diff options
author | Daniel Lezcano <dlezcano@fr.ibm.com> | 2007-12-08 03:14:11 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:56:59 -0500 |
commit | c35b7e72cd48bc7163b6900fb3689fa54b572bba (patch) | |
tree | 28e1386d9c0a7522e40d6d77b2c912f88f0e8a36 | |
parent | 75314fb38364c81a573cd222f74d792409a7afba (diff) |
[IPV6]: remove ifdef in route6 for xfrm6
The following patch create the usual static inline functions to disable
the xfrm6_init and xfrm6_fini function when XFRM is off.
That's allow to remove some ifdef and make the code a little more clear.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/xfrm.h | 16 | ||||
-rw-r--r-- | net/ipv6/route.c | 7 |
2 files changed, 14 insertions, 9 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 18260921eeb5..503d0d294a4c 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -842,7 +842,6 @@ xfrm_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x, unsigned short | |||
842 | } | 842 | } |
843 | 843 | ||
844 | #ifdef CONFIG_XFRM | 844 | #ifdef CONFIG_XFRM |
845 | |||
846 | extern int __xfrm_policy_check(struct sock *, int dir, struct sk_buff *skb, unsigned short family); | 845 | extern int __xfrm_policy_check(struct sock *, int dir, struct sk_buff *skb, unsigned short family); |
847 | 846 | ||
848 | static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, unsigned short family) | 847 | static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, unsigned short family) |
@@ -1066,12 +1065,23 @@ struct xfrm6_tunnel { | |||
1066 | 1065 | ||
1067 | extern void xfrm_init(void); | 1066 | extern void xfrm_init(void); |
1068 | extern void xfrm4_init(void); | 1067 | extern void xfrm4_init(void); |
1069 | extern int xfrm6_init(void); | ||
1070 | extern void xfrm6_fini(void); | ||
1071 | extern void xfrm_state_init(void); | 1068 | extern void xfrm_state_init(void); |
1072 | extern void xfrm4_state_init(void); | 1069 | extern void xfrm4_state_init(void); |
1070 | #ifdef CONFIG_XFRM | ||
1071 | extern int xfrm6_init(void); | ||
1072 | extern void xfrm6_fini(void); | ||
1073 | extern int xfrm6_state_init(void); | 1073 | extern int xfrm6_state_init(void); |
1074 | extern void xfrm6_state_fini(void); | 1074 | extern void xfrm6_state_fini(void); |
1075 | #else | ||
1076 | static inline int xfrm6_init(void) | ||
1077 | { | ||
1078 | return 0; | ||
1079 | } | ||
1080 | static inline void xfrm6_fini(void) | ||
1081 | { | ||
1082 | ; | ||
1083 | } | ||
1084 | #endif | ||
1075 | 1085 | ||
1076 | extern int xfrm_state_walk(u8 proto, int (*func)(struct xfrm_state *, int, void*), void *); | 1086 | extern int xfrm_state_walk(u8 proto, int (*func)(struct xfrm_state *, int, void*), void *); |
1077 | extern struct xfrm_state *xfrm_state_alloc(void); | 1087 | extern struct xfrm_state *xfrm_state_alloc(void); |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index dbdae143ef5f..c4e890abb2d4 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -2522,11 +2522,10 @@ int __init ip6_route_init(void) | |||
2522 | if (ret) | 2522 | if (ret) |
2523 | goto out_fib6_init; | 2523 | goto out_fib6_init; |
2524 | 2524 | ||
2525 | #ifdef CONFIG_XFRM | ||
2526 | ret = xfrm6_init(); | 2525 | ret = xfrm6_init(); |
2527 | if (ret) | 2526 | if (ret) |
2528 | goto out_proc_init; | 2527 | goto out_proc_init; |
2529 | #endif | 2528 | |
2530 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | 2529 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES |
2531 | ret = fib6_rules_init(); | 2530 | ret = fib6_rules_init(); |
2532 | if (ret) | 2531 | if (ret) |
@@ -2547,9 +2546,7 @@ fib6_rules_init: | |||
2547 | fib6_rules_cleanup(); | 2546 | fib6_rules_cleanup(); |
2548 | xfrm6_init: | 2547 | xfrm6_init: |
2549 | #endif | 2548 | #endif |
2550 | #ifdef CONFIG_XFRM | ||
2551 | xfrm6_fini(); | 2549 | xfrm6_fini(); |
2552 | #endif | ||
2553 | out_proc_init: | 2550 | out_proc_init: |
2554 | ipv6_route_proc_fini(&init_net); | 2551 | ipv6_route_proc_fini(&init_net); |
2555 | out_fib6_init: | 2552 | out_fib6_init: |
@@ -2566,9 +2563,7 @@ void ip6_route_cleanup(void) | |||
2566 | fib6_rules_cleanup(); | 2563 | fib6_rules_cleanup(); |
2567 | #endif | 2564 | #endif |
2568 | ipv6_route_proc_fini(&init_net); | 2565 | ipv6_route_proc_fini(&init_net); |
2569 | #ifdef CONFIG_XFRM | ||
2570 | xfrm6_fini(); | 2566 | xfrm6_fini(); |
2571 | #endif | ||
2572 | rt6_ifdown(NULL); | 2567 | rt6_ifdown(NULL); |
2573 | fib6_gc_cleanup(); | 2568 | fib6_gc_cleanup(); |
2574 | kmem_cache_destroy(ip6_dst_ops.kmem_cachep); | 2569 | kmem_cache_destroy(ip6_dst_ops.kmem_cachep); |