diff options
author | Daniel Lezcano <dlezcano@fr.ibm.com> | 2007-12-11 05:23:18 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:57:10 -0500 |
commit | 0a3e78ac2c555441f5bc00588070058533bc8d6b (patch) | |
tree | c5d406c1ea39ae256bc682e5d824682e0a6f6d56 | |
parent | 51602b2a5e849babd94311e555bf1ba58151b8d4 (diff) |
[IPV6]: make flowlabel to return an error
This patch makes the flowlab subsystem to return an error code and makes
some cleanup with procfs ifdefs.
The af_inet6 will use the flowlabel init return code to check the initialization
was correct.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/ipv6.h | 2 | ||||
-rw-r--r-- | net/ipv6/af_inet6.c | 5 | ||||
-rw-r--r-- | net/ipv6/ip6_flowlabel.c | 30 |
3 files changed, 28 insertions, 9 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 38df94b5fb26..4d9106580950 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -219,7 +219,7 @@ extern struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_spac | |||
219 | struct ipv6_txoptions * fopt); | 219 | struct ipv6_txoptions * fopt); |
220 | extern void fl6_free_socklist(struct sock *sk); | 220 | extern void fl6_free_socklist(struct sock *sk); |
221 | extern int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen); | 221 | extern int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen); |
222 | extern void ip6_flowlabel_init(void); | 222 | extern int ip6_flowlabel_init(void); |
223 | extern void ip6_flowlabel_cleanup(void); | 223 | extern void ip6_flowlabel_cleanup(void); |
224 | 224 | ||
225 | static inline void fl6_sock_release(struct ip6_flowlabel *fl) | 225 | static inline void fl6_sock_release(struct ip6_flowlabel *fl) |
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 90d2f723fc46..614f3d905dd1 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -851,7 +851,9 @@ static int __init inet6_init(void) | |||
851 | err = ip6_route_init(); | 851 | err = ip6_route_init(); |
852 | if (err) | 852 | if (err) |
853 | goto ip6_route_fail; | 853 | goto ip6_route_fail; |
854 | ip6_flowlabel_init(); | 854 | err = ip6_flowlabel_init(); |
855 | if (err) | ||
856 | goto ip6_flowlabel_fail; | ||
855 | err = addrconf_init(); | 857 | err = addrconf_init(); |
856 | if (err) | 858 | if (err) |
857 | goto addrconf_fail; | 859 | goto addrconf_fail; |
@@ -874,6 +876,7 @@ out: | |||
874 | 876 | ||
875 | addrconf_fail: | 877 | addrconf_fail: |
876 | ip6_flowlabel_cleanup(); | 878 | ip6_flowlabel_cleanup(); |
879 | ip6_flowlabel_fail: | ||
877 | ip6_route_cleanup(); | 880 | ip6_route_cleanup(); |
878 | ip6_route_fail: | 881 | ip6_route_fail: |
879 | #ifdef CONFIG_PROC_FS | 882 | #ifdef CONFIG_PROC_FS |
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index b12cc22e7745..d0babea89819 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c | |||
@@ -692,20 +692,36 @@ static const struct file_operations ip6fl_seq_fops = { | |||
692 | .llseek = seq_lseek, | 692 | .llseek = seq_lseek, |
693 | .release = seq_release_private, | 693 | .release = seq_release_private, |
694 | }; | 694 | }; |
695 | #endif | ||
696 | 695 | ||
696 | static int ip6_flowlabel_proc_init(struct net *net) | ||
697 | { | ||
698 | if (!proc_net_fops_create(net, "ip6_flowlabel", S_IRUGO, &ip6fl_seq_fops)) | ||
699 | return -ENOMEM; | ||
700 | return 0; | ||
701 | } | ||
697 | 702 | ||
698 | void ip6_flowlabel_init(void) | 703 | static void ip6_flowlabel_proc_fini(struct net *net) |
699 | { | 704 | { |
700 | #ifdef CONFIG_PROC_FS | 705 | proc_net_remove(net, "ip6_flowlabel"); |
701 | proc_net_fops_create(&init_net, "ip6_flowlabel", S_IRUGO, &ip6fl_seq_fops); | 706 | } |
707 | #else | ||
708 | static inline int ip6_flowlabel_proc_init(struct net *net) | ||
709 | { | ||
710 | return 0; | ||
711 | } | ||
712 | static inline void ip6_flowlabel_proc_fini(struct net *net) | ||
713 | { | ||
714 | return ; | ||
715 | } | ||
702 | #endif | 716 | #endif |
717 | |||
718 | int ip6_flowlabel_init(void) | ||
719 | { | ||
720 | return ip6_flowlabel_proc_init(&init_net); | ||
703 | } | 721 | } |
704 | 722 | ||
705 | void ip6_flowlabel_cleanup(void) | 723 | void ip6_flowlabel_cleanup(void) |
706 | { | 724 | { |
707 | del_timer(&ip6_fl_gc_timer); | 725 | del_timer(&ip6_fl_gc_timer); |
708 | #ifdef CONFIG_PROC_FS | 726 | ip6_flowlabel_proc_fini(&init_net); |
709 | proc_net_remove(&init_net, "ip6_flowlabel"); | ||
710 | #endif | ||
711 | } | 727 | } |