Commit b301e82c authored by Brian Haley's avatar Brian Haley Committed by David S. Miller

IPv6: use ipv6_addr_set_v4mapped()

Might as well use the ipv6_addr_set_v4mapped() inline we created last
year.
Signed-off-by: default avatarBrian Haley <brian.haley@hp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 86c36ce4
...@@ -510,11 +510,9 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk, ...@@ -510,11 +510,9 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
memcpy(newnp, np, sizeof(struct ipv6_pinfo)); memcpy(newnp, np, sizeof(struct ipv6_pinfo));
ipv6_addr_set(&newnp->daddr, 0, 0, htonl(0x0000FFFF), ipv6_addr_set_v4mapped(newinet->daddr, &newnp->daddr);
newinet->daddr);
ipv6_addr_set(&newnp->saddr, 0, 0, htonl(0x0000FFFF), ipv6_addr_set_v4mapped(newinet->saddr, &newnp->saddr);
newinet->saddr);
ipv6_addr_copy(&newnp->rcv_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, ...@@ -971,10 +969,8 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
sk->sk_backlog_rcv = dccp_v6_do_rcv; sk->sk_backlog_rcv = dccp_v6_do_rcv;
goto failure; goto failure;
} else { } else {
ipv6_addr_set(&np->saddr, 0, 0, htonl(0x0000FFFF), ipv6_addr_set_v4mapped(inet->saddr, &np->saddr);
inet->saddr); ipv6_addr_set_v4mapped(inet->rcv_saddr, &np->rcv_saddr);
ipv6_addr_set(&np->rcv_saddr, 0, 0, htonl(0x0000FFFF),
inet->rcv_saddr);
} }
return err; return err;
......
...@@ -98,17 +98,14 @@ ipv4_connected: ...@@ -98,17 +98,14 @@ ipv4_connected:
if (err) if (err)
goto out; 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)) { if (ipv6_addr_any(&np->saddr))
ipv6_addr_set(&np->saddr, 0, 0, htonl(0x0000ffff), ipv6_addr_set_v4mapped(inet->saddr, &np->saddr);
inet->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; goto out;
} }
...@@ -330,9 +327,8 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len) ...@@ -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) if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL)
sin->sin6_scope_id = IP6CB(skb)->iif; sin->sin6_scope_id = IP6CB(skb)->iif;
} else { } else {
ipv6_addr_set(&sin->sin6_addr, 0, 0, ipv6_addr_set_v4mapped(*(__be32 *)(nh + serr->addr_offset),
htonl(0xffff), &sin->sin6_addr);
*(__be32 *)(nh + serr->addr_offset));
} }
} }
...@@ -352,8 +348,8 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len) ...@@ -352,8 +348,8 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len)
} else { } else {
struct inet_sock *inet = inet_sk(sk); struct inet_sock *inet = inet_sk(sk);
ipv6_addr_set(&sin->sin6_addr, 0, 0, ipv6_addr_set_v4mapped(ip_hdr(skb)->saddr,
htonl(0xffff), ip_hdr(skb)->saddr); &sin->sin6_addr);
if (inet->cmsg_flags) if (inet->cmsg_flags)
ip_cmsg_recv(msg, skb); ip_cmsg_recv(msg, skb);
} }
......
...@@ -226,10 +226,8 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, ...@@ -226,10 +226,8 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
#endif #endif
goto failure; goto failure;
} else { } else {
ipv6_addr_set(&np->saddr, 0, 0, htonl(0x0000FFFF), ipv6_addr_set_v4mapped(inet->saddr, &np->saddr);
inet->saddr); ipv6_addr_set_v4mapped(inet->rcv_saddr, &np->rcv_saddr);
ipv6_addr_set(&np->rcv_saddr, 0, 0, htonl(0x0000FFFF),
inet->rcv_saddr);
} }
return err; return err;
...@@ -1293,11 +1291,9 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, ...@@ -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)); memcpy(newnp, np, sizeof(struct ipv6_pinfo));
ipv6_addr_set(&newnp->daddr, 0, 0, htonl(0x0000FFFF), ipv6_addr_set_v4mapped(newinet->daddr, &newnp->daddr);
newinet->daddr);
ipv6_addr_set(&newnp->saddr, 0, 0, htonl(0x0000FFFF), ipv6_addr_set_v4mapped(newinet->saddr, &newnp->saddr);
newinet->saddr);
ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr); ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr);
......
...@@ -265,8 +265,8 @@ try_again: ...@@ -265,8 +265,8 @@ try_again:
sin6->sin6_scope_id = 0; sin6->sin6_scope_id = 0;
if (is_udp4) if (is_udp4)
ipv6_addr_set(&sin6->sin6_addr, 0, 0, ipv6_addr_set_v4mapped(ip_hdr(skb)->saddr,
htonl(0xffff), ip_hdr(skb)->saddr); &sin6->sin6_addr);
else { else {
ipv6_addr_copy(&sin6->sin6_addr, ipv6_addr_copy(&sin6->sin6_addr,
&ipv6_hdr(skb)->saddr); &ipv6_hdr(skb)->saddr);
......
...@@ -686,8 +686,7 @@ svcauth_unix_set_client(struct svc_rqst *rqstp) ...@@ -686,8 +686,7 @@ svcauth_unix_set_client(struct svc_rqst *rqstp)
case AF_INET: case AF_INET:
sin = svc_addr_in(rqstp); sin = svc_addr_in(rqstp);
sin6 = &sin6_storage; sin6 = &sin6_storage;
ipv6_addr_set(&sin6->sin6_addr, 0, 0, ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &sin6->sin6_addr);
htonl(0x0000FFFF), sin->sin_addr.s_addr);
break; break;
case AF_INET6: case AF_INET6:
sin6 = svc_addr_in6(rqstp); sin6 = svc_addr_in6(rqstp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment