Source-Changes-HG archive

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

[src/trunk]: src Purge all related L2 caches on removing a route



details:   https://anonhg.NetBSD.org/src/rev/46aa17ce32a5
branches:  trunk
changeset: 354581:46aa17ce32a5
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Thu Jun 22 09:56:48 2017 +0000

description:
Purge all related L2 caches on removing a route

The change addresses situations similar to PR 51179.

diffstat:

 sys/net/if_llatbl.c   |   6 +++---
 sys/net/if_llatbl.h   |   6 +++---
 sys/net/route.c       |  11 +++++++++--
 tests/net/ndp/t_ra.sh |   4 +---
 4 files changed, 16 insertions(+), 11 deletions(-)

diffs (104 lines):

diff -r a41cbac45eb1 -r 46aa17ce32a5 sys/net/if_llatbl.c
--- a/sys/net/if_llatbl.c       Thu Jun 22 09:53:24 2017 +0000
+++ b/sys/net/if_llatbl.c       Thu Jun 22 09:56:48 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_llatbl.c,v 1.18 2017/03/03 06:27:20 msaitoh Exp $   */
+/*     $NetBSD: if_llatbl.c,v 1.19 2017/06/22 09:56:48 ozaki-r Exp $   */
 /*
  * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
  * Copyright (c) 2004-2008 Qing Li. All rights reserved.
@@ -486,8 +486,8 @@
 }
 
 void
-lltable_prefix_free(int af, struct sockaddr *prefix, struct sockaddr *mask,
-    u_int flags)
+lltable_prefix_free(const int af, const struct sockaddr *prefix,
+    const struct sockaddr *mask, const u_int flags)
 {
        struct lltable *llt;
 
diff -r a41cbac45eb1 -r 46aa17ce32a5 sys/net/if_llatbl.h
--- a/sys/net/if_llatbl.h       Thu Jun 22 09:53:24 2017 +0000
+++ b/sys/net/if_llatbl.h       Thu Jun 22 09:56:48 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_llatbl.h,v 1.10 2016/12/21 08:47:02 ozaki-r Exp $   */
+/*     $NetBSD: if_llatbl.h,v 1.11 2017/06/22 09:56:48 ozaki-r Exp $   */
 /*
  * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
  * Copyright (c) 2004-2008 Qing Li. All rights reserved.
@@ -254,8 +254,8 @@
 struct lltable *lltable_allocate_htbl(uint32_t hsize);
 void           lltable_free(struct lltable *);
 void           lltable_link(struct lltable *llt);
-void           lltable_prefix_free(int, struct sockaddr *,
-                   struct sockaddr *, u_int);
+void           lltable_prefix_free(const int, const struct sockaddr *,
+                   const struct sockaddr *, const u_int);
 void           lltable_drain(int);
 void           lltable_purge_entries(struct lltable *);
 int            lltable_sysctl_dumparp(int, struct rt_walkarg *);
diff -r a41cbac45eb1 -r 46aa17ce32a5 sys/net/route.c
--- a/sys/net/route.c   Thu Jun 22 09:53:24 2017 +0000
+++ b/sys/net/route.c   Thu Jun 22 09:56:48 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.c,v 1.195 2017/06/22 08:31:54 ozaki-r Exp $      */
+/*     $NetBSD: route.c,v 1.196 2017/06/22 09:56:48 ozaki-r Exp $      */
 
 /*-
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.195 2017/06/22 08:31:54 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.196 2017/06/22 09:56:48 ozaki-r Exp $");
 
 #include <sys/param.h>
 #ifdef RTFLUSH_DEBUG
@@ -123,6 +123,9 @@
 #include <net/if.h>
 #include <net/if_dl.h>
 #include <net/route.h>
+#if defined(INET) || defined(INET6)
+#include <net/if_llatbl.h>
+#endif
 
 #include <netinet/in.h>
 #include <netinet/in_var.h>
@@ -1249,6 +1252,10 @@
                need_unlock = false;
                rt_timer_remove_all(rt);
                rtcache_clear_rtentry(dst->sa_family, rt);
+#if defined(INET) || defined(INET6)
+               if (netmask != NULL)
+                       lltable_prefix_free(dst->sa_family, dst, netmask, 0);
+#endif
                if (ret_nrt == NULL) {
                        /* Adjust the refcount */
                        rt_ref(rt);
diff -r a41cbac45eb1 -r 46aa17ce32a5 tests/net/ndp/t_ra.sh
--- a/tests/net/ndp/t_ra.sh     Thu Jun 22 09:53:24 2017 +0000
+++ b/tests/net/ndp/t_ra.sh     Thu Jun 22 09:56:48 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: t_ra.sh,v 1.28 2017/06/21 09:05:31 ozaki-r Exp $
+#      $NetBSD: t_ra.sh,v 1.29 2017/06/22 09:56:48 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -334,7 +334,6 @@
        atf_check -s exit:0 -o empty rump.ndp -r
        atf_check -s exit:0 -o match:'No advertising router' rump.ndp -p
        atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0
-       atf_check -s exit:0 -o match:"$ONEDAYISH S R" rump.ndp -n -a
        atf_check -s exit:0 -o not-match:'fc00:1:' rump.ndp -n -a
        atf_check -s exit:0 -o match:'fc00:1:' rump.ifconfig shmif0 inet6
        unset RUMP_SERVER
@@ -762,7 +761,6 @@
        atf_check -s exit:0 -o not-match:'if=shmif0' rump.ndp -r
        atf_check -s exit:0 -o match:'No advertising router' rump.ndp -p
        atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0
-       atf_check -s exit:0 -o match:"$ONEDAYISH S R" rump.ndp -n -a
        atf_check -s exit:0 -o not-match:'fc00:1:' rump.ndp -n -a
        atf_check -s exit:0 -o match:'fc00:1:' rump.ifconfig shmif0 inet6
        unset RUMP_SERVER



Home | Main Index | Thread Index | Old Index