2024-01-04 17:40:18 +00:00
|
|
|
// Copyright (c) Tailscale Inc & AUTHORS
|
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
|
2024-05-01 13:20:09 +00:00
|
|
|
// Common code for FreeBSD. This might also work on other
|
2024-01-04 17:40:18 +00:00
|
|
|
// BSD systems (e.g. OpenBSD) but has not been tested.
|
2024-05-01 13:20:09 +00:00
|
|
|
// Not used on iOS or macOS. See defaultroute_darwin.go.
|
2024-01-04 17:40:18 +00:00
|
|
|
|
2024-05-01 13:20:09 +00:00
|
|
|
//go:build freebsd
|
2024-01-04 17:40:18 +00:00
|
|
|
|
2024-04-28 04:18:18 +00:00
|
|
|
package netmon
|
2024-01-04 17:40:18 +00:00
|
|
|
|
|
|
|
import "net"
|
|
|
|
|
|
|
|
func defaultRoute() (d DefaultRouteDetails, err error) {
|
|
|
|
idx, err := DefaultRouteInterfaceIndex()
|
|
|
|
if err != nil {
|
|
|
|
return d, err
|
|
|
|
}
|
|
|
|
iface, err := net.InterfaceByIndex(idx)
|
|
|
|
if err != nil {
|
|
|
|
return d, err
|
|
|
|
}
|
|
|
|
d.InterfaceName = iface.Name
|
|
|
|
d.InterfaceIndex = idx
|
|
|
|
return d, nil
|
|
|
|
}
|