Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf
Alexei Starovoitov says: ==================== pull-request: bpf 2018-12-05 The following pull-request contains BPF updates for your *net* tree. The main changes are: 1) fix bpf uapi pointers for 32-bit architectures, from Daniel. 2) improve verifer ability to handle progs with a lot of branches, from Alexei. 3) strict btf checks, from Yonghong. 4) bpf_sk_lookup api cleanup, from Joe. 5) other misc fixes ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -2170,7 +2170,7 @@ union bpf_attr {
|
||||
* Return
|
||||
* 0 on success, or a negative error in case of failure.
|
||||
*
|
||||
* struct bpf_sock *bpf_sk_lookup_tcp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u32 netns, u64 flags)
|
||||
* struct bpf_sock *bpf_sk_lookup_tcp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)
|
||||
* Description
|
||||
* Look for TCP socket matching *tuple*, optionally in a child
|
||||
* network namespace *netns*. The return value must be checked,
|
||||
@@ -2187,12 +2187,14 @@ union bpf_attr {
|
||||
* **sizeof**\ (*tuple*\ **->ipv6**)
|
||||
* Look for an IPv6 socket.
|
||||
*
|
||||
* If the *netns* is zero, then the socket lookup table in the
|
||||
* netns associated with the *ctx* will be used. For the TC hooks,
|
||||
* this in the netns of the device in the skb. For socket hooks,
|
||||
* this in the netns of the socket. If *netns* is non-zero, then
|
||||
* it specifies the ID of the netns relative to the netns
|
||||
* associated with the *ctx*.
|
||||
* If the *netns* is a negative signed 32-bit integer, then the
|
||||
* socket lookup table in the netns associated with the *ctx* will
|
||||
* will be used. For the TC hooks, this is the netns of the device
|
||||
* in the skb. For socket hooks, this is the netns of the socket.
|
||||
* If *netns* is any other signed 32-bit value greater than or
|
||||
* equal to zero then it specifies the ID of the netns relative to
|
||||
* the netns associated with the *ctx*. *netns* values beyond the
|
||||
* range of 32-bit integers are reserved for future use.
|
||||
*
|
||||
* All values for *flags* are reserved for future usage, and must
|
||||
* be left at zero.
|
||||
@@ -2201,8 +2203,10 @@ union bpf_attr {
|
||||
* **CONFIG_NET** configuration option.
|
||||
* Return
|
||||
* Pointer to *struct bpf_sock*, or NULL in case of failure.
|
||||
* For sockets with reuseport option, the *struct bpf_sock*
|
||||
* result is from reuse->socks[] using the hash of the tuple.
|
||||
*
|
||||
* struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u32 netns, u64 flags)
|
||||
* struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)
|
||||
* Description
|
||||
* Look for UDP socket matching *tuple*, optionally in a child
|
||||
* network namespace *netns*. The return value must be checked,
|
||||
@@ -2219,12 +2223,14 @@ union bpf_attr {
|
||||
* **sizeof**\ (*tuple*\ **->ipv6**)
|
||||
* Look for an IPv6 socket.
|
||||
*
|
||||
* If the *netns* is zero, then the socket lookup table in the
|
||||
* netns associated with the *ctx* will be used. For the TC hooks,
|
||||
* this in the netns of the device in the skb. For socket hooks,
|
||||
* this in the netns of the socket. If *netns* is non-zero, then
|
||||
* it specifies the ID of the netns relative to the netns
|
||||
* associated with the *ctx*.
|
||||
* If the *netns* is a negative signed 32-bit integer, then the
|
||||
* socket lookup table in the netns associated with the *ctx* will
|
||||
* will be used. For the TC hooks, this is the netns of the device
|
||||
* in the skb. For socket hooks, this is the netns of the socket.
|
||||
* If *netns* is any other signed 32-bit value greater than or
|
||||
* equal to zero then it specifies the ID of the netns relative to
|
||||
* the netns associated with the *ctx*. *netns* values beyond the
|
||||
* range of 32-bit integers are reserved for future use.
|
||||
*
|
||||
* All values for *flags* are reserved for future usage, and must
|
||||
* be left at zero.
|
||||
@@ -2233,6 +2239,8 @@ union bpf_attr {
|
||||
* **CONFIG_NET** configuration option.
|
||||
* Return
|
||||
* Pointer to *struct bpf_sock*, or NULL in case of failure.
|
||||
* For sockets with reuseport option, the *struct bpf_sock*
|
||||
* result is from reuse->socks[] using the hash of the tuple.
|
||||
*
|
||||
* int bpf_sk_release(struct bpf_sock *sk)
|
||||
* Description
|
||||
@@ -2405,6 +2413,9 @@ enum bpf_func_id {
|
||||
/* BPF_FUNC_perf_event_output for sk_buff input context. */
|
||||
#define BPF_F_CTXLEN_MASK (0xfffffULL << 32)
|
||||
|
||||
/* Current network namespace */
|
||||
#define BPF_F_CURRENT_NETNS (-1L)
|
||||
|
||||
/* Mode for BPF_FUNC_skb_adjust_room helper. */
|
||||
enum bpf_adj_room_mode {
|
||||
BPF_ADJ_ROOM_NET,
|
||||
@@ -2422,6 +2433,12 @@ enum bpf_lwt_encap_mode {
|
||||
BPF_LWT_ENCAP_SEG6_INLINE
|
||||
};
|
||||
|
||||
#define __bpf_md_ptr(type, name) \
|
||||
union { \
|
||||
type name; \
|
||||
__u64 :64; \
|
||||
} __attribute__((aligned(8)))
|
||||
|
||||
/* user accessible mirror of in-kernel sk_buff.
|
||||
* new fields can only be added to the end of this structure
|
||||
*/
|
||||
@@ -2456,7 +2473,7 @@ struct __sk_buff {
|
||||
/* ... here. */
|
||||
|
||||
__u32 data_meta;
|
||||
struct bpf_flow_keys *flow_keys;
|
||||
__bpf_md_ptr(struct bpf_flow_keys *, flow_keys);
|
||||
};
|
||||
|
||||
struct bpf_tunnel_key {
|
||||
@@ -2572,8 +2589,8 @@ enum sk_action {
|
||||
* be added to the end of this structure
|
||||
*/
|
||||
struct sk_msg_md {
|
||||
void *data;
|
||||
void *data_end;
|
||||
__bpf_md_ptr(void *, data);
|
||||
__bpf_md_ptr(void *, data_end);
|
||||
|
||||
__u32 family;
|
||||
__u32 remote_ip4; /* Stored in network byte order */
|
||||
@@ -2589,8 +2606,9 @@ struct sk_reuseport_md {
|
||||
* Start of directly accessible data. It begins from
|
||||
* the tcp/udp header.
|
||||
*/
|
||||
void *data;
|
||||
void *data_end; /* End of directly accessible data */
|
||||
__bpf_md_ptr(void *, data);
|
||||
/* End of directly accessible data */
|
||||
__bpf_md_ptr(void *, data_end);
|
||||
/*
|
||||
* Total length of packet (starting from the tcp/udp header).
|
||||
* Note that the directly accessible bytes (data_end - data)
|
||||
|
Reference in New Issue
Block a user