diff options
author | Bhasker Hariharan <bhaskerh@google.com> | 2020-07-09 16:24:43 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-07-09 16:25:57 -0700 |
commit | 5946f111827fa4e342a2e6e9c043c198d2e5cb03 (patch) | |
tree | a8353f19ad0d0b758b9df2eed2cc0c3353ecd3e1 /pkg/sentry | |
parent | e506fcd9314d3402c9e83974e9cc335348b53360 (diff) |
Add support for IP_HDRINCL IP option for raw sockets.
Updates #2746
Fixes #3158
PiperOrigin-RevId: 320497190
Diffstat (limited to 'pkg/sentry')
-rw-r--r-- | pkg/sentry/socket/netstack/netstack.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/pkg/sentry/socket/netstack/netstack.go b/pkg/sentry/socket/netstack/netstack.go index e7d2c83d7..3b248a953 100644 --- a/pkg/sentry/socket/netstack/netstack.go +++ b/pkg/sentry/socket/netstack/netstack.go @@ -2112,13 +2112,22 @@ func setSockOptIP(t *kernel.Task, ep commonEndpoint, name int, optVal []byte) *s } return syserr.TranslateNetstackError(ep.SetSockOptBool(tcpip.ReceiveIPPacketInfoOption, v != 0)) + case linux.IP_HDRINCL: + if len(optVal) == 0 { + return nil + } + v, err := parseIntOrChar(optVal) + if err != nil { + return err + } + return syserr.TranslateNetstackError(ep.SetSockOptBool(tcpip.IPHdrIncludedOption, v != 0)) + case linux.IP_ADD_SOURCE_MEMBERSHIP, linux.IP_BIND_ADDRESS_NO_PORT, linux.IP_BLOCK_SOURCE, linux.IP_CHECKSUM, linux.IP_DROP_SOURCE_MEMBERSHIP, linux.IP_FREEBIND, - linux.IP_HDRINCL, linux.IP_IPSEC_POLICY, linux.IP_MINTTL, linux.IP_MSFILTER, |