From: Roy Marples Date: Fri, 9 Oct 2020 13:45:57 +0000 (+0100) Subject: privsep: Ensure command is for BPF first and interface valid second X-Git-Tag: v9.3.1~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf81b6b9428f1cce9d685f47ac3c2f411416f237;p=thirdparty%2Fdhcpcd.git privsep: Ensure command is for BPF first and interface valid second Otherwise we won't call inet_dispatch on a message meant for it. --- diff --git a/src/privsep-bpf.c b/src/privsep-bpf.c index 465bb57e..ddd3cd82 100644 --- a/src/privsep-bpf.c +++ b/src/privsep-bpf.c @@ -253,6 +253,17 @@ ps_bpf_dispatch(struct dhcpcd_ctx *ctx, uint8_t *bpf; size_t bpf_len; + switch (psm->ps_cmd) { +#ifdef ARP + case PS_BPF_ARP: +#endif + case PS_BPF_BOOTP: + break; + default: + errno = ENOTSUP; + return -1; + } + ifp = if_findindex(ctx->ifaces, psm->ps_id.psi_ifindex); /* interface may have departed .... */ if (ifp == NULL) @@ -270,9 +281,6 @@ ps_bpf_dispatch(struct dhcpcd_ctx *ctx, case PS_BPF_BOOTP: dhcp_packet(ifp, bpf, bpf_len, (unsigned int)psm->ps_flags); break; - default: - errno = ENOTSUP; - return -1; } return 1;