Default to NUD/neighborCache instead of linkAddrCache
This change flips gvisor to use Neighbor unreachability detection by default to populate the neighbor table as defined by RFC 4861 section 7. Although RFC 4861 is targeted at IPv6, the same algorithm is used for link resolution on IPv4 networks using ARP. Integrators may still use the legacy link address cache by setting stack.Options.UseLinkAddrCache to true; stack.Options.UseNeighborCache is now unused and will be removed. A later change will remove linkAddrCache and associated code. Updates #4658. PiperOrigin-RevId: 354850531
This commit is contained in:
parent
c5e3c1c7bd
commit
d930def27a
|
@ -759,6 +759,7 @@ func TestNeighborAdvertisementWithTargetLinkLayerOption(t *testing.T) {
|
|||
t.Run(test.name, func(t *testing.T) {
|
||||
s := stack.New(stack.Options{
|
||||
NetworkProtocols: []stack.NetworkProtocolFactory{NewProtocol},
|
||||
UseLinkAddrCache: true,
|
||||
})
|
||||
e := channel.New(0, 1280, linkAddr0)
|
||||
e.LinkEPCapabilities |= stack.CapabilityResolutionRequired
|
||||
|
|
|
@ -436,6 +436,8 @@ type Stack struct {
|
|||
|
||||
// useNeighborCache indicates whether ARP and NDP packets should be handled
|
||||
// by the NIC's neighborCache instead of linkAddrCache.
|
||||
//
|
||||
// TODO(gvisor.dev/issue/4658): Remove this field.
|
||||
useNeighborCache bool
|
||||
|
||||
// nudDisp is the NUD event dispatcher that is used to send the netstack
|
||||
|
@ -502,13 +504,17 @@ type Options struct {
|
|||
// NUDConfigs is the default NUD configurations used by interfaces.
|
||||
NUDConfigs NUDConfigurations
|
||||
|
||||
// UseNeighborCache indicates whether ARP and NDP packets should be handled
|
||||
// by the Neighbor Unreachability Detection (NUD) state machine. This flag
|
||||
// also enables the APIs for inspecting and modifying the neighbor table via
|
||||
// NUDDispatcher and the following Stack methods: Neighbors, RemoveNeighbor,
|
||||
// and ClearNeighbors.
|
||||
// UseNeighborCache is unused.
|
||||
//
|
||||
// TODO(gvisor.dev/issue/4658): Remove this field.
|
||||
UseNeighborCache bool
|
||||
|
||||
// UseLinkAddrCache indicates that the legacy link address cache should be
|
||||
// used for link resolution.
|
||||
//
|
||||
// TODO(gvisor.dev/issue/4658): Remove this field.
|
||||
UseLinkAddrCache bool
|
||||
|
||||
// NUDDisp is the NUD event dispatcher that an integrator can provide to
|
||||
// receive NUD related events.
|
||||
NUDDisp NUDDispatcher
|
||||
|
@ -648,7 +654,7 @@ func New(opts Options) *Stack {
|
|||
icmpRateLimiter: NewICMPRateLimiter(),
|
||||
seed: generateRandUint32(),
|
||||
nudConfigs: opts.NUDConfigs,
|
||||
useNeighborCache: opts.UseNeighborCache,
|
||||
useNeighborCache: !opts.UseLinkAddrCache,
|
||||
uniqueIDGenerator: opts.UniqueID,
|
||||
nudDisp: opts.NUDDisp,
|
||||
randomGenerator: mathrand.New(randSrc),
|
||||
|
|
Loading…
Reference in New Issue