Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Jul 2020 19:07:59 +0000 (UTC)
From:      Cy Schubert <cy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r363285 - head/sys/contrib/ipfilter/netinet
Message-ID:  <202007171907.06HJ7xTM016179@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cy
Date: Fri Jul 17 19:07:59 2020
New Revision: 363285
URL: https://svnweb.freebsd.org/changeset/base/363285

Log:
  Fix incorrect byte order in ipfstat -f output.
  - make sure frag is initialized to 0
  - initialize ipfr_p field
  
  NetBSD PR:	55137
  Submitted by:	christos@NetBSD.org
  Reported by:	christos@NetBSD.org
  Obtained from:	NetBSD fil.c r1.32, ip_frag.c r1.8
  MFC after:	2 weeks

Modified:
  head/sys/contrib/ipfilter/netinet/fil.c
  head/sys/contrib/ipfilter/netinet/ip_frag.c

Modified: head/sys/contrib/ipfilter/netinet/fil.c
==============================================================================
--- head/sys/contrib/ipfilter/netinet/fil.c	Fri Jul 17 19:07:56 2020	(r363284)
+++ head/sys/contrib/ipfilter/netinet/fil.c	Fri Jul 17 19:07:59 2020	(r363285)
@@ -1698,7 +1698,7 @@ ipf_pr_ipv4hdr(fin)
 	fi->fi_p = p;
 	fin->fin_crc = p;
 	fi->fi_tos = ip->ip_tos;
-	fin->fin_id = ip->ip_id;
+	fin->fin_id = ntohs(ip->ip_id);
 	off = ntohs(ip->ip_off);
 
 	/* Get both TTL and protocol */

Modified: head/sys/contrib/ipfilter/netinet/ip_frag.c
==============================================================================
--- head/sys/contrib/ipfilter/netinet/ip_frag.c	Fri Jul 17 19:07:56 2020	(r363284)
+++ head/sys/contrib/ipfilter/netinet/ip_frag.c	Fri Jul 17 19:07:59 2020	(r363285)
@@ -404,6 +404,7 @@ ipfr_frag_new(softc, softf, fin, pass, table
 		}
 	}
 
+	memset(&frag, 0, sizeof(frag));
 	frag.ipfr_v = fin->fin_v;
 	idx = fin->fin_v;
 	frag.ipfr_p = fin->fin_p;
@@ -452,6 +453,7 @@ ipfr_frag_new(softc, softf, fin, pass, table
 		FBUMPD(ifs_nomem);
 		return NULL;
 	}
+	memset(fran, 0, sizeof(*fran));
 
 	WRITE_ENTER(lock);
 
@@ -489,6 +491,7 @@ ipfr_frag_new(softc, softf, fin, pass, table
 	table[idx] = fra;
 	bcopy((char *)&frag.ipfr_ifp, (char *)&fra->ipfr_ifp, IPFR_CMPSZ);
 	fra->ipfr_v = fin->fin_v;
+	fra->ipfr_p = fin->fin_p;
 	fra->ipfr_ttl = softc->ipf_ticks + softf->ipfr_ttl;
 	fra->ipfr_firstend = frag.ipfr_firstend;
 
@@ -677,6 +680,7 @@ ipf_frag_lookup(softc, softf, fin, table
 	 *
 	 * build up a hash value to index the table with.
 	 */
+	memset(&frag, 0, sizeof(frag));
 	frag.ipfr_v = fin->fin_v;
 	idx = fin->fin_v;
 	frag.ipfr_p = fin->fin_p;



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