diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2017-08-20 02:25:12 +0200 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2017-08-23 22:45:17 +0200 |
commit | bb1b9c47ca090ce4484e1f8061f17b5c33f578ee (patch) | |
tree | 0b6f114b78a84f0dffeb7de41a685d33e152879e /lib/zclient.h | |
parent | zserv: identify label type based on the client protocol (diff) | |
download | frr-bb1b9c47ca090ce4484e1f8061f17b5c33f578ee.tar.xz frr-bb1b9c47ca090ce4484e1f8061f17b5c33f578ee.zip |
lib: updates to zapi_route
This patch introduces the following changes to the zapi_route structure
and associated code:
* Use a fixed-size array to store the nexthops instead of a pointer. This
makes the zapi_route() function much easier to use when we have multiple
nexthops to send. It's also much more efficient to put everything on
the stack rather than allocating an array in the heap every time we
need to send a route to zebra;
* Use the new 'zapi_nexthop' structure. This will allow the client daemons
to send labeled routes without having to allocate memory for the labels
(the 'nexthop' structure was designed to be memory efficient and doesn't
have room for MPLS labels, only a pointer). Also, 'zapi_nexthop' is more
compact and more clean from an API perspective;
* Embed the route prefix inside the zapi_route structure. Since the
route's prefix is sent along with its nexthops and attributes, it makes
sense to pack everything inside the same structure.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/zclient.h')
-rw-r--r-- | lib/zclient.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/zclient.h b/lib/zclient.h index ddd965544..92aeabb07 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -224,6 +224,13 @@ struct zserv_header { uint16_t command; }; +struct zapi_nexthop { + enum nexthop_types_t type; + ifindex_t ifindex; + union g_addr gate; + mpls_label_t label; +}; + struct zapi_route { u_char type; u_short instance; @@ -234,8 +241,11 @@ struct zapi_route { safi_t safi; + struct prefix prefix; + struct prefix_ipv6 src_prefix; + u_char nexthop_num; - struct nexthop **nexthop; + struct zapi_nexthop nexthops[MULTIPATH_NUM]; u_char distance; @@ -416,7 +426,7 @@ extern int zapi_ipv6_route(u_char cmd, struct zclient *zclient, extern int zapi_ipv4_route_ipv6_nexthop(u_char, struct zclient *, struct prefix_ipv4 *, struct zapi_ipv6 *); -extern int zapi_route(u_char cmd, struct zclient *zclient, struct prefix *p, - struct prefix_ipv6 *src_p, struct zapi_route *api); +extern int zapi_route(u_char cmd, struct zclient *zclient, + struct zapi_route *api); #endif /* _ZEBRA_ZCLIENT_H */ |