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.
36 lines
1.1 KiB
Go
36 lines
1.1 KiB
Go
package udp
|
|
|
|
import (
|
|
"net"
|
|
"testing"
|
|
)
|
|
|
|
// A "multicast" row whose group is not a multicast address.
|
|
//
|
|
// 127.0.0.1 in that box is the common mistake — it is the address every other
|
|
// field in every other program wants — and it used to fail the join on every
|
|
// interface with a Windows error about an address not being valid in its
|
|
// context. The row did not run and the message named nothing the operator had
|
|
// typed. Reported by an operator whose WSJT-X rows were dead for exactly this
|
|
// reason, while a third row on unicast worked perfectly beside them.
|
|
func TestOnlyRealMulticastGroupsAreJoined(t *testing.T) {
|
|
for _, tc := range []struct {
|
|
addr string
|
|
multicast bool
|
|
}{
|
|
{"224.0.0.1", true}, // the all-hosts group WSJT-X offers
|
|
{"239.255.0.1", true}, // the administratively-scoped range
|
|
{"127.0.0.1", false}, // loopback: the mistake
|
|
{"192.168.1.10", false},
|
|
{"0.0.0.0", false},
|
|
} {
|
|
ip := net.ParseIP(tc.addr)
|
|
if ip == nil {
|
|
t.Fatalf("%s does not parse", tc.addr)
|
|
}
|
|
if got := ip.IsMulticast(); got != tc.multicast {
|
|
t.Errorf("%s: IsMulticast() = %v, wanted %v", tc.addr, got, tc.multicast)
|
|
}
|
|
}
|
|
}
|