dhclient: do not add 0.0.0.0 interface alias.

Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D38908
This commit is contained in:
Alexander V. Chernikov 2023-03-04 15:18:26 +00:00
parent 055776c84a
commit e2dc8d789f
2 changed files with 9 additions and 21 deletions

View File

@ -318,13 +318,12 @@ fi
case $reason in
MEDIUM)
eval "$IFCONFIG $interface $medium"
eval "$IFCONFIG $interface inet -alias 0.0.0.0 $medium" >/dev/null 2>&1
sleep 1
;;
PREINIT)
delete_old_alias
$IFCONFIG $interface inet alias 0.0.0.0 netmask 255.0.0.0 broadcast 255.255.255.255 up
eval "$IFCONFIG $interface up"
;;
ARPCHECK|ARPSEND)

View File

@ -78,6 +78,7 @@ discover_interfaces(struct interface_info *iface)
{
struct ifaddrs *ifap, *ifa;
struct ifreq *tif;
int len = IFNAMSIZ + sizeof(struct sockaddr_storage);
if (getifaddrs(&ifap) != 0)
error("getifaddrs failed");
@ -118,26 +119,14 @@ discover_interfaces(struct interface_info *iface)
iface->hw_address.htype = HTYPE_ETHER; /* XXX */
memcpy(iface->hw_address.haddr,
LLADDR(foo), foo->sdl_alen);
} else if (ifa->ifa_addr->sa_family == AF_INET) {
struct sockaddr_in foo;
struct iaddr addr;
memcpy(&foo, ifa->ifa_addr, sizeof(foo));
if (foo.sin_addr.s_addr == htonl(INADDR_LOOPBACK))
continue;
if (!iface->ifp) {
if ((tif = calloc(1, sizeof(struct ifreq)))
== NULL)
error("no space to remember ifp");
strlcpy(tif->ifr_name, ifa->ifa_name, IFNAMSIZ);
memcpy(&tif->ifr_addr, ifa->ifa_addr,
ifa->ifa_addr->sa_len);
iface->ifp = tif;
iface->primary_address = foo.sin_addr;
}
addr.len = 4;
memcpy(addr.iabuf, &foo.sin_addr.s_addr, addr.len);
}
if (!iface->ifp) {
if ((tif = calloc(1, len)) == NULL)
error("no space to remember ifp");
strlcpy(tif->ifr_name, ifa->ifa_name, IFNAMSIZ);
iface->ifp = tif;
}
}
if (!iface->ifp)