summaryrefslogtreecommitdiff
path: root/net/eth.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2004-04-15 21:48:45 +0000
committerwdenk <wdenk>2004-04-15 21:48:45 +0000
commita3d991bd0da8b9fb9dbf2c7481091c3d082b9b13 (patch)
treec474375dc1cc812e006921ab2ad122b21923e512 /net/eth.c
parenta6ab4bf978a3d5a52a47bbd259b7eb4c860ebd0c (diff)
Patches by Pantelis Antoniou, 30 Mar 2004:
add networking support for VLANs (802.1q), and CDP (Cisco Discovery Protocol)
Diffstat (limited to 'net/eth.c')
-rw-r--r--net/eth.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/net/eth.c b/net/eth.c
index 7eae469684..7f8afe7bcf 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -87,6 +87,14 @@ int eth_register(struct eth_device* dev)
if (!eth_devices) {
eth_current = eth_devices = dev;
+#ifdef CONFIG_NET_MULTI
+ /* update current ethernet name */
+ {
+ char *act = getenv("ethact");
+ if (act == NULL || strcmp(act, eth_current->name) != 0)
+ setenv("ethact", eth_current->name);
+ }
+#endif
} else {
for (d=eth_devices; d->next!=eth_devices; d=d->next);
d->next = dev;
@@ -221,6 +229,16 @@ int eth_initialize(bd_t *bis)
dev = dev->next;
} while(dev != eth_devices);
+#ifdef CONFIG_NET_MULTI
+ /* update current ethernet name */
+ if (eth_current) {
+ char *act = getenv("ethact");
+ if (act == NULL || strcmp(act, eth_current->name) != 0)
+ setenv("ethact", eth_current->name);
+ } else
+ setenv("ethact", NULL);
+#endif
+
putc ('\n');
}
@@ -326,12 +344,44 @@ void eth_try_another(int first_restart)
eth_current = eth_current->next;
+#ifdef CONFIG_NET_MULTI
+ /* update current ethernet name */
+ {
+ char *act = getenv("ethact");
+ if (act == NULL || strcmp(act, eth_current->name) != 0)
+ setenv("ethact", eth_current->name);
+ }
+#endif
+
if (first_failed == eth_current)
{
NetRestartWrap = 1;
}
}
+#ifdef CONFIG_NET_MULTI
+void eth_set_current(void)
+{
+ char *act;
+ struct eth_device* old_current;
+
+ if (!eth_current) /* XXX no current */
+ return;
+
+ act = getenv("ethact");
+ if (act != NULL) {
+ old_current = eth_current;
+ do {
+ if (strcmp(eth_current->name, act) == 0)
+ return;
+ eth_current = eth_current->next;
+ } while (old_current != eth_current);
+ }
+
+ setenv("ethact", eth_current->name);
+}
+#endif
+
char *eth_get_name (void)
{
return (eth_current ? eth_current->name : "unknown");