-
Notifications
You must be signed in to change notification settings - Fork 180
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
switch off udp receiving of other hosts if network_mode=local #1231
Conversation
THIS approach is not working :-( |
So it still receives traffic from other hosts? |
No, but not from own host either. :-) |
I am writing this comment without checking back with the Internet, but I think "127.0.0.1" just isn't a multicast address. There is no multicast group you can join on that. To whom is this suppost to be multicasted to, anyways? there is just 1 machine on 127.0.0.1. You should be able to just unicast that address. |
check sender/source udp datagram address in udp_receiver_asio.cpp and udp_receiver_npcap.cpp implementation to not process none local host packages in local network mode
if (m_localhost) | ||
{ | ||
// if this is not a local address, return 0 | ||
if (!isLocalAddress(m_sender_endpoint.address())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your definition of a "Local address" has nothing to do with a loopback address (-> localhost)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I didn't name that unambiguously. What is meant is that the network packets come from your own machine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But your isLocalAddress
doesn't check if that IP belongs to your own machine. It checks whether the IP belongs to any machine in any local area network.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I got it .. yes that is true. So this approach will not work at all I think.
if (address.is_v4()) | ||
{ | ||
uint32_t ip = address.to_v4().to_ulong(); | ||
return ((ip & 0xFF000000) == 0x0A000000) || // 10.0.0.0/8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am puzzled why you would care about those. Why not just use a loopback address (127.0.0.0 - 127.255.255.255 https://de.wikipedia.org/wiki/Loopback)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my first approach. On my local system, however, I see packets that have my own IPv4 address as the sender 10.x.x.x instead of "127.x.x.x". I need to investigate this further - IT's A DRAFT :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good news is that with this draft fix all gtest (including local UDP Pub/Sub) and all samples are running correctly with and without local mode setting and with and without activated npcap mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, but then you are probably using DNS to resolve your hostname. Just skip DNS and just send to 127.0.0.1 directly. Why use DNS, if you already know the IP.
Btw, there is no guarantee that DNS will resolve your hostname to a local IP. It could also be a public IP, if you have one. I guess you rather want to check whether the resolved IP address is a multicast or a unicast address. But still I think you don't need DNS at all to send to a loopback adapter.
This will fixed in an upcoming new udp layer implememtation. |
Description
If network mode is set to local (
network_enabled=false
) in the ecal global configuration (ecal.ini
) the receiving of any kind of udp samples is switched off.Related issues
Fixes #1191
Cherry-pick to