HomeFreeBSD

ng_l2tp: improve callout locking.

Description

ng_l2tp: improve callout locking.

Apparently e62e4b85942 wasn't enough to close the race between
a queue being flushed by a packet and callout executing, because
the callouts used without a lock aren't 100% bulletproof. To close
the race use callout_init_mtx() for L2TP timers, and make sure that
all calls to ng_callout()/ng_uncallout() are done under the seq lock.

If used properly, a locked callout can be used transparently with
old netgraph KPI of ng_callout/ng_uncallout which predates locked
callouts.

While here, utilize ng_uncallout_drain() instead of ng_uncallout()
on the node shutdown.

PR: 241133
Reviewed by: mjg, markj
Differential Revision: https://reviews.freebsd.org/D31476

Details

Provenance
glebiusAuthored on Aug 6 2021, 11:04 PM
Reviewer
mjg
Differential Revision
D31476: Summary: ng_l2tp race fix + ng_uncallout improvements
Parents
rG0a76c63dd498: ng_l2tp: improve seq structure locking.
Branches
Unknown
Tags
Unknown