bgpd: add handling for special label

Add handling for reserved MPLS label like IMPLICIT_NULL (3).

Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
This commit is contained in:
Ryoga Saito 2022-09-20 18:42:38 +09:00
parent bee2e7d08f
commit d8b596bd23

View File

@ -568,15 +568,32 @@ static uint32_t alloc_new_sid(struct bgp *bgp, uint32_t index,
if (index != 0) { if (index != 0) {
label = index << shift_len; label = index << shift_len;
if (label < MPLS_LABEL_UNRESERVED_MIN) {
if (debug)
zlog_debug(
"%s: skipped to allocate SRv6 SID (%pFX): Label (%u) is too small to use",
__func__, &chunk->prefix,
label);
continue;
}
transpose_sid(sid, label, offset, func_len); transpose_sid(sid, label, offset, func_len);
if (sid_exist(bgp, sid)) if (sid_exist(bgp, sid))
return false; continue;
alloced = true; alloced = true;
break; break;
} }
for (uint32_t i = 1; i < index_max; i++) { for (uint32_t i = 1; i < index_max; i++) {
label = i << shift_len; label = i << shift_len;
if (label < MPLS_LABEL_UNRESERVED_MIN) {
if (debug)
zlog_debug(
"%s: skipped to allocate SRv6 SID (%pFX): Label (%u) is too small to use",
__func__, &chunk->prefix,
label);
continue;
}
transpose_sid(sid, label, offset, func_len); transpose_sid(sid, label, offset, func_len);
if (sid_exist(bgp, sid)) if (sid_exist(bgp, sid))
continue; continue;