code: plan9front

Download patch

ref: f3ee0648020f1c566920b26d33be65665a2c179c
parent: c91e9322f1f76fa86db69ade780110664750408d
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jun 9 09:02:06 EDT 2024

ip/ipconfig: ask devip to delete expired ipv6 prefixes (thanks arne)

In addition to removing expired default routes,
ask devip to clean out expired addresses as well.

In the future, devip might do something more
sophisticated than just checking the valid life time
like also considering if the address is still begin
used by active connections.

--- a/sys/src/cmd/ip/ipconfig/ipv6.c
+++ b/sys/src/cmd/ip/ipconfig/ipv6.c
@@ -508,6 +508,13 @@
 	free(cfg);
 }
 
+static void
+issuedel6(Conf *cf)
+{
+	/* use "remove6" verb instead of "del6" for older kernels */
+	ewrite(cf->cfd, "remove6");
+}
+
 static int
 masklen(uchar *mask)
 {
@@ -669,7 +676,10 @@
 		m++;
 	}
 
-	/* process prefixes */
+	/* remove expired prefixes */
+	issuedel6(&conf);
+
+	/* process new prefixes */
 	m = sizeof *ra;
 	while(pktlen - m >= 8) {
 		n = m;