diff options
author | Roopa Prabhu <roopa@cumulusnetworks.com> | 2016-06-18 22:30:09 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-07-08 10:02:07 (GMT) |
commit | d62f1960fe76fd68072f9479a78f59118e25603c (patch) | |
tree | 6dd1f4ccfe19af7f5a6dcebe0a92283c0b13b772 /include | |
parent | 95e778f1498bffbc174b6c0c8fd16eae2a7afbf6 (diff) | |
download | libnl-d62f1960fe76fd68072f9479a78f59118e25603c.zip libnl-d62f1960fe76fd68072f9479a78f59118e25603c.tar.gz libnl-d62f1960fe76fd68072f9479a78f59118e25603c.tar.bz2 |
route: cache and object changes to support non-exclusive and append routes
Problem (ipv4 only):
Todays libnl route cache looks at prefix + tos + priority to lookup a
route object. To support route append operation, where routes with same
prefix + tos + priority but different nexthop information can co-exist,
we need to also look at nexthop info. Else we will wrongly store only
one route for all appended routes. This happens Because the libnl cache
inclusion process looks up a route by prefix + tos + priority and replaces
it with the new object with the same prefix + tos + priority.
Only adding nexthop attribute during lookup does not solve the whole
problem. Because NLM_F_REPLACE of objects needs special handling.
This patch implements route cache callback .co_cache_search_attrs_get and
route object callback .oo_hash_attrs_get to return appropriate attributes
for searching route objects depending on type of route and the netlink message
flags (NLM_F_APPEND or NLM_F_REPLACE). This is used during cache inclusion
process. Also adds ROUTE_ATTR_MULTIPATH to the list of route attribute keys to
search.
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/netlink/route/nexthop.h | 1 | ||||
-rw-r--r-- | include/netlink/route/route.h | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/include/netlink/route/nexthop.h b/include/netlink/route/nexthop.h index 2aa44dc..0ce75cb 100644 --- a/include/netlink/route/nexthop.h +++ b/include/netlink/route/nexthop.h @@ -32,6 +32,7 @@ extern struct rtnl_nexthop * rtnl_route_nh_alloc(void); extern struct rtnl_nexthop * rtnl_route_nh_clone(struct rtnl_nexthop *); extern void rtnl_route_nh_free(struct rtnl_nexthop *); +extern uint32_t rtnl_route_nh_id_attrs(void); extern int rtnl_route_nh_compare(struct rtnl_nexthop *, struct rtnl_nexthop *, uint32_t, int); diff --git a/include/netlink/route/route.h b/include/netlink/route/route.h index 477250d..5ab17fe 100644 --- a/include/netlink/route/route.h +++ b/include/netlink/route/route.h @@ -46,6 +46,12 @@ struct rtnl_rtcacheinfo uint32_t rtci_tsage; }; +#define rtnl_route_is_likely_ipv6_multipath(route) \ + (route->rt_family == AF_INET6 && \ + route->rt_table != RT_TABLE_LOCAL && \ + rtnl_route_get_nnexthops(route) == 1 && \ + rtnl_route_nh_get_gateway(rtnl_route_nexthop_n(route, 0))) + extern struct nl_object_ops route_obj_ops; extern struct rtnl_route * rtnl_route_alloc(void); @@ -97,6 +103,8 @@ extern int rtnl_route_get_src_len(struct rtnl_route *); extern void rtnl_route_add_nexthop(struct rtnl_route *, struct rtnl_nexthop *); +extern void rtnl_route_add_nexthop_head(struct rtnl_route *, + struct rtnl_nexthop *); extern void rtnl_route_remove_nexthop(struct rtnl_route *, struct rtnl_nexthop *); extern struct nl_list_head *rtnl_route_get_nexthops(struct rtnl_route *); |