Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 73257
b: refs/heads/master
c: 6a9fb94
h: refs/heads/master
i:
  73255: 7652b25
v: v3
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Nov 7, 2007
1 parent c1dcce5 commit 1696e34
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4e058063f49f53f6d75f707e36c82edee6d2e919
refs/heads/master: 6a9fb9479f2672fa392711735de9e642395c9a14
12 changes: 12 additions & 0 deletions trunk/include/linux/mroute.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,18 @@ struct igmpmsg
#ifdef __KERNEL__
#include <net/sock.h>

#ifdef CONFIG_IP_MROUTE
static inline int ip_mroute_opt(int opt)
{
return (opt >= MRT_BASE) && (opt <= MRT_BASE + 10);
}
#else
static inline int ip_mroute_opt(int opt)
{
return 0;
}
#endif

extern int ip_mroute_setsockopt(struct sock *, int, char __user *, int);
extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
Expand Down
39 changes: 12 additions & 27 deletions trunk/net/ipv4/ip_sockglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,8 @@ static int do_ip_setsockopt(struct sock *sk, int level,

/* If optlen==0, it is equivalent to val == 0 */

#ifdef CONFIG_IP_MROUTE
if (optname >= MRT_BASE && optname <= (MRT_BASE + 10))
if (ip_mroute_opt(optname))
return ip_mroute_setsockopt(sk,optname,optval,optlen);
#endif

err = 0;
lock_sock(sk);
Expand Down Expand Up @@ -909,11 +907,9 @@ int ip_setsockopt(struct sock *sk, int level,
#ifdef CONFIG_NETFILTER
/* we need to exclude all possible ENOPROTOOPTs except default case */
if (err == -ENOPROTOOPT && optname != IP_HDRINCL &&
optname != IP_IPSEC_POLICY && optname != IP_XFRM_POLICY
#ifdef CONFIG_IP_MROUTE
&& (optname < MRT_BASE || optname > (MRT_BASE + 10))
#endif
) {
optname != IP_IPSEC_POLICY &&
optname != IP_XFRM_POLICY &&
!ip_mroute_opt(optname)) {
lock_sock(sk);
err = nf_setsockopt(sk, PF_INET, optname, optval, optlen);
release_sock(sk);
Expand All @@ -935,11 +931,9 @@ int compat_ip_setsockopt(struct sock *sk, int level, int optname,
#ifdef CONFIG_NETFILTER
/* we need to exclude all possible ENOPROTOOPTs except default case */
if (err == -ENOPROTOOPT && optname != IP_HDRINCL &&
optname != IP_IPSEC_POLICY && optname != IP_XFRM_POLICY
#ifdef CONFIG_IP_MROUTE
&& (optname < MRT_BASE || optname > (MRT_BASE + 10))
#endif
) {
optname != IP_IPSEC_POLICY &&
optname != IP_XFRM_POLICY &&
!ip_mroute_opt(optname)) {
lock_sock(sk);
err = compat_nf_setsockopt(sk, PF_INET, optname,
optval, optlen);
Expand Down Expand Up @@ -967,11 +961,8 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
if (level != SOL_IP)
return -EOPNOTSUPP;

#ifdef CONFIG_IP_MROUTE
if (optname >= MRT_BASE && optname <= MRT_BASE+10) {
if (ip_mroute_opt(optname))
return ip_mroute_getsockopt(sk,optname,optval,optlen);
}
#endif

if (get_user(len,optlen))
return -EFAULT;
Expand Down Expand Up @@ -1171,11 +1162,8 @@ int ip_getsockopt(struct sock *sk, int level,
err = do_ip_getsockopt(sk, level, optname, optval, optlen);
#ifdef CONFIG_NETFILTER
/* we need to exclude all possible ENOPROTOOPTs except default case */
if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS
#ifdef CONFIG_IP_MROUTE
&& (optname < MRT_BASE || optname > MRT_BASE+10)
#endif
) {
if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS &&
!ip_mroute_opt(optname)) {
int len;

if (get_user(len,optlen))
Expand All @@ -1200,11 +1188,8 @@ int compat_ip_getsockopt(struct sock *sk, int level, int optname,
int err = do_ip_getsockopt(sk, level, optname, optval, optlen);
#ifdef CONFIG_NETFILTER
/* we need to exclude all possible ENOPROTOOPTs except default case */
if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS
#ifdef CONFIG_IP_MROUTE
&& (optname < MRT_BASE || optname > MRT_BASE+10)
#endif
) {
if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS &&
!ip_mroute_opt(optname)) {
int len;

if (get_user(len, optlen))
Expand Down

0 comments on commit 1696e34

Please sign in to comment.