-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello freebsd-hackers,

Recently i spent almost two hours trying to find error in my
several  shell and perl sripts. These scripts are to process
large  list  of ip addresses stored in text file and do some
stuff with boxes with given addresses on my local network.

Result:  scripts was correct, problem was with some standard
utilities such as ping and arp which has been called from my
script.

To my great surprise I found out that:
ping 192.168.0.26,
ping 192.168.0.032,
and even ping 192.168.0.0x1a - all correct commands doing
the same thing: pinging 192.168.0.26.

That was my problem. IP addresses was stored in text file in
the  form of 192.168.000.032, and after issuing command: arp
- -s  192.168.000.032  xx:xx:xx:xx:xx:xx  (which  actually was
treated as arp -s 192.168.0.26) I had a great headache.

After  some investigation I found that both ping and arp use
inet_aton()  libc  call to interpret their command arguments
into    network    format.    Futher,    inet_aton()    uses
strtoul(c,&endptr,  0)  for  each  octet  in  IP  address to
convert string representation of number to unsigned long.

Why not to use strtoul(x, x, 10) and fix aforementioned
confusing thing with arp/ping/...? Does anybody write
command arguments to ping using octal or hex format :)?

I am not hacker. Just curious.


- --
Best regards,
 Artem                          mailto:[EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (MingW32)

iD8DBQE9nD92bOuJ0KL1C+MRAgTDAJ4uMLZV3KuX0nwO+GtOPFhA6Jn+mgCeKJu4
wjt97cct6tAwV1iu5TYJORE=
=Imv8
-----END PGP SIGNATURE-----


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to