GitHub

@@ -110,6 +110,7 @@ enum bpf_map_type {

110110

BPF_MAP_TYPE_ARRAY_OF_MAPS,

111111

BPF_MAP_TYPE_HASH_OF_MAPS,

112112

BPF_MAP_TYPE_DEVMAP,

113+

BPF_MAP_TYPE_SOCKMAP,

113114

};

114115115116

enum bpf_prog_type {

@@ -135,11 +136,15 @@ enum bpf_attach_type {

135136

BPF_CGROUP_INET_EGRESS,

136137

BPF_CGROUP_INET_SOCK_CREATE,

137138

BPF_CGROUP_SOCK_OPS,

139+

BPF_CGROUP_SMAP_INGRESS,

138140

__MAX_BPF_ATTACH_TYPE

139141

};

140142141143

#define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE

142144145+

/* If BPF_SOCKMAP_STRPARSER is used sockmap will use strparser on receive */

146+

#define BPF_SOCKMAP_STRPARSER (1U << 0)

147+143148

/* If BPF_F_ALLOW_OVERRIDE flag is used in BPF_PROG_ATTACH command

144149

* to the given target_fd cgroup the descendent cgroup will be able to

145150

* override effective bpf program that was inherited from this cgroup

@@ -211,6 +216,7 @@ union bpf_attr {

211216

__u32 attach_bpf_fd; /* eBPF program to attach */

212217

__u32 attach_type;

213218

__u32 attach_flags;

219+

__u32 attach_bpf_fd2;

214220

};

215221216222

struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */

@@ -557,6 +563,23 @@ union bpf_attr {

557563

* @mode: operation mode (enum bpf_adj_room_mode)

558564

* @flags: reserved for future use

559565

* Return: 0 on success or negative error code

566+

*

567+

* int bpf_sk_redirect_map(map, key, flags)

568+

* Redirect skb to a sock in map using key as a lookup key for the

569+

* sock in map.

570+

* @map: pointer to sockmap

571+

* @key: key to lookup sock in map

572+

* @flags: reserved for future use

573+

* Return: SK_REDIRECT

574+

*

575+

* int bpf_sock_map_update(skops, map, key, flags, map_flags)

576+

* @skops: pointer to bpf_sock_ops

577+

* @map: pointer to sockmap to update

578+

* @key: key to insert/update sock in map

579+

* @flags: same flags as map update elem

580+

* @map_flags: sock map specific flags

581+

* bit 1: Enable strparser

582+

* other bits: reserved

560583

*/

561584

#define __BPF_FUNC_MAPPER(FN) \

562585

FN(unspec), \

@@ -610,7 +633,9 @@ union bpf_attr {

610633

FN(set_hash), \

611634

FN(setsockopt), \

612635

FN(skb_adjust_room), \

613-

FN(redirect_map),

636+

FN(redirect_map), \

637+

FN(sk_redirect_map), \

638+

FN(sock_map_update), \

614639615640

/* integer value in 'imm' field of BPF_CALL instruction selects which helper

616641

* function eBPF program intends to call

@@ -747,6 +772,12 @@ struct xdp_md {

747772

__u32 data_end;

748773

};

749774775+

enum sk_action {

776+

SK_ABORTED = 0,

777+

SK_DROP,

778+

SK_REDIRECT,

779+

};

780+750781

#define BPF_TAG_SIZE 8

751782752783

struct bpf_prog_info {

Read the original on github.com ↗