-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
wrote:
> I am facing an issue in my app that is analysing network packets. I
> see that inet_ntoa function (defined in <arpa/inet.h> is not printing
> correctly.
>
> When I print (I have ip pointer variable populated), it prints
> correctly:
> printf(log_msg, "From %lu to %lu", (ip->ip_src).s_addr, (ip-
>> ip_dest).s_addr);
> //prints From 192.168.10.2 to 192.168.10.15
>
> But when I print, it is printing src and dest ip same:
> printf(log_msg, "From %s to %s", inet_ntoa(ip->ip_src), inet_ntoa(ip-
>> ip_dest));
> //prints From 192.168.10.2 to 192.168.10.2
>
> Anything wrong here ?
>
> -Satish
Does that first comment specify what the call actually prints? The way
I understand those functions, the second call is correct and does what
you say, but the first one should not print dotted quads.
- --
- --Falcon Darkstar Kirtaran
- --
- --OpenPGP: (7902:4457) 9282:A431
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla -
http://enigmail.mozdev.org
iQIcBAEBAgAGBQJJa1VPAAoJEKmxP9YxEE4rfXgP/i2MzrMi19L+Baph5UPObNbT
if4j3fC9eMVRabJQ7fVKYHdtgtNxo/m+jlV44JoqK6y/CmFJT1bZsU9NI69fb0F/
oQdDnZ8JamMFKVziHnpLRHZLoTw7jh9SepgNmu3b8IPaXZA2i+ xxBpW5AA2/Y51k
Gp+cV90B1ijykNNFfLhzI+p4no2kxiOMGRXfvsUV7KrqpC3JB5 3HFDyTImL+CiIL
KmkFrgHNtmB/J9X2K2/SrV7UEsWHbh+wn5lvGL8l+vK68jLLvSLgMv99A2MevKj0
BiLfZ6DUFSLGwOoBZudKmmt7DwauqI2YZWj9mDweuEmfaH6ABf QYg9lgvTOHWZfj
MbseefSU8R3A7SVJ5quyb2GpEf65AGU+9d7FDrj3JkIA27UZtf KNrZypBfNF4XlR
lWB9tXYN1+8QBIBdkal2HwquXKbVyX0SiyIVCybih+8qw04bik rOkDnR5xiFauRu
FG4cydhRm1E6CpdVI2y0okYfTF6BXuKWy2iwU13EdTqLZ15MP5 K8QT6fYuWPV7W3
xXp/+WOsfBy1aQJNSF2hAOUx+kSd+3XwLPEZ0q5034RDI3P+AzvseE M3uwVJRCIt
Os6iqxpvZe0vhpsjHP+GVyn6hncmQJVqeCoJ6/dw1mCnsQiYz+PHP/GQr59oMMtq
f16EYX/qRHHaXdDw5Pcx
=qTz8
-----END PGP SIGNATURE-----