aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
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
parent9cce96df5b76691712dba22e83ff5efe900361e1 (diff)
ipv6: Convert to use flowi6 where applicable.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/af_inet6.c32
-rw-r--r--net/ipv6/datagram.c75
-rw-r--r--net/ipv6/exthdrs.c12
-rw-r--r--net/ipv6/fib6_rules.c19
-rw-r--r--net/ipv6/icmp.c110
-rw-r--r--net/ipv6/inet6_connection_sock.c60
-rw-r--r--net/ipv6/ip6_fib.c4
-rw-r--r--net/ipv6/ip6_flowlabel.c6
-rw-r--r--net/ipv6/ip6_output.c90
-rw-r--r--net/ipv6/ip6_tunnel.c50
-rw-r--r--net/ipv6/ip6mr.c53
-rw-r--r--net/ipv6/ipv6_sockglue.c10
-rw-r--r--net/ipv6/mcast.c12
-rw-r--r--net/ipv6/mip6.c13
-rw-r--r--net/ipv6/ndisc.c14
-rw-r--r--net/ipv6/netfilter.c18
-rw-r--r--net/ipv6/netfilter/ip6t_REJECT.c20
-rw-r--r--net/ipv6/raw.c79
-rw-r--r--net/ipv6/route.c96
-rw-r--r--net/ipv6/syncookies.c26
-rw-r--r--net/ipv6/tcp_ipv6.c114
-rw-r--r--net/ipv6/udp.c76
-rw-r--r--net/ipv6/xfrm6_policy.c3
23 files changed, 498 insertions, 494 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 923febea8989..689eea6553fd 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -652,22 +652,22 @@ int inet6_sk_rebuild_header(struct sock *sk)
652 if (dst == NULL) { 652 if (dst == NULL) {
653 struct inet_sock *inet = inet_sk(sk); 653 struct inet_sock *inet = inet_sk(sk);
654 struct in6_addr *final_p, final; 654 struct in6_addr *final_p, final;
655 struct flowi fl; 655 struct flowi6 fl6;
656 656
657 memset(&fl, 0, sizeof(fl)); 657 memset(&fl6, 0, sizeof(fl6));
658 fl.flowi_proto = sk->sk_protocol; 658 fl6.flowi6_proto = sk->sk_protocol;
659 ipv6_addr_copy(&fl.fl6_dst, &np->daddr); 659 ipv6_addr_copy(&fl6.daddr, &np->daddr);
660 ipv6_addr_copy(&fl.fl6_src, &np->saddr); 660 ipv6_addr_copy(&fl6.saddr, &np->saddr);
661 fl.fl6_flowlabel = np->flow_label; 661 fl6.flowlabel = np->flow_label;
662 fl.flowi_oif = sk->sk_bound_dev_if; 662 fl6.flowi6_oif = sk->sk_bound_dev_if;
663 fl.flowi_mark = sk->sk_mark; 663 fl6.flowi6_mark = sk->sk_mark;
664 fl.fl6_dport = inet->inet_dport; 664 fl6.uli.ports.dport = inet->inet_dport;
665 fl.fl6_sport = inet->inet_sport; 665 fl6.uli.ports.sport = inet->inet_sport;
666 security_sk_classify_flow(sk, &fl); 666 security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
667 667
668 final_p = fl6_update_dst(&fl, np->opt, &final); 668 final_p = fl6_update_dst(&fl6, np->opt, &final);
669 669
670 dst = ip6_dst_lookup_flow(sk, &fl, final_p, false); 670 dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
671 if (IS_ERR(dst)) { 671 if (IS_ERR(dst)) {
672 sk->sk_route_caps = 0; 672 sk->sk_route_caps = 0;
673 sk->sk_err_soft = -PTR_ERR(dst); 673 sk->sk_err_soft = -PTR_ERR(dst);
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index 07e03e68243b..04ae676d14ee 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -40,7 +40,7 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
40 struct ipv6_pinfo *np = inet6_sk(sk); 40 struct ipv6_pinfo *np = inet6_sk(sk);
41 struct in6_addr *daddr, *final_p, final; 41 struct in6_addr *daddr, *final_p, final;
42 struct dst_entry *dst; 42 struct dst_entry *dst;
43 struct flowi fl; 43 struct flowi6 fl6;
44 struct ip6_flowlabel *flowlabel = NULL; 44 struct ip6_flowlabel *flowlabel = NULL;
45 struct ipv6_txoptions *opt; 45 struct ipv6_txoptions *opt;
46 int addr_type; 46 int addr_type;
@@ -59,11 +59,11 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
59 if (usin->sin6_family != AF_INET6) 59 if (usin->sin6_family != AF_INET6)
60 return -EAFNOSUPPORT; 60 return -EAFNOSUPPORT;
61 61
62 memset(&fl, 0, sizeof(fl)); 62 memset(&fl6, 0, sizeof(fl6));
63 if (np->sndflow) { 63 if (np->sndflow) {
64 fl.fl6_flowlabel = usin->sin6_flowinfo&IPV6_FLOWINFO_MASK; 64 fl6.flowlabel = usin->sin6_flowinfo&IPV6_FLOWINFO_MASK;
65 if (fl.fl6_flowlabel&IPV6_FLOWLABEL_MASK) { 65 if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) {
66 flowlabel = fl6_sock_lookup(sk, fl.fl6_flowlabel); 66 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
67 if (flowlabel == NULL) 67 if (flowlabel == NULL)
68 return -EINVAL; 68 return -EINVAL;
69 ipv6_addr_copy(&usin->sin6_addr, &flowlabel->dst); 69 ipv6_addr_copy(&usin->sin6_addr, &flowlabel->dst);
@@ -137,7 +137,7 @@ ipv4_connected:
137 } 137 }
138 138
139 ipv6_addr_copy(&np->daddr, daddr); 139 ipv6_addr_copy(&np->daddr, daddr);
140 np->flow_label = fl.fl6_flowlabel; 140 np->flow_label = fl6.flowlabel;
141 141
142 inet->inet_dport = usin->sin6_port; 142 inet->inet_dport = usin->sin6_port;
143 143
@@ -146,23 +146,23 @@ ipv4_connected:
146 * destination cache for it. 146 * destination cache for it.
147 */ 147 */
148 148
149 fl.flowi_proto = sk->sk_protocol; 149 fl6.flowi6_proto = sk->sk_protocol;
150 ipv6_addr_copy(&fl.fl6_dst, &np->daddr); 150 ipv6_addr_copy(&fl6.daddr, &np->daddr);
151 ipv6_addr_copy(&fl.fl6_src, &np->saddr); 151 ipv6_addr_copy(&fl6.saddr, &np->saddr);
152 fl.flowi_oif = sk->sk_bound_dev_if; 152 fl6.flowi6_oif = sk->sk_bound_dev_if;
153 fl.flowi_mark = sk->sk_mark; 153 fl6.flowi6_mark = sk->sk_mark;
154 fl.fl6_dport = inet->inet_dport; 154 fl6.uli.ports.dport = inet->inet_dport;
155 fl.fl6_sport = inet->inet_sport; 155 fl6.uli.ports.sport = inet->inet_sport;
156 156
157 if (!fl.flowi_oif && (addr_type&IPV6_ADDR_MULTICAST)) 157 if (!fl6.flowi6_oif && (addr_type&IPV6_ADDR_MULTICAST))
158 fl.flowi_oif = np->mcast_oif; 158 fl6.flowi6_oif = np->mcast_oif;
159 159
160 security_sk_classify_flow(sk, &fl); 160 security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
161 161
162 opt = flowlabel ? flowlabel->opt : np->opt; 162 opt = flowlabel ? flowlabel->opt : np->opt;
163 final_p = fl6_update_dst(&fl, opt, &final); 163 final_p = fl6_update_dst(&fl6, opt, &final);
164 164
165 dst = ip6_dst_lookup_flow(sk, &fl, final_p, true); 165 dst = ip6_dst_lookup_flow(sk, &fl6, final_p, true);
166 err = 0; 166 err = 0;
167 if (IS_ERR(dst)) { 167 if (IS_ERR(dst)) {
168 err = PTR_ERR(dst); 168 err = PTR_ERR(dst);
@@ -172,20 +172,20 @@ ipv4_connected:
172 /* source address lookup done in ip6_dst_lookup */ 172 /* source address lookup done in ip6_dst_lookup */
173 173
174 if (ipv6_addr_any(&np->saddr)) 174 if (ipv6_addr_any(&np->saddr))
175 ipv6_addr_copy(&np->saddr, &fl.fl6_src); 175 ipv6_addr_copy(&np->saddr, &fl6.saddr);
176 176
177 if (ipv6_addr_any(&np->rcv_saddr)) { 177 if (ipv6_addr_any(&np->rcv_saddr)) {
178 ipv6_addr_copy(&np->rcv_saddr, &fl.fl6_src); 178 ipv6_addr_copy(&np->rcv_saddr, &fl6.saddr);
179 inet->inet_rcv_saddr = LOOPBACK4_IPV6; 179 inet->inet_rcv_saddr = LOOPBACK4_IPV6;
180 if (sk->sk_prot->rehash) 180 if (sk->sk_prot->rehash)
181 sk->sk_prot->rehash(sk); 181 sk->sk_prot->rehash(sk);
182 } 182 }
183 183
184 ip6_dst_store(sk, dst, 184 ip6_dst_store(sk, dst,
185 ipv6_addr_equal(&fl.fl6_dst, &np->daddr) ? 185 ipv6_addr_equal(&fl6.daddr, &np->daddr) ?
186 &np->daddr : NULL, 186 &np->daddr : NULL,
187#ifdef CONFIG_IPV6_SUBTREES 187#ifdef CONFIG_IPV6_SUBTREES
188 ipv6_addr_equal(&fl.fl6_src, &np->saddr) ? 188 ipv6_addr_equal(&fl6.saddr, &np->saddr) ?
189 &np->saddr : 189 &np->saddr :
190#endif 190#endif
191 NULL); 191 NULL);
@@ -231,7 +231,7 @@ void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err,
231 kfree_skb(skb); 231 kfree_skb(skb);
232} 232}
233 233
234void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info) 234void ipv6_local_error(struct sock *sk, int err, struct flowi6 *fl6, u32 info)
235{ 235{
236 struct ipv6_pinfo *np = inet6_sk(sk); 236 struct ipv6_pinfo *np = inet6_sk(sk);
237 struct sock_exterr_skb *serr; 237 struct sock_exterr_skb *serr;
@@ -250,7 +250,7 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info)
250 skb_put(skb, sizeof(struct ipv6hdr)); 250 skb_put(skb, sizeof(struct ipv6hdr));
251 skb_reset_network_header(skb); 251 skb_reset_network_header(skb);
252 iph = ipv6_hdr(skb); 252 iph = ipv6_hdr(skb);
253 ipv6_addr_copy(&iph->daddr, &fl->fl6_dst); 253 ipv6_addr_copy(&iph->daddr, &fl6->daddr);
254 254
255 serr = SKB_EXT_ERR(skb); 255 serr = SKB_EXT_ERR(skb);
256 serr->ee.ee_errno = err; 256 serr->ee.ee_errno = err;
@@ -261,7 +261,7 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info)
261 serr->ee.ee_info = info; 261 serr->ee.ee_info = info;
262 serr->ee.ee_data = 0; 262 serr->ee.ee_data = 0;
263 serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb); 263 serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb);
264 serr->port = fl->fl6_dport; 264 serr->port = fl6->uli.ports.dport;
265 265
266 __skb_pull(skb, skb_tail_pointer(skb) - skb->data); 266 __skb_pull(skb, skb_tail_pointer(skb) - skb->data);
267 skb_reset_transport_header(skb); 267 skb_reset_transport_header(skb);
@@ -270,7 +270,7 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info)
270 kfree_skb(skb); 270 kfree_skb(skb);
271} 271}
272 272
273void ipv6_local_rxpmtu(struct sock *sk, struct flowi *fl, u32 mtu) 273void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu)
274{ 274{
275 struct ipv6_pinfo *np = inet6_sk(sk); 275 struct ipv6_pinfo *np = inet6_sk(sk);
276 struct ipv6hdr *iph; 276 struct ipv6hdr *iph;
@@ -287,7 +287,7 @@ void ipv6_local_rxpmtu(struct sock *sk, struct flowi *fl, u32 mtu)
287 skb_put(skb, sizeof(struct ipv6hdr)); 287 skb_put(skb, sizeof(struct ipv6hdr));
288 skb_reset_network_header(skb); 288 skb_reset_network_header(skb);
289 iph = ipv6_hdr(skb); 289 iph = ipv6_hdr(skb);
290 ipv6_addr_copy(&iph->daddr, &fl->fl6_dst); 290 ipv6_addr_copy(&iph->daddr, &fl6->daddr);
291 291
292 mtu_info = IP6CBMTU(skb); 292 mtu_info = IP6CBMTU(skb);
293 if (!mtu_info) { 293 if (!mtu_info) {
@@ -299,7 +299,7 @@ void ipv6_local_rxpmtu(struct sock *sk, struct flowi *fl, u32 mtu)
299 mtu_info->ip6m_addr.sin6_family = AF_INET6; 299 mtu_info->ip6m_addr.sin6_family = AF_INET6;
300 mtu_info->ip6m_addr.sin6_port = 0; 300 mtu_info->ip6m_addr.sin6_port = 0;
301 mtu_info->ip6m_addr.sin6_flowinfo = 0; 301 mtu_info->ip6m_addr.sin6_flowinfo = 0;
302 mtu_info->ip6m_addr.sin6_scope_id = fl->flowi_oif; 302 mtu_info->ip6m_addr.sin6_scope_id = fl6->flowi6_oif;
303 ipv6_addr_copy(&mtu_info->ip6m_addr.sin6_addr, &ipv6_hdr(skb)->daddr); 303 ipv6_addr_copy(&mtu_info->ip6m_addr.sin6_addr, &ipv6_hdr(skb)->daddr);
304 304
305 __skb_pull(skb, skb_tail_pointer(skb) - skb->data); 305 __skb_pull(skb, skb_tail_pointer(skb) - skb->data);
@@ -593,7 +593,7 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
593} 593}
594 594
595int datagram_send_ctl(struct net *net, 595int datagram_send_ctl(struct net *net,
596 struct msghdr *msg, struct flowi *fl, 596 struct msghdr *msg, struct flowi6 *fl6,
597 struct ipv6_txoptions *opt, 597 struct ipv6_txoptions *opt,
598 int *hlimit, int *tclass, int *dontfrag) 598 int *hlimit, int *tclass, int *dontfrag)
599{ 599{
@@ -629,16 +629,17 @@ int datagram_send_ctl(struct net *net,
629 src_info = (struct in6_pktinfo *)CMSG_DATA(cmsg); 629 src_info = (struct in6_pktinfo *)CMSG_DATA(cmsg);
630 630
631 if (src_info->ipi6_ifindex) { 631 if (src_info->ipi6_ifindex) {
632 if (fl->flowi_oif && src_info->ipi6_ifindex != fl->flowi_oif) 632 if (fl6->flowi6_oif &&
633 src_info->ipi6_ifindex != fl6->flowi6_oif)
633 return -EINVAL; 634 return -EINVAL;
634 fl->flowi_oif = src_info->ipi6_ifindex; 635 fl6->flowi6_oif = src_info->ipi6_ifindex;
635 } 636 }
636 637
637 addr_type = __ipv6_addr_type(&src_info->ipi6_addr); 638 addr_type = __ipv6_addr_type(&src_info->ipi6_addr);
638 639
639 rcu_read_lock(); 640 rcu_read_lock();
640 if (fl->flowi_oif) { 641 if (fl6->flowi6_oif) {
641 dev = dev_get_by_index_rcu(net, fl->flowi_oif); 642 dev = dev_get_by_index_rcu(net, fl6->flowi6_oif);
642 if (!dev) { 643 if (!dev) {
643 rcu_read_unlock(); 644 rcu_read_unlock();
644 return -ENODEV; 645 return -ENODEV;
@@ -654,7 +655,7 @@ int datagram_send_ctl(struct net *net,
654 strict ? dev : NULL, 0)) 655 strict ? dev : NULL, 0))
655 err = -EINVAL; 656 err = -EINVAL;
656 else 657 else
657 ipv6_addr_copy(&fl->fl6_src, &src_info->ipi6_addr); 658 ipv6_addr_copy(&fl6->saddr, &src_info->ipi6_addr);
658 } 659 }
659 660
660 rcu_read_unlock(); 661 rcu_read_unlock();
@@ -671,13 +672,13 @@ int datagram_send_ctl(struct net *net,
671 goto exit_f; 672 goto exit_f;
672 } 673 }
673 674
674 if (fl->fl6_flowlabel&IPV6_FLOWINFO_MASK) { 675 if (fl6->flowlabel&IPV6_FLOWINFO_MASK) {
675 if ((fl->fl6_flowlabel^*(__be32 *)CMSG_DATA(cmsg))&~IPV6_FLOWINFO_MASK) { 676 if ((fl6->flowlabel^*(__be32 *)CMSG_DATA(cmsg))&~IPV6_FLOWINFO_MASK) {
676 err = -EINVAL; 677 err = -EINVAL;
677 goto exit_f; 678 goto exit_f;
678 } 679 }
679 } 680 }
680 fl->fl6_flowlabel = IPV6_FLOWINFO_MASK & *(__be32 *)CMSG_DATA(cmsg); 681 fl6->flowlabel = IPV6_FLOWINFO_MASK & *(__be32 *)CMSG_DATA(cmsg);
681 break; 682 break;
682 683
683 case IPV6_2292HOPOPTS: 684 case IPV6_2292HOPOPTS:
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 262f105d23b9..79a485e8a700 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -876,22 +876,22 @@ struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
876 * fl6_update_dst - update flowi destination address with info given 876 * fl6_update_dst - update flowi destination address with info given
877 * by srcrt option, if any. 877 * by srcrt option, if any.
878 * 878 *
879 * @fl: flowi for which fl6_dst is to be updated 879 * @fl6: flowi6 for which daddr is to be updated
880 * @opt: struct ipv6_txoptions in which to look for srcrt opt 880 * @opt: struct ipv6_txoptions in which to look for srcrt opt
881 * @orig: copy of original fl6_dst address if modified 881 * @orig: copy of original daddr address if modified
882 * 882 *
883 * Returns NULL if no txoptions or no srcrt, otherwise returns orig 883 * Returns NULL if no txoptions or no srcrt, otherwise returns orig
884 * and initial value of fl->fl6_dst set in orig 884 * and initial value of fl6->daddr set in orig
885 */ 885 */
886struct in6_addr *fl6_update_dst(struct flowi *fl, 886struct in6_addr *fl6_update_dst(struct flowi6 *fl6,
887 const struct ipv6_txoptions *opt, 887 const struct ipv6_txoptions *opt,
888 struct in6_addr *orig) 888 struct in6_addr *orig)
889{ 889{
890 if (!opt || !opt->srcrt) 890 if (!opt || !opt->srcrt)
891 return NULL; 891 return NULL;
892 892
893 ipv6_addr_copy(orig, &fl->fl6_dst); 893 ipv6_addr_copy(orig, &fl6->daddr);
894 ipv6_addr_copy(&fl->fl6_dst, ((struct rt0_hdr *)opt->srcrt)->addr); 894 ipv6_addr_copy(&fl6->daddr, ((struct rt0_hdr *)opt->srcrt)->addr);
895 return orig; 895 return orig;
896} 896}
897 897
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index d829874d8946..34d244df907d 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -29,7 +29,7 @@ struct fib6_rule
29 u8 tclass; 29 u8 tclass;
30}; 30};
31 31
32struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi *fl, 32struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6,
33 int flags, pol_lookup_t lookup) 33 int flags, pol_lookup_t lookup)
34{ 34{
35 struct fib_lookup_arg arg = { 35 struct fib_lookup_arg arg = {
@@ -37,7 +37,8 @@ struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi *fl,
37 .flags = FIB_LOOKUP_NOREF, 37 .flags = FIB_LOOKUP_NOREF,
38 }; 38 };
39 39
40 fib_rules_lookup(net->ipv6.fib6_rules_ops, fl, flags, &arg); 40 fib_rules_lookup(net->ipv6.fib6_rules_ops,
41 flowi6_to_flowi(fl6), flags, &arg);
41 42
42 if (arg.result) 43 if (arg.result)
43 return arg.result; 44 return arg.result;
@@ -49,6 +50,7 @@ struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi *fl,
49static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp, 50static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp,
50 int flags, struct fib_lookup_arg *arg) 51 int flags, struct fib_lookup_arg *arg)
51{ 52{
53 struct flowi6 *flp6 = &flp->u.ip6;
52 struct rt6_info *rt = NULL; 54 struct rt6_info *rt = NULL;
53 struct fib6_table *table; 55 struct fib6_table *table;
54 struct net *net = rule->fr_net; 56 struct net *net = rule->fr_net;
@@ -71,7 +73,7 @@ static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp,
71 73
72 table = fib6_get_table(net, rule->table); 74 table = fib6_get_table(net, rule->table);
73 if (table) 75 if (table)
74 rt = lookup(net, table, flp, flags); 76 rt = lookup(net, table, flp6, flags);
75 77
76 if (rt != net->ipv6.ip6_null_entry) { 78 if (rt != net->ipv6.ip6_null_entry) {
77 struct fib6_rule *r = (struct fib6_rule *)rule; 79 struct fib6_rule *r = (struct fib6_rule *)rule;
@@ -86,14 +88,14 @@ static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp,
86 88
87 if (ipv6_dev_get_saddr(net, 89 if (ipv6_dev_get_saddr(net,
88 ip6_dst_idev(&rt->dst)->dev, 90 ip6_dst_idev(&rt->dst)->dev,
89 &flp->fl6_dst, 91 &flp6->daddr,
90 rt6_flags2srcprefs(flags), 92 rt6_flags2srcprefs(flags),
91 &saddr)) 93 &saddr))
92 goto again; 94 goto again;
93 if (!ipv6_prefix_equal(&saddr, &r->src.addr, 95 if (!ipv6_prefix_equal(&saddr, &r->src.addr,
94 r->src.plen)) 96 r->src.plen))
95 goto again; 97 goto again;
96 ipv6_addr_copy(&flp->fl6_src, &saddr); 98 ipv6_addr_copy(&flp6->saddr, &saddr);
97 } 99 }
98 goto out; 100 goto out;
99 } 101 }
@@ -113,9 +115,10 @@ out:
113static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) 115static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
114{ 116{
115 struct fib6_rule *r = (struct fib6_rule *) rule; 117 struct fib6_rule *r = (struct fib6_rule *) rule;
118 struct flowi6 *fl6 = &fl->u.ip6;
116 119
117 if (r->dst.plen && 120 if (r->dst.plen &&
118 !ipv6_prefix_equal(&fl->fl6_dst, &r->dst.addr, r->dst.plen)) 121 !ipv6_prefix_equal(&fl6->daddr, &r->dst.addr, r->dst.plen))
119 return 0; 122 return 0;
120 123
121 /* 124 /*
@@ -125,14 +128,14 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
125 */ 128 */
126 if (r->src.plen) { 129 if (r->src.plen) {
127 if (flags & RT6_LOOKUP_F_HAS_SADDR) { 130 if (flags & RT6_LOOKUP_F_HAS_SADDR) {
128 if (!ipv6_prefix_equal(&fl->fl6_src, &r->src.addr, 131 if (!ipv6_prefix_equal(&fl6->saddr, &r->src.addr,
129 r->src.plen)) 132 r->src.plen))
130 return 0; 133 return 0;
131 } else if (!(r->common.flags & FIB_RULE_FIND_SADDR)) 134 } else if (!(r->common.flags & FIB_RULE_FIND_SADDR))
132 return 0; 135 return 0;
133 } 136 }
134 137
135 if (r->tclass && r->tclass != ((ntohl(fl->fl6_flowlabel) >> 20) & 0xff)) 138 if (r->tclass && r->tclass != ((ntohl(fl6->flowlabel) >> 20) & 0xff))
136 return 0; 139 return 0;
137 140
138 return 1; 141 return 1;
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 52ff7aa1f9fc..f7b9041f7845 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -158,7 +158,7 @@ static int is_ineligible(struct sk_buff *skb)
158 * Check the ICMP output rate limit 158 * Check the ICMP output rate limit
159 */ 159 */
160static inline bool icmpv6_xrlim_allow(struct sock *sk, u8 type, 160static inline bool icmpv6_xrlim_allow(struct sock *sk, u8 type,
161 struct flowi *fl) 161 struct flowi6 *fl6)
162{ 162{
163 struct dst_entry *dst; 163 struct dst_entry *dst;
164 struct net *net = sock_net(sk); 164 struct net *net = sock_net(sk);
@@ -177,7 +177,7 @@ static inline bool icmpv6_xrlim_allow(struct sock *sk, u8 type,
177 * XXX: perhaps the expire for routing entries cloned by 177 * XXX: perhaps the expire for routing entries cloned by
178 * this lookup should be more aggressive (not longer than timeout). 178 * this lookup should be more aggressive (not longer than timeout).
179 */ 179 */
180 dst = ip6_route_output(net, sk, fl); 180 dst = ip6_route_output(net, sk, fl6);
181 if (dst->error) { 181 if (dst->error) {
182 IP6_INC_STATS(net, ip6_dst_idev(dst), 182 IP6_INC_STATS(net, ip6_dst_idev(dst),
183 IPSTATS_MIB_OUTNOROUTES); 183 IPSTATS_MIB_OUTNOROUTES);
@@ -217,7 +217,7 @@ static __inline__ int opt_unrec(struct sk_buff *skb, __u32 offset)
217 return (*op & 0xC0) == 0x80; 217 return (*op & 0xC0) == 0x80;
218} 218}
219 219
220static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct icmp6hdr *thdr, int len) 220static int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6, struct icmp6hdr *thdr, int len)
221{ 221{
222 struct sk_buff *skb; 222 struct sk_buff *skb;
223 struct icmp6hdr *icmp6h; 223 struct icmp6hdr *icmp6h;
@@ -233,9 +233,9 @@ static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct
233 if (skb_queue_len(&sk->sk_write_queue) == 1) { 233 if (skb_queue_len(&sk->sk_write_queue) == 1) {
234 skb->csum = csum_partial(icmp6h, 234 skb->csum = csum_partial(icmp6h,
235 sizeof(struct icmp6hdr), skb->csum); 235 sizeof(struct icmp6hdr), skb->csum);
236 icmp6h->icmp6_cksum = csum_ipv6_magic(&fl->fl6_src, 236 icmp6h->icmp6_cksum = csum_ipv6_magic(&fl6->saddr,
237 &fl->fl6_dst, 237 &fl6->daddr,
238 len, fl->flowi_proto, 238 len, fl6->flowi6_proto,
239 skb->csum); 239 skb->csum);
240 } else { 240 } else {
241 __wsum tmp_csum = 0; 241 __wsum tmp_csum = 0;
@@ -246,9 +246,9 @@ static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct
246 246
247 tmp_csum = csum_partial(icmp6h, 247 tmp_csum = csum_partial(icmp6h,
248 sizeof(struct icmp6hdr), tmp_csum); 248 sizeof(struct icmp6hdr), tmp_csum);
249 icmp6h->icmp6_cksum = csum_ipv6_magic(&fl->fl6_src, 249 icmp6h->icmp6_cksum = csum_ipv6_magic(&fl6->saddr,
250 &fl->fl6_dst, 250 &fl6->daddr,
251 len, fl->flowi_proto, 251 len, fl6->flowi6_proto,
252 tmp_csum); 252 tmp_csum);
253 } 253 }
254 ip6_push_pending_frames(sk); 254 ip6_push_pending_frames(sk);
@@ -301,13 +301,13 @@ static inline void mip6_addr_swap(struct sk_buff *skb) {}
301#endif 301#endif
302 302
303static struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *skb, 303static struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *skb,
304 struct sock *sk, struct flowi *fl) 304 struct sock *sk, struct flowi6 *fl6)
305{ 305{
306 struct dst_entry *dst, *dst2; 306 struct dst_entry *dst, *dst2;
307 struct flowi fl2; 307 struct flowi6 fl2;
308 int err; 308 int err;
309 309
310 err = ip6_dst_lookup(sk, &dst, fl); 310 err = ip6_dst_lookup(sk, &dst, fl6);
311 if (err) 311 if (err)
312 return ERR_PTR(err); 312 return ERR_PTR(err);
313 313
@@ -324,7 +324,7 @@ static struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *sk
324 /* No need to clone since we're just using its address. */ 324 /* No need to clone since we're just using its address. */
325 dst2 = dst; 325 dst2 = dst;
326 326
327 dst = xfrm_lookup(net, dst, fl, sk, 0); 327 dst = xfrm_lookup(net, dst, flowi6_to_flowi(fl6), sk, 0);
328 if (!IS_ERR(dst)) { 328 if (!IS_ERR(dst)) {
329 if (dst != dst2) 329 if (dst != dst2)
330 return dst; 330 return dst;
@@ -335,7 +335,7 @@ static struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *sk
335 return dst; 335 return dst;
336 } 336 }
337 337
338 err = xfrm_decode_session_reverse(skb, &fl2, AF_INET6); 338 err = xfrm_decode_session_reverse(skb, flowi6_to_flowi(&fl2), AF_INET6);
339 if (err) 339 if (err)
340 goto relookup_failed; 340 goto relookup_failed;
341 341
@@ -343,7 +343,7 @@ static struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *sk
343 if (err) 343 if (err)
344 goto relookup_failed; 344 goto relookup_failed;
345 345
346 dst2 = xfrm_lookup(net, dst2, &fl2, sk, XFRM_LOOKUP_ICMP); 346 dst2 = xfrm_lookup(net, dst2, flowi6_to_flowi(&fl2), sk, XFRM_LOOKUP_ICMP);
347 if (!IS_ERR(dst2)) { 347 if (!IS_ERR(dst2)) {
348 dst_release(dst); 348 dst_release(dst);
349 dst = dst2; 349 dst = dst2;
@@ -375,7 +375,7 @@ void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
375 struct in6_addr *saddr = NULL; 375 struct in6_addr *saddr = NULL;
376 struct dst_entry *dst; 376 struct dst_entry *dst;
377 struct icmp6hdr tmp_hdr; 377 struct icmp6hdr tmp_hdr;
378 struct flowi fl; 378 struct flowi6 fl6;
379 struct icmpv6_msg msg; 379 struct icmpv6_msg msg;
380 int iif = 0; 380 int iif = 0;
381 int addr_type = 0; 381 int addr_type = 0;
@@ -442,22 +442,22 @@ void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
442 442
443 mip6_addr_swap(skb); 443 mip6_addr_swap(skb);
444 444
445 memset(&fl, 0, sizeof(fl)); 445 memset(&fl6, 0, sizeof(fl6));
446 fl.flowi_proto = IPPROTO_ICMPV6; 446 fl6.flowi6_proto = IPPROTO_ICMPV6;
447 ipv6_addr_copy(&fl.fl6_dst, &hdr->saddr); 447 ipv6_addr_copy(&fl6.daddr, &hdr->saddr);
448 if (saddr) 448 if (saddr)
449 ipv6_addr_copy(&fl.fl6_src, saddr); 449 ipv6_addr_copy(&fl6.saddr, saddr);
450 fl.flowi_oif = iif; 450 fl6.flowi6_oif = iif;
451 fl.fl6_icmp_type = type; 451 fl6.uli.icmpt.type = type;
452 fl.fl6_icmp_code = code; 452 fl6.uli.icmpt.code = code;
453 security_skb_classify_flow(skb, &fl); 453 security_skb_classify_flow(skb, flowi6_to_flowi(&fl6));
454 454
455 sk = icmpv6_xmit_lock(net); 455 sk = icmpv6_xmit_lock(net);
456 if (sk == NULL) 456 if (sk == NULL)
457 return; 457 return;
458 np = inet6_sk(sk); 458 np = inet6_sk(sk);
459 459
460 if (!icmpv6_xrlim_allow(sk, type, &fl)) 460 if (!icmpv6_xrlim_allow(sk, type, &fl6))
461 goto out; 461 goto out;
462 462
463 tmp_hdr.icmp6_type = type; 463 tmp_hdr.icmp6_type = type;
@@ -465,14 +465,14 @@ void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
465 tmp_hdr.icmp6_cksum = 0; 465 tmp_hdr.icmp6_cksum = 0;
466 tmp_hdr.icmp6_pointer = htonl(info); 466 tmp_hdr.icmp6_pointer = htonl(info);
467 467
468 if (!fl.flowi_oif && ipv6_addr_is_multicast(&fl.fl6_dst)) 468 if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr))
469 fl.flowi_oif = np->mcast_oif; 469 fl6.flowi6_oif = np->mcast_oif;
470 470
471 dst = icmpv6_route_lookup(net, skb, sk, &fl); 471 dst = icmpv6_route_lookup(net, skb, sk, &fl6);
472 if (IS_ERR(dst)) 472 if (IS_ERR(dst))
473 goto out; 473 goto out;
474 474
475 if (ipv6_addr_is_multicast(&fl.fl6_dst)) 475 if (ipv6_addr_is_multicast(&fl6.daddr))
476 hlimit = np->mcast_hops; 476 hlimit = np->mcast_hops;
477 else 477 else
478 hlimit = np->hop_limit; 478 hlimit = np->hop_limit;
@@ -495,14 +495,14 @@ void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
495 err = ip6_append_data(sk, icmpv6_getfrag, &msg, 495 err = ip6_append_data(sk, icmpv6_getfrag, &msg,
496 len + sizeof(struct icmp6hdr), 496 len + sizeof(struct icmp6hdr),
497 sizeof(struct icmp6hdr), hlimit, 497 sizeof(struct icmp6hdr), hlimit,
498 np->tclass, NULL, &fl, (struct rt6_info*)dst, 498 np->tclass, NULL, &fl6, (struct rt6_info*)dst,
499 MSG_DONTWAIT, np->dontfrag); 499 MSG_DONTWAIT, np->dontfrag);
500 if (err) { 500 if (err) {
501 ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTERRORS); 501 ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTERRORS);
502 ip6_flush_pending_frames(sk); 502 ip6_flush_pending_frames(sk);
503 goto out_put; 503 goto out_put;
504 } 504 }
505 err = icmpv6_push_pending_frames(sk, &fl, &tmp_hdr, len + sizeof(struct icmp6hdr)); 505 err = icmpv6_push_pending_frames(sk, &fl6, &tmp_hdr, len + sizeof(struct icmp6hdr));
506 506
507out_put: 507out_put:
508 if (likely(idev != NULL)) 508 if (likely(idev != NULL))
@@ -524,7 +524,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
524 struct in6_addr *saddr = NULL; 524 struct in6_addr *saddr = NULL;
525 struct icmp6hdr *icmph = icmp6_hdr(skb); 525 struct icmp6hdr *icmph = icmp6_hdr(skb);
526 struct icmp6hdr tmp_hdr; 526 struct icmp6hdr tmp_hdr;
527 struct flowi fl; 527 struct flowi6 fl6;
528 struct icmpv6_msg msg; 528 struct icmpv6_msg msg;
529 struct dst_entry *dst; 529 struct dst_entry *dst;
530 int err = 0; 530 int err = 0;
@@ -538,31 +538,31 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
538 memcpy(&tmp_hdr, icmph, sizeof(tmp_hdr)); 538 memcpy(&tmp_hdr, icmph, sizeof(tmp_hdr));
539 tmp_hdr.icmp6_type = ICMPV6_ECHO_REPLY; 539 tmp_hdr.icmp6_type = ICMPV6_ECHO_REPLY;
540 540
541 memset(&fl, 0, sizeof(fl)); 541 memset(&fl6, 0, sizeof(fl6));
542 fl.flowi_proto = IPPROTO_ICMPV6; 542 fl6.flowi6_proto = IPPROTO_ICMPV6;
543 ipv6_addr_copy(&fl.fl6_dst, &ipv6_hdr(skb)->saddr); 543 ipv6_addr_copy(&fl6.daddr, &ipv6_hdr(skb)->saddr);
544 if (saddr) 544 if (saddr)
545 ipv6_addr_copy(&fl.fl6_src, saddr); 545 ipv6_addr_copy(&fl6.saddr, saddr);
546 fl.flowi_oif = skb->dev->ifindex; 546 fl6.flowi6_oif = skb->dev->ifindex;
547 fl.fl6_icmp_type = ICMPV6_ECHO_REPLY; 547 fl6.uli.icmpt.type = ICMPV6_ECHO_REPLY;
548 security_skb_classify_flow(skb, &fl); 548 security_skb_classify_flow(skb, flowi6_to_flowi(&fl6));
549 549
550 sk = icmpv6_xmit_lock(net); 550 sk = icmpv6_xmit_lock(net);
551 if (sk == NULL) 551 if (sk == NULL)
552 return; 552 return;
553 np = inet6_sk(sk); 553 np = inet6_sk(sk);
554 554
555 if (!fl.flowi_oif && ipv6_addr_is_multicast(&fl.fl6_dst)) 555 if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr))
556 fl.flowi_oif = np->mcast_oif; 556 fl6.flowi6_oif = np->mcast_oif;
557 557
558 err = ip6_dst_lookup(sk, &dst, &fl); 558 err = ip6_dst_lookup(sk, &dst, &fl6);
559 if (err) 559 if (err)
560 goto out; 560 goto out;
561 dst = xfrm_lookup(net, dst, &fl, sk, 0); 561 dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), sk, 0);
562 if (IS_ERR(dst)) 562 if (IS_ERR(dst))
563 goto out; 563 goto out;
564 564
565 if (ipv6_addr_is_multicast(&fl.fl6_dst)) 565 if (ipv6_addr_is_multicast(&fl6.daddr))
566 hlimit = np->mcast_hops; 566 hlimit = np->mcast_hops;
567 else 567 else
568 hlimit = np->hop_limit; 568 hlimit = np->hop_limit;
@@ -576,7 +576,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
576 msg.type = ICMPV6_ECHO_REPLY; 576 msg.type = ICMPV6_ECHO_REPLY;
577 577
578 err = ip6_append_data(sk, icmpv6_getfrag, &msg, skb->len + sizeof(struct icmp6hdr), 578 err = ip6_append_data(sk, icmpv6_getfrag, &msg, skb->len + sizeof(struct icmp6hdr),
579 sizeof(struct icmp6hdr), hlimit, np->tclass, NULL, &fl, 579 sizeof(struct icmp6hdr), hlimit, np->tclass, NULL, &fl6,
580 (struct rt6_info*)dst, MSG_DONTWAIT, 580 (struct rt6_info*)dst, MSG_DONTWAIT,
581 np->dontfrag); 581 np->dontfrag);
582 582
@@ -585,7 +585,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
585 ip6_flush_pending_frames(sk); 585 ip6_flush_pending_frames(sk);
586 goto out_put; 586 goto out_put;
587 } 587 }
588 err = icmpv6_push_pending_frames(sk, &fl, &tmp_hdr, skb->len + sizeof(struct icmp6hdr)); 588 err = icmpv6_push_pending_frames(sk, &fl6, &tmp_hdr, skb->len + sizeof(struct icmp6hdr));
589 589
590out_put: 590out_put:
591 if (likely(idev != NULL)) 591 if (likely(idev != NULL))
@@ -784,20 +784,20 @@ drop_no_count:
784 return 0; 784 return 0;
785} 785}
786 786
787void icmpv6_flow_init(struct sock *sk, struct flowi *fl, 787void icmpv6_flow_init(struct sock *sk, struct flowi6 *fl6,
788 u8 type, 788 u8 type,
789 const struct in6_addr *saddr, 789 const struct in6_addr *saddr,
790 const struct in6_addr *daddr, 790 const struct in6_addr *daddr,
791 int oif) 791 int oif)
792{ 792{
793 memset(fl, 0, sizeof(*fl)); 793 memset(fl6, 0, sizeof(*fl6));
794 ipv6_addr_copy(&fl->fl6_src, saddr); 794 ipv6_addr_copy(&fl6->saddr, saddr);
795 ipv6_addr_copy(&fl->fl6_dst, daddr); 795 ipv6_addr_copy(&fl6->daddr, daddr);
796 fl->flowi_proto = IPPROTO_ICMPV6; 796 fl6->flowi6_proto = IPPROTO_ICMPV6;
797 fl->fl6_icmp_type = type; 797 fl6->uli.icmpt.type = type;
798 fl->fl6_icmp_code = 0; 798 fl6->uli.icmpt.code = 0;
799 fl->flowi_oif = oif; 799 fl6->flowi6_oif = oif;
800 security_sk_classify_flow(sk, fl); 800 security_sk_classify_flow(sk, flowi6_to_flowi(fl6));
801} 801}
802 802
803/* 803/*
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
index 1b06a24019c6..27d669160ba6 100644
--- a/net/ipv6/inet6_connection_sock.c
+++ b/net/ipv6/inet6_connection_sock.c
@@ -61,20 +61,20 @@ struct dst_entry *inet6_csk_route_req(struct sock *sk,
61 struct ipv6_pinfo *np = inet6_sk(sk); 61 struct ipv6_pinfo *np = inet6_sk(sk);
62 struct in6_addr *final_p, final; 62 struct in6_addr *final_p, final;
63 struct dst_entry *dst; 63 struct dst_entry *dst;
64 struct flowi fl; 64 struct flowi6 fl6;
65 65
66 memset(&fl, 0, sizeof(fl)); 66 memset(&fl6, 0, sizeof(fl6));
67 fl.flowi_proto = IPPROTO_TCP; 67 fl6.flowi6_proto = IPPROTO_TCP;
68 ipv6_addr_copy(&fl.fl6_dst, &treq->rmt_addr); 68 ipv6_addr_copy(&fl6.daddr, &treq->rmt_addr);
69 final_p = fl6_update_dst(&fl, np->opt, &final); 69 final_p = fl6_update_dst(&fl6, np->opt, &final);
70 ipv6_addr_copy(&fl.fl6_src, &treq->loc_addr); 70 ipv6_addr_copy(&fl6.saddr, &treq->loc_addr);
71 fl.flowi_oif = sk->sk_bound_dev_if; 71 fl6.flowi6_oif = sk->sk_bound_dev_if;
72 fl.flowi_mark = sk->sk_mark; 72 fl6.flowi6_mark = sk->sk_mark;
73 fl.fl6_dport = inet_rsk(req)->rmt_port; 73 fl6.uli.ports.dport = inet_rsk(req)->rmt_port;
74 fl.fl6_sport = inet_rsk(req)->loc_port; 74 fl6.uli.ports.sport = inet_rsk(req)->loc_port;
75 security_req_classify_flow(req, &fl); 75 security_req_classify_flow(req, flowi6_to_flowi(&fl6));
76 76
77 dst = ip6_dst_lookup_flow(sk, &fl, final_p, false); 77 dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
78 if (IS_ERR(dst)) 78 if (IS_ERR(dst))
79 return NULL; 79 return NULL;
80 80
@@ -208,28 +208,28 @@ int inet6_csk_xmit(struct sk_buff *skb)
208 struct sock *sk = skb->sk; 208 struct sock *sk = skb->sk;
209 struct inet_sock *inet = inet_sk(sk); 209 struct inet_sock *inet = inet_sk(sk);
210 struct ipv6_pinfo *np = inet6_sk(sk); 210 struct ipv6_pinfo *np = inet6_sk(sk);
211 struct flowi fl; 211 struct flowi6 fl6;
212 struct dst_entry *dst; 212 struct dst_entry *dst;
213 struct in6_addr *final_p, final; 213 struct in6_addr *final_p, final;
214 214
215 memset(&fl, 0, sizeof(fl)); 215 memset(&fl6, 0, sizeof(fl6));
216 fl.flowi_proto = sk->sk_protocol; 216 fl6.flowi6_proto = sk->sk_protocol;
217 ipv6_addr_copy(&fl.fl6_dst, &np->daddr); 217 ipv6_addr_copy(&fl6.daddr, &np->daddr);
218 ipv6_addr_copy(&fl.fl6_src, &np->saddr); 218 ipv6_addr_copy(&fl6.saddr, &np->saddr);
219 fl.fl6_flowlabel = np->flow_label; 219 fl6.flowlabel = np->flow_label;
220 IP6_ECN_flow_xmit(sk, fl.fl6_flowlabel); 220 IP6_ECN_flow_xmit(sk, fl6.flowlabel);
221 fl.flowi_oif = sk->sk_bound_dev_if; 221 fl6.flowi6_oif = sk->sk_bound_dev_if;
222 fl.flowi_mark = sk->sk_mark; 222 fl6.flowi6_mark = sk->sk_mark;
223 fl.fl6_sport = inet->inet_sport; 223 fl6.uli.ports.sport = inet->inet_sport;
224 fl.fl6_dport = inet->inet_dport; 224 fl6.uli.ports.dport = inet->inet_dport;
225 security_sk_classify_flow(sk, &fl); 225 security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
226 226
227 final_p = fl6_update_dst(&fl, np->opt, &final); 227 final_p = fl6_update_dst(&fl6, np->opt, &final);
228 228
229 dst = __inet6_csk_dst_check(sk, np->dst_cookie); 229 dst = __inet6_csk_dst_check(sk, np->dst_cookie);
230 230
231 if (dst == NULL) { 231 if (dst == NULL) {
232 dst = ip6_dst_lookup_flow(sk, &fl, final_p, false); 232 dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
233 233
234 if (IS_ERR(dst)) { 234 if (IS_ERR(dst)) {
235 sk->sk_err_soft = -PTR_ERR(dst); 235 sk->sk_err_soft = -PTR_ERR(dst);
@@ -244,9 +244,9 @@ int inet6_csk_xmit(struct sk_buff *skb)
244 skb_dst_set(skb, dst_clone(dst)); 244 skb_dst_set(skb, dst_clone(dst));
245 245
246 /* Restore final destination back after routing done */ 246 /* Restore final destination back after routing done */
247 ipv6_addr_copy(&fl.fl6_dst, &np->daddr); 247 ipv6_addr_copy(&fl6.daddr, &np->daddr);
248 248
249 return ip6_xmit(sk, skb, &fl, np->opt); 249 return ip6_xmit(sk, skb, &fl6, np->opt);
250} 250}
251 251
252EXPORT_SYMBOL_GPL(inet6_csk_xmit); 252EXPORT_SYMBOL_GPL(inet6_csk_xmit);
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index de382114609b..7548905e79e1 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -260,10 +260,10 @@ struct fib6_table *fib6_get_table(struct net *net, u32 id)
260 return net->ipv6.fib6_main_tbl; 260 return net->ipv6.fib6_main_tbl;
261} 261}
262 262
263struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi *fl, 263struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6,
264 int flags, pol_lookup_t lookup) 264 int flags, pol_lookup_t lookup)
265{ 265{
266 return (struct dst_entry *) lookup(net, net->ipv6.fib6_main_tbl, fl, flags); 266 return (struct dst_entry *) lookup(net, net->ipv6.fib6_main_tbl, fl6, flags);
267} 267}
268 268
269static void __net_init fib6_tables_init(struct net *net) 269static void __net_init fib6_tables_init(struct net *net)
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index c8fa470b174b..f3caf1b8d572 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -342,7 +342,7 @@ fl_create(struct net *net, struct in6_flowlabel_req *freq, char __user *optval,
342 342
343 if (olen > 0) { 343 if (olen > 0) {
344 struct msghdr msg; 344 struct msghdr msg;
345 struct flowi flowi; 345 struct flowi6 flowi6;
346 int junk; 346 int junk;
347 347
348 err = -ENOMEM; 348 err = -ENOMEM;
@@ -358,9 +358,9 @@ fl_create(struct net *net, struct in6_flowlabel_req *freq, char __user *optval,
358 358
359 msg.msg_controllen = olen; 359 msg.msg_controllen = olen;
360 msg.msg_control = (void*)(fl->opt+1); 360 msg.msg_control = (void*)(fl->opt+1);
361 flowi.flowi_oif = 0; 361 memset(&flowi6, 0, sizeof(flowi6));
362 362
363 err = datagram_send_ctl(net, &msg, &flowi, fl->opt, &junk, 363 err = datagram_send_ctl(net, &msg, &flowi6, fl->opt, &junk,
364 &junk, &junk); 364 &junk, &junk);
365 if (err) 365 if (err)
366 goto done; 366 goto done;
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 3d0f2ac868a7..18208876aa8a 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -174,15 +174,15 @@ int ip6_output(struct sk_buff *skb)
174 * xmit an sk_buff (used by TCP, SCTP and DCCP) 174 * xmit an sk_buff (used by TCP, SCTP and DCCP)
175 */ 175 */
176 176
177int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, 177int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
178 struct ipv6_txoptions *opt) 178 struct ipv6_txoptions *opt)
179{ 179{
180 struct net *net = sock_net(sk); 180 struct net *net = sock_net(sk);
181 struct ipv6_pinfo *np = inet6_sk(sk); 181 struct ipv6_pinfo *np = inet6_sk(sk);
182 struct in6_addr *first_hop = &fl->fl6_dst; 182 struct in6_addr *first_hop = &fl6->daddr;
183 struct dst_entry *dst = skb_dst(skb); 183 struct dst_entry *dst = skb_dst(skb);
184 struct ipv6hdr *hdr; 184 struct ipv6hdr *hdr;
185 u8 proto = fl->flowi_proto; 185 u8 proto = fl6->flowi6_proto;
186 int seg_len = skb->len; 186 int seg_len = skb->len;
187 int hlimit = -1; 187 int hlimit = -1;
188 int tclass = 0; 188 int tclass = 0;
@@ -230,13 +230,13 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
230 if (hlimit < 0) 230 if (hlimit < 0)
231 hlimit = ip6_dst_hoplimit(dst); 231 hlimit = ip6_dst_hoplimit(dst);
232 232
233 *(__be32 *)hdr = htonl(0x60000000 | (tclass << 20)) | fl->fl6_flowlabel; 233 *(__be32 *)hdr = htonl(0x60000000 | (tclass << 20)) | fl6->flowlabel;
234 234
235 hdr->payload_len = htons(seg_len); 235 hdr->payload_len = htons(seg_len);
236 hdr->nexthdr = proto; 236 hdr->nexthdr = proto;
237 hdr->hop_limit = hlimit; 237 hdr->hop_limit = hlimit;
238 238
239 ipv6_addr_copy(&hdr->saddr, &fl->fl6_src); 239 ipv6_addr_copy(&hdr->saddr, &fl6->saddr);
240 ipv6_addr_copy(&hdr->daddr, first_hop); 240 ipv6_addr_copy(&hdr->daddr, first_hop);
241 241
242 skb->priority = sk->sk_priority; 242 skb->priority = sk->sk_priority;
@@ -879,7 +879,7 @@ static inline int ip6_rt_check(struct rt6key *rt_key,
879 879
880static struct dst_entry *ip6_sk_dst_check(struct sock *sk, 880static struct dst_entry *ip6_sk_dst_check(struct sock *sk,
881 struct dst_entry *dst, 881 struct dst_entry *dst,
882 struct flowi *fl) 882 struct flowi6 *fl6)
883{ 883{
884 struct ipv6_pinfo *np = inet6_sk(sk); 884 struct ipv6_pinfo *np = inet6_sk(sk);
885 struct rt6_info *rt = (struct rt6_info *)dst; 885 struct rt6_info *rt = (struct rt6_info *)dst;
@@ -904,11 +904,11 @@ static struct dst_entry *ip6_sk_dst_check(struct sock *sk,
904 * sockets. 904 * sockets.
905 * 2. oif also should be the same. 905 * 2. oif also should be the same.
906 */ 906 */
907 if (ip6_rt_check(&rt->rt6i_dst, &fl->fl6_dst, np->daddr_cache) || 907 if (ip6_rt_check(&rt->rt6i_dst, &fl6->daddr, np->daddr_cache) ||
908#ifdef CONFIG_IPV6_SUBTREES 908#ifdef CONFIG_IPV6_SUBTREES
909 ip6_rt_check(&rt->rt6i_src, &fl->fl6_src, np->saddr_cache) || 909 ip6_rt_check(&rt->rt6i_src, &fl6->saddr, np->saddr_cache) ||
910#endif 910#endif
911 (fl->flowi_oif && fl->flowi_oif != dst->dev->ifindex)) { 911 (fl6->flowi6_oif && fl6->flowi6_oif != dst->dev->ifindex)) {
912 dst_release(dst); 912 dst_release(dst);
913 dst = NULL; 913 dst = NULL;
914 } 914 }
@@ -918,22 +918,22 @@ out:
918} 918}
919 919
920static int ip6_dst_lookup_tail(struct sock *sk, 920static int ip6_dst_lookup_tail(struct sock *sk,
921 struct dst_entry **dst, struct flowi *fl) 921 struct dst_entry **dst, struct flowi6 *fl6)
922{ 922{
923 int err; 923 int err;
924 struct net *net = sock_net(sk); 924 struct net *net = sock_net(sk);
925 925
926 if (*dst == NULL) 926 if (*dst == NULL)
927 *dst = ip6_route_output(net, sk, fl); 927 *dst = ip6_route_output(net, sk, fl6);
928 928
929 if ((err = (*dst)->error)) 929 if ((err = (*dst)->error))
930 goto out_err_release; 930 goto out_err_release;
931 931
932 if (ipv6_addr_any(&fl->fl6_src)) { 932 if (ipv6_addr_any(&fl6->saddr)) {
933 err = ipv6_dev_get_saddr(net, ip6_dst_idev(*dst)->dev, 933 err = ipv6_dev_get_saddr(net, ip6_dst_idev(*dst)->dev,
934 &fl->fl6_dst, 934 &fl6->daddr,
935 sk ? inet6_sk(sk)->srcprefs : 0, 935 sk ? inet6_sk(sk)->srcprefs : 0,
936 &fl->fl6_src); 936 &fl6->saddr);
937 if (err) 937 if (err)
938 goto out_err_release; 938 goto out_err_release;
939 } 939 }
@@ -949,10 +949,10 @@ static int ip6_dst_lookup_tail(struct sock *sk,
949 */ 949 */
950 if ((*dst)->neighbour && !((*dst)->neighbour->nud_state & NUD_VALID)) { 950 if ((*dst)->neighbour && !((*dst)->neighbour->nud_state & NUD_VALID)) {
951 struct inet6_ifaddr *ifp; 951 struct inet6_ifaddr *ifp;
952 struct flowi fl_gw; 952 struct flowi6 fl_gw6;
953 int redirect; 953 int redirect;
954 954
955 ifp = ipv6_get_ifaddr(net, &fl->fl6_src, 955 ifp = ipv6_get_ifaddr(net, &fl6->saddr,
956 (*dst)->dev, 1); 956 (*dst)->dev, 1);
957 957
958 redirect = (ifp && ifp->flags & IFA_F_OPTIMISTIC); 958 redirect = (ifp && ifp->flags & IFA_F_OPTIMISTIC);
@@ -965,9 +965,9 @@ static int ip6_dst_lookup_tail(struct sock *sk,
965 * default router instead 965 * default router instead
966 */ 966 */
967 dst_release(*dst); 967 dst_release(*dst);
968 memcpy(&fl_gw, fl, sizeof(struct flowi)); 968 memcpy(&fl_gw6, fl6, sizeof(struct flowi6));
969 memset(&fl_gw.fl6_dst, 0, sizeof(struct in6_addr)); 969 memset(&fl_gw6.daddr, 0, sizeof(struct in6_addr));
970 *dst = ip6_route_output(net, sk, &fl_gw); 970 *dst = ip6_route_output(net, sk, &fl_gw6);
971 if ((err = (*dst)->error)) 971 if ((err = (*dst)->error))
972 goto out_err_release; 972 goto out_err_release;
973 } 973 }
@@ -988,23 +988,23 @@ out_err_release:
988 * ip6_dst_lookup - perform route lookup on flow 988 * ip6_dst_lookup - perform route lookup on flow
989 * @sk: socket which provides route info 989 * @sk: socket which provides route info
990 * @dst: pointer to dst_entry * for result 990 * @dst: pointer to dst_entry * for result
991 * @fl: flow to lookup 991 * @fl6: flow to lookup
992 * 992 *
993 * This function performs a route lookup on the given flow. 993 * This function performs a route lookup on the given flow.
994 * 994 *
995 * It returns zero on success, or a standard errno code on error. 995 * It returns zero on success, or a standard errno code on error.
996 */ 996 */
997int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl) 997int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi6 *fl6)
998{ 998{
999 *dst = NULL; 999 *dst = NULL;
1000 return ip6_dst_lookup_tail(sk, dst, fl); 1000 return ip6_dst_lookup_tail(sk, dst, fl6);
1001} 1001}
1002EXPORT_SYMBOL_GPL(ip6_dst_lookup); 1002EXPORT_SYMBOL_GPL(ip6_dst_lookup);
1003 1003
1004/** 1004/**
1005 * ip6_dst_lookup_flow - perform route lookup on flow with ipsec 1005 * ip6_dst_lookup_flow - perform route lookup on flow with ipsec
1006 * @sk: socket which provides route info 1006 * @sk: socket which provides route info
1007 * @fl: flow to lookup 1007 * @fl6: flow to lookup
1008 * @final_dst: final destination address for ipsec lookup 1008 * @final_dst: final destination address for ipsec lookup
1009 * @can_sleep: we are in a sleepable context 1009 * @can_sleep: we are in a sleepable context
1010 * 1010 *
@@ -1013,29 +1013,29 @@ EXPORT_SYMBOL_GPL(ip6_dst_lookup);
1013 * It returns a valid dst pointer on success, or a pointer encoded 1013 * It returns a valid dst pointer on success, or a pointer encoded
1014 * error code. 1014 * error code.
1015 */ 1015 */
1016struct dst_entry *ip6_dst_lookup_flow(struct sock *sk, struct flowi *fl, 1016struct dst_entry *ip6_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6,
1017 const struct in6_addr *final_dst, 1017 const struct in6_addr *final_dst,
1018 bool can_sleep) 1018 bool can_sleep)
1019{ 1019{
1020 struct dst_entry *dst = NULL; 1020 struct dst_entry *dst = NULL;
1021 int err; 1021 int err;
1022 1022
1023 err = ip6_dst_lookup_tail(sk, &dst, fl); 1023 err = ip6_dst_lookup_tail(sk, &dst, fl6);
1024 if (err) 1024 if (err)
1025 return ERR_PTR(err); 1025 return ERR_PTR(err);
1026 if (final_dst) 1026 if (final_dst)
1027 ipv6_addr_copy(&fl->fl6_dst, final_dst); 1027 ipv6_addr_copy(&fl6->daddr, final_dst);
1028 if (can_sleep) 1028 if (can_sleep)
1029 fl->flowi_flags |= FLOWI_FLAG_CAN_SLEEP; 1029 fl6->flowi6_flags |= FLOWI_FLAG_CAN_SLEEP;
1030 1030
1031 return xfrm_lookup(sock_net(sk), dst, fl, sk, 0); 1031 return xfrm_lookup(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0);
1032} 1032}
1033EXPORT_SYMBOL_GPL(ip6_dst_lookup_flow); 1033EXPORT_SYMBOL_GPL(ip6_dst_lookup_flow);
1034 1034
1035/** 1035/**
1036 * ip6_sk_dst_lookup_flow - perform socket cached route lookup on flow 1036 * ip6_sk_dst_lookup_flow - perform socket cached route lookup on flow
1037 * @sk: socket which provides the dst cache and route info 1037 * @sk: socket which provides the dst cache and route info
1038 * @fl: flow to lookup 1038 * @fl6: flow to lookup
1039 * @final_dst: final destination address for ipsec lookup 1039 * @final_dst: final destination address for ipsec lookup
1040 * @can_sleep: we are in a sleepable context 1040 * @can_sleep: we are in a sleepable context
1041 * 1041 *
@@ -1047,24 +1047,24 @@ EXPORT_SYMBOL_GPL(ip6_dst_lookup_flow);
1047 * It returns a valid dst pointer on success, or a pointer encoded 1047 * It returns a valid dst pointer on success, or a pointer encoded
1048 * error code. 1048 * error code.
1049 */ 1049 */
1050struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi *fl, 1050struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6,
1051 const struct in6_addr *final_dst, 1051 const struct in6_addr *final_dst,
1052 bool can_sleep) 1052 bool can_sleep)
1053{ 1053{
1054 struct dst_entry *dst = sk_dst_check(sk, inet6_sk(sk)->dst_cookie); 1054 struct dst_entry *dst = sk_dst_check(sk, inet6_sk(sk)->dst_cookie);
1055 int err; 1055 int err;
1056 1056
1057 dst = ip6_sk_dst_check(sk, dst, fl); 1057 dst = ip6_sk_dst_check(sk, dst, fl6);
1058 1058
1059 err = ip6_dst_lookup_tail(sk, &dst, fl); 1059 err = ip6_dst_lookup_tail(sk, &dst, fl6);
1060 if (err) 1060 if (err)
1061 return ERR_PTR(err); 1061 return ERR_PTR(err);
1062 if (final_dst) 1062 if (final_dst)
1063 ipv6_addr_copy(&fl->fl6_dst, final_dst); 1063 ipv6_addr_copy(&fl6->daddr, final_dst);
1064 if (can_sleep) 1064 if (can_sleep)
1065 fl->flowi_flags |= FLOWI_FLAG_CAN_SLEEP; 1065 fl6->flowi6_flags |= FLOWI_FLAG_CAN_SLEEP;
1066 1066
1067 return xfrm_lookup(sock_net(sk), dst, fl, sk, 0); 1067 return xfrm_lookup(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0);
1068} 1068}
1069EXPORT_SYMBOL_GPL(ip6_sk_dst_lookup_flow); 1069EXPORT_SYMBOL_GPL(ip6_sk_dst_lookup_flow);
1070 1070
@@ -1145,7 +1145,7 @@ static inline struct ipv6_rt_hdr *ip6_rthdr_dup(struct ipv6_rt_hdr *src,
1145int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, 1145int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
1146 int offset, int len, int odd, struct sk_buff *skb), 1146 int offset, int len, int odd, struct sk_buff *skb),
1147 void *from, int length, int transhdrlen, 1147 void *from, int length, int transhdrlen,
1148 int hlimit, int tclass, struct ipv6_txoptions *opt, struct flowi *fl, 1148 int hlimit, int tclass, struct ipv6_txoptions *opt, struct flowi6 *fl6,
1149 struct rt6_info *rt, unsigned int flags, int dontfrag) 1149 struct rt6_info *rt, unsigned int flags, int dontfrag)
1150{ 1150{
1151 struct inet_sock *inet = inet_sk(sk); 1151 struct inet_sock *inet = inet_sk(sk);
@@ -1203,7 +1203,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
1203 } 1203 }
1204 dst_hold(&rt->dst); 1204 dst_hold(&rt->dst);
1205 inet->cork.dst = &rt->dst; 1205 inet->cork.dst = &rt->dst;
1206 inet->cork.fl = *fl; 1206 inet->cork.fl.u.ip6 = *fl6;
1207 np->cork.hop_limit = hlimit; 1207 np->cork.hop_limit = hlimit;
1208 np->cork.tclass = tclass; 1208 np->cork.tclass = tclass;
1209 mtu = np->pmtudisc == IPV6_PMTUDISC_PROBE ? 1209 mtu = np->pmtudisc == IPV6_PMTUDISC_PROBE ?
@@ -1224,7 +1224,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
1224 transhdrlen += exthdrlen; 1224 transhdrlen += exthdrlen;
1225 } else { 1225 } else {
1226 rt = (struct rt6_info *)inet->cork.dst; 1226 rt = (struct rt6_info *)inet->cork.dst;
1227 fl = &inet->cork.fl; 1227 fl6 = &inet->cork.fl.u.ip6;
1228 opt = np->cork.opt; 1228 opt = np->cork.opt;
1229 transhdrlen = 0; 1229 transhdrlen = 0;
1230 exthdrlen = 0; 1230 exthdrlen = 0;
@@ -1239,7 +1239,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
1239 1239
1240 if (mtu <= sizeof(struct ipv6hdr) + IPV6_MAXPLEN) { 1240 if (mtu <= sizeof(struct ipv6hdr) + IPV6_MAXPLEN) {
1241 if (inet->cork.length + length > sizeof(struct ipv6hdr) + IPV6_MAXPLEN - fragheaderlen) { 1241 if (inet->cork.length + length > sizeof(struct ipv6hdr) + IPV6_MAXPLEN - fragheaderlen) {
1242 ipv6_local_error(sk, EMSGSIZE, fl, mtu-exthdrlen); 1242 ipv6_local_error(sk, EMSGSIZE, fl6, mtu-exthdrlen);
1243 return -EMSGSIZE; 1243 return -EMSGSIZE;
1244 } 1244 }
1245 } 1245 }
@@ -1271,7 +1271,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
1271 if (length > mtu) { 1271 if (length > mtu) {
1272 int proto = sk->sk_protocol; 1272 int proto = sk->sk_protocol;
1273 if (dontfrag && (proto == IPPROTO_UDP || proto == IPPROTO_RAW)){ 1273 if (dontfrag && (proto == IPPROTO_UDP || proto == IPPROTO_RAW)){
1274 ipv6_local_rxpmtu(sk, fl, mtu-exthdrlen); 1274 ipv6_local_rxpmtu(sk, fl6, mtu-exthdrlen);
1275 return -EMSGSIZE; 1275 return -EMSGSIZE;
1276 } 1276 }
1277 1277
@@ -1516,8 +1516,8 @@ int ip6_push_pending_frames(struct sock *sk)
1516 struct ipv6hdr *hdr; 1516 struct ipv6hdr *hdr;
1517 struct ipv6_txoptions *opt = np->cork.opt; 1517 struct ipv6_txoptions *opt = np->cork.opt;
1518 struct rt6_info *rt = (struct rt6_info *)inet->cork.dst; 1518 struct rt6_info *rt = (struct rt6_info *)inet->cork.dst;
1519 struct flowi *fl = &inet->cork.fl; 1519 struct flowi6 *fl6 = &inet->cork.fl.u.ip6;
1520 unsigned char proto = fl->flowi_proto; 1520 unsigned char proto = fl6->flowi6_proto;
1521 int err = 0; 1521 int err = 0;
1522 1522
1523 if ((skb = __skb_dequeue(&sk->sk_write_queue)) == NULL) 1523 if ((skb = __skb_dequeue(&sk->sk_write_queue)) == NULL)
@@ -1542,7 +1542,7 @@ int ip6_push_pending_frames(struct sock *sk)
1542 if (np->pmtudisc < IPV6_PMTUDISC_DO) 1542 if (np->pmtudisc < IPV6_PMTUDISC_DO)
1543 skb->local_df = 1; 1543 skb->local_df = 1;
1544 1544
1545 ipv6_addr_copy(final_dst, &fl->fl6_dst); 1545 ipv6_addr_copy(final_dst, &fl6->daddr);
1546 __skb_pull(skb, skb_network_header_len(skb)); 1546 __skb_pull(skb, skb_network_header_len(skb));
1547 if (opt && opt->opt_flen) 1547 if (opt && opt->opt_flen)
1548 ipv6_push_frag_opts(skb, opt, &proto); 1548 ipv6_push_frag_opts(skb, opt, &proto);
@@ -1553,12 +1553,12 @@ int ip6_push_pending_frames(struct sock *sk)
1553 skb_reset_network_header(skb); 1553 skb_reset_network_header(skb);
1554 hdr = ipv6_hdr(skb); 1554 hdr = ipv6_hdr(skb);
1555 1555
1556 *(__be32*)hdr = fl->fl6_flowlabel | 1556 *(__be32*)hdr = fl6->flowlabel |
1557 htonl(0x60000000 | ((int)np->cork.tclass << 20)); 1557 htonl(0x60000000 | ((int)np->cork.tclass << 20));
1558 1558
1559 hdr->hop_limit = np->cork.hop_limit; 1559 hdr->hop_limit = np->cork.hop_limit;
1560 hdr->nexthdr = proto; 1560 hdr->nexthdr = proto;
1561 ipv6_addr_copy(&hdr->saddr, &fl->fl6_src); 1561 ipv6_addr_copy(&hdr->saddr, &fl6->saddr);
1562 ipv6_addr_copy(&hdr->daddr, final_dst); 1562 ipv6_addr_copy(&hdr->daddr, final_dst);
1563 1563
1564 skb->priority = sk->sk_priority; 1564 skb->priority = sk->sk_priority;
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
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 61a8be3ac4e4..7ff0343e05c7 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -135,14 +135,15 @@ static struct mr6_table *ip6mr_get_table(struct net *net, u32 id)
135 return NULL; 135 return NULL;
136} 136}
137 137
138static int ip6mr_fib_lookup(struct net *net, struct flowi *flp, 138static int ip6mr_fib_lookup(struct net *net, struct flowi6 *flp6,
139 struct mr6_table **mrt) 139 struct mr6_table **mrt)
140{ 140{
141 struct ip6mr_result res; 141 struct ip6mr_result res;
142 struct fib_lookup_arg arg = { .result = &res, }; 142 struct fib_lookup_arg arg = { .result = &res, };
143 int err; 143 int err;
144 144
145 err = fib_rules_lookup(net->ipv6.mr6_rules_ops, flp, 0, &arg); 145 err = fib_rules_lookup(net->ipv6.mr6_rules_ops,
146 flowi6_to_flowi(flp6), 0, &arg);
146 if (err < 0) 147 if (err < 0)
147 return err; 148 return err;
148 *mrt = res.mrt; 149 *mrt = res.mrt;
@@ -270,7 +271,7 @@ static struct mr6_table *ip6mr_get_table(struct net *net, u32 id)
270 return net->ipv6.mrt6; 271 return net->ipv6.mrt6;
271} 272}
272 273
273static int ip6mr_fib_lookup(struct net *net, struct flowi *flp, 274static int ip6mr_fib_lookup(struct net *net, struct flowi6 *flp6,
274 struct mr6_table **mrt) 275 struct mr6_table **mrt)
275{ 276{
276 *mrt = net->ipv6.mrt6; 277 *mrt = net->ipv6.mrt6;
@@ -617,9 +618,9 @@ static int pim6_rcv(struct sk_buff *skb)
617 struct net_device *reg_dev = NULL; 618 struct net_device *reg_dev = NULL;
618 struct net *net = dev_net(skb->dev); 619 struct net *net = dev_net(skb->dev);
619 struct mr6_table *mrt; 620 struct mr6_table *mrt;
620 struct flowi fl = { 621 struct flowi6 fl6 = {
621 .flowi_iif = skb->dev->ifindex, 622 .flowi6_iif = skb->dev->ifindex,
622 .flowi_mark = skb->mark, 623 .flowi6_mark = skb->mark,
623 }; 624 };
624 int reg_vif_num; 625 int reg_vif_num;
625 626
@@ -644,7 +645,7 @@ static int pim6_rcv(struct sk_buff *skb)
644 ntohs(encap->payload_len) + sizeof(*pim) > skb->len) 645 ntohs(encap->payload_len) + sizeof(*pim) > skb->len)
645 goto drop; 646 goto drop;
646 647
647 if (ip6mr_fib_lookup(net, &fl, &mrt) < 0) 648 if (ip6mr_fib_lookup(net, &fl6, &mrt) < 0)
648 goto drop; 649 goto drop;
649 reg_vif_num = mrt->mroute_reg_vif_num; 650 reg_vif_num = mrt->mroute_reg_vif_num;
650 651
@@ -687,14 +688,14 @@ static netdev_tx_t reg_vif_xmit(struct sk_buff *skb,
687{ 688{
688 struct net *net = dev_net(dev); 689 struct net *net = dev_net(dev);
689 struct mr6_table *mrt; 690 struct mr6_table *mrt;
690 struct flowi fl = { 691 struct flowi6 fl6 = {
691 .flowi_oif = dev->ifindex, 692 .flowi6_oif = dev->ifindex,
692 .flowi_iif = skb->skb_iif, 693 .flowi6_iif = skb->skb_iif,
693 .flowi_mark = skb->mark, 694 .flowi6_mark = skb->mark,
694 }; 695 };
695 int err; 696 int err;
696 697
697 err = ip6mr_fib_lookup(net, &fl, &mrt); 698 err = ip6mr_fib_lookup(net, &fl6, &mrt);
698 if (err < 0) 699 if (err < 0)
699 return err; 700 return err;
700 701
@@ -1547,13 +1548,13 @@ int ip6mr_sk_done(struct sock *sk)
1547struct sock *mroute6_socket(struct net *net, struct sk_buff *skb) 1548struct sock *mroute6_socket(struct net *net, struct sk_buff *skb)
1548{ 1549{
1549 struct mr6_table *mrt; 1550 struct mr6_table *mrt;
1550 struct flowi fl = { 1551 struct flowi6 fl6 = {
1551 .flowi_iif = skb->skb_iif, 1552 .flowi6_iif = skb->skb_iif,
1552 .flowi_oif = skb->dev->ifindex, 1553 .flowi6_oif = skb->dev->ifindex,
1553 .flowi_mark= skb->mark, 1554 .flowi6_mark = skb->mark,
1554 }; 1555 };
1555 1556
1556 if (ip6mr_fib_lookup(net, &fl, &mrt) < 0) 1557 if (ip6mr_fib_lookup(net, &fl6, &mrt) < 0)
1557 return NULL; 1558 return NULL;
1558 1559
1559 return mrt->mroute6_sk; 1560 return mrt->mroute6_sk;
@@ -1897,7 +1898,7 @@ static int ip6mr_forward2(struct net *net, struct mr6_table *mrt,
1897 struct mif_device *vif = &mrt->vif6_table[vifi]; 1898 struct mif_device *vif = &mrt->vif6_table[vifi];
1898 struct net_device *dev; 1899 struct net_device *dev;
1899 struct dst_entry *dst; 1900 struct dst_entry *dst;
1900 struct flowi fl; 1901 struct flowi6 fl6;
1901 1902
1902 if (vif->dev == NULL) 1903 if (vif->dev == NULL)
1903 goto out_free; 1904 goto out_free;
@@ -1915,12 +1916,12 @@ static int ip6mr_forward2(struct net *net, struct mr6_table *mrt,
1915 1916
1916 ipv6h = ipv6_hdr(skb); 1917 ipv6h = ipv6_hdr(skb);
1917 1918
1918 fl = (struct flowi) { 1919 fl6 = (struct flowi6) {
1919 .flowi_oif = vif->link, 1920 .flowi6_oif = vif->link,
1920 .fl6_dst = ipv6h->daddr, 1921 .daddr = ipv6h->daddr,
1921 }; 1922 };
1922 1923
1923 dst = ip6_route_output(net, NULL, &fl); 1924 dst = ip6_route_output(net, NULL, &fl6);
1924 if (!dst) 1925 if (!dst)
1925 goto out_free; 1926 goto out_free;
1926 1927
@@ -2043,13 +2044,13 @@ int ip6_mr_input(struct sk_buff *skb)
2043 struct mfc6_cache *cache; 2044 struct mfc6_cache *cache;
2044 struct net *net = dev_net(skb->dev); 2045 struct net *net = dev_net(skb->dev);
2045 struct mr6_table *mrt; 2046 struct mr6_table *mrt;
2046 struct flowi fl = { 2047 struct flowi6 fl6 = {
2047 .flowi_iif = skb->dev->ifindex, 2048 .flowi6_iif = skb->dev->ifindex,
2048 .flowi_mark= skb->mark, 2049 .flowi6_mark = skb->mark,
2049 }; 2050 };
2050 int err; 2051 int err;
2051 2052
2052 err = ip6mr_fib_lookup(net, &fl, &mrt); 2053 err = ip6mr_fib_lookup(net, &fl6, &mrt);
2053 if (err < 0) 2054 if (err < 0)
2054 return err; 2055 return err;
2055 2056
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 1448c507fdff..9cb191ecaba8 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -444,12 +444,12 @@ sticky_done:
444 { 444 {
445 struct ipv6_txoptions *opt = NULL; 445 struct ipv6_txoptions *opt = NULL;
446 struct msghdr msg; 446 struct msghdr msg;
447 struct flowi fl; 447 struct flowi6 fl6;
448 int junk; 448 int junk;
449 449
450 fl.fl6_flowlabel = 0; 450 memset(&fl6, 0, sizeof(fl6));
451 fl.flowi_oif = sk->sk_bound_dev_if; 451 fl6.flowi6_oif = sk->sk_bound_dev_if;
452 fl.flowi_mark = sk->sk_mark; 452 fl6.flowi6_mark = sk->sk_mark;
453 453
454 if (optlen == 0) 454 if (optlen == 0)
455 goto update; 455 goto update;
@@ -475,7 +475,7 @@ sticky_done:
475 msg.msg_controllen = optlen; 475 msg.msg_controllen = optlen;
476 msg.msg_control = (void*)(opt+1); 476 msg.msg_control = (void*)(opt+1);
477 477
478 retv = datagram_send_ctl(net, &msg, &fl, opt, &junk, &junk, 478 retv = datagram_send_ctl(net, &msg, &fl6, opt, &junk, &junk,
479 &junk); 479 &junk);
480 if (retv) 480 if (retv)
481 goto done; 481 goto done;
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index f2c9b6930ffc..76b893771e6e 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1396,7 +1396,7 @@ static void mld_sendpack(struct sk_buff *skb)
1396 struct inet6_dev *idev; 1396 struct inet6_dev *idev;
1397 struct net *net = dev_net(skb->dev); 1397 struct net *net = dev_net(skb->dev);
1398 int err; 1398 int err;
1399 struct flowi fl; 1399 struct flowi6 fl6;
1400 struct dst_entry *dst; 1400 struct dst_entry *dst;
1401 1401
1402 rcu_read_lock(); 1402 rcu_read_lock();
@@ -1419,11 +1419,11 @@ static void mld_sendpack(struct sk_buff *skb)
1419 goto err_out; 1419 goto err_out;
1420 } 1420 }
1421 1421
1422 icmpv6_flow_init(net->ipv6.igmp_sk, &fl, ICMPV6_MLD2_REPORT, 1422 icmpv6_flow_init(net->ipv6.igmp_sk, &fl6, ICMPV6_MLD2_REPORT,
1423 &ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr, 1423 &ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr,
1424 skb->dev->ifindex); 1424 skb->dev->ifindex);
1425 1425
1426 dst = xfrm_lookup(net, dst, &fl, NULL, 0); 1426 dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), NULL, 0);
1427 err = 0; 1427 err = 0;
1428 if (IS_ERR(dst)) { 1428 if (IS_ERR(dst)) {
1429 err = PTR_ERR(dst); 1429 err = PTR_ERR(dst);
@@ -1731,7 +1731,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
1731 u8 ra[8] = { IPPROTO_ICMPV6, 0, 1731 u8 ra[8] = { IPPROTO_ICMPV6, 0,
1732 IPV6_TLV_ROUTERALERT, 2, 0, 0, 1732 IPV6_TLV_ROUTERALERT, 2, 0, 0,
1733 IPV6_TLV_PADN, 0 }; 1733 IPV6_TLV_PADN, 0 };
1734 struct flowi fl; 1734 struct flowi6 fl6;
1735 struct dst_entry *dst; 1735 struct dst_entry *dst;
1736 1736
1737 if (type == ICMPV6_MGM_REDUCTION) 1737 if (type == ICMPV6_MGM_REDUCTION)
@@ -1791,11 +1791,11 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
1791 goto err_out; 1791 goto err_out;
1792 } 1792 }
1793 1793
1794 icmpv6_flow_init(sk, &fl, type, 1794 icmpv6_flow_init(sk, &fl6, type,
1795 &ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr, 1795 &ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr,
1796 skb->dev->ifindex); 1796 skb->dev->ifindex);
1797 1797
1798 dst = xfrm_lookup(net, dst, &fl, NULL, 0); 1798 dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), NULL, 0);
1799 if (IS_ERR(dst)) { 1799 if (IS_ERR(dst)) {
1800 err = PTR_ERR(dst); 1800 err = PTR_ERR(dst);
1801 goto err_out; 1801 goto err_out;
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c
index e1767aec3334..6a137355311c 100644
--- a/net/ipv6/mip6.c
+++ b/net/ipv6/mip6.c
@@ -208,14 +208,15 @@ static int mip6_destopt_reject(struct xfrm_state *x, struct sk_buff *skb,
208{ 208{
209 struct net *net = xs_net(x); 209 struct net *net = xs_net(x);
210 struct inet6_skb_parm *opt = (struct inet6_skb_parm *)skb->cb; 210 struct inet6_skb_parm *opt = (struct inet6_skb_parm *)skb->cb;
211 const struct flowi6 *fl6 = &fl->u.ip6;
211 struct ipv6_destopt_hao *hao = NULL; 212 struct ipv6_destopt_hao *hao = NULL;
212 struct xfrm_selector sel; 213 struct xfrm_selector sel;
213 int offset; 214 int offset;
214 struct timeval stamp; 215 struct timeval stamp;
215 int err = 0; 216 int err = 0;
216 217
217 if (unlikely(fl->flowi_proto == IPPROTO_MH && 218 if (unlikely(fl6->flowi6_proto == IPPROTO_MH &&
218 fl->fl6_mh_type <= IP6_MH_TYPE_MAX)) 219 fl6->uli.mht.type <= IP6_MH_TYPE_MAX))
219 goto out; 220 goto out;
220 221
221 if (likely(opt->dsthao)) { 222 if (likely(opt->dsthao)) {
@@ -240,14 +241,14 @@ static int mip6_destopt_reject(struct xfrm_state *x, struct sk_buff *skb,
240 sizeof(sel.saddr)); 241 sizeof(sel.saddr));
241 sel.prefixlen_s = 128; 242 sel.prefixlen_s = 128;
242 sel.family = AF_INET6; 243 sel.family = AF_INET6;
243 sel.proto = fl->flowi_proto; 244 sel.proto = fl6->flowi6_proto;
244 sel.dport = xfrm_flowi_dport(fl, &fl->u.ip6.uli); 245 sel.dport = xfrm_flowi_dport(fl, &fl6->uli);
245 if (sel.dport) 246 if (sel.dport)
246 sel.dport_mask = htons(~0); 247 sel.dport_mask = htons(~0);
247 sel.sport = xfrm_flowi_sport(fl, &fl->u.ip6.uli); 248 sel.sport = xfrm_flowi_sport(fl, &fl6->uli);
248 if (sel.sport) 249 if (sel.sport)
249 sel.sport_mask = htons(~0); 250 sel.sport_mask = htons(~0);
250 sel.ifindex = fl->flowi_oif; 251 sel.ifindex = fl6->flowi6_oif;
251 252
252 err = km_report(net, IPPROTO_DSTOPTS, &sel, 253 err = km_report(net, IPPROTO_DSTOPTS, &sel,
253 (hao ? (xfrm_address_t *)&hao->addr : NULL)); 254 (hao ? (xfrm_address_t *)&hao->addr : NULL));
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 9360d3be94f0..0e49c9db3c98 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -511,7 +511,7 @@ void ndisc_send_skb(struct sk_buff *skb,
511 const struct in6_addr *saddr, 511 const struct in6_addr *saddr,
512 struct icmp6hdr *icmp6h) 512 struct icmp6hdr *icmp6h)
513{ 513{
514 struct flowi fl; 514 struct flowi6 fl6;
515 struct dst_entry *dst; 515 struct dst_entry *dst;
516 struct net *net = dev_net(dev); 516 struct net *net = dev_net(dev);
517 struct sock *sk = net->ipv6.ndisc_sk; 517 struct sock *sk = net->ipv6.ndisc_sk;
@@ -521,7 +521,7 @@ void ndisc_send_skb(struct sk_buff *skb,
521 521
522 type = icmp6h->icmp6_type; 522 type = icmp6h->icmp6_type;
523 523
524 icmpv6_flow_init(sk, &fl, type, saddr, daddr, dev->ifindex); 524 icmpv6_flow_init(sk, &fl6, type, saddr, daddr, dev->ifindex);
525 525
526 dst = icmp6_dst_alloc(dev, neigh, daddr); 526 dst = icmp6_dst_alloc(dev, neigh, daddr);
527 if (!dst) { 527 if (!dst) {
@@ -529,7 +529,7 @@ void ndisc_send_skb(struct sk_buff *skb,
529 return; 529 return;
530 } 530 }
531 531
532 dst = xfrm_lookup(net, dst, &fl, NULL, 0); 532 dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), NULL, 0);
533 if (IS_ERR(dst)) { 533 if (IS_ERR(dst)) {
534 kfree_skb(skb); 534 kfree_skb(skb);
535 return; 535 return;
@@ -1515,7 +1515,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1515 struct rt6_info *rt; 1515 struct rt6_info *rt;
1516 struct dst_entry *dst; 1516 struct dst_entry *dst;
1517 struct inet6_dev *idev; 1517 struct inet6_dev *idev;
1518 struct flowi fl; 1518 struct flowi6 fl6;
1519 u8 *opt; 1519 u8 *opt;
1520 int rd_len; 1520 int rd_len;
1521 int err; 1521 int err;
@@ -1535,14 +1535,14 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1535 return; 1535 return;
1536 } 1536 }
1537 1537
1538 icmpv6_flow_init(sk, &fl, NDISC_REDIRECT, 1538 icmpv6_flow_init(sk, &fl6, NDISC_REDIRECT,
1539 &saddr_buf, &ipv6_hdr(skb)->saddr, dev->ifindex); 1539 &saddr_buf, &ipv6_hdr(skb)->saddr, dev->ifindex);
1540 1540
1541 dst = ip6_route_output(net, NULL, &fl); 1541 dst = ip6_route_output(net, NULL, &fl6);
1542 if (dst == NULL) 1542 if (dst == NULL)
1543 return; 1543 return;
1544 1544
1545 dst = xfrm_lookup(net, dst, &fl, NULL, 0); 1545 dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), NULL, 0);
1546 if (IS_ERR(dst)) 1546 if (IS_ERR(dst))
1547 return; 1547 return;
1548 1548
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
index d282c62bc6f4..39aaca2b4fd2 100644
--- a/net/ipv6/netfilter.c
+++ b/net/ipv6/netfilter.c
@@ -15,14 +15,14 @@ int ip6_route_me_harder(struct sk_buff *skb)
15 struct net *net = dev_net(skb_dst(skb)->dev); 15 struct net *net = dev_net(skb_dst(skb)->dev);
16 struct ipv6hdr *iph = ipv6_hdr(skb); 16 struct ipv6hdr *iph = ipv6_hdr(skb);
17 struct dst_entry *dst; 17 struct dst_entry *dst;
18 struct flowi fl = { 18 struct flowi6 fl6 = {
19 .flowi_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0, 19 .flowi6_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0,
20 .flowi_mark = skb->mark, 20 .flowi6_mark = skb->mark,
21 .fl6_dst = iph->daddr, 21 .daddr = iph->daddr,
22 .fl6_src = iph->saddr, 22 .saddr = iph->saddr,
23 }; 23 };
24 24
25 dst = ip6_route_output(net, skb->sk, &fl); 25 dst = ip6_route_output(net, skb->sk, &fl6);
26 if (dst->error) { 26 if (dst->error) {
27 IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES); 27 IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES);
28 LIMIT_NETDEBUG(KERN_DEBUG "ip6_route_me_harder: No more route.\n"); 28 LIMIT_NETDEBUG(KERN_DEBUG "ip6_route_me_harder: No more route.\n");
@@ -37,9 +37,9 @@ int ip6_route_me_harder(struct sk_buff *skb)
37 37
38#ifdef CONFIG_XFRM 38#ifdef CONFIG_XFRM
39 if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) && 39 if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) &&
40 xfrm_decode_session(skb, &fl, AF_INET6) == 0) { 40 xfrm_decode_session(skb, flowi6_to_flowi(&fl6), AF_INET6) == 0) {
41 skb_dst_set(skb, NULL); 41 skb_dst_set(skb, NULL);
42 dst = xfrm_lookup(net, dst, &fl, skb->sk, 0); 42 dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), skb->sk, 0);
43 if (IS_ERR(dst)) 43 if (IS_ERR(dst))
44 return -1; 44 return -1;
45 skb_dst_set(skb, dst); 45 skb_dst_set(skb, dst);
@@ -92,7 +92,7 @@ static int nf_ip6_reroute(struct sk_buff *skb,
92 92
93static int nf_ip6_route(struct dst_entry **dst, struct flowi *fl) 93static int nf_ip6_route(struct dst_entry **dst, struct flowi *fl)
94{ 94{
95 *dst = ip6_route_output(&init_net, NULL, fl); 95 *dst = ip6_route_output(&init_net, NULL, &fl->u.ip6);
96 return (*dst)->error; 96 return (*dst)->error;
97} 97}
98 98
diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c
index d1e905b7f563..df05511dea33 100644
--- a/net/ipv6/netfilter/ip6t_REJECT.c
+++ b/net/ipv6/netfilter/ip6t_REJECT.c
@@ -47,7 +47,7 @@ static void send_reset(struct net *net, struct sk_buff *oldskb)
47 struct ipv6hdr *ip6h; 47 struct ipv6hdr *ip6h;
48 struct dst_entry *dst = NULL; 48 struct dst_entry *dst = NULL;
49 u8 proto; 49 u8 proto;
50 struct flowi fl; 50 struct flowi6 fl6;
51 51
52 if ((!(ipv6_addr_type(&oip6h->saddr) & IPV6_ADDR_UNICAST)) || 52 if ((!(ipv6_addr_type(&oip6h->saddr) & IPV6_ADDR_UNICAST)) ||
53 (!(ipv6_addr_type(&oip6h->daddr) & IPV6_ADDR_UNICAST))) { 53 (!(ipv6_addr_type(&oip6h->daddr) & IPV6_ADDR_UNICAST))) {
@@ -89,19 +89,19 @@ static void send_reset(struct net *net, struct sk_buff *oldskb)
89 return; 89 return;
90 } 90 }
91 91
92 memset(&fl, 0, sizeof(fl)); 92 memset(&fl6, 0, sizeof(fl6));
93 fl.flowi_proto = IPPROTO_TCP; 93 fl6.flowi6_proto = IPPROTO_TCP;
94 ipv6_addr_copy(&fl.fl6_src, &oip6h->daddr); 94 ipv6_addr_copy(&fl6.saddr, &oip6h->daddr);
95 ipv6_addr_copy(&fl.fl6_dst, &oip6h->saddr); 95 ipv6_addr_copy(&fl6.daddr, &oip6h->saddr);
96 fl.fl6_sport = otcph.dest; 96 fl6.uli.ports.sport = otcph.dest;
97 fl.fl6_dport = otcph.source; 97 fl6.uli.ports.dport = otcph.source;
98 security_skb_classify_flow(oldskb, &fl); 98 security_skb_classify_flow(oldskb, flowi6_to_flowi(&fl6));
99 dst = ip6_route_output(net, NULL, &fl); 99 dst = ip6_route_output(net, NULL, &fl6);
100 if (dst == NULL || dst->error) { 100 if (dst == NULL || dst->error) {
101 dst_release(dst); 101 dst_release(dst);
102 return; 102 return;
103 } 103 }
104 dst = xfrm_lookup(net, dst, &fl, NULL, 0); 104 dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), NULL, 0);
105 if (IS_ERR(dst)) 105 if (IS_ERR(dst))
106 return; 106 return;
107 107
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index d061465d6827..259f1b231038 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -524,7 +524,7 @@ csum_copy_err:
524 goto out; 524 goto out;
525} 525}
526 526
527static int rawv6_push_pending_frames(struct sock *sk, struct flowi *fl, 527static int rawv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
528 struct raw6_sock *rp) 528 struct raw6_sock *rp)
529{ 529{
530 struct sk_buff *skb; 530 struct sk_buff *skb;
@@ -586,11 +586,10 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi *fl,
586 if (unlikely(csum)) 586 if (unlikely(csum))
587 tmp_csum = csum_sub(tmp_csum, csum_unfold(csum)); 587 tmp_csum = csum_sub(tmp_csum, csum_unfold(csum));
588 588
589 csum = csum_ipv6_magic(&fl->fl6_src, 589 csum = csum_ipv6_magic(&fl6->saddr, &fl6->daddr,
590 &fl->fl6_dst, 590 total_len, fl6->flowi6_proto, tmp_csum);
591 total_len, fl->flowi_proto, tmp_csum);
592 591
593 if (csum == 0 && fl->flowi_proto == IPPROTO_UDP) 592 if (csum == 0 && fl6->flowi6_proto == IPPROTO_UDP)
594 csum = CSUM_MANGLED_0; 593 csum = CSUM_MANGLED_0;
595 594
596 if (skb_store_bits(skb, offset, &csum, 2)) 595 if (skb_store_bits(skb, offset, &csum, 2))
@@ -603,7 +602,7 @@ out:
603} 602}
604 603
605static int rawv6_send_hdrinc(struct sock *sk, void *from, int length, 604static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
606 struct flowi *fl, struct dst_entry **dstp, 605 struct flowi6 *fl6, struct dst_entry **dstp,
607 unsigned int flags) 606 unsigned int flags)
608{ 607{
609 struct ipv6_pinfo *np = inet6_sk(sk); 608 struct ipv6_pinfo *np = inet6_sk(sk);
@@ -613,7 +612,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
613 struct rt6_info *rt = (struct rt6_info *)*dstp; 612 struct rt6_info *rt = (struct rt6_info *)*dstp;
614 613
615 if (length > rt->dst.dev->mtu) { 614 if (length > rt->dst.dev->mtu) {
616 ipv6_local_error(sk, EMSGSIZE, fl, rt->dst.dev->mtu); 615 ipv6_local_error(sk, EMSGSIZE, fl6, rt->dst.dev->mtu);
617 return -EMSGSIZE; 616 return -EMSGSIZE;
618 } 617 }
619 if (flags&MSG_PROBE) 618 if (flags&MSG_PROBE)
@@ -662,7 +661,7 @@ error:
662 return err; 661 return err;
663} 662}
664 663
665static int rawv6_probe_proto_opt(struct flowi *fl, struct msghdr *msg) 664static int rawv6_probe_proto_opt(struct flowi6 *fl6, struct msghdr *msg)
666{ 665{
667 struct iovec *iov; 666 struct iovec *iov;
668 u8 __user *type = NULL; 667 u8 __user *type = NULL;
@@ -679,7 +678,7 @@ static int rawv6_probe_proto_opt(struct flowi *fl, struct msghdr *msg)
679 if (!iov) 678 if (!iov)
680 continue; 679 continue;
681 680
682 switch (fl->flowi_proto) { 681 switch (fl6->flowi6_proto) {
683 case IPPROTO_ICMPV6: 682 case IPPROTO_ICMPV6:
684 /* check if one-byte field is readable or not. */ 683 /* check if one-byte field is readable or not. */
685 if (iov->iov_base && iov->iov_len < 1) 684 if (iov->iov_base && iov->iov_len < 1)
@@ -694,8 +693,8 @@ static int rawv6_probe_proto_opt(struct flowi *fl, struct msghdr *msg)
694 code = iov->iov_base; 693 code = iov->iov_base;
695 694
696 if (type && code) { 695 if (type && code) {
697 if (get_user(fl->fl6_icmp_type, type) || 696 if (get_user(fl6->uli.icmpt.type, type) ||
698 get_user(fl->fl6_icmp_code, code)) 697 get_user(fl6->uli.icmpt.code, code))
699 return -EFAULT; 698 return -EFAULT;
700 probed = 1; 699 probed = 1;
701 } 700 }
@@ -706,7 +705,7 @@ static int rawv6_probe_proto_opt(struct flowi *fl, struct msghdr *msg)
706 /* check if type field is readable or not. */ 705 /* check if type field is readable or not. */
707 if (iov->iov_len > 2 - len) { 706 if (iov->iov_len > 2 - len) {
708 u8 __user *p = iov->iov_base; 707 u8 __user *p = iov->iov_base;
709 if (get_user(fl->fl6_mh_type, &p[2 - len])) 708 if (get_user(fl6->uli.mht.type, &p[2 - len]))
710 return -EFAULT; 709 return -EFAULT;
711 probed = 1; 710 probed = 1;
712 } else 711 } else
@@ -735,7 +734,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
735 struct ipv6_txoptions *opt = NULL; 734 struct ipv6_txoptions *opt = NULL;
736 struct ip6_flowlabel *flowlabel = NULL; 735 struct ip6_flowlabel *flowlabel = NULL;
737 struct dst_entry *dst = NULL; 736 struct dst_entry *dst = NULL;
738 struct flowi fl; 737 struct flowi6 fl6;
739 int addr_len = msg->msg_namelen; 738 int addr_len = msg->msg_namelen;
740 int hlimit = -1; 739 int hlimit = -1;
741 int tclass = -1; 740 int tclass = -1;
@@ -756,9 +755,9 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
756 /* 755 /*
757 * Get and verify the address. 756 * Get and verify the address.
758 */ 757 */
759 memset(&fl, 0, sizeof(fl)); 758 memset(&fl6, 0, sizeof(fl6));
760 759
761 fl.flowi_mark = sk->sk_mark; 760 fl6.flowi6_mark = sk->sk_mark;
762 761
763 if (sin6) { 762 if (sin6) {
764 if (addr_len < SIN6_LEN_RFC2133) 763 if (addr_len < SIN6_LEN_RFC2133)
@@ -780,9 +779,9 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
780 779
781 daddr = &sin6->sin6_addr; 780 daddr = &sin6->sin6_addr;
782 if (np->sndflow) { 781 if (np->sndflow) {
783 fl.fl6_flowlabel = sin6->sin6_flowinfo&IPV6_FLOWINFO_MASK; 782 fl6.flowlabel = sin6->sin6_flowinfo&IPV6_FLOWINFO_MASK;
784 if (fl.fl6_flowlabel&IPV6_FLOWLABEL_MASK) { 783 if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) {
785 flowlabel = fl6_sock_lookup(sk, fl.fl6_flowlabel); 784 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
786 if (flowlabel == NULL) 785 if (flowlabel == NULL)
787 return -EINVAL; 786 return -EINVAL;
788 daddr = &flowlabel->dst; 787 daddr = &flowlabel->dst;
@@ -800,32 +799,32 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
800 if (addr_len >= sizeof(struct sockaddr_in6) && 799 if (addr_len >= sizeof(struct sockaddr_in6) &&
801 sin6->sin6_scope_id && 800 sin6->sin6_scope_id &&
802 ipv6_addr_type(daddr)&IPV6_ADDR_LINKLOCAL) 801 ipv6_addr_type(daddr)&IPV6_ADDR_LINKLOCAL)
803 fl.flowi_oif = sin6->sin6_scope_id; 802 fl6.flowi6_oif = sin6->sin6_scope_id;
804 } else { 803 } else {
805 if (sk->sk_state != TCP_ESTABLISHED) 804 if (sk->sk_state != TCP_ESTABLISHED)
806 return -EDESTADDRREQ; 805 return -EDESTADDRREQ;
807 806
808 proto = inet->inet_num; 807 proto = inet->inet_num;
809 daddr = &np->daddr; 808 daddr = &np->daddr;
810 fl.fl6_flowlabel = np->flow_label; 809 fl6.flowlabel = np->flow_label;
811 } 810 }
812 811
813 if (fl.flowi_oif == 0) 812 if (fl6.flowi6_oif == 0)
814 fl.flowi_oif = sk->sk_bound_dev_if; 813 fl6.flowi6_oif = sk->sk_bound_dev_if;
815 814
816 if (msg->msg_controllen) { 815 if (msg->msg_controllen) {
817 opt = &opt_space; 816 opt = &opt_space;
818 memset(opt, 0, sizeof(struct ipv6_txoptions)); 817 memset(opt, 0, sizeof(struct ipv6_txoptions));
819 opt->tot_len = sizeof(struct ipv6_txoptions); 818 opt->tot_len = sizeof(struct ipv6_txoptions);
820 819
821 err = datagram_send_ctl(sock_net(sk), msg, &fl, opt, &hlimit, 820 err = datagram_send_ctl(sock_net(sk), msg, &fl6, opt, &hlimit,
822 &tclass, &dontfrag); 821 &tclass, &dontfrag);
823 if (err < 0) { 822 if (err < 0) {
824 fl6_sock_release(flowlabel); 823 fl6_sock_release(flowlabel);
825 return err; 824 return err;
826 } 825 }
827 if ((fl.fl6_flowlabel&IPV6_FLOWLABEL_MASK) && !flowlabel) { 826 if ((fl6.flowlabel&IPV6_FLOWLABEL_MASK) && !flowlabel) {
828 flowlabel = fl6_sock_lookup(sk, fl.fl6_flowlabel); 827 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
829 if (flowlabel == NULL) 828 if (flowlabel == NULL)
830 return -EINVAL; 829 return -EINVAL;
831 } 830 }
@@ -838,31 +837,31 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
838 opt = fl6_merge_options(&opt_space, flowlabel, opt); 837 opt = fl6_merge_options(&opt_space, flowlabel, opt);
839 opt = ipv6_fixup_options(&opt_space, opt); 838 opt = ipv6_fixup_options(&opt_space, opt);
840 839
841 fl.flowi_proto = proto; 840 fl6.flowi6_proto = proto;
842 err = rawv6_probe_proto_opt(&fl, msg); 841 err = rawv6_probe_proto_opt(&fl6, msg);
843 if (err) 842 if (err)
844 goto out; 843 goto out;
845 844
846 if (!ipv6_addr_any(daddr)) 845 if (!ipv6_addr_any(daddr))
847 ipv6_addr_copy(&fl.fl6_dst, daddr); 846 ipv6_addr_copy(&fl6.daddr, daddr);
848 else 847 else
849 fl.fl6_dst.s6_addr[15] = 0x1; /* :: means loopback (BSD'ism) */ 848 fl6.daddr.s6_addr[15] = 0x1; /* :: means loopback (BSD'ism) */
850 if (ipv6_addr_any(&fl.fl6_src) && !ipv6_addr_any(&np->saddr)) 849 if (ipv6_addr_any(&fl6.saddr) && !ipv6_addr_any(&np->saddr))
851 ipv6_addr_copy(&fl.fl6_src, &np->saddr); 850 ipv6_addr_copy(&fl6.saddr, &np->saddr);
852 851
853 final_p = fl6_update_dst(&fl, opt, &final); 852 final_p = fl6_update_dst(&fl6, opt, &final);
854 853
855 if (!fl.flowi_oif && ipv6_addr_is_multicast(&fl.fl6_dst)) 854 if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr))
856 fl.flowi_oif = np->mcast_oif; 855 fl6.flowi6_oif = np->mcast_oif;
857 security_sk_classify_flow(sk, &fl); 856 security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
858 857
859 dst = ip6_dst_lookup_flow(sk, &fl, final_p, true); 858 dst = ip6_dst_lookup_flow(sk, &fl6, final_p, true);
860 if (IS_ERR(dst)) { 859 if (IS_ERR(dst)) {
861 err = PTR_ERR(dst); 860 err = PTR_ERR(dst);
862 goto out; 861 goto out;
863 } 862 }
864 if (hlimit < 0) { 863 if (hlimit < 0) {
865 if (ipv6_addr_is_multicast(&fl.fl6_dst)) 864 if (ipv6_addr_is_multicast(&fl6.daddr))
866 hlimit = np->mcast_hops; 865 hlimit = np->mcast_hops;
867 else 866 else
868 hlimit = np->hop_limit; 867 hlimit = np->hop_limit;
@@ -881,17 +880,17 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
881 880
882back_from_confirm: 881back_from_confirm:
883 if (inet->hdrincl) 882 if (inet->hdrincl)
884 err = rawv6_send_hdrinc(sk, msg->msg_iov, len, &fl, &dst, msg->msg_flags); 883 err = rawv6_send_hdrinc(sk, msg->msg_iov, len, &fl6, &dst, msg->msg_flags);
885 else { 884 else {
886 lock_sock(sk); 885 lock_sock(sk);
887 err = ip6_append_data(sk, ip_generic_getfrag, msg->msg_iov, 886 err = ip6_append_data(sk, ip_generic_getfrag, msg->msg_iov,
888 len, 0, hlimit, tclass, opt, &fl, (struct rt6_info*)dst, 887 len, 0, hlimit, tclass, opt, &fl6, (struct rt6_info*)dst,
889 msg->msg_flags, dontfrag); 888 msg->msg_flags, dontfrag);
890 889
891 if (err) 890 if (err)
892 ip6_flush_pending_frames(sk); 891 ip6_flush_pending_frames(sk);
893 else if (!(msg->msg_flags & MSG_MORE)) 892 else if (!(msg->msg_flags & MSG_MORE))
894 err = rawv6_push_pending_frames(sk, &fl, rp); 893 err = rawv6_push_pending_frames(sk, &fl6, rp);
895 release_sock(sk); 894 release_sock(sk);
896 } 895 }
897done: 896done:
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index c3b20d63921f..6814c8722fa7 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -599,17 +599,17 @@ do { \
599 599
600static struct rt6_info *ip6_pol_route_lookup(struct net *net, 600static struct rt6_info *ip6_pol_route_lookup(struct net *net,
601 struct fib6_table *table, 601 struct fib6_table *table,
602 struct flowi *fl, int flags) 602 struct flowi6 *fl6, int flags)
603{ 603{
604 struct fib6_node *fn; 604 struct fib6_node *fn;
605 struct rt6_info *rt; 605 struct rt6_info *rt;
606 606
607 read_lock_bh(&table->tb6_lock); 607 read_lock_bh(&table->tb6_lock);
608 fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src); 608 fn = fib6_lookup(&table->tb6_root, &fl6->daddr, &fl6->saddr);
609restart: 609restart:
610 rt = fn->leaf; 610 rt = fn->leaf;
611 rt = rt6_device_match(net, rt, &fl->fl6_src, fl->flowi_oif, flags); 611 rt = rt6_device_match(net, rt, &fl6->saddr, fl6->flowi6_oif, flags);
612 BACKTRACK(net, &fl->fl6_src); 612 BACKTRACK(net, &fl6->saddr);
613out: 613out:
614 dst_use(&rt->dst, jiffies); 614 dst_use(&rt->dst, jiffies);
615 read_unlock_bh(&table->tb6_lock); 615 read_unlock_bh(&table->tb6_lock);
@@ -620,19 +620,19 @@ out:
620struct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr, 620struct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr,
621 const struct in6_addr *saddr, int oif, int strict) 621 const struct in6_addr *saddr, int oif, int strict)
622{ 622{
623 struct flowi fl = { 623 struct flowi6 fl6 = {
624 .flowi_oif = oif, 624 .flowi6_oif = oif,
625 .fl6_dst = *daddr, 625 .daddr = *daddr,
626 }; 626 };
627 struct dst_entry *dst; 627 struct dst_entry *dst;
628 int flags = strict ? RT6_LOOKUP_F_IFACE : 0; 628 int flags = strict ? RT6_LOOKUP_F_IFACE : 0;
629 629
630 if (saddr) { 630 if (saddr) {
631 memcpy(&fl.fl6_src, saddr, sizeof(*saddr)); 631 memcpy(&fl6.saddr, saddr, sizeof(*saddr));
632 flags |= RT6_LOOKUP_F_HAS_SADDR; 632 flags |= RT6_LOOKUP_F_HAS_SADDR;
633 } 633 }
634 634
635 dst = fib6_rule_lookup(net, &fl, flags, ip6_pol_route_lookup); 635 dst = fib6_rule_lookup(net, &fl6, flags, ip6_pol_route_lookup);
636 if (dst->error == 0) 636 if (dst->error == 0)
637 return (struct rt6_info *) dst; 637 return (struct rt6_info *) dst;
638 638
@@ -753,7 +753,7 @@ static struct rt6_info *rt6_alloc_clone(struct rt6_info *ort, struct in6_addr *d
753} 753}
754 754
755static struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, int oif, 755static struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, int oif,
756 struct flowi *fl, int flags) 756 struct flowi6 *fl6, int flags)
757{ 757{
758 struct fib6_node *fn; 758 struct fib6_node *fn;
759 struct rt6_info *rt, *nrt; 759 struct rt6_info *rt, *nrt;
@@ -768,12 +768,12 @@ relookup:
768 read_lock_bh(&table->tb6_lock); 768 read_lock_bh(&table->tb6_lock);
769 769
770restart_2: 770restart_2:
771 fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src); 771 fn = fib6_lookup(&table->tb6_root, &fl6->daddr, &fl6->saddr);
772 772
773restart: 773restart:
774 rt = rt6_select(fn, oif, strict | reachable); 774 rt = rt6_select(fn, oif, strict | reachable);
775 775
776 BACKTRACK(net, &fl->fl6_src); 776 BACKTRACK(net, &fl6->saddr);
777 if (rt == net->ipv6.ip6_null_entry || 777 if (rt == net->ipv6.ip6_null_entry ||
778 rt->rt6i_flags & RTF_CACHE) 778 rt->rt6i_flags & RTF_CACHE)
779 goto out; 779 goto out;
@@ -782,9 +782,9 @@ restart:
782 read_unlock_bh(&table->tb6_lock); 782 read_unlock_bh(&table->tb6_lock);
783 783
784 if (!rt->rt6i_nexthop && !(rt->rt6i_flags & RTF_NONEXTHOP)) 784 if (!rt->rt6i_nexthop && !(rt->rt6i_flags & RTF_NONEXTHOP))
785 nrt = rt6_alloc_cow(rt, &fl->fl6_dst, &fl->fl6_src); 785 nrt = rt6_alloc_cow(rt, &fl6->daddr, &fl6->saddr);
786 else if (!(rt->dst.flags & DST_HOST)) 786 else if (!(rt->dst.flags & DST_HOST))
787 nrt = rt6_alloc_clone(rt, &fl->fl6_dst); 787 nrt = rt6_alloc_clone(rt, &fl6->daddr);
788 else 788 else
789 goto out2; 789 goto out2;
790 790
@@ -823,9 +823,9 @@ out2:
823} 823}
824 824
825static struct rt6_info *ip6_pol_route_input(struct net *net, struct fib6_table *table, 825static struct rt6_info *ip6_pol_route_input(struct net *net, struct fib6_table *table,
826 struct flowi *fl, int flags) 826 struct flowi6 *fl6, int flags)
827{ 827{
828 return ip6_pol_route(net, table, fl->flowi_iif, fl, flags); 828 return ip6_pol_route(net, table, fl6->flowi6_iif, fl6, flags);
829} 829}
830 830
831void ip6_route_input(struct sk_buff *skb) 831void ip6_route_input(struct sk_buff *skb)
@@ -833,41 +833,41 @@ void ip6_route_input(struct sk_buff *skb)
833 struct ipv6hdr *iph = ipv6_hdr(skb); 833 struct ipv6hdr *iph = ipv6_hdr(skb);
834 struct net *net = dev_net(skb->dev); 834 struct net *net = dev_net(skb->dev);
835 int flags = RT6_LOOKUP_F_HAS_SADDR; 835 int flags = RT6_LOOKUP_F_HAS_SADDR;
836 struct flowi fl = { 836 struct flowi6 fl6 = {
837 .flowi_iif = skb->dev->ifindex, 837 .flowi6_iif = skb->dev->ifindex,
838 .fl6_dst = iph->daddr, 838 .daddr = iph->daddr,
839 .fl6_src = iph->saddr, 839 .saddr = iph->saddr,
840 .fl6_flowlabel = (* (__be32 *) iph)&IPV6_FLOWINFO_MASK, 840 .flowlabel = (* (__be32 *) iph)&IPV6_FLOWINFO_MASK,
841 .flowi_mark = skb->mark, 841 .flowi6_mark = skb->mark,
842 .flowi_proto = iph->nexthdr, 842 .flowi6_proto = iph->nexthdr,
843 }; 843 };
844 844
845 if (rt6_need_strict(&iph->daddr) && skb->dev->type != ARPHRD_PIMREG) 845 if (rt6_need_strict(&iph->daddr) && skb->dev->type != ARPHRD_PIMREG)
846 flags |= RT6_LOOKUP_F_IFACE; 846 flags |= RT6_LOOKUP_F_IFACE;
847 847
848 skb_dst_set(skb, fib6_rule_lookup(net, &fl, flags, ip6_pol_route_input)); 848 skb_dst_set(skb, fib6_rule_lookup(net, &fl6, flags, ip6_pol_route_input));
849} 849}
850 850
851static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table *table, 851static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table *table,
852 struct flowi *fl, int flags) 852 struct flowi6 *fl6, int flags)
853{ 853{
854 return ip6_pol_route(net, table, fl->flowi_oif, fl, flags); 854 return ip6_pol_route(net, table, fl6->flowi6_oif, fl6, flags);
855} 855}
856 856
857struct dst_entry * ip6_route_output(struct net *net, struct sock *sk, 857struct dst_entry * ip6_route_output(struct net *net, struct sock *sk,
858 struct flowi *fl) 858 struct flowi6 *fl6)
859{ 859{
860 int flags = 0; 860 int flags = 0;
861 861
862 if ((sk && sk->sk_bound_dev_if) || rt6_need_strict(&fl->fl6_dst)) 862 if ((sk && sk->sk_bound_dev_if) || rt6_need_strict(&fl6->daddr))
863 flags |= RT6_LOOKUP_F_IFACE; 863 flags |= RT6_LOOKUP_F_IFACE;
864 864
865 if (!ipv6_addr_any(&fl->fl6_src)) 865 if (!ipv6_addr_any(&fl6->saddr))
866 flags |= RT6_LOOKUP_F_HAS_SADDR; 866 flags |= RT6_LOOKUP_F_HAS_SADDR;
867 else if (sk) 867 else if (sk)
868 flags |= rt6_srcprefs2flags(inet6_sk(sk)->srcprefs); 868 flags |= rt6_srcprefs2flags(inet6_sk(sk)->srcprefs);
869 869
870 return fib6_rule_lookup(net, fl, flags, ip6_pol_route_output); 870 return fib6_rule_lookup(net, fl6, flags, ip6_pol_route_output);
871} 871}
872 872
873EXPORT_SYMBOL(ip6_route_output); 873EXPORT_SYMBOL(ip6_route_output);
@@ -1444,16 +1444,16 @@ static int ip6_route_del(struct fib6_config *cfg)
1444 * Handle redirects 1444 * Handle redirects
1445 */ 1445 */
1446struct ip6rd_flowi { 1446struct ip6rd_flowi {
1447 struct flowi fl; 1447 struct flowi6 fl6;
1448 struct in6_addr gateway; 1448 struct in6_addr gateway;
1449}; 1449};
1450 1450
1451static struct rt6_info *__ip6_route_redirect(struct net *net, 1451static struct rt6_info *__ip6_route_redirect(struct net *net,
1452 struct fib6_table *table, 1452 struct fib6_table *table,
1453 struct flowi *fl, 1453 struct flowi6 *fl6,
1454 int flags) 1454 int flags)
1455{ 1455{
1456 struct ip6rd_flowi *rdfl = (struct ip6rd_flowi *)fl; 1456 struct ip6rd_flowi *rdfl = (struct ip6rd_flowi *)fl6;
1457 struct rt6_info *rt; 1457 struct rt6_info *rt;
1458 struct fib6_node *fn; 1458 struct fib6_node *fn;
1459 1459
@@ -1469,7 +1469,7 @@ static struct rt6_info *__ip6_route_redirect(struct net *net,
1469 */ 1469 */
1470 1470
1471 read_lock_bh(&table->tb6_lock); 1471 read_lock_bh(&table->tb6_lock);
1472 fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src); 1472 fn = fib6_lookup(&table->tb6_root, &fl6->daddr, &fl6->saddr);
1473restart: 1473restart:
1474 for (rt = fn->leaf; rt; rt = rt->dst.rt6_next) { 1474 for (rt = fn->leaf; rt; rt = rt->dst.rt6_next) {
1475 /* 1475 /*
@@ -1484,7 +1484,7 @@ restart:
1484 continue; 1484 continue;
1485 if (!(rt->rt6i_flags & RTF_GATEWAY)) 1485 if (!(rt->rt6i_flags & RTF_GATEWAY))
1486 continue; 1486 continue;
1487 if (fl->flowi_oif != rt->rt6i_dev->ifindex) 1487 if (fl6->flowi6_oif != rt->rt6i_dev->ifindex)
1488 continue; 1488 continue;
1489 if (!ipv6_addr_equal(&rdfl->gateway, &rt->rt6i_gateway)) 1489 if (!ipv6_addr_equal(&rdfl->gateway, &rt->rt6i_gateway))
1490 continue; 1490 continue;
@@ -1493,7 +1493,7 @@ restart:
1493 1493
1494 if (!rt) 1494 if (!rt)
1495 rt = net->ipv6.ip6_null_entry; 1495 rt = net->ipv6.ip6_null_entry;
1496 BACKTRACK(net, &fl->fl6_src); 1496 BACKTRACK(net, &fl6->saddr);
1497out: 1497out:
1498 dst_hold(&rt->dst); 1498 dst_hold(&rt->dst);
1499 1499
@@ -1510,10 +1510,10 @@ static struct rt6_info *ip6_route_redirect(struct in6_addr *dest,
1510 int flags = RT6_LOOKUP_F_HAS_SADDR; 1510 int flags = RT6_LOOKUP_F_HAS_SADDR;
1511 struct net *net = dev_net(dev); 1511 struct net *net = dev_net(dev);
1512 struct ip6rd_flowi rdfl = { 1512 struct ip6rd_flowi rdfl = {
1513 .fl = { 1513 .fl6 = {
1514 .flowi_oif = dev->ifindex, 1514 .flowi6_oif = dev->ifindex,
1515 .fl6_dst = *dest, 1515 .daddr = *dest,
1516 .fl6_src = *src, 1516 .saddr = *src,
1517 }, 1517 },
1518 }; 1518 };
1519 1519
@@ -1522,7 +1522,7 @@ static struct rt6_info *ip6_route_redirect(struct in6_addr *dest,
1522 if (rt6_need_strict(dest)) 1522 if (rt6_need_strict(dest))
1523 flags |= RT6_LOOKUP_F_IFACE; 1523 flags |= RT6_LOOKUP_F_IFACE;
1524 1524
1525 return (struct rt6_info *)fib6_rule_lookup(net, (struct flowi *)&rdfl, 1525 return (struct rt6_info *)fib6_rule_lookup(net, &rdfl.fl6,
1526 flags, __ip6_route_redirect); 1526 flags, __ip6_route_redirect);
1527} 1527}
1528 1528
@@ -2385,7 +2385,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2385 struct rt6_info *rt; 2385 struct rt6_info *rt;
2386 struct sk_buff *skb; 2386 struct sk_buff *skb;
2387 struct rtmsg *rtm; 2387 struct rtmsg *rtm;
2388 struct flowi fl; 2388 struct flowi6 fl6;
2389 int err, iif = 0; 2389 int err, iif = 0;
2390 2390
2391 err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv6_policy); 2391 err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv6_policy);
@@ -2393,27 +2393,27 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2393 goto errout; 2393 goto errout;
2394 2394
2395 err = -EINVAL; 2395 err = -EINVAL;
2396 memset(&fl, 0, sizeof(fl)); 2396 memset(&fl6, 0, sizeof(fl6));
2397 2397
2398 if (tb[RTA_SRC]) { 2398 if (tb[RTA_SRC]) {
2399 if (nla_len(tb[RTA_SRC]) < sizeof(struct in6_addr)) 2399 if (nla_len(tb[RTA_SRC]) < sizeof(struct in6_addr))
2400 goto errout; 2400 goto errout;
2401 2401
2402 ipv6_addr_copy(&fl.fl6_src, nla_data(tb[RTA_SRC])); 2402 ipv6_addr_copy(&fl6.saddr, nla_data(tb[RTA_SRC]));
2403 } 2403 }
2404 2404
2405 if (tb[RTA_DST]) { 2405 if (tb[RTA_DST]) {
2406 if (nla_len(tb[RTA_DST]) < sizeof(struct in6_addr)) 2406 if (nla_len(tb[RTA_DST]) < sizeof(struct in6_addr))
2407 goto errout; 2407 goto errout;
2408 2408
2409 ipv6_addr_copy(&fl.fl6_dst, nla_data(tb[RTA_DST])); 2409 ipv6_addr_copy(&fl6.daddr, nla_data(tb[RTA_DST]));
2410 } 2410 }
2411 2411
2412 if (tb[RTA_IIF]) 2412 if (tb[RTA_IIF])
2413 iif = nla_get_u32(tb[RTA_IIF]); 2413 iif = nla_get_u32(tb[RTA_IIF]);
2414 2414
2415 if (tb[RTA_OIF]) 2415 if (tb[RTA_OIF])
2416 fl.flowi_oif = nla_get_u32(tb[RTA_OIF]); 2416 fl6.flowi6_oif = nla_get_u32(tb[RTA_OIF]);
2417 2417
2418 if (iif) { 2418 if (iif) {
2419 struct net_device *dev; 2419 struct net_device *dev;
@@ -2436,10 +2436,10 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2436 skb_reset_mac_header(skb); 2436 skb_reset_mac_header(skb);
2437 skb_reserve(skb, MAX_HEADER + sizeof(struct ipv6hdr)); 2437 skb_reserve(skb, MAX_HEADER + sizeof(struct ipv6hdr));
2438 2438
2439 rt = (struct rt6_info*) ip6_route_output(net, NULL, &fl); 2439 rt = (struct rt6_info*) ip6_route_output(net, NULL, &fl6);
2440 skb_dst_set(skb, &rt->dst); 2440 skb_dst_set(skb, &rt->dst);
2441 2441
2442 err = rt6_fill_node(net, skb, rt, &fl.fl6_dst, &fl.fl6_src, iif, 2442 err = rt6_fill_node(net, skb, rt, &fl6.daddr, &fl6.saddr, iif,
2443 RTM_NEWROUTE, NETLINK_CB(in_skb).pid, 2443 RTM_NEWROUTE, NETLINK_CB(in_skb).pid,
2444 nlh->nlmsg_seq, 0, 0, 0); 2444 nlh->nlmsg_seq, 0, 0, 0);
2445 if (err < 0) { 2445 if (err < 0) {
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
index 5b9eded1432c..97858d5d67e8 100644
--- a/net/ipv6/syncookies.c
+++ b/net/ipv6/syncookies.c
@@ -232,19 +232,19 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
232 */ 232 */
233 { 233 {
234 struct in6_addr *final_p, final; 234 struct in6_addr *final_p, final;
235 struct flowi fl; 235 struct flowi6 fl6;
236 memset(&fl, 0, sizeof(fl)); 236 memset(&fl6, 0, sizeof(fl6));
237 fl.flowi_proto = IPPROTO_TCP; 237 fl6.flowi6_proto = IPPROTO_TCP;
238 ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr); 238 ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr);
239 final_p = fl6_update_dst(&fl, np->opt, &final); 239 final_p = fl6_update_dst(&fl6, np->opt, &final);
240 ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr); 240 ipv6_addr_copy(&fl6.saddr, &ireq6->loc_addr);
241 fl.flowi_oif = sk->sk_bound_dev_if; 241 fl6.flowi6_oif = sk->sk_bound_dev_if;
242 fl.flowi_mark = sk->sk_mark; 242 fl6.flowi6_mark = sk->sk_mark;
243 fl.fl6_dport = inet_rsk(req)->rmt_port; 243 fl6.uli.ports.dport = inet_rsk(req)->rmt_port;
244 fl.fl6_sport = inet_sk(sk)->inet_sport; 244 fl6.uli.ports.sport = inet_sk(sk)->inet_sport;
245 security_req_classify_flow(req, &fl); 245 security_req_classify_flow(req, flowi6_to_flowi(&fl6));
246 246
247 dst = ip6_dst_lookup_flow(sk, &fl, final_p, false); 247 dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
248 if (IS_ERR(dst)) 248 if (IS_ERR(dst))
249 goto out_free; 249 goto out_free;
250 } 250 }
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index c531ad5fbccc..7ed0ba1995f0 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -131,7 +131,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
131 struct tcp_sock *tp = tcp_sk(sk); 131 struct tcp_sock *tp = tcp_sk(sk);
132 struct in6_addr *saddr = NULL, *final_p, final; 132 struct in6_addr *saddr = NULL, *final_p, final;
133 struct rt6_info *rt; 133 struct rt6_info *rt;
134 struct flowi fl; 134 struct flowi6 fl6;
135 struct dst_entry *dst; 135 struct dst_entry *dst;
136 int addr_type; 136 int addr_type;
137 int err; 137 int err;
@@ -142,14 +142,14 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
142 if (usin->sin6_family != AF_INET6) 142 if (usin->sin6_family != AF_INET6)
143 return -EAFNOSUPPORT; 143 return -EAFNOSUPPORT;
144 144
145 memset(&fl, 0, sizeof(fl)); 145 memset(&fl6, 0, sizeof(fl6));
146 146
147 if (np->sndflow) { 147 if (np->sndflow) {
148 fl.fl6_flowlabel = usin->sin6_flowinfo&IPV6_FLOWINFO_MASK; 148 fl6.flowlabel = usin->sin6_flowinfo&IPV6_FLOWINFO_MASK;
149 IP6_ECN_flow_init(fl.fl6_flowlabel); 149 IP6_ECN_flow_init(fl6.flowlabel);
150 if (fl.fl6_flowlabel&IPV6_FLOWLABEL_MASK) { 150 if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) {
151 struct ip6_flowlabel *flowlabel; 151 struct ip6_flowlabel *flowlabel;
152 flowlabel = fl6_sock_lookup(sk, fl.fl6_flowlabel); 152 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
153 if (flowlabel == NULL) 153 if (flowlabel == NULL)
154 return -EINVAL; 154 return -EINVAL;
155 ipv6_addr_copy(&usin->sin6_addr, &flowlabel->dst); 155 ipv6_addr_copy(&usin->sin6_addr, &flowlabel->dst);
@@ -195,7 +195,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
195 } 195 }
196 196
197 ipv6_addr_copy(&np->daddr, &usin->sin6_addr); 197 ipv6_addr_copy(&np->daddr, &usin->sin6_addr);
198 np->flow_label = fl.fl6_flowlabel; 198 np->flow_label = fl6.flowlabel;
199 199
200 /* 200 /*
201 * TCP over IPv4 201 * TCP over IPv4
@@ -242,27 +242,27 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
242 if (!ipv6_addr_any(&np->rcv_saddr)) 242 if (!ipv6_addr_any(&np->rcv_saddr))
243 saddr = &np->rcv_saddr; 243 saddr = &np->rcv_saddr;
244 244
245 fl.flowi_proto = IPPROTO_TCP; 245 fl6.flowi6_proto = IPPROTO_TCP;
246 ipv6_addr_copy(&fl.fl6_dst, &np->daddr); 246 ipv6_addr_copy(&fl6.daddr, &np->daddr);
247 ipv6_addr_copy(&fl.fl6_src, 247 ipv6_addr_copy(&fl6.saddr,
248 (saddr ? saddr : &np->saddr)); 248 (saddr ? saddr : &np->saddr));
249 fl.flowi_oif = sk->sk_bound_dev_if; 249 fl6.flowi6_oif = sk->sk_bound_dev_if;
250 fl.flowi_mark = sk->sk_mark; 250 fl6.flowi6_mark = sk->sk_mark;
251 fl.fl6_dport = usin->sin6_port; 251 fl6.uli.ports.dport = usin->sin6_port;
252 fl.fl6_sport = inet->inet_sport; 252 fl6.uli.ports.sport = inet->inet_sport;
253 253
254 final_p = fl6_update_dst(&fl, np->opt, &final); 254 final_p = fl6_update_dst(&fl6, np->opt, &final);
255 255
256 security_sk_classify_flow(sk, &fl); 256 security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
257 257
258 dst = ip6_dst_lookup_flow(sk, &fl, final_p, true); 258 dst = ip6_dst_lookup_flow(sk, &fl6, final_p, true);
259 if (IS_ERR(dst)) { 259 if (IS_ERR(dst)) {
260 err = PTR_ERR(dst); 260 err = PTR_ERR(dst);
261 goto failure; 261 goto failure;
262 } 262 }
263 263
264 if (saddr == NULL) { 264 if (saddr == NULL) {
265 saddr = &fl.fl6_src; 265 saddr = &fl6.saddr;
266 ipv6_addr_copy(&np->rcv_saddr, saddr); 266 ipv6_addr_copy(&np->rcv_saddr, saddr);
267 } 267 }
268 268
@@ -389,23 +389,23 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
389 389
390 if (dst == NULL) { 390 if (dst == NULL) {
391 struct inet_sock *inet = inet_sk(sk); 391 struct inet_sock *inet = inet_sk(sk);
392 struct flowi fl; 392 struct flowi6 fl6;
393 393
394 /* BUGGG_FUTURE: Again, it is not clear how 394 /* BUGGG_FUTURE: Again, it is not clear how
395 to handle rthdr case. Ignore this complexity 395 to handle rthdr case. Ignore this complexity
396 for now. 396 for now.
397 */ 397 */
398 memset(&fl, 0, sizeof(fl)); 398 memset(&fl6, 0, sizeof(fl6));
399 fl.flowi_proto = IPPROTO_TCP; 399 fl6.flowi6_proto = IPPROTO_TCP;
400 ipv6_addr_copy(&fl.fl6_dst, &np->daddr); 400 ipv6_addr_copy(&fl6.daddr, &np->daddr);
401 ipv6_addr_copy(&fl.fl6_src, &np->saddr); 401 ipv6_addr_copy(&fl6.saddr, &np->saddr);
402 fl.flowi_oif = sk->sk_bound_dev_if; 402 fl6.flowi6_oif = sk->sk_bound_dev_if;
403 fl.flowi_mark = sk->sk_mark; 403 fl6.flowi6_mark = sk->sk_mark;
404 fl.fl6_dport = inet->inet_dport; 404 fl6.uli.ports.dport = inet->inet_dport;
405 fl.fl6_sport = inet->inet_sport; 405 fl6.uli.ports.sport = inet->inet_sport;
406 security_skb_classify_flow(skb, &fl); 406 security_skb_classify_flow(skb, flowi6_to_flowi(&fl6));
407 407
408 dst = ip6_dst_lookup_flow(sk, &fl, NULL, false); 408 dst = ip6_dst_lookup_flow(sk, &fl6, NULL, false);
409 if (IS_ERR(dst)) { 409 if (IS_ERR(dst)) {
410 sk->sk_err_soft = -PTR_ERR(dst); 410 sk->sk_err_soft = -PTR_ERR(dst);
411 goto out; 411 goto out;
@@ -482,25 +482,25 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req,
482 struct sk_buff * skb; 482 struct sk_buff * skb;
483 struct ipv6_txoptions *opt = NULL; 483 struct ipv6_txoptions *opt = NULL;
484 struct in6_addr * final_p, final; 484 struct in6_addr * final_p, final;
485 struct flowi fl; 485 struct flowi6 fl6;
486 struct dst_entry *dst; 486 struct dst_entry *dst;
487 int err; 487 int err;
488 488
489 memset(&fl, 0, sizeof(fl)); 489 memset(&fl6, 0, sizeof(fl6));
490 fl.flowi_proto = IPPROTO_TCP; 490 fl6.flowi6_proto = IPPROTO_TCP;
491 ipv6_addr_copy(&fl.fl6_dst, &treq->rmt_addr); 491 ipv6_addr_copy(&fl6.daddr, &treq->rmt_addr);
492 ipv6_addr_copy(&fl.fl6_src, &treq->loc_addr); 492 ipv6_addr_copy(&fl6.saddr, &treq->loc_addr);
493 fl.fl6_flowlabel = 0; 493 fl6.flowlabel = 0;
494 fl.flowi_oif = treq->iif; 494 fl6.flowi6_oif = treq->iif;
495 fl.flowi_mark = sk->sk_mark; 495 fl6.flowi6_mark = sk->sk_mark;
496 fl.fl6_dport = inet_rsk(req)->rmt_port; 496 fl6.uli.ports.dport = inet_rsk(req)->rmt_port;
497 fl.fl6_sport = inet_rsk(req)->loc_port; 497 fl6.uli.ports.sport = inet_rsk(req)->loc_port;
498 security_req_classify_flow(req, &fl); 498 security_req_classify_flow(req, flowi6_to_flowi(&fl6));
499 499
500 opt = np->opt; 500 opt = np->opt;
501 final_p = fl6_update_dst(&fl, opt, &final); 501 final_p = fl6_update_dst(&fl6, opt, &final);
502 502
503 dst = ip6_dst_lookup_flow(sk, &fl, final_p, false); 503 dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
504 if (IS_ERR(dst)) { 504 if (IS_ERR(dst)) {
505 err = PTR_ERR(dst); 505 err = PTR_ERR(dst);
506 goto done; 506 goto done;
@@ -510,8 +510,8 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req,
510 if (skb) { 510 if (skb) {
511 __tcp_v6_send_check(skb, &treq->loc_addr, &treq->rmt_addr); 511 __tcp_v6_send_check(skb, &treq->loc_addr, &treq->rmt_addr);
512 512
513 ipv6_addr_copy(&fl.fl6_dst, &treq->rmt_addr); 513 ipv6_addr_copy(&fl6.daddr, &treq->rmt_addr);
514 err = ip6_xmit(sk, skb, &fl, opt); 514 err = ip6_xmit(sk, skb, &fl6, opt);
515 err = net_xmit_eval(err); 515 err = net_xmit_eval(err);
516 } 516 }
517 517
@@ -992,7 +992,7 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win,
992{ 992{
993 struct tcphdr *th = tcp_hdr(skb), *t1; 993 struct tcphdr *th = tcp_hdr(skb), *t1;
994 struct sk_buff *buff; 994 struct sk_buff *buff;
995 struct flowi fl; 995 struct flowi6 fl6;
996 struct net *net = dev_net(skb_dst(skb)->dev); 996 struct net *net = dev_net(skb_dst(skb)->dev);
997 struct sock *ctl_sk = net->ipv6.tcp_sk; 997 struct sock *ctl_sk = net->ipv6.tcp_sk;
998 unsigned int tot_len = sizeof(struct tcphdr); 998 unsigned int tot_len = sizeof(struct tcphdr);
@@ -1046,29 +1046,29 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win,
1046 } 1046 }
1047#endif 1047#endif
1048 1048
1049 memset(&fl, 0, sizeof(fl)); 1049 memset(&fl6, 0, sizeof(fl6));
1050 ipv6_addr_copy(&fl.fl6_dst, &ipv6_hdr(skb)->saddr); 1050 ipv6_addr_copy(&fl6.daddr, &ipv6_hdr(skb)->saddr);
1051 ipv6_addr_copy(&fl.fl6_src, &ipv6_hdr(skb)->daddr); 1051 ipv6_addr_copy(&fl6.saddr, &ipv6_hdr(skb)->daddr);
1052 1052
1053 buff->ip_summed = CHECKSUM_PARTIAL; 1053 buff->ip_summed = CHECKSUM_PARTIAL;
1054 buff->csum = 0; 1054 buff->csum = 0;
1055 1055
1056 __tcp_v6_send_check(buff, &fl.fl6_src, &fl.fl6_dst); 1056 __tcp_v6_send_check(buff, &fl6.saddr, &fl6.daddr);
1057 1057
1058 fl.flowi_proto = IPPROTO_TCP; 1058 fl6.flowi6_proto = IPPROTO_TCP;
1059 fl.flowi_oif = inet6_iif(skb); 1059 fl6.flowi6_oif = inet6_iif(skb);
1060 fl.fl6_dport = t1->dest; 1060 fl6.uli.ports.dport = t1->dest;
1061 fl.fl6_sport = t1->source; 1061 fl6.uli.ports.sport = t1->source;
1062 security_skb_classify_flow(skb, &fl); 1062 security_skb_classify_flow(skb, flowi6_to_flowi(&fl6));
1063 1063
1064 /* Pass a socket to ip6_dst_lookup either it is for RST 1064 /* Pass a socket to ip6_dst_lookup either it is for RST
1065 * Underlying function will use this to retrieve the network 1065 * Underlying function will use this to retrieve the network
1066 * namespace 1066 * namespace
1067 */ 1067 */
1068 dst = ip6_dst_lookup_flow(ctl_sk, &fl, NULL, false); 1068 dst = ip6_dst_lookup_flow(ctl_sk, &fl6, NULL, false);
1069 if (!IS_ERR(dst)) { 1069 if (!IS_ERR(dst)) {
1070 skb_dst_set(buff, dst); 1070 skb_dst_set(buff, dst);
1071 ip6_xmit(ctl_sk, buff, &fl, NULL); 1071 ip6_xmit(ctl_sk, buff, &fl6, NULL);
1072 TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS); 1072 TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
1073 if (rst) 1073 if (rst)
1074 TCP_INC_STATS_BH(net, TCP_MIB_OUTRSTS); 1074 TCP_INC_STATS_BH(net, TCP_MIB_OUTRSTS);
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index dad035fb0afd..ce4b16fbf81c 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -886,7 +886,7 @@ static int udp_v6_push_pending_frames(struct sock *sk)
886 struct udphdr *uh; 886 struct udphdr *uh;
887 struct udp_sock *up = udp_sk(sk); 887 struct udp_sock *up = udp_sk(sk);
888 struct inet_sock *inet = inet_sk(sk); 888 struct inet_sock *inet = inet_sk(sk);
889 struct flowi *fl = &inet->cork.fl; 889 struct flowi6 *fl6 = &inet->cork.fl.u.ip6;
890 int err = 0; 890 int err = 0;
891 int is_udplite = IS_UDPLITE(sk); 891 int is_udplite = IS_UDPLITE(sk);
892 __wsum csum = 0; 892 __wsum csum = 0;
@@ -899,23 +899,23 @@ static int udp_v6_push_pending_frames(struct sock *sk)
899 * Create a UDP header 899 * Create a UDP header
900 */ 900 */
901 uh = udp_hdr(skb); 901 uh = udp_hdr(skb);
902 uh->source = fl->fl6_sport; 902 uh->source = fl6->uli.ports.sport;
903 uh->dest = fl->fl6_dport; 903 uh->dest = fl6->uli.ports.dport;
904 uh->len = htons(up->len); 904 uh->len = htons(up->len);
905 uh->check = 0; 905 uh->check = 0;
906 906
907 if (is_udplite) 907 if (is_udplite)
908 csum = udplite_csum_outgoing(sk, skb); 908 csum = udplite_csum_outgoing(sk, skb);
909 else if (skb->ip_summed == CHECKSUM_PARTIAL) { /* UDP hardware csum */ 909 else if (skb->ip_summed == CHECKSUM_PARTIAL) { /* UDP hardware csum */
910 udp6_hwcsum_outgoing(sk, skb, &fl->fl6_src, &fl->fl6_dst, 910 udp6_hwcsum_outgoing(sk, skb, &fl6->saddr, &fl6->daddr,
911 up->len); 911 up->len);
912 goto send; 912 goto send;
913 } else 913 } else
914 csum = udp_csum_outgoing(sk, skb); 914 csum = udp_csum_outgoing(sk, skb);
915 915
916 /* add protocol-dependent pseudo-header */ 916 /* add protocol-dependent pseudo-header */
917 uh->check = csum_ipv6_magic(&fl->fl6_src, &fl->fl6_dst, 917 uh->check = csum_ipv6_magic(&fl6->saddr, &fl6->daddr,
918 up->len, fl->flowi_proto, csum); 918 up->len, fl6->flowi6_proto, csum);
919 if (uh->check == 0) 919 if (uh->check == 0)
920 uh->check = CSUM_MANGLED_0; 920 uh->check = CSUM_MANGLED_0;
921 921
@@ -947,7 +947,7 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
947 struct in6_addr *daddr, *final_p, final; 947 struct in6_addr *daddr, *final_p, final;
948 struct ipv6_txoptions *opt = NULL; 948 struct ipv6_txoptions *opt = NULL;
949 struct ip6_flowlabel *flowlabel = NULL; 949 struct ip6_flowlabel *flowlabel = NULL;
950 struct flowi fl; 950 struct flowi6 fl6;
951 struct dst_entry *dst; 951 struct dst_entry *dst;
952 int addr_len = msg->msg_namelen; 952 int addr_len = msg->msg_namelen;
953 int ulen = len; 953 int ulen = len;
@@ -1030,19 +1030,19 @@ do_udp_sendmsg:
1030 } 1030 }
1031 ulen += sizeof(struct udphdr); 1031 ulen += sizeof(struct udphdr);
1032 1032
1033 memset(&fl, 0, sizeof(fl)); 1033 memset(&fl6, 0, sizeof(fl6));
1034 1034
1035 if (sin6) { 1035 if (sin6) {
1036 if (sin6->sin6_port == 0) 1036 if (sin6->sin6_port == 0)
1037 return -EINVAL; 1037 return -EINVAL;
1038 1038
1039 fl.fl6_dport = sin6->sin6_port; 1039 fl6.uli.ports.dport = sin6->sin6_port;
1040 daddr = &sin6->sin6_addr; 1040 daddr = &sin6->sin6_addr;
1041 1041
1042 if (np->sndflow) { 1042 if (np->sndflow) {
1043 fl.fl6_flowlabel = sin6->sin6_flowinfo&IPV6_FLOWINFO_MASK; 1043 fl6.flowlabel = sin6->sin6_flowinfo&IPV6_FLOWINFO_MASK;
1044 if (fl.fl6_flowlabel&IPV6_FLOWLABEL_MASK) { 1044 if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) {
1045 flowlabel = fl6_sock_lookup(sk, fl.fl6_flowlabel); 1045 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
1046 if (flowlabel == NULL) 1046 if (flowlabel == NULL)
1047 return -EINVAL; 1047 return -EINVAL;
1048 daddr = &flowlabel->dst; 1048 daddr = &flowlabel->dst;
@@ -1060,38 +1060,38 @@ do_udp_sendmsg:
1060 if (addr_len >= sizeof(struct sockaddr_in6) && 1060 if (addr_len >= sizeof(struct sockaddr_in6) &&
1061 sin6->sin6_scope_id && 1061 sin6->sin6_scope_id &&
1062 ipv6_addr_type(daddr)&IPV6_ADDR_LINKLOCAL) 1062 ipv6_addr_type(daddr)&IPV6_ADDR_LINKLOCAL)
1063 fl.flowi_oif = sin6->sin6_scope_id; 1063 fl6.flowi6_oif = sin6->sin6_scope_id;
1064 } else { 1064 } else {
1065 if (sk->sk_state != TCP_ESTABLISHED) 1065 if (sk->sk_state != TCP_ESTABLISHED)
1066 return -EDESTADDRREQ; 1066 return -EDESTADDRREQ;
1067 1067
1068 fl.fl6_dport = inet->inet_dport; 1068 fl6.uli.ports.dport = inet->inet_dport;
1069 daddr = &np->daddr; 1069 daddr = &np->daddr;
1070 fl.fl6_flowlabel = np->flow_label; 1070 fl6.flowlabel = np->flow_label;
1071 connected = 1; 1071 connected = 1;
1072 } 1072 }
1073 1073
1074 if (!fl.flowi_oif) 1074 if (!fl6.flowi6_oif)
1075 fl.flowi_oif = sk->sk_bound_dev_if; 1075 fl6.flowi6_oif = sk->sk_bound_dev_if;
1076 1076
1077 if (!fl.flowi_oif) 1077 if (!fl6.flowi6_oif)
1078 fl.flowi_oif = np->sticky_pktinfo.ipi6_ifindex; 1078 fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex;
1079 1079
1080 fl.flowi_mark = sk->sk_mark; 1080 fl6.flowi6_mark = sk->sk_mark;
1081 1081
1082 if (msg->msg_controllen) { 1082 if (msg->msg_controllen) {
1083 opt = &opt_space; 1083 opt = &opt_space;
1084 memset(opt, 0, sizeof(struct ipv6_txoptions)); 1084 memset(opt, 0, sizeof(struct ipv6_txoptions));
1085 opt->tot_len = sizeof(*opt); 1085 opt->tot_len = sizeof(*opt);
1086 1086
1087 err = datagram_send_ctl(sock_net(sk), msg, &fl, opt, &hlimit, 1087 err = datagram_send_ctl(sock_net(sk), msg, &fl6, opt, &hlimit,
1088 &tclass, &dontfrag); 1088 &tclass, &dontfrag);
1089 if (err < 0) { 1089 if (err < 0) {
1090 fl6_sock_release(flowlabel); 1090 fl6_sock_release(flowlabel);
1091 return err; 1091 return err;
1092 } 1092 }
1093 if ((fl.fl6_flowlabel&IPV6_FLOWLABEL_MASK) && !flowlabel) { 1093 if ((fl6.flowlabel&IPV6_FLOWLABEL_MASK) && !flowlabel) {
1094 flowlabel = fl6_sock_lookup(sk, fl.fl6_flowlabel); 1094 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
1095 if (flowlabel == NULL) 1095 if (flowlabel == NULL)
1096 return -EINVAL; 1096 return -EINVAL;
1097 } 1097 }
@@ -1105,27 +1105,27 @@ do_udp_sendmsg:
1105 opt = fl6_merge_options(&opt_space, flowlabel, opt); 1105 opt = fl6_merge_options(&opt_space, flowlabel, opt);
1106 opt = ipv6_fixup_options(&opt_space, opt); 1106 opt = ipv6_fixup_options(&opt_space, opt);
1107 1107
1108 fl.flowi_proto = sk->sk_protocol; 1108 fl6.flowi6_proto = sk->sk_protocol;
1109 if (!ipv6_addr_any(daddr)) 1109 if (!ipv6_addr_any(daddr))
1110 ipv6_addr_copy(&fl.fl6_dst, daddr); 1110 ipv6_addr_copy(&fl6.daddr, daddr);
1111 else 1111 else
1112 fl.fl6_dst.s6_addr[15] = 0x1; /* :: means loopback (BSD'ism) */ 1112 fl6.daddr.s6_addr[15] = 0x1; /* :: means loopback (BSD'ism) */
1113 if (ipv6_addr_any(&fl.fl6_src) && !ipv6_addr_any(&np->saddr)) 1113 if (ipv6_addr_any(&fl6.saddr) && !ipv6_addr_any(&np->saddr))
1114 ipv6_addr_copy(&fl.fl6_src, &np->saddr); 1114 ipv6_addr_copy(&fl6.saddr, &np->saddr);
1115 fl.fl6_sport = inet->inet_sport; 1115 fl6.uli.ports.sport = inet->inet_sport;
1116 1116
1117 final_p = fl6_update_dst(&fl, opt, &final); 1117 final_p = fl6_update_dst(&fl6, opt, &final);
1118 if (final_p) 1118 if (final_p)
1119 connected = 0; 1119 connected = 0;
1120 1120
1121 if (!fl.flowi_oif && ipv6_addr_is_multicast(&fl.fl6_dst)) { 1121 if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr)) {
1122 fl.flowi_oif = np->mcast_oif; 1122 fl6.flowi6_oif = np->mcast_oif;
1123 connected = 0; 1123 connected = 0;
1124 } 1124 }
1125 1125
1126 security_sk_classify_flow(sk, &fl); 1126 security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
1127 1127
1128 dst = ip6_sk_dst_lookup_flow(sk, &fl, final_p, true); 1128 dst = ip6_sk_dst_lookup_flow(sk, &fl6, final_p, true);
1129 if (IS_ERR(dst)) { 1129 if (IS_ERR(dst)) {
1130 err = PTR_ERR(dst); 1130 err = PTR_ERR(dst);
1131 dst = NULL; 1131 dst = NULL;
@@ -1133,7 +1133,7 @@ do_udp_sendmsg:
1133 } 1133 }
1134 1134
1135 if (hlimit < 0) { 1135 if (hlimit < 0) {
1136 if (ipv6_addr_is_multicast(&fl.fl6_dst)) 1136 if (ipv6_addr_is_multicast(&fl6.daddr))
1137 hlimit = np->mcast_hops; 1137 hlimit = np->mcast_hops;
1138 else 1138 else
1139 hlimit = np->hop_limit; 1139 hlimit = np->hop_limit;
@@ -1168,7 +1168,7 @@ do_append_data:
1168 up->len += ulen; 1168 up->len += ulen;
1169 getfrag = is_udplite ? udplite_getfrag : ip_generic_getfrag; 1169 getfrag = is_udplite ? udplite_getfrag : ip_generic_getfrag;
1170 err = ip6_append_data(sk, getfrag, msg->msg_iov, ulen, 1170 err = ip6_append_data(sk, getfrag, msg->msg_iov, ulen,
1171 sizeof(struct udphdr), hlimit, tclass, opt, &fl, 1171 sizeof(struct udphdr), hlimit, tclass, opt, &fl6,
1172 (struct rt6_info*)dst, 1172 (struct rt6_info*)dst,
1173 corkreq ? msg->msg_flags|MSG_MORE : msg->msg_flags, dontfrag); 1173 corkreq ? msg->msg_flags|MSG_MORE : msg->msg_flags, dontfrag);
1174 if (err) 1174 if (err)
@@ -1181,10 +1181,10 @@ do_append_data:
1181 if (dst) { 1181 if (dst) {
1182 if (connected) { 1182 if (connected) {
1183 ip6_dst_store(sk, dst, 1183 ip6_dst_store(sk, dst,
1184 ipv6_addr_equal(&fl.fl6_dst, &np->daddr) ? 1184 ipv6_addr_equal(&fl6.daddr, &np->daddr) ?
1185 &np->daddr : NULL, 1185 &np->daddr : NULL,
1186#ifdef CONFIG_IPV6_SUBTREES 1186#ifdef CONFIG_IPV6_SUBTREES
1187 ipv6_addr_equal(&fl.fl6_src, &np->saddr) ? 1187 ipv6_addr_equal(&fl6.saddr, &np->saddr) ?
1188 &np->saddr : 1188 &np->saddr :
1189#endif 1189#endif
1190 NULL); 1190 NULL);
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 254aa6d79506..bef62005c0ed 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -39,8 +39,7 @@ static struct dst_entry *xfrm6_dst_lookup(struct net *net, int tos,
39 if (saddr) 39 if (saddr)
40 memcpy(&fl6.saddr, saddr, sizeof(fl6.saddr)); 40 memcpy(&fl6.saddr, saddr, sizeof(fl6.saddr));
41 41
42 dst = ip6_route_output(net, NULL, 42 dst = ip6_route_output(net, NULL, &fl6);
43 flowi6_to_flowi(&fl6));
44 43
45 err = dst->error; 44 err = dst->error;
46 if (dst->error) { 45 if (dst->error) {