Skip to content

Commit 4e3fd7a

Browse files
Alexey Dobriyandavem330
authored andcommitted
net: remove ipv6_addr_copy()
C assignment can handle struct in6_addr copying. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 40ba849 commit 4e3fd7a

66 files changed

Lines changed: 288 additions & 315 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/infiniband/core/addr.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
243243
int ret;
244244

245245
memset(&fl6, 0, sizeof fl6);
246-
ipv6_addr_copy(&fl6.daddr, &dst_in->sin6_addr);
247-
ipv6_addr_copy(&fl6.saddr, &src_in->sin6_addr);
246+
fl6.daddr = dst_in->sin6_addr;
247+
fl6.saddr = src_in->sin6_addr;
248248
fl6.flowi6_oif = addr->bound_dev_if;
249249

250250
dst = ip6_route_output(&init_net, NULL, &fl6);
@@ -258,7 +258,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
258258
goto put;
259259

260260
src_in->sin6_family = AF_INET6;
261-
ipv6_addr_copy(&src_in->sin6_addr, &fl6.saddr);
261+
src_in->sin6_addr = fl6.saddr;
262262
}
263263

264264
if (dst->dev->flags & IFF_LOOPBACK) {

‎drivers/infiniband/core/cma.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,11 +2005,11 @@ static int cma_resolve_loopback(struct rdma_id_private *id_priv)
20052005
if (cma_zero_addr(src)) {
20062006
dst = (struct sockaddr *) &id_priv->id.route.addr.dst_addr;
20072007
if ((src->sa_family = dst->sa_family) == AF_INET) {
2008-
((struct sockaddr_in *) src)->sin_addr.s_addr =
2009-
((struct sockaddr_in *) dst)->sin_addr.s_addr;
2008+
((struct sockaddr_in *)src)->sin_addr =
2009+
((struct sockaddr_in *)dst)->sin_addr;
20102010
} else {
2011-
ipv6_addr_copy(&((struct sockaddr_in6 *) src)->sin6_addr,
2012-
&((struct sockaddr_in6 *) dst)->sin6_addr);
2011+
((struct sockaddr_in6 *)src)->sin6_addr =
2012+
((struct sockaddr_in6 *)dst)->sin6_addr;
20132013
}
20142014
}
20152015

‎drivers/net/bonding/bond_ipv6.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static void bond_glean_dev_ipv6(struct net_device *dev, struct in6_addr *addr)
5050
struct inet6_ifaddr *ifa
5151
= list_first_entry(&idev->addr_list,
5252
struct inet6_ifaddr, if_list);
53-
ipv6_addr_copy(addr, &ifa->addr);
53+
*addr = ifa->addr;
5454
} else
5555
ipv6_addr_set(addr, 0, 0, 0, 0);
5656

@@ -168,8 +168,7 @@ static int bond_inet6addr_event(struct notifier_block *this,
168168
switch (event) {
169169
case NETDEV_UP:
170170
if (ipv6_addr_any(&bond->master_ipv6))
171-
ipv6_addr_copy(&bond->master_ipv6,
172-
&ifa->addr);
171+
bond->master_ipv6 = ifa->addr;
173172
return NOTIFY_OK;
174173
case NETDEV_DOWN:
175174
if (ipv6_addr_equal(&bond->master_ipv6,
@@ -191,8 +190,7 @@ static int bond_inet6addr_event(struct notifier_block *this,
191190
switch (event) {
192191
case NETDEV_UP:
193192
if (ipv6_addr_any(&vlan->vlan_ipv6))
194-
ipv6_addr_copy(&vlan->vlan_ipv6,
195-
&ifa->addr);
193+
vlan->vlan_ipv6 = ifa->addr;
196194
return NOTIFY_OK;
197195
case NETDEV_DOWN:
198196
if (ipv6_addr_equal(&vlan->vlan_ipv6,

‎drivers/net/ethernet/broadcom/cnic.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3475,7 +3475,7 @@ static int cnic_get_v6_route(struct sockaddr_in6 *dst_addr,
34753475
struct flowi6 fl6;
34763476

34773477
memset(&fl6, 0, sizeof(fl6));
3478-
ipv6_addr_copy(&fl6.daddr, &dst_addr->sin6_addr);
3478+
fl6.daddr = dst_addr->sin6_addr;
34793479
if (ipv6_addr_type(&fl6.daddr) & IPV6_ADDR_LINKLOCAL)
34803480
fl6.flowi6_oif = dst_addr->sin6_scope_id;
34813481

‎fs/dlm/lowcomms.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ static int nodeid_to_addr(int nodeid, struct sockaddr *retaddr)
281281
} else {
282282
struct sockaddr_in6 *in6 = (struct sockaddr_in6 *) &addr;
283283
struct sockaddr_in6 *ret6 = (struct sockaddr_in6 *) retaddr;
284-
ipv6_addr_copy(&ret6->sin6_addr, &in6->sin6_addr);
284+
ret6->sin6_addr = in6->sin6_addr;
285285
}
286286

287287
return 0;

‎include/linux/sunrpc/clnt.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ static inline bool __rpc_copy_addr6(struct sockaddr *dst,
237237
struct sockaddr_in6 *dsin6 = (struct sockaddr_in6 *) dst;
238238

239239
dsin6->sin6_family = ssin6->sin6_family;
240-
ipv6_addr_copy(&dsin6->sin6_addr, &ssin6->sin6_addr);
240+
dsin6->sin6_addr = ssin6->sin6_addr;
241241
return true;
242242
}
243243
#else /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */

‎include/net/inetpeer.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static inline struct inet_peer *inet_getpeer_v6(const struct in6_addr *v6daddr,
8686
{
8787
struct inetpeer_addr daddr;
8888

89-
ipv6_addr_copy((struct in6_addr *)daddr.addr.a6, v6daddr);
89+
*(struct in6_addr *)daddr.addr.a6 = *v6daddr;
9090
daddr.family = AF_INET6;
9191
return inet_getpeer(&daddr, create);
9292
}

‎include/net/ip_vs.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <linux/netfilter.h> /* for union nf_inet_addr */
2222
#include <linux/ip.h>
2323
#include <linux/ipv6.h> /* for struct ipv6hdr */
24-
#include <net/ipv6.h> /* for ipv6_addr_copy */
24+
#include <net/ipv6.h>
2525
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2626
#include <net/netfilter/nf_conntrack.h>
2727
#endif
@@ -119,8 +119,8 @@ ip_vs_fill_iphdr(int af, const void *nh, struct ip_vs_iphdr *iphdr)
119119
const struct ipv6hdr *iph = nh;
120120
iphdr->len = sizeof(struct ipv6hdr);
121121
iphdr->protocol = iph->nexthdr;
122-
ipv6_addr_copy(&iphdr->saddr.in6, &iph->saddr);
123-
ipv6_addr_copy(&iphdr->daddr.in6, &iph->daddr);
122+
iphdr->saddr.in6 = iph->saddr;
123+
iphdr->daddr.in6 = iph->daddr;
124124
} else
125125
#endif
126126
{
@@ -137,7 +137,7 @@ static inline void ip_vs_addr_copy(int af, union nf_inet_addr *dst,
137137
{
138138
#ifdef CONFIG_IP_VS_IPV6
139139
if (af == AF_INET6)
140-
ipv6_addr_copy(&dst->in6, &src->in6);
140+
dst->in6 = src->in6;
141141
else
142142
#endif
143143
dst->ip = src->ip;

‎include/net/ipv6.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,6 @@ ipv6_masked_addr_cmp(const struct in6_addr *a1, const struct in6_addr *m,
309309
((a1->s6_addr32[3] ^ a2->s6_addr32[3]) & m->s6_addr32[3]));
310310
}
311311

312-
static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr *a2)
313-
{
314-
memcpy(a1, a2, sizeof(struct in6_addr));
315-
}
316-
317312
static inline void ipv6_addr_prefix(struct in6_addr *pfx,
318313
const struct in6_addr *addr,
319314
int plen)

‎include/net/xfrm.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,8 +1217,8 @@ void xfrm_flowi_addr_get(const struct flowi *fl,
12171217
memcpy(&daddr->a4, &fl->u.ip4.daddr, sizeof(daddr->a4));
12181218
break;
12191219
case AF_INET6:
1220-
ipv6_addr_copy((struct in6_addr *)&saddr->a6, &fl->u.ip6.saddr);
1221-
ipv6_addr_copy((struct in6_addr *)&daddr->a6, &fl->u.ip6.daddr);
1220+
*(struct in6_addr *)saddr->a6 = fl->u.ip6.saddr;
1221+
*(struct in6_addr *)daddr->a6 = fl->u.ip6.daddr;
12221222
break;
12231223
}
12241224
}

0 commit comments

Comments
 (0)