struct attr *attr, struct bgp_dest *dest);
extern int bgp_evpn_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
struct bgp_path_info *exist, int *paths_eq);
+extern void subgroup_announce_reset_nhop(uint8_t family, struct attr *attr);
#endif /* _QUAGGA_BGP_ROUTE_H */
struct bgp *bgp;
struct attr attr;
struct attr *new_attr = &attr;
- struct aspath *aspath;
struct prefix p;
struct peer *from;
struct bgp_dest *dest;
from = bgp->peer_self;
bgp_attr_default_set(&attr, BGP_ORIGIN_IGP);
- aspath = attr.aspath;
attr.local_pref = bgp->default_local_pref;
}
if (peer->default_rmap[afi][safi].name) {
- struct attr attr_tmp = attr;
- struct bgp_path_info bpi_rmap = {0};
-
- bpi_rmap.peer = bgp->peer_self;
- bpi_rmap.attr = &attr_tmp;
-
SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_DEFAULT);
/* Iterate over the RIB to see if we can announce
if (!bgp_dest_has_bgp_path_info_data(dest))
continue;
- ret = route_map_apply(peer->default_rmap[afi][safi].map,
- bgp_dest_get_prefix(dest),
- RMAP_BGP, &bpi_rmap);
+ for (pi = bgp_dest_get_bgp_path_info(dest); pi;
+ pi = pi->next) {
+ struct attr tmp_attr;
+ struct bgp_path_info tmp_pi;
+ struct bgp_path_info_extra tmp_pie;
+
+ tmp_attr = *pi->attr;
+
+ prep_for_rmap_apply(&tmp_pi, &tmp_pie, dest, pi,
+ pi->peer, &tmp_attr);
- if (ret != RMAP_DENYMATCH)
+ ret = route_map_apply(
+ peer->default_rmap[afi][safi].map,
+ bgp_dest_get_prefix(dest), RMAP_BGP,
+ &tmp_pi);
+
+ if (ret == RMAP_DENYMATCH) {
+ bgp_attr_flush(&tmp_attr);
+ continue;
+ } else {
+ new_attr = bgp_attr_intern(&tmp_attr);
+ new_attr->aspath = attr.aspath;
+
+ subgroup_announce_reset_nhop(
+ (peer_cap_enhe(peer, afi, safi)
+ ? AF_INET6
+ : AF_INET),
+ new_attr);
+
+ break;
+ }
+ }
+ if (ret == RMAP_PERMITMATCH)
break;
}
bgp->peer_self->rmap_type = 0;
- new_attr = bgp_attr_intern(&attr_tmp);
- if (ret == RMAP_DENYMATCH) {
- bgp_attr_flush(&attr_tmp);
+ if (ret == RMAP_DENYMATCH)
withdraw = 1;
- }
}
/* Check if the default route is in local BGP RIB which is
subgroup_default_update_packet(subgrp, new_attr, from);
}
}
-
- aspath_unintern(&aspath);
}
/*