Subject: CVS commit: src/sys
To: None <source-changes@NetBSD.org>
From: David Young <dyoung@netbsd.org>
List: source-changes
Date: 07/19/2007 20:49:00
Module Name:	src
Committed By:	dyoung
Date:		Thu Jul 19 20:49:00 UTC 2007

Modified Files:
	src/sys/conf: files
	src/sys/kern: uipc_domain.c
	src/sys/net: if.c if_strip.c route.c route.h rtsock.c
	src/sys/netinet: if_arp.c if_atm.c in_pcb.c ip_carp.c ip_icmp.c
	    ip_input.c tcp_subr.c
	src/sys/netinet6: icmp6.c in6.c in6_pcb.c in6_var.h ip6_input.c
	    ip6_var.h ip6protosw.h nd6.c nd6.h nd6_nbr.c nd6_rtr.c raw_ip6.c
	src/sys/netiso: clnp_subr.c esis.c esis.h iso_snpac.c
	src/sys/nfs: nfs_boot.c
Added Files:
	src/sys/net: link_proto.c

Log Message:
Take steps to hide the radix_node implementation of the forwarding table
from the forwarding table's users:

        Introduce rt_walktree() for walking the routing table and
        applying a function to each rtentry.  Replace most
        rn_walktree() calls with it.

        Use rt_getkey()/rt_setkey() to get/set a route's destination.
        Keep a pointer to the sockaddr key in the rtentry, so that
        rtentry users do not have to grovel in the radix_node for
        the key.

        Add a RTM_GET method to rtrequest.  Use that instead of
        radix_node lookups in, e.g., carp(4).

Add sys/net/link_proto.c, which supplies sockaddr routines for
link-layer socket addresses (sockaddr_dl).

Cosmetic:

        Constify.  KNF.  Stop open-coding LIST_FOREACH, TAILQ_FOREACH,
        et cetera.  Use NULL instead of 0 for null pointers.  Use
        __arraycount().  Reduce gratuitous parenthesization.

        Stop using variadic arguments for rip6_output(), it is
        unnecessary.

        Remove the unnecessary rtentry member rt_genmask and the
        code to maintain it, since nothing actually used it.

        Make rt_maskedcopy() easier to read by using meaningful variable
        names.

        Extract a subroutine intern_netmask() for looking up a netmask in
        the masks table.

        Start converting backslash-ridden IPv6 macros in
        sys/netinet6/in6_var.h into inline subroutines that one
        can read without special eyeglasses.

One functional change: when the kernel serves an RTM_GET, RTM_LOCK,
or RTM_CHANGE request, it applies the netmask (if supplied) to a
destination before searching for it in the forwarding table.

I have changed sys/netinet/ip_carp.c, carp_setroute(), to remove
the unlawful radix_node knowledge.

Apart from the changes to carp(4), netiso, ATM, and strip(4), I
have run the changes on three nodes in my wireless routing testbed,
which involves IPv4 + IPv6 dynamic routing acrobatics, and it's
working beautifully so far.


To generate a diff of this commit:
cvs rdiff -r1.852 -r1.853 src/sys/conf/files
cvs rdiff -r1.66 -r1.67 src/sys/kern/uipc_domain.c
cvs rdiff -r1.193 -r1.194 src/sys/net/if.c
cvs rdiff -r1.76 -r1.77 src/sys/net/if_strip.c
cvs rdiff -r0 -r1.1 src/sys/net/link_proto.c
cvs rdiff -r1.93 -r1.94 src/sys/net/route.c
cvs rdiff -r1.56 -r1.57 src/sys/net/route.h
cvs rdiff -r1.94 -r1.95 src/sys/net/rtsock.c
cvs rdiff -r1.124 -r1.125 src/sys/netinet/if_arp.c
cvs rdiff -r1.23 -r1.24 src/sys/netinet/if_atm.c
cvs rdiff -r1.117 -r1.118 src/sys/netinet/in_pcb.c
cvs rdiff -r1.13 -r1.14 src/sys/netinet/ip_carp.c
cvs rdiff -r1.111 -r1.112 src/sys/netinet/ip_icmp.c
cvs rdiff -r1.249 -r1.250 src/sys/netinet/ip_input.c
cvs rdiff -r1.216 -r1.217 src/sys/netinet/tcp_subr.c
cvs rdiff -r1.134 -r1.135 src/sys/netinet6/icmp6.c
cvs rdiff -r1.130 -r1.131 src/sys/netinet6/in6.c
cvs rdiff -r1.87 -r1.88 src/sys/netinet6/in6_pcb.c
cvs rdiff -r1.51 -r1.52 src/sys/netinet6/in6_var.h
cvs rdiff -r1.108 -r1.109 src/sys/netinet6/ip6_input.c
cvs rdiff -r1.44 -r1.45 src/sys/netinet6/ip6_var.h
cvs rdiff -r1.18 -r1.19 src/sys/netinet6/ip6protosw.h
cvs rdiff -r1.116 -r1.117 src/sys/netinet6/nd6.c
cvs rdiff -r1.47 -r1.48 src/sys/netinet6/nd6.h
cvs rdiff -r1.76 -r1.77 src/sys/netinet6/nd6_nbr.c
cvs rdiff -r1.65 -r1.66 src/sys/netinet6/nd6_rtr.c
cvs rdiff -r1.85 -r1.86 src/sys/netinet6/raw_ip6.c
cvs rdiff -r1.28 -r1.29 src/sys/netiso/clnp_subr.c
cvs rdiff -r1.46 -r1.47 src/sys/netiso/esis.c
cvs rdiff -r1.21 -r1.22 src/sys/netiso/esis.h
cvs rdiff -r1.43 -r1.44 src/sys/netiso/iso_snpac.c
cvs rdiff -r1.67 -r1.68 src/sys/nfs/nfs_boot.c

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