Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 Move default interface things from nd6_rtr.c to...
details: https://anonhg.NetBSD.org/src/rev/730625e73968
branches: trunk
changeset: 349467:730625e73968
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Sun Dec 11 07:37:53 2016 +0000
description:
Move default interface things from nd6_rtr.c to nd6.c
diffstat:
sys/netinet6/nd6.c | 38 ++++++++++++++++++++++++++++++++++++--
sys/netinet6/nd6.h | 4 +---
sys/netinet6/nd6_rtr.c | 36 ++----------------------------------
3 files changed, 39 insertions(+), 39 deletions(-)
diffs (149 lines):
diff -r 8acced3d2481 -r 730625e73968 sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c Sun Dec 11 07:36:55 2016 +0000
+++ b/sys/netinet6/nd6.c Sun Dec 11 07:37:53 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6.c,v 1.211 2016/11/14 02:34:19 ozaki-r Exp $ */
+/* $NetBSD: nd6.c,v 1.212 2016/12/11 07:37:53 ozaki-r Exp $ */
/* $KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.211 2016/11/14 02:34:19 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.212 2016/12/11 07:37:53 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h"
@@ -125,6 +125,11 @@
static int fill_drlist(void *, size_t *, size_t);
static int fill_prlist(void *, size_t *, size_t);
+static struct ifnet *nd6_defifp;
+static int nd6_defifindex;
+
+static int nd6_setdefaultiface(int);
+
MALLOC_DEFINE(M_IP6NDP, "NDP", "IPv6 Neighbour Discovery");
void
@@ -2780,3 +2785,32 @@
return error;
}
+
+static int
+nd6_setdefaultiface(int ifindex)
+{
+ ifnet_t *ifp;
+ int error = 0;
+ int s;
+
+ s = pserialize_read_enter();
+ ifp = if_byindex(ifindex);
+ if (ifp == NULL) {
+ pserialize_read_exit(s);
+ return EINVAL;
+ }
+ if (nd6_defifindex != ifindex) {
+ nd6_defifindex = ifindex;
+ nd6_defifp = nd6_defifindex > 0 ? ifp : NULL;
+
+ /*
+ * Our current implementation assumes one-to-one maping between
+ * interfaces and links, so it would be natural to use the
+ * default interface as the default link.
+ */
+ scope6_setdefault(nd6_defifp);
+ }
+ pserialize_read_exit(s);
+
+ return (error);
+}
diff -r 8acced3d2481 -r 730625e73968 sys/netinet6/nd6.h
--- a/sys/netinet6/nd6.h Sun Dec 11 07:36:55 2016 +0000
+++ b/sys/netinet6/nd6.h Sun Dec 11 07:37:53 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6.h,v 1.74 2016/12/11 07:36:55 ozaki-r Exp $ */
+/* $NetBSD: nd6.h,v 1.75 2016/12/11 07:37:53 ozaki-r Exp $ */
/* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */
/*
@@ -354,7 +354,6 @@
do { if (nd6_debug) log(level, "%s: " fmt, __func__, ##args);} while (0)
/* nd6_rtr.c */
-extern int nd6_defifindex;
extern int ip6_desync_factor; /* seconds */
extern u_int32_t ip6_temp_preferred_lifetime; /* seconds */
extern u_int32_t ip6_temp_valid_lifetime; /* seconds */
@@ -441,7 +440,6 @@
void pfxlist_onlink_check(void);
struct nd_defrouter *defrouter_lookup(const struct in6_addr *, struct ifnet *);
void rt6_flush(struct in6_addr *, struct ifnet *);
-int nd6_setdefaultiface(int);
int in6_tmpifadd(const struct in6_ifaddr *, int, int);
bool nd6_accepts_rtadv(const struct nd_ifinfo *);
diff -r 8acced3d2481 -r 730625e73968 sys/netinet6/nd6_rtr.c
--- a/sys/netinet6/nd6_rtr.c Sun Dec 11 07:36:55 2016 +0000
+++ b/sys/netinet6/nd6_rtr.c Sun Dec 11 07:37:53 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6_rtr.c,v 1.121 2016/12/11 07:36:55 ozaki-r Exp $ */
+/* $NetBSD: nd6_rtr.c,v 1.122 2016/12/11 07:37:53 ozaki-r Exp $ */
/* $KAME: nd6_rtr.c,v 1.95 2001/02/07 08:09:47 itojun Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.121 2016/12/11 07:36:55 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.122 2016/12/11 07:37:53 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -92,9 +92,6 @@
extern int nd6_recalc_reachtm_interval;
-static struct ifnet *nd6_defifp;
-int nd6_defifindex;
-
int ip6_use_tempaddr = 0;
int ip6_desync_factor;
@@ -2203,32 +2200,3 @@
return 1;
}
-
-int
-nd6_setdefaultiface(int ifindex)
-{
- ifnet_t *ifp;
- int error = 0;
- int s;
-
- s = pserialize_read_enter();
- ifp = if_byindex(ifindex);
- if (ifp == NULL) {
- pserialize_read_exit(s);
- return EINVAL;
- }
- if (nd6_defifindex != ifindex) {
- nd6_defifindex = ifindex;
- nd6_defifp = nd6_defifindex > 0 ? ifp : NULL;
-
- /*
- * Our current implementation assumes one-to-one maping between
- * interfaces and links, so it would be natural to use the
- * default interface as the default link.
- */
- scope6_setdefault(nd6_defifp);
- }
- pserialize_read_exit(s);
-
- return (error);
-}
Home |
Main Index |
Thread Index |
Old Index