Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 May 2001 09:55:18 -0700
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        Gunnar Olsson <gunnar.olsson@xelerated.com>
Cc:        "Freebsd Net (E-mail)" <freebsd-net@FreeBSD.ORG>, "Freebsd Hackers (E-mail)" <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: how to use netgraph?
Message-ID:  <20010503095518.A10093@Odin.AC.HMC.Edu>
In-Reply-To: <31A473DBB655D21180850008C71E251A031AAF3A@mail.kebne.se>; from gunnar.olsson@xelerated.com on Thu, May 03, 2001 at 10:20:45AM %2B0200
References:  <31A473DBB655D21180850008C71E251A031AAF3A@mail.kebne.se>

next in thread | previous in thread | raw e-mail | index | archive | help

--NzB8fVQJ5HfG6fxh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, May 03, 2001 at 10:20:45AM +0200, Gunnar Olsson wrote:
> I have a process in user space, that wants to send a packet
> direct on the ethernet, not encapsulate the packet in IP.
> When I read about netgraph, it looks like it possible to do, or?
> When I hook to a upper or a lower hook, does the kernel create
> the ethernet header, or do I have to create the ethernet header
> in the user process myself before sending down?
>=20
> If the kernal is adding the ethernet header,
> what is actually sent out on the wire? Usaully an ARPLOOKUP
> is done and maps the IP dst to a MAC dst, but now I do not
> have the IP header. How to get the MAC dst field filled in?

It's rather unnecessicary to use netgraph for this purpose.  Instead you
can use the well hidden feature of the bpf device that it can write as
well as read.  If you want to send packets with arbitrary sender
addresses, you will want to use the BIOCGHDRCMPLT ioctl to enable that
(not all cards support this, for instance wireless cards do not.)  You
might also look at libnet which provides wrappers for this, but I seem
to recall that it doesn't support BIOCGHDRCMPLT.

-- Brooks

--=20
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4

--NzB8fVQJ5HfG6fxh
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE68Y11XY6L6fI4GtQRAidiAKCbcfyGhEl2P4klZv4zVqsjm6qG5QCg16p9
RjsEWw6j0QN78Xoiuh0fD2w=
=ucdh
-----END PGP SIGNATURE-----

--NzB8fVQJ5HfG6fxh--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




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