Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Achou.Wang
accel-ppp
提交
5cd2744f
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 搜索 >>
提交
5cd2744f
编写于
11月 20, 2015
作者:
D
Dmitry Kozlov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ipoe: implemented interface renaming by NAS-Port-Id
上级
2f072eba
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
49 addition
and
17 deletion
+49
-17
accel-pppd/ctrl/ipoe/ipoe.c
accel-pppd/ctrl/ipoe/ipoe.c
+26
-12
accel-pppd/ifcfg.c
accel-pppd/ifcfg.c
+23
-5
未找到文件。
accel-pppd/ctrl/ipoe/ipoe.c
浏览文件 @
5cd2744f
...
...
@@ -576,15 +576,12 @@ cont:
if
(
ses
->
serv
->
opt_nat
)
ses
->
ses
.
ipv4
=
ipdb_get_ipv4
(
&
ses
->
ses
);
if
(
ses
->
serv
->
opt_shared
==
0
&&
(
!
ses
->
ses
.
ipv4
||
ses
->
ses
.
ipv4
->
peer_addr
==
ses
->
yiaddr
))
{
strncpy
(
ses
->
ses
.
ifname
,
ses
->
serv
->
ifname
,
AP_IFNAME_LEN
);
ses
->
ses
.
ifindex
=
ses
->
serv
->
ifindex
;
}
else
if
(
ses
->
ifindex
==
-
1
)
{
if
(
ses
->
serv
->
opt_shared
==
0
&&
ses
->
ses
.
ipv4
&&
ses
->
ses
.
ipv4
->
peer_addr
!=
ses
->
yiaddr
)
{
if
(
ipoe_create_interface
(
ses
))
return
;
}
ap_session_set_ifindex
(
&
ses
->
ses
);
ap_session_set_ifindex
(
&
ses
->
ses
);
}
if
(
ses
->
dhcpv4_request
&&
ses
->
serv
->
dhcpv4_relay
)
{
dhcpv4_relay_send
(
ses
->
serv
->
dhcpv4_relay
,
ses
->
dhcpv4_request
,
ses
->
relay_server_id
,
ses
->
serv
->
ifname
,
conf_agent_remote_id
);
...
...
@@ -1092,12 +1089,6 @@ static void ipoe_session_finished(struct ap_session *s)
log_ppp_info1
(
"ipoe: session finished
\n
"
);
pthread_mutex_lock
(
&
ses
->
serv
->
lock
);
list_del
(
&
ses
->
entry
);
if
((
ses
->
serv
->
vid
||
ses
->
serv
->
need_close
)
&&
list_empty
(
&
ses
->
serv
->
sessions
))
triton_context_call
(
&
ses
->
serv
->
ctx
,
(
triton_event_func
)
ipoe_serv_release
,
ses
->
serv
);
pthread_mutex_unlock
(
&
ses
->
serv
->
lock
);
if
(
ses
->
ifindex
!=
-
1
)
{
if
(
uc_size
<
conf_unit_cache
&&
ipoe_nl_modify
(
ses
->
ifindex
,
0
,
0
,
""
,
NULL
))
{
uc
=
mempool_alloc
(
uc_pool
);
...
...
@@ -1125,6 +1116,29 @@ static void ipoe_session_finished(struct ap_session *s)
triton_event_fire
(
EV_CTRL_FINISHED
,
s
);
if
(
s
->
ifindex
==
ses
->
serv
->
ifindex
&&
strcmp
(
s
->
ifname
,
ses
->
serv
->
ifname
))
{
struct
ifreq
ifr
;
strcpy
(
ifr
.
ifr_name
,
s
->
ifname
);
ioctl
(
sock_fd
,
SIOCGIFFLAGS
,
&
ifr
);
ifr
.
ifr_flags
&=
~
IFF_UP
;
ioctl
(
sock_fd
,
SIOCSIFFLAGS
,
&
ifr
);
strcpy
(
ifr
.
ifr_newname
,
ses
->
serv
->
ifname
);
ioctl
(
sock_fd
,
SIOCSIFNAME
,
&
ifr
);
strcpy
(
ifr
.
ifr_name
,
ses
->
serv
->
ifname
);
ifr
.
ifr_flags
|=
IFF_UP
;
ioctl
(
sock_fd
,
SIOCSIFFLAGS
,
&
ifr
);
}
pthread_mutex_lock
(
&
ses
->
serv
->
lock
);
list_del
(
&
ses
->
entry
);
if
((
ses
->
serv
->
vid
||
ses
->
serv
->
need_close
)
&&
list_empty
(
&
ses
->
serv
->
sessions
))
triton_context_call
(
&
ses
->
serv
->
ctx
,
(
triton_event_func
)
ipoe_serv_release
,
ses
->
serv
);
pthread_mutex_unlock
(
&
ses
->
serv
->
lock
);
triton_context_call
(
&
ses
->
ctx
,
(
triton_event_func
)
ipoe_session_free
,
ses
);
}
...
...
accel-pppd/ifcfg.c
浏览文件 @
5cd2744f
...
...
@@ -261,6 +261,7 @@ void __export ap_session_ifdown(struct ap_session *ses)
int
__export
ap_session_rename
(
struct
ap_session
*
ses
,
const
char
*
ifname
,
int
len
)
{
struct
ifreq
ifr
;
int
r
,
up
=
0
;
if
(
len
==
-
1
)
len
=
strlen
(
ifname
);
...
...
@@ -274,19 +275,36 @@ int __export ap_session_rename(struct ap_session *ses, const char *ifname, int l
memcpy
(
ifr
.
ifr_newname
,
ifname
,
len
);
ifr
.
ifr_newname
[
len
]
=
0
;
if
(
ioctl
(
sock_fd
,
SIOCSIFNAME
,
&
ifr
))
{
r
=
ioctl
(
sock_fd
,
SIOCSIFNAME
,
&
ifr
);
if
(
r
&&
errno
==
EBUSY
)
{
ioctl
(
sock_fd
,
SIOCGIFFLAGS
,
&
ifr
);
ifr
.
ifr_flags
&=
~
IFF_UP
;
ioctl
(
sock_fd
,
SIOCSIFFLAGS
,
&
ifr
);
memcpy
(
ifr
.
ifr_newname
,
ifname
,
len
);
ifr
.
ifr_newname
[
len
]
=
0
;
r
=
ioctl
(
sock_fd
,
SIOCSIFNAME
,
&
ifr
);
up
=
1
;
}
if
(
r
)
{
if
(
!
ses
->
ifname_rename
)
ses
->
ifname_rename
=
_strdup
(
ifr
.
ifr_newname
);
else
{
else
log_ppp_warn
(
"interface rename failed: %s
\n
"
,
strerror
(
errno
));
return
-
1
;
}
}
else
{
log_ppp_info2
(
"rename interface to '%s'
\n
"
,
ifr
.
ifr_newname
);
memcpy
(
ses
->
ifname
,
ifname
,
len
);
ses
->
ifname
[
len
]
=
0
;
}
return
0
;
if
(
up
)
{
strcpy
(
ifr
.
ifr_name
,
ses
->
ifname
);
ifr
.
ifr_flags
|=
IFF_UP
;
ioctl
(
sock_fd
,
SIOCSIFFLAGS
,
&
ifr
);
}
return
r
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录