Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Sep 2003 11:42:17 -0700 (PDT)
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 38430 for review
Message-ID:  <200309221842.h8MIgH3d024260@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=38430

Change 38430 by sam@sam_ebb on 2003/09/22 11:41:47

	remove bogus work done in the wrapper function: unlike netbsd
	we pass in an ip header with fields in host byte order; also don't
	need to do delayed checksum on output, it's already been done in
	ip_output
	
	Pointed out by: "Max Laier" <max@love2party.net>

Affected files ...

.. //depot/projects/netperf/sys/contrib/ipfilter/netinet/ip_fil.c#3 edit

Differences ...

==== //depot/projects/netperf/sys/contrib/ipfilter/netinet/ip_fil.c#3 (text+ko) ====

@@ -314,41 +314,7 @@
 fr_check_wrapper(void *arg, struct mbuf **mp, struct ifnet *ifp, int dir)
 {
 	struct ip *ip = mtod(*mp, struct ip *);
-	int rv, hlen = ip->ip_hl << 2;
-
-	/*
-	 * If the packet is out-bound, we can't delay checksums
-	 * here.  For in-bound, the checksum has already been
-	 * validated.
-	 */
-	if (dir == PFIL_OUT) {
-		if ((*mp)->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
-			in_delayed_cksum(*mp);
-			(*mp)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
-		}
-	}
-
-	/*
-	 * We get the packet with all fields in network byte
-	 * order.  We expect ip_len and ip_off to be in host
-	 * order.  We frob them, call the filter, then frob
-	 * them back.
-	 *
-	 * Note, we don't need to update the checksum, because
-	 * it has already been verified.
-	 */
-	ip->ip_len = ntohs(ip->ip_len);
-	ip->ip_off = ntohs(ip->ip_off);
-
-	rv = fr_check(ip, hlen, ifp, (dir == PFIL_OUT), mp);
-
-	if (rv == 0 && *mp != NULL) {
-		ip = mtod(*mp, struct ip *);
-		ip->ip_len = ntohs(ip->ip_len);
-		ip->ip_off = ntohs(ip->ip_off);
-	}
-
-	return (rv);
+	return fr_check(ip, ip->ip_hl << 2, ifp, (dir == PFIL_OUT), mp);
 }
 
 # ifdef USE_INET6



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