Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
RT-Thread
rt-thread
提交
31428116
R
rt-thread
项目概览
RT-Thread
/
rt-thread
大约 1 年 前同步成功
通知
774
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,发现更多精彩内容 >>
提交
31428116
编写于
1月 04, 2014
作者:
B
bernard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[lwIP] Add more RT-Thread options into lwIP
上级
cdf02d3a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
27 deletion
+36
-27
components/net/lwip-1.4.1/src/lwipopts.h
components/net/lwip-1.4.1/src/lwipopts.h
+9
-0
components/net/lwip-1.4.1/src/netif/ppp/ppp_oe.c
components/net/lwip-1.4.1/src/netif/ppp/ppp_oe.c
+27
-27
未找到文件。
components/net/lwip-1.4.1/src/lwipopts.h
浏览文件 @
31428116
...
...
@@ -306,8 +306,17 @@
* we're limited by the command line length so you need to modify the settings
* in this file.
*/
#ifdef RT_LWIP_PPPOE
#define PPPOE_SUPPORT 1
#else
#define PPPOE_SUPPORT 0
#endif
#ifdef RT_LWIP_PPPOS
#define PPPOS_SUPPORT 1
#else
#define PPPOS_SUPPORT 0
#endif
#define PAP_SUPPORT 1
/* Set > 0 for PAP. */
#define CHAP_SUPPORT 1
/* Set > 0 for CHAP. */
...
...
components/net/lwip-1.4.1/src/netif/ppp/ppp_oe.c
浏览文件 @
31428116
...
...
@@ -262,13 +262,13 @@ pppoe_find_softc_by_hunique(u8_t *token, size_t len, struct netif *rcvif)
/* should be safe to access *sc now */
if
(
sc
->
sc_state
<
PPPOE_STATE_PADI_SENT
||
sc
->
sc_state
>=
PPPOE_STATE_SESSION
)
{
printf
(
"%c%c%"
U16_F
": host unique tag found, but it belongs to a connection in state %d
\n
"
,
sc
->
sc_ethif
->
name
[
0
],
sc
->
sc_ethif
->
name
[
1
],
sc
->
sc_ethif
->
num
,
sc
->
sc_state
);
PPPDEBUG
(
LOG_DEBUG
,
(
"%c%c%"
U16_F
": host unique tag found, but it belongs to a connection in state %d
\n
"
,
sc
->
sc_ethif
->
name
[
0
],
sc
->
sc_ethif
->
name
[
1
],
sc
->
sc_ethif
->
num
,
sc
->
sc_state
)
)
;
return
NULL
;
}
if
(
sc
->
sc_ethif
!=
rcvif
)
{
printf
(
"%c%c%"
U16_F
": wrong interface, not accepting host unique
\n
"
,
sc
->
sc_ethif
->
name
[
0
],
sc
->
sc_ethif
->
name
[
1
],
sc
->
sc_ethif
->
num
);
PPPDEBUG
(
LOG_DEBUG
,
(
"%c%c%"
U16_F
": wrong interface, not accepting host unique
\n
"
,
sc
->
sc_ethif
->
name
[
0
],
sc
->
sc_ethif
->
name
[
1
],
sc
->
sc_ethif
->
num
)
)
;
return
NULL
;
}
return
sc
;
...
...
@@ -319,13 +319,13 @@ pppoe_dispatch_disc_pkt(struct netif *netif, struct pbuf *pb)
#endif
session
=
0
;
if
(
pb
->
len
-
off
<
PPPOE_HEADERLEN
)
{
printf
(
"pppoe: packet too short: %d
\n
"
,
pb
->
len
);
PPPDEBUG
(
LOG_DEBUG
,
(
"pppoe: packet too short: %d
\n
"
,
pb
->
len
)
);
goto
done
;
}
ph
=
(
struct
pppoehdr
*
)
(
ethhdr
+
1
);
if
(
ph
->
vertype
!=
PPPOE_VERTYPE
)
{
printf
(
"pppoe: unknown version/type packet: 0x%x
\n
"
,
ph
->
vertype
);
PPPDEBUG
(
LOG_DEBUG
,
(
"pppoe: unknown version/type packet: 0x%x
\n
"
,
ph
->
vertype
)
);
goto
done
;
}
session
=
ntohs
(
ph
->
session
);
...
...
@@ -333,8 +333,8 @@ pppoe_dispatch_disc_pkt(struct netif *netif, struct pbuf *pb)
off
+=
sizeof
(
*
ph
);
if
(
plen
+
off
>
pb
->
len
)
{
printf
(
"pppoe: packet content does not fit: data available = %d, packet size = %u
\n
"
,
pb
->
len
-
off
,
plen
);
PPPDEBUG
(
LOG_DEBUG
,
(
"pppoe: packet content does not fit: data available = %d, packet size = %u
\n
"
,
pb
->
len
-
off
,
plen
)
)
;
goto
done
;
}
if
(
pb
->
tot_len
==
pb
->
len
)
{
...
...
@@ -348,7 +348,7 @@ pppoe_dispatch_disc_pkt(struct netif *netif, struct pbuf *pb)
tag
=
ntohs
(
pt
.
tag
);
len
=
ntohs
(
pt
.
len
);
if
(
off
+
sizeof
(
pt
)
+
len
>
pb
->
len
)
{
printf
(
"pppoe: tag 0x%x len 0x%x is too long
\n
"
,
tag
,
len
);
PPPDEBUG
(
LOG_DEBUG
,
(
"pppoe: tag 0x%x len 0x%x is too long
\n
"
,
tag
,
len
)
);
goto
done
;
}
switch
(
tag
)
{
...
...
@@ -395,9 +395,9 @@ pppoe_dispatch_disc_pkt(struct netif *netif, struct pbuf *pb)
u16_t
error_len
=
LWIP_MIN
(
len
,
sizeof
(
pppoe_error_tmp
)
-
1
);
strncpy
(
pppoe_error_tmp
,
(
char
*
)
pb
->
payload
+
off
+
sizeof
(
pt
),
error_len
);
pppoe_error_tmp
[
error_len
-
1
]
=
'\0'
;
printf
(
"%s: %s: %s
\n
"
,
devname
,
err_msg
,
pppoe_error_tmp
);
PPPDEBUG
(
LOG_DEBUG
,
(
"%s: %s: %s
\n
"
,
devname
,
err_msg
,
pppoe_error_tmp
)
);
}
else
{
printf
(
"%s: %s
\n
"
,
devname
,
err_msg
);
PPPDEBUG
(
LOG_DEBUG
,
(
"%s: %s
\n
"
,
devname
,
err_msg
)
);
}
if
(
errortag
)
{
goto
done
;
...
...
@@ -455,19 +455,19 @@ breakbreak:;
*/
if
(
ac_cookie
==
NULL
)
{
/* be quiet if there is not a single pppoe instance */
printf
(
"pppoe: received PADR but not includes ac_cookie
\n
"
);
PPPDEBUG
(
LOG_DEBUG
,
(
"pppoe: received PADR but not includes ac_cookie
\n
"
)
);
goto
done
;
}
sc
=
pppoe_find_softc_by_hunique
(
ac_cookie
,
ac_cookie_len
,
netif
);
if
(
sc
==
NULL
)
{
/* be quiet if there is not a single pppoe instance */
if
(
!
LIST_EMPTY
(
&
pppoe_softc_list
))
{
printf
(
"pppoe: received PADR but could not find request for it
\n
"
);
PPPDEBUG
(
LOG_DEBUG
,
(
"pppoe: received PADR but could not find request for it
\n
"
)
);
}
goto
done
;
}
if
(
sc
->
sc_state
!=
PPPOE_STATE_PADO_SENT
)
{
printf
(
"%c%c%"
U16_F
": received unexpected PADR
\n
"
,
sc
->
sc_ethif
->
name
[
0
],
sc
->
sc_ethif
->
name
[
1
],
sc
->
sc_ethif
->
num
);
PPPDEBUG
(
LOG_DEBUG
,
(
"%c%c%"
U16_F
": received unexpected PADR
\n
"
,
sc
->
sc_ethif
->
name
[
0
],
sc
->
sc_ethif
->
name
[
1
],
sc
->
sc_ethif
->
num
)
);
goto
done
;
}
if
(
hunique
)
{
...
...
@@ -493,12 +493,12 @@ breakbreak:;
if
(
sc
==
NULL
)
{
/* be quiet if there is not a single pppoe instance */
if
(
pppoe_softc_list
!=
NULL
)
{
printf
(
"pppoe: received PADO but could not find request for it
\n
"
);
PPPDEBUG
(
LOG_DEBUG
,
(
"pppoe: received PADO but could not find request for it
\n
"
)
);
}
goto
done
;
}
if
(
sc
->
sc_state
!=
PPPOE_STATE_PADI_SENT
)
{
printf
(
"%c%c%"
U16_F
": received unexpected PADO
\n
"
,
sc
->
sc_ethif
->
name
[
0
],
sc
->
sc_ethif
->
name
[
1
],
sc
->
sc_ethif
->
num
);
PPPDEBUG
(
LOG_DEBUG
,
(
"%c%c%"
U16_F
": received unexpected PADO
\n
"
,
sc
->
sc_ethif
->
name
[
0
],
sc
->
sc_ethif
->
name
[
1
],
sc
->
sc_ethif
->
num
)
);
goto
done
;
}
if
(
ac_cookie
)
{
...
...
@@ -532,11 +532,11 @@ breakbreak:;
break
;
default:
if
(
sc
)
{
printf
(
"%c%c%"
U16_F
": unknown code (0x%"
X16_F
") session = 0x%"
X16_F
"
\n
"
,
PPPDEBUG
(
LOG_DEBUG
,
(
"%c%c%"
U16_F
": unknown code (0x%"
X16_F
") session = 0x%"
X16_F
"
\n
"
,
sc
->
sc_ethif
->
name
[
0
],
sc
->
sc_ethif
->
name
[
1
],
sc
->
sc_ethif
->
num
,
(
u16_t
)
ph
->
code
,
session
);
(
u16_t
)
ph
->
code
,
session
)
)
;
}
else
{
printf
(
"pppoe: unknown code (0x%"
X16_F
") session = 0x%"
X16_F
"
\n
"
,
(
u16_t
)
ph
->
code
,
session
);
PPPDEBUG
(
LOG_DEBUG
,
(
"pppoe: unknown code (0x%"
X16_F
") session = 0x%"
X16_F
"
\n
"
,
(
u16_t
)
ph
->
code
,
session
)
);
}
break
;
}
...
...
@@ -580,18 +580,18 @@ pppoe_data_input(struct netif *netif, struct pbuf *pb)
pb
=
pppSingleBuf
(
pb
);
if
(
pb
->
len
<=
PPPOE_HEADERLEN
)
{
printf
(
"pppoe (data): dropping too short packet: %d bytes
\n
"
,
pb
->
len
);
PPPDEBUG
(
LOG_DEBUG
,
(
"pppoe (data): dropping too short packet: %d bytes
\n
"
,
pb
->
len
)
);
goto
drop
;
}
if
(
pb
->
len
<
sizeof
(
*
ph
))
{
printf
(
"pppoe_data_input: could not get PPPoE header
\n
"
);
PPPDEBUG
(
LOG_DEBUG
,
(
"pppoe_data_input: could not get PPPoE header
\n
"
)
);
goto
drop
;
}
ph
=
(
struct
pppoehdr
*
)
pb
->
payload
;
if
(
ph
->
vertype
!=
PPPOE_VERTYPE
)
{
printf
(
"pppoe (data): unknown version/type packet: 0x%x
\n
"
,
ph
->
vertype
);
PPPDEBUG
(
LOG_DEBUG
,
(
"pppoe (data): unknown version/type packet: 0x%x
\n
"
,
ph
->
vertype
)
);
goto
drop
;
}
if
(
ph
->
code
!=
0
)
{
...
...
@@ -602,8 +602,8 @@ pppoe_data_input(struct netif *netif, struct pbuf *pb)
sc
=
pppoe_find_softc_by_session
(
session
,
netif
);
if
(
sc
==
NULL
)
{
#ifdef PPPOE_TERM_UNKNOWN_SESSIONS
printf
(
"pppoe: input for unknown session 0x%x, sending PADT
\n
"
,
session
);
pppoe_send_padt
(
netif
,
session
,
shost
);
PPPDEBUG
(
LOG_DEBUG
,
(
"pppoe: input for unknown session 0x%x, sending PADT
\n
"
,
session
);
pppoe_send_padt
(
netif
,
session
,
shost
)
)
;
#endif
goto
drop
;
}
...
...
@@ -874,7 +874,7 @@ pppoe_do_disconnect(struct pppoe_softc *sc)
static
void
pppoe_abort_connect
(
struct
pppoe_softc
*
sc
)
{
printf
(
"%c%c%"
U16_F
": could not establish connection
\n
"
,
sc
->
sc_ethif
->
name
[
0
],
sc
->
sc_ethif
->
name
[
1
],
sc
->
sc_ethif
->
num
);
PPPDEBUG
(
LOG_DEBUG
,
(
"%c%c%"
U16_F
": could not establish connection
\n
"
,
sc
->
sc_ethif
->
name
[
0
],
sc
->
sc_ethif
->
name
[
1
],
sc
->
sc_ethif
->
num
)
);
sc
->
sc_state
=
PPPOE_STATE_CLOSING
;
sc
->
sc_linkStatusCB
(
sc
->
sc_pd
,
0
);
/* notify upper layers */
...
...
@@ -1096,8 +1096,8 @@ pppoe_ifattach_hook(void *arg, struct pbuf **mp, struct netif *ifp, int dir)
}
if (sc->sc_sppp.pp_if.if_flags & IFF_UP) {
sc->sc_sppp.pp_if.if_flags &= ~(IFF_UP|IFF_RUNNING);
printf
("%c%c%"U16_F": ethernet interface detached, going down\n",
sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num);
PPPDEBUG(LOG_DEBUG,
("%c%c%"U16_F": ethernet interface detached, going down\n",
sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num)
)
;
}
sc->sc_ethif = NULL;
pppoe_clear_softc(sc, "ethernet interface detached");
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录