diff options
author | Thomas Haller <thaller@redhat.com> | 2016-06-29 18:43:33 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-07-08 10:02:07 (GMT) |
commit | f01e93f1f9fd3ea3dade4e291b965abf3a928794 (patch) | |
tree | 509ff9323374e22d5a021d6beddfad55d9334f09 /lib/route | |
parent | c312a2a929bbd273619790a9a601f685071a995a (diff) | |
download | libnl-f01e93f1f9fd3ea3dade4e291b965abf3a928794.zip libnl-f01e93f1f9fd3ea3dade4e291b965abf3a928794.tar.gz libnl-f01e93f1f9fd3ea3dade4e291b965abf3a928794.tar.bz2 |
Diffstat (limited to 'lib/route')
-rw-r--r-- | lib/route/route.c | 2 | ||||
-rw-r--r-- | lib/route/route_obj.c | 17 |
2 files changed, 15 insertions, 4 deletions
diff --git a/lib/route/route.c b/lib/route/route.c index cb9d243..f35f2e9 100644 --- a/lib/route/route.c +++ b/lib/route/route.c @@ -40,7 +40,7 @@ uint32_t route_cache_search_attr_get(struct nl_cache *cache, * in the cache. So, look for the first object * that matches the hash key attributes */ - if ((needle->ce_msgflags & NLM_F_REPLACE) || + if ((new_route->rt_msgflags & NLM_F_REPLACE) || rtnl_route_is_likely_ipv6_multipath(new_route)) return ops->oo_hash_attrs_get(needle); else diff --git a/lib/route/route_obj.c b/lib/route/route_obj.c index f495ade..611e125 100644 --- a/lib/route/route_obj.c +++ b/lib/route/route_obj.c @@ -520,7 +520,7 @@ static int route_update(struct nl_object *old_obj, struct nl_object *new_obj, * replace. And the replace flag is only set * for the first nexthop */ - if (new_obj->ce_msgflags & NLM_F_REPLACE) + if (new_route->rt_msgflags & NLM_F_REPLACE) return -NLE_OPNOTSUPP; cloned_nh = rtnl_route_nh_clone(new_nh); @@ -548,7 +548,7 @@ static int route_update(struct nl_object *old_obj, struct nl_object *new_obj, sizeof(nbuf)); nl_object_dump_buf(old_obj, obuf, sizeof(obuf)); - NL_DBG(2, "%s: ignoring duplicate nexthop: ce_msgflags = (%x, %x), rt_flags = (%x, %x), rtnh_flags = (%x, %x), objs = (%s, %s)\n", __FUNCTION__, old_obj->ce_msgflags, new_obj->ce_msgflags, old_route->rt_flags, new_route->rt_flags, old_nh->rtnh_flags, new_nh->rtnh_flags, obuf, nbuf); + NL_DBG(2, "%s: ignoring duplicate nexthop: ce_msgflags = (%x, %x), rt_flags = (%x, %x), rtnh_flags = (%x, %x), objs = (%s, %s)\n", __FUNCTION__, old_route->rt_msgflags, new_route->rt_msgflags, old_route->rt_flags, new_route->rt_flags, old_nh->rtnh_flags, new_nh->rtnh_flags, obuf, nbuf); } #endif rtnl_route_nh_free(cloned_nh); @@ -639,6 +639,15 @@ static char *route_attrs2str(int attrs, char *buf, size_t len) ARRAY_SIZE(route_attrs)); } +static int route_check_objflags(struct nl_object *obj, enum oo_objflags flags) +{ + if (flags & OO_OBJFLAGS_CACHE_APPEND) { + if (((struct rtnl_route *) obj)->rt_msgflags & NLM_F_APPEND) + return 1; + } + return 0; +} + /** * @name Allocation/Freeing * @{ @@ -1097,7 +1106,8 @@ int rtnl_route_parse(struct nlmsghdr *nlh, struct rtnl_route **result) } route->ce_msgtype = nlh->nlmsg_type; - route->ce_msgflags = nlh->nlmsg_flags; + + route->rt_msgflags = nlh->nlmsg_flags; err = nlmsg_parse(nlh, sizeof(struct rtmsg), tb, RTA_MAX, route_policy); if (err < 0) @@ -1384,6 +1394,7 @@ struct nl_object_ops route_obj_ops = { .oo_keygen = route_keygen, .oo_update = route_update, .oo_attrs2str = route_attrs2str, + .oo_check_objflags = route_check_objflags, .oo_id_attrs = (ROUTE_ATTR_FAMILY | ROUTE_ATTR_TOS | ROUTE_ATTR_TABLE | ROUTE_ATTR_DST | ROUTE_ATTR_PRIO), |