ip: use dev_addr_set() in tunnels
Use dev_addr_set() instead of writing to netdev->dev_addr directly in ip tunnels drivers. Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
20c3d9e45b
commit
5a1b7e1a53
|
@ -986,7 +986,7 @@ static int ipgre_tunnel_init(struct net_device *dev)
|
||||||
|
|
||||||
__gre_tunnel_init(dev);
|
__gre_tunnel_init(dev);
|
||||||
|
|
||||||
memcpy(dev->dev_addr, &iph->saddr, 4);
|
__dev_addr_set(dev, &iph->saddr, 4);
|
||||||
memcpy(dev->broadcast, &iph->daddr, 4);
|
memcpy(dev->broadcast, &iph->daddr, 4);
|
||||||
|
|
||||||
dev->flags = IFF_NOARP;
|
dev->flags = IFF_NOARP;
|
||||||
|
|
|
@ -834,7 +834,7 @@ static void ip_tunnel_update(struct ip_tunnel_net *itn,
|
||||||
t->parms.i_key = p->i_key;
|
t->parms.i_key = p->i_key;
|
||||||
t->parms.o_key = p->o_key;
|
t->parms.o_key = p->o_key;
|
||||||
if (dev->type != ARPHRD_ETHER) {
|
if (dev->type != ARPHRD_ETHER) {
|
||||||
memcpy(dev->dev_addr, &p->iph.saddr, 4);
|
__dev_addr_set(dev, &p->iph.saddr, 4);
|
||||||
memcpy(dev->broadcast, &p->iph.daddr, 4);
|
memcpy(dev->broadcast, &p->iph.daddr, 4);
|
||||||
}
|
}
|
||||||
ip_tunnel_add(itn, t);
|
ip_tunnel_add(itn, t);
|
||||||
|
|
|
@ -425,7 +425,7 @@ static int vti_tunnel_init(struct net_device *dev)
|
||||||
struct ip_tunnel *tunnel = netdev_priv(dev);
|
struct ip_tunnel *tunnel = netdev_priv(dev);
|
||||||
struct iphdr *iph = &tunnel->parms.iph;
|
struct iphdr *iph = &tunnel->parms.iph;
|
||||||
|
|
||||||
memcpy(dev->dev_addr, &iph->saddr, 4);
|
__dev_addr_set(dev, &iph->saddr, 4);
|
||||||
memcpy(dev->broadcast, &iph->daddr, 4);
|
memcpy(dev->broadcast, &iph->daddr, 4);
|
||||||
|
|
||||||
dev->flags = IFF_NOARP;
|
dev->flags = IFF_NOARP;
|
||||||
|
|
|
@ -380,7 +380,7 @@ static int ipip_tunnel_init(struct net_device *dev)
|
||||||
{
|
{
|
||||||
struct ip_tunnel *tunnel = netdev_priv(dev);
|
struct ip_tunnel *tunnel = netdev_priv(dev);
|
||||||
|
|
||||||
memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4);
|
__dev_addr_set(dev, &tunnel->parms.iph.saddr, 4);
|
||||||
memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4);
|
memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4);
|
||||||
|
|
||||||
tunnel->tun_hlen = 0;
|
tunnel->tun_hlen = 0;
|
||||||
|
|
|
@ -1088,7 +1088,7 @@ static void ip6gre_tnl_link_config_common(struct ip6_tnl *t)
|
||||||
struct flowi6 *fl6 = &t->fl.u.ip6;
|
struct flowi6 *fl6 = &t->fl.u.ip6;
|
||||||
|
|
||||||
if (dev->type != ARPHRD_ETHER) {
|
if (dev->type != ARPHRD_ETHER) {
|
||||||
memcpy(dev->dev_addr, &p->laddr, sizeof(struct in6_addr));
|
__dev_addr_set(dev, &p->laddr, sizeof(struct in6_addr));
|
||||||
memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr));
|
memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1521,7 +1521,7 @@ static int ip6gre_tunnel_init(struct net_device *dev)
|
||||||
if (tunnel->parms.collect_md)
|
if (tunnel->parms.collect_md)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
memcpy(dev->dev_addr, &tunnel->parms.laddr, sizeof(struct in6_addr));
|
__dev_addr_set(dev, &tunnel->parms.laddr, sizeof(struct in6_addr));
|
||||||
memcpy(dev->broadcast, &tunnel->parms.raddr, sizeof(struct in6_addr));
|
memcpy(dev->broadcast, &tunnel->parms.raddr, sizeof(struct in6_addr));
|
||||||
|
|
||||||
if (ipv6_addr_any(&tunnel->parms.raddr))
|
if (ipv6_addr_any(&tunnel->parms.raddr))
|
||||||
|
|
|
@ -1449,7 +1449,7 @@ static void ip6_tnl_link_config(struct ip6_tnl *t)
|
||||||
unsigned int mtu;
|
unsigned int mtu;
|
||||||
int t_hlen;
|
int t_hlen;
|
||||||
|
|
||||||
memcpy(dev->dev_addr, &p->laddr, sizeof(struct in6_addr));
|
__dev_addr_set(dev, &p->laddr, sizeof(struct in6_addr));
|
||||||
memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr));
|
memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr));
|
||||||
|
|
||||||
/* Set up flowi template */
|
/* Set up flowi template */
|
||||||
|
|
|
@ -660,7 +660,7 @@ static void vti6_link_config(struct ip6_tnl *t, bool keep_mtu)
|
||||||
struct net_device *tdev = NULL;
|
struct net_device *tdev = NULL;
|
||||||
int mtu;
|
int mtu;
|
||||||
|
|
||||||
memcpy(dev->dev_addr, &p->laddr, sizeof(struct in6_addr));
|
__dev_addr_set(dev, &p->laddr, sizeof(struct in6_addr));
|
||||||
memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr));
|
memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr));
|
||||||
|
|
||||||
p->flags &= ~(IP6_TNL_F_CAP_XMIT | IP6_TNL_F_CAP_RCV |
|
p->flags &= ~(IP6_TNL_F_CAP_XMIT | IP6_TNL_F_CAP_RCV |
|
||||||
|
|
|
@ -204,7 +204,7 @@ static int ipip6_tunnel_create(struct net_device *dev)
|
||||||
struct sit_net *sitn = net_generic(net, sit_net_id);
|
struct sit_net *sitn = net_generic(net, sit_net_id);
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
memcpy(dev->dev_addr, &t->parms.iph.saddr, 4);
|
__dev_addr_set(dev, &t->parms.iph.saddr, 4);
|
||||||
memcpy(dev->broadcast, &t->parms.iph.daddr, 4);
|
memcpy(dev->broadcast, &t->parms.iph.daddr, 4);
|
||||||
|
|
||||||
if ((__force u16)t->parms.i_flags & SIT_ISATAP)
|
if ((__force u16)t->parms.i_flags & SIT_ISATAP)
|
||||||
|
@ -1149,7 +1149,7 @@ static void ipip6_tunnel_update(struct ip_tunnel *t, struct ip_tunnel_parm *p,
|
||||||
synchronize_net();
|
synchronize_net();
|
||||||
t->parms.iph.saddr = p->iph.saddr;
|
t->parms.iph.saddr = p->iph.saddr;
|
||||||
t->parms.iph.daddr = p->iph.daddr;
|
t->parms.iph.daddr = p->iph.daddr;
|
||||||
memcpy(t->dev->dev_addr, &p->iph.saddr, 4);
|
__dev_addr_set(t->dev, &p->iph.saddr, 4);
|
||||||
memcpy(t->dev->broadcast, &p->iph.daddr, 4);
|
memcpy(t->dev->broadcast, &p->iph.daddr, 4);
|
||||||
ipip6_tunnel_link(sitn, t);
|
ipip6_tunnel_link(sitn, t);
|
||||||
t->parms.iph.ttl = p->iph.ttl;
|
t->parms.iph.ttl = p->iph.ttl;
|
||||||
|
|
Loading…
Reference in New Issue