Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions bgpd/bgp_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -3757,6 +3757,15 @@ static enum bgp_attr_parse_ret bgp_attr_srv6_service(struct bgp_attr_parser_args
size_t start;
size_t consumed;

/* We already processed an SID Information Sub-TLV. RFC 9252 says
* that when multiple instances are present, the ingress PE SHOULD use
* the SID from the first, so ignore this subsequent instance.
*/
if (bgp_attr_get_srv6_l3service(attr)) {
stream_forward_getp(connection->curr, length);
return BGP_ATTR_PARSE_PROCEED;
}

if (length < BGP_PREFIX_SID_SRV6_L3_SERVICE_SID_INFO_LENGTH) {
flog_err(EC_BGP_ATTR_LEN,
"Malformed SRv6 Service Sub-TLV attribute - declared length %u is less than minimum %d",
Expand All @@ -3779,13 +3788,6 @@ static enum bgp_attr_parse_ret bgp_attr_srv6_service(struct bgp_attr_parser_args
__func__, &ipv6_sid, sid_flags, endpoint_behavior);

/* Configure from Info */
if (bgp_attr_get_srv6_l3service(attr)) {
flog_err(EC_BGP_ATTRIBUTE_REPEATED,
"Prefix SID SRv6 L3 Service field repeated");
return bgp_attr_malformed(
args, BGP_NOTIFY_UPDATE_MAL_ATTR, args->total);
}

struct bgp_attr_srv6_l3service *srv6_l3service =
XCALLOC(MTYPE_BGP_SRV6_L3SERVICE, sizeof(struct bgp_attr_srv6_l3service));

Expand Down
31 changes: 31 additions & 0 deletions tests/bgpd/test_mp_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,37 @@ static struct test_segment mp_prefix_sid[] = {
.len = 37,
.parses = SHOULD_WITHDRAW,
},
{
.name = "PREFIX-SID-SRv6-L3-Service-repeated-sid-info",
.desc = "PREFIX-SID accepts repeated SRv6 SID Information Sub-TLVs",
.data = {
0x05, /* Type 0x05: SRv6 L3 Service */
0x00, 0x31, /* Length */
0x00, /* Reserved */
0x01, /* Sub-TLV type: SID Information */
0x00, 0x15, /* Sub-TLV length */
0x00, /* Reserved */
0xfc, 0xbb, 0xbb, 0xbb, /* First SID: fcbb:bbbb:1:e000:: */
0x00, 0x01, 0xe0, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, /* SID flags */
0x00, 0x40, /* Endpoint behavior */
0x00, /* Reserved */
0x01, /* Repeated Sub-TLV type: SID Information */
0x00, 0x15, /* Sub-TLV length */
0x00, /* Reserved */
0xfc, 0xbb, 0xbb, 0xbb, /* Second SID: fcbb:bbbb:1:e001:: */
0x00, 0x01, 0xe0, 0x01,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, /* SID flags */
0x00, 0x3e, /* Endpoint behavior */
0x00, /* Reserved */
},
.len = 52,
.parses = SHOULD_PARSE,
},
{NULL, NULL, { 0 }, 0, 0},
};

Expand Down
3 changes: 3 additions & 0 deletions tests/bgpd/test_mp_attr.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@ class TestMpAttr(frrtest.TestMultiOut):
TestMpAttr.okfail(
"PREFIX-SID-SRv6-L3-Service-sid-structure-bad-transposition: PREFIX-SID rejects an SRv6 SID Structure Sub-Sub-TLV with bad transposition"
)
TestMpAttr.okfail(
"PREFIX-SID-SRv6-L3-Service-repeated-sid-info: PREFIX-SID accepts repeated SRv6 SID Information Sub-TLVs"
)
Loading