Obtain sender's MAC address for a UDP packet
Obtain sender's MAC address for a UDP packet
When I receive a UDP packet from a remote computer, I need to determine the MAC address of the (remote) interface card from which it was sent. Is there any way to do this?
-
Scott.Bonomi
- Posts: 73
- Joined: Mon Mar 09, 2020 7:36 pm
Re: Obtain sender's MAC address for a UDP packet
It should be bytes 6..11 in the datagram.
I suggest you get wireshark and capture some of your actual packets to ensure they are being built correctly.
I suggest you get wireshark and capture some of your actual packets to ensure they are being built correctly.
Re: Obtain sender's MAC address for a UDP packet
Scott.Bonomi: You don't get the Ethernet-level packet if you use the sockets interface, which valery likely is doing.
Valery: The IP you're receiving from is associated with the MAC through arp. You might be able to use the LWIP call etharp_find_addr() or etharp_get_entry() to convert the IP back to the MAC.
Valery: The IP you're receiving from is associated with the MAC through arp. You might be able to use the LWIP call etharp_find_addr() or etharp_get_entry() to convert the IP back to the MAC.
Re: Obtain sender's MAC address for a UDP packet
Thank YouValery: The IP you're receiving from is associated with the MAC through arp. You might be able to use the LWIP call etharp_find_addr() or etharp_get_entry() to convert the IP back to the MAC.
Who is online
Users browsing this forum: Google [Bot], Qwantbot and 3 guests
