diff options
author | David Ahern <dsahern@gmail.com> | 2018-02-13 20:32:04 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-02-14 14:43:32 -0500 |
commit | 9942895b5ee4b0db53f32fbcb4a51360607aac1b (patch) | |
tree | 81b8c17ab70dd6b085f61fdeb154998b1b6c70c0 /include/net/lwtunnel.h | |
parent | 64da58528bdbdba171cf6c6ffaf39c2ee75e3a10 (diff) | |
download | lwn-9942895b5ee4b0db53f32fbcb4a51360607aac1b.tar.gz lwn-9942895b5ee4b0db53f32fbcb4a51360607aac1b.zip |
net: Move ipv4 set_lwt_redirect helper to lwtunnel
IPv4 uses set_lwt_redirect to set the lwtunnel redirect functions as
needed. Move it to lwtunnel.h as lwtunnel_set_redirect and change
IPv6 to also use it.
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/lwtunnel.h')
-rw-r--r-- | include/net/lwtunnel.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/net/lwtunnel.h b/include/net/lwtunnel.h index d747ef975cd8..33fd9ba7e0e5 100644 --- a/include/net/lwtunnel.h +++ b/include/net/lwtunnel.h @@ -127,6 +127,17 @@ int lwtunnel_output(struct net *net, struct sock *sk, struct sk_buff *skb); int lwtunnel_input(struct sk_buff *skb); int lwtunnel_xmit(struct sk_buff *skb); +static inline void lwtunnel_set_redirect(struct dst_entry *dst) +{ + if (lwtunnel_output_redirect(dst->lwtstate)) { + dst->lwtstate->orig_output = dst->output; + dst->output = lwtunnel_output; + } + if (lwtunnel_input_redirect(dst->lwtstate)) { + dst->lwtstate->orig_input = dst->input; + dst->input = lwtunnel_input; + } +} #else static inline void lwtstate_free(struct lwtunnel_state *lws) @@ -158,6 +169,10 @@ static inline bool lwtunnel_xmit_redirect(struct lwtunnel_state *lwtstate) return false; } +static inline void lwtunnel_set_redirect(struct dst_entry *dst) +{ +} + static inline unsigned int lwtunnel_headroom(struct lwtunnel_state *lwtstate, unsigned int mtu) { |