summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2016-04-19 12:02:02 +0200
committerLubomir Rintel <lkundrak@v3.sk>2016-04-19 13:32:28 +0200
commit03584e420f58aafaa2d71408deb2b4603dcc3103 (patch)
tree4b1f741ec37ad5147bb068e290cee90bbe340125
parent7eca706751907c498ff27408aa2e0098205c4bf3 (diff)
downloadNetworkManager-03584e420f58aafaa2d71408deb2b4603dcc3103.tar.gz
device: check for a parent device
The device creation can be attempted if the name can be determined. It alone is doesn't mean that there's a parent device -- the name could just have been hardcoded in the connection. NetworkManager[21519]: nm_device_get_ifindex: assertion 'NM_IS_DEVICE (self)' failed Program received signal SIGTRAP, Trace/breakpoint trap. g_logv (log_domain=0x5555557fb2e5 "NetworkManager", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffd3d0) at gmessages.c:1046 1046 g_private_set (&g_log_depth, GUINT_TO_POINTER (depth)); (gdb) bt #0 0x00007ffff4ec88c3 in g_logv (log_domain=0x5555557fb2e5 "NetworkManager", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffd3d0) at gmessages.c:1046 #1 0x00007ffff4ec8a3f in g_log (log_domain=<optimized out>, log_level=<optimized out>, format=<optimized out>) at gmessages.c:1079 #2 0x00005555555d2090 in nm_device_get_ifindex (self=0x0) at devices/nm-device.c:562 #3 0x00005555555ef77a in nm_device_supports_vlans (self=0x0) at devices/nm-device.c:9865 #4 0x00005555555bf2f9 in create_and_realize (device=0x555555c549b0 [NMDeviceVlan], connection=0x555555b451e0, parent=0x0, out_plink=0x7fffffffd5f8, error=0x7fffffffd700) at devices/nm-device-vlan.c:225 #5 0x00005555555d5757 in nm_device_create_and_realize (self=0x555555c549b0 [NMDeviceVlan], connection=0x555555b451e0, parent=0x0, error=0x7fffffffd700) at devices/nm-device.c:1783 #6 0x0000555555688601 in system_create_virtual_device (self=0x555555af51c0 [NMManager], connection=0x555555b451e0) at nm-manager.c:1120 #7 0x000055555568894e in connection_changed (settings=0x555555ae8220 [NMSettings], connection=0x555555b451e0, manager=0x555555af51c0 [NMManager]) at nm-manager.c:1172 #8 0x0000555555693448 in nm_manager_start (self=0x555555af51c0 [NMManager], error=0x7fffffffda30) at nm-manager.c:4466 #9 0x00005555555d166f in main (argc=1, argv=0x7fffffffdba8) at main.c:454 (gdb) Fixes: 332994f1b19ded7cb343ef573443916bab05aaec
-rw-r--r--src/devices/nm-device-infiniband.c6
-rw-r--r--src/devices/nm-device-macvlan.c6
-rw-r--r--src/devices/nm-device-vlan.c6
3 files changed, 18 insertions, 0 deletions
diff --git a/src/devices/nm-device-infiniband.c b/src/devices/nm-device-infiniband.c
index 5c61d4766c..0465ae36b2 100644
--- a/src/devices/nm-device-infiniband.c
+++ b/src/devices/nm-device-infiniband.c
@@ -250,6 +250,12 @@ create_and_realize (NMDevice *device,
return FALSE;
}
+ if (!parent) {
+ g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED,
+ "InfiniBand partitions can not be created without a parent interface");
+ return FALSE;
+ }
+
if (!NM_IS_DEVICE_INFINIBAND (parent)) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED,
"Parent interface %s must be an InfiniBand interface",
diff --git a/src/devices/nm-device-macvlan.c b/src/devices/nm-device-macvlan.c
index 1360517440..c431fe891c 100644
--- a/src/devices/nm-device-macvlan.c
+++ b/src/devices/nm-device-macvlan.c
@@ -223,6 +223,12 @@ create_and_realize (NMDevice *device,
s_macvlan = nm_connection_get_setting_macvlan (connection);
g_assert (s_macvlan);
+ if (!parent) {
+ g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED,
+ "MACVLAN devices can not be created without a parent interface");
+ return FALSE;
+ }
+
parent_ifindex = nm_device_get_ifindex (parent);
g_warn_if_fail (parent_ifindex > 0);
diff --git a/src/devices/nm-device-vlan.c b/src/devices/nm-device-vlan.c
index ef30bbeb74..eb6527de8e 100644
--- a/src/devices/nm-device-vlan.c
+++ b/src/devices/nm-device-vlan.c
@@ -222,6 +222,12 @@ create_and_realize (NMDevice *device,
s_vlan = nm_connection_get_setting_vlan (connection);
g_assert (s_vlan);
+ if (!parent) {
+ g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED,
+ "VLAN devices can not be created without a parent interface");
+ return FALSE;
+ }
+
if (!nm_device_supports_vlans (parent)) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED,
"no support for VLANs on interface %s of type %s",