diff options
author | Thomas Graf <tgraf@suug.ch> | 2013-02-01 09:41:45 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2013-02-01 09:45:01 (GMT) |
commit | 8571f58f23763d8db7365d02c9b27832ad3d7005 (patch) | |
tree | cfbebfbcf15375b36e8fff405433498935ee6d3f /lib/route | |
parent | 2005c2ecacdf5e1ba5be630c85f1288eeb8ad6af (diff) | |
download | libnl-8571f58f23763d8db7365d02c9b27832ad3d7005.zip libnl-8571f58f23763d8db7365d02c9b27832ad3d7005.tar.gz libnl-8571f58f23763d8db7365d02c9b27832ad3d7005.tar.bz2 |
neigh: Remove check for AF_UNSPEC in rtnl_neigh_get()
This check was introduces to not accidently return AF_BRIDGE objects
to unaware API users as they do differ in structure. However, such
objects are only available if explicitely requests using the
NL_CACHE_AF_ITER flag or by using arg1 == AF_BRIDGE for the cache.
Therefore remove this check and allow rtnl_neigh_get() to be used to
fetch any neighbor object of a cache.
Reported-by: Maxime Bizon <mbizon@freebox.fr>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Diffstat (limited to 'lib/route')
-rw-r--r-- | lib/route/neigh.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/route/neigh.c b/lib/route/neigh.c index c0f80a2..288bb85 100644 --- a/lib/route/neigh.c +++ b/lib/route/neigh.c @@ -532,6 +532,7 @@ int rtnl_neigh_alloc_cache(struct nl_sock *sock, struct nl_cache **result) * @arg cache neighbour cache * @arg ifindex interface index the neighbour is on * @arg dst destination address of the neighbour + * * @return neighbour handle or NULL if no match was found. */ struct rtnl_neigh * rtnl_neigh_get(struct nl_cache *cache, int ifindex, @@ -540,8 +541,7 @@ struct rtnl_neigh * rtnl_neigh_get(struct nl_cache *cache, int ifindex, struct rtnl_neigh *neigh; nl_list_for_each_entry(neigh, &cache->c_items, ce_list) { - if (neigh->n_family == AF_UNSPEC && - neigh->n_ifindex == ifindex && + if (neigh->n_ifindex == ifindex && !nl_addr_cmp(neigh->n_dst, dst)) { nl_object_get((struct nl_object *) neigh); return neigh; |