History

bpf: allow sk_msg programs to read sock fields

Currently sk_msg programs only have access to the raw data. However, it is often useful when building policies to have the policies specific to the socket endpoint. This allows using the socket tuple as input into filters, etc. This patch adds ctx access to the sock fields.

John Fastabend committed 8 years ago

Commit 303def31 parent 1cb61384 files · +121 −3Browse files

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

Unified · Split

include/uapi/linux/bpf.h+8−0
@@ -2176,6 +2176,14 @@ enum sk_action { · 2175 unmodified lines
2176struct sk_msg_md {2176struct sk_msg_md {
2177 void *data;2177 void *data;
2178 void *data_end;2178 void *data_end;
2179
2180 __u32 family;
2181 __u32 remote_ip4; /* Stored in network byte order */
2182 __u32 local_ip4; /* Stored in network byte order */
2183 __u32 remote_ip6[4]; /* Stored in network byte order */
2184 __u32 local_ip6[4]; /* Stored in network byte order */
2185 __u32 remote_port; /* Stored in network byte order */
2186 __u32 local_port; /* stored in host byte order */
2179};2187};
2180 2188
2181#define BPF_TAG_SIZE 82189#define BPF_TAG_SIZE 8