bgpd: Do not send notification twice when parsing NLRI labels

This is already handled in bgp_nlri_parse() by checking error code.

Even more, we should send error sub-code to be according the NLRI type.

If it's MP_UPDATE/MP_WITHDRAW, sub-code should be an Optional Attribute error.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
Donatas Abraitis 2023-03-05 20:56:05 +02:00
parent e618cc7b21
commit bfeb86dfa8

View File

@ -388,8 +388,6 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr,
EC_BGP_UPDATE_RCV,
"%s [Error] Update packet error (wrong label length 0)",
peer->host);
bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_INVAL_NETWORK);
return BGP_NLRI_PARSE_ERROR_LABEL_LENGTH;
}
p.prefixlen = prefixlen - BSIZE(llen);
@ -399,8 +397,6 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr,
flog_err(EC_BGP_UPDATE_RCV,
"%s [Error] Update packet error (wrong label length %d)",
peer->host, prefixlen);
bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_INVAL_NETWORK);
return BGP_NLRI_PARSE_ERROR_LABEL_LENGTH;
}