svn commit: r354751 - in head: share/doc/IPv6 sys/netinet

Bjoern A. Zeeb bz at FreeBSD.org
Fri Nov 15 21:55:43 UTC 2019


Author: bz
Date: Fri Nov 15 21:55:41 2019
New Revision: 354751
URL: https://svnweb.freebsd.org/changeset/base/354751

Log:
  Remove now unused IPv6 macros and update docs.
  
  After r354748-354750 all uses of the IP6_EXTHDR_CHECK() and
  IP6_EXTHDR_GET() macros are gone from the kernel.  IP6_EXTHDR_GET0()
  was unused.  Remove the macros and update the documentation.
  
  Sponsored by:	Netflix

Modified:
  head/share/doc/IPv6/IMPLEMENTATION
  head/sys/netinet/ip6.h

Modified: head/share/doc/IPv6/IMPLEMENTATION
==============================================================================
--- head/share/doc/IPv6/IMPLEMENTATION	Fri Nov 15 21:51:43 2019	(r354750)
+++ head/share/doc/IPv6/IMPLEMENTATION	Fri Nov 15 21:55:41 2019	(r354751)
@@ -1049,20 +1049,6 @@ requirement. (For more information, refer to Section 2
                 3282 one ext mbuf
                 0 two or more ext mbuf
 
-Each input function calls IP6_EXTHDR_CHECK in the beginning to check
-if the region between IP6 and its header is
-continuous.  IP6_EXTHDR_CHECK calls m_pullup() only if the mbuf has
-M_LOOP flag, that is, the packet comes from the loopback
-interface.  m_pullup() is never called for packets coming from physical
-network interfaces.
-
-TCP6 reassembly makes use of IP6 header to store reassemble
-information.  IP6 is not supposed to be just before TCP6, so
-ip6tcpreass structure has a pointer to TCP6 header.  Of course, it has
-also a pointer back to mbuf to avoid m_pullup().
-
-Like TCP6, both IP and IP6 reassemble functions never call m_pullup().
-
 xxx_ctlinput() calls in_mrejoin() on PRC_IFNEWADDR.  We think this is
 one of 4.4BSD implementation flaws.  Since 4.4BSD keeps ia_multiaddrs
 in in_ifaddr{}, it can't use multicast feature if the interface has no

Modified: head/sys/netinet/ip6.h
==============================================================================
--- head/sys/netinet/ip6.h	Fri Nov 15 21:51:43 2019	(r354750)
+++ head/sys/netinet/ip6.h	Fri Nov 15 21:55:41 2019	(r354751)
@@ -262,88 +262,4 @@ struct ip6_frag {
 #define IPV6_MAXPACKET	65535	/* ip6 max packet size without Jumbo payload*/
 #define IPV6_MAXOPTHDR	2048	/* max option header size, 256 64-bit words */
 
-#ifdef _KERNEL
-/*
- * IP6_EXTHDR_CHECK ensures that region between the IP6 header and the
- * target header (including IPv6 itself, extension headers and
- * TCP/UDP/ICMP6 headers) are contiguous. KAME requires drivers
- * to store incoming data into one internal mbuf or one or more external
- * mbufs(never into two or more internal mbufs). Thus, the third case is
- * supposed to never be matched but is prepared just in case.
- */
-
-#define IP6_EXTHDR_CHECK(m, off, hlen, ret)				\
-do {									\
-    if ((m)->m_next != NULL) {						\
-	if (((m)->m_flags & M_LOOP) &&					\
-	    ((m)->m_len < (off) + (hlen)) &&				\
-	    (((m) = m_pullup((m), (off) + (hlen))) == NULL)) {		\
-		IP6STAT_INC(ip6s_exthdrtoolong);				\
-		return ret;						\
-	} else {							\
-		if ((m)->m_len < (off) + (hlen)) {			\
-			IP6STAT_INC(ip6s_exthdrtoolong);			\
-			m_freem(m);					\
-			return ret;					\
-		}							\
-	}								\
-    } else {								\
-	if ((m)->m_len < (off) + (hlen)) {				\
-		IP6STAT_INC(ip6s_tooshort);				\
-		in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated);	\
-		m_freem(m);						\
-		return ret;						\
-	}								\
-    }									\
-} while (/*CONSTCOND*/ 0)
-
-/*
- * IP6_EXTHDR_GET ensures that intermediate protocol header (from "off" to
- * "len") is located in single mbuf, on contiguous memory region.
- * The pointer to the region will be returned to pointer variable "val",
- * with type "typ".
- * IP6_EXTHDR_GET0 does the same, except that it aligns the structure at the
- * very top of mbuf.  GET0 is likely to make memory copy than GET.
- *
- * XXX we're now testing this, needs m_pulldown()
- */
-#define IP6_EXTHDR_GET(val, typ, m, off, len) \
-do {									\
-	struct mbuf *t;							\
-	int tmp;							\
-	if ((m)->m_len >= (off) + (len))				\
-		(val) = (typ)(mtod((m), caddr_t) + (off));		\
-	else {								\
-		t = m_pulldown((m), (off), (len), &tmp);		\
-		if (t) {						\
-			if (t->m_len < tmp + (len))			\
-				panic("m_pulldown malfunction");	\
-			(val) = (typ)(mtod(t, caddr_t) + tmp);		\
-		} else {						\
-			(val) = (typ)NULL;				\
-			(m) = NULL;					\
-		}							\
-	}								\
-} while (/*CONSTCOND*/ 0)
-
-#define IP6_EXTHDR_GET0(val, typ, m, off, len) \
-do {									\
-	struct mbuf *t;							\
-	if ((off) == 0)							\
-		(val) = (typ)mtod(m, caddr_t);				\
-	else {								\
-		t = m_pulldown((m), (off), (len), NULL);		\
-		if (t) {						\
-			if (t->m_len < (len))				\
-				panic("m_pulldown malfunction");	\
-			(val) = (typ)mtod(t, caddr_t);			\
-		} else {						\
-			(val) = (typ)NULL;				\
-			(m) = NULL;					\
-		}							\
-	}								\
-} while (/*CONSTCOND*/ 0)
-
-#endif /*_KERNEL*/
-
 #endif /* not _NETINET_IP6_H_ */


More information about the svn-src-all mailing list