summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorBhasker Hariharan <bhaskerh@google.com>2020-07-23 12:52:18 -0700
committergVisor bot <gvisor-bot@google.com>2020-07-23 12:54:12 -0700
commit20b556e625354dd8330e30e4075ad06eedc6a2ce (patch)
treefc63afad3c7465fe78be053fb1a39cf88295660d /pkg
parent6f7f73996791bbab6b63c248000df0d3ce652f2b (diff)
Fix wildcard bind for raw socket.
Fixes #3334 PiperOrigin-RevId: 322846384
Diffstat (limited to 'pkg')
-rw-r--r--pkg/tcpip/transport/raw/endpoint.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/tcpip/transport/raw/endpoint.go b/pkg/tcpip/transport/raw/endpoint.go
index c2e9fd29f..aefe0e2b2 100644
--- a/pkg/tcpip/transport/raw/endpoint.go
+++ b/pkg/tcpip/transport/raw/endpoint.go
@@ -456,7 +456,7 @@ func (e *endpoint) Bind(addr tcpip.FullAddress) *tcpip.Error {
defer e.mu.Unlock()
// If a local address was specified, verify that it's valid.
- if e.stack.CheckLocalAddress(addr.NIC, e.NetProto, addr.Addr) == 0 {
+ if len(addr.Addr) != 0 && e.stack.CheckLocalAddress(addr.NIC, e.NetProto, addr.Addr) == 0 {
return tcpip.ErrBadLocalAddress
}