UDP Packets only received with C program while only WireShark capturing

asked 2017-11-14 23:49:25 +0000

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

I am sending udp packets with an Arduino using ENC28J60 module to my computer so a local network. The packets doesnt arrive while WireShark doenst capturing. When i start capturing, C program and WireShark successfuly receive the packets. Any reason for that ?

Packet Details below. Incoming to my computer from Arduino (which doesnt arrive to c program while wireshark doesnt capturing) -> Google Drive Link

Outgoing from my computer to Arduino (Arduino receives perfectly) -> Google Drive Link

Thanks a Lot.

EDIT 1 : I accidently wrote mac adress (which is my vpn adapter mac) to Arduino's destination mac. I fixed it and c program begin receiving perfectly even if wireshark closed. But when i delete force mac set command in Arduino code, the packets come my pc with mac 00:00:00:00:00:00. We think ARP requests probably doesnt work.

Pcap file - beginning of resolve network, until network stabilizes - -> Google Drive Link

edit retag flag offensive close merge delete

Comments

Not an answer yet, just a suggestion - how does your Arduino Ethernet board determine the MAC address of your PC? While capturing in WIreshark, the Ethernet interface of the PC is switched to promiscuous mode, which means that even unicast Ethernet frames which do not have the MAC address of that Ethernet interface as destination one are let through to the kernel network stack.

A supportive inditia is that in the dissection you've published, the first three bytes of the destination MAC address are not translated to vendor name, which normally happens only for a short period of time between assignment of that bytes to a vendor and incorporating that information into Wireshark's tables.

So please check the MAC address of the receiving Ethernet interface at the PC and compare it to the one to which your Arduino sends packets. If they differ, find why.

sindy gravatar imagesindy ( 2017-11-15 08:30:14 +0000 )edit

Normally with using standart ENC28J60 library(Ethernet module), destination mac adress is 00:00:00:00:00:00 but i cant receive that packets. But i made little change in library and set destination mac to my ethernet adapters mac adress. But that didnt solve the problem. There should be a problem with packets, because my computers discards them like their destion different computer. @sindy

barisdoga gravatar imagebarisdoga ( 2017-11-15 09:19:22 +0000 )edit

But i made little change in library and set destination mac to my ethernet adapters mac adress.

I have to disagree here. Look into your files. In the packets PC -> Arduino, there is

Ethernet II, Src: CompalIn_3b:23:7a (f0:76:1c:3b:23:7a), Dst: 70:69:69:2d:30:31 (70:69:69:2d:30:31)

In the packets Arduino -> PC, there is

Ethernet II, Src: 1a:2b:3c:4d:5e:6f (1a:2b:3c:4d:5e:6f), Dst: 00:ff:7e:73:a3:81 (00:ff:7e:73:a3:81)

The Dst address in the packet sent from your Arduino should be the same like the Src address in the packet sent from the PC, and it is not.

I would assume that the Arduino's standard network library contains a function to determine the MAC address of a remote device with a known IP ...(more)

sindy gravatar imagesindy ( 2017-11-15 10:23:50 +0000 )edit

Thank you a lot, yes you are right, I accidently wrote mac adress (vpn adapters :) ) to Arduino's destination mac. When i fixed it, c program begins catching packets.

After all, when i delete force destination mac set command, packets have mac address 00:00:00:00:00:00. As you said, the problem with ARP requests. I extracted wireshark capture data with beginning of resolve until network stabilizes. I am not good at network so far i couldnt understand why arduino cant set my computers mac address as destination. I couldnt understand why. Can you look at pcap file ?

Pcap File -> Google Drive Link@sindy

barisdoga gravatar imagebarisdoga ( 2017-11-15 11:07:41 +0000 )edit

Unfortunately, your capture does not show any ARP request from the Arduino side, nor does it show any ARP response from it to any of the ARP requests sent by the PC. So as a result, the PC does not send any UDP packet towards the Arduino in that capture.

It is not any more a Wireshark question - you should look at the services/functions/methods offered by the network library. If these do not include ARP resolution of IP to MAC, you'll have to put it together yourself - draw by hand an ARP request, using the one sent by the PC as a template, let the library send it, and if it receives a response, parse the response to extract the MAC address from it. Normal network stacks set a lifetime to ARP resolutions and renew them on demand to be able to accomodate to eventual changes on ...(more)

sindy gravatar imagesindy ( 2017-11-15 15:16:32 +0000 )edit