svn commit: r320593 - in stable/11/sys/netpfil/ipfw: nat64 nptv6 pmod

Andrey V. Elsukov ae at FreeBSD.org
Mon Jul 3 08:53:24 UTC 2017


Author: ae
Date: Mon Jul  3 08:53:22 2017
New Revision: 320593
URL: https://svnweb.freebsd.org/changeset/base/320593

Log:
  MFC r320479:
    Fix IPv6 extension header parsing. The length field doesn't include the
    first 8 octets.
  
    Obtained from:	Yandex LLC

Modified:
  stable/11/sys/netpfil/ipfw/nat64/nat64_translate.c
  stable/11/sys/netpfil/ipfw/nptv6/nptv6.c
  stable/11/sys/netpfil/ipfw/pmod/tcpmod.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netpfil/ipfw/nat64/nat64_translate.c
==============================================================================
--- stable/11/sys/netpfil/ipfw/nat64/nat64_translate.c	Mon Jul  3 08:32:52 2017	(r320592)
+++ stable/11/sys/netpfil/ipfw/nat64/nat64_translate.c	Mon Jul  3 08:53:22 2017	(r320593)
@@ -1054,7 +1054,7 @@ nat64_getlasthdr(struct mbuf *m, int *offset)
 		if (proto == IPPROTO_HOPOPTS && ip6->ip6_plen == 0)
 			return (-1);
 		proto = hbh->ip6h_nxt;
-		hlen += hbh->ip6h_len << 3;
+		hlen += (hbh->ip6h_len + 1) << 3;
 	}
 	if (offset != NULL)
 		*offset = hlen;

Modified: stable/11/sys/netpfil/ipfw/nptv6/nptv6.c
==============================================================================
--- stable/11/sys/netpfil/ipfw/nptv6/nptv6.c	Mon Jul  3 08:32:52 2017	(r320592)
+++ stable/11/sys/netpfil/ipfw/nptv6/nptv6.c	Mon Jul  3 08:53:22 2017	(r320593)
@@ -125,7 +125,7 @@ nptv6_getlasthdr(struct nptv6_cfg *cfg, struct mbuf *m
 		if (m->m_len < hlen)
 			return (-1);
 		proto = hbh->ip6h_nxt;
-		hlen += hbh->ip6h_len << 3;
+		hlen += (hbh->ip6h_len + 1) << 3;
 	}
 	if (offset != NULL)
 		*offset = hlen;

Modified: stable/11/sys/netpfil/ipfw/pmod/tcpmod.c
==============================================================================
--- stable/11/sys/netpfil/ipfw/pmod/tcpmod.c	Mon Jul  3 08:32:52 2017	(r320592)
+++ stable/11/sys/netpfil/ipfw/pmod/tcpmod.c	Mon Jul  3 08:53:22 2017	(r320593)
@@ -137,7 +137,7 @@ tcpmod_ipv6_setmss(struct mbuf **mp, uint16_t mss)
 	    proto == IPPROTO_DSTOPTS) {
 		hbh = mtodo(*mp, hlen);
 		proto = hbh->ip6h_nxt;
-		hlen += hbh->ip6h_len << 3;
+		hlen += (hbh->ip6h_len + 1) << 3;
 	}
 	tcp = mtodo(*mp, hlen);
 	plen = (*mp)->m_pkthdr.len - hlen;


More information about the svn-src-all mailing list