3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 23:09:34 +01:00

netconfig: Move removal of DNSs out of IPv4 specific logic

This way resolve_remove can be called once per interface and
remove IPv4 and IPv6 addresses at once.

In addition, this allows to remove the IP addresses and DNS
servers within the same main loop cycle. This will allow iwd
to make an attempt to remove the DNS servers on shutdown of iwd.
This commit is contained in:
Tim Kourt 2019-08-16 11:25:36 -07:00 committed by Denis Kenzior
parent c4771c4c5d
commit e3921193f9

View File

@ -504,26 +504,20 @@ static void netconfig_ifaddr_del_cmd_cb(int error, uint16_t type,
const void *data, uint32_t len, const void *data, uint32_t len,
void *user_data) void *user_data)
{ {
struct netconfig *netconfig;
if (error == -ENODEV) if (error == -ENODEV)
/* The device is unplugged, we are done. */ /* The device is unplugged, we are done. */
return; return;
if (error) { if (!error)
/*
* The kernel removes all of the routes associated with the
* deleted IP on its own. There is no need to explicitly remove
* them.
*/
return;
l_error("netconfig: Failed to delete IP address. " l_error("netconfig: Failed to delete IP address. "
"Error %d: %s", error, strerror(-error)); "Error %d: %s", error, strerror(-error));
return;
}
netconfig = user_data;
/*
* The kernel removes all of the routes associated with the deleted
* IP on its own. There is no need to explicitly remove them.
*/
resolve_remove(netconfig->ifindex);
} }
static void netconfig_uninstall_address(struct netconfig *netconfig, static void netconfig_uninstall_address(struct netconfig *netconfig,
@ -690,6 +684,8 @@ static void netconfig_station_state_changed(enum station_state state,
/* TODO: IPv6 addressing */ /* TODO: IPv6 addressing */
resolve_remove(netconfig->ifindex);
break; break;
case STATION_STATE_ROAMING: case STATION_STATE_ROAMING:
break; break;