]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_updgrp_packet.c
bgpd: Adding BGP GR Global & Per Neighbour FSM changes
[mirror_frr.git] / bgpd / bgp_updgrp_packet.c
index 9329c8d8922af4978a693f44b3397318098cd42b..39eb065288fc4a3f4a384014a458fb43acc6ae4c 100644 (file)
@@ -744,6 +744,22 @@ struct bpacket *subgroup_update_packet(struct update_subgroup *subgrp)
                addpath_tx_id = adj->addpath_tx_id;
                path = adv->pathi;
 
+               /* Check if we need to add a prefix to the packet if
+                * maximum-prefix-out is set for the peer.
+                */
+               if (CHECK_FLAG(peer->af_flags[afi][safi],
+                              PEER_FLAG_MAX_PREFIX_OUT)
+                   && subgrp->scount >= peer->pmax_out[afi][safi]) {
+                       if (BGP_DEBUG(update, UPDATE_OUT)
+                           || BGP_DEBUG(update, UPDATE_PREFIX)) {
+                               zlog_debug(
+                                       "%s reached maximum prefix to be send (%" PRIu32
+                                       ")",
+                                       peer->host, peer->pmax_out[afi][safi]);
+                       }
+                       goto next;
+               }
+
                space_remaining = STREAM_CONCAT_REMAIN(s, snlri, STREAM_SIZE(s))
                                  - BGP_MAX_PACKET_SIZE_OVERFLOW;
                space_needed =
@@ -894,7 +910,7 @@ struct bpacket *subgroup_update_packet(struct update_subgroup *subgrp)
                        subgrp->scount++;
 
                adj->attr = bgp_attr_intern(adv->baa->attr);
-
+next:
                adv = bgp_advertise_clean_subgroup(subgrp, adj);
        }