diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2007-04-20 18:56:20 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:29:10 -0400 |
commit | bf99f1bde3b3009af74874f3465f6861431fbb66 (patch) | |
tree | ec3ee5ca8e95e090d65671d74994b7729058c845 /net/ipv6/proc.c | |
parent | 628a5c561890a9a9a74dea017873530584aab06e (diff) |
[IPV6] SNMP: Netlink interface.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/proc.c')
-rw-r--r-- | net/ipv6/proc.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index fa3fb509f187..0dc551501519 100644 --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c | |||
@@ -207,6 +207,31 @@ static const struct file_operations snmp6_seq_fops = { | |||
207 | .release = single_release, | 207 | .release = single_release, |
208 | }; | 208 | }; |
209 | 209 | ||
210 | static inline void | ||
211 | __snmp6_fill_stats(u64 *stats, void **mib, int items, int bytes) | ||
212 | { | ||
213 | int i; | ||
214 | int pad = bytes - sizeof(u64) * items; | ||
215 | BUG_ON(pad < 0); | ||
216 | stats[0] = items; | ||
217 | for (i = 1; i < items; i++) | ||
218 | stats[i] = (u64)fold_field(mib, i); | ||
219 | memset(&stats[items], 0, pad); | ||
220 | } | ||
221 | |||
222 | void | ||
223 | snmp6_fill_stats(u64 *stats, struct inet6_dev *idev, int attrtype, int bytes) | ||
224 | { | ||
225 | switch(attrtype) { | ||
226 | case IFLA_INET6_STATS: | ||
227 | __snmp6_fill_stats(stats, (void **)idev->stats.ipv6, IPSTATS_MIB_MAX, bytes); | ||
228 | break; | ||
229 | case IFLA_INET6_ICMP6STATS: | ||
230 | __snmp6_fill_stats(stats, (void **)idev->stats.icmpv6, ICMP6_MIB_MAX, bytes); | ||
231 | break; | ||
232 | } | ||
233 | } | ||
234 | |||
210 | int snmp6_register_dev(struct inet6_dev *idev) | 235 | int snmp6_register_dev(struct inet6_dev *idev) |
211 | { | 236 | { |
212 | struct proc_dir_entry *p; | 237 | struct proc_dir_entry *p; |
@@ -283,6 +308,13 @@ int snmp6_unregister_dev(struct inet6_dev *idev) | |||
283 | { | 308 | { |
284 | return 0; | 309 | return 0; |
285 | } | 310 | } |
311 | |||
312 | void | ||
313 | snmp6_fill_stats(u64 *stats, struct inet6_dev *idev, int attrtype, int bytes) | ||
314 | { | ||
315 | memset(stats, 0, sizeof(bytes)); | ||
316 | } | ||
317 | |||
286 | #endif /* CONFIG_PROC_FS */ | 318 | #endif /* CONFIG_PROC_FS */ |
287 | 319 | ||
288 | int snmp6_alloc_dev(struct inet6_dev *idev) | 320 | int snmp6_alloc_dev(struct inet6_dev *idev) |