Import dhcpcd-7.0.8 with the following changes:
* Don't use IP_PKTINFO on NetBSD-7 as it's incomplete. * Workaround RTM_NEWADDR sending the wrong broadcast address on NetBSD-7. * Silence diagnostics if an address vanishes when reading it's flags on all BSD's. * Misc compiler warnings fixed.
This commit is contained in:
parent
f3451e1460
commit
3e0aeb312b
|
@ -28,7 +28,7 @@
|
|||
#define CONFIG_H
|
||||
|
||||
#define PACKAGE "dhcpcd"
|
||||
#define VERSION "7.0.7"
|
||||
#define VERSION "7.0.8"
|
||||
|
||||
#ifndef CONFIG
|
||||
# define CONFIG SYSCONFDIR "/" PACKAGE ".conf"
|
||||
|
|
|
@ -777,7 +777,6 @@ dhcp6_makemessage(struct interface *ifp)
|
|||
/* FALLTHROUGH */
|
||||
case DH6S_INIT:
|
||||
for (l = 0; l < ifo->ia_len; l++) {
|
||||
ifia = &ifo->ia[l];
|
||||
len += sizeof(o) + sizeof(uint32_t); /* IAID */
|
||||
/* IA_TA does not have T1 or T2 timers */
|
||||
if (ifo->ia[l].ia_type != D6_OPTION_IA_TA)
|
||||
|
|
|
@ -1103,9 +1103,32 @@ if_ifa(struct dhcpcd_ctx *ctx, const struct ifa_msghdr *ifam)
|
|||
sin = (const void *)rti_info[RTAX_NETMASK];
|
||||
mask.s_addr = sin != NULL && sin->sin_family == AF_INET ?
|
||||
sin->sin_addr.s_addr : INADDR_ANY;
|
||||
|
||||
#if defined(__NetBSD_Version__) && __NetBSD_Version__ < 800000000
|
||||
/* NetBSD-7 and older send an invalid broadcast address.
|
||||
* So we need to query the actual address to get
|
||||
* the right one. */
|
||||
{
|
||||
struct in_aliasreq ifra;
|
||||
|
||||
memset(&ifra, 0, sizeof(ifra));
|
||||
strlcpy(ifra.ifra_name, ifp->name,
|
||||
sizeof(ifra.ifra_name));
|
||||
ifra.ifra_addr.sin_family = AF_INET;
|
||||
ifra.ifra_addr.sin_len = sizeof(ifra.ifra_addr);
|
||||
ifra.ifra_addr.sin_addr = addr;
|
||||
if (ioctl(ctx->pf_inet_fd, SIOCGIFALIAS, &ifra) == -1) {
|
||||
if (errno != EADDRNOTAVAIL)
|
||||
logerr("%s: SIOCGIFALIAS", __func__);
|
||||
break;
|
||||
}
|
||||
bcast = ifra.ifra_broadaddr.sin_addr;
|
||||
}
|
||||
#else
|
||||
sin = (const void *)rti_info[RTAX_BRD];
|
||||
bcast.s_addr = sin != NULL && sin->sin_family == AF_INET ?
|
||||
sin->sin_addr.s_addr : INADDR_ANY;
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
/* FreeBSD sends RTM_DELADDR for each assigned address
|
||||
|
@ -1134,8 +1157,8 @@ if_ifa(struct dhcpcd_ctx *ctx, const struct ifa_msghdr *ifam)
|
|||
if (ifam->ifam_type == RTM_DELADDR)
|
||||
addrflags = 0 ;
|
||||
else if ((addrflags = if_addrflags(ifp, &addr, NULL)) == -1) {
|
||||
logerr("%s: if_addrflags: %s",
|
||||
ifp->name, inet_ntoa(addr));
|
||||
if (errno != EADDRNOTAVAIL)
|
||||
logerr("%s: if_addrflags", __func__);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
@ -1160,7 +1183,8 @@ if_ifa(struct dhcpcd_ctx *ctx, const struct ifa_msghdr *ifam)
|
|||
if (ifam->ifam_type == RTM_DELADDR)
|
||||
addrflags = 0;
|
||||
else if ((addrflags = if_addrflags6(ifp, &addr6, NULL)) == -1) {
|
||||
logerr("%s: if_addrflags6", ifp->name);
|
||||
if (errno != EADDRNOTAVAIL)
|
||||
logerr("%s: if_addrflags6", __func__);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -240,10 +240,8 @@ if_learnaddrs(struct dhcpcd_ctx *ctx, struct if_head *ifs,
|
|||
addrflags = if_addrflags(ifp, &addr->sin_addr,
|
||||
ifa->ifa_name);
|
||||
if (addrflags == -1) {
|
||||
if (errno != EEXIST)
|
||||
logerr("%s: if_addrflags: %s",
|
||||
__func__,
|
||||
inet_ntoa(addr->sin_addr));
|
||||
if (errno != EEXIST && errno != EADDRNOTAVAIL)
|
||||
logerr("%s: if_addrflags", __func__);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
@ -266,7 +264,7 @@ if_learnaddrs(struct dhcpcd_ctx *ctx, struct if_head *ifs,
|
|||
addrflags = if_addrflags6(ifp, &sin6->sin6_addr,
|
||||
ifa->ifa_name);
|
||||
if (addrflags == -1) {
|
||||
if (errno != EEXIST)
|
||||
if (errno != EEXIST && errno != EADDRNOTAVAIL)
|
||||
logerr("%s: if_addrflags6", __func__);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -816,9 +816,17 @@ ipv4_handleifa(struct dhcpcd_ctx *ctx,
|
|||
bool ia_is_new;
|
||||
|
||||
#if 0
|
||||
logdebugx("%s: %s %s/%d %d", ifname,
|
||||
cmd == RTM_NEWADDR ? "RTM_NEWADDR" : cmd == RTM_DELADDR ? "RTM_DELADDR" : "???",
|
||||
inet_ntoa(*addr), inet_ntocidr(*mask), addrflags);
|
||||
char sbrdbuf[INET_ADDRSTRLEN];
|
||||
const char *sbrd;
|
||||
|
||||
if (brd)
|
||||
sbrd = inet_ntop(AF_INET, brd, sbrdbuf, sizeof(sbrdbuf));
|
||||
else
|
||||
sbrd = NULL;
|
||||
logdebugx("%s: %s %s/%d %s %d", ifname,
|
||||
cmd == RTM_NEWADDR ? "RTM_NEWADDR" :
|
||||
cmd == RTM_DELADDR ? "RTM_DELADDR" : "???",
|
||||
inet_ntoa(*addr), inet_ntocidr(*mask), sbrd, addrflags);
|
||||
#endif
|
||||
|
||||
if (ifs == NULL)
|
||||
|
|
|
@ -430,7 +430,7 @@ ipv6_mask(struct in6_addr *mask, int len)
|
|||
bits = len % NBBY;
|
||||
for (i = 0; i < bytes; i++)
|
||||
mask->s6_addr[i] = 0xff;
|
||||
if (bits) {
|
||||
if (bits != 0) {
|
||||
/* Coverify false positive.
|
||||
* bytelen cannot be 16 if bitlen is non zero */
|
||||
/* coverity[overrun-local] */
|
||||
|
@ -567,7 +567,8 @@ ipv6_checkaddrflags(void *arg)
|
|||
alias = NULL;
|
||||
#endif
|
||||
if ((flags = if_addrflags6(ia->iface, &ia->addr, alias)) == -1) {
|
||||
logerr("%s: if_addrflags6", ia->iface->name);
|
||||
if (errno != EEXIST && errno != EADDRNOTAVAIL)
|
||||
logerr("%s: if_addrflags6", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue