device: get_connection_parent() accept incomplete connections
All of these are wrong asserting that a connection has a particular setting. On AddAndActivate, the connection can be pretty much empty: impl_manager_add_and_activate_connection () validate_activation_request () nm_manager_get_best_device_for_connection () iface = nm_manager_get_connection_iface () find_parent_device_for_connection () nm_device_factory_get_connection_parent () <====== *shriek* nm_device_factory_get_connection_iface () find_device_by_iface (iface) nm_device_complete_connection () Remove those assertions.
This commit is contained in:
@@ -276,9 +276,10 @@ get_connection_parent(NMDeviceFactory *factory, NMConnection *connection)
|
|||||||
g_return_val_if_fail(nm_connection_is_type(connection, NM_SETTING_6LOWPAN_SETTING_NAME), NULL);
|
g_return_val_if_fail(nm_connection_is_type(connection, NM_SETTING_6LOWPAN_SETTING_NAME), NULL);
|
||||||
|
|
||||||
s_6lowpan = NM_SETTING_6LOWPAN(nm_connection_get_setting(connection, NM_TYPE_SETTING_6LOWPAN));
|
s_6lowpan = NM_SETTING_6LOWPAN(nm_connection_get_setting(connection, NM_TYPE_SETTING_6LOWPAN));
|
||||||
g_assert(s_6lowpan);
|
if (s_6lowpan)
|
||||||
|
return nm_setting_6lowpan_get_parent(s_6lowpan);
|
||||||
return nm_setting_6lowpan_get_parent(s_6lowpan);
|
else
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
NM_DEVICE_FACTORY_DEFINE_INTERNAL(
|
NM_DEVICE_FACTORY_DEFINE_INTERNAL(
|
||||||
|
@@ -464,9 +464,10 @@ get_connection_parent(NMDeviceFactory *factory, NMConnection *connection)
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
s_infiniband = nm_connection_get_setting_infiniband(connection);
|
s_infiniband = nm_connection_get_setting_infiniband(connection);
|
||||||
g_assert(s_infiniband);
|
if (s_infiniband)
|
||||||
|
return nm_setting_infiniband_get_parent(s_infiniband);
|
||||||
return nm_setting_infiniband_get_parent(s_infiniband);
|
else
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
@@ -1369,9 +1369,10 @@ get_connection_parent(NMDeviceFactory *factory, NMConnection *connection)
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
s_ip_tunnel = nm_connection_get_setting_ip_tunnel(connection);
|
s_ip_tunnel = nm_connection_get_setting_ip_tunnel(connection);
|
||||||
g_assert(s_ip_tunnel);
|
if (s_ip_tunnel)
|
||||||
|
return nm_setting_ip_tunnel_get_parent(s_ip_tunnel);
|
||||||
return nm_setting_ip_tunnel_get_parent(s_ip_tunnel);
|
else
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
NM_DEVICE_FACTORY_DEFINE_INTERNAL(
|
NM_DEVICE_FACTORY_DEFINE_INTERNAL(
|
||||||
|
@@ -444,18 +444,18 @@ get_connection_parent(NMDeviceFactory *factory, NMConnection *connection)
|
|||||||
g_return_val_if_fail(nm_connection_is_type(connection, NM_SETTING_IPVLAN_SETTING_NAME), NULL);
|
g_return_val_if_fail(nm_connection_is_type(connection, NM_SETTING_IPVLAN_SETTING_NAME), NULL);
|
||||||
|
|
||||||
s_ipvlan = _nm_connection_get_setting(connection, NM_TYPE_SETTING_IPVLAN);
|
s_ipvlan = _nm_connection_get_setting(connection, NM_TYPE_SETTING_IPVLAN);
|
||||||
nm_assert(s_ipvlan);
|
if (s_ipvlan) {
|
||||||
|
parent = nm_setting_ipvlan_get_parent(s_ipvlan);
|
||||||
parent = nm_setting_ipvlan_get_parent(s_ipvlan);
|
if (parent)
|
||||||
if (parent)
|
return parent;
|
||||||
return parent;
|
}
|
||||||
|
|
||||||
/* Try the hardware address from the IPVLAN connection's hardware setting */
|
/* Try the hardware address from the IPVLAN connection's hardware setting */
|
||||||
s_wired = nm_connection_get_setting_wired(connection);
|
s_wired = nm_connection_get_setting_wired(connection);
|
||||||
if (s_wired)
|
if (s_wired)
|
||||||
return nm_setting_wired_get_mac_address(s_wired);
|
return nm_setting_wired_get_mac_address(s_wired);
|
||||||
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
NM_DEVICE_FACTORY_DEFINE_INTERNAL(
|
NM_DEVICE_FACTORY_DEFINE_INTERNAL(
|
||||||
|
@@ -1022,18 +1022,18 @@ get_connection_parent(NMDeviceFactory *factory, NMConnection *connection)
|
|||||||
g_return_val_if_fail(nm_connection_is_type(connection, NM_SETTING_MACSEC_SETTING_NAME), NULL);
|
g_return_val_if_fail(nm_connection_is_type(connection, NM_SETTING_MACSEC_SETTING_NAME), NULL);
|
||||||
|
|
||||||
s_macsec = nm_connection_get_setting_macsec(connection);
|
s_macsec = nm_connection_get_setting_macsec(connection);
|
||||||
g_assert(s_macsec);
|
if (s_macsec) {
|
||||||
|
parent = nm_setting_macsec_get_parent(s_macsec);
|
||||||
parent = nm_setting_macsec_get_parent(s_macsec);
|
if (parent)
|
||||||
if (parent)
|
return parent;
|
||||||
return parent;
|
}
|
||||||
|
|
||||||
/* Try the hardware address from the MACsec connection's hardware setting */
|
/* Try the hardware address from the MACsec connection's hardware setting */
|
||||||
s_wired = nm_connection_get_setting_wired(connection);
|
s_wired = nm_connection_get_setting_wired(connection);
|
||||||
if (s_wired)
|
if (s_wired)
|
||||||
return nm_setting_wired_get_mac_address(s_wired);
|
return nm_setting_wired_get_mac_address(s_wired);
|
||||||
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
NM_DEVICE_FACTORY_DEFINE_INTERNAL(
|
NM_DEVICE_FACTORY_DEFINE_INTERNAL(
|
||||||
|
@@ -590,18 +590,18 @@ get_connection_parent(NMDeviceFactory *factory, NMConnection *connection)
|
|||||||
g_return_val_if_fail(nm_connection_is_type(connection, NM_SETTING_MACVLAN_SETTING_NAME), NULL);
|
g_return_val_if_fail(nm_connection_is_type(connection, NM_SETTING_MACVLAN_SETTING_NAME), NULL);
|
||||||
|
|
||||||
s_macvlan = nm_connection_get_setting_macvlan(connection);
|
s_macvlan = nm_connection_get_setting_macvlan(connection);
|
||||||
g_assert(s_macvlan);
|
if (s_macvlan) {
|
||||||
|
parent = nm_setting_macvlan_get_parent(s_macvlan);
|
||||||
parent = nm_setting_macvlan_get_parent(s_macvlan);
|
if (parent)
|
||||||
if (parent)
|
return parent;
|
||||||
return parent;
|
}
|
||||||
|
|
||||||
/* Try the hardware address from the MACVLAN connection's hardware setting */
|
/* Try the hardware address from the MACVLAN connection's hardware setting */
|
||||||
s_wired = nm_connection_get_setting_wired(connection);
|
s_wired = nm_connection_get_setting_wired(connection);
|
||||||
if (s_wired)
|
if (s_wired)
|
||||||
return nm_setting_wired_get_mac_address(s_wired);
|
return nm_setting_wired_get_mac_address(s_wired);
|
||||||
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
NM_DEVICE_FACTORY_DEFINE_INTERNAL(
|
NM_DEVICE_FACTORY_DEFINE_INTERNAL(
|
||||||
|
@@ -380,9 +380,10 @@ get_connection_parent(NMDeviceFactory *factory, NMConnection *connection)
|
|||||||
nm_assert(nm_connection_is_type(connection, NM_SETTING_PPPOE_SETTING_NAME));
|
nm_assert(nm_connection_is_type(connection, NM_SETTING_PPPOE_SETTING_NAME));
|
||||||
|
|
||||||
s_pppoe = nm_connection_get_setting_pppoe(connection);
|
s_pppoe = nm_connection_get_setting_pppoe(connection);
|
||||||
nm_assert(s_pppoe);
|
if (s_pppoe)
|
||||||
|
return nm_setting_pppoe_get_parent(s_pppoe);
|
||||||
return nm_setting_pppoe_get_parent(s_pppoe);
|
else
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
NM_DEVICE_FACTORY_DEFINE_INTERNAL(
|
NM_DEVICE_FACTORY_DEFINE_INTERNAL(
|
||||||
|
@@ -618,18 +618,18 @@ get_connection_parent(NMDeviceFactory *factory, NMConnection *connection)
|
|||||||
g_return_val_if_fail(nm_connection_is_type(connection, NM_SETTING_VLAN_SETTING_NAME), NULL);
|
g_return_val_if_fail(nm_connection_is_type(connection, NM_SETTING_VLAN_SETTING_NAME), NULL);
|
||||||
|
|
||||||
s_vlan = nm_connection_get_setting_vlan(connection);
|
s_vlan = nm_connection_get_setting_vlan(connection);
|
||||||
g_assert(s_vlan);
|
if (s_vlan) {
|
||||||
|
parent = nm_setting_vlan_get_parent(s_vlan);
|
||||||
parent = nm_setting_vlan_get_parent(s_vlan);
|
if (parent)
|
||||||
if (parent)
|
return parent;
|
||||||
return parent;
|
}
|
||||||
|
|
||||||
/* Try the hardware address from the VLAN connection's hardware setting */
|
/* Try the hardware address from the VLAN connection's hardware setting */
|
||||||
s_wired = nm_connection_get_setting_wired(connection);
|
s_wired = nm_connection_get_setting_wired(connection);
|
||||||
if (s_wired)
|
if (s_wired)
|
||||||
return nm_setting_wired_get_mac_address(s_wired);
|
return nm_setting_wired_get_mac_address(s_wired);
|
||||||
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
@@ -777,9 +777,10 @@ get_connection_parent(NMDeviceFactory *factory, NMConnection *connection)
|
|||||||
g_return_val_if_fail(nm_connection_is_type(connection, NM_SETTING_VXLAN_SETTING_NAME), NULL);
|
g_return_val_if_fail(nm_connection_is_type(connection, NM_SETTING_VXLAN_SETTING_NAME), NULL);
|
||||||
|
|
||||||
s_vxlan = nm_connection_get_setting_vxlan(connection);
|
s_vxlan = nm_connection_get_setting_vxlan(connection);
|
||||||
g_assert(s_vxlan);
|
if (s_vxlan)
|
||||||
|
return nm_setting_vxlan_get_parent(s_vxlan);
|
||||||
return nm_setting_vxlan_get_parent(s_vxlan);
|
else
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
NM_DEVICE_FACTORY_DEFINE_INTERNAL(
|
NM_DEVICE_FACTORY_DEFINE_INTERNAL(
|
||||||
|
Reference in New Issue
Block a user