* [PATCH 2.6] compat_sys_[gs]etsockopt need to check for level
@ 2004-05-24 11:33 Olaf Kirch
0 siblings, 0 replies; only message in thread
From: Olaf Kirch @ 2004-05-24 11:33 UTC (permalink / raw)
To: netdev; +Cc: meissner
[-- Attachment #1: Type: text/plain, Size: 473 bytes --]
The 32bit emulation functions for setsockopt/getsockopt try
to catch a few special cases by looking at the option name,
without checking for the option level. This breaks IPV6_V6ONLY
and probably a few others.
The bug was found by Marcus Meissner.
I hope I got the level for IPT_SO_SET_REPLACE right (I think it's SOL_IP).
I would appreciate if someone could double-check.
Cheers,
Olaf
--
Olaf Kirch | The Hardware Gods hate me.
okir@suse.de |
---------------+
[-- Attachment #2: setsockopt-compat --]
[-- Type: text/plain, Size: 1278 bytes --]
--- linux-2.6.5/net/compat.c.orig 2004-04-04 05:37:24.000000000 +0200
+++ linux-2.6.5/net/compat.c 2004-05-24 13:32:27.000000000 +0200
@@ -457,13 +457,14 @@
asmlinkage long compat_sys_setsockopt(int fd, int level, int optname,
char *optval, int optlen)
{
- if (optname == IPT_SO_SET_REPLACE)
+ if (level == SOL_IP && 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);
@@ -500,7 +501,8 @@
asmlinkage long compat_sys_getsockopt(int fd, int level, int optname,
char *optval, int *optlen)
{
- if (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO)
+ if (level == SOL_SOCKET &&
+ (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO))
return do_get_sock_timeout(fd, level, optname, optval, optlen);
return sys_getsockopt(fd, level, optname, optval, optlen);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-05-24 11:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-24 11:33 [PATCH 2.6] compat_sys_[gs]etsockopt need to check for level Olaf Kirch
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.