mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-04 04:00:17 +01:00
ip4: fix connection assumption
This commit is contained in:
parent
5d87030c26
commit
a1659adec0
1 changed files with 12 additions and 12 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue