summaryrefslogtreecommitdiffstats
path: root/sys/netinet6
diff options
context:
space:
mode:
authormelifaro <melifaro@FreeBSD.org>2015-10-04 12:42:07 +0000
committermelifaro <melifaro@FreeBSD.org>2015-10-04 12:42:07 +0000
commit78672053553cdd4f366badf1c185c7b75d5eb6a5 (patch)
treef6ad3475f63ea22f9e3a6ed2bd34b234c9e0d202 /sys/netinet6
parent707e8db7f896a73ccaf66fc93eb2c33f822c9596 (diff)
downloadFreeBSD-src-78672053553cdd4f366badf1c185c7b75d5eb6a5.zip
FreeBSD-src-78672053553cdd4f366badf1c185c7b75d5eb6a5.tar.gz
Simplify if (lladdr) condition in nd6_cache_lladdr():
For case (7) (new entry) nothing has to be done except lle_event. Invoke this event directly from "create new lle" code block. For case (4) (existing entry, same mac) useless mac update was performed, along with LLENTRY_RESOLVED lle_event. There was no sense in doing that, since nothing really had changed. Simply avoid this condition instead. Given that, condition was simplified to (3),(5) states which can be merged with previous block.
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/nd6.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 6cbe618..4744574 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1753,6 +1753,7 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr,
/* No existing lle, mark as new entry */
is_newentry = 1;
nd6_llinfo_setstate(ln, ND6_LLINFO_STALE);
+ EVENTHANDLER_INVOKE(lle_event, ln, LLENTRY_RESOLVED);
} else {
lltable_free_entry(LLTABLE6(ifp), ln);
ln = ln_tmp;
@@ -1789,25 +1790,21 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr,
*/
do_update = 0;
- if (!is_newentry && llchange != 0)
+ if (is_newentry == 0 && llchange != 0) {
do_update = 1; /* (3,5) */
- if (lladdr) { /* (3-5) and (7) */
/*
* Record source link-layer address
* XXX is it dependent to ifp->if_type?
*/
bcopy(lladdr, &ln->ll_addr, ifp->if_addrlen);
ln->la_flags |= LLE_VALID;
- if (do_update != 0) /* 3,5,7 */
- nd6_llinfo_setstate(ln, ND6_LLINFO_STALE);
+ nd6_llinfo_setstate(ln, ND6_LLINFO_STALE);
EVENTHANDLER_INVOKE(lle_event, ln, LLENTRY_RESOLVED);
- if (do_update) {
- if (ln->la_hold != NULL)
- nd6_grab_holdchain(ln, &chain, &sin6);
- }
+ if (ln->la_hold != NULL)
+ nd6_grab_holdchain(ln, &chain, &sin6);
}
/* Calculates new router status */
OpenPOWER on IntegriCloud