diff options
author | Ghanan Gowripalan <ghanan@google.com> | 2021-03-22 12:30:03 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-03-22 12:31:46 -0700 |
commit | a073d76979d1950a52462823c10b495f4f8c3728 (patch) | |
tree | 819dc851e1348e411029277ce494ed5dd0d64034 /pkg/tcpip/network/ipv4 | |
parent | 6bd2c6ce7307a6422e9aad26b8b3dec006f75e2d (diff) |
Return tcpip.Error from (*Stack).GetMainNICAddress
PiperOrigin-RevId: 364381970
Diffstat (limited to 'pkg/tcpip/network/ipv4')
-rw-r--r-- | pkg/tcpip/network/ipv4/ipv4.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/pkg/tcpip/network/ipv4/ipv4.go b/pkg/tcpip/network/ipv4/ipv4.go index 74270f5f1..a43107d30 100644 --- a/pkg/tcpip/network/ipv4/ipv4.go +++ b/pkg/tcpip/network/ipv4/ipv4.go @@ -1619,9 +1619,8 @@ func (e *endpoint) processIPOptions(pkt *stack.PacketBuffer, orig header.IPv4Opt // TODO(https://gvisor.dev/issue/4586): This will need tweaking when we start // really forwarding packets as we may need to get two addresses, for rx and // tx interfaces. We will also have to take usage into account. - prefixedAddress, ok := e.protocol.stack.GetMainNICAddress(e.nic.ID(), ProtocolNumber) - localAddress := prefixedAddress.Address - if !ok { + localAddress := e.MainAddress().Address + if len(localAddress) == 0 { h := header.IPv4(pkt.NetworkHeader().View()) dstAddr := h.DestinationAddress() if pkt.NetworkPacketInfo.LocalAddressBroadcast || header.IsV4MulticastAddress(dstAddr) { |