Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Achou.Wang
accel-ppp
提交
4e7ed294
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 搜索 >>
提交
4e7ed294
编写于
1月 25, 2013
作者:
K
Kozlov Dmitry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ipoe: insert option 82 to relay request
上级
e5e85219
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
38 addition
and
0 deletion
+38
-0
accel-pppd/ctrl/ipoe/dhcpv4.c
accel-pppd/ctrl/ipoe/dhcpv4.c
+25
-0
accel-pppd/ctrl/ipoe/dhcpv4.h
accel-pppd/ctrl/ipoe/dhcpv4.h
+1
-0
accel-pppd/ctrl/ipoe/ipoe.c
accel-pppd/ctrl/ipoe/ipoe.c
+12
-0
未找到文件。
accel-pppd/ctrl/ipoe/dhcpv4.c
浏览文件 @
4e7ed294
...
...
@@ -44,6 +44,7 @@ static mempool_t opt_pool;
static
LIST_HEAD
(
relay_list
);
static
int
dhcpv4_read
(
struct
triton_md_handler_t
*
h
);
int
dhcpv4_packet_add_opt
(
struct
dhcpv4_packet
*
pack
,
int
type
,
const
void
*
data
,
int
len
);
static
struct
dhcpv4_iprange
*
parse_range
(
const
char
*
str
)
{
...
...
@@ -433,6 +434,27 @@ int dhcpv4_parse_opt82(struct dhcpv4_option *opt, uint8_t **agent_circuit_id, ui
return
0
;
}
int
dhcpv4_packet_insert_opt82
(
struct
dhcpv4_packet
*
pack
,
const
char
*
agent_circuit_id
,
const
char
*
agent_remote_id
)
{
int
len1
=
strlen
(
agent_circuit_id
);
int
len2
=
strlen
(
agent_remote_id
);
uint8_t
*
data
=
_malloc
(
4
+
len1
+
len2
);
uint8_t
*
ptr
=
data
;
int
r
;
*
ptr
++
=
1
;
*
ptr
++
=
len1
;
memcpy
(
ptr
,
agent_circuit_id
,
len1
);
ptr
+=
len1
;
*
ptr
++
=
2
;
*
ptr
++
=
len2
;
memcpy
(
ptr
,
agent_remote_id
,
len2
);
ptr
+=
len2
;
r
=
dhcpv4_packet_add_opt
(
pack
,
82
,
data
,
4
+
len1
+
len2
);
_free
(
data
);
return
r
;
}
static
int
dhcpv4_read
(
struct
triton_md_handler_t
*
h
)
{
...
...
@@ -629,6 +651,9 @@ int dhcpv4_packet_add_opt(struct dhcpv4_packet *pack, int type, const void *data
list_add_tail
(
&
opt
->
entry
,
&
pack
->
options
);
if
(
type
==
82
)
pack
->
relay_agent
=
opt
;
return
0
;
}
...
...
accel-pppd/ctrl/ipoe/dhcpv4.h
浏览文件 @
4e7ed294
...
...
@@ -114,6 +114,7 @@ int dhcpv4_send_nak(struct dhcpv4_serv *serv, struct dhcpv4_packet *req);
void
dhcpv4_packet_ref
(
struct
dhcpv4_packet
*
pack
);
struct
dhcpv4_option
*
dhcpv4_packet_find_opt
(
struct
dhcpv4_packet
*
pack
,
int
type
);
int
dhcpv4_packet_insert_opt82
(
struct
dhcpv4_packet
*
pack
,
const
char
*
agent_circuit_id
,
const
char
*
agent_remote_id
);
void
dhcpv4_packet_free
(
struct
dhcpv4_packet
*
pack
);
int
dhcpv4_check_options
(
struct
dhcpv4_packet
*
);
...
...
accel-pppd/ctrl/ipoe/ipoe.c
浏览文件 @
4e7ed294
...
...
@@ -72,6 +72,7 @@ static int conf_netmask = 24;
static
int
conf_lease_time
=
600
;
static
int
conf_lease_timeout
=
660
;
static
int
conf_verbose
;
static
const
char
*
conf_agent_remote_id
;
static
unsigned
int
stat_starting
;
static
unsigned
int
stat_active
;
...
...
@@ -400,6 +401,11 @@ static void ipoe_session_start(struct ipoe_session *ses)
}
if
(
ses
->
dhcpv4_request
&&
ses
->
serv
->
dhcpv4_relay
)
{
if
(
!
ses
->
dhcpv4_request
->
relay_agent
&&
dhcpv4_packet_insert_opt82
(
ses
->
dhcpv4_request
,
ses
->
serv
->
ifname
,
conf_agent_remote_id
))
{
ap_session_terminate
(
&
ses
->
ses
,
TERM_NAS_ERROR
,
0
);
return
;
}
dhcpv4_relay_send
(
ses
->
serv
->
dhcpv4_relay
,
ses
->
dhcpv4_request
,
ses
->
relay_server_id
);
ses
->
timer
.
expire
=
ipoe_session_timeout
;
...
...
@@ -1695,6 +1701,12 @@ static void load_config(void)
conf_mode
=
MODE_L2
;
conf_relay
=
conf_get_opt
(
"ipoe"
,
"relay"
);
opt
=
conf_get_opt
(
"ipoe"
,
"agent-remote-id"
);
if
(
opt
)
conf_agent_remote_id
=
opt
;
else
conf_agent_remote_id
=
"accel-pppd"
;
conf_dhcpv4
=
0
;
conf_up
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录