Skip to content

Commit

Permalink
kni: update kernel API to set random MAC address
Browse files Browse the repository at this point in the history
[ backported from upstream commit e6cbfd9 ]

Previously used 'random_ether_addr()' API is removed in upstream kernel
with commit
Commit ba530fea8ca1 ("ethernet: remove random_ether_addr()")

Replacement API 'eth_random_addr()' is around since v3.6 [1], so
simply switching to this API without any version checks.

[1]
0a4dd594982a ("etherdevice: Rename random_ether_addr to eth_random_addr")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
  • Loading branch information
Ferruh Yigit authored and bluca committed Feb 18, 2022
1 parent 105b5a4 commit 2bc455e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions kernel/linux/kni/kni_misc.c
Expand Up @@ -403,11 +403,8 @@ kni_ioctl_create(struct net *net, uint32_t ioctl_num,
if (is_valid_ether_addr(dev_info.mac_addr))
memcpy(net_dev->dev_addr, dev_info.mac_addr, ETH_ALEN);
else
/*
* Generate random mac address. eth_random_addr() is the
* newer version of generating mac address in kernel.
*/
random_ether_addr(net_dev->dev_addr);
/* Generate random MAC address. */
eth_random_addr(net_dev->dev_addr);

if (dev_info.mtu)
net_dev->mtu = dev_info.mtu;
Expand Down

0 comments on commit 2bc455e

Please sign in to comment.