Mercurial > hg > dhcpcd
changeset 5238:73659576d485 draft
OpenBSD: Fix non privsep builds.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Wed, 20 May 2020 12:23:25 +0100 |
| parents | 65cef5f96919 |
| children | 4507bcbe200d |
| files | src/if-bsd.c src/ipv6.c |
| diffstat | 2 files changed, 11 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/if-bsd.c Wed May 20 12:17:00 2020 +0100 +++ b/src/if-bsd.c Wed May 20 12:23:25 2020 +0100 @@ -364,17 +364,18 @@ static int if_indirect_ioctl(struct dhcpcd_ctx *ctx, const char *ifname, unsigned long cmd, void *data, size_t len) { + struct ifreq ifr = { .ifr_flags = 0 }; -#ifdef HAVE_PLEDGE - return (int)ps_root_indirectioctl(ctx, cmd, ifname, data, len); +#if defined(PRIVSEP) && defined(HAVE_PLEDGE) + if (IN_PRIVSEP(ctx)) + return (int)ps_root_indirectioctl(ctx, cmd, ifname, data, len); #else - struct ifreq ifr = { .ifr_flags = 0 }; + UNUSED(len); +#endif strlcpy(ifr.ifr_name, ifname, IFNAMSIZ); ifr.ifr_data = data; - UNUSED(len); return ioctl(ctx->pf_inet_fd, cmd, &ifr); -#endif } #endif
--- a/src/ipv6.c Wed May 20 12:17:00 2020 +0100 +++ b/src/ipv6.c Wed May 20 12:23:25 2020 +0100 @@ -1091,10 +1091,12 @@ #ifdef BSD bool forwarding; -#ifdef HAVE_PLEDGE - forwarding = ps_root_ip6forwarding(sifp->ctx) == 1; +#if defined(PRIVSEP) && defined(HAVE_PLEDGE) + if (IN_PRIVSEP(sifp->ctx)) + forwarding = ps_root_ip6forwarding(sifp->ctx) == 1; + else #else - forwarding = ip6_forwarding(NULL) == 1; + forwarding = ip6_forwarding(NULL) == 1; #endif #endif
