diff options
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/drivers/net_kern.c | 26 | ||||
-rw-r--r-- | arch/um/include/shared/net_kern.h | 1 |
2 files changed, 10 insertions, 17 deletions
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c index b1314ebf1f72..d8926c303629 100644 --- a/arch/um/drivers/net_kern.c +++ b/arch/um/drivers/net_kern.c | |||
@@ -274,8 +274,8 @@ static void uml_net_poll_controller(struct net_device *dev) | |||
274 | static void uml_net_get_drvinfo(struct net_device *dev, | 274 | static void uml_net_get_drvinfo(struct net_device *dev, |
275 | struct ethtool_drvinfo *info) | 275 | struct ethtool_drvinfo *info) |
276 | { | 276 | { |
277 | strcpy(info->driver, DRIVER_NAME); | 277 | strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver)); |
278 | strcpy(info->version, "42"); | 278 | strlcpy(info->version, "42", sizeof(info->version)); |
279 | } | 279 | } |
280 | 280 | ||
281 | static const struct ethtool_ops uml_net_ethtool_ops = { | 281 | static const struct ethtool_ops uml_net_ethtool_ops = { |
@@ -293,8 +293,9 @@ static void uml_net_user_timer_expire(unsigned long _conn) | |||
293 | #endif | 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 | char *end; | 299 | char *end; |
299 | int i; | 300 | int i; |
300 | 301 | ||
@@ -334,13 +335,12 @@ static int setup_etheraddr(char *str, unsigned char *addr, char *name) | |||
334 | addr[0] | 0x02, addr[1], addr[2], addr[3], addr[4], | 335 | addr[0] | 0x02, addr[1], addr[2], addr[3], addr[4], |
335 | addr[5]); | 336 | addr[5]); |
336 | } | 337 | } |
337 | return 0; | 338 | return; |
338 | 339 | ||
339 | random: | 340 | random: |
340 | printk(KERN_INFO | 341 | printk(KERN_INFO |
341 | "Choosing a random ethernet address for device %s\n", name); | 342 | "Choosing a random ethernet address for device %s\n", dev->name); |
342 | eth_random_addr(addr); | 343 | eth_hw_addr_random(dev); |
343 | return 1; | ||
344 | } | 344 | } |
345 | 345 | ||
346 | static DEFINE_SPINLOCK(devices_lock); | 346 | static DEFINE_SPINLOCK(devices_lock); |
@@ -392,7 +392,6 @@ static void eth_configure(int n, void *init, char *mac, | |||
392 | struct net_device *dev; | 392 | struct net_device *dev; |
393 | struct uml_net_private *lp; | 393 | struct uml_net_private *lp; |
394 | int err, size; | 394 | int err, size; |
395 | int random_mac; | ||
396 | 395 | ||
397 | size = transport->private_size + sizeof(struct uml_net_private); | 396 | size = transport->private_size + sizeof(struct uml_net_private); |
398 | 397 | ||
@@ -419,9 +418,9 @@ static void eth_configure(int n, void *init, char *mac, | |||
419 | */ | 418 | */ |
420 | snprintf(dev->name, sizeof(dev->name), "eth%d", n); | 419 | snprintf(dev->name, sizeof(dev->name), "eth%d", n); |
421 | 420 | ||
422 | random_mac = setup_etheraddr(mac, device->mac, dev->name); | 421 | setup_etheraddr(dev, mac); |
423 | 422 | ||
424 | printk(KERN_INFO "Netdevice %d (%pM) : ", n, device->mac); | 423 | printk(KERN_INFO "Netdevice %d (%pM) : ", n, dev->dev_addr); |
425 | 424 | ||
426 | lp = netdev_priv(dev); | 425 | lp = netdev_priv(dev); |
427 | /* This points to the transport private data. It's still clear, but we | 426 | /* This points to the transport private data. It's still clear, but we |
@@ -468,17 +467,12 @@ static void eth_configure(int n, void *init, char *mac, | |||
468 | init_timer(&lp->tl); | 467 | init_timer(&lp->tl); |
469 | spin_lock_init(&lp->lock); | 468 | spin_lock_init(&lp->lock); |
470 | lp->tl.function = uml_net_user_timer_expire; | 469 | lp->tl.function = uml_net_user_timer_expire; |
471 | memcpy(lp->mac, device->mac, sizeof(lp->mac)); | 470 | memcpy(lp->mac, dev->dev_addr, sizeof(lp->mac)); |
472 | 471 | ||
473 | if ((transport->user->init != NULL) && | 472 | if ((transport->user->init != NULL) && |
474 | ((*transport->user->init)(&lp->user, dev) != 0)) | 473 | ((*transport->user->init)(&lp->user, dev) != 0)) |
475 | goto out_unregister; | 474 | goto out_unregister; |
476 | 475 | ||
477 | /* don't use eth_mac_addr, it will not work here */ | ||
478 | memcpy(dev->dev_addr, device->mac, ETH_ALEN); | ||
479 | if (random_mac) | ||
480 | dev->addr_assign_type |= NET_ADDR_RANDOM; | ||
481 | |||
482 | dev->mtu = transport->user->mtu; | 476 | dev->mtu = transport->user->mtu; |
483 | dev->netdev_ops = ¨_netdev_ops; | 477 | dev->netdev_ops = ¨_netdev_ops; |
484 | dev->ethtool_ops = ¨_net_ethtool_ops; | 478 | dev->ethtool_ops = ¨_net_ethtool_ops; |
diff --git a/arch/um/include/shared/net_kern.h b/arch/um/include/shared/net_kern.h index 5c367f22595b..012ac87d4900 100644 --- a/arch/um/include/shared/net_kern.h +++ b/arch/um/include/shared/net_kern.h | |||
@@ -18,7 +18,6 @@ struct uml_net { | |||
18 | struct net_device *dev; | 18 | struct net_device *dev; |
19 | struct platform_device pdev; | 19 | struct platform_device pdev; |
20 | int index; | 20 | int index; |
21 | unsigned char mac[ETH_ALEN]; | ||
22 | }; | 21 | }; |
23 | 22 | ||
24 | struct uml_net_private { | 23 | struct uml_net_private { |