summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoopa Prabhu <roopa@cumulusnetworks.com>2017-02-10 05:15:26 (GMT)
committerThomas Haller <thaller@redhat.com>2017-02-27 13:15:15 (GMT)
commit9b22e310cec08e8a89f7e05dc7b69fa20085034c (patch)
tree48baa38797e252be78a2d6ff13b184c0d873f1ef /lib
parenteabd9f2334aee545fc7656966762d999a727d735 (diff)
downloadlibnl-9b22e310cec08e8a89f7e05dc7b69fa20085034c.zip
libnl-9b22e310cec08e8a89f7e05dc7b69fa20085034c.tar.gz
libnl-9b22e310cec08e8a89f7e05dc7b69fa20085034c.tar.bz2
route: neigh: use NDA_MASTER for neigh->n_master if available
fdb cache is per bridge and hence hashed by: <bridge_ifindex, family, mac> newer kernels send bridge ifindex in NDA_MASTER. Use NDA_MASTER for neigh->n_master when available. Also imports a few more NDA_* attributes from upstream to keep linux/neighbour.h NDA_* attributes in sync with upstream. Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/route/neigh.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/route/neigh.c b/lib/route/neigh.c
index c8979ab..966f45d 100644
--- a/lib/route/neigh.c
+++ b/lib/route/neigh.c
@@ -422,17 +422,21 @@ int rtnl_neigh_parse(struct nlmsghdr *n, struct rtnl_neigh **result)
* Get the bridge index for AF_BRIDGE family entries
*/
if (neigh->n_family == AF_BRIDGE) {
- struct nl_cache *lcache = nl_cache_mngt_require_safe("route/link");
- if (lcache ) {
- struct rtnl_link *link = rtnl_link_get(lcache,
- neigh->n_ifindex);
- if (link) {
- neigh->n_master = link->l_master;
- rtnl_link_put(link);
- neigh->ce_mask |= NEIGH_ATTR_MASTER;
+ if (tb[NDA_MASTER]) {
+ neigh->n_master = nla_get_u32(tb[NDA_MASTER]);
+ neigh->ce_mask |= NEIGH_ATTR_MASTER;
+ } else {
+ struct nl_cache *lcache = nl_cache_mngt_require_safe("route/link");
+ if (lcache ) {
+ struct rtnl_link *link = rtnl_link_get(lcache,
+ neigh->n_ifindex);
+ if (link) {
+ neigh->n_master = link->l_master;
+ rtnl_link_put(link);
+ neigh->ce_mask |= NEIGH_ATTR_MASTER;
+ }
+ nl_cache_put(lcache);
}
-
- nl_cache_put(lcache);
}
}