If so, the value of arithmetic instructions’ code should be 4 bit, rather than
BPF_ADD: 0x00, BPF_SUB: 0x10, BPF_MUL: 0x20. Otherwise the convention of
arithmetic instruction is not consistent with the convention of jump
instructions.
As Aoyang Fang points out, Section 3.1 (Arithmetic instructions) and 3.3 (Jump instructions)
are not consistent with each other. 'code' is defined in section 3 as a 4-bit field.
Section 3.1 defines 8-bit values of the code field (BPF_SUB: 0x10, BPF_MUL: 0x20, etc.)
whereas section 3.3 defines 4-bit values of the code field (BPF_JEQ: 0x1, BPF_JGT: 0x2, etc.).
It would be more consistent to change section 3.1 rather than defining 8-bit values for a 4-bit field.
Aoyang Fang (SSE, 222010547) [aoyangfang@link.cuhk.edu.cn](mailto:aoyangfang@link.cuhk.edu.cn) wrote:
As Aoyang Fang points out, Section 3.1 (Arithmetic instructions) and 3.3 (Jump instructions) are not consistent with each other. 'code' is defined in section 3 as a 4-bit field. Section 3.1 defines 8-bit values of the code field (BPF_SUB: 0x10, BPF_MUL: 0x20, etc.) whereas section 3.3 defines 4-bit values of the code field (BPF_JEQ: 0x1, BPF_JGT: 0x2, etc.).
It would be more consistent to change section 3.1 rather than defining 8-bit values for a 4-bit field.