how to get source physical address of received udp datagrams?
Hi,
Say I have a program that listens on a udp port/socket on a Linux 2.6 kernel system.
How do I get the source physical/hardware/ethernet address of the received packets?
Without looking at /proc/net/arp or stuff like that - because this will only have stuff that has a verified IP address.
I know how to get the source IPs of the received packets (the getpeer stuff etc), and the interface the packets come in on (using the Linux specific IP_PKTINFO stuff).
So is it possible to access something like the sockaddr_ll stuff at normal udp socket levels?
I do not want to resort to using a PF_PACKET,SOCK_RAW/SOCK_DGRAM socket or other similar methods (libpcap), because I do not want the program to parse and sift through "all" packets. Just want packets destined to that port.
And yes I know ethernet addresses can also be spoofed, I just want to know what they are when a packet comes in.
Thanks!
Last edited by lyeoh; 05-31-2006 at 05:43 AM.
|