From: Roy Marples Date: Thu, 18 Apr 2019 17:05:56 +0000 (+0100) Subject: BPF: Set BPF_MCAST flag as on BSD X-Git-Tag: v8.0.0~46^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06f90a0ea67867b14a2c3740c69ad1fa19cd54c3;p=thirdparty%2Fdhcpcd.git BPF: Set BPF_MCAST flag as on BSD --- diff --git a/src/bpf.c b/src/bpf.c index 81d3a1c6..940dfd80 100644 --- a/src/bpf.c +++ b/src/bpf.c @@ -95,7 +95,7 @@ bpf_frame_header_len(const struct interface *ifp) static const uint8_t etherbroadcastaddr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; -static int +int bpf_frame_bcast(const struct interface *ifp, const char *frame) { diff --git a/src/bpf.h b/src/bpf.h index f3ce5434..05c20941 100644 --- a/src/bpf.h +++ b/src/bpf.h @@ -37,6 +37,7 @@ extern const char *bpf_name; size_t bpf_frame_header_len(const struct interface *); +int bpf_frame_bcast(const struct interface *, const char *frame); int bpf_open(struct interface *, int (*)(struct interface *, int)); int bpf_close(struct interface *, int); int bpf_attach(int, void *, unsigned int); diff --git a/src/if-linux.c b/src/if-linux.c index dd0fb58f..22913d54 100644 --- a/src/if-linux.c +++ b/src/if-linux.c @@ -1412,6 +1412,10 @@ bpf_read(struct interface *ifp, int s, void *data, size_t len, if (bytes) { ssize_t fl = (ssize_t)bpf_frame_header_len(ifp); + if (bpf_frame_bcast(ifp, state->buffer) == 0) + *flags |= BPF_BCAST; + else + *flags &= ~BPF_BCAST; bytes -= fl; if ((size_t)bytes > len) bytes = (ssize_t)len;