Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

um: net: use eth_hw_addr_random() to generate random mac

Also remove unused "mac" from uml_net struct.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jiri Pirko and committed by
David S. Miller
646cbcda 15c6ff3b

+8 -15
+8 -14
arch/um/drivers/net_kern.c
··· 293 293 #endif 294 294 } 295 295 296 - static int setup_etheraddr(char *str, unsigned char *addr, char *name) 296 + static void setup_etheraddr(struct net_device *dev, char *str) 297 297 { 298 + unsigned char *addr = dev->dev_addr; 298 299 char *end; 299 300 int i; 300 301 ··· 335 334 addr[0] | 0x02, addr[1], addr[2], addr[3], addr[4], 336 335 addr[5]); 337 336 } 338 - return 0; 337 + return; 339 338 340 339 random: 341 340 printk(KERN_INFO 342 - "Choosing a random ethernet address for device %s\n", name); 343 - eth_random_addr(addr); 344 - return 1; 341 + "Choosing a random ethernet address for device %s\n", dev->name); 342 + eth_hw_addr_random(dev); 345 343 } 346 344 347 345 static DEFINE_SPINLOCK(devices_lock); ··· 392 392 struct net_device *dev; 393 393 struct uml_net_private *lp; 394 394 int err, size; 395 - int random_mac; 396 395 397 396 size = transport->private_size + sizeof(struct uml_net_private); 398 397 ··· 418 419 */ 419 420 snprintf(dev->name, sizeof(dev->name), "eth%d", n); 420 421 421 - random_mac = setup_etheraddr(mac, device->mac, dev->name); 422 + setup_etheraddr(dev, mac); 422 423 423 - printk(KERN_INFO "Netdevice %d (%pM) : ", n, device->mac); 424 + printk(KERN_INFO "Netdevice %d (%pM) : ", n, dev->dev_addr); 424 425 425 426 lp = netdev_priv(dev); 426 427 /* This points to the transport private data. It's still clear, but we ··· 467 468 init_timer(&lp->tl); 468 469 spin_lock_init(&lp->lock); 469 470 lp->tl.function = uml_net_user_timer_expire; 470 - memcpy(lp->mac, device->mac, sizeof(lp->mac)); 471 + memcpy(lp->mac, dev->dev_addr, sizeof(lp->mac)); 471 472 472 473 if ((transport->user->init != NULL) && 473 474 ((*transport->user->init)(&lp->user, dev) != 0)) 474 475 goto out_unregister; 475 - 476 - /* don't use eth_mac_addr, it will not work here */ 477 - memcpy(dev->dev_addr, device->mac, ETH_ALEN); 478 - if (random_mac) 479 - dev->addr_assign_type |= NET_ADDR_RANDOM; 480 476 481 477 dev->mtu = transport->user->mtu; 482 478 dev->netdev_ops = &uml_netdev_ops;
-1
arch/um/include/shared/net_kern.h
··· 18 18 struct net_device *dev; 19 19 struct platform_device pdev; 20 20 int index; 21 - unsigned char mac[ETH_ALEN]; 22 21 }; 23 22 24 23 struct uml_net_private {