Set initial device address using a random ethernet address.
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Mon, 24 May 2010 08:57:19 +0000 (04:57 -0400)
committerThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Mon, 24 May 2010 08:57:19 +0000 (04:57 -0400)
ndeth.c

diff --git a/ndeth.c b/ndeth.c
index c9402c4..802ec11 100644 (file)
--- a/ndeth.c
+++ b/ndeth.c
@@ -62,10 +62,13 @@ struct net_device *ndeth;
 static __init int ndeth_init(void)
 {
        int r = -ENOMEM;
 static __init int ndeth_init(void)
 {
        int r = -ENOMEM;
+       char addr[ETH_ALEN];
        ndeth = alloc_etherdev(0);
        if (!ndeth)
                goto out;
        ndeth->netdev_ops = &ndeth_ops;
        ndeth = alloc_etherdev(0);
        if (!ndeth)
                goto out;
        ndeth->netdev_ops = &ndeth_ops;
+       random_ether_addr(addr);
+       memcpy(ndeth->dev_addr, addr, ETH_ALEN);
        r = register_netdev(ndeth);
        if (r)
                goto reg_out;
        r = register_netdev(ndeth);
        if (r)
                goto reg_out;