summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_nht.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_nht.c')
-rw-r--r--bgpd/bgp_nht.c33
1 files changed, 7 insertions, 26 deletions
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index 625d4f844..a963838f5 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -336,7 +336,7 @@ void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id)
bgp = bgp_lookup_by_vrf_id(vrf_id);
if (!bgp) {
zlog_err(
- "parse nexthop update: instance not found for vrf_id %d",
+ "parse nexthop update: instance not found for vrf_id %u",
vrf_id);
return;
}
@@ -389,7 +389,7 @@ void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id)
char buf[PREFIX2STR_BUFFER];
prefix2str(&p, buf, sizeof(buf));
zlog_debug(
- "%d: Rcvd NH update %s - metric %d/%d #nhops %d/%d flags 0x%x",
+ "%u: Rcvd NH update %s - metric %d/%d #nhops %d/%d flags 0x%x",
vrf_id, buf, metric, bnc->metric, nexthop_num,
bnc->nexthop_num, bnc->flags);
}
@@ -572,12 +572,11 @@ static int make_prefix(int afi, struct bgp_info *ri, struct prefix *p)
*/
static void sendmsg_zebra_rnh(struct bgp_nexthop_cache *bnc, int command)
{
- struct stream *s;
struct prefix *p;
+ bool exact_match = false;
int ret;
- /* Check socket. */
- if (!zclient || zclient->sock < 0)
+ if (!zclient)
return;
/* Don't try to register if Zebra doesn't know of this instance. */
@@ -585,32 +584,14 @@ static void sendmsg_zebra_rnh(struct bgp_nexthop_cache *bnc, int command)
return;
p = &(bnc->node->p);
- s = zclient->obuf;
- stream_reset(s);
- zclient_create_header(s, command, bnc->bgp->vrf_id);
if ((command == ZEBRA_NEXTHOP_REGISTER ||
command == ZEBRA_IMPORT_ROUTE_REGISTER) &&
(CHECK_FLAG(bnc->flags, BGP_NEXTHOP_CONNECTED)
|| CHECK_FLAG(bnc->flags, BGP_STATIC_ROUTE_EXACT_MATCH)))
- stream_putc(s, 1);
- else
- 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));
+ exact_match = true;
- ret = zclient_send_message(zclient);
+ ret = zclient_send_rnh(zclient, command, p,
+ exact_match, bnc->bgp->vrf_id);
/* TBD: handle the failure */
if (ret < 0)
zlog_warn("sendmsg_nexthop: zclient_send_message() failed");