Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Achou.Wang
accel-ppp
提交
91df4499
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 搜索 >>
提交
91df4499
编写于
11月 07, 2010
作者:
D
Dmitry Kozlov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chap-secrets: support the rate limit of session (in kilobits) at fifth column
上级
ab309f45
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
104 addition
and
37 deletion
+104
-37
accel-pptpd/accel-pptp.conf
accel-pptpd/accel-pptp.conf
+4
-1
accel-pptpd/accel-pptp.conf.5
accel-pptpd/accel-pptp.conf.5
+6
-0
accel-pptpd/extra/chap-secrets.c
accel-pptpd/extra/chap-secrets.c
+27
-4
accel-pptpd/extra/shaper_tbf.c
accel-pptpd/extra/shaper_tbf.c
+59
-30
accel-pptpd/include/events.h
accel-pptpd/include/events.h
+7
-1
accel-pptpd/ppp/ccp_mppe.c
accel-pptpd/ppp/ccp_mppe.c
+1
-1
未找到文件。
accel-pptpd/accel-pptp.conf
浏览文件 @
91df4499
...
...
@@ -36,14 +36,17 @@ verbose=1
[
pppoe
]
interface
=
eth0
#ac-name=xxx
#service-name=yyy
verbose
=
1
[
l2tp
]
#dictionary=/usr/local/share/accel-pptp/l2tp/dictionary
#hello
_
interval=60
#hello
-
interval=60
#timeout=60
#rtimeout=5
#retransmit=5
#host-name=accel-pptp
verbose
=
1
[
dns
]
...
...
accel-pptpd/accel-pptp.conf.5
浏览文件 @
91df4499
...
...
@@ -152,6 +152,12 @@ Specifies interface name to listen/send discovery packets. You may specify multi
.B interface
options.
.TP
.BI "ac-name=" ac-name
Specifies AC-Name tag value. If absent tag will not be sent.
.TP
.BI "service-name=" service-name
Specifies Service-Name to respond. If absent any Service-Name is acceptable.
.TP
.BI "verbose=" n
If this option is given and
.B n
...
...
accel-pptpd/extra/chap-secrets.c
浏览文件 @
91df4499
...
...
@@ -24,6 +24,7 @@ struct cs_pd_t
struct
ppp_pd_t
pd
;
struct
ipdb_item_t
ip
;
char
*
passwd
;
char
*
rate
;
};
static
char
*
skip_word
(
char
*
ptr
)
...
...
@@ -44,7 +45,7 @@ static int split(char *buf, char **ptr)
{
int
i
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
buf
=
skip_word
(
buf
);
if
(
!*
buf
)
return
i
;
...
...
@@ -72,7 +73,7 @@ static struct cs_pd_t *create_pd(struct ppp_t *ppp, const char *username)
{
FILE
*
f
;
char
*
buf
;
char
*
ptr
[
4
];
char
*
ptr
[
5
];
int
n
;
struct
cs_pd_t
*
pd
;
...
...
@@ -122,10 +123,13 @@ found:
}
pd
->
ip
.
addr
=
conf_gw_ip_address
;
if
(
n
=
=
3
)
if
(
n
>
=
3
)
pd
->
ip
.
peer_addr
=
inet_addr
(
ptr
[
2
]);
pd
->
ip
.
owner
=
&
ipdb
;
if
(
n
==
4
)
pd
->
rate
=
_strdup
(
ptr
[
3
]);
list_add_tail
(
&
pd
->
pd
.
entry
,
&
ppp
->
pd_list
);
fclose
(
f
);
...
...
@@ -156,9 +160,27 @@ static void ev_ppp_finished(struct ppp_t *ppp)
list_del
(
&
pd
->
pd
.
entry
);
_free
(
pd
->
passwd
);
if
(
pd
->
rate
)
_free
(
pd
->
rate
);
_free
(
pd
);
}
static
void
ev_ppp_pre_up
(
struct
ppp_t
*
ppp
)
{
struct
cs_pd_t
*
pd
=
find_pd
(
ppp
);
struct
ev_shaper_t
ev
=
{
.
ppp
=
ppp
,
};
if
(
!
pd
)
return
;
if
(
pd
->
rate
)
{
ev
.
val
=
pd
->
rate
;
triton_event_fire
(
EV_SHAPER
,
&
ev
);
}
}
static
struct
ipdb_item_t
*
get_ip
(
struct
ppp_t
*
ppp
)
{
struct
cs_pd_t
*
pd
;
...
...
@@ -214,4 +236,5 @@ static void __init init(void)
ipdb_register
(
&
ipdb
);
triton_event_register_handler
(
EV_PPP_FINISHED
,
(
triton_event_func
)
ev_ppp_finished
);
triton_event_register_handler
(
EV_PPP_PRE_UP
,
(
triton_event_func
)
ev_ppp_pre_up
);
}
accel-pptpd/extra/shaper_tbf.c
浏览文件 @
91df4499
...
...
@@ -33,12 +33,14 @@
#define ATTR_DOWN 2
static
int
conf_verbose
=
0
;
#ifdef RADIUS
static
int
conf_attr_down
=
11
;
//Filter-Id
static
int
conf_attr_up
=
11
;
//Filter-Id
static
int
conf_vendor
=
0
;
#endif
static
double
conf_burst_factor
=
0
.
1
;
static
int
conf_latency
=
50
;
static
int
conf_mpu
=
0
;
static
int
conf_vendor
=
0
;
static
double
tick_in_usec
=
1
;
static
double
clock_factor
=
1
;
...
...
@@ -491,47 +493,51 @@ out_err:
return
-
1
;
}
#ifdef RADIUS
static
void
parse_attr
(
struct
rad_attr_t
*
attr
,
int
dir
,
int
*
speed
,
int
*
burst
)
static
void
parse_string
(
const
char
*
str
,
int
dir
,
int
*
speed
,
int
*
burst
)
{
char
*
endptr
;
long
int
val
;
unsigned
int
n1
,
n2
,
n3
;
if
(
attr
->
attr
->
type
==
ATTR_TYPE_STRING
)
{
if
(
strstr
(
attr
->
val
.
string
,
"lcp:interface-config#1=rate-limit output"
)
==
attr
->
val
.
string
)
{
if
(
dir
==
ATTR_DOWN
)
{
val
=
sscanf
(
attr
->
val
.
string
,
"lcp:interface-config#1=rate-limit output %u %u %u conform-action transmit exceed-action drop"
,
&
n1
,
&
n2
,
&
n3
);
if
(
val
==
3
)
{
*
speed
=
n1
/
1000
;
*
burst
=
n2
;
}
if
(
strstr
(
str
,
"lcp:interface-config#1=rate-limit output"
)
==
str
)
{
if
(
dir
==
ATTR_DOWN
)
{
val
=
sscanf
(
str
,
"lcp:interface-config#1=rate-limit output %u %u %u conform-action transmit exceed-action drop"
,
&
n1
,
&
n2
,
&
n3
);
if
(
val
==
3
)
{
*
speed
=
n1
/
1000
;
*
burst
=
n2
;
}
return
;
}
else
if
(
strstr
(
attr
->
val
.
string
,
"lcp:interface-config#1=rate-limit input"
)
==
attr
->
val
.
string
)
{
if
(
dir
==
ATTR_UP
)
{
val
=
sscanf
(
attr
->
val
.
string
,
"lcp:interface-config#1=rate-limit input %u %u %u conform-action transmit exceed-action drop"
,
&
n1
,
&
n2
,
&
n3
);
if
(
val
==
3
)
{
*
speed
=
n1
/
1000
;
*
burst
=
n2
;
}
return
;
}
else
if
(
strstr
(
str
,
"lcp:interface-config#1=rate-limit input"
)
==
str
)
{
if
(
dir
==
ATTR_UP
)
{
val
=
sscanf
(
str
,
"lcp:interface-config#1=rate-limit input %u %u %u conform-action transmit exceed-action drop"
,
&
n1
,
&
n2
,
&
n3
);
if
(
val
==
3
)
{
*
speed
=
n1
/
1000
;
*
burst
=
n2
;
}
return
;
}
return
;
}
val
=
strtol
(
attr
->
val
.
string
,
&
endptr
,
10
);
if
(
*
endptr
==
0
)
*
speed
=
val
;
else
{
if
(
*
endptr
==
'/'
||
*
endptr
==
'\\'
||
*
endptr
==
':'
)
{
if
(
dir
==
ATTR_DOWN
)
*
speed
=
val
;
else
*
speed
=
strtol
(
endptr
+
1
,
&
endptr
,
10
);
}
val
=
strtol
(
str
,
&
endptr
,
10
);
if
(
*
endptr
==
0
)
*
speed
=
val
;
else
{
if
(
*
endptr
==
'/'
||
*
endptr
==
'\\'
||
*
endptr
==
':'
)
{
if
(
dir
==
ATTR_DOWN
)
*
speed
=
val
;
else
*
speed
=
strtol
(
endptr
+
1
,
&
endptr
,
10
);
}
}
}
#ifdef RADIUS
static
void
parse_attr
(
struct
rad_attr_t
*
attr
,
int
dir
,
int
*
speed
,
int
*
burst
)
{
if
(
attr
->
attr
->
type
==
ATTR_TYPE_STRING
)
parse_string
(
attr
->
val
.
string
,
dir
,
speed
,
burst
);
else
if
(
attr
->
attr
->
type
==
ATTR_TYPE_INTEGER
)
*
speed
=
attr
->
val
.
integer
;
}
...
...
@@ -615,6 +621,28 @@ static void ev_radius_coa(struct ev_radius_t *ev)
}
#endif
static
void
ev_shaper
(
struct
ev_shaper_t
*
ev
)
{
struct
shaper_pd_t
*
pd
=
find_pd
(
ev
->
ppp
,
1
);
int
down_speed
=
0
,
down_burst
=
0
;
int
up_speed
=
0
,
up_burst
=
0
;
if
(
!
pd
)
return
;
parse_string
(
ev
->
val
,
ATTR_DOWN
,
&
down_speed
,
&
down_burst
);
parse_string
(
ev
->
val
,
ATTR_UP
,
&
up_speed
,
&
up_burst
);
if
(
down_speed
>
0
&&
up_speed
>
0
)
{
pd
->
down_speed
=
down_speed
;
pd
->
up_speed
=
up_speed
;
if
(
!
install_shaper
(
ev
->
ppp
->
ifname
,
down_speed
,
down_burst
,
up_speed
,
up_burst
))
{
if
(
conf_verbose
)
log_ppp_info
(
"tbf: installed shaper %i/%i (Kbit)
\n
"
,
down_speed
,
up_speed
);
}
}
}
static
void
ev_ctrl_finished
(
struct
ppp_t
*
ppp
)
{
struct
shaper_pd_t
*
pd
=
find_pd
(
ppp
,
0
);
...
...
@@ -750,5 +778,6 @@ static void __init init(void)
triton_event_register_handler
(
EV_RADIUS_COA
,
(
triton_event_func
)
ev_radius_coa
);
#endif
triton_event_register_handler
(
EV_CTRL_FINISHED
,
(
triton_event_func
)
ev_ctrl_finished
);
triton_event_register_handler
(
EV_SHAPER
,
(
triton_event_func
)
ev_shaper
);
}
accel-pptpd/include/events.h
浏览文件 @
91df4499
...
...
@@ -14,7 +14,7 @@
#define EV_PPP_PRE_UP 9
#define EV_PPP_ACCT_START 10
#define EV_IP_CHANGED 100
#define EV_SHAPE
_CHANGED
101
#define EV_SHAPE
R
101
#define EV_MPPE_KEYS 102
#define EV_RADIUS_ACCESS_ACCEPT 200
#define EV_RADIUS_COA 201
...
...
@@ -38,5 +38,11 @@ struct ev_mppe_keys_t
int
type
;
};
struct
ev_shaper_t
{
struct
ppp_t
*
ppp
;
const
char
*
val
;
};
#endif
accel-pptpd/ppp/ccp_mppe.c
浏览文件 @
91df4499
...
...
@@ -198,7 +198,7 @@ static int mppe_recv_conf_nak(struct ppp_ccp_t *ccp, struct ccp_option_t *opt, u
if
(
ntohl
(
opt32
->
val
)
==
(
MPPE_S
|
MPPE_H
))
return
-
1
;
}
else
if
(
mppe_opt
->
policy
==
1
)
{
if
(
ntohl
(
opt32
->
val
)
&
(
MPPE_S
|
MPPE_H
)
==
(
MPPE_S
|
MPPE_H
))
if
(
(
ntohl
(
opt32
->
val
)
&
(
MPPE_S
|
MPPE_H
)
)
==
(
MPPE_S
|
MPPE_H
))
mppe_opt
->
mppe
=
0
;
else
mppe_opt
->
mppe
=
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录