diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-10-06 14:02:07 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-10-06 14:02:07 -0700 |
commit | b761330ca7bd5e956e3b90b4202ff0c3ea892750 (patch) | |
tree | d358154c552798ddceaa6f04b84abe26e58d05d5 | |
parent | 1336af78d5dc2a6bc54d22ed45f4dd4793c2f964 (diff) | |
parent | 6f5114446a7952d8b2b3098b2845e660d38d4fe1 (diff) |
Merge pull request #4355 from majek:marek/swallow-SO_RCVBUFFORCE-error
PiperOrigin-RevId: 335714100
-rw-r--r-- | runsc/sandbox/network.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/runsc/sandbox/network.go b/runsc/sandbox/network.go index 0b9f39466..8f66dd1f8 100644 --- a/runsc/sandbox/network.go +++ b/runsc/sandbox/network.go @@ -309,11 +309,20 @@ func createSocket(iface net.Interface, ifaceLink netlink.Link, enableGSO bool) ( const bufSize = 4 << 20 // 4MB. if err := syscall.SetsockoptInt(fd, syscall.SOL_SOCKET, syscall.SO_RCVBUFFORCE, bufSize); err != nil { - return nil, fmt.Errorf("failed to increase socket rcv buffer to %d: %v", bufSize, err) + syscall.SetsockoptInt(fd, syscall.SOL_SOCKET, syscall.SO_RCVBUF, bufSize) + sz, _ := syscall.GetsockoptInt(fd, syscall.SOL_SOCKET, syscall.SO_RCVBUF) + + if sz < bufSize { + log.Warningf("Failed to increase rcv buffer to %d on SOCK_RAW on %s. Current buffer %d: %v", bufSize, iface.Name, sz, err) + } } if err := syscall.SetsockoptInt(fd, syscall.SOL_SOCKET, syscall.SO_SNDBUFFORCE, bufSize); err != nil { - return nil, fmt.Errorf("failed to increase socket snd buffer to %d: %v", bufSize, err) + syscall.SetsockoptInt(fd, syscall.SOL_SOCKET, syscall.SO_SNDBUF, bufSize) + sz, _ := syscall.GetsockoptInt(fd, syscall.SOL_SOCKET, syscall.SO_SNDBUF) + if sz < bufSize { + log.Warningf("Failed to increase snd buffer to %d on SOCK_RAW on %s. Curent buffer %d: %v", bufSize, iface.Name, sz, err) + } } return &socketEntry{deviceFile, gsoMaxSize}, nil |