diff options
Diffstat (limited to 'bgpd/rfapi/rfapi_vty.c')
| -rw-r--r-- | bgpd/rfapi/rfapi_vty.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index 58fdc7c130..89f6852e2b 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -194,7 +194,7 @@ int rfapiQprefix2Raddr(struct prefix *qprefix, struct rfapi_ip_addr *raddr) * Translate Quagga prefix to RFAPI prefix */ /* rprefix->cost set to 0 */ -void rfapiQprefix2Rprefix(struct prefix *qprefix, +void rfapiQprefix2Rprefix(const struct prefix *qprefix, struct rfapi_ip_prefix *rprefix) { memset(rprefix, 0, sizeof(struct rfapi_ip_prefix)); @@ -393,7 +393,7 @@ int rfapiStream2Vty(void *stream, /* input */ } /* called from bgpd/bgp_vty.c'route_vty_out() */ -void rfapi_vty_out_vncinfo(struct vty *vty, struct prefix *p, +void rfapi_vty_out_vncinfo(struct vty *vty, const struct prefix *p, struct bgp_path_info *bpi, safi_t safi) { char *s; @@ -743,7 +743,6 @@ static void rfapiDebugPrintMonitorEncap(void *stream, void rfapiShowItNode(void *stream, struct agg_node *rn) { struct bgp_path_info *bpi; - char buf[BUFSIZ]; int (*fp)(void *, const char *, ...); struct vty *vty; @@ -753,9 +752,7 @@ void rfapiShowItNode(void *stream, struct agg_node *rn) if (rfapiStream2Vty(stream, &fp, &vty, &out, &vty_newline) == 0) return; - fp(out, "%s/%d @%p #%d%s", - rfapi_ntop(rn->p.family, &rn->p.u.prefix, buf, BUFSIZ), - rn->p.prefixlen, rn, rn->lock, HVTYNL); + fp(out, "%pRN @%p #%d%s", rn, rn, rn->lock, HVTYNL); for (bpi = rn->info; bpi; bpi = bpi->next) { rfapiPrintBi(stream, bpi); @@ -782,14 +779,15 @@ void rfapiShowImportTable(void *stream, const char *label, struct agg_table *rt, for (rn = agg_route_top(rt); rn; rn = agg_route_next(rn)) { struct bgp_path_info *bpi; + const struct prefix *p = agg_node_get_prefix(rn); - if (rn->p.family == AF_ETHERNET) { - rfapiEthAddr2Str(&rn->p.u.prefix_eth, buf, BUFSIZ); + if (p->family == AF_ETHERNET) { + rfapiEthAddr2Str(&p->u.prefix_eth, buf, BUFSIZ); } else { - inet_ntop(rn->p.family, &rn->p.u.prefix, buf, BUFSIZ); + inet_ntop(p->family, &p->u.prefix, buf, BUFSIZ); } - fp(out, "%s/%d @%p #%d%s", buf, rn->p.prefixlen, rn, + fp(out, "%s/%d @%p #%d%s", buf, p->prefixlen, rn, rn->lock - 1, /* account for loop iterator locking */ HVTYNL); @@ -868,6 +866,8 @@ int rfapiShowVncQueries(void *stream, struct prefix *pfx_match) if (rfd->mon) { for (rn = agg_route_top(rfd->mon); rn; rn = agg_route_next(rn)) { + const struct prefix *p = + agg_node_get_prefix(rn); struct rfapi_monitor_vpn *m; char buf_remain[BUFSIZ]; char buf_pfx[BUFSIZ]; @@ -879,9 +879,8 @@ int rfapiShowVncQueries(void *stream, struct prefix *pfx_match) ++queries_total; - if (pfx_match - && !prefix_match(pfx_match, &rn->p) - && !prefix_match(&rn->p, pfx_match)) + if (pfx_match && !prefix_match(pfx_match, p) + && !prefix_match(p, pfx_match)) continue; ++queries_displayed; @@ -1028,6 +1027,7 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream, char buf_vn[BUFSIZ]; char buf_lifetime[BUFSIZ]; int nlines = 0; + const struct prefix *p = agg_node_get_prefix(rn); if (!stream) return 0; /* for debug log, print into buf & call output once */ @@ -1040,8 +1040,8 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream, */ buf_pfx[0] = 0; snprintf(buf_pfx, BUFSIZ, "%s/%d", - rfapi_ntop(rn->p.family, &rn->p.u.prefix, buf_ntop, BUFSIZ), - rn->p.prefixlen); + rfapi_ntop(p->family, &p->u.prefix, buf_ntop, BUFSIZ), + p->prefixlen); buf_pfx[BUFSIZ - 1] = 0; nlines++; @@ -1155,7 +1155,7 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream, } fp(out, "%s", HVTYNL); - if (rn->p.family == AF_ETHERNET) { + if (p->family == AF_ETHERNET) { /* * If there is a corresponding IP address && != VN address, * print that on the next line @@ -1221,13 +1221,13 @@ static int rfapiShowRemoteRegistrationsIt(struct bgp *bgp, void *stream, for (rn = agg_route_top(it->imported_vpn[afi]); rn; rn = agg_route_next(rn)) { - + const struct prefix *p = agg_node_get_prefix(rn); struct bgp_path_info *bpi; int count_only; /* allow for wider or more narrow mask from user */ - if (prefix_only && !prefix_match(prefix_only, &rn->p) - && !prefix_match(&rn->p, prefix_only)) + if (prefix_only && !prefix_match(prefix_only, p) + && !prefix_match(p, prefix_only)) count_only = 1; else count_only = 0; @@ -2754,10 +2754,10 @@ static void nve_addr_free(void *hap) XFREE(MTYPE_RFAPI_NVE_ADDR, hap); } -static int nve_addr_cmp(void *k1, void *k2) +static int nve_addr_cmp(const void *k1, const void *k2) { - struct nve_addr *a = (struct nve_addr *)k1; - struct nve_addr *b = (struct nve_addr *)k2; + const struct nve_addr *a = (struct nve_addr *)k1; + const struct nve_addr *b = (struct nve_addr *)k2; int ret = 0; if (!a || !b) { @@ -3428,7 +3428,7 @@ static void clear_vnc_nve_closer(struct rfapi_local_reg_delete_arg *cda) &cursor)) { if (pValue->rfd) { - ((struct rfapi_descriptor *)pValue->rfd)->flags |= + pValue->rfd->flags |= RFAPI_HD_FLAG_CLOSING_ADMINISTRATIVELY; rfapi_close(pValue->rfd); } |
