On Tue, Nov 30, 2021 at 05:53:34PM +0300, Vitaliy Makkoveev wrote: > Hi, > > This question is mostly for bluhm@. Should the gettdbbyflow() grab the > extra reference on returned `tdbp' like other other gettdb*() do? I'm > pointing this because we are going to not rely on the netlock when doing > `tdbp' dereference.
Yes. Call tdb_ref(tdbp) withing the tdb_sadb_mtx mutex. The interesting question is when to unref it. You use the same variable for the tdb parameter and the tdb from gettdbbyflow(). Tracking when you don't use the new TDB anymore, gets tricky. bluhm