interesting problem with raw sockets

Christopher Friesen (cfriesen@nortelnetworks.com)
Thu, 26 Apr 2001 14:02:15 -0400


I have a piece of code that is trying to use sendmsg() on a raw socket to inject
a UDP packet onto an ethernet link. The destination IP address is set to
another machine on the same subnet, and the packet arrives at its destination.
Thus far all is well.

However, inspection of the ethernet headers using tcpdump shows that rather than
being addressed directly to the MAC address of the destination, the packet is
instead being sent to the gateway, which then appears to forward it on to the
destination. It almost appears as though the kernel doesn't realize that the IP
address is on the same subnet.

Here's where it gets interesting. I grabbed what I thought was all the socket
setup and sending code from the misbehaving application and stuck them into a
tiny program that builds and sends empty packets with arbitrary source and
destination addresses. Tcpdump shows this program behaving as expected--ie the
destination MAC address in the ethernet header is set to the MAC address of the
destination, not the MAC address of the gateway.

Does anyone have any clue what might be going on? I'm almost ready to try
strace and kernel debugging....

Thanks,

Chris

-- 
Chris Friesen                    | MailStop: 043/33/F10  
Nortel Networks                  | work: (613) 765-0557
3500 Carling Avenue              | fax:  (613) 765-2986
Nepean, ON K2H 8E9 Canada        | email: cfriesen@nortelnetworks.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/