diff options
author | Dan Williams <dcbw@redhat.com> | 2013-11-08 00:35:42 -0600 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2013-11-08 16:46:45 -0600 |
commit | 0d8015cc98e48d1994ba2c28927818bf930e834b (patch) | |
tree | 0cd913f62ba99c1b41b117c0107f6bae411e2f38 | |
parent | f815b0d31d24bcd1879e49b76ca9e73da7c00aa0 (diff) | |
download | NetworkManager-0d8015cc98e48d1994ba2c28927818bf930e834b.tar.gz |
core: don't generate connections for some devices
If the device has no IP configuration, is not a slave, and is not
a master, there's no point in generating a connection for it and
assuming that connection.
Fixes a problem where tun devices created by vpnc would be activated
with an empty assumed connection before NetworkManager could assign
the VPN IP config to it, and since IPv6 link-local timed out, the tun
device would be deactivated and VPN would be useless.
-rw-r--r-- | src/devices/nm-device.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 067c5acb04..ead8568cac 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -1653,6 +1653,7 @@ nm_device_generate_connection (NMDevice *device) gs_free char *uuid = NULL; gs_free char *name = NULL; int master_ifindex = 0; + const char *ip4_method, *ip6_method; /* If update_connection() is not implemented, just fail. */ if (!klass->update_connection) @@ -1731,6 +1732,19 @@ nm_device_generate_connection (NMDevice *device) /* Check the connection in case of update_connection() bug. */ g_return_val_if_fail (nm_connection_verify (connection, NULL), NULL); + /* Ignore the connection if it has no IP configuration, + * no slave configuration, and is not a master interface. + */ + ip4_method = nm_setting_ip4_config_get_method (NM_SETTING_IP4_CONFIG (s_ip4)); + ip6_method = nm_setting_ip6_config_get_method (NM_SETTING_IP6_CONFIG (s_ip6)); + if ( strcmp (ip4_method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0 + && strcmp (ip6_method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) == 0 + && !nm_setting_connection_get_master (NM_SETTING_CONNECTION (s_con)) + && !nm_platform_link_supports_slaves (priv->ifindex)) { + g_object_unref (connection); + connection = NULL; + } + return connection; } |