From 7f6825d3db103bb44cca71aa926c5f5fd9f544d2 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Wed, 17 Mar 2021 15:12:22 +0000 Subject: [PATCH] privsep: Fix Linux support for prior --- src/if-linux.c | 8 ++++---- src/privsep-linux.c | 2 +- src/privsep-root.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/if-linux.c b/src/if-linux.c index fdda052b..b642ab30 100644 --- a/src/if-linux.c +++ b/src/if-linux.c @@ -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; diff --git a/src/privsep-linux.c b/src/privsep-linux.c index 7dc92083..f272b4bd 100644 --- a/src/privsep-linux.c +++ b/src/privsep-linux.c @@ -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); diff --git a/src/privsep-root.c b/src/privsep-root.c index b7c737e3..4c404aeb 100644 --- a/src/privsep-root.c +++ b/src/privsep-root.c @@ -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; -- 2.47.3