From owner-freebsd-hackers@FreeBSD.ORG Sat Feb 12 01:19:11 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 70896106564A for ; Sat, 12 Feb 2011 01:19:11 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id 4D7678FC17 for ; Sat, 12 Feb 2011 01:19:10 +0000 (UTC) Received: from julian-mac.elischer.org (home-nat.elischer.org [67.100.89.137]) (authenticated bits=0) by vps1.elischer.org (8.14.4/8.14.4) with ESMTP id p1C1J5b5071948 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 11 Feb 2011 17:19:07 -0800 (PST) (envelope-from julian@freebsd.org) Message-ID: <4D55E015.3010709@freebsd.org> Date: Fri, 11 Feb 2011 17:19:17 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: Da Rock References: <4D54E39D.1000505@herveybayaustralia.com.au> <4D54F0B0.7010503@freebsd.org> <4D550300.5090000@herveybayaustralia.com.au> <4D5565C7.1010809@freebsd.org> <4D55CE5A.8040902@herveybayaustralia.com.au> In-Reply-To: <4D55CE5A.8040902@herveybayaustralia.com.au> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org, dudu@dudu.ro Subject: Re: [maybe spam] 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: Sat, 12 Feb 2011 01:19:11 -0000 On 2/11/11 4:03 PM, Da Rock wrote: > On 02/12/11 02:37, Julian Elischer wrote: >> On 2/11/11 1:36 AM, Da Rock wrote: >>> On 02/11/11 18:17, Julian Elischer wrote: >>>> On 2/10/11 11:22 PM, Da Rock 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? >>>> >>>> We don't have an exact equivalent.. but we have ways of doing the >>>> same thing. >>>> one way that is suggested is to use pcap and bpf which I am >>>> pretty certain has been enhanced to allow sending as >>>> well as receiving. >>>> you can also hook directly to the interface using netgraph(4) >>>> there are other ways too but those are the two that came to mind >>>> immediately. >>> So I'm going to have to rewrite that interface entirely? Bugger! I >>> just can't fathom how this howto could even exist for l2tpns on >>> FreeBSD if it isn't even close to buildable... weird! >>> >>> http://kuapp.com/2010/07/14/how-to-setup-l2tpipsec-vpn-on-freebsd.html >>> >>> >>> Thanks guys. I'll probably come back with more problems as I >>> slowly crack this one... :) >> >> >> nothing in that page needs to talk to the network interface >> directly... what do you think does? > I'm afraid you have me a little stumped. The PF_PACKET family talks > directly with the network driver sending data to and from the app. > > Unfortunately this software uses this family instead of pcap or bpf. > So when built it errors. > > I guess if I am to use this app I will have to rewrite the way it > uses the network stack. l2tp runs over UDP packets (port 1701 (like the starship enterprise)) I have no idea why they want raw packets. talk to the writer of the web page you indicated.. maybe he can help.. >> >> >> >>>> >>>> >>>>> >>>>> 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" >>>>> >>>> >>> >>> >> > >