xref: /linux/tools/testing/selftests/bpf/progs/lwt_misc.c (revision 5ea5880764cbb164afb17a62e76ca75dc371409d)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include "vmlinux.h"
4 #include <bpf/bpf_helpers.h>
5 #include "bpf_misc.h"
6 
7 SEC("lwt_xmit")
8 __success __retval(0)
9 int test_missing_dst(struct __sk_buff *skb)
10 {
11 	struct iphdr iph;
12 
13 	__builtin_memset(&iph, 0, sizeof(struct iphdr));
14 	iph.ihl = 5;
15 	iph.version = 4;
16 
17 	bpf_lwt_push_encap(skb, BPF_LWT_ENCAP_IP, &iph, sizeof(struct iphdr));
18 
19 	return 0;
20 }
21 
22 char _license[] SEC("license") = "GPL";
23