Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UDP Multicast MAC not correct? #411

Open
showengineer opened this issue Feb 25, 2021 · 5 comments
Open

UDP Multicast MAC not correct? #411

showengineer opened this issue Feb 25, 2021 · 5 comments

Comments

@showengineer
Copy link

showengineer commented Feb 25, 2021

When sending something to a multicast address (e.g 225.1.2.1), a UDP packet gets properly sent (verified with Wireshark). However, my receiver doesn't get the package.

I've tested my network and its multicasting capabilities with this program. Using the same receiver program, it doesn't get the UDP packets from my Arduino.

I have found that the only difference between the packet sent with the example program and the Arduino is the destination MAC.

The library/Arduino sets its destination MAC to FF:FF:FF:FF:FF:FF (Broadcast). While the socket in Windows sets the destination MAC to 01:00:5E:01:02:01 (IPv4mcast_01:02:01).

Is this why my receivers aren't receiving UDP packets from the Arduino or is it still my fault?

@nuno-silva
Copy link
Contributor

To receive multicast on the Arduino you need to call enableMulticast():

EtherCard/src/enc28j60.h

Lines 118 to 121 in 39a1188

/** @brief Enables reception of multicast messages
* @note This will increase load on received data handling
*/
static void enableMulticast ();

However, your problem seems to be sending from the Arduino, right?

@showengineer
Copy link
Author

Correct

@nuno-silva
Copy link
Contributor

I'd say give enableMulticast() a try anyway. I'm not sure sending multicast packets is implemented though.

@njh
Copy link
Owner

njh commented Mar 4, 2021

I have just done a test using socat on my Mac:

echo "Hello World" | socat -u - udp-datagram:225.1.2.1:1234

And can see the packets going to 01:00:5e:01:02:01 using Wireshark.

The code that sets the MAC address for broadcast/multicast addresses is here:
https://github.com/njh/EtherCard/blob/master/src/tcpip.cpp#L384

So it indeed just sets it to FF:FF:FF:FF:FF:FF.
I am a big fan of multicast, so would like to see this working.
I am surprised that your network switch cares - what sort of switch do you have?

I have a very old Ethernet hub that I sometimes use for testing Ethercard - because it blindly copies all packets to all ports, making it easier to diagnose what is going on.

@showengineer
Copy link
Author

showengineer commented Mar 4, 2021

I am surprised that your network switch cares - what sort of switch do you have?

I am using a Netgear GS108, with nothing more than my PC and the arduino board connected to it. I have tried sending packets over my main network but no results so far.

I did try hardcoding the correct multicast MAC (01:00:5e:01:02:01) as the destination mac, but the packets didn't show up in Wireshark.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants