From owner-freebsd-current Tue Dec 24 14:26:59 2002 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 5614137B401 for ; Tue, 24 Dec 2002 14:26:57 -0800 (PST) Received: from nebula.wanadoo.fr (ca-sqy-1-181.abo.wanadoo.fr [80.8.54.181]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3DCF443EA9 for ; Tue, 24 Dec 2002 14:26:56 -0800 (PST) (envelope-from dak@wanadoo.fr) Received: from nebula.wanadoo.fr (localhost [127.0.0.1]) by nebula.wanadoo.fr (8.12.6/8.12.6) with ESMTP id gBOMRZcC082631 for ; Tue, 24 Dec 2002 23:27:35 +0100 (CET) (envelope-from dak@nebula.wanadoo.fr) Received: (from dak@localhost) by nebula.wanadoo.fr (8.12.6/8.12.6/Submit) id gBOMRZp9082626 for current@freebsd.org; Tue, 24 Dec 2002 23:27:35 +0100 (CET) Date: Tue, 24 Dec 2002 23:27:34 +0100 From: Aurelien Nephtali To: current@freebsd.org Subject: Re: [PATCH] Wrong behaviour of writes of IP packets through BPF fd Message-ID: <20021224222734.GA79092@nebula.wanadoo.fr> References: <20021224205819.GA2042@nebula.wanadoo.fr> <20021224221734.GA69934@nebula.wanadoo.fr> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="H+4ONPRPur6+Ovig" Content-Disposition: inline In-Reply-To: <20021224221734.GA69934@nebula.wanadoo.fr> User-Agent: Mutt/1.5.1i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --H+4ONPRPur6+Ovig Content-Type: multipart/mixed; boundary="ReaqsoxgOBHFXBhH" Content-Disposition: inline --ReaqsoxgOBHFXBhH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable >=20 > Hum ... the previous patch against bpf.c was the result of multiple test,= thus > it was _VERY_ ugly with useless lines of code... now the new one is clean= er :) > (it's just aesthetic modifications but ... better for the eyes :p) >=20 > -- Aurelien @!#~& *tired* here is the ghost patch ... sorry -- Aurelien --ReaqsoxgOBHFXBhH Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="bpf.patch" Content-Transfer-Encoding: quoted-printable --- sys/net/bpf.c Tue Dec 24 23:26:49 2002 +++ sys/net/bpf.c Tue Dec 24 23:13:14 2002 @@ -68,6 +68,8 @@ #include =20 #include +#include +#include #include #include #include @@ -549,6 +551,7 @@ int error; static struct sockaddr dst; int datlen; + struct ip *ip; =20 if (d->bd_bif =3D=3D 0) return (ENXIO); @@ -572,6 +575,10 @@ #ifdef MAC mac_create_mbuf_from_bpfdesc(d, m); #endif + if (dst.sa_family =3D=3D AF_UNSPEC) { + ip =3D mtod(m, struct ip *); + ip->ip_len =3D htons(ip->ip_len); + } =20 error =3D (*ifp->if_output)(ifp, m, &dst, (struct rtentry *)0); mtx_unlock(&Giant); --ReaqsoxgOBHFXBhH-- --H+4ONPRPur6+Ovig Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+CN9WDNsbHbt8ok8RAi44AKCdw64CqYPyjnHI/7WMkdItcex6nwCaA1vS t/EIxCjQ1Qt36dCNoMYrOhE= =AHa7 -----END PGP SIGNATURE----- --H+4ONPRPur6+Ovig-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message