diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-01-23 00:36:03 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-01-23 01:45:31 +0100 |
commit | 3c1925406846d0e2d981086ea4d3c9fb09dc8b4a (patch) | |
tree | 5e0449a7e47c9002b1015e12c56de30bd2dcf5ef /pimd/pim_nht.c | |
parent | pimd: No need to assert on the redist_default (diff) | |
download | frr-3c1925406846d0e2d981086ea4d3c9fb09dc8b4a.tar.xz frr-3c1925406846d0e2d981086ea4d3c9fb09dc8b4a.zip |
bgpd, lib, pimd: Abstract commands for nexthop tracking
Abstract the code that sends the zapi message into zebra
for the turn on/off of nexthop tracking for a prefix.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_nht.c')
-rw-r--r-- | pimd/pim_nht.c | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c index 089639c77..ccef79672 100644 --- a/pimd/pim_nht.c +++ b/pimd/pim_nht.c @@ -47,40 +47,14 @@ void pim_sendmsg_zebra_rnh(struct pim_instance *pim, struct zclient *zclient, struct pim_nexthop_cache *pnc, int command) { - struct stream *s; struct prefix *p; int ret; - /* Check socket. */ - if (!zclient || zclient->sock < 0) - return; - p = &(pnc->rpf.rpf_addr); - s = zclient->obuf; - stream_reset(s); - zclient_create_header(s, command, pim->vrf_id); - /* get update for all routes for a prefix */ - stream_putc(s, 0); - - stream_putw(s, PREFIX_FAMILY(p)); - stream_putc(s, p->prefixlen); - switch (PREFIX_FAMILY(p)) { - case AF_INET: - stream_put_in_addr(s, &p->u.prefix4); - break; - case AF_INET6: - stream_put(s, &(p->u.prefix6), 16); - break; - default: - break; - } - stream_putw_at(s, 0, stream_get_endp(s)); - - ret = zclient_send_message(zclient); + ret = zclient_send_rnh(zclient, command, p, false, pim->vrf_id); if (ret < 0) zlog_warn("sendmsg_nexthop: zclient_send_message() failed"); - if (PIM_DEBUG_PIM_NHT) { char buf[PREFIX2STR_BUFFER]; prefix2str(p, buf, sizeof(buf)); |