jackpal / gateway

A golang library for discovering the address of a LAN gateway.
BSD 3-Clause "New" or "Revised" License
226 stars 69 forks source link

Fix panic when interface not set in Solaris `netstat -rn` output #42

Closed sot-tech closed 6 months ago

sot-tech commented 6 months ago

Interface name for default route may be omitted (i.e. if set in /etc/defaultrouter)

github.com/jackpal/gateway.parseNetstatToRouteStruct({0xc001226000, 0x3e9, 0xc0008f2000?})
    github.com/jackpal/gateway@v1.0.13/gateway_parsers.go:394 +0x605
github.com/jackpal/gateway.parseUnixGatewayIP({0xc001226000?, 0x6c2e313234373532?, 0x6264?})
    github.com/jackpal/gateway@v1.0.13/gateway_parsers.go:355 +0x1c
github.com/jackpal/gateway.discoverGatewayOSSpecific()
    github.com/jackpal/gateway@v1.0.13/gateway_solaris.go:22 +0x2a
github.com/jackpal/gateway.DiscoverGateway(...)
    github.com/jackpal/gateway@v1.0.13/gateway.go:46

See: syncthing/syncthing#9453

jackpal commented 6 months ago

Thanks!