diff options
author | Thomas Graf <tgraf@suug.ch> | 2010-11-11 21:26:11 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2010-11-11 21:26:11 (GMT) |
commit | 7ff4deeb56300a83a1bee091d3664fd588ac7837 (patch) | |
tree | dda1f357ef9b91e9fe1bef82229f1aeb3215579a /include | |
parent | 2847cf081b88678a2bb780c59a2678131d47c11d (diff) | |
download | libnl-7ff4deeb56300a83a1bee091d3664fd588ac7837.zip libnl-7ff4deeb56300a83a1bee091d3664fd588ac7837.tar.gz libnl-7ff4deeb56300a83a1bee091d3664fd588ac7837.tar.bz2 |
Extend rtnl_link_alloc_cache() to support address families
Adds a family argument which allows to request link dumps for a certain
address family. This allows to f.e. dump ipv6 specific statistics and data.
nl-link-list --family inet6
Diffstat (limited to 'include')
-rw-r--r-- | include/netlink-local.h | 3 | ||||
-rw-r--r-- | include/netlink/cli/link.h | 5 | ||||
-rw-r--r-- | include/netlink/route/link.h | 34 |
3 files changed, 38 insertions, 4 deletions
diff --git a/include/netlink-local.h b/include/netlink-local.h index e9310ea..59f1d61 100644 --- a/include/netlink-local.h +++ b/include/netlink-local.h @@ -49,6 +49,9 @@ #include <linux/ip_mp_alg.h> #include <linux/atm.h> +#include <linux/ipv6.h> +#include <linux/snmp.h> + #include <netlink/netlink.h> #include <netlink/handlers.h> #include <netlink/cache.h> diff --git a/include/netlink/cli/link.h b/include/netlink/cli/link.h index 7fe4972..3f37948 100644 --- a/include/netlink/cli/link.h +++ b/include/netlink/cli/link.h @@ -15,10 +15,9 @@ #include <netlink/route/link.h> #include <netlink/cli/utils.h> -#define nl_cli_link_alloc_cache(sk) \ - nl_cli_alloc_cache((sk), "link", rtnl_link_alloc_cache) - extern struct rtnl_link *nl_cli_link_alloc(void); +extern struct nl_cache *nl_cli_link_alloc_cache_family(struct nl_sock *, int); +extern struct nl_cache *nl_cli_link_alloc_cache(struct nl_sock *); extern void nl_cli_link_parse_family(struct rtnl_link *, char *); extern void nl_cli_link_parse_name(struct rtnl_link *, char *); diff --git a/include/netlink/route/link.h b/include/netlink/route/link.h index 39eea0a..1949353 100644 --- a/include/netlink/route/link.h +++ b/include/netlink/route/link.h @@ -46,6 +46,36 @@ enum rtnl_link_st { RTNL_LINK_TX_WIN_ERR, RTNL_LINK_COLLISIONS, RTNL_LINK_MULTICAST, + RTNL_LINK_INPKTS, /* InReceives */ + RTNL_LINK_INHDRERRORS, /* InHdrErrors */ + RTNL_LINK_INTOOBIGERRORS, /* InTooBigErrors */ + RTNL_LINK_INNOROUTES, /* InNoRoutes */ + RTNL_LINK_INADDRERRORS, /* InAddrErrors */ + RTNL_LINK_INUNKNOWNPROTOS, /* InUnknownProtos */ + RTNL_LINK_INTRUNCATEDPKTS, /* InTruncatedPkts */ + RTNL_LINK_INDISCARDS, /* InDiscards */ + RTNL_LINK_INDELIVERS, /* InDelivers */ + RTNL_LINK_OUTFORWDATAGRAMS, /* OutForwDatagrams */ + RTNL_LINK_OUTPKTS, /* OutRequests */ + RTNL_LINK_OUTDISCARDS, /* OutDiscards */ + RTNL_LINK_OUTNOROUTES, /* OutNoRoutes */ + RTNL_LINK_REASMTIMEOUT, /* ReasmTimeout */ + RTNL_LINK_REASMREQDS, /* ReasmReqds */ + RTNL_LINK_REASMOKS, /* ReasmOKs */ + RTNL_LINK_REASMFAILS, /* ReasmFails */ + RTNL_LINK_FRAGOKS, /* FragOKs */ + RTNL_LINK_FRAGFAILS, /* FragFails */ + RTNL_LINK_FRAGCREATES, /* FragCreates */ + RTNL_LINK_INMCASTPKTS, /* InMcastPkts */ + RTNL_LINK_OUTMCASTPKTS, /* OutMcastPkts */ + RTNL_LINK_INBCASTPKTS, /* InBcastPkts */ + RTNL_LINK_OUTBCASTPKTS, /* OutBcastPkts */ + RTNL_LINK_INOCTETS, /* InOctets */ + RTNL_LINK_OUTOCTETS, /* OutOctets */ + RTNL_LINK_INMCASTOCTETS, /* InMcastOctets */ + RTNL_LINK_OUTMCASTOCTETS, /* OutMcastOctets */ + RTNL_LINK_INBCASTOCTETS, /* InBcastOctets */ + RTNL_LINK_OUTBCASTOCTETS, /* OutBcastOctets */ __RTNL_LINK_STATS_MAX, }; @@ -57,7 +87,7 @@ extern void rtnl_link_put(struct rtnl_link *); extern void rtnl_link_free(struct rtnl_link *); /* link cache management */ -extern int rtnl_link_alloc_cache(struct nl_sock *, struct nl_cache **); +extern int rtnl_link_alloc_cache(struct nl_sock *, int, struct nl_cache **); extern struct rtnl_link *rtnl_link_get(struct nl_cache *, int); extern struct rtnl_link *rtnl_link_get_by_name(struct nl_cache *, const char *); @@ -139,6 +169,8 @@ extern void rtnl_link_set_ifalias(struct rtnl_link *, const char *); extern int rtnl_link_get_num_vf(struct rtnl_link *, uint32_t *); extern uint64_t rtnl_link_get_stat(struct rtnl_link *, int); +extern int rtnl_link_set_stat(struct rtnl_link *, const unsigned int, + const uint64_t); extern int rtnl_link_set_info_type(struct rtnl_link *, const char *); extern char * rtnl_link_get_info_type(struct rtnl_link *); |