Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: Tim Kourt <tim.a.kourt@linux.intel.com>
To: iwd@lists.01.org
Subject: [PATCH 2/4] netconfig: Remove IPv6 default route
Date: Wed, 02 Oct 2019 13:39:57 -0700	[thread overview]
Message-ID: <20191002203959.5582-2-tim.a.kourt@linux.intel.com> (raw)
In-Reply-To: <20191002203959.5582-1-tim.a.kourt@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 1332 bytes --]

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 90cd6bc2..cf951245 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,
-- 
2.13.6

  reply	other threads:[~2019-10-02 20:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-02 20:39 [PATCH 1/4] rtnlutil: Add IPv6 route deletion helper Tim Kourt
2019-10-02 20:39 ` Tim Kourt [this message]
2019-10-02 20:39 ` [PATCH 3/4] netconfig: Optimize IPv4 address deletion Tim Kourt
2019-10-02 20:39 ` [PATCH 4/4] netconfig: Fix return type for module init Tim Kourt
2019-10-03 15:56 ` [PATCH 1/4] rtnlutil: Add IPv6 route deletion helper Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191002203959.5582-2-tim.a.kourt@linux.intel.com \
    --to=tim.a.kourt@linux.intel.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox