svn commit: r288301 - in head/sys: net netinet netinet6

Alexander V. Chernikov melifaro at FreeBSD.org
Sun Sep 27 05:29:37 UTC 2015


Author: melifaro
Date: Sun Sep 27 05:29:34 2015
New Revision: 288301
URL: https://svnweb.freebsd.org/changeset/base/288301

Log:
  Eliminate nd6_nud_hint() and its TCP bindings.
  
  Initially function was introduced in r53541 (KAME initial commit) to
    "provide hints from upper layer protocols that indicate a connection
    is making "forward progress"" (quote from RFC 2461 7.3.1 Reachability
    Confirmation).
  However, it was converted to do nothing (e.g. just return) in r122922
    (tcp_hostcache implementation) back in 2003. Some defines were moved
    to tcp_var.h in r169541. Then, it was broken (for non-corner cases)
    by r186119 (L2<>L3 split) in 2008 (NULL ifp in nd6_lookup). So,
    right now this code is broken and has no "real" base users.
  
  Differential Revision:	https://reviews.freebsd.org/D3699

Modified:
  head/sys/net/if_llatbl.c
  head/sys/net/if_llatbl.h
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_reass.c
  head/sys/netinet/tcp_var.h
  head/sys/netinet6/nd6.c
  head/sys/netinet6/nd6.h
  head/sys/netinet6/nd6_nbr.c

Modified: head/sys/net/if_llatbl.c
==============================================================================
--- head/sys/net/if_llatbl.c	Sun Sep 27 05:26:22 2015	(r288300)
+++ head/sys/net/if_llatbl.c	Sun Sep 27 05:29:34 2015	(r288301)
@@ -721,7 +721,6 @@ llatbl_lle_show(struct llentry_sa *la)
 	db_printf(" la_flags=0x%04x\n", lle->la_flags);
 	db_printf(" la_asked=%u\n", lle->la_asked);
 	db_printf(" la_preempt=%u\n", lle->la_preempt);
-	db_printf(" ln_byhint=%u\n", lle->ln_byhint);
 	db_printf(" ln_state=%d\n", lle->ln_state);
 	db_printf(" ln_router=%u\n", lle->ln_router);
 	db_printf(" ln_ntick=%ju\n", (uintmax_t)lle->ln_ntick);

Modified: head/sys/net/if_llatbl.h
==============================================================================
--- head/sys/net/if_llatbl.h	Sun Sep 27 05:26:22 2015	(r288300)
+++ head/sys/net/if_llatbl.h	Sun Sep 27 05:29:34 2015	(r288301)
@@ -75,7 +75,6 @@ struct llentry {
 	uint16_t		 la_flags;
 	uint16_t		 la_asked;
 	uint16_t		 la_preempt;
-	uint16_t		 ln_byhint;
 	int16_t			 ln_state;	/* IPv6 has ND6_LLINFO_NOSTATE == -2 */
 	uint16_t		 ln_router;
 	time_t			 ln_ntick;

Modified: head/sys/netinet/tcp_input.c
==============================================================================
--- head/sys/netinet/tcp_input.c	Sun Sep 27 05:26:22 2015	(r288300)
+++ head/sys/netinet/tcp_input.c	Sun Sep 27 05:29:34 2015	(r288301)
@@ -469,18 +469,6 @@ tcp_signature_verify_input(struct mbuf *
 }
 #endif
 
-/* Neighbor Discovery, Neighbor Unreachability Detection Upper layer hint. */
-#ifdef INET6
-#define ND6_HINT(tp) \
-do { \
-	if ((tp) && (tp)->t_inpcb && \
-	    ((tp)->t_inpcb->inp_vflag & INP_IPV6) != 0) \
-		nd6_nud_hint(NULL, NULL, 0); \
-} while (0)
-#else
-#define ND6_HINT(tp)
-#endif
-
 /*
  * Indicate whether this ack should be delayed.  We can delay the ack if
  * following conditions are met:
@@ -1763,7 +1751,6 @@ tcp_do_segment(struct mbuf *m, struct tc
 				tp->snd_wl2 = th->th_ack;
 				tp->t_dupacks = 0;
 				m_freem(m);
-				ND6_HINT(tp); /* Some progress has been made. */
 
 				/*
 				 * If all outstanding data are acked, stop
@@ -1822,7 +1809,6 @@ tcp_do_segment(struct mbuf *m, struct tc
 			tp->rcv_up = tp->rcv_nxt;
 			TCPSTAT_INC(tcps_rcvpack);
 			TCPSTAT_ADD(tcps_rcvbyte, tlen);
-			ND6_HINT(tp);	/* Some progress has been made */
 #ifdef TCPDEBUG
 			if (so->so_options & SO_DEBUG)
 				tcp_trace(TA_INPUT, ostate, tp,
@@ -2924,7 +2910,6 @@ dodata:							/* XXX */
 			thflags = th->th_flags & TH_FIN;
 			TCPSTAT_INC(tcps_rcvpack);
 			TCPSTAT_ADD(tcps_rcvbyte, tlen);
-			ND6_HINT(tp);
 			SOCKBUF_LOCK(&so->so_rcv);
 			if (so->so_rcv.sb_state & SBS_CANTRCVMORE)
 				m_freem(m);

Modified: head/sys/netinet/tcp_reass.c
==============================================================================
--- head/sys/netinet/tcp_reass.c	Sun Sep 27 05:26:22 2015	(r288300)
+++ head/sys/netinet/tcp_reass.c	Sun Sep 27 05:29:34 2015	(r288301)
@@ -327,7 +327,6 @@ present:
 		tp->t_segqlen--;
 		q = nq;
 	} while (q && q->tqe_th->th_seq == tp->rcv_nxt);
-	ND6_HINT(tp);
 	sorwakeup_locked(so);
 	return (flags);
 }

Modified: head/sys/netinet/tcp_var.h
==============================================================================
--- head/sys/netinet/tcp_var.h	Sun Sep 27 05:26:22 2015	(r288300)
+++ head/sys/netinet/tcp_var.h	Sun Sep 27 05:29:34 2015	(r288301)
@@ -83,18 +83,6 @@ struct tcptemp {
 
 #define tcp6cb		tcpcb  /* for KAME src sync over BSD*'s */
 
-/* Neighbor Discovery, Neighbor Unreachability Detection Upper layer hint. */
-#ifdef INET6
-#define ND6_HINT(tp)						\
-do {								\
-	if ((tp) && (tp)->t_inpcb &&				\
-	    ((tp)->t_inpcb->inp_vflag & INP_IPV6) != 0)		\
-		nd6_nud_hint(NULL, NULL, 0);			\
-} while (0)
-#else
-#define ND6_HINT(tp)
-#endif
-
 /*
  * Tcp control block, one per tcp; fields:
  * Organized for 16 byte cacheline efficiency.

Modified: head/sys/netinet6/nd6.c
==============================================================================
--- head/sys/netinet6/nd6.c	Sun Sep 27 05:26:22 2015	(r288300)
+++ head/sys/netinet6/nd6.c	Sun Sep 27 05:29:34 2015	(r288301)
@@ -1314,47 +1314,6 @@ nd6_free_redirect(const struct llentry *
 }
 
 /*
- * Upper-layer reachability hint for Neighbor Unreachability Detection.
- *
- * XXX cost-effective methods?
- */
-void
-nd6_nud_hint(struct rtentry *rt, struct in6_addr *dst6, int force)
-{
-	struct llentry *ln;
-	struct ifnet *ifp;
-
-	if ((dst6 == NULL) || (rt == NULL))
-		return;
-
-	ifp = rt->rt_ifp;
-	IF_AFDATA_RLOCK(ifp);
-	ln = nd6_lookup(dst6, LLE_EXCLUSIVE, NULL);
-	IF_AFDATA_RUNLOCK(ifp);
-	if (ln == NULL)
-		return;
-
-	if (ln->ln_state < ND6_LLINFO_REACHABLE)
-		goto done;
-
-	/*
-	 * if we get upper-layer reachability confirmation many times,
-	 * it is possible we have false information.
-	 */
-	if (!force) {
-		ln->ln_byhint++;
-		if (ln->ln_byhint > V_nd6_maxnudhint) {
-			goto done;
-		}
-	}
-
- 	nd6_llinfo_setstate(ln, ND6_LLINFO_REACHABLE);
-done:
-	LLE_WUNLOCK(ln);
-}
-
-
-/*
  * Rejuvenate this function for routing operations related
  * processing.
  */

Modified: head/sys/netinet6/nd6.h
==============================================================================
--- head/sys/netinet6/nd6.h	Sun Sep 27 05:26:22 2015	(r288300)
+++ head/sys/netinet6/nd6.h	Sun Sep 27 05:29:34 2015	(r288301)
@@ -412,7 +412,6 @@ void nd6_llinfo_settimer(struct llentry 
 void nd6_llinfo_settimer_locked(struct llentry *, long);
 void nd6_timer(void *);
 void nd6_purge(struct ifnet *);
-void nd6_nud_hint(struct rtentry *, struct in6_addr *, int);
 int nd6_resolve(struct ifnet *, int, struct mbuf *,
     const struct sockaddr *, u_char *, uint32_t *);
 int nd6_ioctl(u_long, caddr_t, struct ifnet *);

Modified: head/sys/netinet6/nd6_nbr.c
==============================================================================
--- head/sys/netinet6/nd6_nbr.c	Sun Sep 27 05:26:22 2015	(r288300)
+++ head/sys/netinet6/nd6_nbr.c	Sun Sep 27 05:29:34 2015	(r288301)
@@ -768,10 +768,9 @@ nd6_na_input(struct mbuf *m, int off, in
 		bcopy(lladdr, &ln->ll_addr, ifp->if_addrlen);
 		ln->la_flags |= LLE_VALID;
 		EVENTHANDLER_INVOKE(lle_event, ln, LLENTRY_RESOLVED);
-		if (is_solicited) {
+		if (is_solicited)
 			nd6_llinfo_setstate(ln, ND6_LLINFO_REACHABLE);
-			ln->ln_byhint = 0;
-		} else
+		else
 			nd6_llinfo_setstate(ln, ND6_LLINFO_STALE);
 		if ((ln->ln_router = is_router) != 0) {
 			/*
@@ -844,10 +843,9 @@ nd6_na_input(struct mbuf *m, int off, in
 			 * If not solicited and the link-layer address was
 			 * changed, make it STALE.
 			 */
-			if (is_solicited) {
-				ln->ln_byhint = 0;
+			if (is_solicited)
 				nd6_llinfo_setstate(ln, ND6_LLINFO_REACHABLE);
-			} else {
+			else {
 				if (lladdr != NULL && llchange)
 					nd6_llinfo_setstate(ln, ND6_LLINFO_STALE);
 			}


More information about the svn-src-all mailing list