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 ip #200

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

udp multicast ip #200

wants to merge 1 commit into from

Conversation

valt2017
Copy link

Specific network interface (selected according its IP address) is used for UDP multicast.

Copy link
Owner

@riebl riebl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR @valt2017! I have left a few remarks which might be worth for consideration. Need to check Boost.Asio's API on socket options, but I assume it is essentially a direct mapping of setsockopt calls.

@@ -7,18 +7,28 @@
namespace ip = boost::asio::ip;
using namespace vanetza;

UdpLink::UdpLink(boost::asio::io_service& io_service, const ip::udp::endpoint& endpoint) :
UdpLink::UdpLink(boost::asio::io_service& io_service, const ip::udp::endpoint& endpoint, const std::string& ip) :
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

passing address as boost::asio::ip::address might be beneficial

multicast_endpoint_(endpoint),
tx_socket_(io_service), rx_socket_(io_service),
rx_buffer_(2560, 0x00)
{
tx_socket_.open(multicast_endpoint_.protocol());

if(ip.size() != 0){
boost::asio::ip::multicast::outbound_interface option(boost::asio::ip::address_v4::from_string(ip));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just had a look at the ip(7) man page: I assume we can even pass the interface index instead of an IP address to outbound_interface and join_group. This would save us the EthernetDevice::ip lookup call.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interface index instead of IP seems reasonable, I can try it later.

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

Successfully merging this pull request may close these issues.

None yet

2 participants