diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2011-01-29 11:15:56 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-30 04:14:38 -0500 |
commit | 709b46e8d90badda1898caea50483c12af178e96 (patch) | |
tree | 799b57704dda3684777fb57a6e413dabac78858c /net/ipv4/raw.c | |
parent | 13ad17745c2cbd437d9e24b2d97393e0be11c439 (diff) |
net: Add compat ioctl support for the ipv4 multicast ioctl SIOCGETSGCNT
SIOCGETSGCNT is not a unique ioctl value as it it maps tio SIOCPROTOPRIVATE +1,
which unfortunately means the existing infrastructure for compat networking
ioctls is insufficient. A trivial compact ioctl implementation would conflict
with:
SIOCAX25ADDUID
SIOCAIPXPRISLT
SIOCGETSGCNT_IN6
SIOCGETSGCNT
SIOCRSSCAUSE
SIOCX25SSUBSCRIP
SIOCX25SDTEFACILITIES
To make this work I have updated the compat_ioctl decode path to mirror the
the normal ioctl decode path. I have added an ipv4 inet_compat_ioctl function
so that I can have ipv4 specific compat ioctls. I have added a compat_ioctl
function into struct proto so I can break out ioctls by which kind of ip socket
I am using. I have added a compat_raw_ioctl function because SIOCGETSGCNT only
works on raw sockets. I have added a ipmr_compat_ioctl that mirrors the normal
ipmr_ioctl.
This was necessary because unfortunately the struct layout for the SIOCGETSGCNT
has unsigned longs in it so changes between 32bit and 64bit kernels.
This change was sufficient to run a 32bit ip multicast routing daemon on a
64bit kernel.
Reported-by: Bill Fenner <fenner@aristanetworks.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/raw.c')
-rw-r--r-- | net/ipv4/raw.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index a3d5ab786e81..6390ba299b3d 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -76,6 +76,7 @@ | |||
76 | #include <linux/seq_file.h> | 76 | #include <linux/seq_file.h> |
77 | #include <linux/netfilter.h> | 77 | #include <linux/netfilter.h> |
78 | #include <linux/netfilter_ipv4.h> | 78 | #include <linux/netfilter_ipv4.h> |
79 | #include <linux/compat.h> | ||
79 | 80 | ||
80 | static struct raw_hashinfo raw_v4_hashinfo = { | 81 | static struct raw_hashinfo raw_v4_hashinfo = { |
81 | .lock = __RW_LOCK_UNLOCKED(raw_v4_hashinfo.lock), | 82 | .lock = __RW_LOCK_UNLOCKED(raw_v4_hashinfo.lock), |
@@ -838,6 +839,23 @@ static int raw_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
838 | } | 839 | } |
839 | } | 840 | } |
840 | 841 | ||
842 | #ifdef CONFIG_COMPAT | ||
843 | static int compat_raw_ioctl(struct sock *sk, unsigned int cmd, unsigned long arg) | ||
844 | { | ||
845 | switch (cmd) { | ||
846 | case SIOCOUTQ: | ||
847 | case SIOCINQ: | ||
848 | return -ENOIOCTLCMD; | ||
849 | default: | ||
850 | #ifdef CONFIG_IP_MROUTE | ||
851 | return ipmr_compat_ioctl(sk, cmd, compat_ptr(arg)); | ||
852 | #else | ||
853 | return -ENOIOCTLCMD; | ||
854 | #endif | ||
855 | } | ||
856 | } | ||
857 | #endif | ||
858 | |||
841 | struct proto raw_prot = { | 859 | struct proto raw_prot = { |
842 | .name = "RAW", | 860 | .name = "RAW", |
843 | .owner = THIS_MODULE, | 861 | .owner = THIS_MODULE, |
@@ -860,6 +878,7 @@ struct proto raw_prot = { | |||
860 | #ifdef CONFIG_COMPAT | 878 | #ifdef CONFIG_COMPAT |
861 | .compat_setsockopt = compat_raw_setsockopt, | 879 | .compat_setsockopt = compat_raw_setsockopt, |
862 | .compat_getsockopt = compat_raw_getsockopt, | 880 | .compat_getsockopt = compat_raw_getsockopt, |
881 | .compat_ioctl = compat_raw_ioctl, | ||
863 | #endif | 882 | #endif |
864 | }; | 883 | }; |
865 | 884 | ||