c***@nycap.rr.com
2004-10-22 18:25:12 UTC
As I struggled with libnet_build_ethernet(), I found that it's used incorrectly in sample/ip_tos.c. That file includes:
char *hwdst = "22:22:22:22:22:22" ...;
...
eth_ptag = libnet_build_ethernet(
hwdst,
...);
but the first two arguments to libnet_build_ethernet() aren't strings, they are arrays of 6 bytes. The above code leads to a packet that has a destination MAC address of 32:32:3a:32:32:3a because '2' is 0x32 and ':' is 0x3a and libnet_build_ethernet() looks at the first 6 bytes ( "22:22:") and treats them as uint8_t, not characters.
Is there somewhere I can log this error besides this mailing list?
char *hwdst = "22:22:22:22:22:22" ...;
...
eth_ptag = libnet_build_ethernet(
hwdst,
...);
but the first two arguments to libnet_build_ethernet() aren't strings, they are arrays of 6 bytes. The above code leads to a packet that has a destination MAC address of 32:32:3a:32:32:3a because '2' is 0x32 and ':' is 0x3a and libnet_build_ethernet() looks at the first 6 bytes ( "22:22:") and treats them as uint8_t, not characters.
Is there somewhere I can log this error besides this mailing list?