Source-Changes archive

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

CVS commit: src/sys



Module Name:    src
Committed By:   dyoung
Date:           Wed May  2 20:40:29 UTC 2007

Modified Files:
        src/sys/conf: files
        src/sys/dist/ipf/netinet: ip_fil_netbsd.c
        src/sys/dist/pf/net: pf.c
        src/sys/kern: uipc_domain.c uipc_socket.c
        src/sys/net: if_etherip.h if_gif.h if_gre.c if_stf.c route.c route.h
        src/sys/netatalk: aarp.c at_proto.c at_var.h ddp_input.c ddp_usrreq.c
        src/sys/netbt: bt_proto.c
        src/sys/netinet: in.h in_gif.c in_pcb.c in_proto.c in_route.c
            ip_etherip.c ip_flow.c ip_input.c ip_output.c tcp_input.c
            tcp_output.c tcp_subr.c tcp_var.h
        src/sys/netinet6: frag6.c icmp6.c in6.h in6_gif.c in6_offload.c
            in6_offload.h in6_pcb.c in6_pcb.h in6_proto.c in6_src.c
            ip6_etherip.c ip6_flow.c ip6_forward.c ip6_input.c ip6_mroute.c
            ip6_output.c ip6_var.h ipsec.c ipsec.h nd6.c nd6.h nd6_nbr.c
        src/sys/netiso: clnp.h clnp_er.c clnp_frag.c clnp_output.c clnp_raw.c
            clnp_subr.c eonvar.h if_eon.c iso.c iso.h iso_pcb.c iso_pcb.h
            iso_proto.c iso_var.h tp_iso.c
        src/sys/netkey: keydb.h
        src/sys/netnatm: natm_proto.c
        src/sys/sys: domain.h socket.h

Log Message:
Eliminate address family-specific route caches (struct route, struct
route_in6, struct route_iso), replacing all caches with a struct
route.

The principle benefit of this change is that all of the protocol
families can benefit from route cache-invalidation, which is
necessary for correct routing.  Route-cache invalidation fixes an
ancient PR, kern/3508, at long last; it fixes various other PRs,
also.

Discussions with and ideas from Joerg Sonnenberger influenced this
work tremendously.  Of course, all design oversights and bugs are
mine.

DETAILS

1 I added to each address family a pool of sockaddrs.  I have
  introduced routines for allocating, copying, and duplicating,
  and freeing sockaddrs:

        struct sockaddr *sockaddr_alloc(sa_family_t af, int flags);
        struct sockaddr *sockaddr_copy(struct sockaddr *dst,
                                       const struct sockaddr *src);
        struct sockaddr *sockaddr_dup(const struct sockaddr *src, int flags);
        void sockaddr_free(struct sockaddr *sa);

  sockaddr_alloc() returns either a sockaddr from the pool belonging
  to the specified family, or NULL if the pool is exhausted.  The
  returned sockaddr has the right size for that family; sa_family
  and sa_len fields are initialized to the family and sockaddr
  length---e.g., sa_family = AF_INET and sa_len = sizeof(struct
  sockaddr_in).  sockaddr_free() puts the given sockaddr back into
  its family's pool.

  sockaddr_dup() and sockaddr_copy() work analogously to strdup()
  and strcpy(), respectively.  sockaddr_copy() KASSERTs that the
  family of the destination and source sockaddrs are alike.

  The 'flags' argumet for sockaddr_alloc() and sockaddr_dup() is
  passed directly to pool_get(9).

2 I added routines for initializing sockaddrs in each address
  family, sockaddr_in_init(), sockaddr_in6_init(), sockaddr_iso_init(),
  etc.  They are fairly self-explanatory.

3 structs route_in6 and route_iso are no more.  All protocol families
  use struct route.  I have changed the route cache, 'struct route',
  so that it does not contain storage space for a sockaddr.  Instead,
  struct route points to a sockaddr coming from the pool the sockaddr
  belongs to.  I added a new method to struct route, rtcache_setdst(),
  for setting the cache destination:

        int rtcache_setdst(struct route *, const struct sockaddr *);

  rtcache_setdst() returns 0 on success, or ENOMEM if no memory is
  available to create the sockaddr storage.

  It is now possible for rtcache_getdst() to return NULL if, say,
  rtcache_setdst() failed.  I check the return value for NULL
  everywhere in the kernel.

4 Each routing domain (struct domain) has a list of live route
  caches, dom_rtcache.  rtflushall(sa_family_t af) looks up the
  domain indicated by 'af', walks the domain's list of route caches
  and invalidates each one.


To generate a diff of this commit:
cvs rdiff -r1.839 -r1.840 src/sys/conf/files
cvs rdiff -r1.34 -r1.35 src/sys/dist/ipf/netinet/ip_fil_netbsd.c
cvs rdiff -r1.36 -r1.37 src/sys/dist/pf/net/pf.c
cvs rdiff -r1.63 -r1.64 src/sys/kern/uipc_domain.c
cvs rdiff -r1.139 -r1.140 src/sys/kern/uipc_socket.c
cvs rdiff -r1.2 -r1.3 src/sys/net/if_etherip.h
cvs rdiff -r1.16 -r1.17 src/sys/net/if_gif.h
cvs rdiff -r1.91 -r1.92 src/sys/net/if_gre.c
cvs rdiff -r1.59 -r1.60 src/sys/net/if_stf.c
cvs rdiff -r1.89 -r1.90 src/sys/net/route.c
cvs rdiff -r1.53 -r1.54 src/sys/net/route.h
cvs rdiff -r1.22 -r1.23 src/sys/netatalk/aarp.c
cvs rdiff -r1.12 -r1.13 src/sys/netatalk/at_proto.c
cvs rdiff -r1.5 -r1.6 src/sys/netatalk/at_var.h
cvs rdiff -r1.14 -r1.15 src/sys/netatalk/ddp_input.c
cvs rdiff -r1.24 -r1.25 src/sys/netatalk/ddp_usrreq.c
cvs rdiff -r1.7 -r1.8 src/sys/netbt/bt_proto.c
cvs rdiff -r1.78 -r1.79 src/sys/netinet/in.h
cvs rdiff -r1.55 -r1.56 src/sys/netinet/in_gif.c
cvs rdiff -r1.116 -r1.117 src/sys/netinet/in_pcb.c
cvs rdiff -r1.83 -r1.84 src/sys/netinet/in_proto.c
cvs rdiff -r1.6 -r1.7 src/sys/netinet/in_route.c
cvs rdiff -r1.4 -r1.5 src/sys/netinet/ip_etherip.c
cvs rdiff -r1.45 -r1.46 src/sys/netinet/ip_flow.c
cvs rdiff -r1.248 -r1.249 src/sys/netinet/ip_input.c
cvs rdiff -r1.179 -r1.180 src/sys/netinet/ip_output.c
cvs rdiff -r1.263 -r1.264 src/sys/netinet/tcp_input.c
cvs rdiff -r1.157 -r1.158 src/sys/netinet/tcp_output.c
cvs rdiff -r1.213 -r1.214 src/sys/netinet/tcp_subr.c
cvs rdiff -r1.145 -r1.146 src/sys/netinet/tcp_var.h
cvs rdiff -r1.36 -r1.37 src/sys/netinet6/frag6.c src/sys/netinet6/in6_src.c
cvs rdiff -r1.131 -r1.132 src/sys/netinet6/icmp6.c
cvs rdiff -r1.59 -r1.60 src/sys/netinet6/in6.h
cvs rdiff -r1.50 -r1.51 src/sys/netinet6/in6_gif.c
cvs rdiff -r1.3 -r1.4 src/sys/netinet6/in6_offload.c
cvs rdiff -r1.4 -r1.5 src/sys/netinet6/in6_offload.h \
    src/sys/netinet6/ip6_etherip.c
cvs rdiff -r1.85 -r1.86 src/sys/netinet6/in6_pcb.c
cvs rdiff -r1.31 -r1.32 src/sys/netinet6/in6_pcb.h
cvs rdiff -r1.75 -r1.76 src/sys/netinet6/in6_proto.c
cvs rdiff -r1.6 -r1.7 src/sys/netinet6/ip6_flow.c
cvs rdiff -r1.56 -r1.57 src/sys/netinet6/ip6_forward.c
cvs rdiff -r1.102 -r1.103 src/sys/netinet6/ip6_input.c
cvs rdiff -r1.79 -r1.80 src/sys/netinet6/ip6_mroute.c
cvs rdiff -r1.117 -r1.118 src/sys/netinet6/ip6_output.c
cvs rdiff -r1.42 -r1.43 src/sys/netinet6/ip6_var.h
cvs rdiff -r1.116 -r1.117 src/sys/netinet6/ipsec.c
cvs rdiff -r1.46 -r1.47 src/sys/netinet6/ipsec.h
cvs rdiff -r1.113 -r1.114 src/sys/netinet6/nd6.c
cvs rdiff -r1.45 -r1.46 src/sys/netinet6/nd6.h
cvs rdiff -r1.72 -r1.73 src/sys/netinet6/nd6_nbr.c
cvs rdiff -r1.23 -r1.24 src/sys/netiso/clnp.h
cvs rdiff -r1.21 -r1.22 src/sys/netiso/clnp_er.c
cvs rdiff -r1.19 -r1.20 src/sys/netiso/clnp_frag.c \
    src/sys/netiso/clnp_output.c src/sys/netiso/iso.h
cvs rdiff -r1.27 -r1.28 src/sys/netiso/clnp_raw.c src/sys/netiso/clnp_subr.c
cvs rdiff -r1.16 -r1.17 src/sys/netiso/eonvar.h src/sys/netiso/iso_pcb.h
cvs rdiff -r1.57 -r1.58 src/sys/netiso/if_eon.c
cvs rdiff -r1.41 -r1.42 src/sys/netiso/iso.c
cvs rdiff -r1.38 -r1.39 src/sys/netiso/iso_pcb.c
cvs rdiff -r1.22 -r1.23 src/sys/netiso/iso_proto.c
cvs rdiff -r1.25 -r1.26 src/sys/netiso/iso_var.h
cvs rdiff -r1.30 -r1.31 src/sys/netiso/tp_iso.c
cvs rdiff -r1.27 -r1.28 src/sys/netkey/keydb.h
cvs rdiff -r1.10 -r1.11 src/sys/netnatm/natm_proto.c
cvs rdiff -r1.24 -r1.25 src/sys/sys/domain.h
cvs rdiff -r1.84 -r1.85 src/sys/sys/socket.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index