summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/network/internal/ip
diff options
context:
space:
mode:
authorGhanan Gowripalan <ghanan@google.com>2021-05-14 16:32:28 -0700
committergVisor bot <gvisor-bot@google.com>2021-05-14 16:37:13 -0700
commit820c77d5e78787cb7ffb197892d912c9f4c25a22 (patch)
tree6b19fe38deace2b303055b87f3287952fb489dba /pkg/tcpip/network/internal/ip
parentdf2352796d1cbe5eea563d54380be60be18455bc (diff)
Validate DAD configs when initializing DAD state
Make sure that the initial configurations used by the DAD state is valid. Before this change, an invalid DAD configuration (with a zero-valued retransmit timer) was used so the DAD state would attempt to resolve DAD immediately. This lead to a deadlock in TestDADResolve as when DAD resolves, the stack notifies the NDP dispatcher which would attempt to write to an unbuffered channel while holding a lock. The test goroutine also attempts to obtain a stack.Route (before receiving from the channel) which ends up attempting to take the same lock. Test: stack_test.TestDADResolve PiperOrigin-RevId: 373888540
Diffstat (limited to 'pkg/tcpip/network/internal/ip')
-rw-r--r--pkg/tcpip/network/internal/ip/duplicate_address_detection.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/pkg/tcpip/network/internal/ip/duplicate_address_detection.go b/pkg/tcpip/network/internal/ip/duplicate_address_detection.go
index eed49f5d2..5123b7d6a 100644
--- a/pkg/tcpip/network/internal/ip/duplicate_address_detection.go
+++ b/pkg/tcpip/network/internal/ip/duplicate_address_detection.go
@@ -83,6 +83,8 @@ func (d *DAD) Init(protocolMU sync.Locker, configs stack.DADConfigurations, opts
panic(fmt.Sprintf("given a non-zero value for NonceSize (%d) but zero for ExtendDADTransmits", opts.NonceSize))
}
+ configs.Validate()
+
*d = DAD{
opts: opts,
configs: configs,