aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ip6_tunnel.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-03-12 16:22:43 -0500
committerDavid S. Miller <davem@davemloft.net>2011-03-12 18:08:54 -0500
commit4c9483b2fb5d2548c3cc1fe03cdd4484ceeb5d1c (patch)
treec29c8070012cffb38fe249cf528589a675f622b1 /net/ipv6/ip6_tunnel.c
parent9cce96df5b76691712dba22e83ff5efe900361e1 (diff)
ipv6: Convert to use flowi6 where applicable.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_tunnel.c')
-rw-r--r--net/ipv6/ip6_tunnel.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index c3fc824c24d9..c1b1bd312df2 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -884,7 +884,7 @@ static inline int ip6_tnl_xmit_ctl(struct ip6_tnl *t)
884static int ip6_tnl_xmit2(struct sk_buff *skb, 884static int ip6_tnl_xmit2(struct sk_buff *skb,
885 struct net_device *dev, 885 struct net_device *dev,
886 __u8 dsfield, 886 __u8 dsfield,
887 struct flowi *fl, 887 struct flowi6 *fl6,
888 int encap_limit, 888 int encap_limit,
889 __u32 *pmtu) 889 __u32 *pmtu)
890{ 890{
@@ -904,11 +904,11 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
904 if ((dst = ip6_tnl_dst_check(t)) != NULL) 904 if ((dst = ip6_tnl_dst_check(t)) != NULL)
905 dst_hold(dst); 905 dst_hold(dst);
906 else { 906 else {
907 dst = ip6_route_output(net, NULL, fl); 907 dst = ip6_route_output(net, NULL, fl6);
908 908
909 if (dst->error) 909 if (dst->error)
910 goto tx_err_link_failure; 910 goto tx_err_link_failure;
911 dst = xfrm_lookup(net, dst, fl, NULL, 0); 911 dst = xfrm_lookup(net, dst, flowi6_to_flowi(fl6), NULL, 0);
912 if (IS_ERR(dst)) { 912 if (IS_ERR(dst)) {
913 err = PTR_ERR(dst); 913 err = PTR_ERR(dst);
914 dst = NULL; 914 dst = NULL;
@@ -963,7 +963,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
963 963
964 skb->transport_header = skb->network_header; 964 skb->transport_header = skb->network_header;
965 965
966 proto = fl->flowi_proto; 966 proto = fl6->flowi6_proto;
967 if (encap_limit >= 0) { 967 if (encap_limit >= 0) {
968 init_tel_txopt(&opt, encap_limit); 968 init_tel_txopt(&opt, encap_limit);
969 ipv6_push_nfrag_opts(skb, &opt.ops, &proto, NULL); 969 ipv6_push_nfrag_opts(skb, &opt.ops, &proto, NULL);
@@ -971,13 +971,13 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
971 skb_push(skb, sizeof(struct ipv6hdr)); 971 skb_push(skb, sizeof(struct ipv6hdr));
972 skb_reset_network_header(skb); 972 skb_reset_network_header(skb);
973 ipv6h = ipv6_hdr(skb); 973 ipv6h = ipv6_hdr(skb);
974 *(__be32*)ipv6h = fl->fl6_flowlabel | htonl(0x60000000); 974 *(__be32*)ipv6h = fl6->flowlabel | htonl(0x60000000);
975 dsfield = INET_ECN_encapsulate(0, dsfield); 975 dsfield = INET_ECN_encapsulate(0, dsfield);
976 ipv6_change_dsfield(ipv6h, ~INET_ECN_MASK, dsfield); 976 ipv6_change_dsfield(ipv6h, ~INET_ECN_MASK, dsfield);
977 ipv6h->hop_limit = t->parms.hop_limit; 977 ipv6h->hop_limit = t->parms.hop_limit;
978 ipv6h->nexthdr = proto; 978 ipv6h->nexthdr = proto;
979 ipv6_addr_copy(&ipv6h->saddr, &fl->fl6_src); 979 ipv6_addr_copy(&ipv6h->saddr, &fl6->saddr);
980 ipv6_addr_copy(&ipv6h->daddr, &fl->fl6_dst); 980 ipv6_addr_copy(&ipv6h->daddr, &fl6->daddr);
981 nf_reset(skb); 981 nf_reset(skb);
982 pkt_len = skb->len; 982 pkt_len = skb->len;
983 err = ip6_local_out(skb); 983 err = ip6_local_out(skb);
@@ -1007,7 +1007,7 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
1007 struct ip6_tnl *t = netdev_priv(dev); 1007 struct ip6_tnl *t = netdev_priv(dev);
1008 struct iphdr *iph = ip_hdr(skb); 1008 struct iphdr *iph = ip_hdr(skb);
1009 int encap_limit = -1; 1009 int encap_limit = -1;
1010 struct flowi fl; 1010 struct flowi6 fl6;
1011 __u8 dsfield; 1011 __u8 dsfield;
1012 __u32 mtu; 1012 __u32 mtu;
1013 int err; 1013 int err;
@@ -1019,16 +1019,16 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
1019 if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) 1019 if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT))
1020 encap_limit = t->parms.encap_limit; 1020 encap_limit = t->parms.encap_limit;
1021 1021
1022 memcpy(&fl, &t->fl, sizeof (fl)); 1022 memcpy(&fl6, &t->fl.u.ip6, sizeof (fl6));
1023 fl.flowi_proto = IPPROTO_IPIP; 1023 fl6.flowi6_proto = IPPROTO_IPIP;
1024 1024
1025 dsfield = ipv4_get_dsfield(iph); 1025 dsfield = ipv4_get_dsfield(iph);
1026 1026
1027 if ((t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)) 1027 if ((t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS))
1028 fl.fl6_flowlabel |= htonl((__u32)iph->tos << IPV6_TCLASS_SHIFT) 1028 fl6.flowlabel |= htonl((__u32)iph->tos << IPV6_TCLASS_SHIFT)
1029 & IPV6_TCLASS_MASK; 1029 & IPV6_TCLASS_MASK;
1030 1030
1031 err = ip6_tnl_xmit2(skb, dev, dsfield, &fl, encap_limit, &mtu); 1031 err = ip6_tnl_xmit2(skb, dev, dsfield, &fl6, encap_limit, &mtu);
1032 if (err != 0) { 1032 if (err != 0) {
1033 /* XXX: send ICMP error even if DF is not set. */ 1033 /* XXX: send ICMP error even if DF is not set. */
1034 if (err == -EMSGSIZE) 1034 if (err == -EMSGSIZE)
@@ -1047,7 +1047,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
1047 struct ipv6hdr *ipv6h = ipv6_hdr(skb); 1047 struct ipv6hdr *ipv6h = ipv6_hdr(skb);
1048 int encap_limit = -1; 1048 int encap_limit = -1;
1049 __u16 offset; 1049 __u16 offset;
1050 struct flowi fl; 1050 struct flowi6 fl6;
1051 __u8 dsfield; 1051 __u8 dsfield;
1052 __u32 mtu; 1052 __u32 mtu;
1053 int err; 1053 int err;
@@ -1069,16 +1069,16 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
1069 } else if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) 1069 } else if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT))
1070 encap_limit = t->parms.encap_limit; 1070 encap_limit = t->parms.encap_limit;
1071 1071
1072 memcpy(&fl, &t->fl, sizeof (fl)); 1072 memcpy(&fl6, &t->fl.u.ip6, sizeof (fl6));
1073 fl.flowi_proto = IPPROTO_IPV6; 1073 fl6.flowi6_proto = IPPROTO_IPV6;
1074 1074
1075 dsfield = ipv6_get_dsfield(ipv6h); 1075 dsfield = ipv6_get_dsfield(ipv6h);
1076 if ((t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)) 1076 if ((t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS))
1077 fl.fl6_flowlabel |= (*(__be32 *) ipv6h & IPV6_TCLASS_MASK); 1077 fl6.flowlabel |= (*(__be32 *) ipv6h & IPV6_TCLASS_MASK);
1078 if ((t->parms.flags & IP6_TNL_F_USE_ORIG_FLOWLABEL)) 1078 if ((t->parms.flags & IP6_TNL_F_USE_ORIG_FLOWLABEL))
1079 fl.fl6_flowlabel |= (*(__be32 *) ipv6h & IPV6_FLOWLABEL_MASK); 1079 fl6.flowlabel |= (*(__be32 *) ipv6h & IPV6_FLOWLABEL_MASK);
1080 1080
1081 err = ip6_tnl_xmit2(skb, dev, dsfield, &fl, encap_limit, &mtu); 1081 err = ip6_tnl_xmit2(skb, dev, dsfield, &fl6, encap_limit, &mtu);
1082 if (err != 0) { 1082 if (err != 0) {
1083 if (err == -EMSGSIZE) 1083 if (err == -EMSGSIZE)
1084 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); 1084 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
@@ -1141,21 +1141,21 @@ static void ip6_tnl_link_config(struct ip6_tnl *t)
1141{ 1141{
1142 struct net_device *dev = t->dev; 1142 struct net_device *dev = t->dev;
1143 struct ip6_tnl_parm *p = &t->parms; 1143 struct ip6_tnl_parm *p = &t->parms;
1144 struct flowi *fl = &t->fl; 1144 struct flowi6 *fl6 = &t->fl.u.ip6;
1145 1145
1146 memcpy(dev->dev_addr, &p->laddr, sizeof(struct in6_addr)); 1146 memcpy(dev->dev_addr, &p->laddr, sizeof(struct in6_addr));
1147 memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr)); 1147 memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr));
1148 1148
1149 /* Set up flowi template */ 1149 /* Set up flowi template */
1150 ipv6_addr_copy(&fl->fl6_src, &p->laddr); 1150 ipv6_addr_copy(&fl6->saddr, &p->laddr);
1151 ipv6_addr_copy(&fl->fl6_dst, &p->raddr); 1151 ipv6_addr_copy(&fl6->daddr, &p->raddr);
1152 fl->flowi_oif = p->link; 1152 fl6->flowi6_oif = p->link;
1153 fl->fl6_flowlabel = 0; 1153 fl6->flowlabel = 0;
1154 1154
1155 if (!(p->flags&IP6_TNL_F_USE_ORIG_TCLASS)) 1155 if (!(p->flags&IP6_TNL_F_USE_ORIG_TCLASS))
1156 fl->fl6_flowlabel |= IPV6_TCLASS_MASK & p->flowinfo; 1156 fl6->flowlabel |= IPV6_TCLASS_MASK & p->flowinfo;
1157 if (!(p->flags&IP6_TNL_F_USE_ORIG_FLOWLABEL)) 1157 if (!(p->flags&IP6_TNL_F_USE_ORIG_FLOWLABEL))
1158 fl->fl6_flowlabel |= IPV6_FLOWLABEL_MASK & p->flowinfo; 1158 fl6->flowlabel |= IPV6_FLOWLABEL_MASK & p->flowinfo;
1159 1159
1160 ip6_tnl_set_cap(t); 1160 ip6_tnl_set_cap(t);
1161 1161