summaryrefslogtreecommitdiffstats
path: root/common/cmd_net.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 /common/cmd_net.c
parenta6ab4bf978a3d5a52a47bbd259b7eb4c860ebd0c (diff)
downloadbootable_bootloader_goldelico_gta04-a3d991bd0da8b9fb9dbf2c7481091c3d082b9b13.zip
bootable_bootloader_goldelico_gta04-a3d991bd0da8b9fb9dbf2c7481091c3d082b9b13.tar.gz
bootable_bootloader_goldelico_gta04-a3d991bd0da8b9fb9dbf2c7481091c3d082b9b13.tar.bz2
Patches by Pantelis Antoniou, 30 Mar 2004:
add networking support for VLANs (802.1q), and CDP (Cisco Discovery Protocol)
Diffstat (limited to 'common/cmd_net.c')
-rw-r--r--common/cmd_net.c55
1 files changed, 54 insertions, 1 deletions
diff --git a/common/cmd_net.c b/common/cmd_net.c
index f13e9d4..85a9023 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -96,7 +96,7 @@ U_BOOT_CMD(
static void netboot_update_env(void)
{
- char tmp[16] ;
+ char tmp[22] ;
if (NetOurGatewayIP) {
ip_to_string (NetOurGatewayIP, tmp);
@@ -139,6 +139,16 @@ static void netboot_update_env(void)
if (NetOurNISDomain[0])
setenv("domain", NetOurNISDomain);
+ if (ntohs(NetOurVLAN) != (ushort)-1) {
+ VLAN_to_string(NetOurVLAN, tmp);
+ setenv("vlan", tmp);
+ }
+
+ if (ntohs(NetOurNativeVLAN) != (ushort)-1) {
+ VLAN_to_string(NetOurNativeVLAN, tmp);
+ setenv("vlan", tmp);
+ }
+
}
static int
netboot_common (int proto, cmd_tbl_t *cmdtp, int argc, char *argv[])
@@ -238,4 +248,47 @@ U_BOOT_CMD(
);
#endif /* CFG_CMD_PING */
+#if (CONFIG_COMMANDS & CFG_CMD_CDP)
+
+static void cdp_update_env(void)
+{
+ char tmp[16];
+
+ if (CDPApplianceVLAN != htons(-1)) {
+ printf("CDP offered appliance VLAN %d\n", ntohs(CDPApplianceVLAN));
+ VLAN_to_string(CDPApplianceVLAN, tmp);
+ setenv("vlan", tmp);
+ NetOurVLAN = CDPApplianceVLAN;
+ }
+
+ if (CDPNativeVLAN != htons(-1)) {
+ printf("CDP offered native VLAN %d\n", ntohs(CDPNativeVLAN));
+ VLAN_to_string(CDPNativeVLAN, tmp);
+ setenv("nvlan", tmp);
+ NetOurNativeVLAN = CDPNativeVLAN;
+ }
+
+}
+
+int do_cdp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ int r;
+
+ r = NetLoop(CDP);
+ if (r < 0) {
+ printf("cdp failed; perhaps not a CISCO switch?\n");
+ return 1;
+ }
+
+ cdp_update_env();
+
+ return 0;
+}
+
+U_BOOT_CMD(
+ cdp, 1, 1, do_cdp,
+ "cdp - Perform CDP network configuration\n",
+);
+#endif /* CFG_CMD_CDP */
+
#endif /* CFG_CMD_NET */