diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2019-12-11 11:57:33 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2019-12-13 14:52:15 +0100 |
commit | 4e59cdf5455ce007b79ca9367f6de900afd2fceb (patch) | |
tree | 7905e4bd13e8906d16d85d25bfe0be79236e23f2 | |
parent | ba53ba722a9dbbec7f975b3e6e5154ed4434bc5f (diff) | |
download | NetworkManager-bg/ovs-interface-state-rh1781165.tar.gz |
device: don't reapply IP configuration if the ifindex is missingbg/ovs-interface-state-rh1781165
Assertions will fail in ip_config_merge_and_apply() if the device
doesn't have an ifindex. Reproducible with:
$ nmcli connection add type ovs-bridge ifname ovs0 ipv4.method disabled ipv6.method disabled
Connection 'ovs-bridge-ovs0' (1d5e794b-10ad-4b2b-aa7c-5ca7e34b0a55) successfully added
$ nmcli device reapply ovs0
Error: Reapplying connection to device '(null)' (/org/freedesktop/NetworkManager/Devices/16) failed: Remote peer disconnected
$ journalctl -u NetworkManager -e
...
localhost NetworkManager[73824]: nm_ip4_config_add_dependent_routes: assertion 'ifindex > 0' failed
localhost systemd[1]: NetworkManager.service: Main process exited, code=dumped, status=5/TRAP
..
-rw-r--r-- | src/devices/nm-device.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 3b595938df..e7a4a059a0 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -11615,7 +11615,8 @@ nm_device_reactivate_ip4_config (NMDevice *self, } } - if (!ip_config_merge_and_apply (self, AF_INET, TRUE)) + if ( nm_device_get_ip_ifindex (self) > 0 + && !ip_config_merge_and_apply (self, AF_INET, TRUE)) _LOGW (LOGD_IP4, "Failed to reapply IPv4 configuration"); } } @@ -11688,7 +11689,8 @@ nm_device_reactivate_ip6_config (NMDevice *self, } } - if (!ip_config_merge_and_apply (self, AF_INET6, TRUE)) + if ( nm_device_get_ip_ifindex (self) > 0 + && !ip_config_merge_and_apply (self, AF_INET6, TRUE)) _LOGW (LOGD_IP4, "Failed to reapply IPv6 configuration"); } } |