Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 Introduce macros for the prefix list
details: https://anonhg.NetBSD.org/src/rev/a6c8c0b71c91
branches: trunk
changeset: 349486:a6c8c0b71c91
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Mon Dec 12 03:14:01 2016 +0000
description:
Introduce macros for the prefix list
No functional change.
diffstat:
sys/netinet6/nd6.c | 18 +++++++++---------
sys/netinet6/nd6.h | 11 ++++++++++-
sys/netinet6/nd6_rtr.c | 26 +++++++++++++-------------
3 files changed, 32 insertions(+), 23 deletions(-)
diffs (223 lines):
diff -r 4e1f0ea877cc -r a6c8c0b71c91 sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c Mon Dec 12 03:13:14 2016 +0000
+++ b/sys/netinet6/nd6.c Mon Dec 12 03:14:01 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6.c,v 1.214 2016/12/12 03:13:14 ozaki-r Exp $ */
+/* $NetBSD: nd6.c,v 1.215 2016/12/12 03:14:01 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.214 2016/12/12 03:13:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.215 2016/12/12 03:14:01 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h"
@@ -692,7 +692,7 @@
curlwp_bindx(bound);
/* expire prefix list */
- LIST_FOREACH_SAFE(pr, &nd_prefix, ndpr_entry, next_pr) {
+ ND_PREFIX_LIST_FOREACH_SAFE(pr, next_pr) {
/*
* check prefix lifetime.
* since pltime is just for autoconf, pltime processing for
@@ -859,7 +859,7 @@
}
/* Nuke prefix list entries toward ifp */
- LIST_FOREACH_SAFE(pr, &nd_prefix, ndpr_entry, npr) {
+ ND_PREFIX_LIST_FOREACH_SAFE(pr, npr) {
if (pr->ndpr_ifp == ifp) {
/*
* Because if_detach() does *not* release prefixes
@@ -981,7 +981,7 @@
* If the address matches one of our on-link prefixes, it should be a
* neighbor.
*/
- LIST_FOREACH(pr, &nd_prefix, ndpr_entry) {
+ ND_PREFIX_LIST_FOREACH(pr) {
if (pr->ndpr_ifp != ifp)
continue;
@@ -1079,7 +1079,7 @@
* If the address matches one of our on-link prefixes, it should be a
* neighbor.
*/
- LIST_FOREACH(pr, &nd_prefix, ndpr_entry) {
+ ND_PREFIX_LIST_FOREACH(pr) {
if (pr->ndpr_ifp != ifp)
continue;
@@ -1647,7 +1647,7 @@
*/
memset(oprl, 0, sizeof(*oprl));
s = splsoftnet();
- LIST_FOREACH(pr, &nd_prefix, ndpr_entry) {
+ ND_PREFIX_LIST_FOREACH(pr) {
struct nd_pfxrouter *pfr;
int j;
@@ -1854,7 +1854,7 @@
struct nd_prefix *pfx, *next;
s = splsoftnet();
- LIST_FOREACH_SAFE(pfx, &nd_prefix, ndpr_entry, next) {
+ ND_PREFIX_LIST_FOREACH_SAFE(pfx, next) {
struct in6_ifaddr *ia, *ia_next;
int _s;
@@ -2696,7 +2696,7 @@
}
l = 0;
- LIST_FOREACH(pr, &nd_prefix, ndpr_entry) {
+ ND_PREFIX_LIST_FOREACH(pr) {
u_short advrtrs;
struct sockaddr_in6 sin6;
struct nd_pfxrouter *pfr;
diff -r 4e1f0ea877cc -r a6c8c0b71c91 sys/netinet6/nd6.h
--- a/sys/netinet6/nd6.h Mon Dec 12 03:13:14 2016 +0000
+++ b/sys/netinet6/nd6.h Mon Dec 12 03:14:01 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6.h,v 1.77 2016/12/12 03:13:14 ozaki-r Exp $ */
+/* $NetBSD: nd6.h,v 1.78 2016/12/12 03:14:01 ozaki-r Exp $ */
/* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */
/*
@@ -321,6 +321,15 @@
#define ndpr_raf_auto ndpr_flags.autonomous
#define ndpr_raf_router ndpr_flags.router
+#define ND_PREFIX_LIST_FOREACH(pr) \
+ LIST_FOREACH((pr), &nd_prefix, ndpr_entry)
+#define ND_PREFIX_LIST_FOREACH_SAFE(pr, pr_next) \
+ LIST_FOREACH_SAFE((pr), &nd_prefix, ndpr_entry, (pr_next))
+#define ND_PREFIX_LIST_REMOVE(pr) \
+ LIST_REMOVE((pr), ndpr_entry)
+#define ND_PREFIX_LIST_INSERT_HEAD(pr) \
+ LIST_INSERT_HEAD(&nd_prefix, (pr), ndpr_entry)
+
/*
* Message format for use in obtaining information about prefixes
* from inet6 sysctl function
diff -r 4e1f0ea877cc -r a6c8c0b71c91 sys/netinet6/nd6_rtr.c
--- a/sys/netinet6/nd6_rtr.c Mon Dec 12 03:13:14 2016 +0000
+++ b/sys/netinet6/nd6_rtr.c Mon Dec 12 03:14:01 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6_rtr.c,v 1.124 2016/12/12 03:13:14 ozaki-r Exp $ */
+/* $NetBSD: nd6_rtr.c,v 1.125 2016/12/12 03:14:01 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.124 2016/12/12 03:13:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.125 2016/12/12 03:14:01 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -528,7 +528,7 @@
/*
* Also delete all the pointers to the router in each prefix lists.
*/
- LIST_FOREACH(pr, &nd_prefix, ndpr_entry) {
+ ND_PREFIX_LIST_FOREACH(pr) {
struct nd_pfxrouter *pfxrtr;
if ((pfxrtr = pfxrtr_lookup(pr, dr)) != NULL)
pfxrtr_del(pfxrtr);
@@ -881,7 +881,7 @@
{
struct nd_prefix *search;
- LIST_FOREACH(search, &nd_prefix, ndpr_entry) {
+ ND_PREFIX_LIST_FOREACH(search) {
if (key->ndprc_ifp == search->ndpr_ifp &&
key->ndprc_plen == search->ndpr_plen &&
in6_are_prefix_equal(&key->ndprc_prefix.sin6_addr,
@@ -983,7 +983,7 @@
s = splsoftnet();
/* link ndpr_entry to nd_prefix list */
- LIST_INSERT_HEAD(&nd_prefix, newpr, ndpr_entry);
+ ND_PREFIX_LIST_INSERT_HEAD(newpr);
splx(s);
/* ND_OPT_PI_FLAG_ONLINK processing */
@@ -1039,7 +1039,7 @@
s = splsoftnet();
/* unlink ndpr_entry from nd_prefix list */
- LIST_REMOVE(pr, ndpr_entry);
+ ND_PREFIX_LIST_REMOVE(pr);
/* free list of routers that adversed the prefix */
for (pfr = LIST_FIRST(&pr->ndpr_advrtrs); pfr != NULL; pfr = next) {
@@ -1454,7 +1454,7 @@
* Check if there is a prefix that has a reachable advertising
* router.
*/
- LIST_FOREACH(pr, &nd_prefix, ndpr_entry) {
+ ND_PREFIX_LIST_FOREACH(pr) {
if (pr->ndpr_raf_onlink && find_pfxlist_reachable_router(pr))
break;
}
@@ -1466,7 +1466,7 @@
ND_DEFROUTER_LIST_FOREACH(dr) {
struct nd_prefix *pr0;
- LIST_FOREACH(pr0, &nd_prefix, ndpr_entry) {
+ ND_PREFIX_LIST_FOREACH(pr0) {
if ((pfxrtr = pfxrtr_lookup(pr0, dr)) != NULL)
break;
}
@@ -1484,7 +1484,7 @@
* Detach prefixes which have no reachable advertising
* router, and attach other prefixes.
*/
- LIST_FOREACH(pr, &nd_prefix, ndpr_entry) {
+ ND_PREFIX_LIST_FOREACH(pr) {
/* XXX: a link-local prefix should never be detached */
if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr))
continue;
@@ -1505,7 +1505,7 @@
}
} else {
/* there is no prefix that has a reachable router */
- LIST_FOREACH(pr, &nd_prefix, ndpr_entry) {
+ ND_PREFIX_LIST_FOREACH(pr) {
if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr))
continue;
@@ -1525,7 +1525,7 @@
* interfaces. Such cases will be handled in nd6_prefix_onlink,
* so we don't have to care about them.
*/
- LIST_FOREACH(pr, &nd_prefix, ndpr_entry) {
+ ND_PREFIX_LIST_FOREACH(pr) {
int e;
if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr))
@@ -1679,7 +1679,7 @@
* Although such a configuration is expected to be rare, we explicitly
* allow it.
*/
- LIST_FOREACH(opr, &nd_prefix, ndpr_entry) {
+ ND_PREFIX_LIST_FOREACH(opr) {
if (opr == pr)
continue;
@@ -1794,7 +1794,7 @@
* If there's one, try to make the prefix on-link on the
* interface.
*/
- LIST_FOREACH(opr, &nd_prefix, ndpr_entry) {
+ ND_PREFIX_LIST_FOREACH(opr) {
if (opr == pr)
continue;
Home |
Main Index |
Thread Index |
Old Index