Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
0b2ac37c
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
1 年多 前同步成功
通知
460
Star
414
Fork
55
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel Liteos A
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0b2ac37c
编写于
11月 16, 2020
作者:
O
openharmony_ci
提交者:
Gitee
11月 16, 2020
浏览文件
操作
浏览文件
下载
差异文件
!27 [Lightweight PR]: 实现IPv6地址解析函数ip6addr_aton,代替lwip自带的,修正ifconfig配置ipv6地址时的误报错误
Merge pull request !27 from Caoruihong/N/A
上级
a2d3befc
f2097a1f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
83 addition
and
1 deletion
+83
-1
net/lwip-2.1/enhancement/include/lwip/fixme.h
net/lwip-2.1/enhancement/include/lwip/fixme.h
+1
-1
net/lwip-2.1/enhancement/src/fixme.c
net/lwip-2.1/enhancement/src/fixme.c
+82
-0
未找到文件。
net/lwip-2.1/enhancement/include/lwip/fixme.h
浏览文件 @
0b2ac37c
...
...
@@ -49,7 +49,7 @@
#define DUP_ARP_DETECT_TIME 2000
/* 2 seconds period */
#define SOF_BINDNONUNICAST 0x0800U
/* socket has bind to a non unicast */
#define NETCONN_PKT_RAW 0x80
#define SYS_ARCH_ERROR
SYS_ARCH_TIMEOUT
#define SYS_ARCH_ERROR
0x7fffffffUL
#define LWIP_ENABLE_LOS_SHELL_CMD LOSCFG_SHELL
#define LWIP_SHELL_CMD_PING_RETRY_TIMES 4
...
...
net/lwip-2.1/enhancement/src/fixme.c
浏览文件 @
0b2ac37c
...
...
@@ -393,3 +393,85 @@ const char *const tcp_state_str[] = {
};
volatile
int
tcpip_init_finish
=
1
;
// needed by api_shell.c
int
ip6addr_aton
(
const
char
*
cp
,
ip6_addr_t
*
addr
)
{
const
int
ipv6_blocks
=
8
;
u16_t
current_block_index
=
0
;
u16_t
current_block_value
=
0
;
u16_t
addr16
[
ipv6_blocks
];
u16_t
*
a16
=
(
u16_t
*
)
addr
->
addr
;
int
squash_pos
=
ipv6_blocks
;
int
i
;
const
char
*
s
=
cp
;
const
char
*
ss
=
cp
-
1
;
for
(;
;
s
++
)
{
if
(
current_block_index
>=
ipv6_blocks
)
{
return
0
;
// address too long
}
if
(
*
s
==
0
)
{
if
(
s
-
ss
==
1
)
{
if
(
squash_pos
!=
current_block_index
)
{
return
0
;
// empty address or address ends with a single ':'
}
// else address ends with one valid "::"
}
else
{
addr16
[
current_block_index
++
]
=
current_block_value
;
}
break
;
}
else
if
(
*
s
==
':'
)
{
if
(
s
-
ss
==
1
)
{
if
(
s
!=
cp
||
s
[
1
]
!=
':'
)
{
return
0
;
// address begins with a single ':' or contains ":::"
}
// else address begins with one valid "::"
}
else
{
addr16
[
current_block_index
++
]
=
current_block_value
;
}
if
(
s
[
1
]
==
':'
)
{
if
(
squash_pos
!=
ipv6_blocks
)
{
return
0
;
// more than one "::"
}
squash_pos
=
current_block_index
;
s
++
;
}
ss
=
s
;
// ss points to the recent ':' position
current_block_value
=
0
;
}
else
if
(
lwip_isxdigit
(
*
s
)
&&
(
s
-
ss
)
<
5
)
{
// 4 hex-digits at most
current_block_value
=
(
current_block_value
<<
4
)
+
(
*
s
|
(
'a'
-
'A'
))
-
'0'
-
(
'a'
-
'9'
-
1
)
*
(
*
s
>=
'A'
);
#if LWIP_IPV4
}
else
if
(
*
s
==
'.'
&&
current_block_index
<
ipv6_blocks
-
1
)
{
ip4_addr_t
ip4
;
int
ret
=
ip4addr_aton
(
ss
+
1
,
&
ip4
);
if
(
!
ret
)
{
return
0
;
}
ip4
.
addr
=
lwip_ntohl
(
ip4
.
addr
);
addr16
[
current_block_index
++
]
=
(
u16_t
)(
ip4
.
addr
>>
16
);
addr16
[
current_block_index
++
]
=
(
u16_t
)(
ip4
.
addr
);
break
;
#endif
/* LWIP_IPV4 */
}
else
{
return
0
;
// unexpected char or too many digits
}
}
if
(
squash_pos
==
ipv6_blocks
&&
current_block_index
!=
ipv6_blocks
)
{
return
0
;
// address too short
}
if
(
squash_pos
!=
ipv6_blocks
&&
current_block_index
==
ipv6_blocks
)
{
return
0
;
// unexpected "::" in address
}
for
(
i
=
0
;
i
<
squash_pos
;
++
i
)
{
a16
[
i
]
=
lwip_htons
(
addr16
[
i
]);
}
for
(;
i
<
ipv6_blocks
-
current_block_index
+
squash_pos
;
++
i
)
{
a16
[
i
]
=
0
;
}
for
(;
i
<
ipv6_blocks
;
++
i
)
{
a16
[
i
]
=
lwip_htons
(
addr16
[
i
-
ipv6_blocks
+
current_block_index
]);
}
return
1
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录