aboutsummaryrefslogtreecommitdiffstats
path: root/net/mpls
diff options
context:
space:
mode:
authorJiri Benc <jbenc@redhat.com>2015-08-20 07:56:25 -0400
committerDavid S. Miller <davem@davemloft.net>2015-08-20 18:42:36 -0400
commit61adedf3e3f1d3f032c5a6a299978d91eff6d555 (patch)
treeb0d915083b64f9196bf90135a501779762149a9e /net/mpls
parent7c383fb2254c44e096427470da6a36380169b548 (diff)
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')
-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)
48 struct dst_entry *dst = skb_dst(skb); 48 struct dst_entry *dst = skb_dst(skb);
49 struct rtable *rt = NULL; 49 struct rtable *rt = NULL;
50 struct rt6_info *rt6 = NULL; 50 struct rt6_info *rt6 = NULL;
51 struct lwtunnel_state *lwtstate = NULL;
52 int err = 0; 51 int err = 0;
53 bool bos; 52 bool bos;
54 int i; 53 int i;
@@ -58,11 +57,9 @@ int mpls_output(struct sock *sk, struct sk_buff *skb)
58 if (skb->protocol == htons(ETH_P_IP)) { 57 if (skb->protocol == htons(ETH_P_IP)) {
59 ttl = ip_hdr(skb)->ttl; 58 ttl = ip_hdr(skb)->ttl;
60 rt = (struct rtable *)dst; 59 rt = (struct rtable *)dst;
61 lwtstate = rt->rt_lwtstate;
62 } else if (skb->protocol == htons(ETH_P_IPV6)) { 60 } else if (skb->protocol == htons(ETH_P_IPV6)) {
63 ttl = ipv6_hdr(skb)->hop_limit; 61 ttl = ipv6_hdr(skb)->hop_limit;
64 rt6 = (struct rt6_info *)dst; 62 rt6 = (struct rt6_info *)dst;
65 lwtstate = rt6->rt6i_lwtstate;
66 } else { 63 } else {
67 goto drop; 64 goto drop;
68 } 65 }
@@ -72,12 +69,12 @@ int mpls_output(struct sock *sk, struct sk_buff *skb)
72 /* Find the output device */ 69 /* Find the output device */
73 out_dev = dst->dev; 70 out_dev = dst->dev;
74 if (!mpls_output_possible(out_dev) || 71 if (!mpls_output_possible(out_dev) ||
75 !lwtstate || skb_warn_if_lro(skb)) 72 !dst->lwtstate || skb_warn_if_lro(skb))
76 goto drop; 73 goto drop;
77 74
78 skb_forward_csum(skb); 75 skb_forward_csum(skb);
79 76
80 tun_encap_info = mpls_lwtunnel_encap(lwtstate); 77 tun_encap_info = mpls_lwtunnel_encap(dst->lwtstate);
81 78
82 /* Verify the destination can hold the packet */ 79 /* Verify the destination can hold the packet */
83 new_header_size = mpls_encap_size(tun_encap_info); 80 new_header_size = mpls_encap_size(tun_encap_info);