]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_updgrp.c
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / bgpd / bgp_updgrp.c
index afd2107b48fbc7720a02b2d407d8e1f9c16c2645..a32cdb1ba42c1a212d1b928ece14083af1d525ce 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /**
  * bgp_updgrp.c: BGP update group structures
  *
@@ -6,22 +7,6 @@
  * @author Avneesh Sachdev <avneesh@sproute.net>
  * @author Rajesh Varadarajan <rajesh@sproute.net>
  * @author Pradosh Mohapatra <pradosh@sproute.net>
- *
- * This file is part of GNU Zebra.
- *
- * GNU Zebra is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * GNU Zebra is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <zebra.h>
@@ -164,6 +149,7 @@ static void conf_copy(struct peer *dst, struct peer *src, afi_t afi,
        dst->change_local_as = src->change_local_as;
        dst->shared_network = src->shared_network;
        dst->local_role = src->local_role;
+       dst->as_path_loop_detection = src->as_path_loop_detection;
 
        if (src->soo[afi][safi]) {
                ecommunity_free(&dst->soo[afi][safi]);
@@ -360,6 +346,9 @@ static unsigned int updgrp_hash_key_make(const void *p)
        key = jhash_1word(peer->max_packet_size, key);
        key = jhash_1word(peer->pmax_out[afi][safi], key);
 
+       if (peer->as_path_loop_detection)
+               key = jhash_2words(peer->as, peer->as_path_loop_detection, key);
+
        if (peer->group)
                key = jhash_1word(jhash(peer->group->name,
                                        strlen(peer->group->name), SEED1),
@@ -454,12 +443,13 @@ static unsigned int updgrp_hash_key_make(const void *p)
                        (intmax_t)CHECK_FLAG(peer->flags, PEER_UPDGRP_FLAGS),
                        (intmax_t)CHECK_FLAG(flags, PEER_UPDGRP_AF_FLAGS));
                zlog_debug(
-                       "%pBP Update Group Hash: addpath: %u UpdGrpCapFlag: %u UpdGrpCapAFFlag: %u route_adv: %u change local as: %u",
+                       "%pBP Update Group Hash: addpath: %u UpdGrpCapFlag: %u UpdGrpCapAFFlag: %u route_adv: %u change local as: %u, as_path_loop_detection: %d",
                        peer, (uint32_t)peer->addpath_type[afi][safi],
                        CHECK_FLAG(peer->cap, PEER_UPDGRP_CAP_FLAGS),
                        CHECK_FLAG(peer->af_cap[afi][safi],
                                   PEER_UPDGRP_AF_CAP_FLAGS),
-                       peer->v_routeadv, peer->change_local_as);
+                       peer->v_routeadv, peer->change_local_as,
+                       peer->as_path_loop_detection);
                zlog_debug(
                        "%pBP Update Group Hash: max packet size: %u pmax_out: %u Peer Group: %s rmap out: %s",
                        peer, peer->max_packet_size, peer->pmax_out[afi][safi],