generated from netgroup/hikepkg-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpaolo_kroute.bpf.c
44 lines (33 loc) · 892 Bytes
/
paolo_kroute.bpf.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
#include <stddef.h>
#include <linux/in.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>
#include <linux/ipv6.h>
#include <linux/seg6.h>
#include <linux/errno.h>
/* HIKe Chain IDs and XDP eBPF/HIKe programs IDs */
#include "minimal.h"
#include "hike_vm.h"
#include "parse_helpers.h"
#include "paolo_kroute.h"
//#define HIKE_PRINT_LEVEL HIKE_PRINT_LEVEL_DEBUG
HIKE_PROG(paolo_kroute)
{
struct pkt_info *info = hike_pcpu_shmem();
struct hdr_cursor *cur;
int rc;
if (unlikely(!info))
goto drop;
/* take the reference to the cursor object which has been saved into
* the HIKe per-cpu shared memory
*/
cur = pkt_info_cur(info);
/* lookup with FIB rules */
rc = __paolo_route(ctx, cur, 0);
return rc;
drop:
return XDP_ABORTED;
}
EXPORT_HIKE_PROG(paolo_kroute);
char LICENSE[] SEC("license") = "Dual BSD/GPL";