irtlab / rtptools

RTP Tools
http://www.cs.columbia.edu/irt/software/rtptools/
Other
162 stars 63 forks source link

rtpdump with multiple network interfaces #49

Open njh opened 6 years ago

njh commented 6 years ago

Hi,

I have been running rtpdump on my MacBook with an Internet connection over Wifi and an AES67 Audio over IP codec connected directly to an Ethernet adaptor, which is sending audio using RTP to a multicast address.

When both network interfaces are enabled, rtpdump does not receive any packets. But if I disable the Wifi interface, it works fine. I don't remember this behaviour when I was last playing with multicast - maybe it is new behaviour in Mac OS? Or maybe I never had more than one network interface.

I started looking into it and found this Stack Overflow question: https://stackoverflow.com/questions/46484186/receiving-multicast-udp-packets-from-a-single-network-interface-on-macos

So it looks like the following line in rtpdump.c, causes Mac OS to join the multicast group only on the default network interface?

mreq.imr_interface.s_addr = htonl(INADDR_ANY);

Would it make sense to add a command line option to rtpdump to specify the interface address or maybe the interface name to receive multicast packets on?

Thanks,

nick.

mcd500 commented 6 years ago

Thank you for valuable information and idea. I was keep using a desktop machine to boot on multiple OSs for checking the build and my desktop machine has only one NIC. I also need to start trying from how to make the line bellow to support specifying the interface with setsockopt() by IP_ADD_MEMBERSHIP. If you have time for programing, I greatly appreciate for the pull request. I am also happy to know that it is able to build and working on your MacOS (with one network inferface). :)