Merge pull request #1464 from aozima/lwip_dev
update lwip Kconfig & cmd.
This commit is contained in:
commit
51db86ca52
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue