aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
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 /net/ipv6
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>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/datagram.c24
-rw-r--r--net/ipv6/tcp_ipv6.c12
-rw-r--r--net/ipv6/udp.c4
3 files changed, 16 insertions, 24 deletions
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);