diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2020-05-10 03:16:36 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2020-05-21 02:31:26 +0200 |
commit | e9c375fb5edeb550786d1436784db909bf672e9f (patch) | |
tree | a042092acd06f181fd5dbc8a6fe0b662b77a5313 /net/ipv4/ip_sockglue.c | |
parent | lift compat definitions of mcast [sg]etsockopt requests into net/compat.h (diff) | |
download | linux-e9c375fb5edeb550786d1436784db909bf672e9f.tar.xz linux-e9c375fb5edeb550786d1436784db909bf672e9f.zip |
compat_ip{,v6}_setsockopt(): enumerate MCAST_... options explicitly
We want to check if optname is among the MCAST_... ones; do that as
an explicit switch.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net/ipv4/ip_sockglue.c')
-rw-r--r-- | net/ipv4/ip_sockglue.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 8206047d70b6..3c2c6cd3933b 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c @@ -1272,9 +1272,17 @@ int compat_ip_setsockopt(struct sock *sk, int level, int optname, if (level != SOL_IP) return -ENOPROTOOPT; - if (optname >= MCAST_JOIN_GROUP && optname <= MCAST_MSFILTER) + switch (optname) { + case MCAST_JOIN_GROUP: + case MCAST_LEAVE_GROUP: + case MCAST_JOIN_SOURCE_GROUP: + case MCAST_LEAVE_SOURCE_GROUP: + case MCAST_BLOCK_SOURCE: + case MCAST_UNBLOCK_SOURCE: + case MCAST_MSFILTER: return compat_mc_setsockopt(sk, level, optname, optval, optlen, ip_setsockopt); + } err = do_ip_setsockopt(sk, level, optname, optval, optlen); #ifdef CONFIG_NETFILTER |