Skip to content

Commit 25f929f

Browse files
congwangdavem330
authored andcommitted
net: allow setting mac address of loopback device
We are trying to mirror the local traffic from lo to eth0, allowing setting mac address of lo to eth0 would make the ether addresses in these packets correct, so that we don't have to modify the ether header again. Since usually no one cares about its mac address (all-zero), it is safe to allow those who care to set its mac address. Cc: Hannes Frederic Sowa <hannes@stressinduktion.org> Cc: Neil Horman <nhorman@tuxdriver.com> Cc: Stephen Hemminger <stephen@networkplumber.org> Cc: Eric Dumazet <edumazet@google.com> Cc: David S. Miller <davem@davemloft.net> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0e42aa4 commit 25f929f

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎drivers/net/loopback.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ static const struct net_device_ops loopback_ops = {
160160
.ndo_init = loopback_dev_init,
161161
.ndo_start_xmit= loopback_xmit,
162162
.ndo_get_stats64 = loopback_get_stats64,
163+
.ndo_set_mac_address = eth_mac_addr,
163164
};
164165

165166
/*
@@ -174,6 +175,7 @@ static void loopback_setup(struct net_device *dev)
174175
dev->tx_queue_len = 0;
175176
dev->type = ARPHRD_LOOPBACK; /* 0x0001*/
176177
dev->flags = IFF_LOOPBACK;
178+
dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
177179
dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
178180
dev->hw_features = NETIF_F_ALL_TSO | NETIF_F_UFO;
179181
dev->features = NETIF_F_SG | NETIF_F_FRAGLIST

0 commit comments

Comments
 (0)