Re: Q: Extract hardware address from received datagram?

From: Stephen Hemminger
Date: Mon Aug 15 2005 - 12:20:24 EST

On Mon, 15 Aug 2005 17:14:42 +0000
Albrecht Dreß <albrecht.dress@xxxxxxxx> wrote:

> Am 15.08.05 12:14 schrieb(en) Henrik Nordstrom:
> > Why is the link layer important at all in the protocol if the packet is
> > an UDP/IP (PF_INET,SOCK_DGRAM) packet?
> Due to this crazy protocol: the MAC addresses are used as some kind of
> "authentication". In the *reply* udp packet data, the micro adds its own
> mac and the mac of the requesting machine retreived from the incoming
> packet. The other end is a winbloze app which apparently uses the two
> mac's to determine whether the packet should be handles or not. It
> obvoisly had the same problems to determine the source mac, so it's
> encoded properly in the reply, but not in the request...
> I know this protocol is really broken, but unfortunately I must keep
> compatibility. Sigh!
> Thaks a lot for your suggestions,
> cheers,
> Albrecht.

Since you need access to the whole packet, don't use a UDP socket
but instead AF_PACKET. You will need to decode/encode the whole
UDP/IP headers but that is relatively easy.
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at