Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Achou.Wang
accel-ppp
提交
43803998
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,发现更多精彩内容 >>
提交
43803998
编写于
11月 29, 2010
作者:
K
Kozlov Dmitry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
l2tp: move hello messages to debug log level
上级
83283bf5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
45 addition
and
34 deletion
+45
-34
accel-pptpd/ctrl/l2tp/l2tp.c
accel-pptpd/ctrl/l2tp/l2tp.c
+29
-19
accel-pptpd/ctrl/l2tp/l2tp.h
accel-pptpd/ctrl/l2tp/l2tp.h
+1
-1
accel-pptpd/ctrl/l2tp/packet.c
accel-pptpd/ctrl/l2tp/packet.c
+15
-14
未找到文件。
accel-pptpd/ctrl/l2tp/l2tp.c
浏览文件 @
43803998
...
...
@@ -99,7 +99,7 @@ static void l2tp_timeout(struct triton_timer_t *t);
static
void
l2tp_rtimeout
(
struct
triton_timer_t
*
t
);
static
void
l2tp_send_HELLO
(
struct
triton_timer_t
*
t
);
static
void
l2tp_send_SCCRP
(
struct
l2tp_conn_t
*
conn
);
static
int
l2tp_send
(
struct
l2tp_conn_t
*
conn
,
struct
l2tp_packet_t
*
pack
);
static
int
l2tp_send
(
struct
l2tp_conn_t
*
conn
,
struct
l2tp_packet_t
*
pack
,
int
log_debug
);
static
int
l2tp_conn_read
(
struct
triton_md_handler_t
*
);
static
void
l2tp_disconnect
(
struct
l2tp_conn_t
*
conn
)
...
...
@@ -173,7 +173,7 @@ static int l2tp_terminate(struct l2tp_conn_t *conn, int res, int err)
if
(
l2tp_packet_add_octets
(
pack
,
Result_Code
,
(
uint8_t
*
)
&
rc
,
sizeof
(
rc
),
0
))
goto
out_err
;
l2tp_send
(
conn
,
pack
);
l2tp_send
(
conn
,
pack
,
0
);
conn
->
state
=
STATE_FIN
;
...
...
@@ -352,7 +352,7 @@ static int l2tp_tunnel_alloc(struct l2tp_serv_t *serv, struct l2tp_packet_t *pac
if
(
conf_verbose
)
{
log_switch
(
&
conn
->
ctx
,
&
conn
->
ppp
);
log_ppp_info
(
"recv "
);
l2tp_packet_print
(
pack
);
l2tp_packet_print
(
pack
,
log_ppp_info
);
}
triton_context_call
(
&
conn
->
ctx
,
(
triton_event_func
)
l2tp_send_SCCRP
,
conn
);
...
...
@@ -438,8 +438,8 @@ static void l2tp_rtimeout(struct triton_timer_t *t)
pack
=
list_entry
(
conn
->
send_queue
.
next
,
typeof
(
*
pack
),
entry
);
pack
->
hdr
.
Nr
=
htons
(
conn
->
Nr
+
1
);
if
(
conf_verbose
)
{
log_ppp_
info
(
"send "
);
l2tp_packet_print
(
pack
);
log_ppp_
debug
(
"send "
);
l2tp_packet_print
(
pack
,
log_ppp_debug
);
}
if
(
l2tp_packet_send
(
conn
->
hnd
.
fd
,
pack
)
==
0
)
return
;
...
...
@@ -455,7 +455,7 @@ static void l2tp_timeout(struct triton_timer_t *t)
l2tp_disconnect
(
conn
);
}
static
int
l2tp_send
(
struct
l2tp_conn_t
*
conn
,
struct
l2tp_packet_t
*
pack
)
static
int
l2tp_send
(
struct
l2tp_conn_t
*
conn
,
struct
l2tp_packet_t
*
pack
,
int
log_debug
)
{
conn
->
retransmit
=
0
;
...
...
@@ -468,8 +468,13 @@ static int l2tp_send(struct l2tp_conn_t *conn, struct l2tp_packet_t *pack)
conn
->
Ns
++
;
if
(
conf_verbose
)
{
log_ppp_info
(
"send "
);
l2tp_packet_print
(
pack
);
if
(
log_debug
)
{
log_ppp_debug
(
"send "
);
l2tp_packet_print
(
pack
,
log_ppp_debug
);
}
else
{
log_ppp_info
(
"send "
);
l2tp_packet_print
(
pack
,
log_ppp_info
);
}
}
if
(
l2tp_packet_send
(
conn
->
hnd
.
fd
,
pack
))
...
...
@@ -497,7 +502,7 @@ static int l2tp_send_ZLB(struct l2tp_conn_t *conn)
if
(
!
pack
)
return
-
1
;
if
(
l2tp_send
(
conn
,
pack
))
if
(
l2tp_send
(
conn
,
pack
,
1
))
return
-
1
;
return
0
;
...
...
@@ -514,7 +519,7 @@ static void l2tp_send_HELLO(struct triton_timer_t *t)
return
;
}
if
(
l2tp_send
(
conn
,
pack
))
if
(
l2tp_send
(
conn
,
pack
,
1
))
l2tp_disconnect
(
conn
);
}
...
...
@@ -535,7 +540,7 @@ static void l2tp_send_SCCRP(struct l2tp_conn_t *conn)
if
(
l2tp_packet_add_int16
(
pack
,
Assigned_Tunnel_ID
,
conn
->
tid
,
1
))
goto
out_err
;
if
(
l2tp_send
(
conn
,
pack
))
if
(
l2tp_send
(
conn
,
pack
,
0
))
goto
out
;
if
(
!
conn
->
timeout_timer
.
tpd
)
...
...
@@ -566,7 +571,7 @@ static int l2tp_send_ICRP(struct l2tp_conn_t *conn)
if
(
l2tp_packet_add_int16
(
pack
,
Assigned_Session_ID
,
conn
->
sid
,
1
))
goto
out_err
;
l2tp_send
(
conn
,
pack
);
l2tp_send
(
conn
,
pack
,
0
);
if
(
!
conn
->
timeout_timer
.
tpd
)
triton_timer_add
(
&
conn
->
ctx
,
&
conn
->
timeout_timer
,
0
);
...
...
@@ -607,7 +612,7 @@ static int l2tp_send_OCRQ(struct l2tp_conn_t *conn)
if
(
l2tp_packet_add_string
(
pack
,
Called_Number
,
""
,
1
))
goto
out_err
;
if
(
l2tp_send
(
conn
,
pack
))
if
(
l2tp_send
(
conn
,
pack
,
0
))
return
-
1
;
if
(
!
conn
->
timeout_timer
.
tpd
)
...
...
@@ -866,11 +871,6 @@ static int l2tp_conn_read(struct triton_md_handler_t *h)
continue
;
}
if
(
conf_verbose
)
{
log_ppp_info
(
"recv "
);
l2tp_packet_print
(
pack
);
}
if
(
ntohs
(
pack
->
hdr
.
Ns
)
==
conn
->
Nr
+
1
)
{
if
(
!
list_empty
(
&
pack
->
attrs
))
conn
->
Nr
++
;
...
...
@@ -912,6 +912,16 @@ static int l2tp_conn_read(struct triton_md_handler_t *h)
goto
drop
;
}
if
(
conf_verbose
)
{
if
(
msg_type
->
val
.
uint16
==
Message_Type_Hello
)
{
log_ppp_debug
(
"recv "
);
l2tp_packet_print
(
pack
,
log_ppp_debug
);
}
else
{
log_ppp_info
(
"recv "
);
l2tp_packet_print
(
pack
,
log_ppp_info
);
}
}
switch
(
msg_type
->
val
.
uint16
)
{
case
Message_Type_Start_Ctrl_Conn_Connected
:
if
(
l2tp_recv_SCCCN
(
conn
,
pack
))
...
...
@@ -1014,7 +1024,7 @@ static int l2tp_udp_read(struct triton_md_handler_t *h)
else
{
if
(
conf_verbose
)
{
log_warn
(
"recv (unexpected) "
);
l2tp_packet_print
(
pack
);
l2tp_packet_print
(
pack
,
log_ppp_warn
);
}
}
skip:
...
...
accel-pptpd/ctrl/l2tp/l2tp.h
浏览文件 @
43803998
...
...
@@ -73,7 +73,7 @@ struct l2tp_dict_value_t *l2tp_dict_find_value(struct l2tp_dict_attr_t *attr, l2
int
l2tp_recv
(
int
fd
,
struct
l2tp_packet_t
**
);
void
l2tp_packet_free
(
struct
l2tp_packet_t
*
);
void
l2tp_packet_print
(
struct
l2tp_packet_t
*
);
void
l2tp_packet_print
(
struct
l2tp_packet_t
*
,
void
(
*
print
)(
const
char
*
fmt
,
...)
);
struct
l2tp_packet_t
*
l2tp_packet_alloc
(
int
ver
,
int
msg_type
,
struct
sockaddr_in
*
addr
);
int
l2tp_packet_send
(
int
sock
,
struct
l2tp_packet_t
*
);
int
l2tp_packet_add_int16
(
struct
l2tp_packet_t
*
pack
,
int
id
,
int16_t
val
,
int
M
);
...
...
accel-pptpd/ctrl/l2tp/packet.c
浏览文件 @
43803998
...
...
@@ -19,40 +19,41 @@ static mempool_t attr_pool;
static
mempool_t
pack_pool
;
static
mempool_t
buf_pool
;
void
l2tp_packet_print
(
struct
l2tp_packet_t
*
pack
)
void
l2tp_packet_print
(
struct
l2tp_packet_t
*
pack
,
void
(
*
print
)(
const
char
*
fmt
,
...)
)
{
struct
l2tp_attr_t
*
attr
;
struct
l2tp_dict_value_t
*
val
;
if
(
pack
->
hdr
.
ver
==
2
)
log_ppp_info
(
"[L2TP tid=%i sid=%i Ns=%i Nr=%i"
,
ntohs
(
pack
->
hdr
.
tid
),
ntohs
(
pack
->
hdr
.
sid
),
ntohs
(
pack
->
hdr
.
Ns
),
ntohs
(
pack
->
hdr
.
Nr
));
else
log_ppp_info
(
"[L2TP cid=%u Ns=%i Nr=%i"
,
pack
->
hdr
.
cid
,
pack
->
hdr
.
Ns
,
pack
->
hdr
.
Nr
);
if
(
pack
->
hdr
.
ver
==
2
)
{
print
(
"[L2TP tid=%i sid=%i"
,
ntohs
(
pack
->
hdr
.
tid
),
ntohs
(
pack
->
hdr
.
sid
));
log_ppp_debug
(
" Ns=%i Nr=%i"
,
ntohs
(
pack
->
hdr
.
Ns
),
ntohs
(
pack
->
hdr
.
Nr
));
}
else
{
print
(
"[L2TP cid=%u"
,
pack
->
hdr
.
cid
);
log_ppp_debug
(
" Ns=%i Nr=%i"
,
ntohs
(
pack
->
hdr
.
Ns
),
ntohs
(
pack
->
hdr
.
Nr
));
}
list_for_each_entry
(
attr
,
&
pack
->
attrs
,
entry
)
{
log_ppp_info
(
" <%s"
,
attr
->
attr
->
name
);
print
(
" <%s"
,
attr
->
attr
->
name
);
val
=
l2tp_dict_find_value
(
attr
->
attr
,
attr
->
val
);
if
(
val
)
log_ppp_info
(
" %s"
,
val
->
name
);
print
(
" %s"
,
val
->
name
);
else
{
switch
(
attr
->
attr
->
type
)
{
case
ATTR_TYPE_INT16
:
log_ppp_info
(
" %i"
,
attr
->
val
.
int16
);
print
(
" %i"
,
attr
->
val
.
int16
);
break
;
case
ATTR_TYPE_INT32
:
log_ppp_info
(
" %i"
,
attr
->
val
.
int32
);
print
(
" %i"
,
attr
->
val
.
int32
);
break
;
case
ATTR_TYPE_STRING
:
log_ppp_info
(
" %s"
,
attr
->
val
.
string
);
print
(
" %s"
,
attr
->
val
.
string
);
break
;
}
}
log_ppp_info
(
">"
);
print
(
">"
);
}
log_ppp_info
(
"]
\n
"
);
print
(
"]
\n
"
);
}
struct
l2tp_packet_t
*
l2tp_packet_alloc
(
int
ver
,
int
msg_type
,
struct
sockaddr_in
*
addr
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录