Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Achou.Wang
accel-ppp
提交
8aec5cc0
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 搜索 >>
提交
8aec5cc0
编写于
6月 11, 2013
作者:
D
Dmitry Kozlov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ipoe: add per-interface 'src' option (use it as source in route)
上级
88e73d66
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
24 addition
and
2 deletion
+24
-2
accel-pppd/accel-ppp.conf.5
accel-pppd/accel-ppp.conf.5
+5
-0
accel-pppd/ctrl/ipoe/ipoe.c
accel-pppd/ctrl/ipoe/ipoe.c
+18
-2
accel-pppd/ctrl/ipoe/ipoe.h
accel-pppd/ctrl/ipoe/ipoe.h
+1
-0
未找到文件。
accel-pppd/accel-ppp.conf.5
浏览文件 @
8aec5cc0
...
...
@@ -243,6 +243,7 @@ parameter.
.BI "" [,range=x.x.x.x/mask][,ifcfg=0|1]
.BI "" [,relay=x.x.x.x]
.BI "" [,giaddr=x.x.x.x]
.BI "" [,src=x.x.x.x]
.br
Specifies interface to listen dhcp or unclassified packets. You may specify multiple
.B interface
...
...
@@ -289,6 +290,10 @@ is also needed.
The
.B giaddr
parameter specifies relay agent IP address.
.br
The
.B src
parameter specifies ip address to use as source when adding route to client.
.TP
.BI "local-net=" x.x.x.x/mask
Specifies networks from which packets will be treated as unclassified. You may specify multiple local-net options.
...
...
accel-pppd/ctrl/ipoe/ipoe.c
浏览文件 @
8aec5cc0
...
...
@@ -50,6 +50,8 @@ static int conf_mode = 0;
static
int
conf_shared
=
1
;
static
int
conf_ifcfg
=
1
;
static
int
conf_nat
=
0
;
static
uint32_t
conf_src
;
//static int conf_dhcpv6;
static
int
conf_username
;
static
int
conf_unit_cache
;
...
...
@@ -516,6 +518,9 @@ static void __ipoe_session_start(struct ipoe_session *ses)
if
(
!
ses
->
siaddr
&&
ses
->
router
!=
ses
->
yiaddr
)
ses
->
siaddr
=
ses
->
router
;
if
(
!
ses
->
siaddr
)
ses
->
siaddr
=
ses
->
serv
->
opt_src
;
if
(
!
ses
->
siaddr
&&
ses
->
serv
->
dhcpv4_relay
)
ses
->
siaddr
=
ses
->
serv
->
dhcpv4_relay
->
giaddr
;
...
...
@@ -600,9 +605,9 @@ static void ipoe_ifcfg_add(struct ipoe_session *ses)
log_ppp_warn
(
"ipoe: failed to add addess to interface '%s'
\n
"
,
serv
->
ifname
);
pthread_mutex_unlock
(
&
serv
->
lock
);
}
if
(
iproute_add
(
serv
->
ifindex
,
ses
->
s
iadd
r
,
ses
->
yiaddr
))
if
(
iproute_add
(
serv
->
ifindex
,
ses
->
s
erv
->
opt_src
?
ses
->
serv
->
opt_src
:
ses
->
route
r
,
ses
->
yiaddr
))
log_ppp_warn
(
"ipoe: failed to add route to interface '%s'
\n
"
,
serv
->
ifname
);
}
else
if
(
iproute_add
(
serv
->
ifindex
,
ses
->
s
iadd
r
,
ses
->
yiaddr
))
}
else
if
(
iproute_add
(
serv
->
ifindex
,
ses
->
s
erv
->
opt_src
?
ses
->
serv
->
opt_src
:
ses
->
route
r
,
ses
->
yiaddr
))
log_ppp_warn
(
"ipoe: failed to add route to interface '%s'
\n
"
,
serv
->
ifname
);
ses
->
ifcfg
=
1
;
...
...
@@ -1545,6 +1550,7 @@ static void add_interface(const char *ifname, int ifindex, const char *opt)
const
char
*
opt_giaddr
=
NULL
;
in_addr_t
relay_addr
=
0
;
in_addr_t
giaddr
=
0
;
in_addr_t
opt_src
=
conf_src
;
str0
=
strchr
(
opt
,
','
);
if
(
str0
)
{
...
...
@@ -1595,6 +1601,8 @@ static void add_interface(const char *ifname, int ifindex, const char *opt)
giaddr
=
inet_addr
(
ptr1
);
}
else
if
(
strcmp
(
str
,
"nat"
)
==
0
)
{
opt_nat
=
atoi
(
ptr1
);
}
else
if
(
strcmp
(
str
,
"src"
)
==
0
)
{
opt_src
=
inet_addr
(
ptr1
);
}
if
(
end
)
...
...
@@ -1651,6 +1659,7 @@ static void add_interface(const char *ifname, int ifindex, const char *opt)
serv
->
opt_mode
=
opt_mode
;
serv
->
opt_ifcfg
=
opt_ifcfg
;
serv
->
opt_nat
=
opt_nat
;
serv
->
opt_src
=
opt_src
;
if
(
str0
)
_free
(
str0
);
...
...
@@ -1669,6 +1678,7 @@ static void add_interface(const char *ifname, int ifindex, const char *opt)
serv
->
opt_mode
=
opt_mode
;
serv
->
opt_ifcfg
=
opt_ifcfg
;
serv
->
opt_nat
=
opt_nat
;
serv
->
opt_src
=
opt_src
;
serv
->
active
=
1
;
INIT_LIST_HEAD
(
&
serv
->
sessions
);
INIT_LIST_HEAD
(
&
serv
->
addr_list
);
...
...
@@ -1979,6 +1989,12 @@ static void load_config(void)
conf_nat
=
atoi
(
opt
);
else
conf_nat
=
0
;
opt
=
conf_get_opt
(
"ipoe"
,
"src"
);
if
(
opt
)
conf_src
=
inet_addr
(
opt
);
else
conf_src
=
0
;
opt
=
conf_get_opt
(
"ipoe"
,
"mode"
);
if
(
opt
)
{
...
...
accel-pppd/ctrl/ipoe/ipoe.h
浏览文件 @
8aec5cc0
...
...
@@ -22,6 +22,7 @@ struct ipoe_serv
struct
dhcpv4_relay
*
dhcpv4_relay
;
pthread_mutex_t
lock
;
int
opt_mode
;
uint32_t
opt_src
;
int
opt_shared
:
1
;
int
opt_dhcpv4
:
1
;
int
opt_up
:
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录