From a1659adec06476be7516eefe6f0066a2545841ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20=C5=A0imerda?= Date: Tue, 19 Jun 2012 18:45:49 +0200 Subject: [PATCH] ip4: fix connection assumption --- src/nm-device.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/nm-device.c b/src/nm-device.c index 6eaa94da41..1c84ec1a07 100644 --- a/src/nm-device.c +++ b/src/nm-device.c @@ -4687,8 +4687,6 @@ ip4_match_config (NMDevice *self, NMConnection *connection) const char *method; s_ip4 = nm_connection_get_setting_ip4_config (connection); - if (!s_ip4) - return FALSE; /* Get any saved leases that apply to this connection */ dhcp_mgr = nm_dhcp_manager_get (); @@ -4697,7 +4695,7 @@ ip4_match_config (NMDevice *self, NMConnection *connection) nm_connection_get_uuid (connection)); g_object_unref (dhcp_mgr); - method = nm_setting_ip4_config_get_method (s_ip4); + method = s_ip4 ? nm_setting_ip4_config_get_method (s_ip4) : NM_SETTING_IP4_CONFIG_METHOD_AUTO; if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) { gboolean found = FALSE; @@ -4740,16 +4738,18 @@ ip4_match_config (NMDevice *self, NMConnection *connection) /* Everything below for static addressing */ /* Find all IP4 addresses of this connection on the device */ - num = nm_setting_ip4_config_get_num_addresses (s_ip4); - for (i = 0; i < num; i++) { - NMIP4Address *addr = nm_setting_ip4_config_get_address (s_ip4, i); - struct in_addr tmp = { .s_addr = nm_ip4_address_get_address (addr) }; + if (s_ip4) { + num = nm_setting_ip4_config_get_num_addresses (s_ip4); + for (i = 0; i < num; i++) { + NMIP4Address *addr = nm_setting_ip4_config_get_address (s_ip4, i); + struct in_addr tmp = { .s_addr = nm_ip4_address_get_address (addr) }; - if (!nm_netlink_find_address (nm_device_get_ip_ifindex (self), - AF_INET, - &tmp, - nm_ip4_address_get_prefix (addr))) - return FALSE; + if (!nm_netlink_find_address (nm_device_get_ip_ifindex (self), + AF_INET, + &tmp, + nm_ip4_address_get_prefix (addr))) + return FALSE; + } } /* Success; all the connection's static IP addresses are assigned to the device */