Re: Q: Extract hardware address from received datagram?

From: Jeremy Jackson
Date: Sun Aug 14 2005 - 11:29:41 EST


Albrecht Dreß wrote:

Hi all,

is there any possibility to read the hardware address (MAC) of the remote machine from received PF_INET/SOCK_DGRAM packets?

I want to write an application which opens a datagram socket, binds it to a specific port and receives broadcast messages. The sending machine is not necessarily in the same net segment. It is of course easy to get the remote ip address, but I also need the in the information in the packet header, in particular the 6-byte hardware (MAC) address of the sending machine. Apparently /proc/net/arp does not contain any information extracted from such packets.

Any idea how I could get this information? Any pointer/example?

Thanks in advance
Cheers

Albrecht

I would look at what the ISC DHCP server does, but i'm not sure you will see broadcast traffic from machines in a different network segment, since routers do not generally forward broadcasts.
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html