After the Circus

Random Sample
Midnight Magic

contact me
jean at geemoo dot ca

May 6, 2008
So, I've been in the process of getting some hardware running linux and I ran into an interesting problem today.

The symptoms...
UDP works fine (I can DHCP an IP from the DHCP server).
ICMP works fine (I can ping remote hosts, and remote hosts can ping me).
TCP doesn't work... Hrmm odd. I'm testing with netcat by opening a port on the board, and then trying to connect to it from another host. The remote host can send a SYN, but the board doesn't acknowledge it.

Testing things in the other direction, the board can send a SYN, the remote host change the port state to SYN_RECV, but the board ignores the syn-ack and doesn't reply. Odd..

Time to start poking around in the kernel. Added some printk()s to various parts in tcp_recv().. hrmm the dest ip is correct.. the port is right. The skb type isn't set to PACKET_HOST.. Hrmm It's actually set to 2.. which according to the include/linux/if_packet.h is PACKET_MULTICAST... that doesn't make any sense at all...

I don't remember exactly how I figured it out, but I think it was one of those times where your brain suddenly snaps into clarity. One of the options that are settable in the environment of the bootloader, is the MAC address to be used for the ethernet interface. For reasons unknown to myself, I had decided to use 11:22:33:44:55:66. It seemed like a nice enough MAC. Little did I know, that there are a bunch of reserved MAC addresses that you can't use. Infact 50% of the MAC address space is reserved for multicast.

If the Least Significant Bit in the First Byte of your MAC is a 1, then it's a multicast address. If the LSB in the first byte is a 0, then it's a normal address. That's all there is to it.

I erased my env, set a new MAC that I stole off an old 10Mbps ISA ethernet card, and things were once again working great.
Tags: linux, networking, kernel,