From owner-freebsd-arch Thu Apr 4 13:11: 8 2002 Delivered-To: freebsd-arch@freebsd.org Received: from shell4.bayarea.net (shell4.bayarea.net [209.128.82.1]) by hub.freebsd.org (Postfix) with ESMTP id B67A837B41E; Thu, 4 Apr 2002 13:10:59 -0800 (PST) Received: from shell4.bayarea.net (localhost [127.0.0.1]) by shell4.bayarea.net (8.9.3/8.9.3) with ESMTP id NAA05062; Thu, 4 Apr 2002 13:10:44 -0800 (envelope-from stephenm@shell4.bayarea.net) Message-Id: <200204042110.NAA05062@shell4.bayarea.net> To: Doug Ambrisko Cc: "M. Warner Losh" , j@uriah.heep.sax.de, alan@clegg.com, luigi@FreeBSD.ORG, nsayer@FreeBSD.ORG, ryand-bsd@zenspider.com, Brian Somers , freebsd-arch@FreeBSD.ORG, freebsd-net@FreeBSD.ORG Subject: Re: Your change to in.c to limit duplicate networks is causing trouble Date: Thu, 04 Apr 2002 13:10:44 -0800 From: stephen macmanus Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > 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 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-arch" in the body of the message