瀏覽代碼

change code style

hduffddybz 10 年之前
父節點
當前提交
838cdbe660

+ 9 - 16
components/net/lwip-head/src/arch/sys_arch.c

@@ -95,15 +95,16 @@ static void tcpip_init_done_callback(void *arg)
             if (netif_default == RT_NULL)
             if (netif_default == RT_NULL)
                 netif_set_default(ethif->netif);
                 netif_set_default(ethif->netif);
 #ifdef LWIP_IPV6
 #ifdef LWIP_IPV6
-			ethif->netif->output_ip6 = ethip6_output;
-			netif_create_ip6_linklocal_address(ethif->netif, 1);
-	#ifdef LWIP_IPV6_AUTOCONFIG
-			ethif->netif->ip6_autoconfig_enabled = 1;
-	#endif
-	#ifdef LWIP_IPV6_MLD
-			ethif->netif->mld_mac_filter = NULL;
-	#endif
+            ethif->netif->output_ip6 = ethip6_output;
+            netif_create_ip6_linklocal_address(ethif->netif, 1);
+#ifdef LWIP_IPV6_AUTOCONFIG
+            ethif->netif->ip6_autoconfig_enabled = 1;
 #endif
 #endif
+#ifdef LWIP_IPV6_MLD
+            ethif->netif->mld_mac_filter = NULL;
+#endif
+#endif
+
 #if LWIP_DHCP
 #if LWIP_DHCP
             if (ethif->flags & NETIF_FLAG_DHCP)
             if (ethif->flags & NETIF_FLAG_DHCP)
             {
             {
@@ -175,14 +176,6 @@ int lwip_system_init(void)
         netifapi_netif_set_addr(netif_default, &ipaddr, &netmask, &gw);
         netifapi_netif_set_addr(netif_default, &ipaddr, &netmask, &gw);
     }
     }
 #endif
 #endif
-/*#if LWIP_IPV6 && LWIP_IPV6_MLD
-	ip6_addr_t ip6addr_group;
-	IP6_ADDR(&ip6addr_group, 0, 0xfe, 0x80, 0x00, 0x00);
-	IP6_ADDR(&ip6addr_group, 0, 0x00, 0x00, 0x00, 0x00);
-	IP6_ADDR(&ip6addr_group, 0, 0x00, 0x00, 0x00, 0x00);
-	IP6_ADDR(&ip6addr_group, 0, 0x00, 0x00, 0x00, 0x01);
-	netif_mld_mac_filter_fn(netif_default, &ip6addr_group, 0);
-#endif*/
 	rt_kprintf("lwIP-%d.%d.%d initialized!\n", LWIP_VERSION_MAJOR, LWIP_VERSION_MINOR, LWIP_VERSION_REVISION);
 	rt_kprintf("lwIP-%d.%d.%d initialized!\n", LWIP_VERSION_MAJOR, LWIP_VERSION_MINOR, LWIP_VERSION_REVISION);
 
 
 	return 0;
 	return 0;

+ 6 - 5
components/net/lwip-head/src/lwipopts.h

@@ -10,14 +10,15 @@
 #define LWIP_NETCONN                1
 #define LWIP_NETCONN                1
 
 
 #ifdef RT_LWIP_IPV6
 #ifdef RT_LWIP_IPV6
-#define LWIP_IPV6		   			1
+#define LWIP_IPV6                   1
 //#define LWIP_IPV6_DHCP6	       	    1
 //#define LWIP_IPV6_DHCP6	       	    1
-#define LWIP_ICMP6		    		1
-#define LWIP_IPV6_NUM_ADDRESSES	    3
-#endif
+#define LWIP_ICMP6                  1
+#define LWIP_IPV6_NUM_ADDRESSES     3
 
 
 #ifdef RT_LWIP_IPV6_AUTOCONFIG
 #ifdef RT_LWIP_IPV6_AUTOCONFIG
-#define LWIP_IPV6_AUTOCONFIG	    1
+#define LWIP_IPV6_AUTOCONFIG        1
+#endif
+
 #endif
 #endif
 
 
 #ifdef RT_LWIP_IPV6_MLD
 #ifdef RT_LWIP_IPV6_MLD

+ 23 - 21
components/net/lwip-head/src/netif/ethernetif.c

@@ -208,18 +208,18 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, char *name, rt_uint8_
     /* if tcp thread has been started up, we add this netif to the system */
     /* if tcp thread has been started up, we add this netif to the system */
     if (rt_thread_find("tcpip") != RT_NULL)
     if (rt_thread_find("tcpip") != RT_NULL)
     {
     {
-		struct ip_addr ipaddr, netmask, gw;
+        struct ip_addr ipaddr, netmask, gw;
 #if !LWIP_DHCP
 #if !LWIP_DHCP
-      	IP4_ADDR(&ipaddr, RT_LWIP_IPADDR0, RT_LWIP_IPADDR1, RT_LWIP_IPADDR2, RT_LWIP_IPADDR3);
+        IP4_ADDR(&ipaddr, RT_LWIP_IPADDR0, RT_LWIP_IPADDR1, RT_LWIP_IPADDR2, RT_LWIP_IPADDR3);
         IP4_ADDR(&gw, RT_LWIP_GWADDR0, RT_LWIP_GWADDR1, RT_LWIP_GWADDR2, RT_LWIP_GWADDR3);
         IP4_ADDR(&gw, RT_LWIP_GWADDR0, RT_LWIP_GWADDR1, RT_LWIP_GWADDR2, RT_LWIP_GWADDR3);
         IP4_ADDR(&netmask, RT_LWIP_MSKADDR0, RT_LWIP_MSKADDR1, RT_LWIP_MSKADDR2, RT_LWIP_MSKADDR3);
         IP4_ADDR(&netmask, RT_LWIP_MSKADDR0, RT_LWIP_MSKADDR1, RT_LWIP_MSKADDR2, RT_LWIP_MSKADDR3);
 
 
 #else
 #else
-		IP4_ADDR(&ipaddr, 0, 0, 0, 0);
-		IP4_ADDR(&gw, 0, 0, 0, 0);
-		IP4_ADDR(&netmask, 0, 0, 0, 0);
+        IP4_ADDR(&ipaddr, 0, 0, 0, 0);
+        IP4_ADDR(&gw, 0, 0, 0, 0);
+        IP4_ADDR(&netmask, 0, 0, 0, 0);
 #endif
 #endif
-		netifapi_netif_add(netif, &ipaddr, &netmask, &gw, dev, eth_netif_device_init, tcpip_input);
+        netifapi_netif_add(netif, &ipaddr, &netmask, &gw, dev, eth_netif_device_init, tcpip_input);
     }
     }
 
 
     return RT_EOK;
     return RT_EOK;
@@ -437,6 +437,7 @@ void set_if(char* netif_name, char* ip_addr, char* gw_addr, char* nm_addr)
 }
 }
 FINSH_FUNCTION_EXPORT(set_if, set network interface address);
 FINSH_FUNCTION_EXPORT(set_if, set network interface address);
 
 
+#if LWIP_IPV6
 void set_if6(char* netif_name, char* ip6_addr)
 void set_if6(char* netif_name, char* ip6_addr)
 {
 {
 	struct netif* netif = netif_list;
 	struct netif* netif = netif_list;
@@ -467,6 +468,7 @@ void set_if6(char* netif_name, char* ip6_addr)
 	}	
 	}	
 }
 }
 FINSH_FUNCTION_EXPORT(set_if6, set ipv6 local address)
 FINSH_FUNCTION_EXPORT(set_if6, set ipv6 local address)
+#endif
 
 
 #if LWIP_DNS
 #if LWIP_DNS
 #include <lwip/dns.h>
 #include <lwip/dns.h>
@@ -514,12 +516,12 @@ void list_if(void)
         rt_kprintf("ip address: %s\n", ipaddr_ntoa(&(netif->ip_addr)));
         rt_kprintf("ip address: %s\n", ipaddr_ntoa(&(netif->ip_addr)));
         rt_kprintf("gw address: %s\n", ipaddr_ntoa(&(netif->gw)));
         rt_kprintf("gw address: %s\n", ipaddr_ntoa(&(netif->gw)));
         rt_kprintf("net mask  : %s\n", ipaddr_ntoa(&(netif->netmask)));
         rt_kprintf("net mask  : %s\n", ipaddr_ntoa(&(netif->netmask)));
-		
-		rt_kprintf("link-local address: %s\n", ip6addr_ntoa(&(netif->ip6_addr[0])));
-		rt_kprintf("ipv6[1] address: %s\n", ip6addr_ntoa(&(netif->ip6_addr[1])));
-		rt_kprintf("\r\n");
-
-		netif = netif->next;
+#if LWIP_IPV6	
+        rt_kprintf("link-local address: %s\n", ip6addr_ntoa(&(netif->ip6_addr[0])));
+        rt_kprintf("ipv6[1] address: %s\n", ip6addr_ntoa(&(netif->ip6_addr[1])));
+        rt_kprintf("\r\n");
+#endif
+        netif = netif->next;
     }
     }
 
 
 #if LWIP_DNS
 #if LWIP_DNS
@@ -558,13 +560,13 @@ void list_tcps(void)
     rt_kprintf("Active PCB states:\n");
     rt_kprintf("Active PCB states:\n");
     for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next)
     for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next)
     {
     {
-			#ifndef LWIP_IPV6
+#ifndef LWIP_IPV6
         strcpy(local_ip_str, ipaddr_ntoa(&(pcb->local_ip)));
         strcpy(local_ip_str, ipaddr_ntoa(&(pcb->local_ip)));
         strcpy(remote_ip_str, ipaddr_ntoa(&(pcb->remote_ip)));
         strcpy(remote_ip_str, ipaddr_ntoa(&(pcb->remote_ip)));
-			#else
-				strcpy(local_ip_str, ip6addr_ntoa((ip6_addr_t *)&(pcb->local_ip)));
+#else
+        strcpy(local_ip_str, ip6addr_ntoa((ip6_addr_t *)&(pcb->local_ip)));
         strcpy(remote_ip_str, ip6addr_ntoa((ip6_addr_t *)&(pcb->remote_ip)));
         strcpy(remote_ip_str, ip6addr_ntoa((ip6_addr_t *)&(pcb->remote_ip)));
-			#endif
+#endif
         rt_kprintf("#%d %s:%d <==> %s:%d snd_nxt 0x%08X rcv_nxt 0x%08X ",
         rt_kprintf("#%d %s:%d <==> %s:%d snd_nxt 0x%08X rcv_nxt 0x%08X ",
                    num++,
                    num++,
                    local_ip_str,
                    local_ip_str,
@@ -588,13 +590,13 @@ void list_tcps(void)
     num = 0;
     num = 0;
     for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next)
     for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next)
     {
     {
-			#ifndef LWIP_IPV6
-				strcpy(local_ip_str, ipaddr_ntoa(&(pcb->local_ip)));
+#ifndef LWIP_IPV6
+        strcpy(local_ip_str, ipaddr_ntoa(&(pcb->local_ip)));
         strcpy(remote_ip_str, ipaddr_ntoa(&(pcb->remote_ip)));
         strcpy(remote_ip_str, ipaddr_ntoa(&(pcb->remote_ip)));
-			#else
-				strcpy(local_ip_str, ip6addr_ntoa((ip6_addr_t *)&(pcb->local_ip)));
+#else
+        strcpy(local_ip_str, ip6addr_ntoa((ip6_addr_t *)&(pcb->local_ip)));
         strcpy(remote_ip_str, ip6addr_ntoa((ip6_addr_t *)&(pcb->remote_ip)));
         strcpy(remote_ip_str, ip6addr_ntoa((ip6_addr_t *)&(pcb->remote_ip)));
-			#endif
+#endif
 
 
         rt_kprintf("#%d %s:%d <==> %s:%d snd_nxt 0x%08X rcv_nxt 0x%08X ",
         rt_kprintf("#%d %s:%d <==> %s:%d snd_nxt 0x%08X rcv_nxt 0x%08X ",
                    num++,
                    num++,