Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Nov 2004 22:55:06 +0100
From:      Andrea Campi <andrea+freebsd_arch@webcom.it>
To:        Max Laier <max@love2party.net>
Cc:        freebsd-arch@freebsd.org
Subject:   Re: in.c autoadding prefix route
Message-ID:  <20041111215506.GA60227@webcom.it>
In-Reply-To: <200411112124.12616.max@love2party.net>
References:  <200411112124.12616.max@love2party.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041111215506.GA60227>