svn commit: r248914 - head/sys/netinet

Ed Maste emaste at FreeBSD.org
Fri Mar 29 20:51:45 UTC 2013


Author: emaste
Date: Fri Mar 29 20:51:44 2013
New Revision: 248914
URL: http://svnweb.freebsd.org/changeset/base/248914

Log:
  Keep fwd_tag around for subsequent pcb lookups
  
  For TIMEWAIT handling tcp_input may have to jump back for an additional
  pass through pcblookup.  Prior to this change the fwd_tag had been
  discarded after the first lookup, so a new connection attempt delivered
  locally via 'ipfw fwd' would fail to find a match.
  
  As of r248886 the tag will be detached and freed when passed to the
  socket buffer.

Modified:
  head/sys/netinet/tcp_input.c

Modified: head/sys/netinet/tcp_input.c
==============================================================================
--- head/sys/netinet/tcp_input.c	Fri Mar 29 20:34:28 2013	(r248913)
+++ head/sys/netinet/tcp_input.c	Fri Mar 29 20:51:44 2013	(r248914)
@@ -768,15 +768,6 @@ tcp_input(struct mbuf *m, int off0)
 	} else
 		ti_locked = TI_UNLOCKED;
 
-findpcb:
-#ifdef INVARIANTS
-	if (ti_locked == TI_WLOCKED) {
-		INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
-	} else {
-		INP_INFO_UNLOCK_ASSERT(&V_tcbinfo);
-	}
-#endif
-
 	/*
 	 * Grab info from PACKET_TAG_IPFORWARD tag prepended to the chain.
 	 */
@@ -793,6 +784,14 @@ findpcb:
 	    )
 		fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL);
 
+findpcb:
+#ifdef INVARIANTS
+	if (ti_locked == TI_WLOCKED) {
+		INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
+	} else {
+		INP_INFO_UNLOCK_ASSERT(&V_tcbinfo);
+	}
+#endif
 #ifdef INET6
 	if (isipv6 && fwd_tag != NULL) {
 		struct sockaddr_in6 *next_hop6;
@@ -817,10 +816,6 @@ findpcb:
 			    th->th_dport, INPLOOKUP_WILDCARD |
 			    INPLOOKUP_WLOCKPCB, m->m_pkthdr.rcvif);
 		}
-		/* Remove the tag from the packet.  We don't need it anymore. */
-		m_tag_delete(m, fwd_tag);
-		m->m_flags &= ~M_IP6_NEXTHOP;
-		fwd_tag = NULL;
 	} else if (isipv6) {
 		inp = in6_pcblookup_mbuf(&V_tcbinfo, &ip6->ip6_src,
 		    th->th_sport, &ip6->ip6_dst, th->th_dport,
@@ -855,10 +850,6 @@ findpcb:
 			    th->th_dport, INPLOOKUP_WILDCARD |
 			    INPLOOKUP_WLOCKPCB, m->m_pkthdr.rcvif);
 		}
-		/* Remove the tag from the packet.  We don't need it anymore. */
-		m_tag_delete(m, fwd_tag);
-		m->m_flags &= ~M_IP_NEXTHOP;
-		fwd_tag = NULL;
 	} else
 		inp = in_pcblookup_mbuf(&V_tcbinfo, ip->ip_src,
 		    th->th_sport, ip->ip_dst, th->th_dport,


More information about the svn-src-all mailing list