diff options
| -rw-r--r-- | bgpd/bgp_conditional_adv.c | 22 | ||||
| -rw-r--r-- | bgpd/bgp_route.c | 26 | ||||
| -rw-r--r-- | bgpd/bgp_updgrp.c | 8 | ||||
| -rw-r--r-- | bgpd/bgpd.c | 87 | ||||
| -rw-r--r-- | bgpd/bgpd.h | 33 | ||||
| -rw-r--r-- | ospf6d/ospf6_interface.c | 5 | ||||
| -rw-r--r-- | ospfd/ospf_abr.c | 2 | ||||
| -rw-r--r-- | redhat/frr.spec.in | 3 | ||||
| -rw-r--r-- | zebra/zebra_pw.c | 7 |
9 files changed, 114 insertions, 79 deletions
diff --git a/bgpd/bgp_conditional_adv.c b/bgpd/bgp_conditional_adv.c index 9c2826fa13..fc44e86cbc 100644 --- a/bgpd/bgp_conditional_adv.c +++ b/bgpd/bgp_conditional_adv.c @@ -258,6 +258,25 @@ static void bgp_conditional_adv_timer(struct thread *t) ? UPDATE_TYPE_WITHDRAW : UPDATE_TYPE_ADVERTISE; + /* + * Update condadv update type so + * subgroup_announce_check() can properly apply + * outbound policy according to advertisement state + */ + paf = peer_af_find(peer, afi, safi); + if (paf && (SUBGRP_PEER(PAF_SUBGRP(paf)) + ->filter[afi][safi] + .advmap.update_type != + filter->advmap.update_type)) { + /* Handle change to peer advmap */ + if (BGP_DEBUG(update, UPDATE_OUT)) + zlog_debug( + "%s: advmap.update_type changed for peer %s, adjusting update_group.", + __func__, peer->host); + + update_group_adjust_peer(paf); + } + /* Send regular update as per the existing policy. * There is a change in route-map, match-rule, ACLs, * or route-map filter configuration on the same peer. @@ -270,11 +289,10 @@ static void bgp_conditional_adv_timer(struct thread *t) __func__, peer->host, get_afi_safi_str(afi, safi, false)); - - paf = peer_af_find(peer, afi, safi); if (paf) { update_subgroup_split_peer(paf, NULL); subgrp = paf->subgroup; + if (subgrp && subgrp->update_group) subgroup_announce_table( paf->subgroup, NULL); diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 2e7dbaaf66..a8cf9ca3c0 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -2212,6 +2212,32 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi, bgp_peer_remove_private_as(bgp, afi, safi, peer, attr); bgp_peer_as_override(bgp, afi, safi, peer, attr); + if (filter->advmap.update_type == UPDATE_TYPE_WITHDRAW && + filter->advmap.aname && + route_map_lookup_by_name(filter->advmap.aname)) { + struct bgp_path_info rmap_path = {0}; + struct bgp_path_info_extra dummy_rmap_path_extra = {0}; + struct attr dummy_attr = *attr; + + /* Fill temp path_info */ + prep_for_rmap_apply(&rmap_path, &dummy_rmap_path_extra, dest, + pi, peer, &dummy_attr); + + struct route_map *amap = + route_map_lookup_by_name(filter->advmap.aname); + + ret = route_map_apply(amap, p, &rmap_path); + + bgp_attr_flush(&dummy_attr); + + /* + * The conditional advertisement mode is Withdraw and this + * prefix is a conditional prefix. Don't advertise it + */ + if (ret == RMAP_PERMITMATCH) + return false; + } + /* Route map & unsuppress-map apply. */ if (!post_attr && (ROUTE_MAP_OUT_NAME(filter) || bgp_path_suppressed(pi))) { diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c index 13d5ec6b86..f1173941a0 100644 --- a/bgpd/bgp_updgrp.c +++ b/bgpd/bgp_updgrp.c @@ -218,6 +218,8 @@ static void conf_copy(struct peer *dst, struct peer *src, afi_t afi, MTYPE_BGP_FILTER_NAME, CONDITION_MAP_NAME(srcfilter)); CONDITION_MAP(dstfilter) = CONDITION_MAP(srcfilter); } + + dstfilter->advmap.update_type = srcfilter->advmap.update_type; } /** @@ -389,6 +391,9 @@ static unsigned int updgrp_hash_key_make(const void *p) strlen(filter->advmap.aname), SEED1), key); + if (filter->advmap.update_type) + key = jhash_1word(filter->advmap.update_type, key); + if (peer->default_rmap[afi][safi].name) key = jhash_1word( jhash(peer->default_rmap[afi][safi].name, @@ -588,6 +593,9 @@ static bool updgrp_hash_cmp(const void *p1, const void *p2) && strcmp(fl1->advmap.aname, fl2->advmap.aname))) return false; + if (fl1->advmap.update_type != fl2->advmap.update_type) + return false; + if ((pe1->default_rmap[afi][safi].name && !pe2->default_rmap[afi][safi].name) || (!pe1->default_rmap[afi][safi].name diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 219dee4693..c17bd76ad7 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -482,14 +482,14 @@ void bgp_suppress_fib_pending_set(struct bgp *bgp, bool set) } /* BGP's cluster-id control. */ -int bgp_cluster_id_set(struct bgp *bgp, struct in_addr *cluster_id) +void bgp_cluster_id_set(struct bgp *bgp, struct in_addr *cluster_id) { struct peer *peer; struct listnode *node, *nnode; if (bgp_config_check(bgp, BGP_CONFIG_CLUSTER_ID) && IPV4_ADDR_SAME(&bgp->cluster_id, cluster_id)) - return 0; + return; IPV4_ADDR_COPY(&bgp->cluster_id, cluster_id); bgp_config_set(bgp, BGP_CONFIG_CLUSTER_ID); @@ -505,16 +505,15 @@ int bgp_cluster_id_set(struct bgp *bgp, struct in_addr *cluster_id) BGP_NOTIFY_CEASE_CONFIG_CHANGE); } } - return 0; } -int bgp_cluster_id_unset(struct bgp *bgp) +void bgp_cluster_id_unset(struct bgp *bgp) { struct peer *peer; struct listnode *node, *nnode; if (!bgp_config_check(bgp, BGP_CONFIG_CLUSTER_ID)) - return 0; + return; bgp->cluster_id.s_addr = 0; bgp_config_unset(bgp, BGP_CONFIG_CLUSTER_ID); @@ -530,7 +529,6 @@ int bgp_cluster_id_unset(struct bgp *bgp) BGP_NOTIFY_CEASE_CONFIG_CHANGE); } } - return 0; } /* time_t value that is monotonicly increasing @@ -623,7 +621,7 @@ void bgp_confederation_id_set(struct bgp *bgp, as_t as) return; } -int bgp_confederation_id_unset(struct bgp *bgp) +void bgp_confederation_id_unset(struct bgp *bgp) { struct peer *peer; struct listnode *node, *nnode; @@ -645,7 +643,6 @@ int bgp_confederation_id_unset(struct bgp *bgp) bgp_session_reset_safe(peer, &nnode); } } - return 0; } /* Is an AS part of the confed or not? */ @@ -664,16 +661,16 @@ bool bgp_confederation_peers_check(struct bgp *bgp, as_t as) } /* Add an AS to the confederation set. */ -int bgp_confederation_peers_add(struct bgp *bgp, as_t as) +void bgp_confederation_peers_add(struct bgp *bgp, as_t as) { struct peer *peer; struct listnode *node, *nnode; if (bgp->as == as) - return BGP_ERR_INVALID_AS; + return; if (bgp_confederation_peers_check(bgp, as)) - return -1; + return; bgp->confed_peers = XREALLOC(MTYPE_BGP_CONFED_LIST, bgp->confed_peers, @@ -699,11 +696,10 @@ int bgp_confederation_peers_add(struct bgp *bgp, as_t as) } } } - return 0; } /* Delete an AS from the confederation set. */ -int bgp_confederation_peers_remove(struct bgp *bgp, as_t as) +void bgp_confederation_peers_remove(struct bgp *bgp, as_t as) { int i; int j; @@ -711,10 +707,10 @@ int bgp_confederation_peers_remove(struct bgp *bgp, as_t as) struct listnode *node, *nnode; if (!bgp) - return -1; + return; if (!bgp_confederation_peers_check(bgp, as)) - return -1; + return; for (i = 0; i < bgp->confed_peers_cnt; i++) if (bgp->confed_peers[i] == as) @@ -751,71 +747,58 @@ int bgp_confederation_peers_remove(struct bgp *bgp, as_t as) } } } - - return 0; } /* Local preference configuration. */ -int bgp_default_local_preference_set(struct bgp *bgp, uint32_t local_pref) +void bgp_default_local_preference_set(struct bgp *bgp, uint32_t local_pref) { if (!bgp) - return -1; + return; bgp->default_local_pref = local_pref; - - return 0; } -int bgp_default_local_preference_unset(struct bgp *bgp) +void bgp_default_local_preference_unset(struct bgp *bgp) { if (!bgp) - return -1; + return; bgp->default_local_pref = BGP_DEFAULT_LOCAL_PREF; - - return 0; } /* Local preference configuration. */ -int bgp_default_subgroup_pkt_queue_max_set(struct bgp *bgp, uint32_t queue_size) +void bgp_default_subgroup_pkt_queue_max_set(struct bgp *bgp, + uint32_t queue_size) { if (!bgp) - return -1; + return; bgp->default_subgroup_pkt_queue_max = queue_size; - - return 0; } -int bgp_default_subgroup_pkt_queue_max_unset(struct bgp *bgp) +void bgp_default_subgroup_pkt_queue_max_unset(struct bgp *bgp) { if (!bgp) - return -1; + return; bgp->default_subgroup_pkt_queue_max = BGP_DEFAULT_SUBGROUP_PKT_QUEUE_MAX; - - return 0; } /* Listen limit configuration. */ -int bgp_listen_limit_set(struct bgp *bgp, int listen_limit) +void bgp_listen_limit_set(struct bgp *bgp, int listen_limit) { if (!bgp) - return -1; + return; bgp->dynamic_neighbors_limit = listen_limit; - - return 0; } -int bgp_listen_limit_unset(struct bgp *bgp) +void bgp_listen_limit_unset(struct bgp *bgp) { if (!bgp) - return -1; + return; bgp->dynamic_neighbors_limit = BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT; - - return 0; } int bgp_map_afi_safi_iana2int(iana_afi_t pkt_afi, iana_safi_t pkt_safi, @@ -1828,7 +1811,7 @@ struct peer *peer_create_accept(struct bgp *bgp) /* * Return true if we have a peer configured to use this afi/safi */ -int bgp_afi_safi_peer_exists(struct bgp *bgp, afi_t afi, safi_t safi) +bool bgp_afi_safi_peer_exists(struct bgp *bgp, afi_t afi, safi_t safi) { struct listnode *node; struct peer *peer; @@ -1838,10 +1821,10 @@ int bgp_afi_safi_peer_exists(struct bgp *bgp, afi_t afi, safi_t safi) continue; if (peer->afc[afi][safi]) - return 1; + return true; } - return 0; + return false; } /* Change peer's AS number. */ @@ -5127,7 +5110,7 @@ int peer_update_source_if_set(struct peer *peer, const char *ifname) return 0; } -int peer_update_source_addr_set(struct peer *peer, const union sockunion *su) +void peer_update_source_addr_set(struct peer *peer, const union sockunion *su) { struct peer *member; struct listnode *node, *nnode; @@ -5136,7 +5119,7 @@ int peer_update_source_addr_set(struct peer *peer, const union sockunion *su) peer_flag_set(peer, PEER_FLAG_UPDATE_SOURCE); if (peer->update_source) { if (sockunion_cmp(peer->update_source, su) == 0) - return 0; + return; sockunion_free(peer->update_source); } peer->update_source = sockunion_dup(su); @@ -5157,7 +5140,7 @@ int peer_update_source_addr_set(struct peer *peer, const union sockunion *su) bgp_peer_bfd_update_source(peer); /* Skip peer-group mechanics for regular peers. */ - return 0; + return; } /* @@ -5193,17 +5176,15 @@ int peer_update_source_addr_set(struct peer *peer, const union sockunion *su) if (member->bfd_config) bgp_peer_bfd_update_source(member); } - - return 0; } -int peer_update_source_unset(struct peer *peer) +void peer_update_source_unset(struct peer *peer) { struct peer *member; struct listnode *node, *nnode; if (!CHECK_FLAG(peer->flags, PEER_FLAG_UPDATE_SOURCE)) - return 0; + return; /* Inherit configuration from peer-group if peer is member. */ if (peer_group_active(peer)) { @@ -5234,7 +5215,7 @@ int peer_update_source_unset(struct peer *peer) bgp_peer_bfd_update_source(peer); /* Skip peer-group mechanics for regular peers. */ - return 0; + return; } /* @@ -5269,8 +5250,6 @@ int peer_update_source_unset(struct peer *peer) if (member->bfd_config) bgp_peer_bfd_update_source(member); } - - return 0; } int peer_default_originate_set(struct peer *peer, afi_t afi, safi_t safi, diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index bcb214873f..8348b37b8e 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -2128,32 +2128,34 @@ extern void bgp_router_id_static_set(struct bgp *, struct in_addr); extern void bm_wait_for_fib_set(bool set); extern void bgp_suppress_fib_pending_set(struct bgp *bgp, bool set); -extern int bgp_cluster_id_set(struct bgp *, struct in_addr *); -extern int bgp_cluster_id_unset(struct bgp *); +extern void bgp_cluster_id_set(struct bgp *bgp, struct in_addr *cluster_id); +extern void bgp_cluster_id_unset(struct bgp *bgp); -extern void bgp_confederation_id_set(struct bgp *, as_t); -extern int bgp_confederation_id_unset(struct bgp *); +extern void bgp_confederation_id_set(struct bgp *bgp, as_t as); +extern void bgp_confederation_id_unset(struct bgp *bgp); extern bool bgp_confederation_peers_check(struct bgp *, as_t); -extern int bgp_confederation_peers_add(struct bgp *, as_t); -extern int bgp_confederation_peers_remove(struct bgp *, as_t); +extern void bgp_confederation_peers_add(struct bgp *bgp, as_t as); +extern void bgp_confederation_peers_remove(struct bgp *bgp, as_t as); extern void bgp_timers_set(struct bgp *, uint32_t keepalive, uint32_t holdtime, uint32_t connect_retry, uint32_t delayopen); extern void bgp_timers_unset(struct bgp *); -extern int bgp_default_local_preference_set(struct bgp *, uint32_t); -extern int bgp_default_local_preference_unset(struct bgp *); +extern void bgp_default_local_preference_set(struct bgp *bgp, + uint32_t local_pref); +extern void bgp_default_local_preference_unset(struct bgp *bgp); -extern int bgp_default_subgroup_pkt_queue_max_set(struct bgp *bgp, uint32_t); -extern int bgp_default_subgroup_pkt_queue_max_unset(struct bgp *bgp); +extern void bgp_default_subgroup_pkt_queue_max_set(struct bgp *bgp, + uint32_t queue_size); +extern void bgp_default_subgroup_pkt_queue_max_unset(struct bgp *bgp); -extern int bgp_listen_limit_set(struct bgp *, int); -extern int bgp_listen_limit_unset(struct bgp *); +extern void bgp_listen_limit_set(struct bgp *bgp, int listen_limit); +extern void bgp_listen_limit_unset(struct bgp *bgp); extern bool bgp_update_delay_active(struct bgp *); extern bool bgp_update_delay_configured(struct bgp *); -extern int bgp_afi_safi_peer_exists(struct bgp *bgp, afi_t afi, safi_t safi); +extern bool bgp_afi_safi_peer_exists(struct bgp *bgp, afi_t afi, safi_t safi); extern void peer_as_change(struct peer *, as_t, int); extern int peer_remote_as(struct bgp *, union sockunion *, const char *, as_t *, int); @@ -2194,8 +2196,9 @@ extern void peer_description_set(struct peer *, const char *); extern void peer_description_unset(struct peer *); extern int peer_update_source_if_set(struct peer *, const char *); -extern int peer_update_source_addr_set(struct peer *, const union sockunion *); -extern int peer_update_source_unset(struct peer *); +extern void peer_update_source_addr_set(struct peer *peer, + const union sockunion *su); +extern void peer_update_source_unset(struct peer *peer); extern int peer_default_originate_set(struct peer *peer, afi_t afi, safi_t safi, const char *rmap, diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 11a8879904..155374d3f0 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -1712,8 +1712,11 @@ void ospf6_interface_start(struct ospf6_interface *oi) if (oi->area_id_format == OSPF6_AREA_FMT_UNSET) return; - if (oi->area) + if (oi->area) { + /* Recompute cost */ + ospf6_interface_recalculate_cost(oi); return; + } ospf6 = oi->interface->vrf->info; if (!ospf6) diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c index 13243a55af..b7db1a6a83 100644 --- a/ospfd/ospf_abr.c +++ b/ospfd/ospf_abr.c @@ -1067,7 +1067,7 @@ static void ospf_abr_process_network_rt(struct ospf *ospf, && !OSPF_IS_AREA_ID_BACKBONE(or->u.std.area_id)) { if (IS_DEBUG_OSPF_EVENT) zlog_debug( - "ospf_abr_process_network_rt(): this is route is not backbone one, skipping"); + "ospf_abr_process_network_rt(): this route is not backbone one, skipping"); continue; } diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index c94785ec01..962541405f 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -409,9 +409,6 @@ routing state through standard SNMP MIBs. --disable-bgp-vnc \ %endif --enable-isisd \ -%if "%{initsystem}" == "systemd" - --enable-systemd \ -%endif --enable-rpki \ %if %{with_bfdd} --enable-bfdd \ diff --git a/zebra/zebra_pw.c b/zebra/zebra_pw.c index 6dde513f40..be089fc759 100644 --- a/zebra/zebra_pw.c +++ b/zebra/zebra_pw.c @@ -101,13 +101,15 @@ void zebra_pw_del(struct zebra_vrf *zvrf, struct zebra_pw *pw) if (pw->status == PW_FORWARDING) { hook_call(pw_uninstall, pw); dplane_pw_uninstall(pw); - } else if (pw->install_retry_timer) - THREAD_OFF(pw->install_retry_timer); + } + + THREAD_OFF(pw->install_retry_timer); /* unlink and release memory */ RB_REMOVE(zebra_pw_head, &zvrf->pseudowires, pw); if (pw->protocol == ZEBRA_ROUTE_STATIC) RB_REMOVE(zebra_static_pw_head, &zvrf->static_pseudowires, pw); + XFREE(MTYPE_PW, pw); } @@ -230,7 +232,6 @@ static void zebra_pw_install_retry(struct thread *thread) { struct zebra_pw *pw = THREAD_ARG(thread); - pw->install_retry_timer = NULL; zebra_pw_install(pw); } |
