summaryrefslogtreecommitdiffstats
path: root/babeld
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2017-08-20 02:59:41 +0200
committerRenato Westphal <renato@opensourcerouting.org>2017-08-23 22:45:17 +0200
commit0e51b4a368257d54b1e07ff74492ea4705de97f7 (patch)
treec213ed50bdf21a94fd031cc6abd838bff3c343e4 /babeld
parentlib: updates to zapi_route (diff)
downloadfrr-0e51b4a368257d54b1e07ff74492ea4705de97f7.tar.xz
frr-0e51b4a368257d54b1e07ff74492ea4705de97f7.zip
lib/zserv: introduce address-family independent ZAPI message types
As noticed in 657cde1, the zapi_ipv[4|6]_route functions are broken in many ways and that's the reason that many client daemons (e.g. ospfd, isisd) need to send handcrafted messages to zebra. The zapi_route() function introduced by Donald solves the problem by providing a consistent way to send ipv4/ipv6 routes to zebra with nexthops of any type, in all possible combinations including IPv4 routes with IPv6 nexthops (for BGP unnumbered routes). This patch goes a bit further and creates two new address-family independent ZAPI message types that the client daemons can use to advertise route information to zebra: ZEBRA_ROUTE_ADD and ZEBRA_ROUTE_DELETE. The big advantage of having address-family independent messages is that it allows us to remove a lot of duplicate code in zebra and in the client daemons. This patch also introduces the zapi_route_decode() function. It will be used by zebra to decode route messages sent by the client daemons using zclient_route_send(), which calls zapi_route_encode(). Later on we'll use this same pair of encode/decode functions to send/receive redistributed routes from zebra to the client daemons, taking the idea of removing code duplication to the next level. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'babeld')
-rw-r--r--babeld/kernel.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/babeld/kernel.c b/babeld/kernel.c
index 105a7d051..6cdd66e48 100644
--- a/babeld/kernel.c
+++ b/babeld/kernel.c
@@ -190,9 +190,8 @@ kernel_route_v4(int add,
debugf(BABEL_DEBUG_ROUTE, "%s route (ipv4) to zebra",
add ? "adding" : "removing" );
- return zapi_route (add ? ZEBRA_IPV4_ROUTE_ADD :
- ZEBRA_IPV4_ROUTE_DELETE,
- zclient, &api);
+ return zclient_route_send (add ? ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE,
+ zclient, &api);
}
static int
@@ -242,9 +241,8 @@ kernel_route_v6(int add, const unsigned char *pref, unsigned short plen,
debugf(BABEL_DEBUG_ROUTE, "%s route (ipv6) to zebra",
add ? "adding" : "removing" );
- return zapi_route (add ? ZEBRA_IPV6_ROUTE_ADD :
- ZEBRA_IPV6_ROUTE_DELETE,
- zclient, &api);
+ return zclient_route_send (add ? ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE,
+ zclient, &api);
}
int