From owner-p4-projects@FreeBSD.ORG Mon Sep 22 11:42:19 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id CDC1616A4C0; Mon, 22 Sep 2003 11:42:18 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9DAE616A4B3 for ; Mon, 22 Sep 2003 11:42:18 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 214CA43FB1 for ; Mon, 22 Sep 2003 11:42:18 -0700 (PDT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h8MIgHXJ024263 for ; Mon, 22 Sep 2003 11:42:17 -0700 (PDT) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h8MIgH3d024260 for perforce@freebsd.org; Mon, 22 Sep 2003 11:42:17 -0700 (PDT) (envelope-from sam@freebsd.org) Date: Mon, 22 Sep 2003 11:42:17 -0700 (PDT) Message-Id: <200309221842.h8MIgH3d024260@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 38430 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Sep 2003 18:42:19 -0000 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" 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