diff options
Diffstat (limited to 'net/ipv4/ip_sockglue.c')
-rw-r--r-- | net/ipv4/ip_sockglue.c | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index f51f20e487c8..82817e554363 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -437,10 +437,8 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
437 | 437 | ||
438 | /* If optlen==0, it is equivalent to val == 0 */ | 438 | /* If optlen==0, it is equivalent to val == 0 */ |
439 | 439 | ||
440 | #ifdef CONFIG_IP_MROUTE | 440 | if (ip_mroute_opt(optname)) |
441 | if (optname >= MRT_BASE && optname <= (MRT_BASE + 10)) | ||
442 | return ip_mroute_setsockopt(sk,optname,optval,optlen); | 441 | return ip_mroute_setsockopt(sk,optname,optval,optlen); |
443 | #endif | ||
444 | 442 | ||
445 | err = 0; | 443 | err = 0; |
446 | lock_sock(sk); | 444 | lock_sock(sk); |
@@ -909,11 +907,9 @@ int ip_setsockopt(struct sock *sk, int level, | |||
909 | #ifdef CONFIG_NETFILTER | 907 | #ifdef CONFIG_NETFILTER |
910 | /* we need to exclude all possible ENOPROTOOPTs except default case */ | 908 | /* we need to exclude all possible ENOPROTOOPTs except default case */ |
911 | if (err == -ENOPROTOOPT && optname != IP_HDRINCL && | 909 | if (err == -ENOPROTOOPT && optname != IP_HDRINCL && |
912 | optname != IP_IPSEC_POLICY && optname != IP_XFRM_POLICY | 910 | optname != IP_IPSEC_POLICY && |
913 | #ifdef CONFIG_IP_MROUTE | 911 | optname != IP_XFRM_POLICY && |
914 | && (optname < MRT_BASE || optname > (MRT_BASE + 10)) | 912 | !ip_mroute_opt(optname)) { |
915 | #endif | ||
916 | ) { | ||
917 | lock_sock(sk); | 913 | lock_sock(sk); |
918 | err = nf_setsockopt(sk, PF_INET, optname, optval, optlen); | 914 | err = nf_setsockopt(sk, PF_INET, optname, optval, optlen); |
919 | release_sock(sk); | 915 | release_sock(sk); |
@@ -935,11 +931,9 @@ int compat_ip_setsockopt(struct sock *sk, int level, int optname, | |||
935 | #ifdef CONFIG_NETFILTER | 931 | #ifdef CONFIG_NETFILTER |
936 | /* we need to exclude all possible ENOPROTOOPTs except default case */ | 932 | /* we need to exclude all possible ENOPROTOOPTs except default case */ |
937 | if (err == -ENOPROTOOPT && optname != IP_HDRINCL && | 933 | if (err == -ENOPROTOOPT && optname != IP_HDRINCL && |
938 | optname != IP_IPSEC_POLICY && optname != IP_XFRM_POLICY | 934 | optname != IP_IPSEC_POLICY && |
939 | #ifdef CONFIG_IP_MROUTE | 935 | optname != IP_XFRM_POLICY && |
940 | && (optname < MRT_BASE || optname > (MRT_BASE + 10)) | 936 | !ip_mroute_opt(optname)) { |
941 | #endif | ||
942 | ) { | ||
943 | lock_sock(sk); | 937 | lock_sock(sk); |
944 | err = compat_nf_setsockopt(sk, PF_INET, optname, | 938 | err = compat_nf_setsockopt(sk, PF_INET, optname, |
945 | optval, optlen); | 939 | optval, optlen); |
@@ -967,11 +961,8 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, | |||
967 | if (level != SOL_IP) | 961 | if (level != SOL_IP) |
968 | return -EOPNOTSUPP; | 962 | return -EOPNOTSUPP; |
969 | 963 | ||
970 | #ifdef CONFIG_IP_MROUTE | 964 | if (ip_mroute_opt(optname)) |
971 | if (optname >= MRT_BASE && optname <= MRT_BASE+10) { | ||
972 | return ip_mroute_getsockopt(sk,optname,optval,optlen); | 965 | return ip_mroute_getsockopt(sk,optname,optval,optlen); |
973 | } | ||
974 | #endif | ||
975 | 966 | ||
976 | if (get_user(len,optlen)) | 967 | if (get_user(len,optlen)) |
977 | return -EFAULT; | 968 | return -EFAULT; |
@@ -1171,11 +1162,8 @@ int ip_getsockopt(struct sock *sk, int level, | |||
1171 | err = do_ip_getsockopt(sk, level, optname, optval, optlen); | 1162 | err = do_ip_getsockopt(sk, level, optname, optval, optlen); |
1172 | #ifdef CONFIG_NETFILTER | 1163 | #ifdef CONFIG_NETFILTER |
1173 | /* we need to exclude all possible ENOPROTOOPTs except default case */ | 1164 | /* we need to exclude all possible ENOPROTOOPTs except default case */ |
1174 | if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS | 1165 | if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS && |
1175 | #ifdef CONFIG_IP_MROUTE | 1166 | !ip_mroute_opt(optname)) { |
1176 | && (optname < MRT_BASE || optname > MRT_BASE+10) | ||
1177 | #endif | ||
1178 | ) { | ||
1179 | int len; | 1167 | int len; |
1180 | 1168 | ||
1181 | if (get_user(len,optlen)) | 1169 | if (get_user(len,optlen)) |
@@ -1200,11 +1188,8 @@ int compat_ip_getsockopt(struct sock *sk, int level, int optname, | |||
1200 | int err = do_ip_getsockopt(sk, level, optname, optval, optlen); | 1188 | int err = do_ip_getsockopt(sk, level, optname, optval, optlen); |
1201 | #ifdef CONFIG_NETFILTER | 1189 | #ifdef CONFIG_NETFILTER |
1202 | /* we need to exclude all possible ENOPROTOOPTs except default case */ | 1190 | /* we need to exclude all possible ENOPROTOOPTs except default case */ |
1203 | if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS | 1191 | if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS && |
1204 | #ifdef CONFIG_IP_MROUTE | 1192 | !ip_mroute_opt(optname)) { |
1205 | && (optname < MRT_BASE || optname > MRT_BASE+10) | ||
1206 | #endif | ||
1207 | ) { | ||
1208 | int len; | 1193 | int len; |
1209 | 1194 | ||
1210 | if (get_user(len, optlen)) | 1195 | if (get_user(len, optlen)) |