git: ifnet: Properly protect if_multiaddrs using ifnet serializers

Sepherosa Ziehau sephe at crater.dragonflybsd.org
Sun May 18 01:29:37 PDT 2014


commit 72659ed0ae74f217471476f10385924812a91186
Author: Sepherosa Ziehau <sephe at dragonflybsd.org>
Date:   Tue May 13 21:59:18 2014 +0800

    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.

Summary of changes:
 sys/net/if.c                               | 99 +++++++++++++++++++-----------
 sys/net/if_var.h                           |  4 +-
 sys/net/vlan/if_vlan.c                     | 44 ++++++++-----
 sys/netinet/igmp.c                         |  2 +-
 sys/netinet/in.c                           | 18 ++----
 sys/netinet/in_var.h                       | 39 +++++++-----
 sys/netinet/ip_demux.c                     |  5 ++
 sys/netinet/ip_input.c                     | 23 ++++++-
 sys/netinet/ip_output.c                    |  2 +-
 sys/netinet6/in6.c                         |  8 +--
 sys/netinet6/in6_ifattach.c                |  4 +-
 sys/netinet6/in6_var.h                     | 41 +++++++------
 sys/netinet6/ip6_mroute.c                  |  2 +-
 sys/netinet6/ip6_output.c                  |  2 +-
 sys/netinet6/mld6.c                        | 33 ++++++++--
 sys/netinet6/nd6.c                         |  2 +-
 sys/netproto/802_11/wlan/ieee80211_ioctl.c | 10 +--
 sys/netproto/ipsec/key.c                   |  3 +-
 sys/netproto/key/key.c                     |  3 +-
 19 files changed, 213 insertions(+), 131 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/72659ed0ae74f217471476f10385924812a91186


-- 
DragonFly BSD source repository


More information about the Commits mailing list