diff options
Diffstat (limited to 'bgpd/rfapi/rfapi_vty.c')
| -rw-r--r-- | bgpd/rfapi/rfapi_vty.c | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index 2a0921bcf0..8a5c1dff91 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -385,14 +385,14 @@ rfapiStdioPrintf (void *stream, const char *format, ...) /* Fake out for debug logging */ static struct vty vty_dummy_zlog; static struct vty vty_dummy_stdio; -#define HVTY_NEWLINE ((vty == &vty_dummy_zlog)? "": VTY_NEWLINE) +#define HVTYNL ((vty == &vty_dummy_zlog)? "": VTYNL) static const char * str_vty_newline (struct vty *vty) { if (vty == &vty_dummy_zlog) return ""; - return VTY_NEWLINE; + return VTYNL; } int @@ -406,7 +406,7 @@ rfapiStream2Vty ( if (!stream) { - vty_dummy_zlog.type = VTY_SHELL; /* for VTY_NEWLINE */ + vty_dummy_zlog.type = VTY_SHELL; /* for VTYNL */ *vty = &vty_dummy_zlog; *fp = (int (*)(void *, const char *,...)) rfapiDebugPrintf; *outstream = NULL; @@ -418,7 +418,7 @@ rfapiStream2Vty ( ((uintptr_t) stream == (uintptr_t) 2)) { - vty_dummy_stdio.type = VTY_SHELL; /* for VTY_NEWLINE */ + vty_dummy_stdio.type = VTY_SHELL; /* for VTYNL */ *vty = &vty_dummy_stdio; *fp = (int (*)(void *, const char *,...)) rfapiStdioPrintf; *outstream = stream; @@ -428,7 +428,7 @@ rfapiStream2Vty ( if (stream) { - *vty = stream; /* VTY_NEWLINE requires vty to be legit */ + *vty = stream; /* VTYNL requires vty to be legit */ *fp = (int (*)(void *, const char *,...)) vty_out; *outstream = stream; *vty_newline = str_vty_newline (*vty); @@ -488,7 +488,7 @@ rfapi_vty_out_vncinfo ( vty_out (vty, " type=%s, subtype=%d", zebra_route_string (bi->type), bi->sub_type); - vty_out (vty, "%s", HVTY_NEWLINE); + vty_out (vty, "%s", HVTYNL); } void @@ -505,27 +505,27 @@ rfapiPrintAttrPtrs (void *stream, struct attr *attr) if (rfapiStream2Vty (stream, &fp, &vty, &out, &vty_newline) == 0) return; - fp (out, "Attr[%p]:%s", attr, HVTY_NEWLINE); + fp (out, "Attr[%p]:%s", attr, HVTYNL); if (!attr) return; /* IPv4 Nexthop */ inet_ntop (AF_INET, &attr->nexthop, buf, BUFSIZ); - fp (out, " nexthop=%s%s", buf, HVTY_NEWLINE); + fp (out, " nexthop=%s%s", buf, HVTYNL); fp (out, " aspath=%p, refcnt=%d%s", attr->aspath, - (attr->aspath ? attr->aspath->refcnt : 0), HVTY_NEWLINE); + (attr->aspath ? attr->aspath->refcnt : 0), HVTYNL); fp (out, " community=%p, refcnt=%d%s", attr->community, - (attr->community ? attr->community->refcnt : 0), HVTY_NEWLINE); + (attr->community ? attr->community->refcnt : 0), HVTYNL); if ((ae = attr->extra)) { fp (out, " ecommunity=%p, refcnt=%d%s", ae->ecommunity, - (ae->ecommunity ? ae->ecommunity->refcnt : 0), HVTY_NEWLINE); + (ae->ecommunity ? ae->ecommunity->refcnt : 0), HVTYNL); fp (out, " cluster=%p, refcnt=%d%s", ae->cluster, - (ae->cluster ? ae->cluster->refcnt : 0), HVTY_NEWLINE); + (ae->cluster ? ae->cluster->refcnt : 0), HVTYNL); fp (out, " transit=%p, refcnt=%d%s", ae->transit, - (ae->transit ? ae->transit->refcnt : 0), HVTY_NEWLINE); + (ae->transit ? ae->transit->refcnt : 0), HVTYNL); } } @@ -726,7 +726,7 @@ rfapiPrintBi (void *stream, struct bgp_info *bi) snprintf (p, REMAIN, " %c:%u", zebra_route_char (bi->type), bi->sub_type); INCP; - fp (out, "%s%s", line, HVTY_NEWLINE); + fp (out, "%s%s", line, HVTYNL); if (has_macaddr) { @@ -735,7 +735,7 @@ rfapiPrintBi (void *stream, struct bgp_info *bi) macaddr.octet[0], macaddr.octet[1], macaddr.octet[2], - macaddr.octet[3], macaddr.octet[4], macaddr.octet[5], HVTY_NEWLINE); + macaddr.octet[3], macaddr.octet[4], macaddr.octet[5], HVTYNL); } if (!rfapiGetL2o (bi->attr, &l2o_buf)) @@ -745,7 +745,7 @@ rfapiPrintBi (void *stream, struct bgp_info *bi) l2o_buf.macaddr.octet[0], l2o_buf.macaddr.octet[1], l2o_buf.macaddr.octet[2], l2o_buf.macaddr.octet[3], l2o_buf.macaddr.octet[4], l2o_buf.macaddr.octet[5], l2o_buf.label, - l2o_buf.logical_net_id, l2o_buf.local_nve_id, HVTY_NEWLINE); + l2o_buf.logical_net_id, l2o_buf.local_nve_id, HVTYNL); } if (bi->extra && bi->extra->vnc.import.aux_prefix.family) { @@ -758,7 +758,7 @@ rfapiPrintBi (void *stream, struct bgp_info *bi) buf[BUFSIZ - 1] = 0; if (sp) { - fp (out, " IP: %s%s", sp, HVTY_NEWLINE); + fp (out, " IP: %s%s", sp, HVTYNL); } } { @@ -807,7 +807,7 @@ rfapiDebugPrintMonitorVpn (void *stream, struct rfapi_monitor_vpn *m) return; rfapiMonitorVpn2Str (m, buf, BUFSIZ); - fp (out, " Mon %s%s", buf, HVTY_NEWLINE); + fp (out, " Mon %s%s", buf, HVTYNL); } static void @@ -822,7 +822,7 @@ rfapiDebugPrintMonitorEncap (void *stream, struct rfapi_monitor_encap *m) return; fp (out, " Mon m=%p, next=%p, node=%p, bi=%p%s", - m, m->next, m->node, m->bi, HVTY_NEWLINE); + m, m->next, m->node, m->bi, HVTYNL); } void @@ -841,7 +841,7 @@ rfapiShowItNode (void *stream, struct route_node *rn) fp (out, "%s/%d @%p #%d%s", rfapi_ntop (rn->p.family, &rn->p.u.prefix, buf, BUFSIZ), - rn->p.prefixlen, rn, rn->lock, HVTY_NEWLINE); + rn->p.prefixlen, rn, rn->lock, HVTYNL); for (bi = rn->info; bi; bi = bi->next) { @@ -869,7 +869,7 @@ rfapiShowImportTable ( if (rfapiStream2Vty (stream, &fp, &vty, &out, &vty_newline) == 0) return; - fp (out, "Import Table [%s]%s", label, HVTY_NEWLINE); + fp (out, "Import Table [%s]%s", label, HVTYNL); for (rn = route_top (rt); rn; rn = route_next (rn)) { @@ -885,7 +885,7 @@ rfapiShowImportTable ( } fp (out, "%s/%d @%p #%d%s", buf, rn->p.prefixlen, rn, rn->lock - 1, /* account for loop iterator locking */ - HVTY_NEWLINE); + HVTYNL); for (bi = rn->info; bi; bi = bi->next) { @@ -995,10 +995,10 @@ rfapiShowVncQueries (void *stream, struct prefix *pfx_match) if (!printedheader) { ++printedheader; - fp (out, "%s", VTY_NEWLINE); + fp (out, "%s", VTYNL); fp (out, "%-15s %-15s %-15s %-10s%s", "VN Address", "UN Address", - "Target", "Remaining", VTY_NEWLINE); + "Target", "Remaining", VTYNL); } if (!printedquerier) @@ -1024,7 +1024,7 @@ rfapiShowVncQueries (void *stream, struct prefix *pfx_match) } fp (out, " %-15s %-10s%s", inet_ntop (m->p.family, &m->p.u.prefix, buf_pfx, BUFSIZ), - buf_remain, VTY_NEWLINE); + buf_remain, VTYNL); } } @@ -1070,10 +1070,10 @@ rfapiShowVncQueries (void *stream, struct prefix *pfx_match) if (!printedheader) { ++printedheader; - fp (out, "%s", VTY_NEWLINE); + fp (out, "%s", VTYNL); fp (out, "%-15s %-15s %-17s %10s %-10s%s", "VN Address", "UN Address", - "Target", "LNI", "Remaining", VTY_NEWLINE); + "Target", "LNI", "Remaining", VTYNL); } if (!printedquerier) @@ -1100,16 +1100,16 @@ rfapiShowVncQueries (void *stream, struct prefix *pfx_match) fp (out, " %-17s %10d %-10s%s", rfapi_ntop (pfx_mac.family, &pfx_mac.u.prefix, buf_pfx, BUFSIZ), mon_eth->logical_net_id, buf_remain, - VTY_NEWLINE); + VTYNL); } } } if (queries_total) { - fp (out, "%s", VTY_NEWLINE); + fp (out, "%s", VTYNL); fp (out, "Displayed %d out of %d total queries%s", - queries_displayed, queries_total, VTY_NEWLINE); + queries_displayed, queries_total, VTYNL); } return CMD_SUCCESS; } @@ -1277,7 +1277,7 @@ rfapiPrintRemoteRegBi ( } fp (out, "%-10s ", buf_age); } - fp (out, "%s", HVTY_NEWLINE); + fp (out, "%s", HVTYNL); if (rn->p.family == AF_ETHERNET) { @@ -1314,7 +1314,7 @@ rfapiPrintRemoteRegBi ( } } if (nlines > 1) - fp (out, "%s", HVTY_NEWLINE); + fp (out, "%s", HVTYNL); return 1; } @@ -1438,12 +1438,12 @@ rfapiShowRemoteRegistrationsIt ( if (pLni) { fp (out, "%s[%s] L2VPN Network 0x%x (%u) RT={%s}", - HVTY_NEWLINE, type, *pLni, (*pLni & 0xfff), s); + HVTYNL, type, *pLni, (*pLni & 0xfff), s); } else { fp (out, "%s[%s] Prefix RT={%s}", - HVTY_NEWLINE, type, s); + HVTYNL, type, s); } XFREE (MTYPE_ECOMMUNITY_STR, s); @@ -1454,7 +1454,7 @@ rfapiShowRemoteRegistrationsIt ( "VRF" : "NVE group"), it->rfg->name); } - fp (out, "%s", HVTY_NEWLINE); + fp (out, "%s", HVTYNL); if (show_expiring) { #if RFAPI_REGISTRATIONS_REPORT_AGE @@ -1473,7 +1473,7 @@ rfapiShowRemoteRegistrationsIt ( fp (out, "%-20s %-15s %-15s %4s %-10s %-10s%s", (pLni ? "L2 Address/IP" : "Prefix"), "VN Address", "UN Address", "Cost", - "Lifetime", agetype, HVTY_NEWLINE); + "Lifetime", agetype, HVTYNL); } printed += rfapiPrintRemoteRegBi (bgp, stream, rn, bi); } @@ -1509,9 +1509,9 @@ rfapiShowRemoteRegistrationsIt ( } fp (out, "Displayed %d out of %d %s%s", - printed, total, type, HVTY_NEWLINE); + printed, total, type, HVTYNL); #if DEBUG_SHOW_EXTRA - fp(out, "IT table above: it=%p%s", it, HVTY_NEWLINE); + fp(out, "IT table above: it=%p%s", it, HVTYNL); #endif } return printed; @@ -1751,7 +1751,7 @@ rfapiPrintAdvertisedInfo ( } bn = bgp_afi_node_get (bgp->rib[afi][safi], afi, safi, p, prd); - vty_out (vty, " bn=%p%s", bn, HVTY_NEWLINE); + vty_out (vty, " bn=%p%s", bn, HVTYNL); for (bi = bn->info; bi; bi = bi->next) { @@ -1768,7 +1768,7 @@ rfapiPrintAdvertisedInfo ( if (!printed) { - vty_out (vty, " --?--%s", HVTY_NEWLINE); + vty_out (vty, " --?--%s", HVTYNL); return; } @@ -1798,9 +1798,9 @@ rfapiPrintDescriptor (struct vty *vty, struct rfapi_descriptor *rfd) rfapiPrintRd (vty, &rfd->rd); vty_out (vty, " %d", rfd->response_lifetime); vty_out (vty, " %s", (rfd->rfg ? rfd->rfg->name : "<orphaned>")); - vty_out (vty, "%s", HVTY_NEWLINE); + vty_out (vty, "%s", HVTYNL); - vty_out (vty, " Peer %p #%d%s", rfd->peer, rfd->peer->lock, HVTY_NEWLINE); + vty_out (vty, " Peer %p #%d%s", rfd->peer, rfd->peer->lock, HVTYNL); /* export RT list */ if (rfd->rt_export_list) @@ -1808,12 +1808,12 @@ rfapiPrintDescriptor (struct vty *vty, struct rfapi_descriptor *rfd) s = ecommunity_ecom2str (rfd->rt_export_list, ECOMMUNITY_FORMAT_ROUTE_MAP, 0); - vty_out (vty, " Export %s%s", s, HVTY_NEWLINE); + vty_out (vty, " Export %s%s", s, HVTYNL); XFREE (MTYPE_ECOMMUNITY_STR, s); } else { - vty_out (vty, " Export (nil)%s", HVTY_NEWLINE); + vty_out (vty, " Export (nil)%s", HVTYNL); } /* import RT list */ @@ -1821,12 +1821,12 @@ rfapiPrintDescriptor (struct vty *vty, struct rfapi_descriptor *rfd) { s = ecommunity_ecom2str (rfd->import_table->rt_import_list, ECOMMUNITY_FORMAT_ROUTE_MAP, 0); - vty_out (vty, " Import %s%s", s, HVTY_NEWLINE); + vty_out (vty, " Import %s%s", s, HVTYNL); XFREE (MTYPE_ECOMMUNITY_STR, s); } else { - vty_out (vty, " Import (nil)%s", HVTY_NEWLINE); + vty_out (vty, " Import (nil)%s", HVTYNL); } for (afi = AFI_IP; afi < AFI_MAX; ++afi) @@ -1853,7 +1853,7 @@ rfapiPrintDescriptor (struct vty *vty, struct rfapi_descriptor *rfd) prefix2str (&adb->u.s.prefix_ip, buf, BUFSIZ); buf[BUFSIZ - 1] = 0; /* guarantee NUL-terminated */ - vty_out (vty, " Adv Pfx: %s%s", buf, HVTY_NEWLINE); + vty_out (vty, " Adv Pfx: %s%s", buf, HVTYNL); rfapiPrintAdvertisedInfo (vty, rfd, SAFI_MPLS_VPN, &adb->u.s.prefix_ip); } } @@ -1868,13 +1868,13 @@ rfapiPrintDescriptor (struct vty *vty, struct rfapi_descriptor *rfd) prefix2str (&adb->u.s.prefix_eth, buf, BUFSIZ); buf[BUFSIZ - 1] = 0; /* guarantee NUL-terminated */ - vty_out (vty, " Adv Pfx: %s%s", buf, HVTY_NEWLINE); + vty_out (vty, " Adv Pfx: %s%s", buf, HVTYNL); /* TBD update the following function to print ethernet info */ /* Also need to pass/use rd */ rfapiPrintAdvertisedInfo (vty, rfd, SAFI_MPLS_VPN, &adb->u.s.prefix_ip); } - vty_out (vty, "%s", HVTY_NEWLINE); + vty_out (vty, "%s", HVTYNL); } /* @@ -1925,7 +1925,7 @@ rfapiPrintMatchingDescriptors (struct vty *vty, vty_out (vty, "%s %s %s %s %s %s %s %s%s", "descriptor", "un-addr", "vn-addr", "callback", "cookie", - "RD", "lifetime", "group", HVTY_NEWLINE); + "RD", "lifetime", "group", HVTYNL); } rfapiPrintDescriptor (vty, rfd); printed = 1; @@ -1941,7 +1941,7 @@ rfapiCliGetPrefixAddr (struct vty *vty, const char *str, struct prefix *p) { if (!str2prefix (str, p)) { - vty_out (vty, "Malformed address \"%s\"%s", str, HVTY_NEWLINE); + vty_out (vty, "Malformed address \"%s\"%s", str, HVTYNL); return CMD_WARNING; } switch (p->family) @@ -1949,19 +1949,19 @@ rfapiCliGetPrefixAddr (struct vty *vty, const char *str, struct prefix *p) case AF_INET: if (p->prefixlen != 32) { - vty_out (vty, "Not a host address: \"%s\"%s", str, HVTY_NEWLINE); + vty_out (vty, "Not a host address: \"%s\"%s", str, HVTYNL); return CMD_WARNING; } break; case AF_INET6: if (p->prefixlen != 128) { - vty_out (vty, "Not a host address: \"%s\"%s", str, HVTY_NEWLINE); + vty_out (vty, "Not a host address: \"%s\"%s", str, HVTYNL); return CMD_WARNING; } break; default: - vty_out (vty, "Invalid address \"%s\"%s", str, HVTY_NEWLINE); + vty_out (vty, "Invalid address \"%s\"%s", str, HVTYNL); return CMD_WARNING; } return 0; @@ -2066,7 +2066,7 @@ rfapiPrintNhl (void *stream, struct rfapi_next_hop_entry *next_hops) truncate: line[BUFSIZ - 1] = 0; - fp (out, "%s%s", line, HVTY_NEWLINE); + fp (out, "%s%s", line, HVTYNL); /* * options @@ -2088,18 +2088,18 @@ rfapiPrintNhl (void *stream, struct rfapi_next_hop_entry *next_hops) fp (out, "%sL2 %s LBL=0x%06x NETID=0x%06x NVEID=%d%s", offset, pbuf, (vo->v.l2addr.label & 0x00ffffff), (vo->v.l2addr.logical_net_id & 0x00ffffff), - vo->v.l2addr.local_nve_id, HVTY_NEWLINE); + vo->v.l2addr.local_nve_id, HVTYNL); break; case RFAPI_VN_OPTION_TYPE_LOCAL_NEXTHOP: prefix2str (&vo->v.local_nexthop.addr, pbuf, sizeof (pbuf)); fp (out, "%sLNH %s cost=%d%s", - offset, pbuf, vo->v.local_nexthop.cost, HVTY_NEWLINE); + offset, pbuf, vo->v.local_nexthop.cost, HVTYNL); break; default: fp (out, "%svn option type %d (unknown)%s", - offset, vo->type, HVTY_NEWLINE); + offset, vo->type, HVTYNL); break; } } @@ -3701,7 +3701,7 @@ clear_vnc_prefix (struct rfapi_local_reg_delete_arg *cda) static void print_cleared_stats (struct rfapi_local_reg_delete_arg *cda) { - struct vty *vty = cda->vty; /* for benefit of VTY_NEWLINE */ + struct vty *vty = cda->vty; /* for benefit of VTYNL */ /* Our special element-deleting function counts nves */ if (cda->nves) |
