Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
e2d57766
Commit
e2d57766
authored
Feb 03, 2011
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: Provide compat support for SIOCGETMIFCNT_IN6 and SIOCGETSGCNT_IN6.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
ca6b8bb0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
0 deletions
+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
No files found.
include/linux/mroute6.h
View file @
e2d57766
...
@@ -136,6 +136,7 @@ extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, unsigned int
...
@@ -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_mroute_getsockopt
(
struct
sock
*
,
int
,
char
__user
*
,
int
__user
*
);
extern
int
ip6_mr_input
(
struct
sk_buff
*
skb
);
extern
int
ip6_mr_input
(
struct
sk_buff
*
skb
);
extern
int
ip6mr_ioctl
(
struct
sock
*
sk
,
int
cmd
,
void
__user
*
arg
);
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
int
ip6_mr_init
(
void
);
extern
void
ip6_mr_cleanup
(
void
);
extern
void
ip6_mr_cleanup
(
void
);
#else
#else
...
...
net/ipv6/ip6mr.c
View file @
e2d57766
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
#include <linux/seq_file.h>
#include <linux/seq_file.h>
#include <linux/init.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/compat.h>
#include <net/protocol.h>
#include <net/protocol.h>
#include <linux/skbuff.h>
#include <linux/skbuff.h>
#include <net/sock.h>
#include <net/sock.h>
...
@@ -1804,6 +1805,80 @@ int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg)
...
@@ -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
)
static
inline
int
ip6mr_forward2_finish
(
struct
sk_buff
*
skb
)
{
{
...
...
net/ipv6/raw.c
View file @
e2d57766
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include <linux/netfilter.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv6.h>
#include <linux/netfilter_ipv6.h>
#include <linux/skbuff.h>
#include <linux/skbuff.h>
#include <linux/compat.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/ioctls.h>
#include <asm/ioctls.h>
...
@@ -1157,6 +1158,23 @@ static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg)
...
@@ -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
)
static
void
rawv6_close
(
struct
sock
*
sk
,
long
timeout
)
{
{
if
(
inet_sk
(
sk
)
->
inet_num
==
IPPROTO_RAW
)
if
(
inet_sk
(
sk
)
->
inet_num
==
IPPROTO_RAW
)
...
@@ -1215,6 +1233,7 @@ struct proto rawv6_prot = {
...
@@ -1215,6 +1233,7 @@ struct proto rawv6_prot = {
#ifdef CONFIG_COMPAT
#ifdef CONFIG_COMPAT
.
compat_setsockopt
=
compat_rawv6_setsockopt
,
.
compat_setsockopt
=
compat_rawv6_setsockopt
,
.
compat_getsockopt
=
compat_rawv6_getsockopt
,
.
compat_getsockopt
=
compat_rawv6_getsockopt
,
.
compat_ioctl
=
compat_rawv6_ioctl
,
#endif
#endif
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment