LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-31-2006, 05:35 AM   #1
lyeoh
LQ Newbie
 
Registered: May 2006
Posts: 1

Rep: Reputation: 0
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
API for mapping Physical Address to Virtual Address Lakshman_smt Linux - Software 2 10-15-2006 09:08 PM
Wrong 'From' address on mail received from sendmail pioniere Linux - General 2 05-21-2004 03:41 PM
how to broadcast UDP datagrams sokar Programming 2 02-14-2004 05:37 PM
NIC physical address hennaheto Linux - Networking 2 01-30-2004 08:40 PM
Physical Address yangh66 Linux - Networking 2 06-19-2001 08:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration