locking ifpromisc (struct ifnet)
John Giacomoni
John.Giacomoni at colorado.edu
Thu Nov 6 09:15:50 PST 2003
Currently how should one lock a struct ifnet* so one can safely use
ifpromisc on it?
I'm writting a module similar to the bpf, however I am failing to
follow the correct way to safely establish locking. Grabbing
[Giant does not seem correct as Giant is being removed]
my understanding is that one uses ifunit to convert
if_name -> struct ifnet *ifp
and then one uses the *ifp in the ifpromisc call.
the safety I'm referring to would be:
a) device deallocation in between ifunit and ifpromisc.
b) simultaneous calls to ifpromisc
d) a simultaneous ifpromisc call and the device being removed and
deallocated.
my guess would be to grab IFNET_RLOCK or IFNET_WLOCK, then do the
ifunit name -> ifp translation, ifpromisc, then the IFNET_UN[RW]LOCK
is this correct?
for the present?
for the future?
is there a way to acquire a struct ifnet* and keep it around safely?
[perhaps some kind of notification system for when an ifp is no
longer valid?]
thanks
John G
--
University of Colorado at Boulder John.Giacomoni at colorado.edu
Department of Computer Science phone: 303.492.8115
Engineering Center, ECCS 121 303.492.7906
430 UCB fax: 303.492.2844
Boulder, CO 80303-0430
USA
More information about the freebsd-hackers
mailing list