From owner-freebsd-current@FreeBSD.ORG Fri Aug 20 22:55:15 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 65A8D16A4CF; Fri, 20 Aug 2004 22:55:15 +0000 (GMT) Received: from tigra.ip.net.ua (tigra.ip.net.ua [82.193.96.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 865E143D2D; Fri, 20 Aug 2004 22:55:14 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from heffalump.ip.net.ua (heffalump.ip.net.ua [82.193.96.213]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id i7KMt8C9061295 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 21 Aug 2004 01:55:09 +0300 (EEST) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.ip.net.ua (8.13.1/8.13.1) id i7KMtAaj058934; Sat, 21 Aug 2004 01:55:10 +0300 (EEST) (envelope-from ru) Date: Sat, 21 Aug 2004 01:55:10 +0300 From: Ruslan Ermilov To: Don Lewis Message-ID: <20040820225510.GB8714@ip.net.ua> References: <20040820222026.GC73564@ip.net.ua> <200408202249.i7KMnX2h003904@gw.catspoiler.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bCsyhTFzCvuiizWE" Content-Disposition: inline In-Reply-To: <200408202249.i7KMnX2h003904@gw.catspoiler.org> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new cc: David_Hankins@isc.org cc: sobomax@portaone.com cc: gallatin@cs.duke.edu cc: current@FreeBSD.org Subject: Re: on amd64 tcp4 cksums are bad (FYI) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2004 22:55:15 -0000 --bCsyhTFzCvuiizWE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 20, 2004 at 03:49:33PM -0700, Don Lewis wrote: > On 21 Aug, Ruslan Ermilov wrote: > > On Fri, Aug 20, 2004 at 11:07:34PM +0300, Maxim Sobolev wrote: > >> Andrew Gallatin wrote: >=20 > >> >You're almost certainly using a driver which offloads transmit > >> >checksums. (both fxp and em do) Since BPF sniffs the packet before it > >> >leaves the host, the checksum has not yet been calculated, so it looks > >> >bad. > >>=20 > >> Is it possible to detect this situation and flag tcpdump somehow, so= =20 > >> that it don't trust checksum? With the widespread adoption of GigE=20 > >> cards, this "problem" is likely to be more and more common. > >>=20 > > It's easy to detect using the m_pkthdr.csum_flags. It shouldn't > > be impossible to make a writable mbuf chain copy, and call > > in_delayed_cksum() on a copy, before calling bpf_mtap(). >=20 > >From a performance point of view, you'd probably want defer calculating > the checksum until after the packet has passed the BPF filter, otherwise > you'd consume an excessive amount of CPU time when sniffing for > infrequently occurring packets on a high bandwidth network interface. >=20 Note that this is only for outgoing packets originated on this host. Also, at least with ng_bpf(4) you have an opportunity to watch both matching and non-matching packets, i.e., all of them. Yes, performance will degrade if we do this, and I don't think it's a good idea to commit this, but if someone wants it, they now know what to do. ;) Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --bCsyhTFzCvuiizWE Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (FreeBSD) iD8DBQFBJoFOqRfpzJluFF4RAmUHAKCGQNA+U+0yAeot+/90uoqTyCEFqQCfYQS3 gr0wgU00TUL7zFeXFGfbl70= =+JLS -----END PGP SIGNATURE----- --bCsyhTFzCvuiizWE--