Attachment "0001-Automatically-join-the-multicast-group-if-the-given-.patch" to
ticket [294ebffb63]
added by
umlaeute
2022-05-31 06:46:46.
From 2357dd0ad1bba5352c7c659320829137778056a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= <[email protected]>
Date: Tue, 31 May 2022 08:43:15 +0200
Subject: [PATCH] Automatically join the multicast group, if the given
nameserver is a multicast IP address
this allows the caller to do mDNS queries like so:
dns::resolve _http._tcp.local -nameserver "224.0.0.251" -port 5353
---
modules/dns/dns.tcl | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/modules/dns/dns.tcl b/modules/dns/dns.tcl
index 316458bb2..a1ffeaa40 100644
--- a/modules/dns/dns.tcl
+++ b/modules/dns/dns.tcl
@@ -802,6 +802,12 @@ proc ::dns::UdpTransmit {token} {
} else {
# using tcludp
set state(sock) [udp_open]
+ catch {
+ # automatically join the multicast group, if the nameserver is a multicast IP address
+ if { [ip::type $state(-nameserver)] eq "multicast" || [ip::isOverlap 224/8 $state(-nameserver)] } {
+ fconfigure $state(sock) -mcastadd $state(-nameserver);
+ }
+ }
udp_conf $state(sock) $state(-nameserver) $state(-port)
}
fconfigure $state(sock) -translation binary -buffering none
--
2.36.1