#include <linux/filter.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/types.h>
#include <linux/bpf.h>
#include <net/lwtunnel.h>
#include <net/gre.h>
#include <net/ip6_route.h>
#include <net/ipv6_stubs.h>
struct bpf_lwt_prog { … };
struct bpf_lwt { … };
#define MAX_PROG_NAME …
static inline struct bpf_lwt *bpf_lwt_lwtunnel(struct lwtunnel_state *lwt)
{ … }
#define NO_REDIRECT …
#define CAN_REDIRECT …
static int run_lwt_bpf(struct sk_buff *skb, struct bpf_lwt_prog *lwt,
struct dst_entry *dst, bool can_redirect)
{ … }
static int bpf_lwt_input_reroute(struct sk_buff *skb)
{ … }
static int bpf_input(struct sk_buff *skb)
{ … }
static int bpf_output(struct net *net, struct sock *sk, struct sk_buff *skb)
{ … }
static int xmit_check_hhlen(struct sk_buff *skb, int hh_len)
{ … }
static int bpf_lwt_xmit_reroute(struct sk_buff *skb)
{ … }
static int bpf_xmit(struct sk_buff *skb)
{ … }
static void bpf_lwt_prog_destroy(struct bpf_lwt_prog *prog)
{ … }
static void bpf_destroy_state(struct lwtunnel_state *lwt)
{ … }
static const struct nla_policy bpf_prog_policy[LWT_BPF_PROG_MAX + 1] = …;
static int bpf_parse_prog(struct nlattr *attr, struct bpf_lwt_prog *prog,
enum bpf_prog_type type)
{ … }
static const struct nla_policy bpf_nl_policy[LWT_BPF_MAX + 1] = …;
static int bpf_build_state(struct net *net, struct nlattr *nla,
unsigned int family, const void *cfg,
struct lwtunnel_state **ts,
struct netlink_ext_ack *extack)
{ … }
static int bpf_fill_lwt_prog(struct sk_buff *skb, int attr,
struct bpf_lwt_prog *prog)
{ … }
static int bpf_fill_encap_info(struct sk_buff *skb, struct lwtunnel_state *lwt)
{ … }
static int bpf_encap_nlsize(struct lwtunnel_state *lwtstate)
{ … }
static int bpf_lwt_prog_cmp(struct bpf_lwt_prog *a, struct bpf_lwt_prog *b)
{ … }
static int bpf_encap_cmp(struct lwtunnel_state *a, struct lwtunnel_state *b)
{ … }
static const struct lwtunnel_encap_ops bpf_encap_ops = …;
static int handle_gso_type(struct sk_buff *skb, unsigned int gso_type,
int encap_len)
{ … }
static int handle_gso_encap(struct sk_buff *skb, bool ipv4, int encap_len)
{ … }
int bpf_lwt_push_ip_encap(struct sk_buff *skb, void *hdr, u32 len, bool ingress)
{ … }
static int __init bpf_lwt_init(void)
{ … }
subsys_initcall(…) …