From 444491490e654c11bb1f94c5e7db09763783c73a Mon Sep 17 00:00:00 2001 From: Tim Kourt Date: Wed, 2 Oct 2019 13:39:57 -0700 Subject: [PATCH] netconfig: Remove IPv6 default route The IPv6 default route needs to be explicitly revoked. Unlike in IPv4, there is no SRC address associated with the route and it will not be removed on address removal. --- src/netconfig.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/netconfig.c b/src/netconfig.c index 0f99a7c4..f057f62f 100644 --- a/src/netconfig.c +++ b/src/netconfig.c @@ -958,6 +958,7 @@ static void netconfig_ipv6_select_and_install(struct netconfig *netconfig) static void netconfig_ipv6_select_and_uninstall(struct netconfig *netconfig) { struct netconfig_ifaddr *ifaddr; + char *gateway; ifaddr = netconfig_ipv6_get_ifaddr(netconfig, netconfig->rtm_v6_protocol); @@ -970,6 +971,20 @@ static void netconfig_ipv6_select_and_uninstall(struct netconfig *netconfig) * TODO * l_dhcp_v6_client_stop(netconfig->l_dhcp_v6_client); */ + + gateway = netconfig_ipv6_get_gateway(netconfig); + if (!gateway) + return; + + if (!rtnl_route_ipv6_delete_gateway(rtnl, netconfig->ifindex, + gateway, ROUTE_PRIORITY_OFFSET, + netconfig->rtm_v6_protocol, + netconfig_route_cmd_cb, NULL, NULL)) { + l_error("netconfig: Failed to delete route for: %s gateway.", + gateway); + } + + l_free(gateway); } bool netconfig_configure(struct netconfig *netconfig,