Skip to content

Commit 19ee58a

Browse files
devnexentgross35
authored andcommitted
adding further BPF program flags for Linux.
[ref](https://sites.uclouvain.be/SystInfo/usr/include/linux/filter.h.html) (backport <#4356>) (cherry picked from commit 9b8242d)
1 parent 2a9260f commit 19ee58a

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed

libc-test/semver/linux-aarch64.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ B2500000
22
B3000000
33
B3500000
44
B4000000
5+
BPF_A
56
BPF_ABS
67
BPF_ADD
78
BPF_ALU
89
BPF_B
10+
BPF_CLASS
911
BPF_DIV
1012
BPF_H
1113
BPF_IMM
@@ -25,15 +27,21 @@ BPF_MEM
2527
BPF_MISC
2628
BPF_MISCOP
2729
BPF_MOD
30+
BPF_MODE
2831
BPF_MSH
2932
BPF_NEG
3033
BPF_NET_OFF
34+
BPF_OP
3135
BPF_RET
3236
BPF_RVAL
37+
BPF_SIZE
38+
BPF_SRC
3339
BPF_ST
3440
BPF_STMT
3541
BPF_STX
3642
BPF_SUB
43+
BPF_TAX
44+
BPF_TXA
3745
BPF_W
3846
BPF_X
3947
BPF_XOR

libc-test/semver/linux-loongarch64.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ B2500000
22
B3000000
33
B3500000
44
B4000000
5+
BPF_A
56
BPF_ABS
67
BPF_ADD
78
BPF_ALU
89
BPF_B
10+
BPF_CLASS
911
BPF_DIV
1012
BPF_H
1113
BPF_IMM
@@ -25,15 +27,21 @@ BPF_MEM
2527
BPF_MISC
2628
BPF_MISCOP
2729
BPF_MOD
30+
BPF_MODE
2831
BPF_MSH
2932
BPF_NEG
3033
BPF_NET_OFF
34+
BPF_OP
3135
BPF_RET
3236
BPF_RVAL
37+
BPF_SIZE
38+
BPF_SRC
3339
BPF_ST
3440
BPF_STMT
3541
BPF_STX
3642
BPF_SUB
43+
BPF_TAX
44+
BPF_TXA
3745
BPF_W
3846
BPF_X
3947
BPF_XOR

libc-test/semver/linux-x86_64.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ B2500000
22
B3000000
33
B3500000
44
B4000000
5+
BPF_A
56
BPF_ABS
67
BPF_ADD
78
BPF_ALU
89
BPF_B
10+
BPF_CLASS
911
BPF_DIV
1012
BPF_H
1113
BPF_IMM
@@ -25,15 +27,21 @@ BPF_MEM
2527
BPF_MISC
2628
BPF_MISCOP
2729
BPF_MOD
30+
BPF_MODE
2831
BPF_MSH
2932
BPF_NEG
3033
BPF_NET_OFF
34+
BPF_OP
3135
BPF_RET
3236
BPF_RVAL
37+
BPF_SIZE
38+
BPF_SRC
3339
BPF_ST
3440
BPF_STMT
3541
BPF_STX
3642
BPF_SUB
43+
BPF_TAX
44+
BPF_TXA
3745
BPF_W
3846
BPF_X
3947
BPF_XOR

src/unix/linux_like/linux/mod.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3492,6 +3492,12 @@ pub const BPF_JSET: __u32 = 0x40;
34923492
pub const BPF_K: __u32 = 0x00;
34933493
pub const BPF_X: __u32 = 0x08;
34943494

3495+
// linux/filter.h
3496+
3497+
pub const BPF_A: __u32 = 0x10;
3498+
pub const BPF_TAX: __u32 = 0x00;
3499+
pub const BPF_TXA: __u32 = 0x80;
3500+
34953501
// linux/openat2.h
34963502
pub const RESOLVE_NO_XDEV: crate::__u64 = 0x01;
34973503
pub const RESOLVE_NO_MAGICLINKS: crate::__u64 = 0x02;
@@ -6169,6 +6175,26 @@ f! {
61696175
(x + TPACKET_ALIGNMENT - 1) & !(TPACKET_ALIGNMENT - 1)
61706176
}
61716177

6178+
pub fn BPF_CLASS(code: __u32) -> __u32 {
6179+
code & 0x07
6180+
}
6181+
6182+
pub fn BPF_SIZE(code: __u32) -> __u32 {
6183+
code & 0x18
6184+
}
6185+
6186+
pub fn BPF_MODE(code: __u32) -> __u32 {
6187+
code & 0xe0
6188+
}
6189+
6190+
pub fn BPF_OP(code: __u32) -> __u32 {
6191+
code & 0xf0
6192+
}
6193+
6194+
pub fn BPF_SRC(code: __u32) -> __u32 {
6195+
code & 0x08
6196+
}
6197+
61726198
pub fn BPF_RVAL(code: __u32) -> __u32 {
61736199
code & 0x18
61746200
}

0 commit comments

Comments
 (0)