net/interfaces: include DefaultRouteInterface in interfaces.State

And log it in wgengine on change. Changing bug in #643.

Updates #643
This commit is contained in:
Brad Fitzpatrick
2020-08-12 12:48:34 -07:00
parent 75225368a4
commit b97aac1718
3 changed files with 26 additions and 1 deletions

View File

@ -163,6 +163,10 @@ type State struct {
// considered "expensive", which currently means LTE/etc
// instead of Wifi. This field is not populated by GetState.
IsExpensive bool
// DefaultRouteInterface is the interface name for the machine's default route.
// It is not yet populated on all OSes.
DefaultRouteInterface string
}
func (s *State) Equal(s2 *State) bool {
@ -198,6 +202,7 @@ func GetState() (*State, error) {
}); err != nil {
return nil, err
}
s.DefaultRouteInterface, _ = DefaultRouteInterface()
return s, nil
}