ipv4,ipv6 mroute: Add some helper inline functions to remove ugly ifdefs.
ip{,v6}_mroute_{set,get}sockopt() should not matter by optimization but it would be better not to depend on optimization semantically. Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
This commit is contained in:
parent
03d2f897e9
commit
e0835f8fa5
|
@ -144,10 +144,37 @@ static inline int ip_mroute_opt(int opt)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_IP_MROUTE
|
||||||
extern int ip_mroute_setsockopt(struct sock *, int, char __user *, int);
|
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 ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
|
||||||
extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
|
extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
|
||||||
extern int ip_mr_init(void);
|
extern int ip_mr_init(void);
|
||||||
|
#else
|
||||||
|
static inline
|
||||||
|
int ip_mroute_setsockopt(struct sock *sock,
|
||||||
|
int optname, char __user *optval, int optlen)
|
||||||
|
{
|
||||||
|
return -ENOPROTOOPT;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int ip_mroute_getsockopt(struct sock *sock,
|
||||||
|
int optname, char __user *optval, int __user *optlen)
|
||||||
|
{
|
||||||
|
return -ENOPROTOOPT;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
|
||||||
|
{
|
||||||
|
return -ENOIOCTLCMD;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int ip_mr_init(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
struct vif_device
|
struct vif_device
|
||||||
{
|
{
|
||||||
|
|
|
@ -131,12 +131,44 @@ static inline int ip6_mroute_opt(int opt)
|
||||||
|
|
||||||
struct sock;
|
struct sock;
|
||||||
|
|
||||||
|
#ifdef CONFIG_IPV6_MROUTE
|
||||||
extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, int);
|
extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, int);
|
||||||
extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
|
extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
|
||||||
extern int ip6_mr_input(struct sk_buff *skb);
|
extern int ip6_mr_input(struct sk_buff *skb);
|
||||||
extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg);
|
extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg);
|
||||||
extern int ip6_mr_init(void);
|
extern int ip6_mr_init(void);
|
||||||
extern void ip6_mr_cleanup(void);
|
extern void ip6_mr_cleanup(void);
|
||||||
|
#else
|
||||||
|
static inline
|
||||||
|
int ip6_mroute_setsockopt(struct sock *sock,
|
||||||
|
int optname, char __user *optval, int optlen)
|
||||||
|
{
|
||||||
|
return -ENOPROTOOPT;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int ip6_mroute_getsockopt(struct sock *sock,
|
||||||
|
int optname, char __user *optval, int __user *optlen)
|
||||||
|
{
|
||||||
|
return -ENOPROTOOPT;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg)
|
||||||
|
{
|
||||||
|
return -ENOIOCTLCMD;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int ip6_mr_init(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void ip6_mr_cleanup(void)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
struct mif_device
|
struct mif_device
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,9 +59,7 @@
|
||||||
|
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
#include <asm/system.h>
|
#include <asm/system.h>
|
||||||
#ifdef CONFIG_IPV6_MROUTE
|
|
||||||
#include <linux/mroute6.h>
|
#include <linux/mroute6.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
MODULE_AUTHOR("Cast of dozens");
|
MODULE_AUTHOR("Cast of dozens");
|
||||||
MODULE_DESCRIPTION("IPv6 protocol stack for Linux");
|
MODULE_DESCRIPTION("IPv6 protocol stack for Linux");
|
||||||
|
@ -952,11 +950,9 @@ static int __init inet6_init(void)
|
||||||
err = icmpv6_init();
|
err = icmpv6_init();
|
||||||
if (err)
|
if (err)
|
||||||
goto icmp_fail;
|
goto icmp_fail;
|
||||||
#ifdef CONFIG_IPV6_MROUTE
|
|
||||||
err = ip6_mr_init();
|
err = ip6_mr_init();
|
||||||
if (err)
|
if (err)
|
||||||
goto ipmr_fail;
|
goto ipmr_fail;
|
||||||
#endif
|
|
||||||
err = ndisc_init();
|
err = ndisc_init();
|
||||||
if (err)
|
if (err)
|
||||||
goto ndisc_fail;
|
goto ndisc_fail;
|
||||||
|
@ -1059,10 +1055,8 @@ netfilter_fail:
|
||||||
igmp_fail:
|
igmp_fail:
|
||||||
ndisc_cleanup();
|
ndisc_cleanup();
|
||||||
ndisc_fail:
|
ndisc_fail:
|
||||||
#ifdef CONFIG_IPV6_MROUTE
|
|
||||||
ip6_mr_cleanup();
|
ip6_mr_cleanup();
|
||||||
ipmr_fail:
|
ipmr_fail:
|
||||||
#endif
|
|
||||||
icmpv6_cleanup();
|
icmpv6_cleanup();
|
||||||
icmp_fail:
|
icmp_fail:
|
||||||
unregister_pernet_subsys(&inet6_net_ops);
|
unregister_pernet_subsys(&inet6_net_ops);
|
||||||
|
@ -1117,9 +1111,7 @@ static void __exit inet6_exit(void)
|
||||||
ipv6_netfilter_fini();
|
ipv6_netfilter_fini();
|
||||||
igmp6_cleanup();
|
igmp6_cleanup();
|
||||||
ndisc_cleanup();
|
ndisc_cleanup();
|
||||||
#ifdef CONFIG_IPV6_MROUTE
|
|
||||||
ip6_mr_cleanup();
|
ip6_mr_cleanup();
|
||||||
#endif
|
|
||||||
icmpv6_cleanup();
|
icmpv6_cleanup();
|
||||||
rawv6_exit();
|
rawv6_exit();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue