git: rtsock: Make sysctl NET_RT_DUMP MPSAFE.

Sepherosa Ziehau sephe at crater.dragonflybsd.org
Thu Mar 12 18:44:36 PDT 2015


commit 291dd55bdc005bdc5191983b74c294c6090cb925
Author: Sepherosa Ziehau <sephe at dragonflybsd.org>
Date:   Mon Mar 9 22:28:15 2015 +0800

    rtsock: Make sysctl NET_RT_DUMP MPSAFE.
    
    - Add rn_walktree_at(), which walks the radix tree from a target node,
      if it could be found, or from the closest node of the target node.
    - Allocate temporary buffer for rtm batch, which should be large enough
      for duplicated keys.  We could consider reallocate it if there are
      any real cases that this temporary buffer could not hold rtms for all
      duplicated keys.  In the current implementation, it just logs one
      error and stop.
    - Convert the rtentries to rtms in temporary buffer in netisr; unlike
      what we do for inpcbs, routing table could be in inconsistent state
      (due to blocking malloc), if we are not accessing the routing table
      in netisr.  If there is no more space in the temporary buffer, the
      current rtentry's key and netmask are saved and we will start from it
      next time.  Since rn_walktree_at() only starts from the first node of
      duplicated keys, we have to make sure that there is enough space for
      all duplicated keys in the temoprary buffer.
    - Once the temporary buffer can't hold more rtms, the rtms in it will
      be delivered to userland.  And we start converting the rtentries in
      netisr from the last node again, until all rtentries are iterated.

Summary of changes:
 sys/net/radix.c  |  25 ++++-
 sys/net/radix.h  |   7 +-
 sys/net/rtsock.c | 288 +++++++++++++++++++++++++++++++++++++++++++------------
 3 files changed, 254 insertions(+), 66 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/291dd55bdc005bdc5191983b74c294c6090cb925


-- 
DragonFly BSD source repository



More information about the Commits mailing list