Cannot send an ethernet II packet.

<[email protected]> 10 May 2004 03:50:07 -0000
Newsgroups gmane.comp.security.libnet
Message-ID <[email protected]>

Greetings everyone,

I have a problem using libnet 1.1.2. I am developping a tool in which I am crafting layer 2 packets.

After doing some monitoring with ethereal, I noticed that none of the packets I was trying to craft with libnet_autobuild_ethernet or libnet_build_ethernet were correct. Ethereal always reports a wrong type of 0x0003 instead of 0X0800 (which is IP protocol).

I know that you are going to say that's an endian problem and I forgot the host to network conversion but I did not :-).

Here is how I initialize my context and create the protocol blocks: (it's "hard coded" in the application while I am doing debugging)

/* initialize context */
libnet_init(LIBNET_LINK, "eth0" , errbuf)

/* create IPv4 block */ 
libnet_autobuild_ipv4(computeSize(), prot, dest, packet->context);

/* create ethernetlII block */
libnet_autobuild_ethernet(dest, type, packet->context)

I tried different things for "type": 0x0800, htons(0x0800) and even a fake value such as 0x0555.

Everytime, ethereal reports this:
"Protocol: unknown (0x0003) ".

If you have any idea where the mistake is...

Best regards.