1 /* Copyright (c) 2017 Facebook
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 #include <stddef.h>
8 #include <linux/bpf.h>
9 #include <linux/pkt_cls.h>
10 #include "bpf_helpers.h"
11 
12 /* It is a dumb bpf program such that it must have no
13  * issue to be loaded since testing the verifier is
14  * not the focus here.
15  */
16 
17 int _version SEC("version") = 1;
18 
19 struct bpf_map_def SEC("maps") test_map_id = {
20 	.type = BPF_MAP_TYPE_ARRAY,
21 	.key_size = sizeof(__u32),
22 	.value_size = sizeof(__u64),
23 	.max_entries = 1,
24 };
25 
26 SEC("test_obj_id_dummy")
27 int test_obj_id(struct __sk_buff *skb)
28 {
29 	__u32 key = 0;
30 	__u64 *value;
31 
32 	value = bpf_map_lookup_elem(&test_map_id, &key);
33 
34 	return TC_ACT_OK;
35 }
36