Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Achou.Wang
accel-ppp
提交
0325cc5f
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 搜索 >>
提交
0325cc5f
编写于
9月 27, 2010
作者:
K
Kozlov Dmitry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bug fixes
上级
59d9616d
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
342 addition
and
56 deletion
+342
-56
accel-pptpd/ctrl/pptp.c
accel-pptpd/ctrl/pptp.c
+2
-0
accel-pptpd/include/ppp_fsm.h
accel-pptpd/include/ppp_fsm.h
+69
-1
accel-pptpd/include/ppp_fsm.h
accel-pptpd/include/ppp_fsm.h
+69
-1
accel-pptpd/ppp/ipcp_opt_dns.c
accel-pptpd/ppp/ipcp_opt_dns.c
+15
-3
accel-pptpd/ppp/lcp_opt_accomp.c
accel-pptpd/ppp/lcp_opt_accomp.c
+8
-0
accel-pptpd/ppp/lcp_opt_magic.c
accel-pptpd/ppp/lcp_opt_magic.c
+3
-0
accel-pptpd/ppp/lcp_opt_mru.c
accel-pptpd/ppp/lcp_opt_mru.c
+3
-0
accel-pptpd/ppp/lcp_opt_pcomp.c
accel-pptpd/ppp/lcp_opt_pcomp.c
+8
-0
accel-pptpd/ppp/ppp_auth.c
accel-pptpd/ppp/ppp_auth.c
+4
-0
accel-pptpd/ppp/ppp_ccp.c
accel-pptpd/ppp/ppp_ccp.c
+39
-0
accel-pptpd/ppp/ppp_ccp.h
accel-pptpd/ppp/ppp_ccp.h
+1
-0
accel-pptpd/ppp/ppp_fsm.c
accel-pptpd/ppp/ppp_fsm.c
+19
-40
accel-pptpd/ppp/ppp_fsm.h
accel-pptpd/ppp/ppp_fsm.h
+5
-0
accel-pptpd/ppp/ppp_ipcp.c
accel-pptpd/ppp/ppp_ipcp.c
+35
-0
accel-pptpd/ppp/ppp_lcp.c
accel-pptpd/ppp/ppp_lcp.c
+59
-10
accel-pptpd/radius/auth.c
accel-pptpd/radius/auth.c
+1
-1
accel-pptpd/radius/dict/dictionary
accel-pptpd/radius/dict/dictionary
+2
-0
未找到文件。
accel-pptpd/ctrl/pptp.c
浏览文件 @
0325cc5f
...
...
@@ -580,6 +580,8 @@ static void __init pptp_init(void)
addr
.
sin_family
=
AF_INET
;
addr
.
sin_port
=
htons
(
PPTP_PORT
);
addr
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
setsockopt
(
serv
.
hnd
.
fd
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
serv
.
hnd
.
fd
,
4
);
if
(
bind
(
serv
.
hnd
.
fd
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
))
<
0
)
{
log_emerg
(
"pptp: failed to bind socket: %s
\n
"
,
strerror
(
errno
));
close
(
serv
.
hnd
.
fd
);
...
...
accel-pptpd/include/ppp_fsm.h
已删除
120000 → 0
浏览文件 @
59d9616d
..
/
ppp
/
ppp_fsm
.
h
\ No newline at end of file
accel-pptpd/include/ppp_fsm.h
0 → 100644
浏览文件 @
0325cc5f
#ifndef PPP_FSM_H
#define PPP_FSM_H
typedef
enum
{
FSM_Initial
=
0
,
FSM_Starting
,
FSM_Closed
,
FSM_Stopped
,
FSM_Closing
,
FSM_Stopping
,
FSM_Req_Sent
,
FSM_Ack_Rcvd
,
FSM_Ack_Sent
,
FSM_Opened
}
FSM_STATE
;
/*
* CP (LCP, IPCP, etc.) codes.
*/
#define CONFREQ 1
/* Configuration Request */
#define CONFACK 2
/* Configuration Ack */
#define CONFNAK 3
/* Configuration Nak */
#define CONFREJ 4
/* Configuration Reject */
#define TERMREQ 5
/* Termination Request */
#define TERMACK 6
/* Termination Ack */
#define CODEREJ 7
/* Code Reject */
#define PROTOREJ 8
/* Code Reject */
#define ECHOREQ 9
/* Echo Request */
#define ECHOREP 10
/* Echo Reply */
struct
ppp_t
;
struct
ppp_fsm_t
{
struct
ppp_t
*
ppp
;
FSM_STATE
fsm_state
;
uint16_t
proto
;
struct
triton_timer_t
restart_timer
;
int
restart_counter
;
int
max_terminate
;
int
max_configure
;
int
max_failure
;
int
timeout
;
int
conf_failure
;
int
id
;
int
recv_id
;
//fsm handling
void
(
*
layer_up
)(
struct
ppp_fsm_t
*
);
void
(
*
layer_down
)(
struct
ppp_fsm_t
*
);
void
(
*
layer_started
)(
struct
ppp_fsm_t
*
);
void
(
*
layer_finished
)(
struct
ppp_fsm_t
*
);
int
(
*
send_conf_req
)(
struct
ppp_fsm_t
*
);
void
(
*
send_conf_ack
)(
struct
ppp_fsm_t
*
);
void
(
*
send_conf_nak
)(
struct
ppp_fsm_t
*
);
void
(
*
send_conf_rej
)(
struct
ppp_fsm_t
*
);
void
(
*
send_code_rej
)(
struct
ppp_fsm_t
*
);
};
void
ppp_fsm_init
(
struct
ppp_fsm_t
*
);
void
ppp_fsm_free
(
struct
ppp_fsm_t
*
);
int
ppp_fsm_lower_up
(
struct
ppp_fsm_t
*
);
void
ppp_fsm_lower_down
(
struct
ppp_fsm_t
*
);
int
ppp_fsm_open
(
struct
ppp_fsm_t
*
);
void
ppp_fsm_close
(
struct
ppp_fsm_t
*
);
void
ppp_fsm_timeout0
(
struct
ppp_fsm_t
*
layer
);
void
ppp_fsm_timeout1
(
struct
ppp_fsm_t
*
layer
);
void
ppp_fsm_recv_conf_req_ack
(
struct
ppp_fsm_t
*
layer
);
void
ppp_fsm_recv_conf_req_nak
(
struct
ppp_fsm_t
*
layer
);
void
ppp_fsm_recv_conf_req_rej
(
struct
ppp_fsm_t
*
layer
);
void
ppp_fsm_recv_conf_ack
(
struct
ppp_fsm_t
*
layer
);
void
ppp_fsm_recv_conf_rej
(
struct
ppp_fsm_t
*
layer
);
void
ppp_fsm_recv_term_req
(
struct
ppp_fsm_t
*
layer
);
void
ppp_fsm_recv_term_ack
(
struct
ppp_fsm_t
*
layer
);
void
ppp_fsm_recv_unk
(
struct
ppp_fsm_t
*
layer
);
void
ppp_fsm_recv_code_rej_bad
(
struct
ppp_fsm_t
*
layer
);
#endif
accel-pptpd/ppp/ipcp_opt_dns.c
浏览文件 @
0325cc5f
...
...
@@ -9,6 +9,9 @@
#include "memdebug.h"
static
in_addr_t
conf_dns1
;
static
in_addr_t
conf_dns2
;
static
struct
ipcp_option_t
*
dns1_init
(
struct
ppp_ipcp_t
*
ipcp
);
static
struct
ipcp_option_t
*
dns2_init
(
struct
ppp_ipcp_t
*
ipcp
);
static
void
dns_free
(
struct
ppp_ipcp_t
*
ipcp
,
struct
ipcp_option_t
*
opt
);
...
...
@@ -100,8 +103,8 @@ static int dns_recv_conf_req(struct ppp_ipcp_t *ipcp, struct ipcp_option_t *opt,
if
(
!
dns_opt
->
addr
)
{
if
(
dns_opt
->
opt
.
id
==
CI_DNS1
)
dns_opt
->
addr
=
inet_addr
(
"10.0.0.1"
)
;
else
dns_opt
->
addr
=
inet_addr
(
"10.0.0.2"
)
;
if
(
dns_opt
->
opt
.
id
==
CI_DNS1
&&
conf_dns1
)
dns_opt
->
addr
=
conf_dns1
;
else
if
(
dns_opt
->
opt
.
id
==
CI_DNS2
&&
conf_dns2
)
dns_opt
->
addr
=
conf_dns2
;
if
(
!
dns_opt
->
addr
)
{
...
...
@@ -142,7 +145,16 @@ static void dns2_print(void (*print)(const char *fmt,...),struct ipcp_option_t *
static
void
__init
dns_opt_init
()
{
char
*
opt
;
opt
=
conf_get_opt
(
"dns"
,
"dns1"
);
if
(
opt
)
conf_dns1
=
inet_addr
(
opt
);
opt
=
conf_get_opt
(
"dns"
,
"dns2"
);
if
(
opt
)
conf_dns2
=
inet_addr
(
opt
);
ipcp_option_register
(
&
dns1_opt_hnd
);
ipcp_option_register
(
&
dns2_opt_hnd
);
}
accel-pptpd/ppp/lcp_opt_accomp.c
浏览文件 @
0325cc5f
...
...
@@ -19,6 +19,7 @@ struct accomp_option_t
{
struct
lcp_option_t
opt
;
int
accomp
;
// 0 - disabled, 1 - enabled, 2 - allow,disabled, 3 - allow,enabled
int
require
;
};
static
struct
lcp_option_handler_t
accomp_opt_hnd
=
...
...
@@ -75,6 +76,13 @@ static int accomp_recv_conf_req(struct ppp_lcp_t *lcp, struct lcp_option_t *opt,
{
struct
accomp_option_t
*
accomp_opt
=
container_of
(
opt
,
typeof
(
*
accomp_opt
),
opt
);
if
(
!
ptr
)
{
if
(
accomp_opt
->
require
)
return
LCP_OPT_NAK
;
accomp_opt
->
accomp
=
0
;
return
LCP_OPT_ACK
;
}
if
(
accomp_opt
->
accomp
>
0
)
{
accomp_opt
->
accomp
=
1
;
...
...
accel-pptpd/ppp/lcp_opt_magic.c
浏览文件 @
0325cc5f
...
...
@@ -64,6 +64,9 @@ static int magic_recv_conf_req(struct ppp_lcp_t *lcp, struct lcp_option_t *opt,
struct
magic_option_t
*
magic_opt
=
container_of
(
opt
,
typeof
(
*
magic_opt
),
opt
);
struct
lcp_opt32_t
*
opt32
=
(
struct
lcp_opt32_t
*
)
ptr
;
if
(
!
ptr
)
return
LCP_OPT_NAK
;
if
(
magic_opt
->
magic
==
ntohl
(
opt32
->
val
))
{
log_ppp_error
(
"loop detected"
);
...
...
accel-pptpd/ppp/lcp_opt_mru.c
浏览文件 @
0325cc5f
...
...
@@ -86,6 +86,9 @@ static int mru_recv_conf_req(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, ui
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
)
return
LCP_OPT_NAK
;
if
(
ntohs
(
opt16
->
val
)
<
conf_min_mtu
||
ntohs
(
opt16
->
val
)
>
lcp
->
ppp
->
ctrl
->
max_mtu
)
return
LCP_OPT_NAK
;
...
...
accel-pptpd/ppp/lcp_opt_pcomp.c
浏览文件 @
0325cc5f
...
...
@@ -19,6 +19,7 @@ struct pcomp_option_t
{
struct
lcp_option_t
opt
;
int
pcomp
;
// 0 - disabled, 1 - enabled, 2 - allow,disabled, 3 - allow,enabled
int
require
;
};
static
struct
lcp_option_handler_t
pcomp_opt_hnd
=
...
...
@@ -75,6 +76,13 @@ static int pcomp_recv_conf_req(struct ppp_lcp_t *lcp, struct lcp_option_t *opt,
{
struct
pcomp_option_t
*
pcomp_opt
=
container_of
(
opt
,
typeof
(
*
pcomp_opt
),
opt
);
if
(
!
ptr
)
{
if
(
pcomp_opt
->
require
)
return
LCP_OPT_NAK
;
pcomp_opt
->
pcomp
=
0
;
return
LCP_OPT_ACK
;
}
if
(
pcomp_opt
->
pcomp
>
0
)
{
pcomp_opt
->
pcomp
=
1
;
...
...
accel-pptpd/ppp/ppp_auth.c
浏览文件 @
0325cc5f
...
...
@@ -137,6 +137,10 @@ static int auth_recv_conf_req(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, u
if
(
list_empty
(
&
auth_opt
->
auth_list
))
return
LCP_OPT_REJ
;
if
(
!
ptr
)
return
LCP_OPT_ACK
;
list_for_each_entry
(
d
,
&
auth_opt
->
auth_list
,
entry
)
{
...
...
accel-pptpd/ppp/ppp_ccp.c
浏览文件 @
0325cc5f
...
...
@@ -30,6 +30,8 @@ static int send_conf_req(struct ppp_fsm_t*);
static
void
send_conf_ack
(
struct
ppp_fsm_t
*
);
static
void
send_conf_nak
(
struct
ppp_fsm_t
*
);
static
void
send_conf_rej
(
struct
ppp_fsm_t
*
);
static
void
send_term_req
(
struct
ppp_fsm_t
*
fsm
);
static
void
send_term_ack
(
struct
ppp_fsm_t
*
fsm
);
static
void
ccp_recv
(
struct
ppp_handler_t
*
);
static
void
ccp_options_init
(
struct
ppp_ccp_t
*
ccp
)
...
...
@@ -87,6 +89,8 @@ static struct ppp_layer_data_t *ccp_layer_init(struct ppp_t *ppp)
ccp
->
fsm
.
send_conf_ack
=
send_conf_ack
;
ccp
->
fsm
.
send_conf_nak
=
send_conf_nak
;
ccp
->
fsm
.
send_conf_rej
=
send_conf_rej
;
ccp
->
fsm
.
send_term_req
=
send_term_req
;
ccp
->
fsm
.
send_term_ack
=
send_term_ack
;
INIT_LIST_HEAD
(
&
ccp
->
options
);
INIT_LIST_HEAD
(
&
ccp
->
ropt_list
);
...
...
@@ -135,6 +139,7 @@ static void ccp_layer_up(struct ppp_fsm_t *fsm)
{
struct
ppp_ccp_t
*
ccp
=
container_of
(
fsm
,
typeof
(
*
ccp
),
fsm
);
log_ppp_debug
(
"ccp_layer_started
\n
"
);
ccp
->
started
=
1
;
ppp_layer_started
(
ccp
->
ppp
,
&
ccp
->
ld
);
}
...
...
@@ -142,6 +147,9 @@ static void ccp_layer_down(struct ppp_fsm_t *fsm)
{
struct
ppp_ccp_t
*
ccp
=
container_of
(
fsm
,
typeof
(
*
ccp
),
fsm
);
log_ppp_debug
(
"ccp_layer_finished
\n
"
);
if
(
!
ccp
->
started
)
ppp_layer_started
(
ccp
->
ppp
,
&
ccp
->
ld
);
ccp
->
started
=
0
;
ppp_layer_finished
(
ccp
->
ppp
,
&
ccp
->
ld
);
}
...
...
@@ -481,6 +489,36 @@ static int ccp_recv_conf_ack(struct ppp_ccp_t *ccp,uint8_t *data,int size)
return
res
;
}
static
void
send_term_req
(
struct
ppp_fsm_t
*
fsm
)
{
struct
ppp_ccp_t
*
ccp
=
container_of
(
fsm
,
typeof
(
*
ccp
),
fsm
);
struct
ccp_hdr_t
hdr
=
{
.
proto
=
htons
(
PPP_CCP
),
.
code
=
TERMREQ
,
.
id
=
++
ccp
->
fsm
.
id
,
.
len
=
htons
(
4
),
};
log_ppp_debug
(
"send [CCP TermReq id=%i
\"\"
]
\n
"
,
hdr
.
id
);
ppp_chan_send
(
ccp
->
ppp
,
&
hdr
,
6
);
}
static
void
send_term_ack
(
struct
ppp_fsm_t
*
fsm
)
{
struct
ppp_ccp_t
*
ccp
=
container_of
(
fsm
,
typeof
(
*
ccp
),
fsm
);
struct
ccp_hdr_t
hdr
=
{
.
proto
=
htons
(
PPP_CCP
),
.
code
=
TERMACK
,
.
id
=
ccp
->
fsm
.
recv_id
,
.
len
=
htons
(
4
),
};
log_ppp_debug
(
"send [CCP TermAck id=%i
\"\"
]
\n
"
,
hdr
.
id
);
ppp_chan_send
(
ccp
->
ppp
,
&
hdr
,
6
);
}
static
void
ccp_recv
(
struct
ppp_handler_t
*
h
)
{
struct
ccp_hdr_t
*
hdr
;
...
...
@@ -549,6 +587,7 @@ static void ccp_recv(struct ppp_handler_t*h)
log_ppp_debug
(
"recv [CCP TermReq id=%x
\"
%s
\"
]
\n
"
,
hdr
->
id
,
term_msg
);
_free
(
term_msg
);
ppp_fsm_recv_term_req
(
&
ccp
->
fsm
);
ppp_fsm_close
(
&
ccp
->
fsm
);
break
;
case
TERMACK
:
term_msg
=
_strndup
((
char
*
)(
hdr
+
1
),
ntohs
(
hdr
->
len
)
-
4
);
...
...
accel-pptpd/ppp/ppp_ccp.h
浏览文件 @
0325cc5f
...
...
@@ -86,6 +86,7 @@ struct ppp_ccp_t
int
ropt_len
;
int
conf_req_len
;
int
started
:
1
;
};
int
ccp_option_register
(
struct
ccp_option_handler_t
*
h
);
...
...
accel-pptpd/ppp/ppp_fsm.c
浏览文件 @
0325cc5f
...
...
@@ -143,7 +143,7 @@ void ppp_fsm_close(struct ppp_fsm_t *layer)
case
FSM_Ack_Sent
:
//if (layer->init_req_cnt) layer->init_req_cnt(layer);
init_req_counter
(
layer
,
layer
->
max_terminate
);
send_term_req
(
layer
);
layer
->
send_term_req
(
layer
);
layer
->
fsm_state
=
FSM_Closing
;
break
;
default:
...
...
@@ -157,7 +157,7 @@ void ppp_fsm_timeout0(struct ppp_fsm_t *layer)
{
case
FSM_Closing
:
case
FSM_Stopping
:
send_term_req
(
layer
);
layer
->
send_term_req
(
layer
);
break
;
case
FSM_Ack_Rcvd
:
layer
->
fsm_state
=
FSM_Req_Sent
;
...
...
@@ -202,7 +202,7 @@ void ppp_fsm_recv_conf_req_ack(struct ppp_fsm_t *layer)
switch
(
layer
->
fsm_state
)
{
case
FSM_Closed
:
send_term_ack
(
layer
);
layer
->
send_term_ack
(
layer
);
break
;
case
FSM_Stopped
:
//if (layer->init_req_cnt) layer->init_req_cnt(layer);
...
...
@@ -237,7 +237,7 @@ void ppp_fsm_recv_conf_req_nak(struct ppp_fsm_t *layer)
switch
(
layer
->
fsm_state
)
{
case
FSM_Closed
:
send_term_ack
(
layer
);
layer
->
send_term_ack
(
layer
);
break
;
case
FSM_Stopped
:
//if (layer->init_req_cnt) layer->init_req_cnt(layer);
...
...
@@ -269,7 +269,7 @@ void ppp_fsm_recv_conf_req_rej(struct ppp_fsm_t *layer)
switch
(
layer
->
fsm_state
)
{
case
FSM_Closed
:
send_term_ack
(
layer
);
layer
->
send_term_ack
(
layer
);
break
;
case
FSM_Stopped
:
//if (layer->init_req_cnt) layer->init_req_cnt(layer);
...
...
@@ -302,7 +302,7 @@ void ppp_fsm_recv_conf_ack(struct ppp_fsm_t *layer)
{
case
FSM_Closed
:
case
FSM_Stopped
:
send_term_ack
(
layer
);
layer
->
send_term_ack
(
layer
);
break
;
case
FSM_Req_Sent
:
//if (layer->init_req_cnt) layer->init_req_cnt(layer);
...
...
@@ -338,9 +338,13 @@ void ppp_fsm_recv_conf_rej(struct ppp_fsm_t *layer)
{
case
FSM_Closed
:
case
FSM_Stopped
:
send_term_ack
(
layer
);
layer
->
send_term_ack
(
layer
);
break
;
case
FSM_Req_Sent
:
if
(
++
layer
->
conf_failure
==
layer
->
max_failure
)
{
ppp_terminate
(
layer
->
ppp
,
0
);
return
;
}
//if (layer->init_req_cnt) layer->init_req_cnt(layer);
init_req_counter
(
layer
,
layer
->
max_failure
);
--
layer
->
restart_counter
;
...
...
@@ -375,7 +379,7 @@ void ppp_fsm_recv_term_req(struct ppp_fsm_t *layer)
case
FSM_Opened
:
if
(
layer
->
layer_down
)
layer
->
layer_down
(
layer
);
//send_term_req(layer);
send_term_ack
(
layer
);
layer
->
send_term_ack
(
layer
);
//if (layer->zero_req_cnt) layer->zero_req_cnt(layer);
zero_req_counter
(
layer
);
layer
->
fsm_state
=
FSM_Stopping
;
...
...
@@ -383,17 +387,18 @@ void ppp_fsm_recv_term_req(struct ppp_fsm_t *layer)
case
FSM_Req_Sent
:
case
FSM_Ack_Rcvd
:
case
FSM_Ack_Sent
:
send_term_ack
(
layer
);
layer
->
send_term_ack
(
layer
);
layer
->
fsm_state
=
FSM_Req_Sent
;
break
;
default:
send_term_req
(
layer
);
layer
->
send_term_req
(
layer
);
break
;
}
}
void
ppp_fsm_recv_term_ack
(
struct
ppp_fsm_t
*
layer
)
{
stop_timer
(
layer
);
switch
(
layer
->
fsm_state
)
{
case
FSM_Closing
:
...
...
@@ -420,7 +425,7 @@ void ppp_fsm_recv_term_ack(struct ppp_fsm_t *layer)
void
ppp_fsm_recv_unk
(
struct
ppp_fsm_t
*
layer
)
{
if
(
layer
->
send_co
nf_rej
)
layer
->
send_conf
_rej
(
layer
);
if
(
layer
->
send_co
de_rej
)
layer
->
send_code
_rej
(
layer
);
}
void
ppp_fsm_recv_code_rej_perm
(
struct
ppp_fsm_t
*
layer
)
...
...
@@ -441,7 +446,7 @@ void ppp_fsm_recv_code_rej_bad(struct ppp_fsm_t *layer)
{
case
FSM_Opened
:
if
(
layer
->
layer_down
)
layer
->
layer_down
(
layer
);
send_term_req
(
layer
);
layer
->
send_term_req
(
layer
);
layer
->
fsm_state
=
FSM_Stopping
;
break
;
case
FSM_Closing
:
...
...
@@ -460,34 +465,6 @@ void ppp_fsm_recv_code_rej_bad(struct ppp_fsm_t *layer)
}
}
void
send_term_req
(
struct
ppp_fsm_t
*
layer
)
{
struct
lcp_hdr_t
hdr
=
{
.
proto
=
htons
(
PPP_LCP
),
.
code
=
TERMREQ
,
.
id
=
++
layer
->
id
,
.
len
=
htons
(
4
),
};
log_ppp_debug
(
"send [LCP TermReq id=%i
\"\"
]
\n
"
,
hdr
.
id
);
--
layer
->
restart_counter
;
ppp_chan_send
(
layer
->
ppp
,
&
hdr
,
6
);
}
void
send_term_ack
(
struct
ppp_fsm_t
*
layer
)
{
struct
lcp_hdr_t
hdr
=
{
.
proto
=
htons
(
layer
->
proto
),
.
code
=
TERMACK
,
.
id
=
layer
->
recv_id
,
.
len
=
htons
(
4
),
};
log_ppp_debug
(
"send [LCP TermAck id=%i
\"\"
]
\n
"
,
hdr
.
id
);
ppp_chan_send
(
layer
->
ppp
,
&
hdr
,
6
);
}
static
void
stop_timer
(
struct
ppp_fsm_t
*
fsm
)
{
if
(
fsm
->
restart_timer
.
tpd
)
...
...
@@ -510,6 +487,8 @@ static void restart_timer_func(struct triton_timer_t *t)
{
struct
ppp_fsm_t
*
layer
=
container_of
(
t
,
typeof
(
*
layer
),
restart_timer
);
log_ppp_debug
(
"fsm timeout
\n
"
);
if
(
layer
->
restart_counter
>
0
)
ppp_fsm_timeout0
(
layer
);
else
...
...
accel-pptpd/ppp/ppp_fsm.h
浏览文件 @
0325cc5f
...
...
@@ -12,6 +12,7 @@ typedef enum {FSM_Initial=0,FSM_Starting,FSM_Closed,FSM_Stopped,FSM_Closing,FSM_
#define TERMREQ 5
/* Termination Request */
#define TERMACK 6
/* Termination Ack */
#define CODEREJ 7
/* Code Reject */
#define PROTOREJ 8
/* Code Reject */
#define ECHOREQ 9
/* Echo Request */
#define ECHOREP 10
/* Echo Reply */
...
...
@@ -29,6 +30,7 @@ struct ppp_fsm_t
int
max_configure
;
int
max_failure
;
int
timeout
;
int
conf_failure
;
int
id
;
int
recv_id
;
...
...
@@ -42,6 +44,9 @@ struct ppp_fsm_t
void
(
*
send_conf_ack
)(
struct
ppp_fsm_t
*
);
void
(
*
send_conf_nak
)(
struct
ppp_fsm_t
*
);
void
(
*
send_conf_rej
)(
struct
ppp_fsm_t
*
);
void
(
*
send_code_rej
)(
struct
ppp_fsm_t
*
);
void
(
*
send_term_req
)(
struct
ppp_fsm_t
*
);
void
(
*
send_term_ack
)(
struct
ppp_fsm_t
*
);
};
void
ppp_fsm_init
(
struct
ppp_fsm_t
*
);
...
...
accel-pptpd/ppp/ppp_ipcp.c
浏览文件 @
0325cc5f
...
...
@@ -31,6 +31,8 @@ static void send_conf_ack(struct ppp_fsm_t*);
static
void
send_conf_nak
(
struct
ppp_fsm_t
*
);
static
void
send_conf_rej
(
struct
ppp_fsm_t
*
);
static
void
ipcp_recv
(
struct
ppp_handler_t
*
);
static
void
send_term_req
(
struct
ppp_fsm_t
*
fsm
);
static
void
send_term_ack
(
struct
ppp_fsm_t
*
fsm
);
static
void
ipcp_options_init
(
struct
ppp_ipcp_t
*
ipcp
)
{
...
...
@@ -87,6 +89,8 @@ static struct ppp_layer_data_t *ipcp_layer_init(struct ppp_t *ppp)
ipcp
->
fsm
.
send_conf_ack
=
send_conf_ack
;
ipcp
->
fsm
.
send_conf_nak
=
send_conf_nak
;
ipcp
->
fsm
.
send_conf_rej
=
send_conf_rej
;
ipcp
->
fsm
.
send_term_req
=
send_term_req
;
ipcp
->
fsm
.
send_term_ack
=
send_term_ack
;
INIT_LIST_HEAD
(
&
ipcp
->
options
);
INIT_LIST_HEAD
(
&
ipcp
->
ropt_list
);
...
...
@@ -478,6 +482,36 @@ static int ipcp_recv_conf_ack(struct ppp_ipcp_t *ipcp,uint8_t *data,int size)
return
res
;
}
static
void
send_term_req
(
struct
ppp_fsm_t
*
fsm
)
{
struct
ppp_ipcp_t
*
ipcp
=
container_of
(
fsm
,
typeof
(
*
ipcp
),
fsm
);
struct
ipcp_hdr_t
hdr
=
{
.
proto
=
htons
(
PPP_IPCP
),
.
code
=
TERMREQ
,
.
id
=
++
ipcp
->
fsm
.
id
,
.
len
=
htons
(
4
),
};
log_ppp_debug
(
"send [IPCP TermReq id=%i
\"\"
]
\n
"
,
hdr
.
id
);
ppp_unit_send
(
ipcp
->
ppp
,
&
hdr
,
6
);
}
static
void
send_term_ack
(
struct
ppp_fsm_t
*
fsm
)
{
struct
ppp_ipcp_t
*
ipcp
=
container_of
(
fsm
,
typeof
(
*
ipcp
),
fsm
);
struct
ipcp_hdr_t
hdr
=
{
.
proto
=
htons
(
PPP_IPCP
),
.
code
=
TERMACK
,
.
id
=
ipcp
->
fsm
.
recv_id
,
.
len
=
htons
(
4
),
};
log_ppp_debug
(
"send [IPCP TermAck id=%i
\"\"
]
\n
"
,
hdr
.
id
);
ppp_unit_send
(
ipcp
->
ppp
,
&
hdr
,
6
);
}
static
void
ipcp_recv
(
struct
ppp_handler_t
*
h
)
{
struct
ipcp_hdr_t
*
hdr
;
...
...
@@ -553,6 +587,7 @@ static void ipcp_recv(struct ppp_handler_t*h)
log_ppp_debug
(
"recv [IPCP TermAck id=%x
\"
%s
\"
]
\n
"
,
hdr
->
id
,
term_msg
);
_free
(
term_msg
);
ppp_fsm_recv_term_ack
(
&
ipcp
->
fsm
);
ppp_terminate
(
ipcp
->
ppp
,
0
);
break
;
case
CODEREJ
:
log_ppp_debug
(
"recv [IPCP CodeRej id=%x]
\n
"
,
hdr
->
id
);
...
...
accel-pptpd/ppp/ppp_lcp.c
浏览文件 @
0325cc5f
...
...
@@ -34,9 +34,12 @@ static int send_conf_req(struct ppp_fsm_t*);
static
void
send_conf_ack
(
struct
ppp_fsm_t
*
);
static
void
send_conf_nak
(
struct
ppp_fsm_t
*
);
static
void
send_conf_rej
(
struct
ppp_fsm_t
*
);
static
void
lcp_recv
(
struct
ppp_handler
_t
*
);
static
void
send_code_rej
(
struct
ppp_fsm
_t
*
);
static
void
start_echo
(
struct
ppp_lcp_t
*
lcp
);
static
void
stop_echo
(
struct
ppp_lcp_t
*
lcp
);
static
void
send_term_req
(
struct
ppp_fsm_t
*
fsm
);
static
void
send_term_ack
(
struct
ppp_fsm_t
*
fsm
);
static
void
lcp_recv
(
struct
ppp_handler_t
*
);
static
void
lcp_options_init
(
struct
ppp_lcp_t
*
lcp
)
{
...
...
@@ -96,6 +99,9 @@ static struct ppp_layer_data_t *lcp_layer_init(struct ppp_t *ppp)
lcp
->
fsm
.
send_conf_ack
=
send_conf_ack
;
lcp
->
fsm
.
send_conf_nak
=
send_conf_nak
;
lcp
->
fsm
.
send_conf_rej
=
send_conf_rej
;
lcp
->
fsm
.
send_code_rej
=
send_code_rej
;
lcp
->
fsm
.
send_term_req
=
send_term_req
;
lcp
->
fsm
.
send_term_ack
=
send_term_ack
;
INIT_LIST_HEAD
(
&
lcp
->
ropt_list
);
...
...
@@ -238,12 +244,23 @@ static void send_conf_ack(struct ppp_fsm_t *fsm)
ppp_chan_send
(
lcp
->
ppp
,
hdr
,
ntohs
(
hdr
->
len
)
+
2
);
}
static
void
send_code_rej
(
struct
ppp_fsm_t
*
fsm
)
{
struct
ppp_lcp_t
*
lcp
=
container_of
(
fsm
,
typeof
(
*
lcp
),
fsm
);
struct
lcp_hdr_t
*
hdr
=
(
struct
lcp_hdr_t
*
)
lcp
->
ppp
->
chan_buf
;
hdr
->
code
=
CONFACK
;
log_ppp_debug
(
"send [LCP CodeRej %x id=%x ]
\n
"
,
hdr
->
code
,
lcp
->
fsm
.
recv_id
);
ppp_chan_send
(
lcp
->
ppp
,
hdr
,
ntohs
(
hdr
->
len
)
+
2
);
}
static
void
send_conf_nak
(
struct
ppp_fsm_t
*
fsm
)
{
struct
ppp_lcp_t
*
lcp
=
container_of
(
fsm
,
typeof
(
*
lcp
),
fsm
);
uint8_t
*
buf
=
_malloc
(
lcp
->
conf_req_len
),
*
ptr
=
buf
;
struct
lcp_hdr_t
*
lcp_hdr
=
(
struct
lcp_hdr_t
*
)
ptr
;
struct
recv_opt_t
*
r
opt
;
struct
lcp_option_t
*
l
opt
;
log_ppp_debug
(
"send [LCP ConfNak id=%x"
,
lcp
->
fsm
.
recv_id
);
...
...
@@ -254,13 +271,11 @@ static void send_conf_nak(struct ppp_fsm_t *fsm)
ptr
+=
sizeof
(
*
lcp_hdr
);
list_for_each_entry
(
ropt
,
&
lcp
->
ropt_list
,
entry
)
{
if
(
ropt
->
state
==
LCP_OPT_NAK
)
{
list_for_each_entry
(
lopt
,
&
lcp
->
options
,
entry
)
{
if
(
lopt
->
state
==
LCP_OPT_NAK
)
{
log_ppp_debug
(
" "
);
ropt
->
lopt
->
h
->
print
(
log_ppp_debug
,
ropt
->
lopt
,
NULL
);
ptr
+=
ropt
->
lopt
->
h
->
send_conf_nak
(
lcp
,
ropt
->
lopt
,
ptr
);
lopt
->
h
->
print
(
log_ppp_debug
,
lopt
,
NULL
);
ptr
+=
lopt
->
h
->
send_conf_nak
(
lcp
,
lopt
,
ptr
);
}
}
...
...
@@ -363,7 +378,7 @@ static int lcp_recv_conf_req(struct ppp_lcp_t *lcp,uint8_t *data,int size)
}
log_ppp_debug
(
"]
\n
"
);
/*
list_for_each_entry(lopt,&lcp->options,entry)
list_for_each_entry
(
lopt
,
&
lcp
->
options
,
entry
)
{
if
(
lopt
->
state
==
LCP_OPT_NONE
)
{
...
...
@@ -371,7 +386,7 @@ static int lcp_recv_conf_req(struct ppp_lcp_t *lcp,uint8_t *data,int size)
lopt
->
state
=
r
;
if
(
r
<
ret
)
ret
=
r
;
}
}
*/
}
return
ret
;
}
...
...
@@ -571,6 +586,36 @@ static void stop_echo(struct ppp_lcp_t *lcp)
triton_timer_del
(
&
lcp
->
echo_timer
);
}
static
void
send_term_req
(
struct
ppp_fsm_t
*
fsm
)
{
struct
ppp_lcp_t
*
lcp
=
container_of
(
fsm
,
typeof
(
*
lcp
),
fsm
);
struct
lcp_hdr_t
hdr
=
{
.
proto
=
htons
(
PPP_LCP
),
.
code
=
TERMREQ
,
.
id
=
++
lcp
->
fsm
.
id
,
.
len
=
htons
(
4
),
};
log_ppp_debug
(
"send [LCP TermReq id=%i
\"\"
]
\n
"
,
hdr
.
id
);
ppp_chan_send
(
lcp
->
ppp
,
&
hdr
,
6
);
}
static
void
send_term_ack
(
struct
ppp_fsm_t
*
fsm
)
{
struct
ppp_lcp_t
*
lcp
=
container_of
(
fsm
,
typeof
(
*
lcp
),
fsm
);
struct
lcp_hdr_t
hdr
=
{
.
proto
=
htons
(
PPP_LCP
),
.
code
=
TERMACK
,
.
id
=
lcp
->
fsm
.
recv_id
,
.
len
=
htons
(
4
),
};
log_ppp_debug
(
"send [LCP TermAck id=%i
\"\"
]
\n
"
,
hdr
.
id
);
ppp_chan_send
(
lcp
->
ppp
,
&
hdr
,
6
);
}
static
void
lcp_recv
(
struct
ppp_handler_t
*
h
)
{
struct
lcp_hdr_t
*
hdr
;
...
...
@@ -657,7 +702,11 @@ static void lcp_recv(struct ppp_handler_t*h)
case
ECHOREP
:
lcp_recv_echo_repl
(
lcp
,(
uint8_t
*
)(
hdr
+
1
),
ntohs
(
hdr
->
len
)
-
PPP_HDRLEN
);
break
;
case
PROTOREJ
:
log_ppp_debug
(
"recv [LCP ProtoRej id=%x <%x>]
\n
"
,
hdr
->
code
,
hdr
->
id
,
*
(
uint16_t
*
)(
hdr
+
1
));
break
;
default:
log_ppp_debug
(
"recv [LCP Unknown %x]
\n
"
,
hdr
->
code
);
ppp_fsm_recv_unk
(
&
lcp
->
fsm
);
break
;
}
...
...
accel-pptpd/radius/auth.c
浏览文件 @
0325cc5f
...
...
@@ -173,7 +173,7 @@ int rad_auth_mschap_v1(struct radius_pd_t *rpd, const char *username, va_list ar
const
uint8_t
*
nt_response
=
va_arg
(
args
,
const
uint8_t
*
);
int
flags
=
va_arg
(
args
,
int
);
req
=
rad_req_alloc
(
rpd
,
CODE_ACCESS_
ACCEP
T
,
username
);
req
=
rad_req_alloc
(
rpd
,
CODE_ACCESS_
REQUES
T
,
username
);
if
(
!
req
)
return
PWDB_DENIED
;
...
...
accel-pptpd/radius/dict/dictionary
浏览文件 @
0325cc5f
...
...
@@ -74,3 +74,5 @@ $INCLUDE dictionary.rfc5176
$INCLUDE dictionary.microsoft
ATTRIBUTE Traffic-Shape-in 231 integer
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录