DragonFly BSD
DragonFly commits List (threaded) for 2005-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

cvs commit: src/sys/net hostcache.c if_atm.h if_fddisubr.c route.c route.h rtsock.c src/sys/net/faith if_faith.c src/sys/netinet if_ether.c in_gif.c in_hostcache.c in_rmx.c ip_icmp.c src/sys/netinet6 icmp6.c in6.c in6_gif.c in6_ifattach.c in6_pcb.c ...


From: Jeffrey Hsu <hsu@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 6 Jan 2005 09:59:33 -0800 (PST)

hsu         2005/01/06 09:59:33 PST

DragonFly src repository

  Modified files:
    sys/net              hostcache.c if_atm.h if_fddisubr.c 
                         route.c route.h rtsock.c 
    sys/net/faith        if_faith.c 
    sys/netinet          if_ether.c in_gif.c in_hostcache.c 
                         in_rmx.c ip_icmp.c 
    sys/netinet6         icmp6.c in6.c in6_gif.c in6_ifattach.c 
                         in6_pcb.c in6_rmx.c in6_src.c 
                         ip6_output.c nd6.c nd6_nbr.c 
  Log:
  Now that I understand the poorly written BSD routing code and what
  it was trying to do, rewrite it in a clear and concise manner.
  
  The old rtalloc1() code written by CSRG had a number of problems:
    1. it was not clear which route was being returned
    2. it was not clear what was being reported
    3. it hid the essential radix tree lookup operation inside a series of
        conditional tests and inline assignments
    4. it had multiple gotos to the inside of if statements
    5. it intermixed reporting code with the operational logic of lookup
        and cloning
    6. it assigns multiple times to key variables
    7. it has unnecessary assignments to key variables
    8. it overloaded the "report" argument parameter, to have two
        different semantics
    9. it misnamed the key route lookup function "rtalloc1", obscuring all uses
        of route lookup.
  
  In contrast to the rtalloc1 code in FreeBSD 4 or the even more convoluted
  rtalloc1 code in FreeBSD 5, the DragonFlyBSD version
    A. has a clear control flow that makes the common case obvious
        by highlighting the core call to the radix tree look up function,
        eliminating gotos into if statements,
        and completely separating out the special-case cloning logic
    B. makes it clear which route is being returned
        by only assigning once to the key "rt" variable
        and by expliciting returning "rt" or "clonedroute"
    C. abstracts out the reporting code into its own reporting API
    D. cleans up the semantics of the "report" argument parameter to
        only indicate whether to report a miss and not whether to clone
    E. introduces a simple single-argument API for caller that want to clone
        and those that do not.
  
  Revision  Changes    Path
  1.5       +1 -1      src/sys/net/hostcache.c
  1.6       +1 -1      src/sys/net/if_atm.h
  1.15      +1 -1      src/sys/net/if_fddisubr.c
  1.13      +116 -69   src/sys/net/route.c
  1.10      +79 -1     src/sys/net/route.h
  1.20      +85 -10    src/sys/net/rtsock.c
  1.11      +1 -1      src/sys/net/faith/if_faith.c
  1.24      +56 -3     src/sys/netinet/if_ether.c
  1.13      +1 -1      src/sys/netinet/in_gif.c
  1.5       +1 -1      src/sys/netinet/in_hostcache.c
  1.9       +1 -2      src/sys/netinet/in_rmx.c
  1.19      +1 -2      src/sys/netinet/ip_icmp.c
  1.16      +2 -2      src/sys/netinet6/icmp6.c
  1.12      +2 -2      src/sys/netinet6/in6.c
  1.11      +1 -1      src/sys/netinet6/in6_gif.c
  1.11      +2 -2      src/sys/netinet6/in6_ifattach.c
  1.21      +2 -2      src/sys/netinet6/in6_pcb.c
  1.11      +2 -4      src/sys/netinet6/in6_rmx.c
  1.9       +2 -2      src/sys/netinet6/in6_src.c
  1.16      +2 -2      src/sys/netinet6/ip6_output.c
  1.14      +6 -5      src/sys/netinet6/nd6.c
  1.9       +1 -1      src/sys/netinet6/nd6_nbr.c


http://www.dragonflybsd.org/cvsweb/src/sys/net/hostcache.c.diff?r1=1.4&r2=1.5&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/net/if_atm.h.diff?r1=1.5&r2=1.6&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/net/if_fddisubr.c.diff?r1=1.14&r2=1.15&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/net/route.c.diff?r1=1.12&r2=1.13&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/net/route.h.diff?r1=1.9&r2=1.10&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/net/rtsock.c.diff?r1=1.19&r2=1.20&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/net/faith/if_faith.c.diff?r1=1.10&r2=1.11&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/netinet/if_ether.c.diff?r1=1.23&r2=1.24&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/netinet/in_gif.c.diff?r1=1.12&r2=1.13&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/netinet/in_hostcache.c.diff?r1=1.4&r2=1.5&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/netinet/in_rmx.c.diff?r1=1.8&r2=1.9&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/netinet/ip_icmp.c.diff?r1=1.18&r2=1.19&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/netinet6/icmp6.c.diff?r1=1.15&r2=1.16&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/netinet6/in6.c.diff?r1=1.11&r2=1.12&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/netinet6/in6_gif.c.diff?r1=1.10&r2=1.11&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/netinet6/in6_ifattach.c.diff?r1=1.10&r2=1.11&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/netinet6/in6_pcb.c.diff?r1=1.20&r2=1.21&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/netinet6/in6_rmx.c.diff?r1=1.10&r2=1.11&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/netinet6/in6_src.c.diff?r1=1.8&r2=1.9&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/netinet6/ip6_output.c.diff?r1=1.15&r2=1.16&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/netinet6/nd6.c.diff?r1=1.13&r2=1.14&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/netinet6/nd6_nbr.c.diff?r1=1.8&r2=1.9&f=u



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]