Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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?'
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: (OT) Getting the source hardware address of received UDP packets?
by ikegami (Patriarch) on Jun 01, 2006 at 07:59 UTC | |
Re: (OT) Getting the source hardware address of received UDP packets?
by isotope (Deacon) on Jun 01, 2006 at 16:26 UTC | |
by Anonymous Monk on Jun 02, 2006 at 06:12 UTC | |
by ikegami (Patriarch) on Jun 02, 2006 at 17:32 UTC | |
by isotope (Deacon) on Jun 02, 2006 at 17:07 UTC |