IPv6: use ipv6_addr_set_v4mapped()
authorBrian Haley <brian.haley@hp.com>
Wed, 7 Oct 2009 20:58:25 +0000 (13:58 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 7 Oct 2009 20:58:25 +0000 (13:58 -0700)
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>
net/dccp/ipv6.c
net/ipv6/datagram.c
net/ipv6/tcp_ipv6.c
net/ipv6/udp.c
net/sunrpc/svcauth_unix.c

index e48ca5d45658468176bb60c8cbb53a587feea72d..a2afb553d8b3b9f2ff122f6d50453e7fb24cd5bf 100644 (file)
@@ -510,11 +510,9 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
 
                memcpy(newnp, np, sizeof(struct ipv6_pinfo));
 
-               ipv6_addr_set(&newnp->daddr, 0, 0, htonl(0x0000FFFF),
-                             newinet->daddr);
+               ipv6_addr_set_v4mapped(newinet->daddr, &newnp->daddr);
 
-               ipv6_addr_set(&newnp->saddr, 0, 0, htonl(0x0000FFFF),
-                             newinet->saddr);
+               ipv6_addr_set_v4mapped(newinet->saddr, &newnp->saddr);
 
                ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr);
 
@@ -971,10 +969,8 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
                        sk->sk_backlog_rcv = dccp_v6_do_rcv;
                        goto failure;
                } else {
-                       ipv6_addr_set(&np->saddr, 0, 0, htonl(0x0000FFFF),
-                                     inet->saddr);
-                       ipv6_addr_set(&np->rcv_saddr, 0, 0, htonl(0x0000FFFF),
-                                     inet->rcv_saddr);
+                       ipv6_addr_set_v4mapped(inet->saddr, &np->saddr);
+                       ipv6_addr_set_v4mapped(inet->rcv_saddr, &np->rcv_saddr);
                }
 
                return err;
index a615b4dea6c4b8427572fedf2d4fe5554eb3977e..dbfec7147aa53fc1e22fe568be22a10d5cd9879d 100644 (file)
@@ -98,17 +98,14 @@ ipv4_connected:
                if (err)
                        goto out;
 
-               ipv6_addr_set(&np->daddr, 0, 0, htonl(0x0000ffff), inet->daddr);
+               ipv6_addr_set_v4mapped(inet->daddr, &np->daddr);
 
-               if (ipv6_addr_any(&np->saddr)) {
-                       ipv6_addr_set(&np->saddr, 0, 0, htonl(0x0000ffff),
-                                     inet->saddr);
-               }
+               if (ipv6_addr_any(&np->saddr))
+                       ipv6_addr_set_v4mapped(inet->saddr, &np->saddr);
+
+               if (ipv6_addr_any(&np->rcv_saddr))
+                       ipv6_addr_set_v4mapped(inet->rcv_saddr, &np->rcv_saddr);
 
-               if (ipv6_addr_any(&np->rcv_saddr)) {
-                       ipv6_addr_set(&np->rcv_saddr, 0, 0, htonl(0x0000ffff),
-                                     inet->rcv_saddr);
-               }
                goto out;
        }
 
@@ -330,9 +327,8 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len)
                        if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL)
                                sin->sin6_scope_id = IP6CB(skb)->iif;
                } else {
-                       ipv6_addr_set(&sin->sin6_addr, 0, 0,
-                                     htonl(0xffff),
-                                     *(__be32 *)(nh + serr->addr_offset));
+                       ipv6_addr_set_v4mapped(*(__be32 *)(nh + serr->addr_offset),
+                                              &sin->sin6_addr);
                }
        }
 
@@ -352,8 +348,8 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len)
                } else {
                        struct inet_sock *inet = inet_sk(sk);
 
-                       ipv6_addr_set(&sin->sin6_addr, 0, 0,
-                                     htonl(0xffff), ip_hdr(skb)->saddr);
+                       ipv6_addr_set_v4mapped(ip_hdr(skb)->saddr,
+                                              &sin->sin6_addr);
                        if (inet->cmsg_flags)
                                ip_cmsg_recv(msg, skb);
                }
index 321aafd40dcb9cf4ca3a8e115c4aa530bad8ffdd..451763059142931d7f1697407326f2d9f54d5879 100644 (file)
@@ -226,10 +226,8 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
 #endif
                        goto failure;
                } else {
-                       ipv6_addr_set(&np->saddr, 0, 0, htonl(0x0000FFFF),
-                                     inet->saddr);
-                       ipv6_addr_set(&np->rcv_saddr, 0, 0, htonl(0x0000FFFF),
-                                     inet->rcv_saddr);
+                       ipv6_addr_set_v4mapped(inet->saddr, &np->saddr);
+                       ipv6_addr_set_v4mapped(inet->rcv_saddr, &np->rcv_saddr);
                }
 
                return err;
@@ -1293,11 +1291,9 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
 
                memcpy(newnp, np, sizeof(struct ipv6_pinfo));
 
-               ipv6_addr_set(&newnp->daddr, 0, 0, htonl(0x0000FFFF),
-                             newinet->daddr);
+               ipv6_addr_set_v4mapped(newinet->daddr, &newnp->daddr);
 
-               ipv6_addr_set(&newnp->saddr, 0, 0, htonl(0x0000FFFF),
-                             newinet->saddr);
+               ipv6_addr_set_v4mapped(newinet->saddr, &newnp->saddr);
 
                ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr);
 
index 3842c557d6fa28ff91972c2045b938c868bed9b5..c6a303ec834cf71d20aaed0c32d2635477c4e52d 100644 (file)
@@ -265,8 +265,8 @@ try_again:
                sin6->sin6_scope_id = 0;
 
                if (is_udp4)
-                       ipv6_addr_set(&sin6->sin6_addr, 0, 0,
-                                     htonl(0xffff), ip_hdr(skb)->saddr);
+                       ipv6_addr_set_v4mapped(ip_hdr(skb)->saddr,
+                                              &sin6->sin6_addr);
                else {
                        ipv6_addr_copy(&sin6->sin6_addr,
                                       &ipv6_hdr(skb)->saddr);
index 117f68a8aa40c2d220b0dbd0ab3fda6ed6a6d523..f4c7ff3a53e6c65b881069946443b1bed94127e5 100644 (file)
@@ -686,8 +686,7 @@ svcauth_unix_set_client(struct svc_rqst *rqstp)
        case AF_INET:
                sin = svc_addr_in(rqstp);
                sin6 = &sin6_storage;
-               ipv6_addr_set(&sin6->sin6_addr, 0, 0,
-                               htonl(0x0000FFFF), sin->sin_addr.s_addr);
+               ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &sin6->sin6_addr);
                break;
        case AF_INET6:
                sin6 = svc_addr_in6(rqstp);