Click to See Complete Forum and Search --> : Libnet


aph3x
11-30-2001, 03:43 AM
hi everyone,

i have recently taken up learning the Libnet API(http://www.packetfactory.net/libnet) i am trying to work my way up the various network protocol layers, starting at the link layer, but i am having a small problem:

i have a simple program which accepts a command line argument specifying an interface on which to send ARP frames. if a device is not specified (NULL), i use libnet_select_device() which opens the first device found (other than the loopback).

i am trying to have the interface name and IP address displayed on screen and im using libnet_get_ipaddress() to return the network byte-ordered (big endian) IP address assigned to the interface. according to the Libnet manual, *libnet_host_lookup() "converts the supplied network-ordered (big-endian) IP address into its human-readable counterpart".

so, i am passing the returned value from libnet_get_ipaddress() as an argument to *libnet_host_lookup(). when it gets displayed on the screen, the IP address is written backwards, ie: 1.0.168.192 for 192.168.0.1 :confused:

the only workaround i have found is to use inet_ntop() to convert the IP to host byte-order... then it is displayed correctly. am i missing something simple?

also, i would like any suggestion as to how i can pass a source and/or destination MAC address as a command line argument.

any help appreciated :)

aph3x
12-03-2001, 03:14 AM
anyone? anyone?
bueller... bueller... bueller...