From e61f7c0a106f501db64ed0622f66c228efcc2c14 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 5 Feb 2020 20:55:30 -0500 Subject: 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 --- bgpd/bgp_nexthop.c | 15 ++++----------- 1 file 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); -- cgit v1.2.3