]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - net/net.c
Merge branch 'master' of git://git.denx.de/u-boot-mmc
[karo-tx-uboot.git] / net / net.c
index 67df3c9a9979fe7ab4256fb60fcaa3a710d5d0fb..7a6058339cccaf8a21879a685c837a0a10fc5695 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -321,7 +321,8 @@ NetInitLoop(proto_t protocol)
 
        /* update only when the environment has changed */
        if (env_changed_id != env_id) {
-               NetCopyIP(&NetOurIP, &bd->bi_ip_addr);
+               NetOurIP = getenv_IPaddr("ipaddr");
+               NetCopyIP(&bd->bi_ip_addr, &NetOurIP);
                NetOurGatewayIP = getenv_IPaddr("gatewayip");
                NetOurSubnetMask = getenv_IPaddr("netmask");
                NetServerIP = getenv_IPaddr("serverip");
@@ -423,7 +424,11 @@ restart:
                        /* always use ARP to get server ethernet address */
                        TftpStart();
                        break;
-
+#ifdef CONFIG_CMD_TFTPSRV
+               case TFTPSRV:
+                       TftpStartServer();
+                       break;
+#endif
 #if defined(CONFIG_CMD_DHCP)
                case DHCP:
                        BootpTry = 0;
@@ -1103,51 +1108,50 @@ CDPHandler(const uchar *pkt, unsigned len)
                tlen -= 4;
 
                switch (type) {
-                       case CDP_DEVICE_ID_TLV:
-                               break;
-                       case CDP_ADDRESS_TLV:
-                               break;
-                       case CDP_PORT_ID_TLV:
-                               break;
-                       case CDP_CAPABILITIES_TLV:
-                               break;
-                       case CDP_VERSION_TLV:
-                               break;
-                       case CDP_PLATFORM_TLV:
-                               break;
-                       case CDP_NATIVE_VLAN_TLV:
-                               nvlan = *ss;
-                               break;
-                       case CDP_APPLIANCE_VLAN_TLV:
-                               t = (const uchar *)ss;
-                               while (tlen > 0) {
-                                       if (tlen < 3)
-                                               goto pkt_short;
+               case CDP_DEVICE_ID_TLV:
+                       break;
+               case CDP_ADDRESS_TLV:
+                       break;
+               case CDP_PORT_ID_TLV:
+                       break;
+               case CDP_CAPABILITIES_TLV:
+                       break;
+               case CDP_VERSION_TLV:
+                       break;
+               case CDP_PLATFORM_TLV:
+                       break;
+               case CDP_NATIVE_VLAN_TLV:
+                       nvlan = *ss;
+                       break;
+               case CDP_APPLIANCE_VLAN_TLV:
+                       t = (const uchar *)ss;
+                       while (tlen > 0) {
+                               if (tlen < 3)
+                                       goto pkt_short;
 
-                                       applid = t[0];
-                                       ss = (const ushort *)(t + 1);
+                               applid = t[0];
+                               ss = (const ushort *)(t + 1);
 
 #ifdef CONFIG_CDP_APPLIANCE_VLAN_TYPE
-                                       if (applid ==
-                                           CONFIG_CDP_APPLIANCE_VLAN_TYPE)
-                                               vlan = *ss;
+                               if (applid == CONFIG_CDP_APPLIANCE_VLAN_TYPE)
+                                       vlan = *ss;
 #else
-                                       /* XXX will this work; dunno */
-                                       vlan = ntohs(*ss);
+                               /* XXX will this work; dunno */
+                               vlan = ntohs(*ss);
 #endif
-                                       t += 3; tlen -= 3;
-                               }
-                               break;
-                       case CDP_TRIGGER_TLV:
-                               break;
-                       case CDP_POWER_CONSUMPTION_TLV:
-                               break;
-                       case CDP_SYSNAME_TLV:
-                               break;
-                       case CDP_SYSOBJECT_TLV:
-                               break;
-                       case CDP_MANAGEMENT_ADDRESS_TLV:
-                               break;
+                               t += 3; tlen -= 3;
+                       }
+                       break;
+               case CDP_TRIGGER_TLV:
+                       break;
+               case CDP_POWER_CONSUMPTION_TLV:
+                       break;
+               case CDP_SYSNAME_TLV:
+                       break;
+               case CDP_SYSOBJECT_TLV:
+                       break;
+               case CDP_MANAGEMENT_ADDRESS_TLV:
+                       break;
                }
        }
 
@@ -1608,7 +1612,7 @@ NetReceive(volatile uchar *inpkt, int len)
 #ifdef CONFIG_MCAST_TFTP
                        if (Mcast_addr != tmp)
 #endif
-                       return;
+                               return;
                }
                /* Read source IP address for later use */
                src_ip = NetReadIP(&ip->ip_src);
@@ -1617,7 +1621,8 @@ NetReceive(volatile uchar *inpkt, int len)
                 * a fragment, and either the complete packet or NULL if
                 * it is a fragment (if !CONFIG_IP_DEFRAG, it returns NULL)
                 */
-               if (!(ip = NetDefragment(ip, &len)))
+               ip = NetDefragment(ip, &len);
+               if (!ip)
                        return;
                /*
                 * watch for ICMP host redirects
@@ -1791,6 +1796,7 @@ common:
                /* Fall through */
 
        case NETCONS:
+       case TFTPSRV:
                if (NetOurIP == 0) {
                        puts("*** ERROR: `ipaddr' not set\n");
                        return 1;
@@ -1883,7 +1889,7 @@ NetSetEther(volatile uchar *xet, uchar * addr, uint prot)
        memcpy(et->et_dest, addr, 6);
        memcpy(et->et_src, NetOurEther, 6);
        if ((myvlanid & VLAN_IDMASK) == VLAN_NONE) {
-       et->et_protlen = htons(prot);
+               et->et_protlen = htons(prot);
                return ETHER_HDR_SIZE;
        } else {
                VLAN_Ethernet_t *vet = (VLAN_Ethernet_t *)xet;