> 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>
[EMAIL PROTECTED]
- - - 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 [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message