Date: Wed, 21 Mar 2018 11:08:24 -0700 From: "Ronald F. Guilmette" <rfg@tristatelogic.com> To: FreeBSD Net <freebsd-net@freebsd.org> Subject: Re: Raw Sockets: Two Questions Message-ID: <3559.1521655704@segfault.tristatelogic.com> In-Reply-To: <5AB23FB9.7050407@grosbein.net>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <5AB23FB9.7050407@grosbein.net>, Eugene Grosbein <eugen@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?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3559.1521655704>