diff options
author | Denis V. Lunev <den@openvz.org> | 2008-10-07 17:49:36 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-10-07 17:49:36 -0400 |
commit | 0c7ed677fb7013c8028045d409a48ac42151187a (patch) | |
tree | 7449bac3fd2433b541da0d458cf0aecfb90451b8 | |
parent | e43291cb37406dae405d50332eaa1ba2264c8dce (diff) |
netns: make udpv6 mib per/namespace
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/netns/mib.h | 1 | ||||
-rw-r--r-- | include/net/udp.h | 12 | ||||
-rw-r--r-- | net/ipv4/udp.c | 3 | ||||
-rw-r--r-- | net/ipv6/af_inet6.c | 9 | ||||
-rw-r--r-- | net/ipv6/proc.c | 3 |
5 files changed, 13 insertions, 15 deletions
diff --git a/include/net/netns/mib.h b/include/net/netns/mib.h index ffcef5de3d1d..ba622b24b847 100644 --- a/include/net/netns/mib.h +++ b/include/net/netns/mib.h | |||
@@ -14,6 +14,7 @@ struct netns_mib { | |||
14 | 14 | ||
15 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 15 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
16 | struct proc_dir_entry *proc_net_devsnmp6; | 16 | struct proc_dir_entry *proc_net_devsnmp6; |
17 | DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6); | ||
17 | #endif | 18 | #endif |
18 | }; | 19 | }; |
19 | 20 | ||
diff --git a/include/net/udp.h b/include/net/udp.h index d38f6f2419f9..72f28c3ddaae 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
@@ -152,8 +152,6 @@ extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, | |||
152 | __be32 daddr, __be16 dport, | 152 | __be32 daddr, __be16 dport, |
153 | int dif); | 153 | int dif); |
154 | 154 | ||
155 | DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6); | ||
156 | |||
157 | /* UDP-Lite does not have a standardized MIB yet, so we inherit from UDP */ | 155 | /* UDP-Lite does not have a standardized MIB yet, so we inherit from UDP */ |
158 | DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6); | 156 | DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6); |
159 | 157 | ||
@@ -167,12 +165,14 @@ DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6); | |||
167 | if (is_udplite) SNMP_INC_STATS_BH((net)->mib.udplite_statistics, field); \ | 165 | if (is_udplite) SNMP_INC_STATS_BH((net)->mib.udplite_statistics, field); \ |
168 | else SNMP_INC_STATS_BH((net)->mib.udp_statistics, field); } while(0) | 166 | else SNMP_INC_STATS_BH((net)->mib.udp_statistics, field); } while(0) |
169 | 167 | ||
170 | #define UDP6_INC_STATS_BH(net, field, is_udplite) do { (void)net; \ | 168 | #define UDP6_INC_STATS_BH(net, field, is_udplite) do { \ |
171 | if (is_udplite) SNMP_INC_STATS_BH(udplite_stats_in6, field); \ | 169 | if (is_udplite) SNMP_INC_STATS_BH(udplite_stats_in6, field); \ |
172 | else SNMP_INC_STATS_BH(udp_stats_in6, field); } while(0) | 170 | else SNMP_INC_STATS_BH((net)->mib.udp_stats_in6, field); \ |
173 | #define UDP6_INC_STATS_USER(net, field, is_udplite) do { (void)net; \ | 171 | } while(0) |
172 | #define UDP6_INC_STATS_USER(net, field, is_udplite) do { \ | ||
174 | if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \ | 173 | if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \ |
175 | else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0) | 174 | else SNMP_INC_STATS_USER((net)->mib.udp_stats_in6, field); \ |
175 | } while(0) | ||
176 | 176 | ||
177 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 177 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
178 | #define UDPX_INC_STATS_BH(sk, field) \ | 178 | #define UDPX_INC_STATS_BH(sk, field) \ |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 822c9deac83b..85f8e8e10b1b 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -108,9 +108,6 @@ | |||
108 | * Snmp MIB for the UDP layer | 108 | * Snmp MIB for the UDP layer |
109 | */ | 109 | */ |
110 | 110 | ||
111 | DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6) __read_mostly; | ||
112 | EXPORT_SYMBOL(udp_stats_in6); | ||
113 | |||
114 | struct hlist_head udp_hash[UDP_HTABLE_SIZE]; | 111 | struct hlist_head udp_hash[UDP_HTABLE_SIZE]; |
115 | DEFINE_RWLOCK(udp_hash_lock); | 112 | DEFINE_RWLOCK(udp_hash_lock); |
116 | 113 | ||
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index e8f82eca1609..e09139122efe 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -806,16 +806,12 @@ static int __init init_ipv6_mibs(void) | |||
806 | if (snmp_mib_init((void **)icmpv6msg_statistics, | 806 | if (snmp_mib_init((void **)icmpv6msg_statistics, |
807 | sizeof(struct icmpv6msg_mib)) < 0) | 807 | sizeof(struct icmpv6msg_mib)) < 0) |
808 | goto err_icmpmsg_mib; | 808 | goto err_icmpmsg_mib; |
809 | if (snmp_mib_init((void **)udp_stats_in6, sizeof (struct udp_mib)) < 0) | ||
810 | goto err_udp_mib; | ||
811 | if (snmp_mib_init((void **)udplite_stats_in6, | 809 | if (snmp_mib_init((void **)udplite_stats_in6, |
812 | sizeof (struct udp_mib)) < 0) | 810 | sizeof (struct udp_mib)) < 0) |
813 | goto err_udplite_mib; | 811 | goto err_udplite_mib; |
814 | return 0; | 812 | return 0; |
815 | 813 | ||
816 | err_udplite_mib: | 814 | err_udplite_mib: |
817 | snmp_mib_free((void **)udp_stats_in6); | ||
818 | err_udp_mib: | ||
819 | snmp_mib_free((void **)icmpv6msg_statistics); | 815 | snmp_mib_free((void **)icmpv6msg_statistics); |
820 | err_icmpmsg_mib: | 816 | err_icmpmsg_mib: |
821 | snmp_mib_free((void **)icmpv6_statistics); | 817 | snmp_mib_free((void **)icmpv6_statistics); |
@@ -831,17 +827,20 @@ static void cleanup_ipv6_mibs(void) | |||
831 | snmp_mib_free((void **)ipv6_statistics); | 827 | snmp_mib_free((void **)ipv6_statistics); |
832 | snmp_mib_free((void **)icmpv6_statistics); | 828 | snmp_mib_free((void **)icmpv6_statistics); |
833 | snmp_mib_free((void **)icmpv6msg_statistics); | 829 | snmp_mib_free((void **)icmpv6msg_statistics); |
834 | snmp_mib_free((void **)udp_stats_in6); | ||
835 | snmp_mib_free((void **)udplite_stats_in6); | 830 | snmp_mib_free((void **)udplite_stats_in6); |
836 | } | 831 | } |
837 | 832 | ||
838 | static int __net_init ipv6_init_mibs(struct net *net) | 833 | static int __net_init ipv6_init_mibs(struct net *net) |
839 | { | 834 | { |
835 | if (snmp_mib_init((void **)net->mib.udp_stats_in6, | ||
836 | sizeof (struct udp_mib)) < 0) | ||
837 | return -ENOMEM; | ||
840 | return 0; | 838 | return 0; |
841 | } | 839 | } |
842 | 840 | ||
843 | static void __net_exit ipv6_cleanup_mibs(struct net *net) | 841 | static void __net_exit ipv6_cleanup_mibs(struct net *net) |
844 | { | 842 | { |
843 | snmp_mib_free((void **)net->mib.udp_stats_in6); | ||
845 | } | 844 | } |
846 | 845 | ||
847 | static int inet6_net_init(struct net *net) | 846 | static int inet6_net_init(struct net *net) |
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index 23e567fb1d37..3eaf20bf998f 100644 --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c | |||
@@ -180,7 +180,8 @@ static int snmp6_seq_show(struct seq_file *seq, void *v) | |||
180 | snmp6_seq_show_item(seq, (void **)ipv6_statistics, snmp6_ipstats_list); | 180 | snmp6_seq_show_item(seq, (void **)ipv6_statistics, snmp6_ipstats_list); |
181 | snmp6_seq_show_item(seq, (void **)icmpv6_statistics, snmp6_icmp6_list); | 181 | snmp6_seq_show_item(seq, (void **)icmpv6_statistics, snmp6_icmp6_list); |
182 | snmp6_seq_show_icmpv6msg(seq, (void **)icmpv6msg_statistics); | 182 | snmp6_seq_show_icmpv6msg(seq, (void **)icmpv6msg_statistics); |
183 | snmp6_seq_show_item(seq, (void **)udp_stats_in6, snmp6_udp6_list); | 183 | snmp6_seq_show_item(seq, (void **)net->mib.udp_stats_in6, |
184 | snmp6_udp6_list); | ||
184 | snmp6_seq_show_item(seq, (void **)udplite_stats_in6, snmp6_udplite6_list); | 185 | snmp6_seq_show_item(seq, (void **)udplite_stats_in6, snmp6_udplite6_list); |
185 | return 0; | 186 | return 0; |
186 | } | 187 | } |