Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Achou.Wang
accel-ppp
提交
cdd91cd6
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 搜索 >>
提交
cdd91cd6
编写于
1月 04, 2011
作者:
D
Dmitry Kozlov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pppoe: additional statistics
radius: additional statistics
上级
709dd159
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
67 addition
and
3 deletion
+67
-3
accel-pptpd/ctrl/pppoe/cli.c
accel-pptpd/ctrl/pppoe/cli.c
+4
-0
accel-pptpd/ctrl/pppoe/pppoe.c
accel-pptpd/ctrl/pppoe/pppoe.c
+14
-1
accel-pptpd/ctrl/pppoe/pppoe.h
accel-pptpd/ctrl/pppoe/pppoe.h
+5
-0
accel-pptpd/radius/acct.c
accel-pptpd/radius/acct.c
+12
-1
accel-pptpd/radius/auth.c
accel-pptpd/radius/auth.c
+4
-1
accel-pptpd/radius/radius.c
accel-pptpd/radius/radius.c
+21
-0
accel-pptpd/radius/radius_p.h
accel-pptpd/radius/radius_p.h
+7
-0
未找到文件。
accel-pptpd/ctrl/pppoe/cli.c
浏览文件 @
cdd91cd6
...
...
@@ -68,6 +68,10 @@ static int show_stat_exec(const char *cmd, char * const *fields, int fields_cnt,
cli_send
(
client
,
"pppoe:
\r\n
"
);
cli_sendv
(
client
,
" active: %u
\r\n
"
,
stat_active
);
cli_sendv
(
client
,
" delayed PADO: %u
\r\n
"
,
stat_delayed_pado
);
cli_sendv
(
client
,
" recv PADI: %lu
\r\n
"
,
stat_PADI_recv
);
cli_sendv
(
client
,
" sent PADO: %lu
\r\n
"
,
stat_PADO_sent
);
cli_sendv
(
client
,
" recv PADR(dup): %lu(%lu)
\r\n
"
,
stat_PADR_recv
,
stat_PADR_dup_recv
);
cli_sendv
(
client
,
" sent PADS: %lu
\r\n
"
,
stat_PADS_sent
);
return
CLI_CMD_OK
;
}
...
...
accel-pptpd/ctrl/pppoe/pppoe.c
浏览文件 @
cdd91cd6
...
...
@@ -75,6 +75,11 @@ static mempool_t pado_pool;
unsigned
int
stat_active
;
unsigned
int
stat_delayed_pado
;
unsigned
long
stat_PADI_recv
;
unsigned
long
stat_PADO_sent
;
unsigned
long
stat_PADR_recv
;
unsigned
long
stat_PADR_dup_recv
;
unsigned
long
stat_PADS_sent
;
pthread_rwlock_t
serv_lock
=
PTHREAD_RWLOCK_INITIALIZER
;
LIST_HEAD
(
serv_list
);
...
...
@@ -581,6 +586,7 @@ static void pppoe_send_PADO(struct pppoe_serv_t *serv, const uint8_t *addr, cons
print_packet
(
pack
);
}
__sync_add_and_fetch
(
&
stat_PADO_sent
,
1
);
pppoe_send
(
serv
->
hnd
.
fd
,
pack
);
}
...
...
@@ -628,6 +634,7 @@ static void pppoe_send_PADS(struct pppoe_conn_t *conn)
print_packet
(
pack
);
}
__sync_add_and_fetch
(
&
stat_PADS_sent
,
1
);
pppoe_send
(
conn
->
disc_sock
,
pack
);
}
...
...
@@ -693,6 +700,8 @@ static void pppoe_recv_PADI(struct pppoe_serv_t *serv, uint8_t *pack, int size)
int
n
,
service_match
=
0
;
struct
delayed_pado_t
*
pado
;
__sync_add_and_fetch
(
&
stat_PADI_recv
,
1
);
if
(
ppp_shutdown
||
pado_delay
==
-
1
)
return
;
...
...
@@ -791,6 +800,8 @@ static void pppoe_recv_PADR(struct pppoe_serv_t *serv, uint8_t *pack, int size)
struct
pppoe_conn_t
*
conn
;
int
vendor_id
;
__sync_add_and_fetch
(
&
stat_PADR_recv
,
1
);
if
(
ppp_shutdown
)
return
;
...
...
@@ -876,8 +887,10 @@ static void pppoe_recv_PADR(struct pppoe_serv_t *serv, uint8_t *pack, int size)
pthread_mutex_lock
(
&
serv
->
lock
);
conn
=
find_channel
(
serv
,
(
uint8_t
*
)
ac_cookie_tag
->
tag_data
);
if
(
conn
&&
!
conn
->
ppp
.
username
)
if
(
conn
&&
!
conn
->
ppp
.
username
)
{
__sync_add_and_fetch
(
&
stat_PADR_dup_recv
,
1
);
pppoe_send_PADS
(
conn
);
}
pthread_mutex_unlock
(
&
serv
->
lock
);
if
(
conn
)
...
...
accel-pptpd/ctrl/pppoe/pppoe.h
浏览文件 @
cdd91cd6
...
...
@@ -91,6 +91,11 @@ extern char *conf_pado_delay;
extern
unsigned
int
stat_active
;
extern
unsigned
int
stat_delayed_pado
;
extern
unsigned
long
stat_PADI_recv
;
extern
unsigned
long
stat_PADO_sent
;
extern
unsigned
long
stat_PADR_recv
;
extern
unsigned
long
stat_PADR_dup_recv
;
extern
unsigned
long
stat_PADS_sent
;
extern
pthread_rwlock_t
serv_lock
;
extern
struct
list_head
serv_list
;
...
...
accel-pptpd/radius/acct.c
浏览文件 @
cdd91cd6
...
...
@@ -114,6 +114,8 @@ static void rad_acct_timeout(struct triton_timer_t *t)
struct
rad_req_t
*
req
=
container_of
(
t
,
typeof
(
*
req
),
timeout
);
time_t
ts
,
dt
;
__sync_add_and_fetch
(
&
stat_interim_lost
,
1
);
time
(
&
ts
);
dt
=
ts
-
req
->
rpd
->
acct_timestamp
;
...
...
@@ -138,6 +140,7 @@ static void rad_acct_timeout(struct triton_timer_t *t)
rad_packet_change_int
(
req
->
pack
,
NULL
,
"Acct-Delay-Time"
,
dt
);
req_set_RA
(
req
,
conf_acct_secret
);
rad_req_send
(
req
,
conf_interim_verbose
);
__sync_add_and_fetch
(
&
stat_interim_sent
,
1
);
}
static
void
rad_acct_interim_update
(
struct
triton_timer_t
*
t
)
...
...
@@ -158,6 +161,7 @@ static void rad_acct_interim_update(struct triton_timer_t *t)
rad_packet_change_int
(
rpd
->
acct_req
->
pack
,
NULL
,
"Acct-Delay-Time"
,
0
);
req_set_RA
(
rpd
->
acct_req
,
conf_acct_secret
);
rad_req_send
(
rpd
->
acct_req
,
conf_interim_verbose
);
__sync_add_and_fetch
(
&
stat_interim_sent
,
1
);
if
(
conf_acct_timeout
)
{
rpd
->
acct_req
->
timeout
.
period
=
conf_timeout
*
1000
;
triton_timer_add
(
rpd
->
ppp
->
ctrl
->
ctx
,
&
rpd
->
acct_req
->
timeout
,
0
);
...
...
@@ -199,15 +203,18 @@ int rad_acct_start(struct radius_pd_t *rpd)
goto
out_err
;
if
(
rad_req_send
(
rpd
->
acct_req
,
conf_verbose
))
goto
out_err
;
__sync_add_and_fetch
(
&
stat_acct_sent
,
1
);
rad_req_wait
(
rpd
->
acct_req
,
conf_timeout
);
if
(
!
rpd
->
acct_req
->
reply
)
{
rpd
->
acct_req
->
pack
->
id
++
;
__sync_add_and_fetch
(
&
stat_acct_lost
,
1
);
continue
;
}
if
(
rpd
->
acct_req
->
reply
->
id
!=
rpd
->
acct_req
->
pack
->
id
||
rpd
->
acct_req
->
reply
->
code
!=
CODE_ACCOUNTING_RESPONSE
)
{
rad_packet_free
(
rpd
->
acct_req
->
reply
);
rpd
->
acct_req
->
reply
=
NULL
;
rpd
->
acct_req
->
pack
->
id
++
;
__sync_add_and_fetch
(
&
stat_acct_lost
,
1
);
}
else
break
;
}
...
...
@@ -298,12 +305,16 @@ void rad_acct_stop(struct radius_pd_t *rpd)
break
;
if
(
rad_req_send
(
rpd
->
acct_req
,
conf_verbose
))
break
;
__sync_add_and_fetch
(
&
stat_acct_sent
,
1
);
rad_req_wait
(
rpd
->
acct_req
,
conf_timeout
);
if
(
!
rpd
->
acct_req
->
reply
)
if
(
!
rpd
->
acct_req
->
reply
)
{
__sync_add_and_fetch
(
&
stat_acct_lost
,
1
);
continue
;
}
if
(
rpd
->
acct_req
->
reply
->
id
!=
rpd
->
acct_req
->
pack
->
id
||
rpd
->
acct_req
->
reply
->
code
!=
CODE_ACCOUNTING_RESPONSE
)
{
rad_packet_free
(
rpd
->
acct_req
->
reply
);
rpd
->
acct_req
->
reply
=
NULL
;
__sync_add_and_fetch
(
&
stat_acct_lost
,
1
);
}
else
break
;
}
...
...
accel-pptpd/radius/auth.c
浏览文件 @
cdd91cd6
...
...
@@ -147,6 +147,7 @@ static int rad_auth_send(struct rad_req_t *req)
int
i
;
for
(
i
=
0
;
i
<
conf_max_try
;
i
++
)
{
__sync_add_and_fetch
(
&
stat_auth_sent
,
1
);
if
(
rad_req_send
(
req
,
conf_verbose
))
goto
out
;
...
...
@@ -154,11 +155,13 @@ static int rad_auth_send(struct rad_req_t *req)
if
(
req
->
reply
)
{
if
(
req
->
reply
->
id
!=
req
->
pack
->
id
)
{
__sync_add_and_fetch
(
&
stat_auth_lost
,
1
);
rad_packet_free
(
req
->
reply
);
req
->
reply
=
NULL
;
}
else
break
;
}
}
else
__sync_add_and_fetch
(
&
stat_auth_lost
,
1
);
}
if
(
!
req
->
reply
)
...
...
accel-pptpd/radius/radius.c
浏览文件 @
cdd91cd6
...
...
@@ -12,6 +12,7 @@
#include "pwdb.h"
#include "ipdb.h"
#include "ppp_auth.h"
#include "cli.h"
#include "radius_p.h"
#include "attr_defs.h"
...
...
@@ -48,6 +49,13 @@ int conf_sid_in_auth;
int
conf_require_nas_ident
;
int
conf_acct_interim_interval
;
unsigned
long
stat_auth_sent
;
unsigned
long
stat_auth_lost
;
unsigned
long
stat_acct_sent
;
unsigned
long
stat_acct_lost
;
unsigned
long
stat_interim_sent
;
unsigned
long
stat_interim_lost
;
static
LIST_HEAD
(
sessions
);
static
pthread_rwlock_t
sessions_lock
=
PTHREAD_RWLOCK_INITIALIZER
;
...
...
@@ -339,6 +347,18 @@ int rad_check_nas_pack(struct rad_packet_t *pack)
return
0
;
}
static
int
show_stat_exec
(
const
char
*
cmd
,
char
*
const
*
fields
,
int
fields_cnt
,
void
*
client
)
{
cli_send
(
client
,
"radius:
\r\n
"
);
cli_sendv
(
client
,
" auth sent: %lu
\r\n
"
,
stat_auth_sent
);
cli_sendv
(
client
,
" auth lost: %lu
\r\n
"
,
stat_auth_lost
);
cli_sendv
(
client
,
" acct sent: %lu
\r\n
"
,
stat_acct_sent
);
cli_sendv
(
client
,
" acct lost: %lu
\r\n
"
,
stat_acct_lost
);
cli_sendv
(
client
,
" interim sent: %lu
\r\n
"
,
stat_interim_sent
);
cli_sendv
(
client
,
" interim lost: %lu
\r\n
"
,
stat_interim_lost
);
return
CLI_CMD_OK
;
}
void
__export
rad_register_plugin
(
struct
ppp_t
*
ppp
,
struct
rad_plugin_t
*
plugin
)
{
struct
radius_pd_t
*
rpd
=
find_pd
(
ppp
);
...
...
@@ -505,4 +525,5 @@ static void __init radius_init(void)
triton_event_register_handler
(
EV_PPP_FINISHED
,
(
triton_event_func
)
ppp_finished
);
triton_event_register_handler
(
EV_CONFIG_RELOAD
,
(
triton_event_func
)
load_config
);
cli_register_simple_cmd2
(
show_stat_exec
,
NULL
,
2
,
"show"
,
"stat"
);
}
accel-pptpd/radius/radius_p.h
浏览文件 @
cdd91cd6
...
...
@@ -78,6 +78,13 @@ extern in_addr_t conf_dm_coa_server;
extern
int
conf_dm_coa_port
;
extern
int
conf_acct_interim_interval
;
extern
unsigned
long
stat_auth_sent
;
extern
unsigned
long
stat_auth_lost
;
extern
unsigned
long
stat_acct_sent
;
extern
unsigned
long
stat_acct_lost
;
extern
unsigned
long
stat_interim_sent
;
extern
unsigned
long
stat_interim_lost
;
int
rad_check_nas_pack
(
struct
rad_packet_t
*
pack
);
struct
radius_pd_t
*
rad_find_session
(
const
char
*
sessionid
,
const
char
*
username
,
int
port_id
,
in_addr_t
ipaddr
,
const
char
*
csid
);
struct
radius_pd_t
*
rad_find_session_pack
(
struct
rad_packet_t
*
pack
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录