device: commit the l3cd changes via l3cfg during cleanup

After the first time committing, the routes and addresses are removed
directly by bypassing the l3cfg in `nm_device_cleanup()`, then when
committing the second time, the l3cfg think that some addresses are
still configured but they are actually already disappeared from the
kernel already.

To fix it, commit the l3cd changes through l3cfg instead of removing
the addresses/routes directly.
This commit is contained in:
Wen Liang 2022-02-15 14:00:18 -05:00
parent 59c60cccf5
commit 9f6114afe8

View file

@ -15079,8 +15079,7 @@ nm_device_cleanup(NMDevice *self, NMDeviceStateReason reason, CleanupType cleanu
if (ifindex > 0) { if (ifindex > 0) {
NMPlatform *platform = nm_device_get_platform(self); NMPlatform *platform = nm_device_get_platform(self);
nm_platform_ip_route_flush(platform, AF_UNSPEC, ifindex); nm_device_l3cfg_commit(self, NM_L3_CFG_COMMIT_TYPE_REAPPLY, TRUE);
nm_platform_ip_address_flush(platform, AF_UNSPEC, ifindex);
if (nm_device_get_applied_setting(self, NM_TYPE_SETTING_TC_CONFIG)) { if (nm_device_get_applied_setting(self, NM_TYPE_SETTING_TC_CONFIG)) {
nm_platform_tc_sync(platform, ifindex, NULL, NULL); nm_platform_tc_sync(platform, ifindex, NULL, NULL);