Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
u010088926
rt-thread
提交
43228aeb
R
rt-thread
项目概览
u010088926
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
43228aeb
编写于
2月 28, 2013
作者:
wuyangyong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed list_tcps bug: ipaddr_ntoa isn't reentrant.
上级
0df78e45
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
304 addition
and
276 deletion
+304
-276
components/net/lwip/src/netif/ethernetif.c
components/net/lwip/src/netif/ethernetif.c
+304
-276
未找到文件。
components/net/lwip/src/netif/ethernetif.c
浏览文件 @
43228aeb
...
...
@@ -14,6 +14,7 @@
* 2012-04-10 Bernard add more compatible with RT-Thread.
* 2012-11-12 Bernard The network interface can be initialized
* after lwIP initialization.
* 2013-02-28 aozima fixed list_tcps bug: ipaddr_ntoa isn't reentrant.
*/
/*
...
...
@@ -451,11 +452,16 @@ void list_if(void)
rt_ubase_t
index
;
struct
netif
*
netif
;
rt_enter_critical
();
netif
=
netif_list
;
while
(
netif
!=
RT_NULL
)
{
rt_kprintf
(
"network interface: %c%c%s
\n
"
,
netif
->
name
[
0
],
netif
->
name
[
1
],
(
netif
==
netif_default
)
?
" (Default)"
:
""
);
rt_kprintf
(
"network interface: %c%c%s
\n
"
,
netif
->
name
[
0
],
netif
->
name
[
1
],
(
netif
==
netif_default
)
?
" (Default)"
:
""
);
rt_kprintf
(
"MTU: %d
\n
"
,
netif
->
mtu
);
rt_kprintf
(
"MAC: "
);
for
(
index
=
0
;
index
<
netif
->
hwaddr_len
;
index
++
)
...
...
@@ -489,6 +495,8 @@ void list_if(void)
}
}
#endif
/**< #if LWIP_DNS */
rt_exit_critical
();
}
FINSH_FUNCTION_EXPORT
(
list_if
,
list
network
interface
information
);
...
...
@@ -496,9 +504,13 @@ FINSH_FUNCTION_EXPORT(list_if, list network interface information);
#include <lwip/tcp.h>
#include <lwip/tcp_impl.h>
void
list_tcps
()
void
list_tcps
(
void
)
{
rt_uint32_t
num
=
0
;
struct
tcp_pcb
*
pcb
;
char
local_ip_str
[
16
];
char
remote_ip_str
[
16
];
extern
struct
tcp_pcb
*
tcp_active_pcbs
;
extern
union
tcp_listen_pcbs_t
tcp_listen_pcbs
;
extern
struct
tcp_pcb
*
tcp_tw_pcbs
;
...
...
@@ -508,27 +520,43 @@ void list_tcps()
rt_kprintf
(
"Active PCB states:
\n
"
);
for
(
pcb
=
tcp_active_pcbs
;
pcb
!=
NULL
;
pcb
=
pcb
->
next
)
{
rt_kprintf
(
"%s:%d <==> %s:%d snd_nxt %d rcv_nxt %d "
,
ipaddr_ntoa
(
&
(
pcb
->
local_ip
)),
pcb
->
local_port
,
ipaddr_ntoa
(
&
(
pcb
->
remote_ip
)),
pcb
->
remote_port
,
pcb
->
snd_nxt
,
pcb
->
rcv_nxt
);
strcpy
(
local_ip_str
,
ipaddr_ntoa
(
&
(
pcb
->
local_ip
)));
strcpy
(
remote_ip_str
,
ipaddr_ntoa
(
&
(
pcb
->
remote_ip
)));
rt_kprintf
(
"#%d %s:%d <==> %s:%d snd_nxt 0x%08X rcv_nxt 0x%08X "
,
num
++
,
local_ip_str
,
pcb
->
local_port
,
remote_ip_str
,
pcb
->
remote_port
,
pcb
->
snd_nxt
,
pcb
->
rcv_nxt
);
rt_kprintf
(
"state: %s
\n
"
,
tcp_state_str
[
pcb
->
state
]);
}
rt_kprintf
(
"Listen PCB states:
\n
"
);
num
=
0
;
for
(
pcb
=
(
struct
tcp_pcb
*
)
tcp_listen_pcbs
.
pcbs
;
pcb
!=
NULL
;
pcb
=
pcb
->
next
)
{
rt_kprintf
(
"local port %d "
,
pcb
->
local_port
);
rt_kprintf
(
"#%d local port %d "
,
num
++
,
pcb
->
local_port
);
rt_kprintf
(
"state: %s
\n
"
,
tcp_state_str
[
pcb
->
state
]);
}
rt_kprintf
(
"TIME-WAIT PCB states:
\n
"
);
num
=
0
;
for
(
pcb
=
tcp_tw_pcbs
;
pcb
!=
NULL
;
pcb
=
pcb
->
next
)
{
rt_kprintf
(
"%s:%d <==> %s:%d snd_nxt %d rcv_nxt %d "
,
ipaddr_ntoa
(
&
(
pcb
->
local_ip
)),
pcb
->
local_port
,
ipaddr_ntoa
(
&
(
pcb
->
remote_ip
)),
pcb
->
remote_port
,
pcb
->
snd_nxt
,
pcb
->
rcv_nxt
);
strcpy
(
local_ip_str
,
ipaddr_ntoa
(
&
(
pcb
->
local_ip
)));
strcpy
(
remote_ip_str
,
ipaddr_ntoa
(
&
(
pcb
->
remote_ip
)));
rt_kprintf
(
"#%d %s:%d <==> %s:%d snd_nxt 0x%08X rcv_nxt 0x%08X "
,
num
++
,
local_ip_str
,
pcb
->
local_port
,
remote_ip_str
,
pcb
->
remote_port
,
pcb
->
snd_nxt
,
pcb
->
rcv_nxt
);
rt_kprintf
(
"state: %s
\n
"
,
tcp_state_str
[
pcb
->
state
]);
}
rt_exit_critical
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录