diff options
| author | Roy Marples <roy@marples.name> | 2020-10-09 14:45:57 +0100 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2020-10-09 14:45:57 +0100 |
| commit | cf81b6b9428f1cce9d685f47ac3c2f411416f237 (patch) | |
| tree | 9f2b5302021fb0f62d7e95cbc6f478ee31836cc5 | |
| parent | 6a5456df2211fcb1969044e6c678a5c8aa7f07d2 (diff) | |
| download | dhcpcd-cf81b6b9428f1cce9d685f47ac3c2f411416f237.tar.xz | |
privsep: Ensure command is for BPF first and interface valid second
Otherwise we won't call inet_dispatch on a message meant for it.
| -rw-r--r-- | src/privsep-bpf.c | 14 |
1 files changed, 11 insertions, 3 deletions
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; |
