diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2016-10-05 17:58:01 -0300 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-10-18 08:51:23 -0400 |
| commit | a695cc7b8089ca25d277c168e5ceba6955d9daf6 (patch) | |
| tree | a445b0bf1b5a229f40a1d2cd905a8ab512d93112 /ldpd/ldp_zebra.c | |
| parent | f9164b1d74f6a20d69d7ef10d2e39b4ae7996cbf (diff) | |
zebra/ldpd: introduce ZEBRA_ROUTE_ALL wildcard route type
The ZEBRA_ROUTE_ALL route type can be used by a client to request
all routes from zebra. The main motivation for introducing this is
to allow ldpd to get routes from all OSPF instances, not only from
the default one. Without ZEBRA_ROUTE_ALL, ldpd would need to send a
ZEBRA_REDISTRIBUTE_ADD message for each possible OSPF instance (65k),
which doesn't scale very well.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ldpd/ldp_zebra.c')
| -rw-r--r-- | ldpd/ldp_zebra.c | 45 |
1 files changed, 14 insertions, 31 deletions
diff --git a/ldpd/ldp_zebra.c b/ldpd/ldp_zebra.c index b796b6f6d6..71c0a21dd4 100644 --- a/ldpd/ldp_zebra.c +++ b/ldpd/ldp_zebra.c @@ -359,8 +359,17 @@ ldp_zebra_read_route(int command, struct zclient *zclient, zebra_size_t length, s = zclient->ibuf; type = stream_getc(s); - if (type == ZEBRA_ROUTE_CONNECT) + switch (type) { + case ZEBRA_ROUTE_CONNECT: kr.flags |= F_CONNECTED; + break; + case ZEBRA_ROUTE_BGP: + /* LDP should follow the IGP and ignore BGP routes */ + return (0); + default: + break; + } + stream_getl(s); /* flags, unused */ stream_getw(s); /* instance, unused */ message_flags = stream_getc(s); @@ -448,37 +457,11 @@ ldp_zebra_read_route(int command, struct zclient *zclient, zebra_size_t length, static void ldp_zebra_connected(struct zclient *zclient) { - int i; - zclient_send_reg_requests(zclient, VRF_DEFAULT); - - for (i = 0; i < ZEBRA_ROUTE_MAX; i++) { - switch (i) { - case ZEBRA_ROUTE_KERNEL: - case ZEBRA_ROUTE_CONNECT: - case ZEBRA_ROUTE_STATIC: - case ZEBRA_ROUTE_ISIS: - zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient, - AFI_IP, i, 0, VRF_DEFAULT); - zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient, - AFI_IP6, i, 0, VRF_DEFAULT); - break; - case ZEBRA_ROUTE_RIP: - case ZEBRA_ROUTE_OSPF: - zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient, - AFI_IP, i, 0, VRF_DEFAULT); - break; - case ZEBRA_ROUTE_RIPNG: - case ZEBRA_ROUTE_OSPF6: - zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient, - AFI_IP6, i, 0, VRF_DEFAULT); - break; - case ZEBRA_ROUTE_BGP: - /* LDP should follow the IGP and ignore BGP routes */ - default: - break; - } - } + zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP, + ZEBRA_ROUTE_ALL, 0, VRF_DEFAULT); + zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP6, + ZEBRA_ROUTE_ALL, 0, VRF_DEFAULT); } void |
