Linux Audio

Check our new training course

Loading...
v6.13.7
 1// SPDX-License-Identifier: GPL-2.0-only
 2/* Copyright (c) 2020 Facebook */
 3#include <stddef.h>
 4#include <linux/bpf.h>
 5#include <bpf/bpf_helpers.h>
 6#include "bpf_misc.h"
 7
 8__attribute__ ((noinline))
 9void foo(struct __sk_buff *skb)
10{
11	skb->tc_index = 0;
12}
13
14SEC("tc")
15__failure __msg("foo() doesn't return scalar")
16int global_func7(struct __sk_buff *skb)
17{
18	foo(skb);
19	return 0;
20}
v5.9
 1// SPDX-License-Identifier: GPL-2.0-only
 2/* Copyright (c) 2020 Facebook */
 3#include <stddef.h>
 4#include <linux/bpf.h>
 5#include <bpf/bpf_helpers.h>
 
 6
 7__attribute__ ((noinline))
 8void foo(struct __sk_buff *skb)
 9{
10	skb->tc_index = 0;
11}
12
13SEC("classifier/test")
14int test_cls(struct __sk_buff *skb)
 
15{
16	foo(skb);
17	return 0;
18}