Module Name: src Committed By: ozaki-r Date: Thu Jun 22 09:56:48 UTC 2017
Modified Files: src/sys/net: if_llatbl.c if_llatbl.h route.c src/tests/net/ndp: t_ra.sh Log Message: Purge all related L2 caches on removing a route The change addresses situations similar to PR 51179. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/net/if_llatbl.c cvs rdiff -u -r1.10 -r1.11 src/sys/net/if_llatbl.h cvs rdiff -u -r1.195 -r1.196 src/sys/net/route.c cvs rdiff -u -r1.28 -r1.29 src/tests/net/ndp/t_ra.sh 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_llatbl.c diff -u src/sys/net/if_llatbl.c:1.18 src/sys/net/if_llatbl.c:1.19 --- src/sys/net/if_llatbl.c:1.18 Fri Mar 3 06:27:20 2017 +++ src/sys/net/if_llatbl.c Thu Jun 22 09:56:48 2017 @@ -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 @@ lltable_drain(int af) } 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; Index: src/sys/net/if_llatbl.h diff -u src/sys/net/if_llatbl.h:1.10 src/sys/net/if_llatbl.h:1.11 --- src/sys/net/if_llatbl.h:1.10 Wed Dec 21 08:47:02 2016 +++ src/sys/net/if_llatbl.h Thu Jun 22 09:56:48 2017 @@ -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 @@ void lltableinit(void); 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 *); Index: src/sys/net/route.c diff -u src/sys/net/route.c:1.195 src/sys/net/route.c:1.196 --- src/sys/net/route.c:1.195 Thu Jun 22 08:31:54 2017 +++ src/sys/net/route.c Thu Jun 22 09:56:48 2017 @@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: route.c,v 1. #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 @@ rtrequest1(int req, struct rt_addrinfo * 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); Index: src/tests/net/ndp/t_ra.sh diff -u src/tests/net/ndp/t_ra.sh:1.28 src/tests/net/ndp/t_ra.sh:1.29 --- src/tests/net/ndp/t_ra.sh:1.28 Wed Jun 21 09:05:31 2017 +++ src/tests/net/ndp/t_ra.sh Thu Jun 22 09:56:48 2017 @@ -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 @@ ra_flush_defrouter_entries_body() 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 @@ ra_defrouter_expiration_body() 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