aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ipv6.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-03-12 16:22:43 -0500
committerDavid S. Miller <davem@davemloft.net>2011-03-12 18:08:54 -0500
commit4c9483b2fb5d2548c3cc1fe03cdd4484ceeb5d1c (patch)
treec29c8070012cffb38fe249cf528589a675f622b1 /net/dccp/ipv6.c
parent9cce96df5b76691712dba22e83ff5efe900361e1 (diff)
ipv6: Convert to use flowi6 where applicable.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/ipv6.c')
-rw-r--r--net/dccp/ipv6.c132
1 files changed, 66 insertions, 66 deletions
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 2b351c6da49a..8d26c122de64 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -147,22 +147,22 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
147 dst = __sk_dst_check(sk, np->dst_cookie); 147 dst = __sk_dst_check(sk, np->dst_cookie);
148 if (dst == NULL) { 148 if (dst == NULL) {
149 struct inet_sock *inet = inet_sk(sk); 149 struct inet_sock *inet = inet_sk(sk);
150 struct flowi fl; 150 struct flowi6 fl6;
151 151
152 /* BUGGG_FUTURE: Again, it is not clear how 152 /* BUGGG_FUTURE: Again, it is not clear how
153 to handle rthdr case. Ignore this complexity 153 to handle rthdr case. Ignore this complexity
154 for now. 154 for now.
155 */ 155 */
156 memset(&fl, 0, sizeof(fl)); 156 memset(&fl6, 0, sizeof(fl6));
157 fl.flowi_proto = IPPROTO_DCCP; 157 fl6.flowi6_proto = IPPROTO_DCCP;
158 ipv6_addr_copy(&fl.fl6_dst, &np->daddr); 158 ipv6_addr_copy(&fl6.daddr, &np->daddr);
159 ipv6_addr_copy(&fl.fl6_src, &np->saddr); 159 ipv6_addr_copy(&fl6.saddr, &np->saddr);
160 fl.flowi_oif = sk->sk_bound_dev_if; 160 fl6.flowi6_oif = sk->sk_bound_dev_if;
161 fl.fl6_dport = inet->inet_dport; 161 fl6.uli.ports.dport = inet->inet_dport;
162 fl.fl6_sport = inet->inet_sport; 162 fl6.uli.ports.sport = inet->inet_sport;
163 security_sk_classify_flow(sk, &fl); 163 security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
164 164
165 dst = ip6_dst_lookup_flow(sk, &fl, NULL, false); 165 dst = ip6_dst_lookup_flow(sk, &fl6, NULL, false);
166 if (IS_ERR(dst)) { 166 if (IS_ERR(dst)) {
167 sk->sk_err_soft = -PTR_ERR(dst); 167 sk->sk_err_soft = -PTR_ERR(dst);
168 goto out; 168 goto out;
@@ -243,25 +243,25 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req,
243 struct sk_buff *skb; 243 struct sk_buff *skb;
244 struct ipv6_txoptions *opt = NULL; 244 struct ipv6_txoptions *opt = NULL;
245 struct in6_addr *final_p, final; 245 struct in6_addr *final_p, final;
246 struct flowi fl; 246 struct flowi6 fl6;
247 int err = -1; 247 int err = -1;
248 struct dst_entry *dst; 248 struct dst_entry *dst;
249 249
250 memset(&fl, 0, sizeof(fl)); 250 memset(&fl6, 0, sizeof(fl6));
251 fl.flowi_proto = IPPROTO_DCCP; 251 fl6.flowi6_proto = IPPROTO_DCCP;
252 ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr); 252 ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr);
253 ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr); 253 ipv6_addr_copy(&fl6.saddr, &ireq6->loc_addr);
254 fl.fl6_flowlabel = 0; 254 fl6.flowlabel = 0;
255 fl.flowi_oif = ireq6->iif; 255 fl6.flowi6_oif = ireq6->iif;
256 fl.fl6_dport = inet_rsk(req)->rmt_port; 256 fl6.uli.ports.dport = inet_rsk(req)->rmt_port;
257 fl.fl6_sport = inet_rsk(req)->loc_port; 257 fl6.uli.ports.sport = inet_rsk(req)->loc_port;
258 security_req_classify_flow(req, &fl); 258 security_req_classify_flow(req, flowi6_to_flowi(&fl6));
259 259
260 opt = np->opt; 260 opt = np->opt;
261 261
262 final_p = fl6_update_dst(&fl, opt, &final); 262 final_p = fl6_update_dst(&fl6, opt, &final);
263 263
264 dst = ip6_dst_lookup_flow(sk, &fl, final_p, false); 264 dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
265 if (IS_ERR(dst)) { 265 if (IS_ERR(dst)) {
266 err = PTR_ERR(dst); 266 err = PTR_ERR(dst);
267 dst = NULL; 267 dst = NULL;
@@ -275,8 +275,8 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req,
275 dh->dccph_checksum = dccp_v6_csum_finish(skb, 275 dh->dccph_checksum = dccp_v6_csum_finish(skb,
276 &ireq6->loc_addr, 276 &ireq6->loc_addr,
277 &ireq6->rmt_addr); 277 &ireq6->rmt_addr);
278 ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr); 278 ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr);
279 err = ip6_xmit(sk, skb, &fl, opt); 279 err = ip6_xmit(sk, skb, &fl6, opt);
280 err = net_xmit_eval(err); 280 err = net_xmit_eval(err);
281 } 281 }
282 282
@@ -298,7 +298,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
298{ 298{
299 struct ipv6hdr *rxip6h; 299 struct ipv6hdr *rxip6h;
300 struct sk_buff *skb; 300 struct sk_buff *skb;
301 struct flowi fl; 301 struct flowi6 fl6;
302 struct net *net = dev_net(skb_dst(rxskb)->dev); 302 struct net *net = dev_net(skb_dst(rxskb)->dev);
303 struct sock *ctl_sk = net->dccp.v6_ctl_sk; 303 struct sock *ctl_sk = net->dccp.v6_ctl_sk;
304 struct dst_entry *dst; 304 struct dst_entry *dst;
@@ -317,21 +317,21 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
317 dccp_hdr(skb)->dccph_checksum = dccp_v6_csum_finish(skb, &rxip6h->saddr, 317 dccp_hdr(skb)->dccph_checksum = dccp_v6_csum_finish(skb, &rxip6h->saddr,
318 &rxip6h->daddr); 318 &rxip6h->daddr);
319 319
320 memset(&fl, 0, sizeof(fl)); 320 memset(&fl6, 0, sizeof(fl6));
321 ipv6_addr_copy(&fl.fl6_dst, &rxip6h->saddr); 321 ipv6_addr_copy(&fl6.daddr, &rxip6h->saddr);
322 ipv6_addr_copy(&fl.fl6_src, &rxip6h->daddr); 322 ipv6_addr_copy(&fl6.saddr, &rxip6h->daddr);
323 323
324 fl.flowi_proto = IPPROTO_DCCP; 324 fl6.flowi6_proto = IPPROTO_DCCP;
325 fl.flowi_oif = inet6_iif(rxskb); 325 fl6.flowi6_oif = inet6_iif(rxskb);
326 fl.fl6_dport = dccp_hdr(skb)->dccph_dport; 326 fl6.uli.ports.dport = dccp_hdr(skb)->dccph_dport;
327 fl.fl6_sport = dccp_hdr(skb)->dccph_sport; 327 fl6.uli.ports.sport = dccp_hdr(skb)->dccph_sport;
328 security_skb_classify_flow(rxskb, &fl); 328 security_skb_classify_flow(rxskb, flowi6_to_flowi(&fl6));
329 329
330 /* sk = NULL, but it is safe for now. RST socket required. */ 330 /* sk = NULL, but it is safe for now. RST socket required. */
331 dst = ip6_dst_lookup_flow(ctl_sk, &fl, NULL, false); 331 dst = ip6_dst_lookup_flow(ctl_sk, &fl6, NULL, false);
332 if (!IS_ERR(dst)) { 332 if (!IS_ERR(dst)) {
333 skb_dst_set(skb, dst); 333 skb_dst_set(skb, dst);
334 ip6_xmit(ctl_sk, skb, &fl, NULL); 334 ip6_xmit(ctl_sk, skb, &fl6, NULL);
335 DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS); 335 DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS);
336 DCCP_INC_STATS_BH(DCCP_MIB_OUTRSTS); 336 DCCP_INC_STATS_BH(DCCP_MIB_OUTRSTS);
337 return; 337 return;
@@ -527,19 +527,19 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
527 527
528 if (dst == NULL) { 528 if (dst == NULL) {
529 struct in6_addr *final_p, final; 529 struct in6_addr *final_p, final;
530 struct flowi fl; 530 struct flowi6 fl6;
531 531
532 memset(&fl, 0, sizeof(fl)); 532 memset(&fl6, 0, sizeof(fl6));
533 fl.flowi_proto = IPPROTO_DCCP; 533 fl6.flowi6_proto = IPPROTO_DCCP;
534 ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr); 534 ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr);
535 final_p = fl6_update_dst(&fl, opt, &final); 535 final_p = fl6_update_dst(&fl6, opt, &final);
536 ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr); 536 ipv6_addr_copy(&fl6.saddr, &ireq6->loc_addr);
537 fl.flowi_oif = sk->sk_bound_dev_if; 537 fl6.flowi6_oif = sk->sk_bound_dev_if;
538 fl.fl6_dport = inet_rsk(req)->rmt_port; 538 fl6.uli.ports.dport = inet_rsk(req)->rmt_port;
539 fl.fl6_sport = inet_rsk(req)->loc_port; 539 fl6.uli.ports.sport = inet_rsk(req)->loc_port;
540 security_sk_classify_flow(sk, &fl); 540 security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
541 541
542 dst = ip6_dst_lookup_flow(sk, &fl, final_p, false); 542 dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
543 if (IS_ERR(dst)) 543 if (IS_ERR(dst))
544 goto out; 544 goto out;
545 } 545 }
@@ -859,7 +859,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
859 struct ipv6_pinfo *np = inet6_sk(sk); 859 struct ipv6_pinfo *np = inet6_sk(sk);
860 struct dccp_sock *dp = dccp_sk(sk); 860 struct dccp_sock *dp = dccp_sk(sk);
861 struct in6_addr *saddr = NULL, *final_p, final; 861 struct in6_addr *saddr = NULL, *final_p, final;
862 struct flowi fl; 862 struct flowi6 fl6;
863 struct dst_entry *dst; 863 struct dst_entry *dst;
864 int addr_type; 864 int addr_type;
865 int err; 865 int err;
@@ -872,14 +872,14 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
872 if (usin->sin6_family != AF_INET6) 872 if (usin->sin6_family != AF_INET6)
873 return -EAFNOSUPPORT; 873 return -EAFNOSUPPORT;
874 874
875 memset(&fl, 0, sizeof(fl)); 875 memset(&fl6, 0, sizeof(fl6));
876 876
877 if (np->sndflow) { 877 if (np->sndflow) {
878 fl.fl6_flowlabel = usin->sin6_flowinfo & IPV6_FLOWINFO_MASK; 878 fl6.flowlabel = usin->sin6_flowinfo & IPV6_FLOWINFO_MASK;
879 IP6_ECN_flow_init(fl.fl6_flowlabel); 879 IP6_ECN_flow_init(fl6.flowlabel);
880 if (fl.fl6_flowlabel & IPV6_FLOWLABEL_MASK) { 880 if (fl6.flowlabel & IPV6_FLOWLABEL_MASK) {
881 struct ip6_flowlabel *flowlabel; 881 struct ip6_flowlabel *flowlabel;
882 flowlabel = fl6_sock_lookup(sk, fl.fl6_flowlabel); 882 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
883 if (flowlabel == NULL) 883 if (flowlabel == NULL)
884 return -EINVAL; 884 return -EINVAL;
885 ipv6_addr_copy(&usin->sin6_addr, &flowlabel->dst); 885 ipv6_addr_copy(&usin->sin6_addr, &flowlabel->dst);
@@ -916,7 +916,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
916 } 916 }
917 917
918 ipv6_addr_copy(&np->daddr, &usin->sin6_addr); 918 ipv6_addr_copy(&np->daddr, &usin->sin6_addr);
919 np->flow_label = fl.fl6_flowlabel; 919 np->flow_label = fl6.flowlabel;
920 920
921 /* 921 /*
922 * DCCP over IPv4 922 * DCCP over IPv4
@@ -953,24 +953,24 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
953 if (!ipv6_addr_any(&np->rcv_saddr)) 953 if (!ipv6_addr_any(&np->rcv_saddr))
954 saddr = &np->rcv_saddr; 954 saddr = &np->rcv_saddr;
955 955
956 fl.flowi_proto = IPPROTO_DCCP; 956 fl6.flowi6_proto = IPPROTO_DCCP;
957 ipv6_addr_copy(&fl.fl6_dst, &np->daddr); 957 ipv6_addr_copy(&fl6.daddr, &np->daddr);
958 ipv6_addr_copy(&fl.fl6_src, saddr ? saddr : &np->saddr); 958 ipv6_addr_copy(&fl6.saddr, saddr ? saddr : &np->saddr);
959 fl.flowi_oif = sk->sk_bound_dev_if; 959 fl6.flowi6_oif = sk->sk_bound_dev_if;
960 fl.fl6_dport = usin->sin6_port; 960 fl6.uli.ports.dport = usin->sin6_port;
961 fl.fl6_sport = inet->inet_sport; 961 fl6.uli.ports.sport = inet->inet_sport;
962 security_sk_classify_flow(sk, &fl); 962 security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
963 963
964 final_p = fl6_update_dst(&fl, np->opt, &final); 964 final_p = fl6_update_dst(&fl6, np->opt, &final);
965 965
966 dst = ip6_dst_lookup_flow(sk, &fl, final_p, true); 966 dst = ip6_dst_lookup_flow(sk, &fl6, final_p, true);
967 if (IS_ERR(dst)) { 967 if (IS_ERR(dst)) {
968 err = PTR_ERR(dst); 968 err = PTR_ERR(dst);
969 goto failure; 969 goto failure;
970 } 970 }
971 971
972 if (saddr == NULL) { 972 if (saddr == NULL) {
973 saddr = &fl.fl6_src; 973 saddr = &fl6.saddr;
974 ipv6_addr_copy(&np->rcv_saddr, saddr); 974 ipv6_addr_copy(&np->rcv_saddr, saddr);
975 } 975 }
976 976