Linux-libre 5.4.49-gnu
[librecmc/linux-libre.git] / tools / testing / selftests / bpf / progs / test_xdp_redirect.c
1 /* Copyright (c) 2017 VMware
2  *
3  * This program is free software; you can redistribute it and/or
4  * modify it under the terms of version 2 of the GNU General Public
5  * License as published by the Free Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful, but
8  * WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10  * General Public License for more details.
11  */
12 #include <linux/bpf.h>
13 #include "bpf_helpers.h"
14
15 int _version SEC("version") = 1;
16
17 SEC("redirect_to_111")
18 int xdp_redirect_to_111(struct xdp_md *xdp)
19 {
20         return bpf_redirect(111, 0);
21 }
22 SEC("redirect_to_222")
23 int xdp_redirect_to_222(struct xdp_md *xdp)
24 {
25         return bpf_redirect(222, 0);
26 }
27
28 char _license[] SEC("license") = "GPL";