diff options
| author | Russ White <russ@riw.us> | 2018-08-07 15:58:26 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-07 15:58:26 -0400 |
| commit | 9728f9944959abeb819e932232e239ad87f0d419 (patch) | |
| tree | f1b29eed124b6e31213e11f133dde029bee5611f | |
| parent | 2cf1e38c1009fad652e66220ec8f0810c856ad9f (diff) | |
| parent | 07d0c4ed2d6a2a54fd13d76dbc0c9fd1eed99bb2 (diff) | |
Merge pull request #2788 from ton31337/fix/print_ipv6_route_if_afi
bgpd: Display `::` if AFI is IPv6, `0.0.0.0` otherwise
| -rw-r--r-- | bgpd/bgp_route.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index c1bc204df2..b66a913f54 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -9560,7 +9560,7 @@ ravg_tally (unsigned long count, unsigned long oldavg, unsigned long newval) unsigned long newtot = (count-1) * oldavg + (newval * TALLY_SIGFIG); unsigned long res = (newtot * TALLY_SIGFIG) / count; unsigned long ret = newtot / count; - + if ((res % TALLY_SIGFIG) > (TALLY_SIGFIG/2)) return ret + 1; else @@ -9654,7 +9654,7 @@ static int bgp_table_stats_walker(struct thread *t) ts->counts[BGP_STATS_ASPATH_TOTHOPS] += hops; ts->counts[BGP_STATS_ASPATH_TOTSIZE] += size; #if 0 - ts->counts[BGP_STATS_ASPATH_AVGHOPS] + ts->counts[BGP_STATS_ASPATH_AVGHOPS] = ravg_tally (ts->counts[BGP_STATS_ASPATH_COUNT], ts->counts[BGP_STATS_ASPATH_AVGHOPS], hops); @@ -10142,9 +10142,9 @@ static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi, json_scode); json_object_object_add(json, "bgpOriginCodes", json_ocode); - json_object_string_add(json, - "bgpOriginatingDefaultNetwork", - "0.0.0.0"); + json_object_string_add( + json, "bgpOriginatingDefaultNetwork", + (afi == AFI_IP) ? "0.0.0.0/0" : "::/0"); } else { vty_out(vty, "BGP table version is %" PRIu64 ", local router ID is %s, vrf id ", @@ -10158,7 +10158,8 @@ static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi, vty_out(vty, BGP_SHOW_NCODE_HEADER); vty_out(vty, BGP_SHOW_OCODE_HEADER); - vty_out(vty, "Originating default network 0.0.0.0\n\n"); + vty_out(vty, "Originating default network %s\n\n", + (afi == AFI_IP) ? "0.0.0.0/0" : "::/0"); } header1 = 0; } |
