summaryrefslogtreecommitdiffstats
path: root/net/mpls/mpls_iptunnel.c
diff options
context:
space:
mode:
authorJiri Benc <jbenc@redhat.com>2015-08-20 13:56:25 +0200
committerDavid S. Miller <davem@davemloft.net>2015-08-20 15:42:36 -0700
commit61adedf3e3f1d3f032c5a6a299978d91eff6d555 (patch)
treeb0d915083b64f9196bf90135a501779762149a9e /net/mpls/mpls_iptunnel.c
parent7c383fb2254c44e096427470da6a36380169b548 (diff)
downloadlinux-stable-61adedf3e3f1d3f032c5a6a299978d91eff6d555.tar.gz
linux-stable-61adedf3e3f1d3f032c5a6a299978d91eff6d555.tar.bz2
linux-stable-61adedf3e3f1d3f032c5a6a299978d91eff6d555.zip
route: move lwtunnel state to dst_entry
Currently, the lwtunnel state resides in per-protocol data. This is a problem if we encapsulate ipv6 traffic in an ipv4 tunnel (or vice versa). The xmit function of the tunnel does not know whether the packet has been routed to it by ipv4 or ipv6, yet it needs the lwtstate data. Moving the lwtstate data to dst_entry makes such inter-protocol tunneling possible. As a bonus, this brings a nice diffstat. Signed-off-by: Jiri Benc <jbenc@redhat.com> Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com> Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mpls/mpls_iptunnel.c')
-rw-r--r--net/mpls/mpls_iptunnel.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c
index 276f8c992218..3da5ca3ba563 100644
--- a/net/mpls/mpls_iptunnel.c
+++ b/net/mpls/mpls_iptunnel.c
@@ -48,7 +48,6 @@ int mpls_output(struct sock *sk, struct sk_buff *skb)
struct dst_entry *dst = skb_dst(skb);
struct rtable *rt = NULL;
struct rt6_info *rt6 = NULL;
- struct lwtunnel_state *lwtstate = NULL;
int err = 0;
bool bos;
int i;
@@ -58,11 +57,9 @@ int mpls_output(struct sock *sk, struct sk_buff *skb)
if (skb->protocol == htons(ETH_P_IP)) {
ttl = ip_hdr(skb)->ttl;
rt = (struct rtable *)dst;
- lwtstate = rt->rt_lwtstate;
} else if (skb->protocol == htons(ETH_P_IPV6)) {
ttl = ipv6_hdr(skb)->hop_limit;
rt6 = (struct rt6_info *)dst;
- lwtstate = rt6->rt6i_lwtstate;
} else {
goto drop;
}
@@ -72,12 +69,12 @@ int mpls_output(struct sock *sk, struct sk_buff *skb)
/* Find the output device */
out_dev = dst->dev;
if (!mpls_output_possible(out_dev) ||
- !lwtstate || skb_warn_if_lro(skb))
+ !dst->lwtstate || skb_warn_if_lro(skb))
goto drop;
skb_forward_csum(skb);
- tun_encap_info = mpls_lwtunnel_encap(lwtstate);
+ tun_encap_info = mpls_lwtunnel_encap(dst->lwtstate);
/* Verify the destination can hold the packet */
new_header_size = mpls_encap_size(tun_encap_info);