From owner-freebsd-net@freebsd.org Wed Mar 21 18:08:26 2018 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CEA20F595B2 for ; Wed, 21 Mar 2018 18:08:26 +0000 (UTC) (envelope-from rfg@tristatelogic.com) Received: from outgoing.tristatelogic.com (segfault.tristatelogic.com [69.62.255.118]) by mx1.freebsd.org (Postfix) with ESMTP id 674EE7E18E for ; Wed, 21 Mar 2018 18:08:25 +0000 (UTC) (envelope-from rfg@tristatelogic.com) Received: from segfault-nmh-helo.tristatelogic.com (localhost [127.0.0.1]) by segfault.tristatelogic.com (Postfix) with ESMTP id 20FDA3AEF2 for ; Wed, 21 Mar 2018 11:08:25 -0700 (PDT) From: "Ronald F. Guilmette" To: FreeBSD Net Subject: Re: Raw Sockets: Two Questions In-Reply-To: <5AB23FB9.7050407@grosbein.net> Date: Wed, 21 Mar 2018 11:08:24 -0700 Message-ID: <3559.1521655704@segfault.tristatelogic.com> X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 18:08:27 -0000 In message <5AB23FB9.7050407@grosbein.net>, Eugene Grosbein 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?