Create network interfaces for EoE devices with alias as eoeXaY.
authorFlorian Pose <fp@igh-essen.com>
Wed, 12 Sep 2007 10:00:39 +0000
changeset 712 14f899ac51f0
parent 711 a36f48ff2ba0
child 713 ae41cadd25b6
Create network interfaces for EoE devices with alias as eoeXaY.
master/ethernet.c
--- a/master/ethernet.c	Wed Sep 12 09:50:47 2007 +0000
+++ b/master/ethernet.c	Wed Sep 12 10:00:39 2007 +0000
@@ -117,12 +117,16 @@
     eoe->tx_rate = 0;
     eoe->rate_jiffies = 0;
 
-    /* device name eoe<MASTER>s<SLAVE>, because system tools don't like
-     * hyphens etc. in interface names. */
-    sprintf(name, "eoe%us%u", slave->master->index, slave->ring_position);
+    /* device name eoe<MASTER>[as]<SLAVE>, because networking scripts don't
+     * like hyphens etc. in interface names. */
+    if (slave->sii_alias) {
+        sprintf(name, "eoe%ua%u", slave->master->index, slave->sii_alias);
+    } else {
+        sprintf(name, "eoe%us%u", slave->master->index, slave->ring_position);
+    }
 
     if (!(eoe->dev = alloc_netdev(sizeof(ec_eoe_t *), name, ether_setup))) {
-        EC_ERR("Unable to allocate net_device for EoE handler!\n");
+        EC_ERR("Unable to allocate net_device %s for EoE handler!\n", name);
         goto out_return;
     }