snapshot: sagernet/gvisor v0.0.0-20250811.0-sing-box-mod.1
Содержимое пина, зафиксированного в go.mod sing-box-lx, одним коммитом без истории. Полная история SagerNet/gvisor — 1.45 ГБ и клонируется в каждой CI-джобе; наша дельта — одна вставка в одну функцию, история для неё не нужна. Module path github.com/sagernet/gvisor сохранён намеренно: на него опирается replace-директива суперпроекта. Патч поверх — отдельным коммитом, чтобы дельта читалась одним git show и переносилась на новый пин копированием. SPECS/TASKS/048-GVISOR_HANDSHAKE_NIL_CRASH
This commit is contained in:
commit
2c4ae3b0a4
712 changed files with 185689 additions and 0 deletions
1065
pkg/tcpip/transport/internal/network/endpoint.go
Normal file
1065
pkg/tcpip/transport/internal/network/endpoint.go
Normal file
File diff suppressed because it is too large
Load diff
62
pkg/tcpip/transport/internal/network/endpoint_state.go
Normal file
62
pkg/tcpip/transport/internal/network/endpoint_state.go
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
// Copyright 2021 The gVisor Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package network
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/sagernet/gvisor/pkg/tcpip"
|
||||
"github.com/sagernet/gvisor/pkg/tcpip/stack"
|
||||
"github.com/sagernet/gvisor/pkg/tcpip/transport"
|
||||
)
|
||||
|
||||
// Resume implements tcpip.ResumableEndpoint.Resume.
|
||||
func (e *Endpoint) Resume(s *stack.Stack) error {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
|
||||
e.stack = s
|
||||
for m := range e.multicastMemberships {
|
||||
if err := e.stack.JoinGroup(e.netProto, m.nicID, m.multicastAddr); err != nil {
|
||||
return fmt.Errorf("e.stack.JoinGroup(%d, %d, %s): %s", e.netProto, m.nicID, m.multicastAddr, err)
|
||||
}
|
||||
}
|
||||
|
||||
info := e.Info()
|
||||
|
||||
switch state := e.State(); state {
|
||||
case transport.DatagramEndpointStateInitial, transport.DatagramEndpointStateClosed:
|
||||
case transport.DatagramEndpointStateBound:
|
||||
if info.ID.LocalAddress.BitLen() != 0 && !e.isBroadcastOrMulticast(info.RegisterNICID, e.effectiveNetProto, info.ID.LocalAddress) {
|
||||
if e.stack.CheckLocalAddress(info.RegisterNICID, e.effectiveNetProto, info.ID.LocalAddress) == 0 {
|
||||
return fmt.Errorf("got e.stack.CheckLocalAddress(%d, %d, %s) = 0, want != 0", info.RegisterNICID, e.effectiveNetProto, info.ID.LocalAddress)
|
||||
}
|
||||
}
|
||||
case transport.DatagramEndpointStateConnected:
|
||||
var err tcpip.Error
|
||||
multicastLoop := e.ops.GetMulticastLoop()
|
||||
// Release the connectedRoute if present.
|
||||
if e.connectedRoute != nil {
|
||||
e.connectedRoute.Release()
|
||||
}
|
||||
e.connectedRoute, err = e.stack.FindRoute(info.RegisterNICID, info.ID.LocalAddress, info.ID.RemoteAddress, e.effectiveNetProto, multicastLoop)
|
||||
if err != nil {
|
||||
return fmt.Errorf("e.stack.FindRoute(%d, %s, %s, %d, %t): %s", info.RegisterNICID, info.ID.LocalAddress, info.ID.RemoteAddress, e.effectiveNetProto, multicastLoop, err)
|
||||
}
|
||||
default:
|
||||
panic(fmt.Sprintf("unhandled state = %s", state))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
121
pkg/tcpip/transport/internal/network/network_state_autogen.go
Normal file
121
pkg/tcpip/transport/internal/network/network_state_autogen.go
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
// automatically generated by stateify.
|
||||
|
||||
package network
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/sagernet/gvisor/pkg/state"
|
||||
)
|
||||
|
||||
func (e *Endpoint) StateTypeName() string {
|
||||
return "pkg/tcpip/transport/internal/network.Endpoint"
|
||||
}
|
||||
|
||||
func (e *Endpoint) StateFields() []string {
|
||||
return []string{
|
||||
"stack",
|
||||
"ops",
|
||||
"netProto",
|
||||
"transProto",
|
||||
"waiterQueue",
|
||||
"wasBound",
|
||||
"owner",
|
||||
"writeShutdown",
|
||||
"effectiveNetProto",
|
||||
"multicastMemberships",
|
||||
"ipv4TTL",
|
||||
"ipv6HopLimit",
|
||||
"multicastTTL",
|
||||
"multicastAddr",
|
||||
"multicastNICID",
|
||||
"ipv4TOS",
|
||||
"ipv6TClass",
|
||||
"info",
|
||||
"state",
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Endpoint) beforeSave() {}
|
||||
|
||||
// +checklocksignore
|
||||
func (e *Endpoint) StateSave(stateSinkObject state.Sink) {
|
||||
e.beforeSave()
|
||||
stateSinkObject.Save(0, &e.stack)
|
||||
stateSinkObject.Save(1, &e.ops)
|
||||
stateSinkObject.Save(2, &e.netProto)
|
||||
stateSinkObject.Save(3, &e.transProto)
|
||||
stateSinkObject.Save(4, &e.waiterQueue)
|
||||
stateSinkObject.Save(5, &e.wasBound)
|
||||
stateSinkObject.Save(6, &e.owner)
|
||||
stateSinkObject.Save(7, &e.writeShutdown)
|
||||
stateSinkObject.Save(8, &e.effectiveNetProto)
|
||||
stateSinkObject.Save(9, &e.multicastMemberships)
|
||||
stateSinkObject.Save(10, &e.ipv4TTL)
|
||||
stateSinkObject.Save(11, &e.ipv6HopLimit)
|
||||
stateSinkObject.Save(12, &e.multicastTTL)
|
||||
stateSinkObject.Save(13, &e.multicastAddr)
|
||||
stateSinkObject.Save(14, &e.multicastNICID)
|
||||
stateSinkObject.Save(15, &e.ipv4TOS)
|
||||
stateSinkObject.Save(16, &e.ipv6TClass)
|
||||
stateSinkObject.Save(17, &e.info)
|
||||
stateSinkObject.Save(18, &e.state)
|
||||
}
|
||||
|
||||
func (e *Endpoint) afterLoad(context.Context) {}
|
||||
|
||||
// +checklocksignore
|
||||
func (e *Endpoint) StateLoad(ctx context.Context, stateSourceObject state.Source) {
|
||||
stateSourceObject.Load(0, &e.stack)
|
||||
stateSourceObject.Load(1, &e.ops)
|
||||
stateSourceObject.Load(2, &e.netProto)
|
||||
stateSourceObject.Load(3, &e.transProto)
|
||||
stateSourceObject.Load(4, &e.waiterQueue)
|
||||
stateSourceObject.Load(5, &e.wasBound)
|
||||
stateSourceObject.Load(6, &e.owner)
|
||||
stateSourceObject.Load(7, &e.writeShutdown)
|
||||
stateSourceObject.Load(8, &e.effectiveNetProto)
|
||||
stateSourceObject.Load(9, &e.multicastMemberships)
|
||||
stateSourceObject.Load(10, &e.ipv4TTL)
|
||||
stateSourceObject.Load(11, &e.ipv6HopLimit)
|
||||
stateSourceObject.Load(12, &e.multicastTTL)
|
||||
stateSourceObject.Load(13, &e.multicastAddr)
|
||||
stateSourceObject.Load(14, &e.multicastNICID)
|
||||
stateSourceObject.Load(15, &e.ipv4TOS)
|
||||
stateSourceObject.Load(16, &e.ipv6TClass)
|
||||
stateSourceObject.Load(17, &e.info)
|
||||
stateSourceObject.Load(18, &e.state)
|
||||
}
|
||||
|
||||
func (m *multicastMembership) StateTypeName() string {
|
||||
return "pkg/tcpip/transport/internal/network.multicastMembership"
|
||||
}
|
||||
|
||||
func (m *multicastMembership) StateFields() []string {
|
||||
return []string{
|
||||
"nicID",
|
||||
"multicastAddr",
|
||||
}
|
||||
}
|
||||
|
||||
func (m *multicastMembership) beforeSave() {}
|
||||
|
||||
// +checklocksignore
|
||||
func (m *multicastMembership) StateSave(stateSinkObject state.Sink) {
|
||||
m.beforeSave()
|
||||
stateSinkObject.Save(0, &m.nicID)
|
||||
stateSinkObject.Save(1, &m.multicastAddr)
|
||||
}
|
||||
|
||||
func (m *multicastMembership) afterLoad(context.Context) {}
|
||||
|
||||
// +checklocksignore
|
||||
func (m *multicastMembership) StateLoad(ctx context.Context, stateSourceObject state.Source) {
|
||||
stateSourceObject.Load(0, &m.nicID)
|
||||
stateSourceObject.Load(1, &m.multicastAddr)
|
||||
}
|
||||
|
||||
func init() {
|
||||
state.Register((*Endpoint)(nil))
|
||||
state.Register((*multicastMembership)(nil))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue