diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2020-02-06 02:55:30 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2020-02-06 13:24:53 +0100 |
commit | e61f7c0a106f501db64ed0622f66c228efcc2c14 (patch) | |
tree | 7271543cd31f605c884b82787b2e629ad528b3a7 /bgpd/bgp_nexthop.c | |
parent | Merge pull request #5761 from qlyoung/fix-bgp-gr-cruft (diff) | |
download | frr-e61f7c0a106f501db64ed0622f66c228efcc2c14.tar.xz frr-e61f7c0a106f501db64ed0622f66c228efcc2c14.zip |
bgpd: show martian nexthops improve code flow
The show martian nexthops command for bgp had some strangely
duplicated code. Refactor.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_nexthop.c')
-rw-r--r-- | bgpd/bgp_nexthop.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index 7116c8094..1e565af89 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -192,17 +192,10 @@ static void show_address_entry(struct hash_bucket *bucket, void *args) struct listnode *node; char str[INET6_ADDRSTRLEN] = {0}; - if (addr->p->family == AF_INET) { - vty_out(vty, "addr: %s, count: %d : ", inet_ntop(AF_INET, - &(addr->p->u.prefix4), - str, INET_ADDRSTRLEN), - addr->ifp_name_list->count); - } else if (addr->p->family == AF_INET6) { - vty_out(vty, "addr: %s, count: %d : ", inet_ntop(AF_INET6, - &(addr->p->u.prefix6), - str, INET6_ADDRSTRLEN), - addr->ifp_name_list->count); - } + vty_out(vty, "addr: %s, count: %d : ", + inet_ntop(addr->p->family, &(addr->p->u.prefix), + str, INET6_ADDRSTRLEN), + addr->ifp_name_list->count); for (ALL_LIST_ELEMENTS_RO(addr->ifp_name_list, node, name)) { vty_out(vty, " %s,", name); |