Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
e2d57766
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e2d57766
编写于
2月 03, 2011
作者:
D
David S. Miller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
net: Provide compat support for SIOCGETMIFCNT_IN6 and SIOCGETSGCNT_IN6.
Signed-off-by:
N
David S. Miller
<
davem@davemloft.net
>
上级
ca6b8bb0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
95 addition
and
0 deletion
+95
-0
include/linux/mroute6.h
include/linux/mroute6.h
+1
-0
net/ipv6/ip6mr.c
net/ipv6/ip6mr.c
+75
-0
net/ipv6/raw.c
net/ipv6/raw.c
+19
-0
未找到文件。
include/linux/mroute6.h
浏览文件 @
e2d57766
...
...
@@ -136,6 +136,7 @@ extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, unsigned int
extern
int
ip6_mroute_getsockopt
(
struct
sock
*
,
int
,
char
__user
*
,
int
__user
*
);
extern
int
ip6_mr_input
(
struct
sk_buff
*
skb
);
extern
int
ip6mr_ioctl
(
struct
sock
*
sk
,
int
cmd
,
void
__user
*
arg
);
extern
int
ip6mr_compat_ioctl
(
struct
sock
*
sk
,
unsigned
int
cmd
,
void
__user
*
arg
);
extern
int
ip6_mr_init
(
void
);
extern
void
ip6_mr_cleanup
(
void
);
#else
...
...
net/ipv6/ip6mr.c
浏览文件 @
e2d57766
...
...
@@ -34,6 +34,7 @@
#include <linux/seq_file.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/compat.h>
#include <net/protocol.h>
#include <linux/skbuff.h>
#include <net/sock.h>
...
...
@@ -1804,6 +1805,80 @@ int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg)
}
}
#ifdef CONFIG_COMPAT
struct
compat_sioc_sg_req6
{
struct
sockaddr_in6
src
;
struct
sockaddr_in6
grp
;
compat_ulong_t
pktcnt
;
compat_ulong_t
bytecnt
;
compat_ulong_t
wrong_if
;
};
struct
compat_sioc_mif_req6
{
mifi_t
mifi
;
compat_ulong_t
icount
;
compat_ulong_t
ocount
;
compat_ulong_t
ibytes
;
compat_ulong_t
obytes
;
};
int
ip6mr_compat_ioctl
(
struct
sock
*
sk
,
unsigned
int
cmd
,
void
__user
*
arg
)
{
struct
compat_sioc_sg_req6
sr
;
struct
compat_sioc_mif_req6
vr
;
struct
mif_device
*
vif
;
struct
mfc6_cache
*
c
;
struct
net
*
net
=
sock_net
(
sk
);
struct
mr6_table
*
mrt
;
mrt
=
ip6mr_get_table
(
net
,
raw6_sk
(
sk
)
->
ip6mr_table
?
:
RT6_TABLE_DFLT
);
if
(
mrt
==
NULL
)
return
-
ENOENT
;
switch
(
cmd
)
{
case
SIOCGETMIFCNT_IN6
:
if
(
copy_from_user
(
&
vr
,
arg
,
sizeof
(
vr
)))
return
-
EFAULT
;
if
(
vr
.
mifi
>=
mrt
->
maxvif
)
return
-
EINVAL
;
read_lock
(
&
mrt_lock
);
vif
=
&
mrt
->
vif6_table
[
vr
.
mifi
];
if
(
MIF_EXISTS
(
mrt
,
vr
.
mifi
))
{
vr
.
icount
=
vif
->
pkt_in
;
vr
.
ocount
=
vif
->
pkt_out
;
vr
.
ibytes
=
vif
->
bytes_in
;
vr
.
obytes
=
vif
->
bytes_out
;
read_unlock
(
&
mrt_lock
);
if
(
copy_to_user
(
arg
,
&
vr
,
sizeof
(
vr
)))
return
-
EFAULT
;
return
0
;
}
read_unlock
(
&
mrt_lock
);
return
-
EADDRNOTAVAIL
;
case
SIOCGETSGCNT_IN6
:
if
(
copy_from_user
(
&
sr
,
arg
,
sizeof
(
sr
)))
return
-
EFAULT
;
read_lock
(
&
mrt_lock
);
c
=
ip6mr_cache_find
(
mrt
,
&
sr
.
src
.
sin6_addr
,
&
sr
.
grp
.
sin6_addr
);
if
(
c
)
{
sr
.
pktcnt
=
c
->
mfc_un
.
res
.
pkt
;
sr
.
bytecnt
=
c
->
mfc_un
.
res
.
bytes
;
sr
.
wrong_if
=
c
->
mfc_un
.
res
.
wrong_if
;
read_unlock
(
&
mrt_lock
);
if
(
copy_to_user
(
arg
,
&
sr
,
sizeof
(
sr
)))
return
-
EFAULT
;
return
0
;
}
read_unlock
(
&
mrt_lock
);
return
-
EADDRNOTAVAIL
;
default:
return
-
ENOIOCTLCMD
;
}
}
#endif
static
inline
int
ip6mr_forward2_finish
(
struct
sk_buff
*
skb
)
{
...
...
net/ipv6/raw.c
浏览文件 @
e2d57766
...
...
@@ -31,6 +31,7 @@
#include <linux/netfilter.h>
#include <linux/netfilter_ipv6.h>
#include <linux/skbuff.h>
#include <linux/compat.h>
#include <asm/uaccess.h>
#include <asm/ioctls.h>
...
...
@@ -1157,6 +1158,23 @@ static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg)
}
}
#ifdef CONFIG_COMPAT
static
int
compat_rawv6_ioctl
(
struct
sock
*
sk
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
switch
(
cmd
)
{
case
SIOCOUTQ
:
case
SIOCINQ
:
return
-
ENOIOCTLCMD
;
default:
#ifdef CONFIG_IPV6_MROUTE
return
ip6mr_compat_ioctl
(
sk
,
cmd
,
compat_ptr
(
arg
));
#else
return
-
ENOIOCTLCMD
;
#endif
}
}
#endif
static
void
rawv6_close
(
struct
sock
*
sk
,
long
timeout
)
{
if
(
inet_sk
(
sk
)
->
inet_num
==
IPPROTO_RAW
)
...
...
@@ -1215,6 +1233,7 @@ struct proto rawv6_prot = {
#ifdef CONFIG_COMPAT
.
compat_setsockopt
=
compat_rawv6_setsockopt
,
.
compat_getsockopt
=
compat_rawv6_getsockopt
,
.
compat_ioctl
=
compat_rawv6_ioctl
,
#endif
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录