From af17e19901290b7c8e3dddaab1128033b06979b4 Mon Sep 17 00:00:00 2001 From: pritchardv Date: Wed, 8 Nov 2017 16:40:39 +0000 Subject: [PATCH 1/4] Set socket TTL to configured session-ttl before accepting connections Signed-off-by: pritchardv --- Dlep.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Dlep.cpp b/Dlep.cpp index c7b3a28..9e65430 100644 --- a/Dlep.cpp +++ b/Dlep.cpp @@ -465,6 +465,21 @@ Dlep::start_dlep() session_acceptor = new boost::asio::ip::tcp::acceptor(io_service_, boost::asio::ip::tcp::endpoint(session_address, session_port)); + + // Set the socket's TTL to the session-ttl config parameter + // if it exists. + + try + { + unsigned int ttl; + dlep_client.get_config_parameter("session-ttl", &ttl); + session_acceptor->set_option(boost::asio::ip::unicast::hops(ttl)); + } + catch (LLDLEP::DlepClient::BadParameterName) + { + // Let the default TTL take effect. + } + start_async_accept(); } else // we're the router From 122492f70f20685580e66fa459d92c46fe312390 Mon Sep 17 00:00:00 2001 From: pritchardv Date: Wed, 8 Nov 2017 16:41:01 +0000 Subject: [PATCH 2/4] Send Peer Offer to correct port Signed-off-by: pritchardv --- PeerDiscovery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PeerDiscovery.cpp b/PeerDiscovery.cpp index 3b14c51..d0fcdaf 100644 --- a/PeerDiscovery.cpp +++ b/PeerDiscovery.cpp @@ -593,7 +593,7 @@ PeerDiscovery::send_peer_offer(boost::asio::ip::udp::endpoint to_endpoint) } boost::asio::ip::udp::endpoint send_endpoint(to_endpoint.address(), - udp_port); + to_endpoint.port()); msg << "Sending signal to " << send_endpoint; LOG(DLEP_LOG_INFO, msg); From 78bba1fcf086d8f800039cccf4784ab93226a0da Mon Sep 17 00:00:00 2001 From: pritchardv Date: Wed, 8 Nov 2017 16:41:43 +0000 Subject: [PATCH 3/4] Use RFC8175 IANA assigned port Signed-off-by: pritchardv --- config/modem.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/modem.xml b/config/modem.xml index 4adc184..e2e7ff9 100644 --- a/config/modem.xml +++ b/config/modem.xml @@ -4,10 +4,10 @@ modem 1 eth0 - 30002 + 854 225.0.0.44 5 - 30003 + 854 5 2 emulated-modem From 75f96232048a23aa3eed039d30fd2c8dc335ed3c Mon Sep 17 00:00:00 2001 From: pritchardv Date: Wed, 8 Nov 2017 16:41:52 +0000 Subject: [PATCH 4/4] Set TTL to 255 Signed-off-by: pritchardv --- config/modem.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/modem.xml b/config/modem.xml index e2e7ff9..3ceb08e 100644 --- a/config/modem.xml +++ b/config/modem.xml @@ -7,6 +7,8 @@ 854 225.0.0.44 5 + 255 + 255 854 5 2