Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Jun 2017 19:06:44 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r320479 - in head/sys/netpfil/ipfw: nat64 nptv6 pmod
Message-ID:  <201706291906.v5TJ6i7Z055282@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Thu Jun 29 19:06:43 2017
New Revision: 320479
URL: https://svnweb.freebsd.org/changeset/base/320479

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

Modified:
  head/sys/netpfil/ipfw/nat64/nat64_translate.c
  head/sys/netpfil/ipfw/nptv6/nptv6.c
  head/sys/netpfil/ipfw/pmod/tcpmod.c

Modified: head/sys/netpfil/ipfw/nat64/nat64_translate.c
==============================================================================
--- head/sys/netpfil/ipfw/nat64/nat64_translate.c	Thu Jun 29 18:52:36 2017	(r320478)
+++ head/sys/netpfil/ipfw/nat64/nat64_translate.c	Thu Jun 29 19:06:43 2017	(r320479)
@@ -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: head/sys/netpfil/ipfw/nptv6/nptv6.c
==============================================================================
--- head/sys/netpfil/ipfw/nptv6/nptv6.c	Thu Jun 29 18:52:36 2017	(r320478)
+++ head/sys/netpfil/ipfw/nptv6/nptv6.c	Thu Jun 29 19:06:43 2017	(r320479)
@@ -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: head/sys/netpfil/ipfw/pmod/tcpmod.c
==============================================================================
--- head/sys/netpfil/ipfw/pmod/tcpmod.c	Thu Jun 29 18:52:36 2017	(r320478)
+++ head/sys/netpfil/ipfw/pmod/tcpmod.c	Thu Jun 29 19:06:43 2017	(r320479)
@@ -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;



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