summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormelifaro <melifaro@FreeBSD.org>2015-08-31 05:03:36 +0000
committermelifaro <melifaro@FreeBSD.org>2015-08-31 05:03:36 +0000
commit3f9699bcfe4422e0ba027d297154a947ac656338 (patch)
tree35b1c562c5d615f690ec265eeecf5ece392b7c3c
parent58e5250bc17f63c7b59be2af81b0e50067fa3415 (diff)
downloadFreeBSD-src-3f9699bcfe4422e0ba027d297154a947ac656338.zip
FreeBSD-src-3f9699bcfe4422e0ba027d297154a947ac656338.tar.gz
Simplify lla_rt_output()/nd6_add_ifa_lle() by setting lle state in
alloc handler, based on flags.
-rw-r--r--sys/net/if_llatbl.c21
-rw-r--r--sys/netinet6/in6.c3
-rw-r--r--sys/netinet6/nd6.c3
3 files changed, 8 insertions, 19 deletions
diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c
index 38f1c1f..1e246d4 100644
--- a/sys/net/if_llatbl.c
+++ b/sys/net/if_llatbl.c
@@ -592,7 +592,10 @@ lla_rt_output(struct rt_msghdr *rtm, struct rt_addrinfo *info)
switch (rtm->rtm_type) {
case RTM_ADD:
/* Add static LLE */
- lle = lltable_alloc_entry(llt, 0, dst);
+ laflags = 0;
+ if (rtm->rtm_rmx.rmx_expire == 0)
+ laflags = LLE_STATIC;
+ lle = lltable_alloc_entry(llt, laflags, dst);
if (lle == NULL)
return (ENOMEM);
@@ -600,22 +603,8 @@ lla_rt_output(struct rt_msghdr *rtm, struct rt_addrinfo *info)
if ((rtm->rtm_flags & RTF_ANNOUNCE))
lle->la_flags |= LLE_PUB;
lle->la_flags |= LLE_VALID;
-#ifdef INET6
- /*
- * ND6
- */
- if (dst->sa_family == AF_INET6)
- lle->ln_state = ND6_LLINFO_REACHABLE;
-#endif
- /*
- * NB: arp and ndp always set (RTF_STATIC | RTF_HOST)
- */
+ lle->la_expire = rtm->rtm_rmx.rmx_expire;
- if (rtm->rtm_rmx.rmx_expire == 0) {
- lle->la_flags |= LLE_STATIC;
- lle->la_expire = 0;
- } else
- lle->la_expire = rtm->rtm_rmx.rmx_expire;
laflags = lle->la_flags;
/* Try to link new entry */
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 75c66a2..0242f8d 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -2264,6 +2264,9 @@ in6_lltable_alloc(struct lltable *llt, u_int flags,
lle->la_flags |= (LLE_VALID | LLE_STATIC);
}
+ if ((lle->la_flags & LLE_STATIC) != 0)
+ lle->ln_state = ND6_LLINFO_REACHABLE;
+
return (lle);
}
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index a5bd5c7..eeb8648 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -2275,9 +2275,6 @@ nd6_add_ifa_lle(struct in6_ifaddr *ia)
if (ln == NULL)
return (ENOBUFS);
- ln->la_expire = 0; /* for IPv6 this means permanent */
- ln->ln_state = ND6_LLINFO_REACHABLE;
-
IF_AFDATA_WLOCK(ifp);
LLE_WLOCK(ln);
/* Unlink any entry if exists */
OpenPOWER on IntegriCloud