mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Clean up warnings
- Typos - Unused arguments - Useless conversions PiperOrigin-RevId: 376362730
This commit is contained in:
committed by
gVisor bot
parent
394c6089c3
commit
30bca3270b
@@ -182,7 +182,7 @@ const (
|
||||
// ipv4LinkLocalUnicastSubnet is the IPv4 link local unicast subnet as defined
|
||||
// by RFC 3927 section 1.
|
||||
var ipv4LinkLocalUnicastSubnet = func() tcpip.Subnet {
|
||||
subnet, err := tcpip.NewSubnet("\xa9\xfe\x00\x00", tcpip.AddressMask("\xff\xff\x00\x00"))
|
||||
subnet, err := tcpip.NewSubnet("\xa9\xfe\x00\x00", "\xff\xff\x00\x00")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -192,7 +192,7 @@ var ipv4LinkLocalUnicastSubnet = func() tcpip.Subnet {
|
||||
// ipv4LinkLocalMulticastSubnet is the IPv4 link local multicast subnet as
|
||||
// defined by RFC 5771 section 4.
|
||||
var ipv4LinkLocalMulticastSubnet = func() tcpip.Subnet {
|
||||
subnet, err := tcpip.NewSubnet("\xe0\x00\x00\x00", tcpip.AddressMask("\xff\xff\xff\x00"))
|
||||
subnet, err := tcpip.NewSubnet("\xe0\x00\x00\x00", "\xff\xff\xff\x00")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -573,7 +573,7 @@ func (o *IPv4OptionGeneric) Type() IPv4OptionType {
|
||||
func (o *IPv4OptionGeneric) Size() uint8 { return uint8(len(*o)) }
|
||||
|
||||
// Contents implements IPv4Option.
|
||||
func (o *IPv4OptionGeneric) Contents() []byte { return []byte(*o) }
|
||||
func (o *IPv4OptionGeneric) Contents() []byte { return *o }
|
||||
|
||||
// IPv4OptionIterator is an iterator pointing to a specific IP option
|
||||
// at any point of time. It also holds information as to a new options buffer
|
||||
@@ -611,7 +611,7 @@ func (i *IPv4OptionIterator) InitReplacement(option IPv4Option) IPv4Options {
|
||||
// RemainingBuffer returns the remaining (unused) part of the new option buffer,
|
||||
// into which a new option may be written.
|
||||
func (i *IPv4OptionIterator) RemainingBuffer() IPv4Options {
|
||||
return IPv4Options(i.newOptions[i.writePoint:])
|
||||
return i.newOptions[i.writePoint:]
|
||||
}
|
||||
|
||||
// ConsumeBuffer marks a portion of the new buffer as used.
|
||||
@@ -847,7 +847,7 @@ func (ts *IPv4OptionTimestamp) Type() IPv4OptionType { return IPv4OptionTimestam
|
||||
func (ts *IPv4OptionTimestamp) Size() uint8 { return uint8(len(*ts)) }
|
||||
|
||||
// Contents implements IPv4Option.
|
||||
func (ts *IPv4OptionTimestamp) Contents() []byte { return []byte(*ts) }
|
||||
func (ts *IPv4OptionTimestamp) Contents() []byte { return *ts }
|
||||
|
||||
// Pointer returns the pointer field in the IP Timestamp option.
|
||||
func (ts *IPv4OptionTimestamp) Pointer() uint8 {
|
||||
@@ -951,7 +951,7 @@ func (rr *IPv4OptionRecordRoute) Type() IPv4OptionType { return IPv4OptionRecord
|
||||
func (rr *IPv4OptionRecordRoute) Size() uint8 { return uint8(len(*rr)) }
|
||||
|
||||
// Contents implements IPv4Option.
|
||||
func (rr *IPv4OptionRecordRoute) Contents() []byte { return []byte(*rr) }
|
||||
func (rr *IPv4OptionRecordRoute) Contents() []byte { return *rr }
|
||||
|
||||
// Router Alert option specific related constants.
|
||||
//
|
||||
@@ -996,7 +996,7 @@ func (*IPv4OptionRouterAlert) Type() IPv4OptionType { return IPv4OptionRouterAle
|
||||
func (ra *IPv4OptionRouterAlert) Size() uint8 { return uint8(len(*ra)) }
|
||||
|
||||
// Contents implements IPv4Option.
|
||||
func (ra *IPv4OptionRouterAlert) Contents() []byte { return []byte(*ra) }
|
||||
func (ra *IPv4OptionRouterAlert) Contents() []byte { return *ra }
|
||||
|
||||
// Value returns the value of the IPv4OptionRouterAlert.
|
||||
func (ra *IPv4OptionRouterAlert) Value() uint16 {
|
||||
|
||||
@@ -278,7 +278,7 @@ func (*protocol) ParseAddresses(buffer.View) (src, dst tcpip.Address) {
|
||||
return "", ""
|
||||
}
|
||||
|
||||
func (p *protocol) NewEndpoint(nic stack.NetworkInterface, dispatcher stack.TransportDispatcher) stack.NetworkEndpoint {
|
||||
func (p *protocol) NewEndpoint(nic stack.NetworkInterface, _ stack.TransportDispatcher) stack.NetworkEndpoint {
|
||||
e := &endpoint{
|
||||
protocol: p,
|
||||
nic: nic,
|
||||
|
||||
@@ -82,7 +82,7 @@ type endpoint struct {
|
||||
protocol *protocol
|
||||
stats sharedStats
|
||||
|
||||
// enabled is set to 1 when the enpoint is enabled and 0 when it is
|
||||
// enabled is set to 1 when the endpoint is enabled and 0 when it is
|
||||
// disabled.
|
||||
//
|
||||
// Must be accessed using atomic operations.
|
||||
@@ -332,8 +332,8 @@ func (e *endpoint) DefaultTTL() uint8 {
|
||||
return e.protocol.DefaultTTL()
|
||||
}
|
||||
|
||||
// MTU implements stack.NetworkEndpoint.MTU. It returns the link-layer MTU minus
|
||||
// the network layer max header length.
|
||||
// MTU implements stack.NetworkEndpoint. It returns the link-layer MTU minus the
|
||||
// network layer max header length.
|
||||
func (e *endpoint) MTU() uint32 {
|
||||
networkMTU, err := calculateNetworkMTU(e.nic.MTU(), header.IPv4MinimumSize)
|
||||
if err != nil {
|
||||
@@ -348,7 +348,7 @@ func (e *endpoint) MaxHeaderLength() uint16 {
|
||||
return e.nic.MaxHeaderLength() + header.IPv4MaximumHeaderSize
|
||||
}
|
||||
|
||||
// NetworkProtocolNumber implements stack.NetworkEndpoint.NetworkProtocolNumber.
|
||||
// NetworkProtocolNumber implements stack.NetworkEndpoint.
|
||||
func (e *endpoint) NetworkProtocolNumber() tcpip.NetworkProtocolNumber {
|
||||
return e.protocol.Number()
|
||||
}
|
||||
@@ -363,7 +363,7 @@ func (e *endpoint) addIPHeader(srcAddr, dstAddr tcpip.Address, pkt *stack.Packet
|
||||
if hdrLen > header.IPv4MaximumHeaderSize {
|
||||
return &tcpip.ErrMessageTooLong{}
|
||||
}
|
||||
ip := header.IPv4(pkt.NetworkHeader().Push(hdrLen))
|
||||
ipH := header.IPv4(pkt.NetworkHeader().Push(hdrLen))
|
||||
length := pkt.Size()
|
||||
if length > math.MaxUint16 {
|
||||
return &tcpip.ErrMessageTooLong{}
|
||||
@@ -372,7 +372,7 @@ func (e *endpoint) addIPHeader(srcAddr, dstAddr tcpip.Address, pkt *stack.Packet
|
||||
// datagrams. Since the DF bit is never being set here, all datagrams
|
||||
// are non-atomic and need an ID.
|
||||
id := atomic.AddUint32(&e.protocol.ids[hashRoute(srcAddr, dstAddr, params.Protocol, e.protocol.hashIV)%buckets], 1)
|
||||
ip.Encode(&header.IPv4Fields{
|
||||
ipH.Encode(&header.IPv4Fields{
|
||||
TotalLength: uint16(length),
|
||||
ID: uint16(id),
|
||||
TTL: params.TTL,
|
||||
@@ -382,7 +382,7 @@ func (e *endpoint) addIPHeader(srcAddr, dstAddr tcpip.Address, pkt *stack.Packet
|
||||
DstAddr: dstAddr,
|
||||
Options: options,
|
||||
})
|
||||
ip.SetChecksum(^ip.CalculateChecksum())
|
||||
ipH.SetChecksum(^ipH.CalculateChecksum())
|
||||
pkt.NetworkProtocolNumber = ProtocolNumber
|
||||
return nil
|
||||
}
|
||||
@@ -391,7 +391,7 @@ func (e *endpoint) addIPHeader(srcAddr, dstAddr tcpip.Address, pkt *stack.Packet
|
||||
// fragment. It returns the number of fragments handled and the number of
|
||||
// fragments left to be processed. The IP header must already be present in the
|
||||
// original packet.
|
||||
func (e *endpoint) handleFragments(r *stack.Route, networkMTU uint32, pkt *stack.PacketBuffer, handler func(*stack.PacketBuffer) tcpip.Error) (int, int, tcpip.Error) {
|
||||
func (e *endpoint) handleFragments(_ *stack.Route, networkMTU uint32, pkt *stack.PacketBuffer, handler func(*stack.PacketBuffer) tcpip.Error) (int, int, tcpip.Error) {
|
||||
// Round the MTU down to align to 8 bytes.
|
||||
fragmentPayloadSize := networkMTU &^ 7
|
||||
networkHeader := header.IPv4(pkt.NetworkHeader().View())
|
||||
@@ -500,7 +500,7 @@ func (e *endpoint) writePacket(r *stack.Route, pkt *stack.PacketBuffer, headerIn
|
||||
return nil
|
||||
}
|
||||
|
||||
// WritePackets implements stack.NetworkEndpoint.WritePackets.
|
||||
// WritePackets implements stack.NetworkEndpoint.
|
||||
func (e *endpoint) WritePackets(r *stack.Route, pkts stack.PacketBufferList, params stack.NetworkHeaderParams) (int, tcpip.Error) {
|
||||
if r.Loop()&stack.PacketLoop != 0 {
|
||||
panic("multiple packets in local loop")
|
||||
@@ -603,34 +603,34 @@ func (e *endpoint) WriteHeaderIncludedPacket(r *stack.Route, pkt *stack.PacketBu
|
||||
if !ok {
|
||||
return &tcpip.ErrMalformedHeader{}
|
||||
}
|
||||
ip := header.IPv4(h)
|
||||
ipH := header.IPv4(h)
|
||||
|
||||
// Always set the total length.
|
||||
pktSize := pkt.Data().Size()
|
||||
ip.SetTotalLength(uint16(pktSize))
|
||||
ipH.SetTotalLength(uint16(pktSize))
|
||||
|
||||
// Set the source address when zero.
|
||||
if ip.SourceAddress() == header.IPv4Any {
|
||||
ip.SetSourceAddress(r.LocalAddress())
|
||||
if ipH.SourceAddress() == header.IPv4Any {
|
||||
ipH.SetSourceAddress(r.LocalAddress())
|
||||
}
|
||||
|
||||
// Set the destination. If the packet already included a destination, it will
|
||||
// be part of the route anyways.
|
||||
ip.SetDestinationAddress(r.RemoteAddress())
|
||||
ipH.SetDestinationAddress(r.RemoteAddress())
|
||||
|
||||
// Set the packet ID when zero.
|
||||
if ip.ID() == 0 {
|
||||
if ipH.ID() == 0 {
|
||||
// RFC 6864 section 4.3 mandates uniqueness of ID values for
|
||||
// non-atomic datagrams, so assign an ID to all such datagrams
|
||||
// according to the definition given in RFC 6864 section 4.
|
||||
if ip.Flags()&header.IPv4FlagDontFragment == 0 || ip.Flags()&header.IPv4FlagMoreFragments != 0 || ip.FragmentOffset() > 0 {
|
||||
ip.SetID(uint16(atomic.AddUint32(&e.protocol.ids[hashRoute(r.LocalAddress(), r.RemoteAddress(), 0 /* protocol */, e.protocol.hashIV)%buckets], 1)))
|
||||
if ipH.Flags()&header.IPv4FlagDontFragment == 0 || ipH.Flags()&header.IPv4FlagMoreFragments != 0 || ipH.FragmentOffset() > 0 {
|
||||
ipH.SetID(uint16(atomic.AddUint32(&e.protocol.ids[hashRoute(r.LocalAddress(), r.RemoteAddress(), 0 /* protocol */, e.protocol.hashIV)%buckets], 1)))
|
||||
}
|
||||
}
|
||||
|
||||
// Always set the checksum.
|
||||
ip.SetChecksum(0)
|
||||
ip.SetChecksum(^ip.CalculateChecksum())
|
||||
ipH.SetChecksum(0)
|
||||
ipH.SetChecksum(^ipH.CalculateChecksum())
|
||||
|
||||
// Populate the packet buffer's network header and don't allow an invalid
|
||||
// packet to be sent.
|
||||
@@ -993,7 +993,7 @@ func (e *endpoint) handleValidatedPacket(h header.IPv4, pkt *stack.PacketBuffer)
|
||||
|
||||
// The reassembler doesn't take care of fixing up the header, so we need
|
||||
// to do it here.
|
||||
h.SetTotalLength(uint16(pkt.Data().Size() + len((h))))
|
||||
h.SetTotalLength(uint16(pkt.Data().Size() + len(h)))
|
||||
h.SetFlagsFragmentOffset(0, 0)
|
||||
}
|
||||
stats.ip.PacketsDelivered.Increment()
|
||||
@@ -1224,13 +1224,13 @@ func (p *protocol) DefaultPrefixLen() int {
|
||||
return header.IPv4AddressSize * 8
|
||||
}
|
||||
|
||||
// ParseAddresses implements NetworkProtocol.ParseAddresses.
|
||||
// ParseAddresses implements stack.NetworkProtocol.
|
||||
func (*protocol) ParseAddresses(v buffer.View) (src, dst tcpip.Address) {
|
||||
h := header.IPv4(v)
|
||||
return h.SourceAddress(), h.DestinationAddress()
|
||||
}
|
||||
|
||||
// SetOption implements NetworkProtocol.SetOption.
|
||||
// SetOption implements stack.NetworkProtocol.
|
||||
func (p *protocol) SetOption(option tcpip.SettableNetworkProtocolOption) tcpip.Error {
|
||||
switch v := option.(type) {
|
||||
case *tcpip.DefaultTTLOption:
|
||||
@@ -1241,7 +1241,7 @@ func (p *protocol) SetOption(option tcpip.SettableNetworkProtocolOption) tcpip.E
|
||||
}
|
||||
}
|
||||
|
||||
// Option implements NetworkProtocol.Option.
|
||||
// Option implements stack.NetworkProtocol.
|
||||
func (p *protocol) Option(option tcpip.GettableNetworkProtocolOption) tcpip.Error {
|
||||
switch v := option.(type) {
|
||||
case *tcpip.DefaultTTLOption:
|
||||
@@ -1262,10 +1262,10 @@ func (p *protocol) DefaultTTL() uint8 {
|
||||
return uint8(atomic.LoadUint32(&p.defaultTTL))
|
||||
}
|
||||
|
||||
// Close implements stack.TransportProtocol.Close.
|
||||
// Close implements stack.TransportProtocol.
|
||||
func (*protocol) Close() {}
|
||||
|
||||
// Wait implements stack.TransportProtocol.Wait.
|
||||
// Wait implements stack.TransportProtocol.
|
||||
func (*protocol) Wait() {}
|
||||
|
||||
// parseAndValidate parses the packet (including its transport layer header) and
|
||||
@@ -1303,7 +1303,7 @@ func (p *protocol) parseAndValidate(pkt *stack.PacketBuffer) (header.IPv4, bool)
|
||||
return h, true
|
||||
}
|
||||
|
||||
// Parse implements stack.NetworkProtocol.Parse.
|
||||
// Parse implements stack.NetworkProtocol.
|
||||
func (*protocol) Parse(pkt *stack.PacketBuffer) (proto tcpip.TransportProtocolNumber, hasTransportHdr bool, ok bool) {
|
||||
if ok := parse.IPv4(pkt); !ok {
|
||||
return 0, false, false
|
||||
@@ -1333,7 +1333,7 @@ func calculateNetworkMTU(linkMTU, networkHeaderSize uint32) (uint32, tcpip.Error
|
||||
networkMTU = MaxTotalSize
|
||||
}
|
||||
|
||||
return networkMTU - uint32(networkHeaderSize), nil
|
||||
return networkMTU - networkHeaderSize, nil
|
||||
}
|
||||
|
||||
func packetMustBeFragmented(pkt *stack.PacketBuffer, networkMTU uint32) bool {
|
||||
@@ -1742,9 +1742,8 @@ type optionTracker struct {
|
||||
//
|
||||
// If there were no errors during parsing, the new set of options is returned as
|
||||
// a new buffer.
|
||||
func (e *endpoint) processIPOptions(pkt *stack.PacketBuffer, orig header.IPv4Options, usage optionsUsage) (header.IPv4Options, optionTracker, *header.IPv4OptParameterProblem) {
|
||||
func (e *endpoint) processIPOptions(pkt *stack.PacketBuffer, opts header.IPv4Options, usage optionsUsage) (header.IPv4Options, optionTracker, *header.IPv4OptParameterProblem) {
|
||||
stats := e.stats.ip
|
||||
opts := header.IPv4Options(orig)
|
||||
optIter := opts.MakeIterator()
|
||||
|
||||
// Except NOP, each option must only appear at most once (RFC 791 section 3.1,
|
||||
|
||||
@@ -3030,7 +3030,7 @@ func (lm *limitedMatcher) Match(stack.Hook, *stack.PacketBuffer, string, string)
|
||||
return false, false
|
||||
}
|
||||
|
||||
func TestPacketQueing(t *testing.T) {
|
||||
func TestPacketQueuing(t *testing.T) {
|
||||
const nicID = 1
|
||||
|
||||
var (
|
||||
|
||||
@@ -230,11 +230,11 @@ type endpoint struct {
|
||||
// If the NIC was created with a name, it is passed to NICNameFromID.
|
||||
//
|
||||
// NICNameFromID SHOULD return unique NIC names so unique opaque IIDs are
|
||||
// generated for the same prefix on differnt NICs.
|
||||
// generated for the same prefix on different NICs.
|
||||
type NICNameFromID func(tcpip.NICID, string) string
|
||||
|
||||
// OpaqueInterfaceIdentifierOptions holds the options related to the generation
|
||||
// of opaque interface indentifiers (IIDs) as defined by RFC 7217.
|
||||
// of opaque interface identifiers (IIDs) as defined by RFC 7217.
|
||||
type OpaqueInterfaceIdentifierOptions struct {
|
||||
// NICNameFromID is a function that returns a stable name for a specified NIC,
|
||||
// even if the NIC ID changes over time.
|
||||
@@ -545,7 +545,7 @@ func (e *endpoint) Enable() tcpip.Error {
|
||||
// Perform DAD on the all the unicast IPv6 endpoints that are in the permanent
|
||||
// state.
|
||||
//
|
||||
// Addresses may have aleady completed DAD but in the time since the endpoint
|
||||
// Addresses may have already completed DAD but in the time since the endpoint
|
||||
// was last enabled, other devices may have acquired the same addresses.
|
||||
var err tcpip.Error
|
||||
e.mu.addressableEndpointState.ForEachEndpoint(func(addressEndpoint stack.AddressEndpoint) bool {
|
||||
@@ -650,8 +650,8 @@ func (e *endpoint) DefaultTTL() uint8 {
|
||||
return e.protocol.DefaultTTL()
|
||||
}
|
||||
|
||||
// MTU implements stack.NetworkEndpoint.MTU. It returns the link-layer MTU minus
|
||||
// the network layer max header length.
|
||||
// MTU implements stack.NetworkEndpoint. It returns the link-layer MTU minus the
|
||||
// network layer max header length.
|
||||
func (e *endpoint) MTU() uint32 {
|
||||
networkMTU, err := calculateNetworkMTU(e.nic.MTU(), header.IPv6MinimumSize)
|
||||
if err != nil {
|
||||
@@ -826,7 +826,7 @@ func (e *endpoint) writePacket(r *stack.Route, pkt *stack.PacketBuffer, protocol
|
||||
return nil
|
||||
}
|
||||
|
||||
// WritePackets implements stack.NetworkEndpoint.WritePackets.
|
||||
// WritePackets implements stack.NetworkEndpoint.
|
||||
func (e *endpoint) WritePackets(r *stack.Route, pkts stack.PacketBufferList, params stack.NetworkHeaderParams) (int, tcpip.Error) {
|
||||
if r.Loop()&stack.PacketLoop != 0 {
|
||||
panic("not implemented")
|
||||
@@ -1618,7 +1618,7 @@ func (e *endpoint) Close() {
|
||||
e.protocol.forgetEndpoint(e.nic.ID())
|
||||
}
|
||||
|
||||
// NetworkProtocolNumber implements stack.NetworkEndpoint.NetworkProtocolNumber.
|
||||
// NetworkProtocolNumber implements stack.NetworkEndpoint.
|
||||
func (e *endpoint) NetworkProtocolNumber() tcpip.NetworkProtocolNumber {
|
||||
return e.protocol.Number()
|
||||
}
|
||||
@@ -2012,7 +2012,7 @@ func (p *protocol) DefaultPrefixLen() int {
|
||||
return header.IPv6AddressSize * 8
|
||||
}
|
||||
|
||||
// ParseAddresses implements NetworkProtocol.ParseAddresses.
|
||||
// ParseAddresses implements stack.NetworkProtocol.
|
||||
func (*protocol) ParseAddresses(v buffer.View) (src, dst tcpip.Address) {
|
||||
h := header.IPv6(v)
|
||||
return h.SourceAddress(), h.DestinationAddress()
|
||||
@@ -2089,7 +2089,7 @@ func (p *protocol) forgetEndpoint(nicID tcpip.NICID) {
|
||||
delete(p.mu.eps, nicID)
|
||||
}
|
||||
|
||||
// SetOption implements NetworkProtocol.SetOption.
|
||||
// SetOption implements stack.NetworkProtocol.
|
||||
func (p *protocol) SetOption(option tcpip.SettableNetworkProtocolOption) tcpip.Error {
|
||||
switch v := option.(type) {
|
||||
case *tcpip.DefaultTTLOption:
|
||||
@@ -2100,7 +2100,7 @@ func (p *protocol) SetOption(option tcpip.SettableNetworkProtocolOption) tcpip.E
|
||||
}
|
||||
}
|
||||
|
||||
// Option implements NetworkProtocol.Option.
|
||||
// Option implements stack.NetworkProtocol.
|
||||
func (p *protocol) Option(option tcpip.GettableNetworkProtocolOption) tcpip.Error {
|
||||
switch v := option.(type) {
|
||||
case *tcpip.DefaultTTLOption:
|
||||
@@ -2121,10 +2121,10 @@ func (p *protocol) DefaultTTL() uint8 {
|
||||
return uint8(atomic.LoadUint32(&p.defaultTTL))
|
||||
}
|
||||
|
||||
// Close implements stack.TransportProtocol.Close.
|
||||
// Close implements stack.TransportProtocol.
|
||||
func (*protocol) Close() {}
|
||||
|
||||
// Wait implements stack.TransportProtocol.Wait.
|
||||
// Wait implements stack.TransportProtocol.
|
||||
func (*protocol) Wait() {}
|
||||
|
||||
// parseAndValidate parses the packet (including its transport layer header) and
|
||||
@@ -2158,7 +2158,7 @@ func (p *protocol) parseAndValidate(pkt *stack.PacketBuffer) (header.IPv6, bool)
|
||||
return h, true
|
||||
}
|
||||
|
||||
// Parse implements stack.NetworkProtocol.Parse.
|
||||
// Parse implements stack.NetworkProtocol.
|
||||
func (*protocol) Parse(pkt *stack.PacketBuffer) (proto tcpip.TransportProtocolNumber, hasTransportHdr bool, ok bool) {
|
||||
proto, _, fragOffset, fragMore, ok := parse.IPv6(pkt)
|
||||
if !ok {
|
||||
@@ -2207,7 +2207,7 @@ type Options struct {
|
||||
// Note, setting this to true does not mean that a link-local address is
|
||||
// assigned right away, or at all. If Duplicate Address Detection is enabled,
|
||||
// an address is only assigned if it successfully resolves. If it fails, no
|
||||
// further attempts are made to auto-generate a link-local adddress.
|
||||
// further attempts are made to auto-generate a link-local address.
|
||||
//
|
||||
// The generated link-local address follows RFC 4291 Appendix A guidelines.
|
||||
AutoGenLinkLocal bool
|
||||
@@ -2223,7 +2223,7 @@ type Options struct {
|
||||
// TempIIDSeed is used to seed the initial temporary interface identifier
|
||||
// history value used to generate IIDs for temporary SLAAC addresses.
|
||||
//
|
||||
// Temporary SLAAC adresses are short-lived addresses which are unpredictable
|
||||
// Temporary SLAAC addresses are short-lived addresses which are unpredictable
|
||||
// and random from the perspective of other nodes on the network. It is
|
||||
// recommended that the seed be a random byte buffer of at least
|
||||
// header.IIDSize bytes to make sure that temporary SLAAC addresses are
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1312,7 +1312,7 @@ func TestCheckDuplicateAddress(t *testing.T) {
|
||||
t.Fatalf("RemoveAddress(%d, %s): %s", nicID, lladdr0, err)
|
||||
}
|
||||
// Should not restart DAD since we already requested DAD above - the handler
|
||||
// should be called when the original request compeletes so we should not send
|
||||
// should be called when the original request completes so we should not send
|
||||
// an extra DAD message here.
|
||||
dadRequestsMade++
|
||||
if res, err := s.CheckDuplicateAddress(nicID, ProtocolNumber, lladdr0, func(r stack.DADResult) {
|
||||
|
||||
@@ -420,7 +420,7 @@ const (
|
||||
PermanentExpired
|
||||
|
||||
// Temporary is an endpoint, created on a one-off basis to temporarily
|
||||
// consider the NIC bound an an address that it is not explictiy bound to
|
||||
// consider the NIC bound an an address that it is not explicitly bound to
|
||||
// (such as a permanent address). Its reference count must not be biased by 1
|
||||
// so that the address is removed immediately when references to it are no
|
||||
// longer held.
|
||||
@@ -630,7 +630,7 @@ type NetworkEndpoint interface {
|
||||
// HandlePacket takes ownership of pkt.
|
||||
HandlePacket(pkt *PacketBuffer)
|
||||
|
||||
// Close is called when the endpoint is reomved from a stack.
|
||||
// Close is called when the endpoint is removed from a stack.
|
||||
Close()
|
||||
|
||||
// NetworkProtocolNumber returns the tcpip.NetworkProtocolNumber for
|
||||
@@ -968,7 +968,7 @@ type DuplicateAddressDetector interface {
|
||||
// called with the result of the original DAD request.
|
||||
CheckDuplicateAddress(tcpip.Address, DADCompletionHandler) DADCheckAddressDisposition
|
||||
|
||||
// SetDADConfiguations sets the configurations for DAD.
|
||||
// SetDADConfigurations sets the configurations for DAD.
|
||||
SetDADConfigurations(c DADConfigurations)
|
||||
|
||||
// DuplicateAddressProtocol returns the network protocol the receiver can
|
||||
@@ -979,7 +979,7 @@ type DuplicateAddressDetector interface {
|
||||
// LinkAddressResolver handles link address resolution for a network protocol.
|
||||
type LinkAddressResolver interface {
|
||||
// LinkAddressRequest sends a request for the link address of the target
|
||||
// address. The request is broadcasted on the local network if a remote link
|
||||
// address. The request is broadcast on the local network if a remote link
|
||||
// address is not provided.
|
||||
LinkAddressRequest(targetAddr, localAddr tcpip.Address, remoteLinkAddr tcpip.LinkAddress) tcpip.Error
|
||||
|
||||
@@ -1072,4 +1072,4 @@ type GSOEndpoint interface {
|
||||
|
||||
// SoftwareGSOMaxSize is a maximum allowed size of a software GSO segment.
|
||||
// This isn't a hard limit, because it is never set into packet headers.
|
||||
const SoftwareGSOMaxSize = (1 << 16)
|
||||
const SoftwareGSOMaxSize = 1 << 16
|
||||
|
||||
Reference in New Issue
Block a user