Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Jul 2019 02:30:25 +0000 (UTC)
From:      Cy Schubert <cy@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: r350234 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet
Message-ID:  <201907230230.x6N2UPJB043673@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cy
Date: Tue Jul 23 02:30:24 2019
New Revision: 350234
URL: https://svnweb.freebsd.org/changeset/base/350234

Log:
  MFC r350063:
  
  Refactor, removing one compare.
  
  This changes the return code however the caller only tests for 0 and != 0.
  One might ask then, why multiple return codes when the caller only tests
  for 0 and != 0? From what I can tell, Darren probably passed various
  return codes for sake of debugging. The debugging code is long gone
  however we can still use the different return codes using DTrace FBT
  traces. We can still determine why the compare failed by examining the
  differences between the fr1 and fr2 frentry structs, which is a simple
  test in DTrace. This allows reducing the number of tests, improving the
  code while not affecting our ability to capture information for
  diagnostic purposes.

Modified:
  stable/11/sys/contrib/ipfilter/netinet/fil.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/contrib/ipfilter/netinet/fil.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c
==============================================================================
--- stable/11/sys/contrib/ipfilter/netinet/fil.c	Tue Jul 23 02:11:14 2019	(r350233)
+++ stable/11/sys/contrib/ipfilter/netinet/fil.c	Tue Jul 23 02:30:24 2019	(r350234)
@@ -4439,15 +4439,13 @@ ipf_rule_compare(frentry_t *fr1, frentry_t *fr2)
 	if (bcmp((char *)&fr1->fr_func, (char *)&fr2->fr_func, FR_CMPSIZ(fr1))
 	    != 0)
 		return (4);
-	if (fr1->fr_data && !fr2->fr_data)
-		return (5);
-	if (!fr1->fr_data && fr2->fr_data)
-		return (6);
-	if (fr1->fr_data) {
-		if (bcmp(fr1->fr_caddr, fr2->fr_caddr, fr1->fr_dsize))
-			return (7);
+	if (!fr1->fr_data && !fr2->fr_data)
+		return (0);	/* move along, nothing to see here */
+	if (fr1->fr_data && fr2->fr_data) {
+		if (bcmp(fr1->fr_caddr, fr2->fr_caddr, fr1->fr_dsize) == 0)
+			return (0);	/* same */
 	}
-	return (0);
+	return (5);
 }
 
 



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