]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
privsep: Fix Linux support for prior
authorRoy Marples <roy@marples.name>
Wed, 17 Mar 2021 15:12:22 +0000 (15:12 +0000)
committerRoy Marples <roy@marples.name>
Wed, 17 Mar 2021 15:12:22 +0000 (15:12 +0000)
src/if-linux.c
src/privsep-linux.c
src/privsep-root.c

index fdda052bdde3b5c99762559432ce2a3b61bf841f..b642ab30617b8eb62e8a9ec81a0168c8b940fc06 100644 (file)
@@ -745,8 +745,8 @@ link_route(struct dhcpcd_ctx *ctx, __unused struct interface *ifp,
 
        /* Ignore messages we sent. */
 #ifdef PRIVSEP
-       if (ctx->ps_root_pid != 0 &&
-           nlm->nlmsg_pid == (uint32_t)ctx->ps_root_pid)
+       if (ctx->ps_root != NULL &&
+           nlm->nlmsg_pid == (uint32_t)ctx->ps_root->psp_pid)
                return 0;
 #endif
        priv = (struct priv *)ctx->priv;
@@ -788,8 +788,8 @@ link_addr(struct dhcpcd_ctx *ctx, struct interface *ifp, struct nlmsghdr *nlm)
         * We need to process address flag changes though. */
        if (nlm->nlmsg_type == RTM_DELADDR) {
 #ifdef PRIVSEP
-               if (ctx->ps_root_pid != 0 &&
-                   nlm->nlmsg_pid == (uint32_t)ctx->ps_root_pid)
+               if (ctx->ps_root != NULL &&
+                   nlm->nlmsg_pid == (uint32_t)ctx->ps_root->psp_pid)
                        return 0;
 #endif
                priv = (struct priv*)ctx->priv;
index 7dc9208353869a699e8d550e81c53541a87bda6d..f272b4bdadedb637b0b47403dc326a0573236937 100644 (file)
@@ -103,7 +103,7 @@ ssize_t
 ps_root_sendnetlink(struct dhcpcd_ctx *ctx, int protocol, struct msghdr *msg)
 {
 
-       if (ps_sendmsg(ctx, ctx->ps_root_fd, PS_ROUTE,
+       if (ps_sendmsg(ctx, ctx->ps_root->psp_fd, PS_ROUTE,
            (unsigned long)protocol, msg) == -1)
                return -1;
        return ps_root_readerror(ctx, NULL, 0);
index b7c737e3b6f2d460236881519108c656b0245434..4c404aeb85996cac46071362337cc8bdeb088ad7 100644 (file)
@@ -181,7 +181,7 @@ ps_root_mreaderror(struct dhcpcd_ctx *ctx, void **data, size_t *len)
            .psr_ctx = ctx,
        };
 
-       if (eloop_event_add(ctx->ps_eloop, ctx->ps_root_fd, ELE_READ,
+       if (eloop_event_add(ctx->ps_eloop, ctx->ps_root->psp_fd, ELE_READ,
            ps_root_mreaderrorcb, &psr_ctx) == -1)
                return -1;