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);
|
||||
|
||||
s_6lowpan = NM_SETTING_6LOWPAN(nm_connection_get_setting(connection, NM_TYPE_SETTING_6LOWPAN));
|
||||
g_assert(s_6lowpan);
|
||||
|
||||
return nm_setting_6lowpan_get_parent(s_6lowpan);
|
||||
if (s_6lowpan)
|
||||
return nm_setting_6lowpan_get_parent(s_6lowpan);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NM_DEVICE_FACTORY_DEFINE_INTERNAL(
|
||||
|
@@ -464,9 +464,10 @@ get_connection_parent(NMDeviceFactory *factory, NMConnection *connection)
|
||||
NULL);
|
||||
|
||||
s_infiniband = nm_connection_get_setting_infiniband(connection);
|
||||
g_assert(s_infiniband);
|
||||
|
||||
return nm_setting_infiniband_get_parent(s_infiniband);
|
||||
if (s_infiniband)
|
||||
return nm_setting_infiniband_get_parent(s_infiniband);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *
|
||||
|
@@ -1369,9 +1369,10 @@ get_connection_parent(NMDeviceFactory *factory, NMConnection *connection)
|
||||
NULL);
|
||||
|
||||
s_ip_tunnel = nm_connection_get_setting_ip_tunnel(connection);
|
||||
g_assert(s_ip_tunnel);
|
||||
|
||||
return nm_setting_ip_tunnel_get_parent(s_ip_tunnel);
|
||||
if (s_ip_tunnel)
|
||||
return nm_setting_ip_tunnel_get_parent(s_ip_tunnel);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
s_ipvlan = _nm_connection_get_setting(connection, NM_TYPE_SETTING_IPVLAN);
|
||||
nm_assert(s_ipvlan);
|
||||
|
||||
parent = nm_setting_ipvlan_get_parent(s_ipvlan);
|
||||
if (parent)
|
||||
return parent;
|
||||
if (s_ipvlan) {
|
||||
parent = nm_setting_ipvlan_get_parent(s_ipvlan);
|
||||
if (parent)
|
||||
return parent;
|
||||
}
|
||||
|
||||
/* Try the hardware address from the IPVLAN connection's hardware setting */
|
||||
s_wired = nm_connection_get_setting_wired(connection);
|
||||
if (s_wired)
|
||||
return nm_setting_wired_get_mac_address(s_wired);
|
||||
|
||||
return NULL;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
s_macsec = nm_connection_get_setting_macsec(connection);
|
||||
g_assert(s_macsec);
|
||||
|
||||
parent = nm_setting_macsec_get_parent(s_macsec);
|
||||
if (parent)
|
||||
return parent;
|
||||
if (s_macsec) {
|
||||
parent = nm_setting_macsec_get_parent(s_macsec);
|
||||
if (parent)
|
||||
return parent;
|
||||
}
|
||||
|
||||
/* Try the hardware address from the MACsec connection's hardware setting */
|
||||
s_wired = nm_connection_get_setting_wired(connection);
|
||||
if (s_wired)
|
||||
return nm_setting_wired_get_mac_address(s_wired);
|
||||
|
||||
return NULL;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
s_macvlan = nm_connection_get_setting_macvlan(connection);
|
||||
g_assert(s_macvlan);
|
||||
|
||||
parent = nm_setting_macvlan_get_parent(s_macvlan);
|
||||
if (parent)
|
||||
return parent;
|
||||
if (s_macvlan) {
|
||||
parent = nm_setting_macvlan_get_parent(s_macvlan);
|
||||
if (parent)
|
||||
return parent;
|
||||
}
|
||||
|
||||
/* Try the hardware address from the MACVLAN connection's hardware setting */
|
||||
s_wired = nm_connection_get_setting_wired(connection);
|
||||
if (s_wired)
|
||||
return nm_setting_wired_get_mac_address(s_wired);
|
||||
|
||||
return NULL;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
s_pppoe = nm_connection_get_setting_pppoe(connection);
|
||||
nm_assert(s_pppoe);
|
||||
|
||||
return nm_setting_pppoe_get_parent(s_pppoe);
|
||||
if (s_pppoe)
|
||||
return nm_setting_pppoe_get_parent(s_pppoe);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
s_vlan = nm_connection_get_setting_vlan(connection);
|
||||
g_assert(s_vlan);
|
||||
|
||||
parent = nm_setting_vlan_get_parent(s_vlan);
|
||||
if (parent)
|
||||
return parent;
|
||||
if (s_vlan) {
|
||||
parent = nm_setting_vlan_get_parent(s_vlan);
|
||||
if (parent)
|
||||
return parent;
|
||||
}
|
||||
|
||||
/* Try the hardware address from the VLAN connection's hardware setting */
|
||||
s_wired = nm_connection_get_setting_wired(connection);
|
||||
if (s_wired)
|
||||
return nm_setting_wired_get_mac_address(s_wired);
|
||||
|
||||
return NULL;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
s_vxlan = nm_connection_get_setting_vxlan(connection);
|
||||
g_assert(s_vxlan);
|
||||
|
||||
return nm_setting_vxlan_get_parent(s_vxlan);
|
||||
if (s_vxlan)
|
||||
return nm_setting_vxlan_get_parent(s_vxlan);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NM_DEVICE_FACTORY_DEFINE_INTERNAL(
|
||||
|
Reference in New Issue
Block a user