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
1 changed files with 10 additions and 14 deletions

View File

@ -504,26 +504,20 @@ static void netconfig_ifaddr_del_cmd_cb(int error, uint16_t type,
const void *data, uint32_t len,
void *user_data)
{
struct netconfig *netconfig;
if (error == -ENODEV)
/* The device is unplugged, we are done. */
return;
if (error) {
l_error("netconfig: Failed to delete IP address. "
"Error %d: %s", error, strerror(-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;
}
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);
l_error("netconfig: Failed to delete IP address. "
"Error %d: %s", error, strerror(-error));
}
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 */
resolve_remove(netconfig->ifindex);
break;
case STATION_STATE_ROAMING:
break;