summaryrefslogtreecommitdiffstats
path: root/src/if.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-05-13 20:52:24 +0100
committerRoy Marples <roy@marples.name>2020-05-13 20:52:24 +0100
commita34dc1d4f46ce76020654eef5e3ff33542425149 (patch)
tree1629564b6e151f42ae2ccd735963365363247c6f /src/if.c
parentd65f4be81281ad3a69ffa65cf6fba3e4b9498df3 (diff)
downloaddhcpcd-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.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/if.c b/src/if.c
index e479dc35..f703d7c2 100644
--- a/src/if.c
+++ b/src/if.c
@@ -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);