Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Make sure to remove all AF_LINK addresses in if_detach



details:   https://anonhg.NetBSD.org/src/rev/b7622157c3d0
branches:  trunk
changeset: 319497:b7622157c3d0
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Fri Jun 01 07:16:23 2018 +0000

description:
Make sure to remove all AF_LINK addresses in if_detach

diffstat:

 sys/net/if.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (33 lines):

diff -r 2d01519f6e63 -r b7622157c3d0 sys/net/if.c
--- a/sys/net/if.c      Fri Jun 01 07:14:13 2018 +0000
+++ b/sys/net/if.c      Fri Jun 01 07:16:23 2018 +0000
@@ -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 @@
 
        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);



Home | Main Index | Thread Index | Old Index