From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 11 08:35:34 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A57951065670 for ; Fri, 11 Feb 2011 08:35:34 +0000 (UTC) (envelope-from dudu@dudu.ro) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 31D378FC17 for ; Fri, 11 Feb 2011 08:35:33 +0000 (UTC) Received: by wyf19 with SMTP id 19so2235770wyf.13 for ; Fri, 11 Feb 2011 00:35:33 -0800 (PST) Received: by 10.216.18.194 with SMTP id l44mr166399wel.87.1297411466112; Fri, 11 Feb 2011 00:04:26 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.185.9 with HTTP; Fri, 11 Feb 2011 00:03:46 -0800 (PST) In-Reply-To: <4D54E39D.1000505@herveybayaustralia.com.au> References: <4D54E39D.1000505@herveybayaustralia.com.au> From: Vlad Galu Date: Fri, 11 Feb 2011 10:03:46 +0200 Message-ID: To: Da Rock Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: linux PF_PACKET compatibility X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Feb 2011 08:35:34 -0000 On Fri, Feb 11, 2011 at 9:22 AM, Da Rock < freebsd-hackers@herveybayaustralia.com.au> wrote: > "In recent versions of the Linux kernel (post-2.0 releases) a new protocol > family has been introduced, named PF_PACKET. This family allows an > application to send and receive packets dealing directly with the network > card driver, thus avoiding the usual protocol stack-handling (e.g., IP/TCP > or IP/UDP processing). That is, any packet sent through the socket will be > directly passed to the Ethernet interface, and any packet received through > the interface will be directly passed to the application." > > I've been chasing the answer to a FreeBSD version of this (approx. anyway), > but I needed to find out what exactly PF_PACKET was first. Finally found > this answer here: http://www.linuxjournal.com/article/4659 > > I looked up man socket and I can see possibilities (in my mind anyway), but > I thought I'd be best to check if the gurus here might have a better idea. > My reason for this is I'm attempting to build l2tpns (which supposedly > builds on 7.3?! with no trouble), and I'm chasing the errors which appear to > be linuxisms mostly. > > So in man socket simply looking at the list of protocol families I'd say > network driver level would be similar to PF_LINK link layer interface? Is > there another man page I should be looking at as well? > > FWIW my gmake output is this: > > gcc -Wall -Wformat-security -Wno-format-zero-length -g -O3 -I. > -I/usr/include -I/usr/local/include -DLIBDIR='"/lib/l2tpns"' > -DETCDIR='"/etc/l2tpns"' -DSTATISTICS -DSTAT_CALLS -DRINGBUFFER -DHAVE_EPOLL > -DBGP -c -o arp.o arp.c > arp.c: In function 'sendarp': > arp.c:34: error: storage size of 'sll' isn't known > arp.c:59: error: 'PF_PACKET' undeclared (first use in this function) > arp.c:59: error: (Each undeclared identifier is reported only once > arp.c:59: error: for each function it appears in.) > arp.c:62: error: 'AF_PACKET' undeclared (first use in this function) > arp.c:34: warning: unused variable 'sll' > gmake: *** [arp.o] Error 1 > > I posted this over at -questions@ but it was suggested to try here instead > (or -net@). I figured this would be the best place to start... :) > > Cheers > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > Take a look at bpf(4). I believe you could bypass the TCP/IP stack with netgraph(4), as well, although with possibly more overhead. -- Good, fast & cheap. Pick any two.