[bedevtalk] ping for BONE?
Philippe Houdoin
philippe.houdoin at free.fr
Wed Nov 15 06:10:27 EST 2006
Hi Pete,
> The main catch seems to be that BONE's 'getprotobyname' just returns
> null for "icmp".
Hum, maybe because there is no /etc/protocols yet?
IIRC, BONE provides an /etc/services file, but no etc/protocols.
> Looking at a 'strings' dump of the Be ping, it appears
> to access icmp OK, but it doesn't even mention 'getprotobyname'.
Well, I guess ping *knows* for sure what the ICMP and IP protocols numbers are,
as it build itself both packets type using RAW socket. Even under BONE.
Most probably BONE just opened its sockets using constant, like:
sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
Keep in mind getprotobyname[_r]() purpose is to support future protocols. It's
kind of useless for well-established protocols like TCP/IP basic protocols.
> Is that even supposed to work under BONE?
I guess it should. At least, BONE comes with an icmp.h header...
> So how do they do it? Anybody actually *have* a working source?
> That'd be marvellous...
We don't have BONE ping source, but it should be really close to any ping
implementation using the BSD Sockets API and its SOCK_RAW mode. Haiku's one is
no exception.
- Philippe
More information about the bedevtalk
mailing list