Module Name: src
Committed By: ozaki-r
Date: Fri Jun 1 07:16:24 UTC 2018
Modified Files:
src/sys/net: if.c
Log Message:
Make sure to remove all AF_LINK addresses in if_detach
To generate a diff of this commit:
cvs rdiff -u -r1.426 -r1.427 src/sys/net/if.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.426 src/sys/net/if.c:1.427
--- src/sys/net/if.c:1.426 Fri Jun 1 07:14:13 2018
+++ src/sys/net/if.c Fri Jun 1 07:16:23 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.426 2018/06/01 07:14:13 ozaki-r Exp $ */
+/* $NetBSD: if.c,v 1.427 2018/06/01 07:16:23 ozaki-r Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.426 2018/06/01 07:14:13 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.427 2018/06/01 07:16:23 ozaki-r Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -1405,6 +1405,14 @@ again:
if_free_sadl(ifp, 1);
+restart:
+ IFADDR_WRITER_FOREACH(ifa, ifp) {
+ family = ifa->ifa_addr->sa_family;
+ KASSERT(family == AF_LINK);
+ ifa_remove(ifp, ifa);
+ goto restart;
+ }
+
/* Delete stray routes from the routing table. */
for (i = 0; i <= AF_MAX; i++)
rt_delete_matched_entries(i, if_delroute_matcher, ifp);