summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/socket/netstack
diff options
context:
space:
mode:
authorKevin Krakauer <krakauer@google.com>2020-01-08 11:15:46 -0800
committerKevin Krakauer <krakauer@google.com>2020-01-08 11:15:46 -0800
commit1e1921e2acdb7357972257219fdffb9edf17bf55 (patch)
tree12fbd37a90ebf1463277cc8c61ad4606545a7841 /pkg/sentry/socket/netstack
parent8cc1c35bbdc5c9bd6b3965311497885ce72317a8 (diff)
Minor fixes to comments and logging
Diffstat (limited to 'pkg/sentry/socket/netstack')
-rw-r--r--pkg/sentry/socket/netstack/netstack.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/sentry/socket/netstack/netstack.go b/pkg/sentry/socket/netstack/netstack.go
index f7caa45b4..8c07eef4b 100644
--- a/pkg/sentry/socket/netstack/netstack.go
+++ b/pkg/sentry/socket/netstack/netstack.go
@@ -326,7 +326,7 @@ func AddressAndFamily(sfamily int, addr []byte, strict bool) (tcpip.FullAddress,
}
family := usermem.ByteOrder.Uint16(addr)
- if family != uint16(sfamily) && (!strict && family != linux.AF_UNSPEC) {
+ if family != uint16(sfamily) && (strict || family != linux.AF_UNSPEC) {
return tcpip.FullAddress{}, family, syserr.ErrAddressFamilyNotSupported
}
@@ -1357,7 +1357,8 @@ func (s *SocketOperations) SetSockOpt(t *kernel.Task, level int, name int, optVa
}
if s.skType == linux.SOCK_RAW && level == linux.IPPROTO_IP {
- if name == linux.IPT_SO_SET_REPLACE {
+ switch name {
+ case linux.IPT_SO_SET_REPLACE:
if len(optVal) < linux.SizeOfIPTReplace {
return syserr.ErrInvalidArgument
}
@@ -1371,7 +1372,8 @@ func (s *SocketOperations) SetSockOpt(t *kernel.Task, level int, name int, optVa
return err
}
return nil
- } else if name == linux.IPT_SO_SET_ADD_COUNTERS {
+
+ case linux.IPT_SO_SET_ADD_COUNTERS:
// TODO(gvisor.dev/issue/170): Counter support.
return nil
}