Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Achou.Wang
accel-ppp
提交
decb3de4
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 搜索 >>
提交
decb3de4
编写于
11月 18, 2015
作者:
D
Dmitry Kozlov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ipoe: for vlan name pattern implemented %P argument - VID of parent interface
上级
1e505332
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
73 addition
and
5 deletion
+73
-5
accel-pppd/accel-ppp.conf.5
accel-pppd/accel-ppp.conf.5
+3
-0
accel-pppd/ctrl/ipoe/ipoe.c
accel-pppd/ctrl/ipoe/ipoe.c
+14
-5
accel-pppd/ctrl/ipoe/ipoe.h
accel-pppd/ctrl/ipoe/ipoe.h
+1
-0
accel-pppd/libnetlink/iputils.c
accel-pppd/libnetlink/iputils.c
+54
-0
accel-pppd/libnetlink/iputils.h
accel-pppd/libnetlink/iputils.h
+1
-0
未找到文件。
accel-pppd/accel-ppp.conf.5
浏览文件 @
decb3de4
...
...
@@ -386,6 +386,9 @@ Specifies pattern of vlan interface name. Pattern may contain following macros:
.B %N
- number of vlan.
.br
.B %P
- number of vlan of parent interface.
.br
By default vlan-name=%I.%N.
.TP
.BI "soft-terminate=" 0|1
...
...
accel-pppd/ctrl/ipoe/ipoe.c
浏览文件 @
decb3de4
...
...
@@ -2205,13 +2205,14 @@ static int get_offer_delay()
return
0
;
}
static
int
make_vlan_name
(
const
char
*
parent
,
int
vid
,
char
*
name
)
static
int
make_vlan_name
(
const
char
*
parent
,
int
svid
,
int
c
vid
,
char
*
name
)
{
char
*
ptr1
=
name
,
*
endptr
=
name
+
IFNAMSIZ
;
const
char
*
ptr2
=
conf_vlan_name
;
char
num
[
5
],
*
ptr3
=
num
;
char
svid_str
[
5
],
cvid_str
[
5
],
*
ptr3
;
sprintf
(
num
,
"%i"
,
vid
);
sprintf
(
svid_str
,
"%i"
,
svid
);
sprintf
(
cvid_str
,
"%i"
,
cvid
);
while
(
ptr1
<
endptr
&&
*
ptr2
)
{
if
(
ptr2
[
0
]
==
'%'
&&
ptr2
[
1
]
==
'I'
)
{
...
...
@@ -2219,6 +2220,12 @@ static int make_vlan_name(const char *parent, int vid, char *name)
*
ptr1
++
=
*
parent
++
;
ptr2
+=
2
;
}
else
if
(
ptr2
[
0
]
==
'%'
&&
ptr2
[
1
]
==
'N'
)
{
ptr3
=
cvid_str
;
while
(
ptr1
<
endptr
&&
*
ptr3
)
*
ptr1
++
=
*
ptr3
++
;
ptr2
+=
2
;
}
else
if
(
ptr2
[
0
]
==
'%'
&&
ptr2
[
1
]
==
'P'
)
{
ptr3
=
svid_str
;
while
(
ptr1
<
endptr
&&
*
ptr3
)
*
ptr1
++
=
*
ptr3
++
;
ptr2
+=
2
;
...
...
@@ -2240,7 +2247,7 @@ void ipoe_vlan_notify(int ifindex, int vid)
struct
conf_option_t
*
opt
;
struct
ifreq
ifr
;
char
*
ptr
;
int
len
,
r
;
int
len
,
r
,
svid
;
pcre
*
re
=
NULL
;
const
char
*
pcre_err
;
char
*
pattern
;
...
...
@@ -2257,7 +2264,9 @@ void ipoe_vlan_notify(int ifindex, int vid)
return
;
}
if
(
make_vlan_name
(
ifr
.
ifr_name
,
vid
,
ifname
))
{
svid
=
iplink_vlan_get_vid
(
ifindex
);
if
(
make_vlan_name
(
ifr
.
ifr_name
,
svid
,
vid
,
ifname
))
{
log_error
(
"ipoe: vlan-mon: %s.%i: interface name is too long
\n
"
,
ifr
.
ifr_name
,
vid
);
return
;
}
...
...
accel-pppd/ctrl/ipoe/ipoe.h
浏览文件 @
decb3de4
...
...
@@ -35,6 +35,7 @@ struct ipoe_serv {
pthread_mutex_t
lock
;
int
parent_ifindex
;
int
vid
;
int
parent_vid
;
int
opt_mode
;
uint32_t
opt_src
;
int
opt_arp
;
...
...
accel-pppd/libnetlink/iputils.c
浏览文件 @
decb3de4
...
...
@@ -243,6 +243,60 @@ int __export iplink_vlan_del(int ifindex)
return
0
;
}
int
__export
iplink_vlan_get_vid
(
int
ifindex
)
{
struct
iplink_req
{
struct
nlmsghdr
n
;
struct
ifinfomsg
i
;
char
buf
[
4096
];
}
req
;
struct
ifinfomsg
*
ifi
;
int
len
;
struct
rtattr
*
tb
[
IFLA_MAX
+
1
];
if
(
!
rth
)
open_rth
();
if
(
!
rth
)
return
-
1
;
memset
(
&
req
,
0
,
sizeof
(
req
)
-
4096
);
req
.
n
.
nlmsg_len
=
NLMSG_LENGTH
(
sizeof
(
struct
ifinfomsg
));
req
.
n
.
nlmsg_flags
=
NLM_F_REQUEST
|
NLM_F_ACK
;
req
.
n
.
nlmsg_type
=
RTM_GETLINK
;
req
.
i
.
ifi_family
=
AF_PACKET
;
req
.
i
.
ifi_index
=
ifindex
;
if
(
rtnl_talk
(
rth
,
&
req
.
n
,
0
,
0
,
&
req
.
n
,
NULL
,
NULL
,
0
)
<
0
)
return
-
1
;
if
(
req
.
n
.
nlmsg_type
!=
RTM_NEWLINK
)
return
-
1
;
ifi
=
NLMSG_DATA
(
&
req
.
n
);
len
=
req
.
n
.
nlmsg_len
;
len
-=
NLMSG_LENGTH
(
sizeof
(
*
ifi
));
if
(
len
<
0
)
return
-
1
;
parse_rtattr
(
tb
,
IFLA_MAX
,
IFLA_RTA
(
ifi
),
len
);
if
(
!
tb
[
IFLA_LINKINFO
])
return
0
;
parse_rtattr_nested
(
tb
,
IFLA_MAX
,
tb
[
IFLA_LINKINFO
]);
if
(
strcmp
(
RTA_DATA
(
tb
[
IFLA_INFO_KIND
]),
"vlan"
))
return
0
;
parse_rtattr_nested
(
tb
,
IFLA_MAX
,
tb
[
IFLA_INFO_DATA
]);
return
*
(
uint16_t
*
)
RTA_DATA
(
tb
[
IFLA_VLAN_ID
]);
}
int
__export
ipaddr_add
(
int
ifindex
,
in_addr_t
addr
,
int
mask
)
{
struct
ipaddr_req
{
...
...
accel-pppd/libnetlink/iputils.h
浏览文件 @
decb3de4
...
...
@@ -10,6 +10,7 @@ int iplink_get_stats(int ifindex, struct rtnl_link_stats *stats);
int
iplink_vlan_add
(
const
char
*
ifname
,
int
ifindex
,
int
vid
);
int
iplink_vlan_del
(
int
ifindex
);
int
iplink_vlan_get_vid
(
int
ifindex
);
int
ipaddr_add
(
int
ifindex
,
in_addr_t
addr
,
int
mask
);
int
ipaddr_del
(
int
ifindex
,
in_addr_t
addr
,
int
mask
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录