mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Support IPV6_RECVPKTINFO on UDP sockets
PiperOrigin-RevId: 397631833
This commit is contained in:
committed by
gVisor bot
parent
09477db2bc
commit
89a0011c10
@@ -1371,6 +1371,14 @@ func getSockOptIPv6(t *kernel.Task, s socket.SocketOps, ep commonEndpoint, name
|
||||
v := primitive.Int32(boolToInt32(ep.SocketOptions().GetReceiveOriginalDstAddress()))
|
||||
return &v, nil
|
||||
|
||||
case linux.IPV6_RECVPKTINFO:
|
||||
if outLen < sizeOfInt32 {
|
||||
return nil, syserr.ErrInvalidArgument
|
||||
}
|
||||
|
||||
v := primitive.Int32(boolToInt32(ep.SocketOptions().GetIPv6ReceivePacketInfo()))
|
||||
return &v, nil
|
||||
|
||||
case linux.IP6T_ORIGINAL_DST:
|
||||
if outLen < sockAddrInet6Size {
|
||||
return nil, syserr.ErrInvalidArgument
|
||||
@@ -2127,6 +2135,15 @@ func setSockOptIPv6(t *kernel.Task, s socket.SocketOps, ep commonEndpoint, name
|
||||
ep.SocketOptions().SetReceiveOriginalDstAddress(v != 0)
|
||||
return nil
|
||||
|
||||
case linux.IPV6_RECVPKTINFO:
|
||||
if len(optVal) < sizeOfInt32 {
|
||||
return syserr.ErrInvalidArgument
|
||||
}
|
||||
v := int32(hostarch.ByteOrder.Uint32(optVal))
|
||||
|
||||
ep.SocketOptions().SetIPv6ReceivePacketInfo(v != 0)
|
||||
return nil
|
||||
|
||||
case linux.IPV6_TCLASS:
|
||||
if len(optVal) < sizeOfInt32 {
|
||||
return syserr.ErrInvalidArgument
|
||||
@@ -2516,7 +2533,6 @@ func emitUnimplementedEventIPv6(t *kernel.Task, name int) {
|
||||
linux.IPV6_RECVHOPLIMIT,
|
||||
linux.IPV6_RECVHOPOPTS,
|
||||
linux.IPV6_RECVPATHMTU,
|
||||
linux.IPV6_RECVPKTINFO,
|
||||
linux.IPV6_RECVRTHDR,
|
||||
linux.IPV6_RTHDR,
|
||||
linux.IPV6_RTHDRDSTOPTS,
|
||||
@@ -2742,6 +2758,8 @@ func (s *socketOpsCommon) controlMessages(cm tcpip.ControlMessages) socket.Contr
|
||||
TClass: readCM.TClass,
|
||||
HasIPPacketInfo: readCM.HasIPPacketInfo,
|
||||
PacketInfo: readCM.PacketInfo,
|
||||
HasIPv6PacketInfo: readCM.HasIPv6PacketInfo,
|
||||
IPv6PacketInfo: readCM.IPv6PacketInfo,
|
||||
OriginalDstAddress: readCM.OriginalDstAddress,
|
||||
SockErr: readCM.SockErr,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user