HomeFreeBSD

nd6: Make the DAD callout MPSAFE

Description

nd6: Make the DAD callout MPSAFE

Interface addresses with pending duplicate address detection (DAD) live
in a global queue. In this case, a callout is associated with each
entry. The callout transmits neighbour solicitations until the system
decides the address is no longer tentative, or until a duplicate address
is discovered. At this point the entry is dequeued and freed. DAD may
be manually stopped as well.

The callout currently runs (and potentially transmits packets) with
Giant held. Reorganize DAD queue locking to interlock properly with the
callout:

  • Configure the callout to acquire the DAD queue lock before running. The lock is dropped before transmitting any packets. Stop protecting the callout with Giant.
  • When looking up DAD queue entries for an incoming NS or NA, don't bother fiddling with the DAD queue entry reference count.
  • Split nd6_dad_starttimer() so that the caller is responsible to transmitting a NS if it so desires.
  • Remove the DAD entry from the queue before stopping the timer. Use a temporary reference to make sure that the entry doesn't get freed by the callout while we're draining.

Reported by: mav
Reviewed by: bz, hrs
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D31826

Details

Provenance
markjAuthored on Sep 7 2021, 1:49 PM
Reviewer
bz
Differential Revision
D31826: nd6: Make the DAD callout MPSAFE
Parents
rG5402baa5b5d1: g_label: Handle small sector sizes when tasting
Branches
Unknown
Tags
Unknown