Update to dhcpcd-9.3.1 with the following changes:

* dhcpcd: carrier handling issue fixed from 9.3.0
 * dhcpcd: log if interface type is unsupported in debug
 * duid: memory leak fixed if UUID wanted but none available
 * privsep: fix receiving inet and no BPF running
 * privsep: allow gettimeofday for SECCOMP
 * privsep: fix stderr redirection again
This commit is contained in:
roy 2020-10-12 14:07:55 +00:00
parent 5d858a7a6b
commit 597ffba2d5
10 changed files with 67 additions and 17 deletions

View File

@ -506,7 +506,7 @@ arp_announceaddr(struct dhcpcd_ctx *ctx, const struct in_addr *ia)
struct ipv4_addr *iap; struct ipv4_addr *iap;
TAILQ_FOREACH(ifp, ctx->ifaces, next) { TAILQ_FOREACH(ifp, ctx->ifaces, next) {
if (!ifp->active || ifp->carrier <= LINK_DOWN) if (!ifp->active || !if_is_link_up(ifp))
continue; continue;
iap = ipv4_iffindaddr(ifp, ia, NULL); iap = ipv4_iffindaddr(ifp, ia, NULL);
if (iap == NULL) if (iap == NULL)

View File

@ -29,7 +29,7 @@
#define CONFIG_H #define CONFIG_H
#define PACKAGE "dhcpcd" #define PACKAGE "dhcpcd"
#define VERSION "9.3.0" #define VERSION "9.3.1"
#ifndef PRIVSEP_USER #ifndef PRIVSEP_USER
# define PRIVSEP_USER "_" PACKAGE # define PRIVSEP_USER "_" PACKAGE

View File

@ -55,7 +55,6 @@
#define LINK_UP 1 #define LINK_UP 1
#define LINK_UNKNOWN 0 #define LINK_UNKNOWN 0
#define LINK_DOWN -1 #define LINK_DOWN -1
#define LINK_DOWN_IFFUP -2
#define IF_DATA_IPV4 0 #define IF_DATA_IPV4 0
#define IF_DATA_ARP 1 #define IF_DATA_ARP 1

View File

@ -178,8 +178,9 @@ duid_get(struct dhcpcd_ctx *ctx, const struct interface *ifp)
if (ifp == NULL) { if (ifp == NULL) {
if (ctx->duid_type != DUID_DEFAULT && if (ctx->duid_type != DUID_DEFAULT &&
ctx->duid_type != DUID_UUID) ctx->duid_type != DUID_UUID)
return 0; len = 0;
len = duid_make_uuid(data); else
len = duid_make_uuid(data);
if (len == 0) if (len == 0)
free(data); free(data);
else else

View File

@ -99,7 +99,7 @@
#define DHCPCD_NOALIAS (1ULL << 39) #define DHCPCD_NOALIAS (1ULL << 39)
#define DHCPCD_IA_FORCED (1ULL << 40) #define DHCPCD_IA_FORCED (1ULL << 40)
#define DHCPCD_STOPPING (1ULL << 41) #define DHCPCD_STOPPING (1ULL << 41)
#define DHCPCD_DEPARTED (1ULL << 42) #define DHCPCD_LAUNCHER (1ULL << 42)
#define DHCPCD_HOSTNAME_SHORT (1ULL << 43) #define DHCPCD_HOSTNAME_SHORT (1ULL << 43)
#define DHCPCD_EXITING (1ULL << 44) #define DHCPCD_EXITING (1ULL << 44)
#define DHCPCD_WAITIP4 (1ULL << 45) #define DHCPCD_WAITIP4 (1ULL << 45)

View File

@ -193,6 +193,17 @@ if_setflag(struct interface *ifp, short setflag, short unsetflag)
return 0; return 0;
} }
bool
if_is_link_up(const struct interface *ifp)
{
return ifp->flags & IFF_UP &&
(ifp->carrier == LINK_UP ||
(ifp->carrier == LINK_UNKNOWN &&
!(ifp->options == NULL ||
ifp->options->options & DHCPCD_LINK)));
}
int int
if_randomisemac(struct interface *ifp) if_randomisemac(struct interface *ifp)
{ {
@ -411,11 +422,16 @@ if_check_arphrd(struct interface *ifp, unsigned int active, bool if_noconf)
} }
break; break;
default: default:
if (if_noconf) if (active) {
active = IF_INACTIVE; int i;
if (active)
logwarnx("%s: unsupported interface type 0x%.2x", if (if_noconf)
active = IF_INACTIVE;
i = active ? LOG_WARNING : LOG_DEBUG;
logmessage(i, "%s: unsupported"
" interface type 0x%.2x",
ifp->name, ifp->hwtype); ifp->name, ifp->hwtype);
}
break; break;
} }
@ -621,12 +637,14 @@ if_discover(struct dhcpcd_ctx *ctx, struct ifaddrs **ifaddrs,
#endif #endif
default: default:
/* Don't allow unless explicit */ /* Don't allow unless explicit */
if (if_noconf) if (active) {
active = IF_INACTIVE; if (if_noconf)
if (active) active = IF_INACTIVE;
logwarnx("%s: unsupported" i = active ? LOG_WARNING : LOG_DEBUG;
logmessage(i, "%s: unsupported"
" interface type 0x%.2x", " interface type 0x%.2x",
ifp->name, sdl->sdl_type); ifp->name, sdl->sdl_type);
}
/* Pretend it's ethernet */ /* Pretend it's ethernet */
ifp->hwtype = ARPHRD_ETHER; ifp->hwtype = ARPHRD_ETHER;
break; break;

View File

@ -146,6 +146,7 @@ int if_getflags(struct interface *);
int if_setflag(struct interface *, short, short); int if_setflag(struct interface *, short, short);
#define if_up(ifp) if_setflag((ifp), (IFF_UP | IFF_RUNNING), 0) #define if_up(ifp) if_setflag((ifp), (IFF_UP | IFF_RUNNING), 0)
#define if_down(ifp) if_setflag((ifp), 0, IFF_UP); #define if_down(ifp) if_setflag((ifp), 0, IFF_UP);
bool if_is_link_up(const struct interface *);
bool if_valid_hwaddr(const uint8_t *, size_t); bool if_valid_hwaddr(const uint8_t *, size_t);
struct if_head *if_discover(struct dhcpcd_ctx *, struct ifaddrs **, struct if_head *if_discover(struct dhcpcd_ctx *, struct ifaddrs **,
int, char * const *); int, char * const *);

View File

@ -253,6 +253,17 @@ ps_bpf_dispatch(struct dhcpcd_ctx *ctx,
uint8_t *bpf; uint8_t *bpf;
size_t bpf_len; size_t bpf_len;
switch (psm->ps_cmd) {
#ifdef ARP
case PS_BPF_ARP:
#endif
case PS_BPF_BOOTP:
break;
default:
errno = ENOTSUP;
return -1;
}
ifp = if_findindex(ctx->ifaces, psm->ps_id.psi_ifindex); ifp = if_findindex(ctx->ifaces, psm->ps_id.psi_ifindex);
/* interface may have departed .... */ /* interface may have departed .... */
if (ifp == NULL) if (ifp == NULL)
@ -270,9 +281,6 @@ ps_bpf_dispatch(struct dhcpcd_ctx *ctx,
case PS_BPF_BOOTP: case PS_BPF_BOOTP:
dhcp_packet(ifp, bpf, bpf_len, (unsigned int)psm->ps_flags); dhcp_packet(ifp, bpf, bpf_len, (unsigned int)psm->ps_flags);
break; break;
default:
errno = ENOTSUP;
return -1;
} }
return 1; return 1;

View File

@ -89,6 +89,28 @@ ps_inet_recvdhcp6(void *arg)
} }
#endif #endif
bool
ps_inet_canstart(const struct dhcpcd_ctx *ctx)
{
#ifdef INET
if ((ctx->options & (DHCPCD_IPV4 | DHCPCD_MASTER)) ==
(DHCPCD_IPV4 | DHCPCD_MASTER))
return true;
#endif
#if defined(INET6) && !defined(__sun)
if (ctx->options & DHCPCD_IPV6)
return true;
#endif
#ifdef DHCP6
if ((ctx->options & (DHCPCD_IPV6 | DHCPCD_MASTER)) ==
(DHCPCD_IPV6 | DHCPCD_MASTER))
return true;
#endif
return false;
}
static int static int
ps_inet_startcb(void *arg) ps_inet_startcb(void *arg)
{ {

View File

@ -29,6 +29,7 @@
#ifndef PRIVSEP_INET_H #ifndef PRIVSEP_INET_H
#define PRIVSEP_INET_H #define PRIVSEP_INET_H
bool ps_inet_canstart(const struct dhcpcd_ctx *);
pid_t ps_inet_start(struct dhcpcd_ctx *); pid_t ps_inet_start(struct dhcpcd_ctx *);
int ps_inet_stop(struct dhcpcd_ctx *); int ps_inet_stop(struct dhcpcd_ctx *);
ssize_t ps_inet_cmd(struct dhcpcd_ctx *, struct ps_msghdr *, struct msghdr *); ssize_t ps_inet_cmd(struct dhcpcd_ctx *, struct ps_msghdr *, struct msghdr *);