Author: melifaro
Date: Sun Oct  4 12:42:07 2015
New Revision: 288664
URL: https://svnweb.freebsd.org/changeset/base/288664

Log:
  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.

Modified:
  head/sys/netinet6/nd6.c

Modified: head/sys/netinet6/nd6.c
==============================================================================
--- head/sys/netinet6/nd6.c     Sun Oct  4 10:26:58 2015        (r288663)
+++ head/sys/netinet6/nd6.c     Sun Oct  4 12:42:07 2015        (r288664)
@@ -1753,6 +1753,7 @@ nd6_cache_lladdr(struct ifnet *ifp, stru
                        /* 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, stru
         */
 
        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 */
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to