Raw Sockets: Two Questions
Ronald F. Guilmette
rfg at tristatelogic.com
Wed Mar 21 18:08:27 UTC 2018
In message <5AB23FB9.7050407 at grosbein.net>,
Eugene Grosbein <eugen at grosbein.net> wrote:
>On 21.03.2018 10:55, Matt Joras wrote:
>> Saying "Not for FreeBSD" is needlessly confusing and not accurate. In
>> the common parlance "raw sockets" does not refer to libdnet, which is
>> not a part of the FreeBSD base system. You cannot use traditional raw
>> sockets on FreeBSD to receive traditional protocol packets.
>
>The goal is to send/receive RAW IP packets, not to use raw sockets, isn't it?
>
>> The only way to do that in the base system is to use a BPF handle directly.
>
>Not exactly. For example: if_ethersubr.c/ether_input_internal() performs some sanity checks
>then passes incoming frame to BPF and to NETGRAPH (ng_ether) before passing it to upper stack l
>ayers.
>
>One can do almost anything with the frame by means of NETGRAPH subsystem
>and pass it to userland too. One have to setup some NETGRAPH nodes before, though -
>just like ppp(8) does to process control PPPoE frames.
OK, so, if I have understood all that has been said in this thread so
far, then I would assert that, from the perspective of a simple-minded
and naive end user (e.g. me), the assertion that I originally quoted
-is- in fact correct, i.e. one -cannot- just simply do sendto/recvfrom
(and expect to get back responses) if the raw packets that one sends out
happen to be, for example, well formed TCP or UDP packets.
If I have correctly understood Matt Joras, there -are- ways to get hold
of such reply packets, under FreeBSD, but those require getting a bit more
"under the hood" in order to actually get hold of them... more than just
a simple recvfrom on the RAW socket.
Have I understood correctly?
More information about the freebsd-net
mailing list