diff options
author | Donatas Abraitis <donatas.abraitis@gmail.com> | 2020-10-18 13:33:54 +0200 |
---|---|---|
committer | Donatas Abraitis <donatas.abraitis@gmail.com> | 2020-10-22 08:07:41 +0200 |
commit | 2dbe669bdf0f0bcbf0228ccdab7b631bd8b934f1 (patch) | |
tree | 69c38032b07630b46d2d5852200789b13392153c /pbrd | |
parent | Merge pull request #7353 from AnuradhaKaruppiah/mh-cleanup-fix-1 (diff) | |
download | frr-2dbe669bdf0f0bcbf0228ccdab7b631bd8b934f1.tar.xz frr-2dbe669bdf0f0bcbf0228ccdab7b631bd8b934f1.zip |
:* Convert prefix2str to %pFX
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
Diffstat (limited to 'pbrd')
-rw-r--r-- | pbrd/pbr_nht.c | 6 | ||||
-rw-r--r-- | pbrd/pbr_vty.c | 15 | ||||
-rw-r--r-- | pbrd/pbr_zebra.c | 37 |
3 files changed, 21 insertions, 37 deletions
diff --git a/pbrd/pbr_nht.c b/pbrd/pbr_nht.c index 3fb375904..ce7780ed4 100644 --- a/pbrd/pbr_nht.c +++ b/pbrd/pbr_nht.c @@ -827,16 +827,14 @@ static void pbr_nht_individual_nexthop_update_lookup(struct hash_bucket *b, { struct pbr_nexthop_cache *pnhc = b->data; struct pbr_nht_individual *pnhi = data; - char buf[PREFIX_STRLEN]; bool old_valid; old_valid = pnhc->valid; pbr_nht_individual_nexthop_update(pnhc, pnhi); - DEBUGD(&pbr_dbg_nht, "\tFound %s: old: %d new: %d", - prefix2str(&pnhi->nhr->prefix, buf, sizeof(buf)), old_valid, - pnhc->valid); + DEBUGD(&pbr_dbg_nht, "\tFound %pFX: old: %d new: %d", + &pnhi->nhr->prefix, old_valid, pnhc->valid); if (pnhc->valid) pnhi->valid = true; diff --git a/pbrd/pbr_vty.c b/pbrd/pbr_vty.c index c423668eb..eb51516c2 100644 --- a/pbrd/pbr_vty.c +++ b/pbrd/pbr_vty.c @@ -648,7 +648,6 @@ pbrms_nexthop_group_write_individual_nexthop( static void vty_show_pbrms(struct vty *vty, const struct pbr_map_sequence *pbrms, bool detail) { - char buf[PREFIX_STRLEN]; char rbuf[64]; if (pbrms->reason) @@ -666,11 +665,9 @@ static void vty_show_pbrms(struct vty *vty, pbrms->reason ? rbuf : "Valid"); if (pbrms->src) - vty_out(vty, " SRC Match: %s\n", - prefix2str(pbrms->src, buf, sizeof(buf))); + vty_out(vty, " SRC Match: %pFX\n", pbrms->src); if (pbrms->dst) - vty_out(vty, " DST Match: %s\n", - prefix2str(pbrms->dst, buf, sizeof(buf))); + vty_out(vty, " DST Match: %pFX\n", pbrms->dst); if (pbrms->dsfield & PBR_DSFIELD_DSCP) vty_out(vty, " DSCP Match: %u\n", (pbrms->dsfield & PBR_DSFIELD_DSCP) >> 2); @@ -1058,17 +1055,13 @@ static int pbr_vty_map_config_write_sequence(struct vty *vty, struct pbr_map *pbrm, struct pbr_map_sequence *pbrms) { - char buff[PREFIX_STRLEN]; - vty_out(vty, "pbr-map %s seq %u\n", pbrm->name, pbrms->seqno); if (pbrms->src) - vty_out(vty, " match src-ip %s\n", - prefix2str(pbrms->src, buff, sizeof(buff))); + vty_out(vty, " match src-ip %pFX\n", pbrms->src); if (pbrms->dst) - vty_out(vty, " match dst-ip %s\n", - prefix2str(pbrms->dst, buff, sizeof(buff))); + vty_out(vty, " match dst-ip %pFX\n", pbrms->dst); if (pbrms->dsfield & PBR_DSFIELD_DSCP) vty_out(vty, " match dscp %u\n", diff --git a/pbrd/pbr_zebra.c b/pbrd/pbr_zebra.c index 866f27136..b8ee97463 100644 --- a/pbrd/pbr_zebra.c +++ b/pbrd/pbr_zebra.c @@ -102,15 +102,14 @@ static int interface_address_add(ZAPI_CALLBACK_ARGS) static int interface_address_delete(ZAPI_CALLBACK_ARGS) { struct connected *c; - char buf[PREFIX_STRLEN]; c = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); if (!c) return 0; - DEBUGD(&pbr_dbg_zebra, "%s: %s deleted %s", __func__, c->ifp->name, - prefix2str(c->address, buf, sizeof(buf))); + DEBUGD(&pbr_dbg_zebra, "%s: %s deleted %pFX", __func__, c->ifp->name, + c->address); connected_free(&c); return 0; @@ -162,40 +161,37 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS) struct prefix p; enum zapi_route_notify_owner note; uint32_t table_id; - char buf[PREFIX_STRLEN]; if (!zapi_route_notify_decode(zclient->ibuf, &p, &table_id, ¬e)) return -1; - prefix2str(&p, buf, sizeof(buf)); - switch (note) { case ZAPI_ROUTE_FAIL_INSTALL: DEBUGD(&pbr_dbg_zebra, - "%s: [%s] Route install failure for table: %u", __func__, - buf, table_id); + "%s: [%pFX] Route install failure for table: %u", + __func__, &p, table_id); break; case ZAPI_ROUTE_BETTER_ADMIN_WON: DEBUGD(&pbr_dbg_zebra, - "%s: [%s] Route better admin distance won for table: %u", - __func__, buf, table_id); + "%s: [%pFX] Route better admin distance won for table: %u", + __func__, &p, table_id); break; case ZAPI_ROUTE_INSTALLED: DEBUGD(&pbr_dbg_zebra, - "%s: [%s] Route installed succeeded for table: %u", - __func__, buf, table_id); + "%s: [%pFX] Route installed succeeded for table: %u", + __func__, &p, table_id); pbr_nht_route_installed_for_table(table_id); break; case ZAPI_ROUTE_REMOVED: DEBUGD(&pbr_dbg_zebra, - "%s: [%s] Route Removed succeeded for table: %u", - __func__, buf, table_id); + "%s: [%pFX] Route Removed succeeded for table: %u", + __func__, &p, table_id); pbr_nht_route_removed_for_table(table_id); break; case ZAPI_ROUTE_REMOVE_FAIL: DEBUGD(&pbr_dbg_zebra, - "%s: [%s] Route remove fail for table: %u", __func__, - buf, table_id); + "%s: [%pFX] Route remove fail for table: %u", __func__, + &p, table_id); break; } @@ -259,14 +255,12 @@ static void route_add_helper(struct zapi_route *api, struct nexthop_group nhg, uint8_t install_afi) { struct zapi_nexthop *api_nh; - char buf[PREFIX_STRLEN]; struct nexthop *nhop; int i; api->prefix.family = install_afi; - DEBUGD(&pbr_dbg_zebra, "\tEncoding %s", - prefix2str(&api->prefix, buf, sizeof(buf))); + DEBUGD(&pbr_dbg_zebra, "\tEncoding %pFX", &api->prefix); i = 0; for (ALL_NEXTHOPS(nhg, nhop)) { @@ -397,7 +391,6 @@ void route_delete(struct pbr_nexthop_group_cache *pnhgc, afi_t afi) static int pbr_zebra_nexthop_update(ZAPI_CALLBACK_ARGS) { struct zapi_route nhr; - char buf[PREFIX2STR_BUFFER]; uint32_t i; if (!zapi_nexthop_update_decode(zclient->ibuf, &nhr)) { @@ -407,8 +400,8 @@ static int pbr_zebra_nexthop_update(ZAPI_CALLBACK_ARGS) if (DEBUG_MODE_CHECK(&pbr_dbg_zebra, DEBUG_MODE_ALL)) { - DEBUGD(&pbr_dbg_zebra, "%s: Received Nexthop update: %s", - __func__, prefix2str(&nhr.prefix, buf, sizeof(buf))); + DEBUGD(&pbr_dbg_zebra, "%s: Received Nexthop update: %pFX", + __func__, &nhr.prefix); DEBUGD(&pbr_dbg_zebra, "%s: (\tNexthops(%u)", __func__, nhr.nexthop_num); |