diff options
| author | Roy Marples <roy@marples.name> | 2020-05-13 20:52:24 +0100 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2020-05-13 20:52:24 +0100 |
| commit | a34dc1d4f46ce76020654eef5e3ff33542425149 (patch) | |
| tree | 1629564b6e151f42ae2ccd735963365363247c6f /src/if.c | |
| parent | d65f4be81281ad3a69ffa65cf6fba3e4b9498df3 (diff) | |
| download | dhcpcd-a34dc1d4f46ce76020654eef5e3ff33542425149.tar.xz | |
privsep: Add a generic wrapper for getifaddrs(3)
Although this is only for Capsicum, the getifaddrs interface is
quite portable although not POSIX.
With this final change, the Master process can now enter Capsicum
Capabilites Mode and this completes the Capsicum integration.
Diffstat (limited to 'src/if.c')
| -rw-r--r-- | src/if.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -392,12 +392,22 @@ if_discover(struct dhcpcd_ctx *ctx, struct ifaddrs **ifaddrs, logerr(__func__); return NULL; } + TAILQ_INIT(ifs); + +#ifdef HAVE_CAPSICUM + if (ctx->options & DHCPCD_PRIVSEP) { + if (ps_root_getifaddrs(ctx, ifaddrs) == -1) { + logerr("ps_root_getifaddrs"); + free(ifs); + return NULL; + } + } else +#endif if (getifaddrs(ifaddrs) == -1) { logerr("getifaddrs"); free(ifs); return NULL; } - TAILQ_INIT(ifs); #ifdef IFLR_ACTIVE link_fd = xsocket(PF_LINK, SOCK_DGRAM | SOCK_CLOEXEC, 0); |
