Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Achou.Wang
accel-ppp
提交
c5e859f1
A
accel-ppp
项目概览
Achou.Wang
/
accel-ppp
通知
6
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
accel-ppp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c5e859f1
编写于
2月 28, 2015
作者:
V
Vladislav Grishenko
提交者:
Dmitry Kozlov
3月 05, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ppp: fix mtu/mru set if not negotiated on any end plus cleanup
上级
26a89d0f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
20 deletion
+26
-20
accel-pppd/ppp/lcp_opt_mru.c
accel-pppd/ppp/lcp_opt_mru.c
+24
-18
accel-pppd/ppp/ppp.c
accel-pppd/ppp/ppp.c
+2
-2
未找到文件。
accel-pppd/ppp/lcp_opt_mru.c
浏览文件 @
c5e859f1
...
...
@@ -27,7 +27,7 @@ static int mru_send_conf_nak(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, ui
static
int
mru_recv_conf_req
(
struct
ppp_lcp_t
*
lcp
,
struct
lcp_option_t
*
opt
,
uint8_t
*
ptr
);
static
int
mru_recv_conf_ack
(
struct
ppp_lcp_t
*
lcp
,
struct
lcp_option_t
*
opt
,
uint8_t
*
ptr
);
static
int
mru_recv_conf_nak
(
struct
ppp_lcp_t
*
lcp
,
struct
lcp_option_t
*
opt
,
uint8_t
*
ptr
);
static
void
mru_print
(
void
(
*
print
)(
const
char
*
fmt
,
...),
struct
lcp_option_t
*
,
uint8_t
*
ptr
);
static
void
mru_print
(
void
(
*
print
)(
const
char
*
fmt
,
...),
struct
lcp_option_t
*
,
uint8_t
*
ptr
);
struct
mru_option_t
{
...
...
@@ -39,19 +39,20 @@ struct mru_option_t
static
struct
lcp_option_handler_t
mru_opt_hnd
=
{
.
init
=
mru_init
,
.
send_conf_req
=
mru_send_conf_req
,
.
send_conf_nak
=
mru_send_conf_nak
,
.
recv_conf_req
=
mru_recv_conf_req
,
.
recv_conf_ack
=
mru_recv_conf_ack
,
.
recv_conf_nak
=
mru_recv_conf_nak
,
.
free
=
mru_free
,
.
print
=
mru_print
,
.
init
=
mru_init
,
.
send_conf_req
=
mru_send_conf_req
,
.
send_conf_nak
=
mru_send_conf_nak
,
.
recv_conf_req
=
mru_recv_conf_req
,
.
recv_conf_ack
=
mru_recv_conf_ack
,
.
recv_conf_nak
=
mru_recv_conf_nak
,
.
free
=
mru_free
,
.
print
=
mru_print
,
};
static
struct
lcp_option_t
*
mru_init
(
struct
ppp_lcp_t
*
lcp
)
{
struct
mru_option_t
*
mru_opt
=
_malloc
(
sizeof
(
*
mru_opt
));
struct
mru_option_t
*
mru_opt
=
_malloc
(
sizeof
(
*
mru_opt
));
memset
(
mru_opt
,
0
,
sizeof
(
*
mru_opt
));
mru_opt
->
mru
=
(
conf_mru
&&
conf_mru
<=
lcp
->
ppp
->
ses
.
ctrl
->
max_mtu
)
?
conf_mru
:
lcp
->
ppp
->
ses
.
ctrl
->
max_mtu
;
if
(
mru_opt
->
mru
>
conf_max_mtu
)
...
...
@@ -62,6 +63,9 @@ static struct lcp_option_t *mru_init(struct ppp_lcp_t *lcp)
mru_opt
->
opt
.
id
=
CI_MRU
;
mru_opt
->
opt
.
len
=
4
;
lcp
->
ppp
->
mru
=
mru_opt
->
mru
;
lcp
->
ppp
->
mtu
=
mru_opt
->
mtu
;
return
&
mru_opt
->
opt
;
}
...
...
@@ -74,7 +78,7 @@ static void mru_free(struct ppp_lcp_t *lcp, struct lcp_option_t *opt)
static
int
mru_send_conf_req
(
struct
ppp_lcp_t
*
lcp
,
struct
lcp_option_t
*
opt
,
uint8_t
*
ptr
)
{
struct
mru_option_t
*
mru_opt
=
container_of
(
opt
,
typeof
(
*
mru_opt
),
opt
);
struct
mru_option_t
*
mru_opt
=
container_of
(
opt
,
typeof
(
*
mru_opt
),
opt
);
struct
lcp_opt16_t
*
opt16
=
(
struct
lcp_opt16_t
*
)
ptr
;
if
(
mru_opt
->
naked
)
...
...
@@ -88,8 +92,9 @@ static int mru_send_conf_req(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, ui
static
int
mru_send_conf_nak
(
struct
ppp_lcp_t
*
lcp
,
struct
lcp_option_t
*
opt
,
uint8_t
*
ptr
)
{
struct
mru_option_t
*
mru_opt
=
container_of
(
opt
,
typeof
(
*
mru_opt
),
opt
);
struct
mru_option_t
*
mru_opt
=
container_of
(
opt
,
typeof
(
*
mru_opt
),
opt
);
struct
lcp_opt16_t
*
opt16
=
(
struct
lcp_opt16_t
*
)
ptr
;
opt16
->
hdr
.
id
=
CI_MRU
;
opt16
->
hdr
.
len
=
4
;
opt16
->
val
=
htons
(
mru_opt
->
mtu
);
...
...
@@ -98,7 +103,7 @@ static int mru_send_conf_nak(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, ui
static
int
mru_recv_conf_req
(
struct
ppp_lcp_t
*
lcp
,
struct
lcp_option_t
*
opt
,
uint8_t
*
ptr
)
{
struct
mru_option_t
*
mru_opt
=
container_of
(
opt
,
typeof
(
*
mru_opt
),
opt
);
struct
mru_option_t
*
mru_opt
=
container_of
(
opt
,
typeof
(
*
mru_opt
),
opt
);
struct
lcp_opt16_t
*
opt16
=
(
struct
lcp_opt16_t
*
)
ptr
;
/*if (!ptr)
...
...
@@ -118,7 +123,7 @@ static int mru_recv_conf_req(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, ui
static
int
mru_recv_conf_ack
(
struct
ppp_lcp_t
*
lcp
,
struct
lcp_option_t
*
opt
,
uint8_t
*
ptr
)
{
struct
mru_option_t
*
mru_opt
=
container_of
(
opt
,
typeof
(
*
mru_opt
),
opt
);
struct
mru_option_t
*
mru_opt
=
container_of
(
opt
,
typeof
(
*
mru_opt
),
opt
);
if
(
ioctl
(
lcp
->
ppp
->
chan_fd
,
PPPIOCSMRU
,
&
mru_opt
->
mru
)
&&
errno
!=
EIO
&&
errno
!=
ENOTTY
)
...
...
@@ -131,20 +136,21 @@ static int mru_recv_conf_ack(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, ui
static
int
mru_recv_conf_nak
(
struct
ppp_lcp_t
*
lcp
,
struct
lcp_option_t
*
opt
,
uint8_t
*
ptr
)
{
struct
mru_option_t
*
mru_opt
=
container_of
(
opt
,
typeof
(
*
mru_opt
),
opt
);
struct
mru_option_t
*
mru_opt
=
container_of
(
opt
,
typeof
(
*
mru_opt
),
opt
);
mru_opt
->
naked
=
1
;
return
0
;
}
static
void
mru_print
(
void
(
*
print
)(
const
char
*
fmt
,...),
struct
lcp_option_t
*
opt
,
uint8_t
*
ptr
)
static
void
mru_print
(
void
(
*
print
)(
const
char
*
fmt
,
...),
struct
lcp_option_t
*
opt
,
uint8_t
*
ptr
)
{
struct
mru_option_t
*
mru_opt
=
container_of
(
opt
,
typeof
(
*
mru_opt
),
opt
);
struct
lcp_opt16_t
*
opt16
=
(
struct
lcp_opt16_t
*
)
ptr
;
if
(
ptr
)
print
(
"<mru %i>"
,
ntohs
(
opt16
->
val
));
print
(
"<mru %i>"
,
ntohs
(
opt16
->
val
));
else
print
(
"<mru %i>"
,
mru_opt
->
mru
);
print
(
"<mru %i>"
,
mru_opt
->
mru
);
}
static
void
load_config
(
void
)
...
...
accel-pppd/ppp/ppp.c
浏览文件 @
c5e859f1
...
...
@@ -185,12 +185,12 @@ int __export connect_ppp_channel(struct ppp_t *ppp)
ifr
.
ifr_mtu
=
ppp
->
mtu
;
strcpy
(
ifr
.
ifr_name
,
ppp
->
ses
.
ifname
);
if
(
ioctl
(
sock_fd
,
SIOCSIFMTU
,
&
ifr
))
{
if
(
ppp
->
mtu
&&
ioctl
(
sock_fd
,
SIOCSIFMTU
,
&
ifr
))
{
log_ppp_error
(
"failed to set MTU: %s
\n
"
,
strerror
(
errno
));
goto
exit_close_unit
;
}
if
(
ioctl
(
ppp
->
unit_fd
,
PPPIOCSMRU
,
&
ppp
->
mru
))
{
if
(
ppp
->
mru
&&
ioctl
(
ppp
->
unit_fd
,
PPPIOCSMRU
,
&
ppp
->
mru
))
{
log_ppp_error
(
"failed to set MRU: %s
\n
"
,
strerror
(
errno
));
goto
exit_close_unit
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录