Skip to content

Commit

Permalink
multicast: Populate the NetworkInfo with the right subnet
Browse files Browse the repository at this point in the history
Don't falsely populate the subnet by using the regular network address.
Use the actual network address.

Signed-off-by: Julian Pelizäus <[email protected]>
  • Loading branch information
roosterfish committed Feb 13, 2025
1 parent 648e6c6 commit a0649eb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions multicast/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ func GetNetworkInfo() ([]NetworkInfo, error) {
}

for _, addr := range addrs {
ipNet, ok := addr.(*net.IPNet)
if !ok {
ip, ipNet, err := net.ParseCIDR(addr.String())
if err != nil {
continue
}

if !ipNet.IP.IsGlobalUnicast() {
if !ip.IsGlobalUnicast() {
continue
}

networks = append(networks, NetworkInfo{Interface: iface, Address: ipNet.IP.String(), Subnet: ipNet})
networks = append(networks, NetworkInfo{Interface: iface, Address: ip.String(), Subnet: ipNet})
}
}

Expand Down

0 comments on commit a0649eb

Please sign in to comment.