diff options
Diffstat (limited to 'arch/um/drivers/net_kern.c')
-rw-r--r-- | arch/um/drivers/net_kern.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c index a492e59883a3..d2996183e584 100644 --- a/arch/um/drivers/net_kern.c +++ b/arch/um/drivers/net_kern.c | |||
@@ -293,7 +293,7 @@ static void uml_net_user_timer_expire(unsigned long _conn) | |||
293 | #endif | 293 | #endif |
294 | } | 294 | } |
295 | 295 | ||
296 | static void setup_etheraddr(char *str, unsigned char *addr, char *name) | 296 | static int setup_etheraddr(char *str, unsigned char *addr, char *name) |
297 | { | 297 | { |
298 | char *end; | 298 | char *end; |
299 | int i; | 299 | int i; |
@@ -334,12 +334,13 @@ static void setup_etheraddr(char *str, unsigned char *addr, char *name) | |||
334 | addr[0] | 0x02, addr[1], addr[2], addr[3], addr[4], | 334 | addr[0] | 0x02, addr[1], addr[2], addr[3], addr[4], |
335 | addr[5]); | 335 | addr[5]); |
336 | } | 336 | } |
337 | return; | 337 | return 0; |
338 | 338 | ||
339 | random: | 339 | random: |
340 | printk(KERN_INFO | 340 | printk(KERN_INFO |
341 | "Choosing a random ethernet address for device %s\n", name); | 341 | "Choosing a random ethernet address for device %s\n", name); |
342 | random_ether_addr(addr); | 342 | random_ether_addr(addr); |
343 | return 1; | ||
343 | } | 344 | } |
344 | 345 | ||
345 | static DEFINE_SPINLOCK(devices_lock); | 346 | static DEFINE_SPINLOCK(devices_lock); |
@@ -391,6 +392,7 @@ static void eth_configure(int n, void *init, char *mac, | |||
391 | struct net_device *dev; | 392 | struct net_device *dev; |
392 | struct uml_net_private *lp; | 393 | struct uml_net_private *lp; |
393 | int err, size; | 394 | int err, size; |
395 | int random_mac; | ||
394 | 396 | ||
395 | size = transport->private_size + sizeof(struct uml_net_private); | 397 | size = transport->private_size + sizeof(struct uml_net_private); |
396 | 398 | ||
@@ -417,7 +419,7 @@ static void eth_configure(int n, void *init, char *mac, | |||
417 | */ | 419 | */ |
418 | snprintf(dev->name, sizeof(dev->name), "eth%d", n); | 420 | snprintf(dev->name, sizeof(dev->name), "eth%d", n); |
419 | 421 | ||
420 | setup_etheraddr(mac, device->mac, dev->name); | 422 | random_mac = setup_etheraddr(mac, device->mac, dev->name); |
421 | 423 | ||
422 | printk(KERN_INFO "Netdevice %d (%pM) : ", n, device->mac); | 424 | printk(KERN_INFO "Netdevice %d (%pM) : ", n, device->mac); |
423 | 425 | ||
@@ -474,6 +476,9 @@ static void eth_configure(int n, void *init, char *mac, | |||
474 | 476 | ||
475 | /* don't use eth_mac_addr, it will not work here */ | 477 | /* don't use eth_mac_addr, it will not work here */ |
476 | memcpy(dev->dev_addr, device->mac, ETH_ALEN); | 478 | memcpy(dev->dev_addr, device->mac, ETH_ALEN); |
479 | if (random_mac) | ||
480 | dev->addr_assign_type |= NET_ADDR_RANDOM; | ||
481 | |||
477 | dev->mtu = transport->user->mtu; | 482 | dev->mtu = transport->user->mtu; |
478 | dev->netdev_ops = ¨_netdev_ops; | 483 | dev->netdev_ops = ¨_netdev_ops; |
479 | dev->ethtool_ops = ¨_net_ethtool_ops; | 484 | dev->ethtool_ops = ¨_net_ethtool_ops; |