Date: Tue, 24 Dec 2002 23:27:34 +0100 From: Aurelien Nephtali <aurelien.nephtali@wanadoo.fr> To: current@freebsd.org Subject: Re: [PATCH] Wrong behaviour of writes of IP packets through BPF fd Message-ID: <20021224222734.GA79092@nebula.wanadoo.fr> In-Reply-To: <20021224221734.GA69934@nebula.wanadoo.fr> References: <20021224205819.GA2042@nebula.wanadoo.fr> <20021224221734.GA69934@nebula.wanadoo.fr>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 <net/bpfdesc.h>
=20
#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
#include <netinet/if_ether.h>
#include <sys/kernel.h>
#include <sys/sysctl.h>
@@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021224222734.GA79092>
