Raw socket behavior in OS/X 10.5... "Invalid argument"?
Raw socket behavior in OS/X 10.5... "Invalid argument"?
- Subject: Raw socket behavior in OS/X 10.5... "Invalid argument"?
- From: Hostile Fork <email@hidden>
- Date: Mon, 11 Aug 2008 14:01:58 -0700
Hello again list... :)
I just posted about my motivations for using the "libnet" layer, which I think is a generally useful thing:
http://packetfactory.net/projects/libnet/
On the Mac implementation of libnet, I'd tripped over a problem that I sent to the library's author (Mike Schiffman). Mike got back to me about my question today, because he is brushing up the code for a new release of libnet... and said he found it happened to him too.
The problem has to do with getting "Invalid argument" errors when running the raw socket samples on OS/X 10.5. It's pretty easy to build the library and see what I'm talking about. The simplest case is probably ip_raw, which uses LIBNET_RAW4:
$ sudo sample/ip_raw
libnet 1.1 packet shaping: IP + payload[raw]
Using device (null)
Write error: libnet_write_raw_ipv4(): -1 bytes written (Invalid argument)
The same code worked fine on a Fedora Core linux box, FWIW.
In my DHCP server, I would have liked to use the raw socket layer so I wouldn't have to construct the link layer myself! I worked around it because the get_addr example worked (and gave back real numbers, not xx):
$ sudo sample/get_addr
libnet 1.1 address getter
Interface: en0
MAC address: xx:xx:xx:xx:xx:xx
IP address: xxx.xxx.xx.x
So I was able to use that number to fill in the slots for the link layer (LIBNET_LINK). But beyond the issue of it being extra work, I'm still a bit fuzzy on how that might affect the code if it were running on a different kind of network...
Can anyone confirm if the raw sockets used to work in an old OS/X and then stopped working? Does anyone know why that "Invalid argument" is happening?
(Note: You will probably notice that the documentation on the libnet website is out of date with the current release. If you look inside the archive for the current release, it contains current sample code and READMEs which are better. I'm encouraging Mike to switch to a wiki or CMS for documentation...)
Thank you! This is a good library and I hope we can figure out what's wrong before the updated release... --- http://hostilefork.com
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden