Messages in this thread | | | Date | Mon, 15 Nov 1999 12:37:42 -0100 | From | Folkert van Heusden <> | Subject | ethertap -> are this really ethernet-packets? |
| |
Ok, I finally got the ethertap-device to work. It seems I did forget to include something :)
But now I wonder; in the docs it is stated that ethernet-frames are passed trough this interface, but when I run something simple as: (some code removed)
fdin = open("/dev/tap0", O_RDWR);
for(;;) { char buf[1514]; int n; n = read(fdin, buf, 1514, 0); if (n>0) { struct ethhdr *eth = (struct ethhdr *)buf; struct iphdr *iph = (struct iphdr *)(eth+ETH_HLEN); cnt++; printf("%03d] ", cnt); disp_mac(eth -> h_source); printf(" "); disp_mac(eth -> h_dest); printf(" %04x|", eth -> h_proto); if (eth -> h_proto == 0x0800) { disp_ipa(iph -> saddr); printf(" "); disp_ipa(iph -> daddr); printf(" %02x %d %d", iph -> protocol, iph -> tot_len, iph -> ttl); } printf("\n"); } }
and I do a ping to some non-existing host on the tap0-device I get output like:
001] ff:ff:fe:fd:00:00 fb:0f:ff:ff:ff:ff 0000| 002] ff:ff:fe:fd:00:00 fb:0f:ff:ff:ff:ff 0000| 003] ff:ff:fe:fd:00:00 fb:0f:ff:ff:ff:ff 0000| 004] ff:ff:fe:fd:00:00 fb:0f:ff:ff:ff:ff 0000|
I'm not sure about the hardware-address (which looks funny to me - maybe I have to little endian some things), but that protocol-field: 0x0000?!?!
( the disp_mac-routine: void disp_mac(unsigned char *adr) { int loop;
for(loop=0; loop<ETH_ALEN; loop++) { printf("%02x", adr[loop]); if (loop<(ETH_ALEN-1)) { printf(":"); } } } )
-- ------------------------------------------------------------ Folkert van Heusden some e-mail addresses: f.v.heusden@ftr.nl, flok99@dds.nl mobile phone: +31-6-22390057
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |