Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Achou.Wang
accel-ppp
提交
0e6defcc
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,发现更多精彩内容 >>
提交
0e6defcc
编写于
4月 14, 2014
作者:
D
Dmitry Kozlov
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
ssh://git.code.sf.net/p/accel-ppp/code
上级
cb4dd773
33bdf407
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
57 addition
and
41 deletion
+57
-41
accel-pppd/ctrl/ipoe/ipoe.c
accel-pppd/ctrl/ipoe/ipoe.c
+45
-33
accel-pppd/ctrl/ipoe/lua.c
accel-pppd/ctrl/ipoe/lua.c
+2
-0
accel-pppd/extra/net-snmp/agent.c
accel-pppd/extra/net-snmp/agent.c
+10
-8
未找到文件。
accel-pppd/ctrl/ipoe/ipoe.c
浏览文件 @
0e6defcc
...
...
@@ -163,6 +163,7 @@ static void __ipoe_recv_dhcpv4(struct dhcpv4_serv *dhcpv4, struct dhcpv4_packet
static
void
ipoe_session_keepalive
(
struct
dhcpv4_packet
*
pack
);
static
void
add_interface
(
const
char
*
ifname
,
int
ifindex
,
const
char
*
opt
,
int
parent_ifindex
,
int
vid
);
static
int
get_offer_delay
();
static
void
__ipoe_session_start
(
struct
ipoe_session
*
ses
);
static
struct
ipoe_session
*
ipoe_session_lookup
(
struct
ipoe_serv
*
serv
,
struct
dhcpv4_packet
*
pack
,
struct
ipoe_session
**
opt82_ses
)
{
...
...
@@ -447,13 +448,50 @@ static void ipoe_change_addr(struct ipoe_session *ses, in_addr_t newaddr)
}
static
void
__ipoe_session_start
(
struct
ipoe_session
*
ses
);
static
int
ipoe_create_interface
(
struct
ipoe_session
*
ses
)
{
struct
unit_cache
*
uc
;
struct
ifreq
ifr
;
pthread_mutex_lock
(
&
uc_lock
);
if
(
!
list_empty
(
&
uc_list
))
{
uc
=
list_entry
(
uc_list
.
next
,
typeof
(
*
uc
),
entry
);
ses
->
ifindex
=
uc
->
ifindex
;
list_del
(
&
uc
->
entry
);
--
uc_size
;
pthread_mutex_unlock
(
&
uc_lock
);
mempool_free
(
uc
);
}
else
{
pthread_mutex_unlock
(
&
uc_lock
);
ses
->
ifindex
=
ipoe_nl_create
(
0
,
0
,
ses
->
serv
->
opt_mode
==
MODE_L2
?
ses
->
serv
->
ifname
:
NULL
,
ses
->
hwaddr
);
if
(
ses
->
ifindex
==
-
1
)
{
log_ppp_error
(
"ipoe: failed to create interface
\n
"
);
ap_session_terminate
(
&
ses
->
ses
,
TERM_NAS_ERROR
,
1
);
return
-
1
;
}
}
memset
(
&
ifr
,
0
,
sizeof
(
ifr
));
ifr
.
ifr_ifindex
=
ses
->
ifindex
;
if
(
ioctl
(
sock_fd
,
SIOCGIFNAME
,
&
ifr
,
sizeof
(
ifr
)))
{
log_ppp_error
(
"ipoe: failed to get interface name
\n
"
);
ses
->
ifindex
=
-
1
;
ap_session_terminate
(
&
ses
->
ses
,
TERM_NAS_ERROR
,
1
);
return
-
1
;
}
strncpy
(
ses
->
ses
.
ifname
,
ifr
.
ifr_name
,
AP_IFNAME_LEN
);
ses
->
ses
.
ifindex
=
ses
->
ifindex
;
ses
->
ses
.
unit_idx
=
ses
->
ifindex
;
ses
->
ctrl
.
dont_ifcfg
=
0
;
return
0
;
}
static
void
ipoe_session_start
(
struct
ipoe_session
*
ses
)
{
int
r
;
char
*
passwd
;
struct
ifreq
ifr
;
struct
unit_cache
*
uc
;
__sync_add_and_fetch
(
&
stat_starting
,
1
);
...
...
@@ -476,6 +514,9 @@ static void ipoe_session_start(struct ipoe_session *ses)
ap_session_starting
(
&
ses
->
ses
);
if
(
!
conf_noauth
)
{
if
(
ses
->
serv
->
opt_shared
&&
ipoe_create_interface
(
ses
))
return
;
r
=
pwdb_check
(
&
ses
->
ses
,
ses
->
ses
.
username
,
PPP_PAP
,
conf_password
?
conf_password
:
ses
->
ses
.
username
);
if
(
r
==
PWDB_NO_IMPL
)
{
passwd
=
pwdb_get_passwd
(
&
ses
->
ses
,
ses
->
ses
.
username
);
...
...
@@ -509,37 +550,8 @@ static void ipoe_session_start(struct ipoe_session *ses)
strncpy
(
ses
->
ses
.
ifname
,
ses
->
serv
->
ifname
,
AP_IFNAME_LEN
);
ses
->
ses
.
ifindex
=
ses
->
serv
->
ifindex
;
}
else
if
(
ses
->
ifindex
==
-
1
)
{
pthread_mutex_lock
(
&
uc_lock
);
if
(
!
list_empty
(
&
uc_list
))
{
uc
=
list_entry
(
uc_list
.
next
,
typeof
(
*
uc
),
entry
);
ses
->
ifindex
=
uc
->
ifindex
;
list_del
(
&
uc
->
entry
);
--
uc_size
;
pthread_mutex_unlock
(
&
uc_lock
);
mempool_free
(
uc
);
}
else
{
pthread_mutex_unlock
(
&
uc_lock
);
ses
->
ifindex
=
ipoe_nl_create
(
0
,
0
,
ses
->
serv
->
opt_mode
==
MODE_L2
?
ses
->
serv
->
ifname
:
NULL
,
ses
->
hwaddr
);
if
(
ses
->
ifindex
==
-
1
)
{
log_ppp_error
(
"ipoe: failed to create interface
\n
"
);
ap_session_terminate
(
&
ses
->
ses
,
TERM_NAS_ERROR
,
1
);
return
;
}
}
memset
(
&
ifr
,
0
,
sizeof
(
ifr
));
ifr
.
ifr_ifindex
=
ses
->
ifindex
;
if
(
ioctl
(
sock_fd
,
SIOCGIFNAME
,
&
ifr
,
sizeof
(
ifr
)))
{
log_ppp_error
(
"ipoe: failed to get interface name
\n
"
);
ses
->
ifindex
=
-
1
;
ap_session_terminate
(
&
ses
->
ses
,
TERM_NAS_ERROR
,
1
);
if
(
ipoe_create_interface
(
ses
))
return
;
}
strncpy
(
ses
->
ses
.
ifname
,
ifr
.
ifr_name
,
AP_IFNAME_LEN
);
ses
->
ses
.
ifindex
=
ses
->
ifindex
;
ses
->
ses
.
unit_idx
=
ses
->
ifindex
;
ses
->
ctrl
.
dont_ifcfg
=
0
;
}
ap_session_set_ifindex
(
&
ses
->
ses
);
...
...
accel-pppd/ctrl/ipoe/lua.c
浏览文件 @
0e6defcc
...
...
@@ -204,6 +204,7 @@ out_err:
log_ppp_error
(
"ipoe: lua: %s
\n
"
,
lua_tostring
(
L
,
-
1
));
lua_close
(
L
);
L
=
NULL
;
pthread_setspecific
(
__key
,
L
);
}
/*static void stackDump (lua_State *L) {
...
...
@@ -266,6 +267,7 @@ out_err:
file_error
=
1
;
lua_close
(
L
);
L
=
NULL
;
pthread_setspecific
(
__key
,
L
);
return
-
1
;
}
...
...
accel-pppd/extra/net-snmp/agent.c
浏览文件 @
0e6defcc
#include <pthread.h>
#include <signal.h>
#include <sys/wait.h>
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
...
...
@@ -26,8 +27,8 @@ static int conf_master = 0;
static oid* oid_prefix;
static size_t oid_prefix_size;*/
static
pthread_t
snmp_thr
;
static
int
snmp_term
=
0
;
static
int
snmp_pid
;
/*int accel_ppp_alloc_oid(oid tail, size_t size, oid **oid)
{
...
...
@@ -70,7 +71,7 @@ static int agent_log(int major, int minor, void *serv_arg, void *cl_arg)
return
0
;
}
static
void
*
snmp_thread
(
void
*
a
)
static
int
snmp_thread
(
void
*
a
)
{
sigset_t
set
;
...
...
@@ -107,22 +108,22 @@ static void *snmp_thread(void *a)
if
(
conf_master
)
init_master_agent
();
while
(
!
snmp_term
)
{
while
(
!
snmp_term
)
agent_check_and_process
(
1
);
}
snmp_shutdown
(
conf_agent_name
);
SOCK_CLEANUP
;
return
NULL
;
return
0
;
}
static
void
snmp_ctx_close
(
struct
triton_context_t
*
ctx
)
{
int
status
;
snmp_term
=
1
;
pthread_cancel
(
snmp_thr
);
pthread_join
(
snmp_thr
,
NULL
);
kill
(
snmp_pid
,
32
);
waitpid
(
snmp_pid
,
&
status
,
0
);
triton_context_unregister
(
ctx
);
}
...
...
@@ -146,7 +147,8 @@ static void init(void)
if (opt)
conf_oid_prefix = opt;*/
pthread_create
(
&
snmp_thr
,
NULL
,
snmp_thread
,
NULL
);
snmp_pid
=
clone
(
snmp_thread
,
malloc
(
1024
*
1024
)
+
1024
*
1024
,
CLONE_SIGHAND
|
CLONE_FS
|
CLONE_VM
|
CLONE_THREAD
,
NULL
);
triton_context_register
(
&
ctx
,
NULL
);
triton_context_wakeup
(
&
ctx
);
triton_collect_cpu_usage
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录