Date: Sun, 13 Feb 2011 16:45:11 +1000 From: Da Rock <freebsd-hackers@herveybayaustralia.com.au> To: Vlad Galu <dudu@dudu.ro> Cc: freebsd-hackers@freebsd.org Subject: Re: [maybe spam] Re: linux PF_PACKET compatibility Message-ID: <4D577DF7.4090408@herveybayaustralia.com.au> In-Reply-To: <AANLkTi=7KuS5ZK0TxH4aQwZfWTMCw4dwi7OX5qEXSoG-@mail.gmail.com> References: <4D54E39D.1000505@herveybayaustralia.com.au> <4D54F0B0.7010503@freebsd.org> <4D550300.5090000@herveybayaustralia.com.au> <4D5565C7.1010809@freebsd.org> <4D55CE5A.8040902@herveybayaustralia.com.au> <4D55E015.3010709@freebsd.org> <20110212103923.3098f6b3@ernst.jennejohn.org> <4D5660D9.2040002@herveybayaustralia.com.au> <AANLkTi=7KuS5ZK0TxH4aQwZfWTMCw4dwi7OX5qEXSoG-@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 02/13/11 06:15, Vlad Galu wrote: > > > On Sat, Feb 12, 2011 at 12:28 PM, Da Rock > <freebsd-hackers@herveybayaustralia.com.au > <mailto:freebsd-hackers@herveybayaustralia.com.au>> wrote: > > On 02/12/11 19:39, Gary Jennejohn wrote: > > On Fri, 11 Feb 2011 17:19:17 -0800 > Julian Elischer<julian@freebsd.org > <mailto:julian@freebsd.org>> wrote: > > > On 2/11/11 4:03 PM, Da Rock wrote: > > 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. > > > Ther's a sendarp() routine which uses PF_PACKET to directly > access the > network driver and bypass the stack. Lazy Linuxers who have > no idea > or don't care that other operating systems exist. > > > Indeed. Is it possible to leverage another compatible routine? I > haven't had a look yet as I just read the message, but can I > (after checking return values and arguments) just drop in another > arp routine? Or are they simply incompatible across the board? > > From what I understand they should all be essentially doing the > same thing, but I could be wrong on this. Alternatively would I > have to basically rewrite the arp.c to be posix compatible (for > portability)? > > Cheers > > > You only need to rewrite the sendarp() routine, using a BPF device > descriptor instead of the PF_PACKET socket descriptor. Take a look at > libdnet[1] and rbootd[2]'s source. > > [1] http://libdnet.sf.net/ > [2] http://ftp.fr.openbsd.org/pub/OpenBSD/src/usr.sbin/rbootd/ > > You will need, however, to fill the source with #ifdefs to compensate > the fact that Linux has assigned different names and sizes to the > members of struct ether_header and arphdr (and has a _BSD_SOURCE knob > to accomodate compiling BSD-based software)./ / Ok, I think I know where I have this thing ass-backwards now: I was looking for similar structs with the same _size_- they don't have to be! Duh! I've figured the out the members like ETH_ALEN and defined the bsd equivalent, I'll have to look into the _BSD_SOURCE. Thx for the recorrect :)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D577DF7.4090408>