aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/ipv6.h10
-rw-r--r--include/net/netns/mib.h3
-rw-r--r--net/ipv6/af_inet6.c38
-rw-r--r--net/ipv6/proc.c8
4 files changed, 28 insertions, 31 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index d0538dd2c44b..6d5b58a1c743 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -113,23 +113,20 @@ extern struct ctl_path net_ipv6_ctl_path[];
113#define _DEVINC(net, statname, modifier, idev, field) \ 113#define _DEVINC(net, statname, modifier, idev, field) \
114({ \ 114({ \
115 struct inet6_dev *_idev = (idev); \ 115 struct inet6_dev *_idev = (idev); \
116 (void)(net); \
117 if (likely(_idev != NULL)) \ 116 if (likely(_idev != NULL)) \
118 SNMP_INC_STATS##modifier((_idev)->stats.statname, (field)); \ 117 SNMP_INC_STATS##modifier((_idev)->stats.statname, (field)); \
119 SNMP_INC_STATS##modifier(statname##_statistics, (field)); \ 118 SNMP_INC_STATS##modifier((net)->mib.statname##_statistics, (field));\
120}) 119})
121 120
122#define _DEVADD(net, statname, modifier, idev, field, val) \ 121#define _DEVADD(net, statname, modifier, idev, field, val) \
123({ \ 122({ \
124 struct inet6_dev *_idev = (idev); \ 123 struct inet6_dev *_idev = (idev); \
125 (void)(net); \
126 if (likely(_idev != NULL)) \ 124 if (likely(_idev != NULL)) \
127 SNMP_ADD_STATS##modifier((_idev)->stats.statname, (field), (val)); \ 125 SNMP_ADD_STATS##modifier((_idev)->stats.statname, (field), (val)); \
128 SNMP_ADD_STATS##modifier(statname##_statistics, (field), (val));\ 126 SNMP_ADD_STATS##modifier((net)->mib.statname##_statistics, (field), (val));\
129}) 127})
130 128
131/* MIBs */ 129/* MIBs */
132DECLARE_SNMP_STAT(struct ipstats_mib, ipv6_statistics);
133 130
134#define IP6_INC_STATS(net, idev,field) \ 131#define IP6_INC_STATS(net, idev,field) \
135 _DEVINC(net, ipv6, , idev, field) 132 _DEVINC(net, ipv6, , idev, field)
@@ -138,9 +135,6 @@ DECLARE_SNMP_STAT(struct ipstats_mib, ipv6_statistics);
138#define IP6_ADD_STATS_BH(net, idev,field,val) \ 135#define IP6_ADD_STATS_BH(net, idev,field,val) \
139 _DEVADD(net, ipv6, _BH, idev, field, val) 136 _DEVADD(net, ipv6, _BH, idev, field, val)
140 137
141DECLARE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics);
142DECLARE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics);
143
144#define ICMP6_INC_STATS(net, idev, field) \ 138#define ICMP6_INC_STATS(net, idev, field) \
145 _DEVINC(net, icmpv6, , idev, field) 139 _DEVINC(net, icmpv6, , idev, field)
146#define ICMP6_INC_STATS_BH(net, idev, field) \ 140#define ICMP6_INC_STATS_BH(net, idev, field) \
diff --git a/include/net/netns/mib.h b/include/net/netns/mib.h
index 4e58f0519ce8..10cb7c336de5 100644
--- a/include/net/netns/mib.h
+++ b/include/net/netns/mib.h
@@ -16,6 +16,9 @@ struct netns_mib {
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 DEFINE_SNMP_STAT(struct udp_mib, udplite_stats_in6);
19 DEFINE_SNMP_STAT(struct ipstats_mib, ipv6_statistics);
20 DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics);
21 DEFINE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics);
19#endif 22#endif
20}; 23};
21 24
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 127b240d2d81..6b509d7700de 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -797,31 +797,11 @@ static void ipv6_packet_cleanup(void)
797 797
798static int __init init_ipv6_mibs(void) 798static int __init init_ipv6_mibs(void)
799{ 799{
800 if (snmp_mib_init((void **)ipv6_statistics,
801 sizeof(struct ipstats_mib)) < 0)
802 goto err_ip_mib;
803 if (snmp_mib_init((void **)icmpv6_statistics,
804 sizeof(struct icmpv6_mib)) < 0)
805 goto err_icmp_mib;
806 if (snmp_mib_init((void **)icmpv6msg_statistics,
807 sizeof(struct icmpv6msg_mib)) < 0)
808 goto err_icmpmsg_mib;
809 return 0; 800 return 0;
810
811err_icmpmsg_mib:
812 snmp_mib_free((void **)icmpv6_statistics);
813err_icmp_mib:
814 snmp_mib_free((void **)ipv6_statistics);
815err_ip_mib:
816 return -ENOMEM;
817
818} 801}
819 802
820static void cleanup_ipv6_mibs(void) 803static void cleanup_ipv6_mibs(void)
821{ 804{
822 snmp_mib_free((void **)ipv6_statistics);
823 snmp_mib_free((void **)icmpv6_statistics);
824 snmp_mib_free((void **)icmpv6msg_statistics);
825} 805}
826 806
827static int __net_init ipv6_init_mibs(struct net *net) 807static int __net_init ipv6_init_mibs(struct net *net)
@@ -832,8 +812,23 @@ static int __net_init ipv6_init_mibs(struct net *net)
832 if (snmp_mib_init((void **)net->mib.udplite_stats_in6, 812 if (snmp_mib_init((void **)net->mib.udplite_stats_in6,
833 sizeof (struct udp_mib)) < 0) 813 sizeof (struct udp_mib)) < 0)
834 goto err_udplite_mib; 814 goto err_udplite_mib;
815 if (snmp_mib_init((void **)net->mib.ipv6_statistics,
816 sizeof(struct ipstats_mib)) < 0)
817 goto err_ip_mib;
818 if (snmp_mib_init((void **)net->mib.icmpv6_statistics,
819 sizeof(struct icmpv6_mib)) < 0)
820 goto err_icmp_mib;
821 if (snmp_mib_init((void **)net->mib.icmpv6msg_statistics,
822 sizeof(struct icmpv6msg_mib)) < 0)
823 goto err_icmpmsg_mib;
835 return 0; 824 return 0;
836 825
826err_icmpmsg_mib:
827 snmp_mib_free((void **)net->mib.icmpv6_statistics);
828err_icmp_mib:
829 snmp_mib_free((void **)net->mib.ipv6_statistics);
830err_ip_mib:
831 snmp_mib_free((void **)net->mib.udplite_stats_in6);
837err_udplite_mib: 832err_udplite_mib:
838 snmp_mib_free((void **)net->mib.udp_stats_in6); 833 snmp_mib_free((void **)net->mib.udp_stats_in6);
839 return -ENOMEM; 834 return -ENOMEM;
@@ -843,6 +838,9 @@ static void __net_exit ipv6_cleanup_mibs(struct net *net)
843{ 838{
844 snmp_mib_free((void **)net->mib.udp_stats_in6); 839 snmp_mib_free((void **)net->mib.udp_stats_in6);
845 snmp_mib_free((void **)net->mib.udplite_stats_in6); 840 snmp_mib_free((void **)net->mib.udplite_stats_in6);
841 snmp_mib_free((void **)net->mib.ipv6_statistics);
842 snmp_mib_free((void **)net->mib.icmpv6_statistics);
843 snmp_mib_free((void **)net->mib.icmpv6msg_statistics);
846} 844}
847 845
848static int inet6_net_init(struct net *net) 846static int inet6_net_init(struct net *net)
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index c78cf754ef3f..07f0b76e7427 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -177,9 +177,11 @@ static int snmp6_seq_show(struct seq_file *seq, void *v)
177{ 177{
178 struct net *net = (struct net *)seq->private; 178 struct net *net = (struct net *)seq->private;
179 179
180 snmp6_seq_show_item(seq, (void **)ipv6_statistics, snmp6_ipstats_list); 180 snmp6_seq_show_item(seq, (void **)net->mib.ipv6_statistics,
181 snmp6_seq_show_item(seq, (void **)icmpv6_statistics, snmp6_icmp6_list); 181 snmp6_ipstats_list);
182 snmp6_seq_show_icmpv6msg(seq, (void **)icmpv6msg_statistics); 182 snmp6_seq_show_item(seq, (void **)net->mib.icmpv6_statistics,
183 snmp6_icmp6_list);
184 snmp6_seq_show_icmpv6msg(seq, (void **)net->mib.icmpv6msg_statistics);
183 snmp6_seq_show_item(seq, (void **)net->mib.udp_stats_in6, 185 snmp6_seq_show_item(seq, (void **)net->mib.udp_stats_in6,
184 snmp6_udp6_list); 186 snmp6_udp6_list);
185 snmp6_seq_show_item(seq, (void **)net->mib.udplite_stats_in6, 187 snmp6_seq_show_item(seq, (void **)net->mib.udplite_stats_in6,