On Sat, Nov 10, 2018 at 10:05:18AM +0100, Denis Fondras wrote:
> 'tcpdump vlan $vlan_number' will not return anything if priority is not 0.
>
> Fix that by not comparing vlan number against priority.
> Also deny usage of vlan number greater than 4095 while at it.
4095 is reserved, 4094 is the maximum.
OK kn with using defines, see inline with one other irrelevant nit.
> @@ -3364,6 +3364,11 @@ gen_vlan(vlan_num)
> /*NOTREACHED*/
> }
>
> + if (vlan_num > 4095) {
/usr/include/netinet/if_ether.h
99:#define EVL_VLID_MAX 0xFFE
> + bpf_error("invalid VLAN number : %d", vlan_num);
> + /*NOTREACHED*/
Adding more of these obsolete hints seems off. I see how it keeps
consistency, but it's not a big deal and we might even just sweep the
existing ones.
> + }
> +
> /*
> * Change the offsets to point to the type and data fields within
> * the VLAN packet. This is somewhat of a kludge.
> @@ -3395,7 +3400,7 @@ gen_vlan(vlan_num)
> if (vlan_num >= 0) {
> struct block *b1;
>
> - b1 = gen_cmp(orig_nl, BPF_H, (bpf_int32)vlan_num);
> + b1 = gen_mcmp(orig_nl, BPF_H, (bpf_int32)vlan_num, 0x0FFF);
95:#define EVL_VLID_MASK 0xFFF