diff options
author | Tamir Duberstein <tamird@google.com> | 2020-01-13 14:45:31 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-01-13 14:47:22 -0800 |
commit | debd213da61cf35d7c91346820e93fc87bfa5896 (patch) | |
tree | 50cb6ba0f0f0c32ce18d864d5188d1df7771b7de /pkg/sentry/socket/unix | |
parent | fff04769518b279a364c928307a71055eaa6166d (diff) |
Allow dual stack sockets to operate on AF_INET
Fixes #1490
Fixes #1495
PiperOrigin-RevId: 289523250
Diffstat (limited to 'pkg/sentry/socket/unix')
-rw-r--r-- | pkg/sentry/socket/unix/unix.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/sentry/socket/unix/unix.go b/pkg/sentry/socket/unix/unix.go index 91effe89a..7f49ba864 100644 --- a/pkg/sentry/socket/unix/unix.go +++ b/pkg/sentry/socket/unix/unix.go @@ -116,13 +116,16 @@ func (s *SocketOperations) Endpoint() transport.Endpoint { // extractPath extracts and validates the address. func extractPath(sockaddr []byte) (string, *syserr.Error) { - addr, _, err := netstack.AddressAndFamily(linux.AF_UNIX, sockaddr, true /* strict */) + addr, family, err := netstack.AddressAndFamily(sockaddr) if err != nil { if err == syserr.ErrAddressFamilyNotSupported { err = syserr.ErrInvalidArgument } return "", err } + if family != linux.AF_UNIX { + return "", syserr.ErrInvalidArgument + } // The address is trimmed by GetAddress. p := string(addr.Addr) |