Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Aug 2015 05:03:36 +0000 (UTC)
From:      "Alexander V. Chernikov" <melifaro@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r287318 - in head/sys: net netinet6
Message-ID:  <201508310503.t7V53aWQ046586@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: melifaro
Date: Mon Aug 31 05:03:36 2015
New Revision: 287318
URL: https://svnweb.freebsd.org/changeset/base/287318

Log:
  Simplify lla_rt_output()/nd6_add_ifa_lle() by setting lle state in
    alloc handler, based on flags.

Modified:
  head/sys/net/if_llatbl.c
  head/sys/netinet6/in6.c
  head/sys/netinet6/nd6.c

Modified: head/sys/net/if_llatbl.c
==============================================================================
--- head/sys/net/if_llatbl.c	Sun Aug 30 23:58:53 2015	(r287317)
+++ head/sys/net/if_llatbl.c	Mon Aug 31 05:03:36 2015	(r287318)
@@ -592,7 +592,10 @@ lla_rt_output(struct rt_msghdr *rtm, str
 	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, str
 		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 */

Modified: head/sys/netinet6/in6.c
==============================================================================
--- head/sys/netinet6/in6.c	Sun Aug 30 23:58:53 2015	(r287317)
+++ head/sys/netinet6/in6.c	Mon Aug 31 05:03:36 2015	(r287318)
@@ -2264,6 +2264,9 @@ in6_lltable_alloc(struct lltable *llt, u
 		lle->la_flags |= (LLE_VALID | LLE_STATIC);
 	}
 
+	if ((lle->la_flags & LLE_STATIC) != 0)
+		lle->ln_state = ND6_LLINFO_REACHABLE;
+
 	return (lle);
 }
 

Modified: head/sys/netinet6/nd6.c
==============================================================================
--- head/sys/netinet6/nd6.c	Sun Aug 30 23:58:53 2015	(r287317)
+++ head/sys/netinet6/nd6.c	Mon Aug 31 05:03:36 2015	(r287318)
@@ -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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508310503.t7V53aWQ046586>