diff options
author | David Ahern <dsa@cumulusnetworks.com> | 2015-10-27 22:40:48 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-11-19 15:48:21 (GMT) |
commit | 18d60cb9d72f61f2070f3758bcd347bb2e3747c1 (patch) | |
tree | 56b5794a49531dc4ebaa6d1511196ba8e3b8a95d /src/lib/link.c | |
parent | 7ea15f60a726de67f02e6868a8125a59570e956d (diff) | |
download | libnl-18d60cb9d72f61f2070f3758bcd347bb2e3747c1.zip libnl-18d60cb9d72f61f2070f3758bcd347bb2e3747c1.tar.gz libnl-18d60cb9d72f61f2070f3758bcd347bb2e3747c1.tar.bz2 |
link/neigh: add flags option to link and neighbor caches
Both link and neighbor cache support specify multiple groups (nl_af_group),
but the alloc_cache functions for both do not set the NL_CACHE_AF_ITER
flag before populating the cache so only the first group is used by
default. This patch adds an API to pass in flags to make that happen
and updates the nl-neigh-list command to make use of it.
http://lists.infradead.org/pipermail/libnl/2015-October/001996.html
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'src/lib/link.c')
-rw-r--r-- | src/lib/link.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/lib/link.c b/src/lib/link.c index 5bce824..eb5b54b 100644 --- a/src/lib/link.c +++ b/src/lib/link.c @@ -31,12 +31,14 @@ struct rtnl_link *nl_cli_link_alloc(void) return link; } -struct nl_cache *nl_cli_link_alloc_cache_family(struct nl_sock *sock, int family) +struct nl_cache *nl_cli_link_alloc_cache_family_flags(struct nl_sock *sock, + int family, + unsigned int flags) { struct nl_cache *cache; int err; - if ((err = rtnl_link_alloc_cache(sock, family, &cache)) < 0) + if ((err = rtnl_link_alloc_cache_flags(sock, family, &cache, flags)) < 0) nl_cli_fatal(err, "Unable to allocate link cache: %s", nl_geterror(err)); @@ -45,11 +47,22 @@ struct nl_cache *nl_cli_link_alloc_cache_family(struct nl_sock *sock, int family return cache; } +struct nl_cache *nl_cli_link_alloc_cache_family(struct nl_sock *sock, int family) +{ + return nl_cli_link_alloc_cache_family_flags(sock, family, 0); +} + struct nl_cache *nl_cli_link_alloc_cache(struct nl_sock *sock) { return nl_cli_link_alloc_cache_family(sock, AF_UNSPEC); } +struct nl_cache *nl_cli_link_alloc_cache_flags(struct nl_sock *sock, + unsigned int flags) +{ + return nl_cli_link_alloc_cache_family_flags(sock, AF_UNSPEC, flags); +} + void nl_cli_link_parse_family(struct rtnl_link *link, char *arg) { int family; |