mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Do not spawn a goroutine when calling stack.NDPDispatcher's methods
Do not start a new goroutine when calling stack.NDPDispatcher.OnDuplicateAddressDetectionStatus. PiperOrigin-RevId: 292268574
This commit is contained in:
committed by
gVisor bot
parent
0ade523f06
commit
6f841c304d
@@ -167,8 +167,8 @@ type NDPDispatcher interface {
|
||||
// reason, such as the address being removed). If an error occured
|
||||
// during DAD, err will be set and resolved must be ignored.
|
||||
//
|
||||
// This function is permitted to block indefinitely without interfering
|
||||
// with the stack's operation.
|
||||
// This function is not permitted to block indefinitely. This function
|
||||
// is also not permitted to call into the stack.
|
||||
OnDuplicateAddressDetectionStatus(nicID tcpip.NICID, addr tcpip.Address, resolved bool, err *tcpip.Error)
|
||||
|
||||
// OnDefaultRouterDiscovered will be called when a new default router is
|
||||
@@ -607,8 +607,8 @@ func (ndp *ndpState) stopDuplicateAddressDetection(addr tcpip.Address) {
|
||||
delete(ndp.dad, addr)
|
||||
|
||||
// Let the integrator know DAD did not resolve.
|
||||
if ndp.nic.stack.ndpDisp != nil {
|
||||
go ndp.nic.stack.ndpDisp.OnDuplicateAddressDetectionStatus(ndp.nic.ID(), addr, false, nil)
|
||||
if ndpDisp := ndp.nic.stack.ndpDisp; ndpDisp != nil {
|
||||
ndpDisp.OnDuplicateAddressDetectionStatus(ndp.nic.ID(), addr, false, nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -497,7 +497,7 @@ func TestDADFail(t *testing.T) {
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
ndpDisp := ndpDispatcher{
|
||||
dadC: make(chan ndpDADEvent),
|
||||
dadC: make(chan ndpDADEvent, 1),
|
||||
}
|
||||
ndpConfigs := stack.DefaultNDPConfigurations()
|
||||
opts := stack.Options{
|
||||
@@ -576,7 +576,7 @@ func TestDADFail(t *testing.T) {
|
||||
// removed.
|
||||
func TestDADStop(t *testing.T) {
|
||||
ndpDisp := ndpDispatcher{
|
||||
dadC: make(chan ndpDADEvent),
|
||||
dadC: make(chan ndpDADEvent, 1),
|
||||
}
|
||||
ndpConfigs := stack.NDPConfigurations{
|
||||
RetransmitTimer: time.Second,
|
||||
|
||||
Reference in New Issue
Block a user