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?
-
- 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.
-
- Posts: 9770
- Joined: Thu Nov 26, 2015 4:08 am
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 YouESP_Sprite wrote: ↑Thu Nov 12, 2020 1:16 amValery: 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: doragasu and 76 guests