ifnet: Properly protect if_multiaddrs using ifnet serializers
- Protect ifnet.if_multiaddrs using ifnet serializers. Add some
comment in the places, where only main serailizer is necessary.
- Fix if_delallmulti(). Using TAILQ_FOREACH_MUTABLE is incorrect for
deleting an ifmultiaddr from ifnet.if_multiaddrs. Since deleting one
ifmultiaddr may cause additional ifmultiaddr deletion (e.g. the AF_LINK
ifmultiaddr for AF_INET ifmultiaddr).
- Change IN_LOOKUP_MULTI and IN6_LOOKUP_MULTI macros into inline
functions.
- Redispatch multicast IP packets to netisr0 for further processing.
Software based IP packet hash function is changed. And hash value
fixup for multicast IP packets is added to the beginning of ip_input();
this is mainly for IP packets, whose hash is calculated by hardware.
- For wlan's multicast hardware filter updating, we no longer need to
release wlan serializer and mess up w/ the if_ioctl setting.
In netisr0, read and test ifma_refcount for AF_INET ifmultiaddr is MPSAFE
w/o ifnet serializers, since its ifma_refcount is only altered in netisr0.
In netisr0, any operation on in_multi, which is obtained from the
corresponding ifmuliaddr's ifma_protospec, is MPSAFE w/o ifnet
serializers, since ifmultiaddr for AF_INET is only set and cleared in
netisr0.
While I'm here also redispatch IP packets w/o hash to the proper netisrs,
on ip_input() path. And unnecessary critical sections in
in_{add,del}multi() are removed.
19 files changed: