Bounty
XE-13287 · Bounty

[net/gossip_score.go] M1: privateIPNets() tidak lengkap — IP colocation detection tidak accurate

Closed · invalid — xe#432 filed 2026-11-12 02:50 UTC by wahyu20260100233-ops

Report

Ringkasan

Hanya cover: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16, 100.64.0.0/10, fd00::/8, fe80::/10.

Missing: 0.0.0.0/8, 192.0.0.0/24, 192.0.2.0/24 (TEST-NET-1), 198.18.0.0/15 (benchmarking), 198.51.100.0/24 (TEST-NET-2), 203.0.113.0/24 (TEST-NET-3), 224.0.0.0/4 (multicast), 240.0.0.0/4 (reserved), 255.255.255.255/32.

Lokasi

  • File: net/gossip_score.go
  • Lines: 119-139

Kode

func privateIPNets() []netip.Prefix {
    return []netip.Prefix{
        netip.MustParsePrefix("10.0.0.0/8"),
        netip.MustParsePrefix("172.16.0.0/12"),
        netip.MustParsePrefix("192.168.0.0/16"),
        netip.MustParsePrefix("169.254.0.0/16"),
        netip.MustParsePrefix("100.64.0.0/10"),
        netip.MustParsePrefix("fd00::/8"),
        netip.MustParsePrefix("fe80::/10"),
    }
}

Impact

IP colocation detection tidak accurate. Peer dengan IP di range yang tidak tercover dianggap bukan private, padahal seharusnya.

Suggested Fix

func privateIPNets() []netip.Prefix {
    return []netip.Prefix{
        netip.MustParsePrefix("0.0.0.0/8"),
        netip.MustParsePrefix("10.0.0.0/8"),
        netip.MustParsePrefix("100.64.0.0/10"),
        netip.MustParsePrefix("127.0.0.0/8"),
        netip.MustParsePrefix("169.254.0.0/16"),
        netip.MustParsePrefix("172.16.0.0/12"),
        netip.MustParsePrefix("192.0.0.0/24"),
        netip.MustParsePrefix("192.0.2.0/24"),
        netip.MustParsePrefix("192.168.0.0/16"),
        netip.MustParsePrefix("198.18.0.0/15"),
        netip.MustParsePrefix("198.51.100.0/24"),
        netip.MustParsePrefix("203.0.113.0/24"),
        netip.MustParsePrefix("224.0.0.0/4"),
        netip.MustParsePrefix("240.0.0.0/4"),
        netip.MustParsePrefix("255.255.255.255/32"),
        netip.MustParsePrefix("fc00::/7"),
        netip.MustParsePrefix("fd00::/8"),
        netip.MustParsePrefix("fe80::/10"),
    }
}

Atau gunakan library yang sudah maintain, misal github.com/libp2p/go-netroute atau github.com/jimstudt/netutil.

Thread

XE deskteam2026-11-20 00:49 UTCgithub

Thanks for the report. We read it against the code and could not confirm a bug in what it describes.

This report is closed as invalid. If we have missed something, file a new report that links https://bounty.xe.network/XE-13287 and says what; it is read like any other.