aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Haley <brian.haley@hp.com>2009-10-07 16:58:25 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-07 16:58:25 -0400
commitb301e82cf8104cfddbe5452ebe625bab49597c64 (patch)
tree49d7f8c91833e0658bf4074c0022bbf34790ce47
parent86c36ce45dc2e2f022562c6481cd778f4cc381a9 (diff)
IPv6: use ipv6_addr_set_v4mapped()
Might as well use the ipv6_addr_set_v4mapped() inline we created last year. Signed-off-by: Brian Haley <brian.haley@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/dccp/ipv6.c12
-rw-r--r--net/ipv6/datagram.c24
-rw-r--r--net/ipv6/tcp_ipv6.c12
-rw-r--r--net/ipv6/udp.c4
-rw-r--r--net/sunrpc/svcauth_unix.c3
5 files changed, 21 insertions, 34 deletions
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index e48ca5d45658..a2afb553d8b3 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -510,11 +510,9 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
510 510
511 memcpy(newnp, np, sizeof(struct ipv6_pinfo)); 511 memcpy(newnp, np, sizeof(struct ipv6_pinfo));
512 512
513 ipv6_addr_set(&newnp->daddr, 0, 0, htonl(0x0000FFFF), 513 ipv6_addr_set_v4mapped(newinet->daddr, &newnp->daddr);
514 newinet->daddr);
515 514
516 ipv6_addr_set(&newnp->saddr, 0, 0, htonl(0x0000FFFF), 515 ipv6_addr_set_v4mapped(newinet->saddr, &newnp->saddr);
517 newinet->saddr);
518 516
519 ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr); 517 ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr);
520 518
@@ -971,10 +969,8 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
971 sk->sk_backlog_rcv = dccp_v6_do_rcv; 969 sk->sk_backlog_rcv = dccp_v6_do_rcv;
972 goto failure; 970 goto failure;
973 } else { 971 } else {
974 ipv6_addr_set(&np->saddr, 0, 0, htonl(0x0000FFFF), 972 ipv6_addr_set_v4mapped(inet->saddr, &np->saddr);
975 inet->saddr); 973 ipv6_addr_set_v4mapped(inet->rcv_saddr, &np->rcv_saddr);
976 ipv6_addr_set(&np->rcv_saddr, 0, 0, htonl(0x0000FFFF),
977 inet->rcv_saddr);
978 } 974 }
979 975
980 return err; 976 return err;
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index a615b4dea6c4..dbfec7147aa5 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -98,17 +98,14 @@ ipv4_connected:
98 if (err) 98 if (err)
99 goto out; 99 goto out;
100 100
101 ipv6_addr_set(&np->daddr, 0, 0, htonl(0x0000ffff), inet->daddr); 101 ipv6_addr_set_v4mapped(inet->daddr, &np->daddr);
102 102
103 if (ipv6_addr_any(&np->saddr)) { 103 if (ipv6_addr_any(&np->saddr))
104 ipv6_addr_set(&np->saddr, 0, 0, htonl(0x0000ffff), 104 ipv6_addr_set_v4mapped(inet->saddr, &np->saddr);
105 inet->saddr); 105
106 } 106 if (ipv6_addr_any(&np->rcv_saddr))
107 ipv6_addr_set_v4mapped(inet->rcv_saddr, &np->rcv_saddr);
107 108
108 if (ipv6_addr_any(&np->rcv_saddr)) {
109 ipv6_addr_set(&np->rcv_saddr, 0, 0, htonl(0x0000ffff),
110 inet->rcv_saddr);
111 }
112 goto out; 109 goto out;
113 } 110 }
114 111
@@ -330,9 +327,8 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len)
330 if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL) 327 if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL)
331 sin->sin6_scope_id = IP6CB(skb)->iif; 328 sin->sin6_scope_id = IP6CB(skb)->iif;
332 } else { 329 } else {
333 ipv6_addr_set(&sin->sin6_addr, 0, 0, 330 ipv6_addr_set_v4mapped(*(__be32 *)(nh + serr->addr_offset),
334 htonl(0xffff), 331 &sin->sin6_addr);
335 *(__be32 *)(nh + serr->addr_offset));
336 } 332 }
337 } 333 }
338 334
@@ -352,8 +348,8 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len)
352 } else { 348 } else {
353 struct inet_sock *inet = inet_sk(sk); 349 struct inet_sock *inet = inet_sk(sk);
354 350
355 ipv6_addr_set(&sin->sin6_addr, 0, 0, 351 ipv6_addr_set_v4mapped(ip_hdr(skb)->saddr,
356 htonl(0xffff), ip_hdr(skb)->saddr); 352 &sin->sin6_addr);
357 if (inet->cmsg_flags) 353 if (inet->cmsg_flags)
358 ip_cmsg_recv(msg, skb); 354 ip_cmsg_recv(msg, skb);
359 } 355 }
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 321aafd40dcb..451763059142 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -226,10 +226,8 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
226#endif 226#endif
227 goto failure; 227 goto failure;
228 } else { 228 } else {
229 ipv6_addr_set(&np->saddr, 0, 0, htonl(0x0000FFFF), 229 ipv6_addr_set_v4mapped(inet->saddr, &np->saddr);
230 inet->saddr); 230 ipv6_addr_set_v4mapped(inet->rcv_saddr, &np->rcv_saddr);
231 ipv6_addr_set(&np->rcv_saddr, 0, 0, htonl(0x0000FFFF),
232 inet->rcv_saddr);
233 } 231 }
234 232
235 return err; 233 return err;
@@ -1293,11 +1291,9 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1293 1291
1294 memcpy(newnp, np, sizeof(struct ipv6_pinfo)); 1292 memcpy(newnp, np, sizeof(struct ipv6_pinfo));
1295 1293
1296 ipv6_addr_set(&newnp->daddr, 0, 0, htonl(0x0000FFFF), 1294 ipv6_addr_set_v4mapped(newinet->daddr, &newnp->daddr);
1297 newinet->daddr);
1298 1295
1299 ipv6_addr_set(&newnp->saddr, 0, 0, htonl(0x0000FFFF), 1296 ipv6_addr_set_v4mapped(newinet->saddr, &newnp->saddr);
1300 newinet->saddr);
1301 1297
1302 ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr); 1298 ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr);
1303 1299
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 3842c557d6fa..c6a303ec834c 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -265,8 +265,8 @@ try_again:
265 sin6->sin6_scope_id = 0; 265 sin6->sin6_scope_id = 0;
266 266
267 if (is_udp4) 267 if (is_udp4)
268 ipv6_addr_set(&sin6->sin6_addr, 0, 0, 268 ipv6_addr_set_v4mapped(ip_hdr(skb)->saddr,
269 htonl(0xffff), ip_hdr(skb)->saddr); 269 &sin6->sin6_addr);
270 else { 270 else {
271 ipv6_addr_copy(&sin6->sin6_addr, 271 ipv6_addr_copy(&sin6->sin6_addr,
272 &ipv6_hdr(skb)->saddr); 272 &ipv6_hdr(skb)->saddr);
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index 117f68a8aa40..f4c7ff3a53e6 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -686,8 +686,7 @@ svcauth_unix_set_client(struct svc_rqst *rqstp)
686 case AF_INET: 686 case AF_INET:
687 sin = svc_addr_in(rqstp); 687 sin = svc_addr_in(rqstp);
688 sin6 = &sin6_storage; 688 sin6 = &sin6_storage;
689 ipv6_addr_set(&sin6->sin6_addr, 0, 0, 689 ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &sin6->sin6_addr);
690 htonl(0x0000FFFF), sin->sin_addr.s_addr);
691 break; 690 break;
692 case AF_INET6: 691 case AF_INET6:
693 sin6 = svc_addr_in6(rqstp); 692 sin6 = svc_addr_in6(rqstp);