static struct bgp_path_info *
bgp_create_evpn_bgp_path_info(struct bgp_path_info *parent_pi,
- struct bgp_node *rn)
+ struct bgp_node *rn, struct attr *attr)
{
struct attr *attr_new;
struct bgp_path_info *pi;
/* Add (or update) attribute to hash. */
- attr_new = bgp_attr_intern(parent_pi->attr);
+ attr_new = bgp_attr_intern(attr);
/* Create new route with its attribute. */
pi = info_make(parent_pi->type, BGP_ROUTE_IMPORTED, 0, parent_pi->peer,
break;
if (!pi)
- pi = bgp_create_evpn_bgp_path_info(parent_pi, rn);
+ pi = bgp_create_evpn_bgp_path_info(parent_pi, rn, &attr);
else {
if (attrhash_cmp(pi->attr, &attr)
&& !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
pi->attr = attr_new;
pi->uptime = bgp_clock();
}
+ /* as it is an importation, change nexthop */
+ bgp_path_info_set_flag(rn, pi, BGP_PATH_ANNC_NH_SELF);
bgp_aggregate_increment(bgp_vrf, &rn->p, pi, afi, safi);
if (!pi) {
/* Create an info */
- (void)bgp_create_evpn_bgp_path_info(parent_pi, rn);
+ (void)bgp_create_evpn_bgp_path_info(parent_pi, rn,
+ parent_pi->attr);
} else {
if (attrhash_cmp(pi->attr, parent_pi->attr)
&& !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
uint32_t eth_tag;
mpls_label_t label; /* holds the VNI as in the packet */
int ret;
+ afi_t gw_afi;
+ bool is_valid_update = false;
/* Type-5 route should be 34 or 58 bytes:
* RD (8), ESI (10), Eth Tag (4), IP len (1), IP (4 or 16),
pfx += 4;
memcpy(&evpn.gw_ip.ipv4, pfx, 4);
pfx += 4;
+ gw_afi = AF_INET;
} else {
SET_IPADDR_V6(&p.prefix.prefix_addr.ip);
memcpy(&p.prefix.prefix_addr.ip.ipaddr_v6, pfx, 16);
pfx += 16;
memcpy(&evpn.gw_ip.ipv6, pfx, 16);
pfx += 16;
+ gw_afi = AF_INET6;
}
/* Get the VNI (in MPLS label field). Stored as bytes here. */
* field
*/
+ if (attr) {
+ is_valid_update = true;
+ if (is_zero_mac(&attr->rmac) && is_zero_esi(&evpn.eth_s_id) &&
+ is_zero_gw_ip(&evpn.gw_ip, gw_afi))
+ is_valid_update = false;
+
+ if (is_mcast_mac(&attr->rmac) || is_bcast_mac(&attr->rmac))
+ is_valid_update = false;
+ }
+
/* Process the route. */
- if (attr)
+ if (is_valid_update)
ret = bgp_update(peer, (struct prefix *)&p, addpath_id, attr,
afi, safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL,
&prd, &label, 1, 0, &evpn);