Say I have a perl 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?
I want to do this without looking at /proc/net/arp or running /sbin/arp - 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 thingies etc), and the interface the packets come in on (using the Linux specific IP_PKTINFO stuff).
So is it possible to similarly 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 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 would like to know what they are when a packet comes in.
Thanks!
2006-06-03 Retitled by g0n, as per Monastery guidelines
Original title: 'Getting the source hardware address of received UDP packets?'
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |