From 325671b7755b7db61a586dbe7732d9a8e7644b46 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 12 Jun 2015 07:59:08 -0700 Subject: [PATCH] With the dynamic update groups feature, BGP updates are formed for an update group and then replicated and sent for each member peer. The nexthop field in the update is set only as part of this final step, as it may differ per member peer. Update logs to display the final nexthop that is sent. --- bgpd/bgp_packet.c | 4 ---- bgpd/bgp_updgrp_packet.c | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 4f42005c1b..41ee5d248b 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -262,10 +262,6 @@ bgp_write_packet (struct peer *peer) */ s = bpacket_reformat_for_peer (next_pkt, paf); bpacket_queue_advance_peer (paf); - if (bgp_debug_update(peer, NULL, NULL, 0)) - zlog_debug ("u%" PRIu64 ":s%" PRIu64 "%s send UPDATE len %zu ", - PAF_SUBGRP(paf)->update_group->id, PAF_SUBGRP(paf)->id, - peer->host, (stream_get_endp(s) - stream_get_getp(s))); return s; } diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c index b2c78f2c97..9aa7a4301f 100644 --- a/bgpd/bgp_updgrp_packet.c +++ b/bgpd/bgp_updgrp_packet.c @@ -409,6 +409,8 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) struct stream *s = NULL; bpacket_attr_vec *vec; struct peer *peer; + char buf[BUFSIZ]; + char buf2[BUFSIZ]; s = stream_dup (pkt->buffer); peer = PAF_PEER(paf); @@ -471,6 +473,11 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) if (nh_modified) stream_put_in_addr_at (s, vec->offset + 1, mod_v4nh); + if (bgp_debug_update(peer, NULL, NULL, 0)) + zlog_debug ("u" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ nexthop %s", + PAF_SUBGRP(paf)->update_group->id, PAF_SUBGRP(paf)->id, + peer->host, inet_ntoa (*mod_v4nh)); + } else if (paf->afi == AFI_IP6 || peer_cap_enhe(peer)) { @@ -531,6 +538,23 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) stream_put_in6_addr_at (s, vec->offset + 1, mod_v6nhg); if (lnh_modified) stream_put_in6_addr_at (s, vec->offset + 1 + 16, mod_v6nhl); + + if (bgp_debug_update(peer, NULL, NULL, 0)) + { + if (nhlen == 32) + zlog_debug ("u" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ mp_nexthops %s, %s", + PAF_SUBGRP(paf)->update_group->id, + PAF_SUBGRP(paf)->id, + peer->host, + inet_ntop (AF_INET6, mod_v6nhg, buf, BUFSIZ), + inet_ntop (AF_INET6, mod_v6nhl, buf2, BUFSIZ)); + else + zlog_debug ("u" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ mp_nexthop %s", + PAF_SUBGRP(paf)->update_group->id, + PAF_SUBGRP(paf)->id, + peer->host, + inet_ntop (AF_INET6, mod_v6nhg, buf, BUFSIZ)); + } } } -- 2.39.5