Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Achou.Wang
accel-ppp
提交
f3d14bf9
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,体验更适合开发者的 AI 搜索 >>
提交
f3d14bf9
编写于
12月 28, 2010
作者:
K
Kozlov Dmitry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ppp: check if requested IP is already assigned if check-ip option is specified
上级
0ad64cf5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
40 addition
and
1 deletion
+40
-1
accel-pptpd/accel-pptp.conf
accel-pptpd/accel-pptp.conf
+1
-0
accel-pptpd/accel-pptp.conf.5
accel-pptpd/accel-pptp.conf.5
+4
-1
accel-pptpd/ppp/ipcp_opt_ipaddr.c
accel-pptpd/ppp/ipcp_opt_ipaddr.c
+35
-0
未找到文件。
accel-pptpd/accel-pptp.conf
浏览文件 @
f3d14bf9
...
...
@@ -28,6 +28,7 @@ mtu=1400
mru
=
1400
#ccp=0
#sid-case=upper
#check-ip=0
[
lcp
]
echo
-
interval
=
30
...
...
accel-pptpd/accel-pptp.conf.5
浏览文件 @
f3d14bf9
...
...
@@ -98,9 +98,12 @@ Prefered MRU.
Disable CCP negotiation if this parameter is zero.
.TP
.TP
.BI "sid-case="
[upper|lower]
.BI "sid-case="
upper|lower
Specifies in which case generate session identifier (default lower).
.TP
.BI "check-ip=" 0|1
Specifies whether accel-pptp should check if IP already assigned to other ppp interface (default 0).
.TP
.SH [lcp]
.br
PPP LCP module configuration
...
...
accel-pptpd/ppp/ipcp_opt_ipaddr.c
浏览文件 @
f3d14bf9
...
...
@@ -16,6 +16,8 @@
#include "memdebug.h"
static
int
conf_check_exists
;
static
struct
ipcp_option_t
*
ipaddr_init
(
struct
ppp_ipcp_t
*
ipcp
);
static
void
ipaddr_free
(
struct
ppp_ipcp_t
*
ipcp
,
struct
ipcp_option_t
*
opt
);
static
int
ipaddr_send_conf_req
(
struct
ppp_ipcp_t
*
ipcp
,
struct
ipcp_option_t
*
opt
,
uint8_t
*
ptr
);
...
...
@@ -61,6 +63,24 @@ static void ipaddr_free(struct ppp_ipcp_t *ipcp, struct ipcp_option_t *opt)
_free
(
ipaddr_opt
);
}
static
int
check_exists
(
in_addr_t
addr
)
{
struct
ppp_t
*
ppp
;
int
r
=
0
;
pthread_rwlock_rdlock
(
&
ppp_lock
);
list_for_each_entry
(
ppp
,
&
ppp_list
,
entry
)
{
if
(
!
ppp
->
terminating
&&
ppp
->
peer_ipaddr
==
addr
)
{
log_ppp_warn
(
"ppp:ipcp: requested IP already assigned to %s
\n
"
,
ppp
->
ifname
);
r
=
1
;
break
;
}
}
pthread_rwlock_unlock
(
&
ppp_lock
);
return
r
;
}
static
int
ipaddr_send_conf_req
(
struct
ppp_ipcp_t
*
ipcp
,
struct
ipcp_option_t
*
opt
,
uint8_t
*
ptr
)
{
struct
ipaddr_option_t
*
ipaddr_opt
=
container_of
(
opt
,
typeof
(
*
ipaddr_opt
),
opt
);
...
...
@@ -73,6 +93,7 @@ static int ipaddr_send_conf_req(struct ppp_ipcp_t *ipcp, struct ipcp_option_t *o
return
-
1
;
}
}
if
(
iprange_tunnel_check
(
ipaddr_opt
->
ip
->
peer_addr
))
{
log_ppp_warn
(
"ppp:ipcp: to avoid kernel soft lockup requested IP cannot be assigned (%i.%i.%i.%i)
\n
"
,
ipaddr_opt
->
ip
->
peer_addr
&
0xff
,
...
...
@@ -82,6 +103,9 @@ static int ipaddr_send_conf_req(struct ppp_ipcp_t *ipcp, struct ipcp_option_t *o
return
-
1
;
}
if
(
conf_check_exists
&&
check_exists
(
ipaddr_opt
->
ip
->
peer_addr
))
return
-
1
;
opt32
->
hdr
.
id
=
CI_ADDR
;
opt32
->
hdr
.
len
=
6
;
opt32
->
val
=
ipaddr_opt
->
ip
->
addr
;
...
...
@@ -185,8 +209,19 @@ static void ipaddr_print(void (*print)(const char *fmt,...),struct ipcp_option_t
print
(
"<addr %s>"
,
inet_ntoa
(
in
));
}
static
void
load_config
(
void
)
{
const
char
*
opt
;
opt
=
conf_get_opt
(
"ppp"
,
"check-ip"
);
if
(
opt
&&
atoi
(
opt
)
>
0
)
conf_check_exists
=
1
;
}
static
void
__init
ipaddr_opt_init
()
{
ipcp_option_register
(
&
ipaddr_opt_hnd
);
load_config
();
triton_event_register_handler
(
EV_CONFIG_RELOAD
,
(
triton_event_func
)
load_config
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录