.. | .. |
---|
16 | 16 | #define LWTUNNEL_STATE_INPUT_REDIRECT BIT(1) |
---|
17 | 17 | #define LWTUNNEL_STATE_XMIT_REDIRECT BIT(2) |
---|
18 | 18 | |
---|
| 19 | +/* LWTUNNEL_XMIT_CONTINUE should be distinguishable from dst_output return |
---|
| 20 | + * values (NET_XMIT_xxx and NETDEV_TX_xxx in linux/netdevice.h) for safety. |
---|
| 21 | + */ |
---|
19 | 22 | enum { |
---|
20 | 23 | LWTUNNEL_XMIT_DONE, |
---|
21 | | - LWTUNNEL_XMIT_CONTINUE, |
---|
| 24 | + LWTUNNEL_XMIT_CONTINUE = 0x100, |
---|
22 | 25 | }; |
---|
23 | 26 | |
---|
24 | 27 | |
---|
.. | .. |
---|
30 | 33 | int (*orig_output)(struct net *net, struct sock *sk, struct sk_buff *skb); |
---|
31 | 34 | int (*orig_input)(struct sk_buff *); |
---|
32 | 35 | struct rcu_head rcu; |
---|
33 | | - __u8 data[0]; |
---|
| 36 | + __u8 data[]; |
---|
34 | 37 | }; |
---|
35 | 38 | |
---|
36 | 39 | struct lwtunnel_encap_ops { |
---|
37 | | - int (*build_state)(struct nlattr *encap, |
---|
| 40 | + int (*build_state)(struct net *net, struct nlattr *encap, |
---|
38 | 41 | unsigned int family, const void *cfg, |
---|
39 | 42 | struct lwtunnel_state **ts, |
---|
40 | 43 | struct netlink_ext_ack *extack); |
---|
.. | .. |
---|
113 | 116 | struct netlink_ext_ack *extack); |
---|
114 | 117 | int lwtunnel_valid_encap_type_attr(struct nlattr *attr, int len, |
---|
115 | 118 | struct netlink_ext_ack *extack); |
---|
116 | | -int lwtunnel_build_state(u16 encap_type, |
---|
| 119 | +int lwtunnel_build_state(struct net *net, u16 encap_type, |
---|
117 | 120 | struct nlattr *encap, |
---|
118 | 121 | unsigned int family, const void *cfg, |
---|
119 | 122 | struct lwtunnel_state **lws, |
---|
120 | 123 | struct netlink_ext_ack *extack); |
---|
121 | | -int lwtunnel_fill_encap(struct sk_buff *skb, |
---|
122 | | - struct lwtunnel_state *lwtstate); |
---|
| 124 | +int lwtunnel_fill_encap(struct sk_buff *skb, struct lwtunnel_state *lwtstate, |
---|
| 125 | + int encap_attr, int encap_type_attr); |
---|
123 | 126 | int lwtunnel_get_encap_size(struct lwtunnel_state *lwtstate); |
---|
124 | 127 | struct lwtunnel_state *lwtunnel_state_alloc(int hdr_len); |
---|
125 | 128 | int lwtunnel_cmp_encap(struct lwtunnel_state *a, struct lwtunnel_state *b); |
---|
126 | 129 | int lwtunnel_output(struct net *net, struct sock *sk, struct sk_buff *skb); |
---|
127 | 130 | int lwtunnel_input(struct sk_buff *skb); |
---|
128 | 131 | int lwtunnel_xmit(struct sk_buff *skb); |
---|
| 132 | +int bpf_lwt_push_ip_encap(struct sk_buff *skb, void *hdr, u32 len, |
---|
| 133 | + bool ingress); |
---|
129 | 134 | |
---|
130 | 135 | static inline void lwtunnel_set_redirect(struct dst_entry *dst) |
---|
131 | 136 | { |
---|
.. | .. |
---|
207 | 212 | return 0; |
---|
208 | 213 | } |
---|
209 | 214 | |
---|
210 | | -static inline int lwtunnel_build_state(u16 encap_type, |
---|
| 215 | +static inline int lwtunnel_build_state(struct net *net, u16 encap_type, |
---|
211 | 216 | struct nlattr *encap, |
---|
212 | 217 | unsigned int family, const void *cfg, |
---|
213 | 218 | struct lwtunnel_state **lws, |
---|
.. | .. |
---|
217 | 222 | } |
---|
218 | 223 | |
---|
219 | 224 | static inline int lwtunnel_fill_encap(struct sk_buff *skb, |
---|
220 | | - struct lwtunnel_state *lwtstate) |
---|
| 225 | + struct lwtunnel_state *lwtstate, |
---|
| 226 | + int encap_attr, int encap_type_attr) |
---|
221 | 227 | { |
---|
222 | 228 | return 0; |
---|
223 | 229 | } |
---|