Skip to content

Commit

Permalink
isisd: Add pack function for SRv6 End SID Sub-TLV
Browse files Browse the repository at this point in the history
Add a function to pack an SRv6 End SID Sub-TLV
(RFC 9352 section sonic-net#7.2).

Signed-off-by: Carmine Scarpitta <[email protected]>
  • Loading branch information
cscarpitta committed Sep 11, 2023
1 parent 6605ccf commit b38fed4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions isisd/isis_tlvs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2098,6 +2098,28 @@ static void free_item_srv6_end_sid(struct isis_item *i)
XFREE(MTYPE_ISIS_SUBTLV, i);
}

static int pack_item_srv6_end_sid(struct isis_item *i, struct stream *s,
size_t *min_len)
{
struct isis_srv6_end_sid_subtlv *sid =
(struct isis_srv6_end_sid_subtlv *)i;

if (STREAM_WRITEABLE(s) < 19) {
*min_len = 19;
return 1;
}

stream_putc(s, sid->flags);
stream_putw(s, sid->behavior);
stream_put(s, &sid->sid, IPV6_MAX_BYTELEN);

/* Put 0 as Sub-Sub-TLV length, because we don't support any Sub-Sub-TLV
* at this time */
stream_putc(s, 0);

return 0;
}

/* Functions related to TLVs 1 Area Addresses */

static struct isis_item *copy_item_area_address(struct isis_item *i)
Expand Down

0 comments on commit b38fed4

Please sign in to comment.