Date: Thu, 04 Apr 2002 13:10:44 -0800 From: stephen macmanus <stephenm@bayarea.net> To: Doug Ambrisko <ambrisko@ambrisko.com> Cc: "M. Warner Losh" <imp@village.org>, j@uriah.heep.sax.de, alan@clegg.com, luigi@FreeBSD.ORG, nsayer@FreeBSD.ORG, ryand-bsd@zenspider.com, Brian Somers <brian@freebsd-services.com>, freebsd-arch@FreeBSD.ORG, freebsd-net@FreeBSD.ORG Subject: Re: Your change to in.c to limit duplicate networks is causing trouble Message-ID: <200204042110.NAA05062@shell4.bayarea.net>
next in thread | raw e-mail | index | archive | help
> The code now avoids adding a host route if the interface address is > 0.0.0.0, and always treats a failure to add a host route as fatal > (previously, it masked EEXIST for some reason - I guessed because it > was trying to handle address re-assignment, but that works ok with > this patch). One effect of the masked EEXIST is to suppress the spurious error which occurs when adding an alias IP address (SIOCAIFADDR) on the same logical subnet as an existing IP address. Users have no way of knowing that it's actually safe to simply ignore the error in that situation, so the masking should probably be preserved. Stephen ------------------ Stephen Macmanus #include <std_disclaimer.h> stephenm@bayarea.net - - - if ((error = rtinit(&(ia->ia_ifa), (int)RTM_ADD, flags)) == 0) - - - ia->ia_flags |= IFA_ROUTE; - - - if (error != 0 && ia->ia_dstaddr.sin_family == AF_INET) { - - - ia->ia_addr = oldaddr; - - - return (error); + /* + * Don't add routing table entries for interface address entries + * of 0.0.0.0. This makes it possible to assign several such address + * pairs with consistent results (no host route) and is required by + * BOOTP. + */ + if (ia->ia_addr.sin_addr.s_addr != INADDR_ANY) { + if ((error = rtinit(&ia->ia_ifa, (int)RTM_ADD, flags)) != 0) { + ia->ia_addr = oldaddr; + return (error); + } + ia->ia_flags |= IFA_ROUTE; } - - - /* XXX check if the subnet route points to the same interface */ - - - if (error == EEXIST) - - - error = 0; /* * If the interface supports multicast, join the "all hosts" To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200204042110.NAA05062>