in.c autoadding prefix route

Andrea Campi andrea+freebsd_arch at webcom.it
Sun Jul 3 00:09:03 GMT 2005


On Thu, Nov 11, 2004 at 09:24:05PM +0100, Max Laier wrote:
> The attached patch (http://people.freebsd.org/~mlaier/in.c.patch) derived from 
> WIDE via OpenBSD in.c, rev 1.21 improves the handling of automatic prefix 
> routes.

Sounds like a very useful change indeed.

One comment though:

> @@ -743,26 +766,7 @@
>  			return (0);
>  		flags |= RTF_HOST;
>  	}
> -
> -	/*-
> -	 * Don't add host routes for interface addresses of
> -	 * 0.0.0.0 --> 0.255.255.255 netmask 255.0.0.0.  This makes it
> -	 * possible to assign several such address pairs with consistent
> -	 * results (no host route) and is required by BOOTP.
> -	 *
> -	 * XXX: This is ugly !  There should be a way for the caller to
> -	 *      say that they don't want a host route.
> -	 */
> -	if (ia->ia_addr.sin_addr.s_addr != INADDR_ANY ||
> -	    ia->ia_netmask != IN_CLASSA_NET ||
> -	    ia->ia_dstaddr.sin_addr.s_addr != htonl(IN_CLASSA_HOST)) {
> -		if ((error = rtinit(&ia->ia_ifa, (int)RTM_ADD, flags)) != 0) {
> -			ia->ia_addr = oldaddr;
> -			return (error);
> -		}
> -		ia->ia_flags |= IFA_ROUTE;
> -	}
> -
> +	error = in_addprefix(ia, flags);
>  	/*
>  	 * If the interface supports multicast, join the "all hosts"
>  	 * multicast group on that interface.

Are you sure you want to go on if you got an error? Regardless, you should
probably have an empty line after in_addrprefix.

> +	TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) {
> +			if (rtinitflags(ia))
> +			p = ia->ia_dstaddr.sin_addr;
> +		else {

The if() is misindented.


The rest looks good.

Bye,
	Andrea


-- 
      ...and that is how we know the Earth to be banana-shaped.
_______________________________________________
freebsd-arch at freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe at freebsd.org"



More information about the freebsd-net mailing list