Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Purge L2 caches on changing an interface of a route
details: https://anonhg.NetBSD.org/src/rev/e77ff9b2d047
branches: trunk
changeset: 824883:e77ff9b2d047
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Thu Jun 22 09:58:04 2017 +0000
description:
Purge L2 caches on changing an interface of a route
The change addresses situations similar to PR 51179.
diffstat:
sys/net/rtsock.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diffs (57 lines):
diff -r 926e26976ecb -r e77ff9b2d047 sys/net/rtsock.c
--- a/sys/net/rtsock.c Thu Jun 22 09:56:48 2017 +0000
+++ b/sys/net/rtsock.c Thu Jun 22 09:58:04 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rtsock.c,v 1.216 2017/06/16 02:26:17 ozaki-r Exp $ */
+/* $NetBSD: rtsock.c,v 1.217 2017/06/22 09:58:04 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.216 2017/06/16 02:26:17 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.217 2017/06/22 09:58:04 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -641,7 +641,7 @@
struct ifnet *ifp = NULL, *new_ifp;
struct ifaddr *ifa = NULL, *new_ifa;
struct psref psref_ifa, psref_new_ifa, psref_ifp;
- bool newgw;
+ bool newgw, ifp_changed = false;
/*
* New gateway could require new ifaddr, ifp;
@@ -691,13 +691,16 @@
oifa->ifa_rtrequest(RTM_DELETE, rt, info);
rt_replace_ifa(rt, ifa);
rt->rt_ifp = new_ifp;
+ ifp_changed = true;
}
if (new_ifa == NULL)
ifa_release(ifa, &psref_ifa);
}
ifa_release(new_ifa, &psref_new_ifa);
- if (new_ifp && rt->rt_ifp != new_ifp && !if_is_deactivated(new_ifp))
+ if (new_ifp && rt->rt_ifp != new_ifp && !if_is_deactivated(new_ifp)) {
rt->rt_ifp = new_ifp;
+ ifp_changed = true;
+ }
rt_setmetrics(rtm->rtm_inits, rtm, rt);
if (rt->rt_flags != info->rti_flags) {
rt->rt_flags = (info->rti_flags & ~PRESERVED_RTF) |
@@ -705,6 +708,11 @@
}
if (rt->rt_ifa && rt->rt_ifa->ifa_rtrequest)
rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt, info);
+#if defined(INET) || defined(INET6)
+ if (ifp_changed && rt_mask(rt) != NULL)
+ lltable_prefix_free(rt_getkey(rt)->sa_family, rt_getkey(rt),
+ rt_mask(rt), 0);
+#endif
out:
if_put(ifp, &psref_ifp);
Home |
Main Index |
Thread Index |
Old Index