#include "bgpd/bgp_debug.h"
#include "bgpd/bgp_errors.h"
-static int bgp_fs_nlri_validate(uint8_t *nlri_content, uint32_t len)
+static int bgp_fs_nlri_validate(uint8_t *nlri_content, uint32_t len,
+ afi_t afi)
{
uint32_t offset = 0;
int type;
ret = bgp_flowspec_ip_address(
BGP_FLOWSPEC_VALIDATE_ONLY,
nlri_content + offset,
- len - offset, NULL, &error);
+ len - offset, NULL, &error,
+ afi, NULL);
+ break;
+ case FLOWSPEC_FLOW_LABEL:
+ if (afi == AFI_IP)
+ return -1;
+ ret = bgp_flowspec_op_decode(BGP_FLOWSPEC_VALIDATE_ONLY,
+ nlri_content + offset,
+ len - offset, NULL, &error);
break;
case FLOWSPEC_IP_PROTOCOL:
case FLOWSPEC_PORT:
afi = packet->afi;
safi = packet->safi;
- if (afi == AFI_IP6) {
- flog_err(EC_LIB_DEVELOPMENT, "BGP flowspec IPv6 not supported");
- return BGP_NLRI_PARSE_ERROR_FLOWSPEC_IPV6_NOT_SUPPORTED;
- }
-
if (packet->length >= FLOWSPEC_NLRI_SIZELIMIT_EXTENDED) {
flog_err(EC_BGP_FLOWSPEC_PACKET,
"BGP flowspec nlri length maximum reached (%u)",
psize);
return BGP_NLRI_PARSE_ERROR_PACKET_OVERFLOW;
}
- if (bgp_fs_nlri_validate(pnt, psize) < 0) {
+ if (bgp_fs_nlri_validate(pnt, psize, afi) < 0) {
flog_err(
EC_BGP_FLOWSPEC_PACKET,
"Bad flowspec format or NLRI options not supported");
p.prefixlen = 0;
/* Flowspec encoding is in bytes */
p.u.prefix_flowspec.prefixlen = psize;
+ p.u.prefix_flowspec.family = afi2family(afi);
temp = XCALLOC(MTYPE_TMP, psize);
memcpy(temp, pnt, psize);
p.u.prefix_flowspec.ptr = (uintptr_t) temp;
p.u.prefix_flowspec.ptr,
p.u.prefix_flowspec.prefixlen,
return_string,
- NLRI_STRING_FORMAT_MIN, NULL);
+ NLRI_STRING_FORMAT_MIN, NULL,
+ afi);
snprintf(ec_string, sizeof(ec_string),
"EC{none}");
if (attr && attr->ecommunity) {