This commit is contained in:
bluepython508 committed 2026-10-22 12:27:19 +01:00
1 parent 3530afb854
commit 6903fcff27
2146 files changed
+112256 -190703

No files matched your search

+40 -9
View File
@@ -49,10 +49,8 @@ import (
// Using the header package here would cause an import cycle.
const (
ipv4AddressSize = 4
ipv4ProtocolNumber = 0x0800
ipv6AddressSize = 16
ipv6ProtocolNumber = 0x86dd
ipv4AddressSize = 4
ipv6AddressSize = 16
)
const (
@@ -712,6 +710,10 @@ type ReadOptions struct {
// NeedLinkPacketInfo indicates whether to return the link-layer information,
// if supported.
NeedLinkPacketInfo bool
// NeedRecvdExperimentOption indicates whether to return the experiment
// option value from the last received packet, if supported.
NeedReceivedExperimentOption bool
}
// ReadResult represents result for a successful Endpoint.Read.
@@ -732,6 +734,10 @@ type ReadResult struct {
// LinkPacketInfo is the link-layer information of the received packet if
// ReadOptions.NeedLinkPacketInfo is true.
LinkPacketInfo LinkPacketInfo
// ReceivedExperimentOption is the experiment option value from the last
// received packet if ReadOptions.NeedReceivedExperimentOption is true.
ReceivedExperimentOption uint16
}
// Endpoint is the interface implemented by transport protocols (e.g., tcp, udp)
@@ -844,7 +850,7 @@ type Endpoint interface {
// protocol-specific and is primarily used for diagnostics.
State() uint32
// ModerateRecvBuf should be called everytime data is copied to the user
// ModerateRecvBuf should be called every time data is copied to the user
// space. This allows for dynamic tuning of recv buffer space for a
// given socket.
//
@@ -949,9 +955,8 @@ const (
// MTUDiscoverOption is used to set/get the path MTU discovery setting.
//
// NOTE: Setting this option to any other value than PMTUDiscoveryDont
// is not supported and will fail as such, and getting this option will
// always return PMTUDiscoveryDont.
// The value controls whether the Don't Fragment (DF) bit is set on
// outgoing IPv4 packets.
MTUDiscoverOption
// MulticastTTLOption is used by SetSockOptInt/GetSockOptInt to control
@@ -996,6 +1001,17 @@ const (
// IPv6Checksum is used to request the stack to populate and validate the IPv6
// checksum for transport level headers.
IPv6Checksum
// PacketMMapVersionOption is used to set the packet mmap version.
PacketMMapVersionOption
// PacketMMapReserveOption is used to set the packet mmap reserved space
// between the aligned header and the payload.
PacketMMapReserveOption
// IPv6MulticastInterfaceOption is used to set/get the NIC used for
// IPv6 multicast Tx.
IPv6MulticastInterfaceOption
)
const (
@@ -1198,6 +1214,17 @@ type TpacketReq struct {
func (*TpacketReq) isSettableSocketOption() {}
// TpacketStats is the statistics for a packet_mmap ring buffer from
// <linux/if_packet.h>.
//
// +stateify savable
type TpacketStats struct {
Packets uint32
Dropped uint32
}
func (*TpacketStats) isGettableSocketOption() {}
// EndpointState represents the state of an endpoint.
type EndpointState uint8
@@ -2830,10 +2857,14 @@ type ProtocolAddress struct {
}
var (
// danglingEndpointsMu protects access to danglingEndpoints.
// Public dangling-endpoint helpers acquire this mutex themselves. Their
// caller exclusions cannot be exported reliably by checklocks because
// the guard is rooted in a private package global.
danglingEndpointsMu sync.Mutex
// danglingEndpoints tracks all dangling endpoints no longer owned by the app.
//
// +checklocks:danglingEndpointsMu
danglingEndpoints = make(map[Endpoint]struct{})
)