bgpd: handle more than one ext. community

The ecommunity was badly read. This fix ensures that all ecom are reads
and stored in local structure.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
Philippe Guibert 2018-05-03 14:08:38 +02:00
parent 4762c2137d
commit 149d272b37

View File

@ -332,15 +332,15 @@ static int bgp_pbr_build_and_validate_entry(struct prefix *p,
ecom = info->attr->ecommunity; ecom = info->attr->ecommunity;
for (i = 0; i < ecom->size; i++) { for (i = 0; i < ecom->size; i++) {
ecom_eval = (struct ecommunity_val *) ecom_eval = (struct ecommunity_val *)
ecom->val + (i * ECOMMUNITY_SIZE); (ecom->val + (i * ECOMMUNITY_SIZE));
action_count++;
if (action_count > ACTIONS_MAX_NUM) { if (action_count > ACTIONS_MAX_NUM) {
if (BGP_DEBUG(pbr, PBR_ERROR)) if (BGP_DEBUG(pbr, PBR_ERROR))
zlog_err("%s: flowspec actions exceeds limit (max %u)", zlog_err("%s: flowspec actions exceeds limit (max %u)",
__func__, action_count); __func__, action_count);
break; break;
} }
api_action = &api->actions[action_count]; api_action = &api->actions[action_count - 1];
if ((ecom_eval->val[1] == if ((ecom_eval->val[1] ==
(char)ECOMMUNITY_REDIRECT_VRF) && (char)ECOMMUNITY_REDIRECT_VRF) &&