diff options
author | 2021-01-18 09:26:35 +0000 | |
---|---|---|
committer | 2021-01-18 09:26:35 +0000 | |
commit | ff78d6edd4ee27e44eebf250095a6ef702022eff (patch) | |
tree | b601ee7ff62ad68096cc194a15837c13e5e61278 /lib/libpcap/gencode.c | |
parent | crank limits to satisfy piggy piggy clang (diff) | |
download | wireguard-openbsd-ff78d6edd4ee27e44eebf250095a6ef702022eff.tar.xz wireguard-openbsd-ff78d6edd4ee27e44eebf250095a6ef702022eff.zip |
support PCAP_NETMASK_UNKNOWN, adapted from an old commit in upstream
libpcap, ok dlg@
https://github.com/the-tcpdump-group/libpcap/commit/74b2de364f3443fc2414d0160b0b942f347c6fd4
https://github.com/the-tcpdump-group/libpcap/commit/117cb5eb2eb4fe212d3851f1205bb0b8f57873c6
Diffstat (limited to 'lib/libpcap/gencode.c')
-rw-r--r-- | lib/libpcap/gencode.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libpcap/gencode.c b/lib/libpcap/gencode.c index a9fb14be943..5018b52266c 100644 --- a/lib/libpcap/gencode.c +++ b/lib/libpcap/gencode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gencode.c,v 1.56 2020/09/12 09:27:22 kn Exp $ */ +/* $OpenBSD: gencode.c,v 1.57 2021/01/18 09:26:35 sthen Exp $ */ /* * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998 @@ -3103,6 +3103,13 @@ gen_broadcast(proto) break; case Q_IP: + /* + * We treat a netmask of PCAP_NETMASK_UNKNOWN (0xffffffff) + * as an indication that we don't know the netmask, and fail + * in that case. + */ + if (netmask == PCAP_NETMASK_UNKNOWN) + bpf_error("netmask not known, so 'ip broadcast' not supported"); b0 = gen_linktype(ETHERTYPE_IP); hostmask = ~netmask; b1 = gen_mcmp_nl(16, BPF_W, (bpf_int32)0, hostmask); |