Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Use rt_update framework on updating a rtentry
details: https://anonhg.NetBSD.org/src/rev/c0cbcd04d0c8
branches: trunk
changeset: 445451:c0cbcd04d0c8
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Tue Oct 30 05:56:02 2018 +0000
description:
Use rt_update framework on updating a rtentry
diffstat:
sys/net/route.c | 18 ++++++++++++++++--
sys/netinet6/in6.c | 34 ++++++++++++++++++++++++++++++++--
2 files changed, 48 insertions(+), 4 deletions(-)
diffs (106 lines):
diff -r 86c2f45c82be -r c0cbcd04d0c8 sys/net/route.c
--- a/sys/net/route.c Tue Oct 30 05:54:41 2018 +0000
+++ b/sys/net/route.c Tue Oct 30 05:56:02 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: route.c,v 1.215 2018/10/30 05:54:42 ozaki-r Exp $ */
+/* $NetBSD: route.c,v 1.216 2018/10/30 05:56:02 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.215 2018/10/30 05:54:42 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.216 2018/10/30 05:56:02 ozaki-r Exp $");
#include <sys/param.h>
#ifdef RTFLUSH_DEBUG
@@ -1730,7 +1730,21 @@
}
rt_newaddrmsg(RTM_DELADDR, ifa, 0, NULL);
} else {
+#ifdef NET_MPSAFE
+ int error = rt_update_prepare(rt);
+ if (error == 0) {
+ rt_replace_ifa(rt, alt_ifa);
+ rt_update_finish(rt);
+ } else {
+ /*
+ * If error != 0, the rtentry is being
+ * destroyed, so doing nothing doesn't
+ * matter.
+ */
+ }
+#else
rt_replace_ifa(rt, alt_ifa);
+#endif
rt_newmsg(RTM_CHANGE, rt);
}
} else
diff -r 86c2f45c82be -r c0cbcd04d0c8 sys/netinet6/in6.c
--- a/sys/netinet6/in6.c Tue Oct 30 05:54:41 2018 +0000
+++ b/sys/netinet6/in6.c Tue Oct 30 05:56:02 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6.c,v 1.269 2018/07/04 00:35:33 kamil Exp $ */
+/* $NetBSD: in6.c,v 1.270 2018/10/30 05:56:02 ozaki-r Exp $ */
/* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.269 2018/07/04 00:35:33 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.270 2018/10/30 05:56:02 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -867,8 +867,23 @@
ntohs(mltaddr.sin6_addr.s6_addr16[1]),
satocsin6(rt_getkey(rt))->sin6_addr.s6_addr16[0],
satocsin6(rt_getkey(rt))->sin6_addr.s6_addr16[1]);
+#ifdef NET_MPSAFE
+ error = rt_update_prepare(rt);
+ if (error == 0) {
+ rt_replace_ifa(rt, &ia->ia_ifa);
+ rt->rt_ifp = ifp;
+ rt_update_finish(rt);
+ } else {
+ /*
+ * If error != 0, the rtentry is being
+ * destroyed, so doing nothing doesn't
+ * matter.
+ */
+ }
+#else
rt_replace_ifa(rt, &ia->ia_ifa);
rt->rt_ifp = ifp;
+#endif
}
}
if (!rt) {
@@ -951,8 +966,23 @@
ntohs(mltaddr.sin6_addr.s6_addr16[1]),
satocsin6(rt_getkey(rt))->sin6_addr.s6_addr16[0],
satocsin6(rt_getkey(rt))->sin6_addr.s6_addr16[1]);
+#ifdef NET_MPSAFE
+ error = rt_update_prepare(rt);
+ if (error == 0) {
+ rt_replace_ifa(rt, &ia->ia_ifa);
+ rt->rt_ifp = ifp;
+ rt_update_finish(rt);
+ } else {
+ /*
+ * If error != 0, the rtentry is being
+ * destroyed, so doing nothing doesn't
+ * matter.
+ */
+ }
+#else
rt_replace_ifa(rt, &ia->ia_ifa);
rt->rt_ifp = ifp;
+#endif
}
}
if (!rt) {
Home |
Main Index |
Thread Index |
Old Index