summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/lwt_misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/selftests/bpf/progs/lwt_misc.c')
-rw-r--r--tools/testing/selftests/bpf/progs/lwt_misc.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/lwt_misc.c b/tools/testing/selftests/bpf/progs/lwt_misc.c
new file mode 100644
index 000000000000..b392317088d2
--- /dev/null
+++ b/tools/testing/selftests/bpf/progs/lwt_misc.c
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include "vmlinux.h"
+#include <bpf/bpf_helpers.h>
+#include "bpf_misc.h"
+
+SEC("lwt_xmit")
+__success __retval(0)
+int test_missing_dst(struct __sk_buff *skb)
+{
+ struct iphdr iph;
+
+ __builtin_memset(&iph, 0, sizeof(struct iphdr));
+ iph.ihl = 5;
+ iph.version = 4;
+
+ bpf_lwt_push_encap(skb, BPF_LWT_ENCAP_IP, &iph, sizeof(struct iphdr));
+
+ return 0;
+}
+
+char _license[] SEC("license") = "GPL";