uapi/bpf: update kernel header from 4.17-rc1

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Stephen Hemminger 2018-04-10 10:48:56 -07:00
parent ef36717816
commit dcf7997bcd
1 changed files with 61 additions and 1 deletions

View File

@ -94,6 +94,7 @@ enum bpf_cmd {
BPF_MAP_GET_FD_BY_ID, BPF_MAP_GET_FD_BY_ID,
BPF_OBJ_GET_INFO_BY_FD, BPF_OBJ_GET_INFO_BY_FD,
BPF_PROG_QUERY, BPF_PROG_QUERY,
BPF_RAW_TRACEPOINT_OPEN,
}; };
enum bpf_map_type { enum bpf_map_type {
@ -134,6 +135,8 @@ enum bpf_prog_type {
BPF_PROG_TYPE_SK_SKB, BPF_PROG_TYPE_SK_SKB,
BPF_PROG_TYPE_CGROUP_DEVICE, BPF_PROG_TYPE_CGROUP_DEVICE,
BPF_PROG_TYPE_SK_MSG, BPF_PROG_TYPE_SK_MSG,
BPF_PROG_TYPE_RAW_TRACEPOINT,
BPF_PROG_TYPE_CGROUP_SOCK_ADDR,
}; };
enum bpf_attach_type { enum bpf_attach_type {
@ -145,6 +148,12 @@ enum bpf_attach_type {
BPF_SK_SKB_STREAM_VERDICT, BPF_SK_SKB_STREAM_VERDICT,
BPF_CGROUP_DEVICE, BPF_CGROUP_DEVICE,
BPF_SK_MSG_VERDICT, BPF_SK_MSG_VERDICT,
BPF_CGROUP_INET4_BIND,
BPF_CGROUP_INET6_BIND,
BPF_CGROUP_INET4_CONNECT,
BPF_CGROUP_INET6_CONNECT,
BPF_CGROUP_INET4_POST_BIND,
BPF_CGROUP_INET6_POST_BIND,
__MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE
}; };
@ -294,6 +303,11 @@ union bpf_attr {
__u32 prog_flags; __u32 prog_flags;
char prog_name[BPF_OBJ_NAME_LEN]; char prog_name[BPF_OBJ_NAME_LEN];
__u32 prog_ifindex; /* ifindex of netdev to prep for */ __u32 prog_ifindex; /* ifindex of netdev to prep for */
/* For some prog types expected attach type must be known at
* load time to verify attach type specific parts of prog
* (context accesses, allowed helpers, etc).
*/
__u32 expected_attach_type;
}; };
struct { /* anonymous struct used by BPF_OBJ_* commands */ struct { /* anonymous struct used by BPF_OBJ_* commands */
@ -344,6 +358,11 @@ union bpf_attr {
__aligned_u64 prog_ids; __aligned_u64 prog_ids;
__u32 prog_cnt; __u32 prog_cnt;
} query; } query;
struct {
__u64 name;
__u32 prog_fd;
} raw_tracepoint;
} __attribute__((aligned(8))); } __attribute__((aligned(8)));
/* BPF helper function descriptions: /* BPF helper function descriptions:
@ -729,6 +748,13 @@ union bpf_attr {
* @flags: reserved for future use * @flags: reserved for future use
* Return: SK_PASS * Return: SK_PASS
* *
* int bpf_bind(ctx, addr, addr_len)
* Bind socket to address. Only binding to IP is supported, no port can be
* set in addr.
* @ctx: pointer to context of type bpf_sock_addr
* @addr: pointer to struct sockaddr to bind socket to
* @addr_len: length of sockaddr structure
* Return: 0 on success or negative error code
*/ */
#define __BPF_FUNC_MAPPER(FN) \ #define __BPF_FUNC_MAPPER(FN) \
FN(unspec), \ FN(unspec), \
@ -794,7 +820,8 @@ union bpf_attr {
FN(msg_redirect_map), \ FN(msg_redirect_map), \
FN(msg_apply_bytes), \ FN(msg_apply_bytes), \
FN(msg_cork_bytes), \ FN(msg_cork_bytes), \
FN(msg_pull_data), FN(msg_pull_data), \
FN(bind),
/* integer value in 'imm' field of BPF_CALL instruction selects which helper /* integer value in 'imm' field of BPF_CALL instruction selects which helper
* function eBPF program intends to call * function eBPF program intends to call
@ -923,6 +950,15 @@ struct bpf_sock {
__u32 protocol; __u32 protocol;
__u32 mark; __u32 mark;
__u32 priority; __u32 priority;
__u32 src_ip4; /* Allows 1,2,4-byte read.
* Stored in network byte order.
*/
__u32 src_ip6[4]; /* Allows 1,2,4-byte read.
* Stored in network byte order.
*/
__u32 src_port; /* Allows 4-byte read.
* Stored in host byte order
*/
}; };
#define XDP_PACKET_HEADROOM 256 #define XDP_PACKET_HEADROOM 256
@ -998,6 +1034,26 @@ struct bpf_map_info {
__u64 netns_ino; __u64 netns_ino;
} __attribute__((aligned(8))); } __attribute__((aligned(8)));
/* User bpf_sock_addr struct to access socket fields and sockaddr struct passed
* by user and intended to be used by socket (e.g. to bind to, depends on
* attach attach type).
*/
struct bpf_sock_addr {
__u32 user_family; /* Allows 4-byte read, but no write. */
__u32 user_ip4; /* Allows 1,2,4-byte read and 4-byte write.
* Stored in network byte order.
*/
__u32 user_ip6[4]; /* Allows 1,2,4-byte read an 4-byte write.
* Stored in network byte order.
*/
__u32 user_port; /* Allows 4-byte read and write.
* Stored in network byte order
*/
__u32 family; /* Allows 4-byte read, but no write */
__u32 type; /* Allows 4-byte read, but no write */
__u32 protocol; /* Allows 4-byte read, but no write */
};
/* User bpf_sock_ops struct to access socket values and specify request ops /* User bpf_sock_ops struct to access socket values and specify request ops
* and their replies. * and their replies.
* Some of this fields are in network (bigendian) byte order and may need * Some of this fields are in network (bigendian) byte order and may need
@ -1152,4 +1208,8 @@ struct bpf_cgroup_dev_ctx {
__u32 minor; __u32 minor;
}; };
struct bpf_raw_tracepoint_args {
__u64 args[0];
};
#endif /* __LINUX_BPF_H__ */ #endif /* __LINUX_BPF_H__ */