summaryrefslogtreecommitdiff
path: root/components/net
diff options
context:
space:
mode:
authorhduffddybz <[email protected]>2014-08-30 11:04:13 +0800
committerhduffddybz <[email protected]>2014-08-30 11:04:13 +0800
commit838cdbe660f87cb1469ddae4956180c65eeca7d5 (patch)
tree07413bbe3e41daed6325a0f3de3e16c2cea89cbb /components/net
parent5a7d40f80e055df0bce85c2ef61ba81a1b827bb4 (diff)
change code style
Diffstat (limited to 'components/net')
-rw-r--r--components/net/lwip-head/src/arch/sys_arch.c25
-rw-r--r--components/net/lwip-head/src/lwipopts.h11
-rw-r--r--components/net/lwip-head/src/netif/ethernetif.c44
3 files changed, 38 insertions, 42 deletions
diff --git a/components/net/lwip-head/src/arch/sys_arch.c b/components/net/lwip-head/src/arch/sys_arch.c
index 8317e49eeb..7ad6757bca 100644
--- a/components/net/lwip-head/src/arch/sys_arch.c
+++ b/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)
netif_set_default(ethif->netif);
#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
+#ifdef LWIP_IPV6_MLD
+ ethif->netif->mld_mac_filter = NULL;
+#endif
+#endif
+
#if LWIP_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);
}
#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);
return 0;
diff --git a/components/net/lwip-head/src/lwipopts.h b/components/net/lwip-head/src/lwipopts.h
index 84fa32c76e..4d7961d8e8 100644
--- a/components/net/lwip-head/src/lwipopts.h
+++ b/components/net/lwip-head/src/lwipopts.h
@@ -10,14 +10,15 @@
#define LWIP_NETCONN 1
#ifdef RT_LWIP_IPV6
-#define LWIP_IPV6 1
+#define LWIP_IPV6 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
-#define LWIP_IPV6_AUTOCONFIG 1
+#define LWIP_IPV6_AUTOCONFIG 1
+#endif
+
#endif
#ifdef RT_LWIP_IPV6_MLD
diff --git a/components/net/lwip-head/src/netif/ethernetif.c b/components/net/lwip-head/src/netif/ethernetif.c
index bced7e8b37..cf3262b4fc 100644
--- a/components/net/lwip-head/src/netif/ethernetif.c
+++ b/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 (rt_thread_find("tcpip") != RT_NULL)
{
- struct ip_addr ipaddr, netmask, gw;
+ struct ip_addr ipaddr, netmask, gw;
#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(&netmask, RT_LWIP_MSKADDR0, RT_LWIP_MSKADDR1, RT_LWIP_MSKADDR2, RT_LWIP_MSKADDR3);
#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
- 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;
@@ -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);
+#if LWIP_IPV6
void set_if6(char* netif_name, char* ip6_addr)
{
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)
+#endif
#if LWIP_DNS
#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("gw address: %s\n", ipaddr_ntoa(&(netif->gw)));
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
@@ -558,13 +560,13 @@ void list_tcps(void)
rt_kprintf("Active PCB states:\n");
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(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)));
- #endif
+#endif
rt_kprintf("#%d %s:%d <==> %s:%d snd_nxt 0x%08X rcv_nxt 0x%08X ",
num++,
local_ip_str,
@@ -588,13 +590,13 @@ void list_tcps(void)
num = 0;
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)));
- #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)));
- #endif
+#endif
rt_kprintf("#%d %s:%d <==> %s:%d snd_nxt 0x%08X rcv_nxt 0x%08X ",
num++,