diff options
Diffstat (limited to 'pkg/tcpip/stack/nic.go')
-rw-r--r-- | pkg/tcpip/stack/nic.go | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/pkg/tcpip/stack/nic.go b/pkg/tcpip/stack/nic.go index 62f7c880e..ca15c0691 100644 --- a/pkg/tcpip/stack/nic.go +++ b/pkg/tcpip/stack/nic.go @@ -568,23 +568,19 @@ func (n *nic) primaryAddresses() []tcpip.ProtocolAddress { return addrs } -// primaryAddress returns the primary address associated with this NIC. -// -// primaryAddress will return the first non-deprecated address if such an -// address exists. If no non-deprecated address exists, the first deprecated -// address will be returned. -func (n *nic) primaryAddress(proto tcpip.NetworkProtocolNumber) tcpip.AddressWithPrefix { +// PrimaryAddress implements NetworkInterface. +func (n *nic) PrimaryAddress(proto tcpip.NetworkProtocolNumber) (tcpip.AddressWithPrefix, tcpip.Error) { ep, ok := n.networkEndpoints[proto] if !ok { - return tcpip.AddressWithPrefix{} + return tcpip.AddressWithPrefix{}, &tcpip.ErrUnknownProtocol{} } addressableEndpoint, ok := ep.(AddressableEndpoint) if !ok { - return tcpip.AddressWithPrefix{} + return tcpip.AddressWithPrefix{}, &tcpip.ErrNotSupported{} } - return addressableEndpoint.MainAddress() + return addressableEndpoint.MainAddress(), nil } // removeAddress removes an address from n. |