aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-10-07 17:50:06 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-07 17:50:06 -0400
commitbe713a443ee019489890e93654557916fbf72612 (patch)
tree0ff5bacfd4b6f17ccc380ef01fcd6661959531b8
parent0c7ed677fb7013c8028045d409a48ac42151187a (diff)
netns: make uplitev6 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.h1
-rw-r--r--include/net/udp.h11
-rw-r--r--net/ipv6/af_inet6.c14
-rw-r--r--net/ipv6/proc.c3
-rw-r--r--net/ipv6/udplite.c2
5 files changed, 15 insertions, 16 deletions
diff --git a/include/net/netns/mib.h b/include/net/netns/mib.h
index ba622b24b847..4e58f0519ce8 100644
--- a/include/net/netns/mib.h
+++ b/include/net/netns/mib.h
@@ -15,6 +15,7 @@ struct netns_mib {
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 DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6);
18 DEFINE_SNMP_STAT(struct udp_mib, udplite_stats_in6);
18#endif 19#endif
19}; 20};
20 21
diff --git a/include/net/udp.h b/include/net/udp.h
index 72f28c3ddaae..1e205095ea68 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -152,9 +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/* UDP-Lite does not have a standardized MIB yet, so we inherit from UDP */
156DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6);
157
158/* 155/*
159 * SNMP statistics for UDP and UDP-Lite 156 * SNMP statistics for UDP and UDP-Lite
160 */ 157 */
@@ -166,12 +163,12 @@ DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6);
166 else SNMP_INC_STATS_BH((net)->mib.udp_statistics, field); } while(0) 163 else SNMP_INC_STATS_BH((net)->mib.udp_statistics, field); } while(0)
167 164
168#define UDP6_INC_STATS_BH(net, field, is_udplite) do { \ 165#define UDP6_INC_STATS_BH(net, field, is_udplite) do { \
169 if (is_udplite) SNMP_INC_STATS_BH(udplite_stats_in6, field); \ 166 if (is_udplite) SNMP_INC_STATS_BH((net)->mib.udplite_stats_in6, field);\
170 else SNMP_INC_STATS_BH((net)->mib.udp_stats_in6, field); \ 167 else SNMP_INC_STATS_BH((net)->mib.udp_stats_in6, field); \
171} while(0) 168} while(0)
172#define UDP6_INC_STATS_USER(net, field, is_udplite) do { \ 169#define UDP6_INC_STATS_USER(net, field, __lite) do { \
173 if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \ 170 if (__lite) SNMP_INC_STATS_USER((net)->mib.udplite_stats_in6, field); \
174 else SNMP_INC_STATS_USER((net)->mib.udp_stats_in6, field); \ 171 else SNMP_INC_STATS_USER((net)->mib.udp_stats_in6, field); \
175} while(0) 172} while(0)
176 173
177#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 174#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index e09139122efe..127b240d2d81 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -806,13 +806,8 @@ 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 **)udplite_stats_in6,
810 sizeof (struct udp_mib)) < 0)
811 goto err_udplite_mib;
812 return 0; 809 return 0;
813 810
814err_udplite_mib:
815 snmp_mib_free((void **)icmpv6msg_statistics);
816err_icmpmsg_mib: 811err_icmpmsg_mib:
817 snmp_mib_free((void **)icmpv6_statistics); 812 snmp_mib_free((void **)icmpv6_statistics);
818err_icmp_mib: 813err_icmp_mib:
@@ -827,7 +822,6 @@ static void cleanup_ipv6_mibs(void)
827 snmp_mib_free((void **)ipv6_statistics); 822 snmp_mib_free((void **)ipv6_statistics);
828 snmp_mib_free((void **)icmpv6_statistics); 823 snmp_mib_free((void **)icmpv6_statistics);
829 snmp_mib_free((void **)icmpv6msg_statistics); 824 snmp_mib_free((void **)icmpv6msg_statistics);
830 snmp_mib_free((void **)udplite_stats_in6);
831} 825}
832 826
833static int __net_init ipv6_init_mibs(struct net *net) 827static int __net_init ipv6_init_mibs(struct net *net)
@@ -835,12 +829,20 @@ static int __net_init ipv6_init_mibs(struct net *net)
835 if (snmp_mib_init((void **)net->mib.udp_stats_in6, 829 if (snmp_mib_init((void **)net->mib.udp_stats_in6,
836 sizeof (struct udp_mib)) < 0) 830 sizeof (struct udp_mib)) < 0)
837 return -ENOMEM; 831 return -ENOMEM;
832 if (snmp_mib_init((void **)net->mib.udplite_stats_in6,
833 sizeof (struct udp_mib)) < 0)
834 goto err_udplite_mib;
838 return 0; 835 return 0;
836
837err_udplite_mib:
838 snmp_mib_free((void **)net->mib.udp_stats_in6);
839 return -ENOMEM;
839} 840}
840 841
841static void __net_exit ipv6_cleanup_mibs(struct net *net) 842static void __net_exit ipv6_cleanup_mibs(struct net *net)
842{ 843{
843 snmp_mib_free((void **)net->mib.udp_stats_in6); 844 snmp_mib_free((void **)net->mib.udp_stats_in6);
845 snmp_mib_free((void **)net->mib.udplite_stats_in6);
844} 846}
845 847
846static int inet6_net_init(struct net *net) 848static int inet6_net_init(struct net *net)
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 3eaf20bf998f..c78cf754ef3f 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -182,7 +182,8 @@ static int snmp6_seq_show(struct seq_file *seq, void *v)
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 **)net->mib.udp_stats_in6, 183 snmp6_seq_show_item(seq, (void **)net->mib.udp_stats_in6,
184 snmp6_udp6_list); 184 snmp6_udp6_list);
185 snmp6_seq_show_item(seq, (void **)udplite_stats_in6, snmp6_udplite6_list); 185 snmp6_seq_show_item(seq, (void **)net->mib.udplite_stats_in6,
186 snmp6_udplite6_list);
186 return 0; 187 return 0;
187} 188}
188 189
diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c
index f6cdcb348e05..3cd1a1ac3d6c 100644
--- a/net/ipv6/udplite.c
+++ b/net/ipv6/udplite.c
@@ -13,8 +13,6 @@
13 */ 13 */
14#include "udp_impl.h" 14#include "udp_impl.h"
15 15
16DEFINE_SNMP_STAT(struct udp_mib, udplite_stats_in6) __read_mostly;
17
18static int udplitev6_rcv(struct sk_buff *skb) 16static int udplitev6_rcv(struct sk_buff *skb)
19{ 17{
20 return __udp6_lib_rcv(skb, udplite_hash, IPPROTO_UDPLITE); 18 return __udp6_lib_rcv(skb, udplite_hash, IPPROTO_UDPLITE);