vserver 1.9.3
[linux-2.6.git] / net / compat.c
index 998b21b..6080b64 100644 (file)
@@ -455,13 +455,15 @@ static int do_set_sock_timeout(int fd, int level, int optname, char __user *optv
 asmlinkage long compat_sys_setsockopt(int fd, int level, int optname,
                                char __user *optval, int optlen)
 {
+       /* SO_SET_REPLACE seems to be the same in all levels */
        if (optname == IPT_SO_SET_REPLACE)
                return do_netfilter_replace(fd, level, optname,
                                            optval, optlen);
-       if (optname == SO_ATTACH_FILTER)
+       if (level == SOL_SOCKET && optname == SO_ATTACH_FILTER)
                return do_set_attach_filter(fd, level, optname,
                                            optval, optlen);
-       if (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO)
+       if (level == SOL_SOCKET &&
+           (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO))
                return do_set_sock_timeout(fd, level, optname, optval, optlen);
 
        return sys_setsockopt(fd, level, optname, optval, optlen);