fix(udp): a "multicast" row on an address that is not one still listens

Reported from a station whose two WSJT-X rows had been dead for weeks:
both were ticked multicast with 127.0.0.1 in the group box, and both
failed the join on every interface with

    setsockopt: l'adresse demandée n'est pas valide dans son contexte

which names nothing the operator typed and does not say what is wrong
with it. A multicast group runs 224.0.0.0 to 239.255.255.255; 127.0.0.1
is loopback unicast, and it is an understandable thing to type — it is
the address every other field in every other program wants.

The address is now checked before the join. When it is not a multicast
one the row listens on unicast instead, which is what such an address
means, and the log says why it is not multicast. The row works, and the
reason is in a sentence rather than in a kernel error code.
This commit is contained in:
2026-09-08 09:27:09 +02:00
parent 3415e12363
commit 612e265837
3 changed files with 61 additions and 3 deletions
+22 -1
View File
@@ -310,7 +310,28 @@ func newServer(cfg Config, out chan<- Event, mgr *Manager) *Server {
func (s *Server) start() error {
var conn *net.UDPConn
if s.cfg.Multicast {
// "Multicast" ticked with an address that is not one.
//
// 127.0.0.1 in the group box is the common mistake, and it is an
// understandable one — it is the address every other field in every other
// program wants. But a multicast group is 224.0.0.0 to 239.255.255.255, and
// joining anything else fails on every interface with a Windows error about
// an address not being valid in its context. The row then simply does not
// run, and an operator reads a setsockopt message that names nothing they
// typed.
//
// So it listens anyway, as unicast, which is what an address like that means
// — and says what it did. The row works, and the reason it is not multicast
// is in the log rather than in a kernel error code.
multicast := s.cfg.Multicast
if multicast {
if ip := net.ParseIP(strings.TrimSpace(s.cfg.MulticastGroup)); ip != nil && !ip.IsMulticast() {
applog.Printf("udp: [%s] %s is not a multicast address (those run 224.0.0.0-239.255.255.255) — listening on unicast :%d instead\n",
s.cfg.Name, ip, s.cfg.Port)
multicast = false
}
}
if multicast {
group := strings.TrimSpace(s.cfg.MulticastGroup)
if group == "" {
return fmt.Errorf("multicast enabled but group address is empty")