struct ethernet_t *ethernet = cursor_advance(cursor, sizeof(*ethernet));
struct bpf_tunnel_key tkey = {};
- bpf_skb_get_tunnel_key(skb, &tkey, sizeof(tkey));
+ bpf_skb_get_tunnel_key(skb, &tkey, sizeof(tkey), 0);
int *ifindex = vni2if.lookup(&tkey.tunnel_id);
if (ifindex) {
u32 zero = 0;
tkey.tunnel_id = dst_host->tunnel_id;
tkey.remote_ipv4 = dst_host->remote_ipv4;
- bpf_skb_set_tunnel_key(skb, &tkey, sizeof(tkey));
+ bpf_skb_set_tunnel_key(skb, &tkey, sizeof(tkey), 0);
lock_xadd(&dst_host->tx_pkts, 1);
} else {
struct bpf_tunnel_key tkey = {};
return 1;
tkey.tunnel_id = dst_host->tunnel_id;
tkey.remote_ipv4 = dst_host->remote_ipv4;
- bpf_skb_set_tunnel_key(skb, &tkey, sizeof(tkey));
+ bpf_skb_set_tunnel_key(skb, &tkey, sizeof(tkey), 0);
}
bpf_clone_redirect(skb, cfg->tunnel_ifindex, 0/*egress*/);
return 1;
// Handle packets from the encap device, demux into the dest tenant
int handle_ingress(struct __sk_buff *skb) {
struct bpf_tunnel_key tkey = {};
- bpf_skb_get_tunnel_key(skb, &tkey, sizeof(tkey));
+ bpf_skb_get_tunnel_key(skb, &tkey, sizeof(tkey), 0);
int *ifindex = tunkey2if.lookup(&tkey);
if (ifindex) {
if (tkey_p) {
tkey.tunnel_id = tkey_p->tunnel_id;
tkey.remote_ipv4 = tkey_p->remote_ipv4;
- bpf_skb_set_tunnel_key(skb, &tkey, sizeof(tkey));
+ bpf_skb_set_tunnel_key(skb, &tkey, sizeof(tkey), 0);
bpf_clone_redirect(skb, cfg->tunnel_ifindex, 0/*egress*/);
}
return 1;
BPF_FUNC_skb_vlan_pop, /* bpf_skb_vlan_pop(skb) */
/**
- * bpf_skb_[gs]et_tunnel_key(skb, struct bpf_tunnel_key *key, int size)
+ * bpf_skb_[gs]et_tunnel_key(skb, key, size, flags)
* retrieve or populate tunnel metadata
* @skb: pointer to skb
* @key: pointer to 'struct bpf_tunnel_key'
* @size: size of 'struct bpf_tunnel_key'
+ * @flags: room for future extensions
* Retrun: 0 on success
*/
BPF_FUNC_skb_get_tunnel_key,
static void bpf_tail_call_(u64 map_fd, void *ctx, int index) {
((void (*)(void *, u64, int))BPF_FUNC_tail_call)(ctx, map_fd, index);
}
-static int (*bpf_skb_get_tunnel_key)(void *ctx, void *to, u32 size) =
+static int (*bpf_skb_get_tunnel_key)(void *ctx, void *to, u32 size, u64 flags) =
(void *) BPF_FUNC_skb_get_tunnel_key;
-static int (*bpf_skb_set_tunnel_key)(void *ctx, void *from, u32 size) =
+static int (*bpf_skb_set_tunnel_key)(void *ctx, void *from, u32 size, u64 flags) =
(void *) BPF_FUNC_skb_set_tunnel_key;
#endif