#define SET_LABEL(label) ((label << 8) & SET_LABEL_MASK)
#define GET_LABEL(label) ((label >> 8) & GET_LABEL_MASK)
-#define OSPF_SR_DEFAULT_METRIC 1
+/* smallest configurable SRGB / SRLB sizes */
+#define MIN_SRLB_SIZE 16
+#define MIN_SRGB_SIZE 16
/* Segment Routing TLVs as per RFC 8665 */
/* SID/Label Sub TLV - section 2.1 */
#define SUBTLV_SID_LABEL 1
-#define SUBTLV_SID_LABEL_SIZE 8
+#define SUBTLV_SID_LABEL_SIZE 4
struct subtlv_sid_label {
/* Length is 3 (20 rightmost bits MPLS label) or 4 (32 bits SID) */
struct tlv_header header;
/* RI SID/Label Range TLV used for SRGB & SRLB - section 3.2 & 3.3 */
#define RI_SR_TLV_SRGB_LABEL_RANGE 9
#define RI_SR_TLV_SRLB_LABEL_RANGE 14
+#define RI_SR_TLV_LABEL_RANGE_SIZE 12
struct ri_sr_tlv_sid_label_range {
struct tlv_header header;
/* Only 24 upper most bits are significant */
/* RI Node/MSD TLV as per RFC 8476 */
#define RI_SR_TLV_NODE_MSD 12
+#define RI_SR_TLV_NODE_MSD_SIZE 4
struct ri_sr_tlv_node_msd {
struct tlv_header header;
uint8_t subtype; /* always = 1 */
/* Default min and size of SR Global Block label range */
#define DEFAULT_SRGB_LABEL 16000
#define DEFAULT_SRGB_SIZE 8000
+#define DEFAULT_SRGB_END (DEFAULT_SRGB_LABEL + DEFAULT_SRGB_SIZE - 1)
/* Default min and size of SR Local Block label range */
#define DEFAULT_SRLB_LABEL 15000
#define DEFAULT_SRLB_SIZE 1000
+#define DEFAULT_SRLB_END (DEFAULT_SRLB_LABEL + DEFAULT_SRLB_SIZE - 1)
/* Structure aggregating SR Range Block info retrieved from an lsa */
struct sr_block {
enum sid_type { PREF_SID, LOCAL_SID, ADJ_SID, LAN_ADJ_SID };
/* Status of Segment Routing: Off (Disable), On (Enable), (Up) Started */
-enum sr_status { SR_OFF, SR_ON, SR_UP, SR_DOWN };
+enum sr_status { SR_OFF, SR_ON, SR_UP };
/* Structure aggregating all OSPF Segment Routing information for the node */
struct ospf_sr_db {