Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
RT-Thread
rt-thread
提交
72298bac
R
rt-thread
项目概览
RT-Thread
/
rt-thread
大约 1 年 前同步成功
通知
775
Star
8911
Fork
4735
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
72298bac
编写于
1月 31, 2015
作者:
B
bernard
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'bernard/master'
上级
1f2a6e3a
7e11b8eb
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
64 addition
and
14 deletion
+64
-14
components/dfs/src/dfs.c
components/dfs/src/dfs.c
+4
-0
components/drivers/src/ringbuffer.c
components/drivers/src/ringbuffer.c
+5
-5
components/net/lwip-1.4.1/src/core/ipv4/ip.c
components/net/lwip-1.4.1/src/core/ipv4/ip.c
+32
-5
components/net/lwip_nat/README.md
components/net/lwip_nat/README.md
+19
-0
components/net/lwip_nat/ipv4_nat.c
components/net/lwip_nat/ipv4_nat.c
+3
-3
components/net/lwip_nat/ipv4_nat.h
components/net/lwip_nat/ipv4_nat.h
+1
-1
未找到文件。
components/dfs/src/dfs.c
浏览文件 @
72298bac
...
...
@@ -234,7 +234,11 @@ int fd_is_open(const char *pathname)
mountpath
=
fullpath
+
strlen
(
fs
->
path
);
dfs_lock
();
#ifdef DFS_USING_STDIO
for
(
index
=
3
;
index
<
DFS_FD_MAX
+
3
;
index
++
)
#else
for
(
index
=
0
;
index
<
DFS_FD_MAX
;
index
++
)
#endif
{
fd
=
&
(
fd_table
[
index
]);
if
(
fd
->
fs
==
RT_NULL
)
...
...
components/drivers/src/ringbuffer.c
浏览文件 @
72298bac
...
...
@@ -100,13 +100,13 @@ rt_size_t rt_ringbuffer_put_force(struct rt_ringbuffer *rb,
const
rt_uint8_t
*
ptr
,
rt_uint16_t
length
)
{
enum
rt_ringbuffer_state
old_state
;
rt_uint16_t
space_length
;
RT_ASSERT
(
rb
!=
RT_NULL
);
old_state
=
rt_ringbuffer_status
(
rb
);
space_length
=
rt_ringbuffer_space_len
(
rb
);
if
(
length
>
rb
->
buffer_size
)
if
(
length
>
space_length
)
length
=
rb
->
buffer_size
;
if
(
rb
->
buffer_size
-
rb
->
write_index
>
length
)
...
...
@@ -117,7 +117,7 @@ rt_size_t rt_ringbuffer_put_force(struct rt_ringbuffer *rb,
* length of data in current mirror */
rb
->
write_index
+=
length
;
if
(
old_state
==
RT_RINGBUFFER_FULL
)
if
(
length
>
space_length
)
rb
->
read_index
=
rb
->
write_index
;
return
length
;
...
...
@@ -134,7 +134,7 @@ rt_size_t rt_ringbuffer_put_force(struct rt_ringbuffer *rb,
rb
->
write_mirror
=
~
rb
->
write_mirror
;
rb
->
write_index
=
length
-
(
rb
->
buffer_size
-
rb
->
write_index
);
if
(
old_state
==
RT_RINGBUFFER_FULL
)
if
(
length
>
space_length
)
{
rb
->
read_mirror
=
~
rb
->
read_mirror
;
rb
->
read_index
=
rb
->
write_index
;
...
...
components/net/lwip-1.4.1/src/core/ipv4/ip.c
浏览文件 @
72298bac
...
...
@@ -312,6 +312,11 @@ ip_input(struct pbuf *p, struct netif *inp)
int
check_ip_src
=
1
;
#endif
/* IP_ACCEPT_LINK_LAYER_ADDRESSING */
#if IP_NAT
extern
u8_t
ip_nat_input
(
struct
pbuf
*
p
);
extern
u8_t
ip_nat_out
(
struct
pbuf
*
p
);
#endif
IP_STATS_INC
(
ip
.
recv
);
snmp_inc_ipinreceives
();
...
...
@@ -487,15 +492,30 @@ ip_input(struct pbuf *p, struct netif *inp)
/* packet not for us? */
if
(
netif
==
NULL
)
{
#if IP_FORWARD || IP_NAT
u8_t
taken
=
0
;
#endif
/* IP_FORWARD || IP_NAT */
/* packet not for us, route or discard */
LWIP_DEBUGF
(
IP_DEBUG
|
LWIP_DBG_TRACE
,
(
"ip_input: packet not for us.
\n
"
));
#if IP_FORWARD
#if IP_FORWARD
|| IP_NAT
/* non-broadcast packet? */
if
(
!
ip_addr_isbroadcast
(
&
current_iphdr_dest
,
inp
))
{
/* try to forward IP packet on (other) interfaces */
ip_forward
(
p
,
iphdr
,
inp
);
}
else
if
(
!
ip_addr_isbroadcast
(
&
(
iphdr
->
dest
),
inp
))
{
#if IP_NAT
/* check if we want to perform NAT with this packet. */
taken
=
ip_nat_out
(
p
);
if
(
!
taken
)
#endif
/* IP_NAT */
{
#if IP_FORWARD
/* try to forward IP packet on (other) interfaces */
if
(
ip_forward
(
p
,
iphdr
,
inp
)
!=
NULL
)
{
taken
=
1
;
}
#endif
/* IP_FORWARD */
}
}
if
(
!
taken
)
#endif
/* IP_FORWARD || IP_NAT */
{
snmp_inc_ipinaddrerrors
();
snmp_inc_ipindiscards
();
...
...
@@ -553,6 +573,13 @@ ip_input(struct pbuf *p, struct netif *inp)
current_netif
=
inp
;
current_header
=
iphdr
;
#if IP_NAT
if
(
!
ip_addr_isbroadcast
(
&
(
iphdr
->
dest
),
inp
)
&&
(
ip_nat_input
(
p
)
!=
0
))
{
LWIP_DEBUGF
(
IP_DEBUG
,
(
"ip_input: packet consumed by nat layer
\n
"
));
}
else
#endif
/* IP_NAT */
#if LWIP_RAW
/* raw input did not eat the packet? */
if
(
raw_input
(
p
,
inp
)
==
0
)
...
...
components/net/lwip_nat/README.md
0 → 100644
浏览文件 @
72298bac
lwIP NAT componenent
If you want to use lwIP NAT componenent, please define LWIP_USING_NAT in rtconfig.h.
In this case the network 213.129.231.168/29 is nat'ed when packets are sent to the
destination network 10.0.0.0/24 (untypical example - most users will have the other
way around).
Use following code to add a NAT entry:
ip_nat_entry_t nat_entry;
nat_entry.out_if = (struct netif
*
)
&emac_if1;
nat_entry.in_if = (struct netif
*
)
&emac_if2;
IP4_ADDR(&nat_entry.source_net, 213, 129, 231, 168);
IP4_ADDR(&nat_entry.source_netmask, 255, 255, 255, 248);
IP4_ADDR(&nat_entry.dest_net, 10, 0, 0, 0);
IP4_ADDR(&nat_entry.source_netmask, 255, 0, 0, 0);
ip_nat_add(
&_nat_entry);
components/net/lwip_nat/ipv4_nat.c
浏览文件 @
72298bac
...
...
@@ -435,8 +435,8 @@ ip_nat_check_header(struct pbuf *p, u16_t min_size)
* @return 1 if the packet has been consumed (it was a NAT packet),
* 0 if the packet has not been consumed (no NAT packet)
*/
int
ip_nat_input
(
struct
pbuf
*
p
,
struct
netif
*
inp
)
u8_t
ip_nat_input
(
struct
pbuf
*
p
)
{
struct
ip_hdr
*
iphdr
=
(
struct
ip_hdr
*
)
p
->
payload
;
struct
tcp_hdr
*
tcphdr
;
...
...
@@ -444,7 +444,7 @@ ip_nat_input(struct pbuf *p, struct netif *inp)
struct
icmp_echo_hdr
*
icmphdr
;
nat_entry_t
nat_entry
;
err_t
err
;
int
consumed
=
0
;
u8_t
consumed
=
0
;
int
i
;
struct
pbuf
*
q
=
NULL
;
...
...
components/net/lwip_nat/ipv4_nat.h
浏览文件 @
72298bac
...
...
@@ -88,7 +88,7 @@ typedef struct ip_nat_entry
void
ip_nat_init
(
void
);
void
ip_nat_tmr
(
void
);
int
ip_nat_input
(
struct
pbuf
*
p
,
struct
netif
*
in
p
);
u8_t
ip_nat_input
(
struct
pbuf
*
p
);
u8_t
ip_nat_out
(
struct
pbuf
*
p
);
err_t
ip_nat_add
(
const
ip_nat_entry_t
*
new_entry
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录