Skip to content

Commit e856795

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
Daniel Borkmann says: ==================== pull-request: bpf-next 2018-10-16 The following pull-request contains BPF updates for your *net-next* tree. The main changes are: 1) Convert BPF sockmap and kTLS to both use a new sk_msg API and enable sk_msg BPF integration for the latter, from Daniel and John. 2) Enable BPF syscall side to indicate for maps that they do not support a map lookup operation as opposed to just missing key, from Prashant. 3) Add bpftool map create command which after map creation pins the map into bpf fs for further processing, from Jakub. 4) Add bpftool support for attaching programs to maps allowing sock_map and sock_hash to be used from bpftool, from John. 5) Improve syscall BPF map update/delete path for map-in-map types to wait a RCU grace period for pending references to complete, from Daniel. 6) Couple of follow-up fixes for the BPF socket lookup to get it enabled also when IPv6 is compiled as a module, from Joe. 7) Fix a generic-XDP bug to handle the case when the Ethernet header was mangled and thus update skb's protocol and data, from Jesper. 8) Add a missing BTF header length check between header copies from user space, from Wenwen. 9) Minor fixups in libbpf to use __u32 instead u32 types and include proper perf_event.h uapi header instead of perf internal one, from Yonghong. 10) Allow to pass user-defined flags through EXTRA_CFLAGS and EXTRA_LDFLAGS to bpftool's build, from Jiri. 11) BPF kselftest tweaks to add LWTUNNEL to config fragment and to install with_addr.sh script from flow dissector selftest, from Anders. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents c45d715 + 0b592b5 commit e856795

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+4962
-3659
lines changed

MAINTAINERS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8193,6 +8193,16 @@ S: Maintained
81938193
F: net/l3mdev
81948194
F: include/net/l3mdev.h
81958195

8196+
L7 BPF FRAMEWORK
8197+
M: John Fastabend <john.fastabend@gmail.com>
8198+
M: Daniel Borkmann <daniel@iogearbox.net>
8199+
L: netdev@vger.kernel.org
8200+
S: Maintained
8201+
F: include/linux/skmsg.h
8202+
F: net/core/skmsg.c
8203+
F: net/core/sock_map.c
8204+
F: net/ipv4/tcp_bpf.c
8205+
81968206
LANTIQ / INTEL Ethernet drivers
81978207
M: Hauke Mehrtens <hauke@hauke-m.de>
81988208
L: netdev@vger.kernel.org

include/linux/bpf.h

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -737,33 +737,18 @@ static inline void bpf_map_offload_map_free(struct bpf_map *map)
737737
}
738738
#endif /* CONFIG_NET && CONFIG_BPF_SYSCALL */
739739

740-
#if defined(CONFIG_STREAM_PARSER) && defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_INET)
741-
struct sock *__sock_map_lookup_elem(struct bpf_map *map, u32 key);
742-
struct sock *__sock_hash_lookup_elem(struct bpf_map *map, void *key);
743-
int sock_map_prog(struct bpf_map *map, struct bpf_prog *prog, u32 type);
744-
int sockmap_get_from_fd(const union bpf_attr *attr, int type,
745-
struct bpf_prog *prog);
740+
#if defined(CONFIG_BPF_STREAM_PARSER)
741+
int sock_map_prog_update(struct bpf_map *map, struct bpf_prog *prog, u32 which);
742+
int sock_map_get_from_fd(const union bpf_attr *attr, struct bpf_prog *prog);
746743
#else
747-
static inline struct sock *__sock_map_lookup_elem(struct bpf_map *map, u32 key)
748-
{
749-
return NULL;
750-
}
751-
752-
static inline struct sock *__sock_hash_lookup_elem(struct bpf_map *map,
753-
void *key)
754-
{
755-
return NULL;
756-
}
757-
758-
static inline int sock_map_prog(struct bpf_map *map,
759-
struct bpf_prog *prog,
760-
u32 type)
744+
static inline int sock_map_prog_update(struct bpf_map *map,
745+
struct bpf_prog *prog, u32 which)
761746
{
762747
return -EOPNOTSUPP;
763748
}
764749

765-
static inline int sockmap_get_from_fd(const union bpf_attr *attr, int type,
766-
struct bpf_prog *prog)
750+
static inline int sock_map_get_from_fd(const union bpf_attr *attr,
751+
struct bpf_prog *prog)
767752
{
768753
return -EINVAL;
769754
}
@@ -839,6 +824,10 @@ extern const struct bpf_func_proto bpf_get_stack_proto;
839824
extern const struct bpf_func_proto bpf_sock_map_update_proto;
840825
extern const struct bpf_func_proto bpf_sock_hash_update_proto;
841826
extern const struct bpf_func_proto bpf_get_current_cgroup_id_proto;
827+
extern const struct bpf_func_proto bpf_msg_redirect_hash_proto;
828+
extern const struct bpf_func_proto bpf_msg_redirect_map_proto;
829+
extern const struct bpf_func_proto bpf_sk_redirect_hash_proto;
830+
extern const struct bpf_func_proto bpf_sk_redirect_map_proto;
842831

843832
extern const struct bpf_func_proto bpf_get_local_storage_proto;
844833

include/linux/bpf_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY_OF_MAPS, array_of_maps_map_ops)
5757
BPF_MAP_TYPE(BPF_MAP_TYPE_HASH_OF_MAPS, htab_of_maps_map_ops)
5858
#ifdef CONFIG_NET
5959
BPF_MAP_TYPE(BPF_MAP_TYPE_DEVMAP, dev_map_ops)
60-
#if defined(CONFIG_STREAM_PARSER) && defined(CONFIG_INET)
60+
#if defined(CONFIG_BPF_STREAM_PARSER)
6161
BPF_MAP_TYPE(BPF_MAP_TYPE_SOCKMAP, sock_map_ops)
6262
BPF_MAP_TYPE(BPF_MAP_TYPE_SOCKHASH, sock_hash_ops)
6363
#endif

include/linux/filter.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -520,24 +520,6 @@ struct bpf_skb_data_end {
520520
void *data_end;
521521
};
522522

523-
struct sk_msg_buff {
524-
void *data;
525-
void *data_end;
526-
__u32 apply_bytes;
527-
__u32 cork_bytes;
528-
int sg_copybreak;
529-
int sg_start;
530-
int sg_curr;
531-
int sg_end;
532-
struct scatterlist sg_data[MAX_SKB_FRAGS];
533-
bool sg_copy[MAX_SKB_FRAGS];
534-
__u32 flags;
535-
struct sock *sk_redir;
536-
struct sock *sk;
537-
struct sk_buff *skb;
538-
struct list_head list;
539-
};
540-
541523
struct bpf_redirect_info {
542524
u32 ifindex;
543525
u32 flags;
@@ -833,9 +815,6 @@ void xdp_do_flush_map(void);
833815

834816
void bpf_warn_invalid_xdp_action(u32 act);
835817

836-
struct sock *do_sk_redirect_map(struct sk_buff *skb);
837-
struct sock *do_msg_redirect_map(struct sk_msg_buff *md);
838-
839818
#ifdef CONFIG_INET
840819
struct sock *bpf_run_sk_reuseport(struct sock_reuseport *reuse, struct sock *sk,
841820
struct bpf_prog *prog, struct sk_buff *skb,

0 commit comments

Comments
 (0)