Author: qingli
Date: Tue Dec 16 01:21:19 2008
New Revision: 186153
URL: http://svn.freebsd.org/changeset/base/186153

Log:
  Initialize the variable "router", and apply "static_route" flag
  across the entire nd6_cache_lladdr() function.

Modified:
  head/sys/netinet6/nd6.c

Modified: head/sys/netinet6/nd6.c
==============================================================================
--- head/sys/netinet6/nd6.c     Tue Dec 16 01:18:10 2008        (r186152)
+++ head/sys/netinet6/nd6.c     Tue Dec 16 01:21:19 2008        (r186153)
@@ -1405,9 +1405,10 @@ nd6_cache_lladdr(struct ifnet *ifp, stru
        int llchange;
        int flags = 0;
        int newstate = 0;
-       uint16_t router;
+       uint16_t router = 0;
        struct sockaddr_in6 sin6;
        struct mbuf *chain = NULL;
+       int static_route = 0;
 
        IF_AFDATA_UNLOCK_ASSERT(ifp);
 
@@ -1441,8 +1442,10 @@ nd6_cache_lladdr(struct ifnet *ifp, stru
                is_newentry = 1;
        } else {
                /* do nothing if static ndp is set */
-               if (ln->la_flags & LLE_STATIC)
+               if (ln->la_flags & LLE_STATIC) {
+                       static_route = 1;
                        goto done;
+               }
                is_newentry = 0;
        }
        if (ln == NULL)
@@ -1600,7 +1603,7 @@ nd6_cache_lladdr(struct ifnet *ifp, stru
        }
 
        if (ln) {
-               int static_route = (ln->la_flags & LLE_STATIC);
+               static_route = (ln->la_flags & LLE_STATIC);
                router = ln->ln_router;
 
                if (flags & ND6_EXCLUSIVE)
@@ -1642,7 +1645,7 @@ done:     
                        LLE_WUNLOCK(ln);
                else
                        LLE_RUNLOCK(ln);
-               if (ln->la_flags & LLE_STATIC)
+               if (static_route)
                        ln = NULL;
        }
        return (ln);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to