Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 May 2018 08:15:32 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r333206 - stable/11/sys/netinet6
Message-ID:  <201805030815.w438FWT9022473@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Thu May  3 08:15:32 2018
New Revision: 333206
URL: https://svnweb.freebsd.org/changeset/base/333206

Log:
  MFC r332886:
    icmp6_reflect() sends ICMPv6 message with new IPv6 header. So, it is
    considered as originated by our host packet. And thus rcvif should be
    NULL, since it is used by ipfw(4) to determine that packet was originated
    from this host. Some of icmp6_reflect() consumers reuse mbuf and m_pkthdr
    without resetting rcvif pointer. To avoid this always reset m_pkthdr.rcvif
    pointer to NULL in icmp6_reflect(). Also remove such line and comment
    describing this from icmp6_error(), since it does not longer matters.
  
    PR:		227674

Modified:
  stable/11/sys/netinet6/icmp6.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet6/icmp6.c
==============================================================================
--- stable/11/sys/netinet6/icmp6.c	Thu May  3 07:57:08 2018	(r333205)
+++ stable/11/sys/netinet6/icmp6.c	Thu May  3 08:15:32 2018	(r333206)
@@ -381,15 +381,6 @@ icmp6_error(struct mbuf *m, int type, int code, int pa
 	icmp6->icmp6_code = code;
 	icmp6->icmp6_pptr = htonl((u_int32_t)param);
 
-	/*
-	 * icmp6_reflect() is designed to be in the input path.
-	 * icmp6_error() can be called from both input and output path,
-	 * and if we are in output path rcvif could contain bogus value.
-	 * clear m->m_pkthdr.rcvif for safety, we should have enough scope
-	 * information in ip header (nip6).
-	 */
-	m->m_pkthdr.rcvif = NULL;
-
 	ICMP6STAT_INC(icp6s_outhist[type]);
 	icmp6_reflect(m, sizeof(struct ip6_hdr)); /* header order: IPv6 - ICMPv6 */
 
@@ -2181,7 +2172,7 @@ icmp6_reflect(struct mbuf *m, size_t off)
 	 */
 
 	m->m_flags &= ~(M_BCAST|M_MCAST);
-
+	m->m_pkthdr.rcvif = NULL;
 	ip6_output(m, NULL, NULL, 0, NULL, &outif, NULL);
 	if (outif)
 		icmp6_ifoutstat_inc(outif, type, code);



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