mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Pass must-not-be-nil by value
PiperOrigin-RevId: 393095246
This commit is contained in:
committed by
gVisor bot
parent
4c7aaa941e
commit
19056957eb
@@ -203,7 +203,7 @@ func (l *listenContext) useSynCookies() bool {
|
||||
|
||||
// createConnectingEndpoint creates a new endpoint in a connecting state, with
|
||||
// the connection parameters given by the arguments.
|
||||
func (l *listenContext) createConnectingEndpoint(s *segment, rcvdSynOpts *header.TCPSynOptions, queue *waiter.Queue) (*endpoint, tcpip.Error) {
|
||||
func (l *listenContext) createConnectingEndpoint(s *segment, rcvdSynOpts header.TCPSynOptions, queue *waiter.Queue) (*endpoint, tcpip.Error) {
|
||||
// Create a new endpoint.
|
||||
netProto := l.netProto
|
||||
if netProto == 0 {
|
||||
@@ -246,7 +246,7 @@ func (l *listenContext) createConnectingEndpoint(s *segment, rcvdSynOpts *header
|
||||
// On success, a handshake h is returned with h.ep.mu held.
|
||||
//
|
||||
// Precondition: if l.listenEP != nil, l.listenEP.mu must be locked.
|
||||
func (l *listenContext) startHandshake(s *segment, opts *header.TCPSynOptions, queue *waiter.Queue, owner tcpip.PacketOwner) (*handshake, tcpip.Error) {
|
||||
func (l *listenContext) startHandshake(s *segment, opts header.TCPSynOptions, queue *waiter.Queue, owner tcpip.PacketOwner) (*handshake, tcpip.Error) {
|
||||
// Create new endpoint.
|
||||
irs := s.sequenceNumber
|
||||
isn := generateSecureISN(s.id, l.stack.Clock(), l.protocol.seqnumSecret)
|
||||
@@ -325,7 +325,7 @@ func (l *listenContext) startHandshake(s *segment, opts *header.TCPSynOptions, q
|
||||
// established endpoint is returned with e.mu held.
|
||||
//
|
||||
// Precondition: if l.listenEP != nil, l.listenEP.mu must be locked.
|
||||
func (l *listenContext) performHandshake(s *segment, opts *header.TCPSynOptions, queue *waiter.Queue, owner tcpip.PacketOwner) (*endpoint, tcpip.Error) {
|
||||
func (l *listenContext) performHandshake(s *segment, opts header.TCPSynOptions, queue *waiter.Queue, owner tcpip.PacketOwner) (*endpoint, tcpip.Error) {
|
||||
h, err := l.startHandshake(s, opts, queue, owner)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -497,7 +497,7 @@ func (e *endpoint) notifyAborted() {
|
||||
// cookies to accept connections.
|
||||
//
|
||||
// Precondition: if ctx.listenEP != nil, ctx.listenEP.mu must be locked.
|
||||
func (e *endpoint) handleSynSegment(ctx *listenContext, s *segment, opts *header.TCPSynOptions) tcpip.Error {
|
||||
func (e *endpoint) handleSynSegment(ctx *listenContext, s *segment, opts header.TCPSynOptions) tcpip.Error {
|
||||
defer s.decRef()
|
||||
|
||||
h, err := ctx.startHandshake(s, opts, &waiter.Queue{}, e.owner)
|
||||
@@ -583,7 +583,7 @@ func (e *endpoint) handleListenSegment(ctx *listenContext, s *segment) tcpip.Err
|
||||
if !ctx.useSynCookies() {
|
||||
s.incRef()
|
||||
atomic.AddInt32(&e.synRcvdCount, 1)
|
||||
return e.handleSynSegment(ctx, s, &opts)
|
||||
return e.handleSynSegment(ctx, s, opts)
|
||||
}
|
||||
route, err := e.stack.FindRoute(s.nicID, s.dstAddr, s.srcAddr, s.netProto, false /* multicastLoop */)
|
||||
if err != nil {
|
||||
@@ -672,7 +672,7 @@ func (e *endpoint) handleListenSegment(ctx *listenContext, s *segment) tcpip.Err
|
||||
}
|
||||
e.stack.Stats().TCP.ListenOverflowSynCookieRcvd.Increment()
|
||||
// Create newly accepted endpoint and deliver it.
|
||||
rcvdSynOptions := &header.TCPSynOptions{
|
||||
rcvdSynOptions := header.TCPSynOptions{
|
||||
MSS: mssTable[data],
|
||||
// Disable Window scaling as original SYN is
|
||||
// lost.
|
||||
|
||||
@@ -127,7 +127,7 @@ func (e *endpoint) newHandshake() *handshake {
|
||||
return h
|
||||
}
|
||||
|
||||
func (e *endpoint) newPassiveHandshake(isn, irs seqnum.Value, opts *header.TCPSynOptions, deferAccept time.Duration) *handshake {
|
||||
func (e *endpoint) newPassiveHandshake(isn, irs seqnum.Value, opts header.TCPSynOptions, deferAccept time.Duration) *handshake {
|
||||
h := e.newHandshake()
|
||||
h.resetToSynRcvd(isn, irs, opts, deferAccept)
|
||||
return h
|
||||
@@ -197,7 +197,7 @@ func (h *handshake) effectiveRcvWndScale() uint8 {
|
||||
|
||||
// resetToSynRcvd resets the state of the handshake object to the SYN-RCVD
|
||||
// state.
|
||||
func (h *handshake) resetToSynRcvd(iss seqnum.Value, irs seqnum.Value, opts *header.TCPSynOptions, deferAccept time.Duration) {
|
||||
func (h *handshake) resetToSynRcvd(iss seqnum.Value, irs seqnum.Value, opts header.TCPSynOptions, deferAccept time.Duration) {
|
||||
h.active = false
|
||||
h.state = handshakeSynRcvd
|
||||
h.flags = header.TCPFlagSyn | header.TCPFlagAck
|
||||
@@ -258,10 +258,10 @@ func (h *handshake) synSentState(s *segment) tcpip.Error {
|
||||
rcvSynOpts := parseSynSegmentOptions(s)
|
||||
|
||||
// Remember if the Timestamp option was negotiated.
|
||||
h.ep.maybeEnableTimestamp(&rcvSynOpts)
|
||||
h.ep.maybeEnableTimestamp(rcvSynOpts)
|
||||
|
||||
// Remember if the SACKPermitted option was negotiated.
|
||||
h.ep.maybeEnableSACKPermitted(&rcvSynOpts)
|
||||
h.ep.maybeEnableSACKPermitted(rcvSynOpts)
|
||||
|
||||
// Remember the sequence we'll ack from now on.
|
||||
h.ackNum = s.sequenceNumber + 1
|
||||
|
||||
@@ -2905,7 +2905,7 @@ func (e *endpoint) updateRecentTimestamp(tsVal uint32, maxSentAck seqnum.Value,
|
||||
// maybeEnableTimestamp marks the timestamp option enabled for this endpoint if
|
||||
// the SYN options indicate that timestamp option was negotiated. It also
|
||||
// initializes the recentTS with the value provided in synOpts.TSval.
|
||||
func (e *endpoint) maybeEnableTimestamp(synOpts *header.TCPSynOptions) {
|
||||
func (e *endpoint) maybeEnableTimestamp(synOpts header.TCPSynOptions) {
|
||||
if synOpts.TS {
|
||||
e.SendTSOk = true
|
||||
e.setRecentTimestamp(synOpts.TSVal)
|
||||
@@ -2949,7 +2949,7 @@ func timeStampOffset(secret uint32, src, dst tcpip.Address) uint32 {
|
||||
// maybeEnableSACKPermitted marks the SACKPermitted option enabled for this endpoint
|
||||
// if the SYN options indicate that the SACK option was negotiated and the TCP
|
||||
// stack is configured to enable TCP SACK option.
|
||||
func (e *endpoint) maybeEnableSACKPermitted(synOpts *header.TCPSynOptions) {
|
||||
func (e *endpoint) maybeEnableSACKPermitted(synOpts header.TCPSynOptions) {
|
||||
var v tcpip.TCPSACKEnabled
|
||||
if err := e.stack.TransportProtocolOption(ProtocolNumber, &v); err != nil {
|
||||
// Stack doesn't support SACK. So just return.
|
||||
|
||||
@@ -152,7 +152,7 @@ func (r *ForwarderRequest) CreateEndpoint(queue *waiter.Queue) (tcpip.Endpoint,
|
||||
}
|
||||
|
||||
f := r.forwarder
|
||||
ep, err := f.listen.performHandshake(r.segment, &header.TCPSynOptions{
|
||||
ep, err := f.listen.performHandshake(r.segment, header.TCPSynOptions{
|
||||
MSS: r.synOptions.MSS,
|
||||
WS: r.synOptions.WS,
|
||||
TS: r.synOptions.TS,
|
||||
|
||||
Reference in New Issue
Block a user