Fix SO_ACCEPTCONN option for unix sockets.

SO_ACCEPTCONN returns true for TCP sockets which are in a listening state.
Added this socket option support for unix sockets.

PiperOrigin-RevId: 577008617
This commit is contained in:
Nayana Bidari
2023-10-26 15:48:38 -07:00
committed by gVisor bot
parent b445e3ca8e
commit aa02c6fa15
5 changed files with 45 additions and 7 deletions
+2 -7
View File
@@ -1076,13 +1076,8 @@ func getSockOptSocket(t *kernel.Task, s socket.Socket, ep commonEndpoint, family
return nil, syserr.ErrInvalidArgument
}
// This option is only viable for TCP endpoints.
var v bool
if socket.IsTCP(s) {
v = tcp.EndpointState(ep.State()) == tcp.StateListen
}
vP := primitive.Int32(boolToInt32(v))
return &vP, nil
v := primitive.Int32(boolToInt32(ep.SocketOptions().GetAcceptConn()))
return &v, nil
case linux.SO_RCVLOWAT:
if outLen < sizeOfInt32 {