From: Philippe Guibert Date: Mon, 18 Dec 2017 11:33:29 +0000 (+0100) Subject: bgpd: fix compilation issue with bgpd X-Git-Tag: frr-4.0-dev~36^2~4 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=a8bf7d9c9e6c7c852da1b5c9d27d5e227de7a9d3;p=mirror_frr.git bgpd: fix compilation issue with bgpd Changes due to the change of vrf_id_t moved from 16 bits to 32 bits. Signed-off-by: Philippe Guibert --- diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index 2e277bfa5..ce46b21f0 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -302,13 +302,13 @@ static int bgp_bfd_dest_update(int command, struct zclient *zclient, prefix2str(&dp, buf[0], sizeof(buf[0])); if (ifp) { zlog_debug( - "Zebra: vrf %d interface %s bfd destination %s %s", + "Zebra: vrf %u interface %s bfd destination %s %s", vrf_id, ifp->name, buf[0], bfd_get_status_str(status)); } else { prefix2str(&sp, buf[1], sizeof(buf[1])); zlog_debug( - "Zebra: vrf %d source %s bfd destination %s %s", + "Zebra: vrf %u source %s bfd destination %s %s", vrf_id, buf[1], buf[0], bfd_get_status_str(status)); } diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index a720d31a7..0508f4846 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -232,7 +232,7 @@ static __attribute__((__noreturn__)) void bgp_exit(int status) static int bgp_vrf_new(struct vrf *vrf) { if (BGP_DEBUG(zebra, ZEBRA)) - zlog_debug("VRF Created: %s(%d)", vrf->name, vrf->vrf_id); + zlog_debug("VRF Created: %s(%u)", vrf->name, vrf->vrf_id); return 0; } @@ -240,7 +240,7 @@ static int bgp_vrf_new(struct vrf *vrf) static int bgp_vrf_delete(struct vrf *vrf) { if (BGP_DEBUG(zebra, ZEBRA)) - zlog_debug("VRF Deletion: %s(%d)", vrf->name, vrf->vrf_id); + zlog_debug("VRF Deletion: %s(%u)", vrf->name, vrf->vrf_id); return 0; } @@ -251,7 +251,7 @@ static int bgp_vrf_enable(struct vrf *vrf) vrf_id_t old_vrf_id; if (BGP_DEBUG(zebra, ZEBRA)) - zlog_debug("VRF enable add %s id %d", vrf->name, vrf->vrf_id); + zlog_debug("VRF enable add %s id %u", vrf->name, vrf->vrf_id); bgp = bgp_lookup_by_name(vrf->name); if (bgp) { diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 625d4f844..247884d29 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); } diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 061f5fb1e..c7901f30d 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7859,7 +7859,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi, vty_out(vty, "{\n \"vrfId\": %d,\n \"vrfName\": \"%s\",\n \"tableVersion\": %" PRId64 ",\n \"routerId\": \"%s\",\n \"routes\": { ", - bgp->vrf_id == VRF_UNKNOWN ? -1 : bgp->vrf_id, + bgp->vrf_id == VRF_UNKNOWN ? -1 : (int)bgp->vrf_id, bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT ? "Default" : bgp->name, table->version, inet_ntoa(bgp->router_id)); diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 19cfb2d91..c98cf9c32 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -6479,7 +6479,6 @@ DEFUN (show_bgp_vrfs, struct listnode *node, *nnode; int peers_cfg, peers_estb; json_object *json_vrf = NULL; - int vrf_id_ui; /* Skip Views. */ if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW) @@ -6513,8 +6512,10 @@ DEFUN (show_bgp_vrfs, type = "VRF"; } - vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id; + if (uj) { + int64_t vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 : + (int64_t)bgp->vrf_id; json_object_string_add(json_vrf, "type", type); json_object_int_add(json_vrf, "vrfId", vrf_id_ui); json_object_string_add(json_vrf, "routerId", @@ -6532,7 +6533,9 @@ DEFUN (show_bgp_vrfs, } else vty_out(vty, "%4s %-5d %-16s %9u %10u %-37s %-10u %-15s\n", - type, vrf_id_ui, inet_ntoa(bgp->router_id), + type, bgp->vrf_id == VRF_UNKNOWN ? + -1 : (int)bgp->vrf_id, + inet_ntoa(bgp->router_id), peers_cfg, peers_estb, name, bgp->l3vni, prefix_mac2str(&bgp->rmac, buf, sizeof(buf))); } @@ -6852,10 +6855,11 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi, if (!count) { unsigned long ents; char memstrbuf[MTYPE_MEMSTR_LEN]; - int vrf_id_ui; + int64_t vrf_id_ui; vrf_id_ui = - (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id; + (bgp->vrf_id == VRF_UNKNOWN) ? -1 : + (int64_t)bgp->vrf_id; /* Usage summary and header */ if (use_json) { @@ -6874,7 +6878,8 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi, vty_out(vty, "BGP router identifier %s, local AS number %u vrf-id %d", inet_ntoa(bgp->router_id), bgp->as, - vrf_id_ui); + bgp->vrf_id == VRF_UNKNOWN ? -1 : + (int)bgp->vrf_id); vty_out(vty, "\n"); } @@ -9876,8 +9881,7 @@ static void bgp_show_all_instances_neighbors_vty(struct vty *vty, json_object_int_add(json, "vrfId", (bgp->vrf_id == VRF_UNKNOWN) - ? -1 - : bgp->vrf_id); + ? -1 : (int64_t) bgp->vrf_id); json_object_string_add( json, "vrfName", (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)