diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2025-07-11 10:23:43 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2025-07-11 10:23:43 +0200 |
commit | 41a417bee0a55712a23a7a4bc080a021fe84ad51 (patch) | |
tree | f1a7ca7dbbc5f5c95639f42340eb143f9d4ec276 /lib/edioutput | |
parent | 53bc9d56c02397c01505beee090851ed40e6f8c6 (diff) | |
download | dabmux-41a417bee0a55712a23a7a4bc080a021fe84ad51.tar.gz dabmux-41a417bee0a55712a23a7a4bc080a021fe84ad51.tar.bz2 dabmux-41a417bee0a55712a23a7a4bc080a021fe84ad51.zip |
common 3849213: allow setting TTL without UDP source
Diffstat (limited to 'lib/edioutput')
-rw-r--r-- | lib/edioutput/EDIConfig.h | 3 | ||||
-rw-r--r-- | lib/edioutput/Transport.cpp | 16 |
2 files changed, 14 insertions, 5 deletions
diff --git a/lib/edioutput/EDIConfig.h b/lib/edioutput/EDIConfig.h index 7016e87..de4217f 100644 --- a/lib/edioutput/EDIConfig.h +++ b/lib/edioutput/EDIConfig.h @@ -27,6 +27,7 @@ #pragma once +#include <optional> #include <vector> #include <string> #include <memory> @@ -60,7 +61,7 @@ struct udp_destination_t : public destination_t { uint16_t dest_port = 0; std::string source_addr; uint16_t source_port = 0; - uint8_t ttl = 10; + std::optional<uint8_t> ttl = std::nullopt; }; // TCP server that can accept multiple connections diff --git a/lib/edioutput/Transport.cpp b/lib/edioutput/Transport.cpp index e9559b5..6707a90 100644 --- a/lib/edioutput/Transport.cpp +++ b/lib/edioutput/Transport.cpp @@ -41,10 +41,15 @@ void configuration_t::print() const if (auto udp_dest = dynamic_pointer_cast<edi::udp_destination_t>(edi_dest)) { etiLog.level(info) << " UDP to " << udp_dest->dest_addr << ":" << udp_dest->dest_port; if (not udp_dest->source_addr.empty()) { - etiLog.level(info) << " source " << udp_dest->source_addr; - etiLog.level(info) << " ttl " << udp_dest->ttl; + etiLog.level(info) << " source address=" << udp_dest->source_addr; } - etiLog.level(info) << " source port " << udp_dest->source_port; + if (udp_dest->ttl) { + etiLog.level(info) << " ttl=" << (int)(*udp_dest->ttl); + } + else { + etiLog.level(info) << " ttl=(default)"; + } + etiLog.level(info) << " source port=" << udp_dest->source_port; } else if (auto tcp_dest = dynamic_pointer_cast<edi::tcp_server_t>(edi_dest)) { etiLog.level(info) << " TCP listening on port " << tcp_dest->listen_port; @@ -80,7 +85,10 @@ Sender::Sender(const configuration_t& conf) : if (not udp_dest->source_addr.empty()) { udp_socket.setMulticastSource(udp_dest->source_addr.c_str()); - udp_socket.setMulticastTTL(udp_dest->ttl); + } + + if (udp_dest->ttl) { + udp_socket.setMulticastTTL(*udp_dest->ttl); } auto sender = make_shared<udp_sender_t>( |