diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-12 16:22:43 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-12 18:08:54 -0500 |
commit | 4c9483b2fb5d2548c3cc1fe03cdd4484ceeb5d1c (patch) | |
tree | c29c8070012cffb38fe249cf528589a675f622b1 /net/ipv6/tcp_ipv6.c | |
parent | 9cce96df5b76691712dba22e83ff5efe900361e1 (diff) |
ipv6: Convert to use flowi6 where applicable.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 114 |
1 files changed, 57 insertions, 57 deletions
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); |