summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2018-05-26 08:16:58 +0800
committerGitHub <[email protected]>2018-05-26 08:16:58 +0800
commit51db86ca52c05ece57831151adb0970dca7610f0 (patch)
tree4f48f58b7230dee49dbaf01123fd7c3fd9828f26 /components
parent7be20be3e5ebf4582155bb3040ea78e6dc2234ca (diff)
parent7d1324ee68a051c7c80bfe73213887a0c3660a3e (diff)
Merge pull request #1464 from aozima/lwip_dev
update lwip Kconfig & cmd.
Diffstat (limited to 'components')
-rw-r--r--components/finsh/msh_cmd.c2
-rw-r--r--components/net/Kconfig8
-rw-r--r--components/net/lwip-1.4.1/src/netif/ethernetif.c30
-rw-r--r--components/net/lwip-2.0.2/src/netif/ethernetif.c33
4 files changed, 72 insertions, 1 deletions
diff --git a/components/finsh/msh_cmd.c b/components/finsh/msh_cmd.c
index 7e9fd68a5f..71dca15976 100644
--- a/components/finsh/msh_cmd.c
+++ b/components/finsh/msh_cmd.c
@@ -385,8 +385,10 @@ FINSH_FUNCTION_EXPORT_ALIAS(cmd_dns, __cmd_dns, list the information of dns);
int cmd_netstat(int argc, char **argv)
{
extern void list_tcps(void);
+ extern void list_udps(void);
list_tcps();
+ list_udps();
return 0;
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_netstat, __cmd_netstat, list the information of TCP / IP);
diff --git a/components/net/Kconfig b/components/net/Kconfig
index 58a327ee1e..2fa1dccf6e 100644
--- a/components/net/Kconfig
+++ b/components/net/Kconfig
@@ -145,6 +145,14 @@ config RT_USING_LWIP
int "the stack size of lwIP thread"
default 1024
+ config LWIP_NO_RX_THREAD
+ bool "Not use Rx thread"
+ default n
+
+ config LWIP_NO_TX_THREAD
+ bool "Not use Tx thread"
+ default n
+
config RT_LWIP_ETHTHREAD_PRIORITY
int "the priority level value of ethernet thread"
default 12
diff --git a/components/net/lwip-1.4.1/src/netif/ethernetif.c b/components/net/lwip-1.4.1/src/netif/ethernetif.c
index 7a8cde12da..ddebaf347e 100644
--- a/components/net/lwip-1.4.1/src/netif/ethernetif.c
+++ b/components/net/lwip-1.4.1/src/netif/ethernetif.c
@@ -618,4 +618,34 @@ void list_tcps(void)
FINSH_FUNCTION_EXPORT(list_tcps, list all of tcp connections);
#endif
+#if LWIP_UDP
+#include "lwip/udp.h"
+void list_udps(void)
+{
+ struct udp_pcb *pcb;
+ rt_uint32_t num = 0;
+ char local_ip_str[16];
+ char remote_ip_str[16];
+
+ rt_enter_critical();
+ rt_kprintf("Active UDP PCB states:\n");
+ for (pcb = udp_pcbs; pcb != NULL; pcb = pcb->next)
+ {
+ strcpy(local_ip_str, ipaddr_ntoa(&(pcb->local_ip)));
+ strcpy(remote_ip_str, ipaddr_ntoa(&(pcb->remote_ip)));
+
+ rt_kprintf("#%d %d %s:%d <==> %s:%d \n",
+ num, (int)pcb->flags,
+ local_ip_str,
+ pcb->local_port,
+ remote_ip_str,
+ pcb->remote_port);
+
+ num++;
+ }
+ rt_exit_critical();
+}
+FINSH_FUNCTION_EXPORT(list_udps, list all of udp connections);
+#endif /* LWIP_UDP */
+
#endif
diff --git a/components/net/lwip-2.0.2/src/netif/ethernetif.c b/components/net/lwip-2.0.2/src/netif/ethernetif.c
index ba23528c58..8ab1727bd3 100644
--- a/components/net/lwip-2.0.2/src/netif/ethernetif.c
+++ b/components/net/lwip-2.0.2/src/netif/ethernetif.c
@@ -563,6 +563,7 @@ void list_if(void)
if (netif->flags & NETIF_FLAG_LINK_UP) rt_kprintf(" LINK_UP");
else rt_kprintf(" LINK_DOWN");
if (netif->flags & NETIF_FLAG_ETHARP) rt_kprintf(" ETHARP");
+ if (netif->flags & NETIF_FLAG_BROADCAST) rt_kprintf(" BROADCAST");
if (netif->flags & NETIF_FLAG_IGMP) rt_kprintf(" IGMP");
rt_kprintf("\n");
rt_kprintf("ip address: %s\n", ipaddr_ntoa(&(netif->ip_addr)));
@@ -672,6 +673,36 @@ void list_tcps(void)
rt_exit_critical();
}
FINSH_FUNCTION_EXPORT(list_tcps, list all of tcp connections);
-#endif
+#endif /* LWIP_TCP */
+
+#if LWIP_UDP
+#include "lwip/udp.h"
+void list_udps(void)
+{
+ struct udp_pcb *pcb;
+ rt_uint32_t num = 0;
+ char local_ip_str[16];
+ char remote_ip_str[16];
+
+ rt_enter_critical();
+ rt_kprintf("Active UDP PCB states:\n");
+ for (pcb = udp_pcbs; pcb != NULL; pcb = pcb->next)
+ {
+ strcpy(local_ip_str, ipaddr_ntoa(&(pcb->local_ip)));
+ strcpy(remote_ip_str, ipaddr_ntoa(&(pcb->remote_ip)));
+
+ rt_kprintf("#%d %d %s:%d <==> %s:%d \n",
+ num, (int)pcb->flags,
+ local_ip_str,
+ pcb->local_port,
+ remote_ip_str,
+ pcb->remote_port);
+
+ num++;
+ }
+ rt_exit_critical();
+}
+FINSH_FUNCTION_EXPORT(list_udps, list all of udp connections);
+#endif /* LWIP_UDP */
#endif