diff options
author | Ian Gudger <igudger@google.com> | 2019-02-15 18:39:10 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-02-15 18:40:15 -0800 |
commit | c611dbc5a7399922588e3fd99b22bda19f684afe (patch) | |
tree | 2bf1ac2dd626e3996d889135a32c4807345bde16 /pkg/tcpip/stack | |
parent | e2dcce544297b2364ebd4874f6db0390aafa366e (diff) |
Implement IP_MULTICAST_IF.
This allows setting a default send interface for IPv4 multicast. IPv6 support
will come later.
PiperOrigin-RevId: 234251379
Change-Id: I65922341cd8b8880f690fae3eeb7ddfa47c8c173
Diffstat (limited to 'pkg/tcpip/stack')
-rw-r--r-- | pkg/tcpip/stack/stack.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/tcpip/stack/stack.go b/pkg/tcpip/stack/stack.go index 854ebe1bb..252c79317 100644 --- a/pkg/tcpip/stack/stack.go +++ b/pkg/tcpip/stack/stack.go @@ -565,6 +565,17 @@ func (s *Stack) EnableNIC(id tcpip.NICID) *tcpip.Error { return nil } +// CheckNIC checks if a NIC is usable. +func (s *Stack) CheckNIC(id tcpip.NICID) bool { + s.mu.RLock() + nic, ok := s.nics[id] + s.mu.RUnlock() + if ok { + return nic.linkEP.IsAttached() + } + return false +} + // NICSubnets returns a map of NICIDs to their associated subnets. func (s *Stack) NICSubnets() map[tcpip.NICID][]tcpip.Subnet { s.mu.RLock() |