]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
OpenBSD: disable setting resource limits as we have pledge.
authorRoy Marples <roy@marples.name>
Fri, 5 Jun 2020 12:02:32 +0000 (13:02 +0100)
committerRoy Marples <roy@marples.name>
Fri, 5 Jun 2020 12:02:32 +0000 (13:02 +0100)
src/if.c
src/privsep.c

index d0012771de126c3ce2fc481ae5af1cf4449385fb..69a5003c07ccf8350787f5787bf99ba67faee511 100644 (file)
--- a/src/if.c
+++ b/src/if.c
@@ -107,7 +107,7 @@ if_opensockets(struct dhcpcd_ctx *ctx)
        if (if_opensockets_os(ctx) == -1)
                return -1;
 
-#ifdef PF_LINK
+#ifdef IFLR_ACTIVE
        ctx->pf_link_fd = xsocket(PF_LINK, SOCK_DGRAM | SOCK_CLOEXEC, 0);
        if (ctx->pf_link_fd == -1)
                return -1;
index ed01d2a8600ac5f571287a2c0e2c6c6111b37cc4..749f00c6ea7b5dcbf85780b853e911498e65679f 100644 (file)
@@ -113,7 +113,9 @@ int
 ps_dropprivs(struct dhcpcd_ctx *ctx)
 {
        struct passwd *pw = ctx->ps_user;
+#ifndef HAVE_PLEDGE
        struct rlimit rzero = { .rlim_cur = 0, .rlim_max = 0 };
+#endif
 
        if (!(ctx->options & DHCPCD_FORKED))
                logdebugx("chrooting to `%s' as %s", pw->pw_dir, pw->pw_name);
@@ -130,6 +132,7 @@ ps_dropprivs(struct dhcpcd_ctx *ctx)
                return -1;
        }
 
+#ifndef HAVE_PLEDGE
        /* Prohibit new files, sockets, etc */
        if (setrlimit(RLIMIT_NOFILE, &rzero) == -1) {
                logerr("setrlimit RLIMIT_NOFILE");
@@ -148,6 +151,7 @@ ps_dropprivs(struct dhcpcd_ctx *ctx)
                logerr("setrlimit RLIMIT_NPROC");
                return -1;
        }
+#endif
 #endif
 
        return 0;