Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F175832213
D55905.id173828.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D55905.id173828.diff
View Options
diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h
--- a/sys/netinet6/nd6.h
+++ b/sys/netinet6/nd6.h
@@ -155,7 +155,10 @@
/* ND6 queue flags */
#define ND6_QUEUE_FLAG_NEWGUA 0x01 /* new global unicast address event */
#define ND6_QUEUE_FLAG_LLADDR 0x02 /* link-layer address change event */
-#define ND6_QUEUE_FLAG_ANYCAST 0x04 /* delay NA for anycast or proxy address */
+#define ND6_QUEUE_FLAG_ANYCAST 0x04 /* delay NA for anycast address */
+
+/* don't count for GRAND */
+#define ND6_QUEUE_PATH_MASK (ND6_QUEUE_FLAG_ANYCAST)
/* protocol constants */
#define MAX_RTR_SOLICITATION_DELAY 1 /* 1sec */
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -1649,21 +1649,31 @@
}
static void
-nd6_queue_rel(void *arg)
+nd6_queue_rel_locked(struct nd_queue *ndq)
{
- struct nd_queue *ndq = arg;
- struct ifaddr *ifa = ndq->ndq_ifa;
+ struct ifaddr *ifa;
+ ifa = ndq->ndq_ifa;
IF_ADDR_WLOCK_ASSERT(ifa->ifa_ifp);
/* Remove ndq from the nd_queue and free it */
TAILQ_REMOVE(&ifa->ifa_ifp->if_inet6->nd_queue, ndq, ndq_list);
free(ndq, M_IP6NDP);
- IF_ADDR_WUNLOCK(ifa->ifa_ifp);
-
ifa_free(ifa);
}
+static void
+nd6_queue_rel(void *arg)
+{
+ struct nd_queue *ndq = arg;
+ struct ifnet *ifp;
+
+ ifp = ndq->ndq_ifa->ifa_ifp;
+ IF_ADDR_WLOCK_ASSERT(ifp);
+ nd6_queue_rel_locked(ndq);
+ IF_ADDR_WUNLOCK(ifp);
+}
+
static void
nd6_queue_timer(void *arg)
{
@@ -1713,8 +1723,11 @@
flags |= ND_NA_FLAG_SOLICITED;
/* Wait at least a RetransTimer before removing from queue */
- delay = ext->nd_retrans * hz / 1000;
- callout_reset(&ndq->ndq_callout, delay, nd6_queue_rel, ndq);
+ if ((ndq->ndq_flags & ND6_QUEUE_PATH_MASK) != 0) {
+ delay = ext->nd_retrans * hz / 1000;
+ callout_reset(&ndq->ndq_callout, delay, nd6_queue_rel, ndq);
+ } else
+ nd6_queue_rel_locked(ndq);
IF_ADDR_WUNLOCK(ifp);
if (__predict_true(in6_setscope(&daddr, ifp, NULL) == 0))
@@ -1730,36 +1743,36 @@
int delay, uint32_t flags)
{
struct nd_queue *ndq;
- struct ifnet *ifp = ifa->ifa_ifp;
- struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa;
- struct in6_ifextra *ext = ifp->if_inet6;
+ struct ifnet *ifp;
+ struct in6_ifextra *ext;
char ip6buf[INET6_ADDRSTRLEN];
NET_EPOCH_ASSERT();
+ ifp = ifa->ifa_ifp;
+ ext = ifp->if_inet6;
ndq = malloc(sizeof(*ndq), M_IP6NDP, M_NOWAIT | M_ZERO);
if (ndq == NULL) {
log(LOG_ERR, "nd6_queue_add: memory allocation failed for "
- "%s(%s)\n",
- ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr),
+ "%s(%s)\n", ip6_sprintf(ip6buf, IFA_IN6(ifa)),
ifp ? if_name(ifp) : "???");
return;
}
- IF_ADDR_WLOCK(ifa->ifa_ifp);
+ IF_ADDR_WLOCK(ifp);
callout_init_mtx(&ndq->ndq_callout, &ifp->if_addr_lock,
CALLOUT_TRYLOCK | CALLOUT_RETURNUNLOCKED);
nd6log((LOG_DEBUG, "%s: send delayed IPv6 ND for %s\n", if_name(ifp),
- ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr)));
+ ip6_sprintf(ip6buf, IFA_IN6(ifa))));
+ ifa_ref(ifa);
ndq->ndq_ifa = ifa;
- ifa_ref(ndq->ndq_ifa);
memcpy(&ndq->ndq_daddr, daddr, sizeof(struct in6_addr));
ndq->ndq_flags = flags;
TAILQ_INSERT_TAIL(&ext->nd_queue, ndq, ndq_list);
callout_reset(&ndq->ndq_callout, delay, nd6_queue_timer, ndq);
- IF_ADDR_WUNLOCK(ifa->ifa_ifp);
+ IF_ADDR_WUNLOCK(ifp);
}
/*
@@ -1796,6 +1809,9 @@
* Make sure we don't queue GRAND more than V_ip6_grand_count
* per interface.
*/
+ if ((ndq->ndq_flags & ND6_QUEUE_PATH_MASK) == 0)
+ continue;
+
count++;
if (count >= V_ip6_grand_count)
return;
@@ -1825,18 +1841,19 @@
void
nd6_queue_stop(struct ifaddr *ifa)
{
- struct nd_queue *ndq;
+ struct nd_queue *ndq, *dndq;
+ struct ifnet *ifp;
- IF_ADDR_WLOCK(ifa->ifa_ifp);
- TAILQ_FOREACH(ndq, &ifa->ifa_ifp->if_inet6->nd_queue, ndq_list) {
+ ifp = ifa->ifa_ifp;
+ IF_ADDR_WLOCK(ifp);
+ TAILQ_FOREACH_SAFE(ndq, &ifp->if_inet6->nd_queue, ndq_list, dndq) {
if (ndq->ndq_ifa != ifa)
continue;
callout_stop(&ndq->ndq_callout);
- nd6_queue_rel(ndq);
- return;
+ nd6_queue_rel_locked(ndq);
}
- IF_ADDR_WUNLOCK(ifa->ifa_ifp);
+ IF_ADDR_WUNLOCK(ifp);
}
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Oct 14, 5:49 PM (6 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40812103
Default Alt Text
D55905.id173828.diff (4 KB)
Attached To
Mode
D55905: ndp: Accept multiple queued ND for non-GRAND NAs
Attached
Detach File
Event Timeline
Log In to Comment