History

filter: added BPF random opcode

Added a new ancillary load (bpf call in eBPF parlance) that produces a 32-bit random number. We are implementing it as an ancillary load (instead of an ISA opcode) because (a) it is simpler, (b) allows easy JITing, and (c) seems more in line with generic ISAs that do not have "get a random number" as a instruction, but as an OS call. The main use for this ancillary load is to perform random packet sampling.

Chema Gonzalez committed 12 years ago

Commit 4cd36751 parent 5a4ae5f6 files · +39 −2Browse files

Showing the changes to include/uapi/linux (1 of 6 files). Show all

Unified · Split

include/uapi/linux/filter.h+2−1
@@ -130,7 +130,8 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */ · 129 unmodified lines
130130 #define SKF_AD_VLAN_TAG 44
131131 #define SKF_AD_VLAN_TAG_PRESENT 48
132132 #define SKF_AD_PAY_OFFSET 52
133−#define SKF_AD_MAX 56
133+#define SKF_AD_RANDOM 56
134+#define SKF_AD_MAX 60
134135 #define SKF_NET_OFF (-0x100000)
135136 #define SKF_LL_OFF (-0x200000)
136137