mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Allow MSG_OOB and MSG_DONTROUTE to be no-ops on recvmsg(2).
PiperOrigin-RevId: 228428223 Change-Id: I433ba5ffc15ea4c2706ec944901b8269b1f364f8
This commit is contained in:
@@ -63,6 +63,10 @@ var messageHeader64Len = uint64(binary.Size(MessageHeader64{}))
|
||||
// multipleMessageHeader64Len is the length of a multipeMessageHeader64 struct.
|
||||
var multipleMessageHeader64Len = uint64(binary.Size(multipleMessageHeader64{}))
|
||||
|
||||
// baseRecvFlags are the flags that are accepted across recvmsg(2),
|
||||
// recvmmsg(2), and recvfrom(2).
|
||||
const baseRecvFlags = linux.MSG_OOB | linux.MSG_DONTROUTE | linux.MSG_DONTWAIT | linux.MSG_NOSIGNAL | linux.MSG_WAITALL | linux.MSG_TRUNC | linux.MSG_CTRUNC
|
||||
|
||||
// MessageHeader64 is the 64-bit representation of the msghdr struct used in
|
||||
// the recvmsg and sendmsg syscalls.
|
||||
type MessageHeader64 struct {
|
||||
@@ -602,7 +606,7 @@ func RecvMsg(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sysca
|
||||
}
|
||||
|
||||
// Reject flags that we don't handle yet.
|
||||
if flags & ^(linux.MSG_DONTWAIT|linux.MSG_NOSIGNAL|linux.MSG_PEEK|linux.MSG_TRUNC|linux.MSG_CTRUNC|linux.MSG_CMSG_CLOEXEC|linux.MSG_ERRQUEUE|linux.MSG_WAITALL) != 0 {
|
||||
if flags & ^(baseRecvFlags|linux.MSG_PEEK|linux.MSG_CMSG_CLOEXEC|linux.MSG_ERRQUEUE) != 0 {
|
||||
return 0, nil, syscall.EINVAL
|
||||
}
|
||||
|
||||
@@ -637,7 +641,7 @@ func RecvMMsg(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sysc
|
||||
}
|
||||
|
||||
// Reject flags that we don't handle yet.
|
||||
if flags & ^(linux.MSG_DONTWAIT|linux.MSG_NOSIGNAL|linux.MSG_TRUNC|linux.MSG_CTRUNC|linux.MSG_CMSG_CLOEXEC|linux.MSG_ERRQUEUE|linux.MSG_WAITALL) != 0 {
|
||||
if flags & ^(baseRecvFlags|linux.MSG_CMSG_CLOEXEC|linux.MSG_ERRQUEUE) != 0 {
|
||||
return 0, nil, syscall.EINVAL
|
||||
}
|
||||
|
||||
@@ -794,7 +798,7 @@ func recvFrom(t *kernel.Task, fd kdefs.FD, bufPtr usermem.Addr, bufLen uint64, f
|
||||
}
|
||||
|
||||
// Reject flags that we don't handle yet.
|
||||
if flags & ^(linux.MSG_DONTWAIT|linux.MSG_NOSIGNAL|linux.MSG_PEEK|linux.MSG_TRUNC|linux.MSG_CTRUNC|linux.MSG_CONFIRM|linux.MSG_WAITALL) != 0 {
|
||||
if flags & ^(baseRecvFlags|linux.MSG_PEEK|linux.MSG_CONFIRM) != 0 {
|
||||
return 0, syscall.EINVAL
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user