}
/* Increment instance value for Extended Prefix Opaque LSAs Opaque ID field */
-static u_int32_t get_ext_pref_instance_value(void)
+static uint32_t get_ext_pref_instance_value(void)
{
- static u_int32_t seqno = 0;
+ static uint32_t seqno = 0;
if (seqno < MAX_LEGAL_EXT_INSTANCE_NUM)
seqno += 1;
}
/* Increment instance value for Extended Link Opaque LSAs Opaque ID field */
-static u_int32_t get_ext_link_instance_value(void)
+static uint32_t get_ext_link_instance_value(void)
{
- static u_int32_t seqno = 0;
+ static uint32_t seqno = 0;
if (seqno < MAX_LEGAL_EXT_INSTANCE_NUM)
seqno += 1;
*------------------------------------------------------------------------*/
/* Extended Prefix TLV - RFC7684 section 2.1 */
-static void set_ext_prefix(struct ext_itf *exti, u_int8_t route_type,
- u_int8_t flags, struct prefix_ipv4 p)
+static void set_ext_prefix(struct ext_itf *exti, uint8_t route_type,
+ uint8_t flags, struct prefix_ipv4 p)
{
TLV_TYPE(exti->prefix) = htons(EXT_TLV_PREFIX);
}
/* Extended Link TLV - RFC7684 section 3.1 */
-static void set_ext_link(struct ext_itf *exti, u_int8_t type, struct in_addr id,
+static void set_ext_link(struct ext_itf *exti, uint8_t type, struct in_addr id,
struct in_addr data)
{
}
/* Prefix SID SubTLV - section 5 */
-static void set_prefix_sid(struct ext_itf *exti, u_int8_t algorithm,
- u_int32_t value, int value_type)
+static void set_prefix_sid(struct ext_itf *exti, uint8_t algorithm,
+ uint32_t value, int value_type)
{
- u_int8_t flags;
+ uint8_t flags;
if ((algorithm != SR_ALGORITHM_SPF)
&& (algorithm != SR_ALGORITHM_STRICT_SPF)) {
}
/* Adjacency SID SubTLV - section 6.1 */
-static void set_adj_sid(struct ext_itf *exti, bool backup, u_int32_t value,
+static void set_adj_sid(struct ext_itf *exti, bool backup, uint32_t value,
int value_type)
{
int index;
- u_int8_t flags;
+ uint8_t flags;
/* Determine which ADJ_SID must be set: nominal or backup */
if (backup) {
}
/* LAN Adjacency SID SubTLV - section 6.2 */
-static void set_lan_adj_sid(struct ext_itf *exti, bool backup, u_int32_t value,
+static void set_lan_adj_sid(struct ext_itf *exti, bool backup, uint32_t value,
int value_type, struct in_addr neighbor_id)
{
int index;
- u_int8_t flags;
+ uint8_t flags;
/* Determine which ADJ_SID must be set: nominal or backup */
if (backup) {
*
* @return instance number if update is OK, 0 otherwise
*/
-int ospf_ext_schedule_prefix_index(struct interface *ifp, u_int32_t index,
+int ospf_ext_schedule_prefix_index(struct interface *ifp, uint32_t index,
struct prefix_ipv4 *p)
{
int rc = 0;
{
struct ospf_interface *oi = nbr->oi;
struct ext_itf *exti;
- u_int32_t label;
+ uint32_t label;
/* Process Neighbor only when its state is NSM Full */
if (nbr->state != NSM_Full)
u_char options, lsa_type;
struct in_addr lsa_id;
struct in_addr router_id;
- u_int32_t tmp;
- u_int16_t length;
+ uint32_t tmp;
+ uint16_t length;
/* Sanity Check */
if (exti == NULL)
struct ospf_lsa *new = NULL;
u_char options, lsa_type;
struct in_addr lsa_id;
- u_int32_t tmp;
- u_int16_t length;
+ uint32_t tmp;
+ uint16_t length;
/* Sanity Check */
if (exti == NULL)
struct ospf_lsa lsa;
struct lsa_header lsah;
struct ospf *top;
- u_int32_t tmp;
+ uint32_t tmp;
memset(&lsa, 0, sizeof(lsa));
memset(&lsah, 0, sizeof(lsah));
struct ospf_lsa lsa;
struct lsa_header lsah;
struct ospf *top;
- u_int32_t tmp;
+ uint32_t tmp;
memset(&lsa, 0, sizeof(lsa));
memset(&lsah, 0, sizeof(lsah));
* Followings are vty show functions.
*------------------------------------------------------------------------*/
/* Cisco experimental SubTLV */
-static u_int16_t show_vty_ext_link_rmt_itf_addr(struct vty *vty,
+static uint16_t show_vty_ext_link_rmt_itf_addr(struct vty *vty,
struct tlv_header *tlvh)
{
struct ext_subtlv_rmt_itf_addr *top;
}
/* Adjacency SID SubTLV */
-static u_int16_t show_vty_ext_link_adj_sid(struct vty *vty,
+static uint16_t show_vty_ext_link_adj_sid(struct vty *vty,
struct tlv_header *tlvh)
{
struct ext_subtlv_adj_sid *top = (struct ext_subtlv_adj_sid *)tlvh;
}
/* LAN Adjacency SubTLV */
-static u_int16_t show_vty_ext_link_lan_adj_sid(struct vty *vty,
+static uint16_t show_vty_ext_link_lan_adj_sid(struct vty *vty,
struct tlv_header *tlvh)
{
struct ext_subtlv_lan_adj_sid *top =
return TLV_SIZE(tlvh);
}
-static u_int16_t show_vty_unknown_tlv(struct vty *vty, struct tlv_header *tlvh)
+static uint16_t show_vty_unknown_tlv(struct vty *vty, struct tlv_header *tlvh)
{
vty_out(vty, " Unknown TLV: [type(0x%x), length(0x%x)]\n",
ntohs(tlvh->type), ntohs(tlvh->length));
}
/* Extended Link Sub TLVs */
-static u_int16_t show_vty_link_info(struct vty *vty, struct tlv_header *ext)
+static uint16_t show_vty_link_info(struct vty *vty, struct tlv_header *ext)
{
struct ext_tlv_link *top = (struct ext_tlv_link *)ext;
struct tlv_header *tlvh;
- u_int16_t length = ntohs(top->header.length) - 3 * sizeof(u_int32_t);
- u_int16_t sum = 0;
+ uint16_t length = ntohs(top->header.length) - 3 * sizeof(uint32_t);
+ uint16_t sum = 0;
vty_out(vty,
" Extended Link TLV: Length %d\n Link Type: 0x%x\n"
{
struct lsa_header *lsah = (struct lsa_header *)lsa->data;
struct tlv_header *tlvh;
- u_int16_t length = 0, sum = 0;
+ uint16_t length = 0, sum = 0;
/* Initialize TLV browsing */
length = ntohs(lsah->length) - OSPF_LSA_HEADER_SIZE;
}
/* Prefix SID SubTLV */
-static u_int16_t show_vty_ext_pref_pref_sid(struct vty *vty,
+static uint16_t show_vty_ext_pref_pref_sid(struct vty *vty,
struct tlv_header *tlvh)
{
struct ext_subtlv_prefix_sid *top =
}
/* Extended Prefix SubTLVs */
-static u_int16_t show_vty_pref_info(struct vty *vty, struct tlv_header *ext)
+static uint16_t show_vty_pref_info(struct vty *vty, struct tlv_header *ext)
{
struct ext_tlv_prefix *top = (struct ext_tlv_prefix *)ext;
struct tlv_header *tlvh;
- u_int16_t length = ntohs(top->header.length) - 2 * sizeof(u_int32_t);
- u_int16_t sum = 0;
+ uint16_t length = ntohs(top->header.length) - 2 * sizeof(uint32_t);
+ uint16_t sum = 0;
vty_out(vty,
" Extended Prefix TLV: Length %d\n\tRoute Type: %d\n"
{
struct lsa_header *lsah = (struct lsa_header *)lsa->data;
struct tlv_header *tlvh;
- u_int16_t length = 0, sum = 0;
+ uint16_t length = 0, sum = 0;
/* Initialize TLV browsing */
length = ntohs(lsah->length) - OSPF_LSA_HEADER_SIZE;
#define EXT_TLV_PREFIX_SIZE 8
struct ext_tlv_prefix {
struct tlv_header header;
- u_int8_t route_type;
- u_int8_t pref_length;
- u_int8_t af;
- u_int8_t flags;
+ uint8_t route_type;
+ uint8_t pref_length;
+ uint8_t af;
+ uint8_t flags;
struct in_addr address;
};
#define EXT_TLV_LINK_SIZE 12
struct ext_tlv_link {
struct tlv_header header;
- u_int8_t link_type;
- u_int8_t reserved[3];
+ uint8_t link_type;
+ uint8_t reserved[3];
struct in_addr link_id;
struct in_addr link_data;
};
bool enabled;
/* Flags to manage this Extended Prefix/Link Opaque LSA */
- u_int32_t flags;
+ uint32_t flags;
/* Scope is area Opaque Type 10 or AS Opaque LSA Type 11 for
* Extended Prefix and area Opaque Type 10 for Extended Link */
- u_int8_t scope;
+ uint8_t scope;
/* area pointer if flooding is Type 10 Null if flooding is AS scope */
struct ospf_area *area;
/* Structure to aggregate interfaces information for Extended Prefix/Link */
struct ext_itf {
/* 24-bit Opaque-ID field value according to RFC 7684 specification */
- u_int32_t instance;
- u_int8_t type; /* Extended Prefix (7) or Link (8) */
+ uint32_t instance;
+ uint8_t type; /* Extended Prefix (7) or Link (8) */
/* Reference pointer to a Zebra-interface. */
struct interface *ifp;
struct ospf_area *area;
/* Flags to manage this link parameters. */
- u_int32_t flags;
+ uint32_t flags;
/* SID type: Node, Adjacency or LAN Adjacency */
enum sid_type stype;
extern int ospf_ext_init(void);
extern void ospf_ext_term(void);
extern void ospf_ext_update_sr(bool);
-extern int ospf_ext_schedule_prefix_index(struct interface *, u_int32_t,
+extern int ospf_ext_schedule_prefix_index(struct interface *, uint32_t,
struct prefix_ipv4 *);
#endif /* _FRR_OSPF_EXT_PREF_H_ */
/* Segment Routing TLV setter */
/* Algorithm SubTLV - section 3.1 */
-static void set_sr_algorithm(u_int8_t algo)
+static void set_sr_algorithm(uint8_t algo)
{
OspfRI.sr_info.algo.value[0] = algo;
/* Set TLV type and length == only 1 Algorithm */
TLV_TYPE(OspfRI.sr_info.algo) = htons(RI_SR_TLV_SR_ALGORITHM);
- TLV_LEN(OspfRI.sr_info.algo) = htons(sizeof(u_int8_t));
+ TLV_LEN(OspfRI.sr_info.algo) = htons(sizeof(uint8_t));
return;
}
/* unset Aglogithm SubTLV */
-static void unset_sr_algorithm(u_int8_t algo)
+static void unset_sr_algorithm(uint8_t algo)
{
for (int i = 0; i < ALGORITHM_COUNT; i++)
/* Set Header */
TLV_TYPE(OspfRI.sr_info.range) = htons(RI_SR_TLV_SID_LABEL_RANGE);
TLV_LEN(OspfRI.sr_info.range) =
- htons(SUBTLV_SID_LABEL_SIZE + sizeof(u_int32_t));
+ htons(SUBTLV_SID_LABEL_SIZE + sizeof(uint32_t));
/* Set Range Size */
OspfRI.sr_info.range.size = htonl(SET_RANGE_SIZE(srgb.range_size));
/* Set Lower bound label SubTLV */
}
/* Set Maximum Stack Depth for this router */
-static void set_sr_node_msd(u_int8_t msd)
+static void set_sr_node_msd(uint8_t msd)
{
TLV_TYPE(OspfRI.sr_info.msd) = htons(RI_SR_TLV_NODE_MSD);
- TLV_LEN(OspfRI.sr_info.msd) = htons(sizeof(u_int32_t));
+ TLV_LEN(OspfRI.sr_info.msd) = htons(sizeof(uint32_t));
OspfRI.sr_info.msd.value = msd;
return;
*
* @return none
*/
-void ospf_router_info_update_sr(bool enable, struct sr_srgb srgb, u_int8_t msd)
+void ospf_router_info_update_sr(bool enable, struct sr_srgb srgb, uint8_t msd)
{
/* First activate and initialize Router Information is necessary */
}
/* Display Segment Routing Algorithm TLV information */
-static u_int16_t show_vty_sr_algorithm(struct vty *vty, struct tlv_header *tlvh)
+static uint16_t show_vty_sr_algorithm(struct vty *vty, struct tlv_header *tlvh)
{
struct ri_sr_tlv_sr_algorithm *algo =
(struct ri_sr_tlv_sr_algorithm *)tlvh;
}
/* Display Segment Routing SID/Label Range TLV information */
-static u_int16_t show_vty_sr_range(struct vty *vty, struct tlv_header *tlvh)
+static uint16_t show_vty_sr_range(struct vty *vty, struct tlv_header *tlvh)
{
struct ri_sr_tlv_sid_label_range *range =
(struct ri_sr_tlv_sid_label_range *)tlvh;
}
/* Display Segment Routing Maximum Stack Depth TLV information */
-static u_int16_t show_vty_sr_msd(struct vty *vty, struct tlv_header *tlvh)
+static uint16_t show_vty_sr_msd(struct vty *vty, struct tlv_header *tlvh)
{
struct ri_sr_tlv_node_msd *msd = (struct ri_sr_tlv_node_msd *)tlvh;
/* Structure to share flooding scope info for Segment Routing */
struct scope_info {
- u_int8_t scope;
+ uint8_t scope;
struct in_addr area_id;
};
extern int ospf_router_info_init(void);
extern void ospf_router_info_term(void);
extern int ospf_router_info_enable(void);
-extern void ospf_router_info_update_sr(bool, struct sr_srgb, u_int8_t);
+extern void ospf_router_info_update_sr(bool, struct sr_srgb, uint8_t);
extern struct scope_info ospf_router_info_get_flooding_scope(void);
#endif /* _ZEBRA_OSPF_ROUTER_INFO_H */
*/
/* Compute label from index */
-static mpls_label_t index2label(u_int32_t index, struct sr_srgb srgb)
+static mpls_label_t index2label(uint32_t index, struct sr_srgb srgb)
{
mpls_label_t label;
memset(&api, 0, sizeof(api));
api.vrf_id = VRF_DEFAULT;
- api.type = ZEBRA_ROUTE_OSPF_SR;
+ api.type = ZEBRA_ROUTE_OSPF;
api.safi = SAFI_UNICAST;
memcpy(&api.prefix, &nhlfe.prefv4, sizeof(struct prefix_ipv4));
nhlfe.prefv4.prefixlen, nhlfe.ifindex);
return (zclient_route_send(cmd, zclient, &api));
-
- return -1;
}
/* Add new NHLFE entry for SID */
struct ext_subtlv_rmt_itf_addr *rmt_itf;
struct tlv_header *sub_tlvh;
- u_int16_t length = 0, sum = 0, i = 0;
+ uint16_t length = 0, sum = 0, i = 0;
srl = XCALLOC(MTYPE_OSPF_SR_PARAMS, sizeof(struct sr_link));
struct ext_subtlv_prefix_sid *psid;
struct tlv_header *sub_tlvh;
- u_int16_t length = 0, sum = 0;
+ uint16_t length = 0, sum = 0;
srp = XCALLOC(MTYPE_OSPF_SR_PARAMS, sizeof(struct sr_prefix));
struct ri_sr_tlv_sid_label_range *ri_srgb;
struct ri_sr_tlv_sr_algorithm *algo;
struct sr_srgb srgb;
- u_int16_t length = 0, sum = 0;
+ uint16_t length = 0, sum = 0;
if (IS_DEBUG_OSPF_SR)
zlog_debug(
struct lsa_header *lsah = (struct lsa_header *)lsa->data;
struct sr_link *srl;
- u_int16_t length, sum;
+ uint16_t length, sum;
if (IS_DEBUG_OSPF_SR)
zlog_debug(
struct sr_link *srl;
struct sr_node *srn;
struct lsa_header *lsah = (struct lsa_header *)lsa->data;
- u_int32_t instance = ntohl(lsah->id.s_addr);
+ uint32_t instance = ntohl(lsah->id.s_addr);
if (IS_DEBUG_OSPF_SR)
zlog_debug(
struct lsa_header *lsah = (struct lsa_header *)lsa->data;
struct sr_prefix *srp;
- u_int16_t length, sum;
+ uint16_t length, sum;
if (IS_DEBUG_OSPF_SR)
zlog_debug(
struct sr_prefix *srp;
struct sr_node *srn;
struct lsa_header *lsah = (struct lsa_header *)lsa->data;
- u_int32_t instance = ntohl(lsah->id.s_addr);
+ uint32_t instance = ntohl(lsah->id.s_addr);
if (IS_DEBUG_OSPF_SR)
zlog_debug(
/* Get Label for Extended Link SID */
/* TODO: To be replace by Zebra Label Manager */
-u_int32_t get_ext_link_label_value(void)
+uint32_t get_ext_link_label_value(void)
{
- static u_int32_t label = ADJ_SID_MIN - 1;
+ static uint32_t label = ADJ_SID_MIN - 1;
if (label < ADJ_SID_MAX)
label += 1;
"Lower-bound range in decimal (0-1048575)\n"
"Upper-bound range in decimal (0-1048575)\n")
{
- u_int32_t upper;
- u_int32_t lower;
- u_int32_t size;
+ uint32_t upper;
+ uint32_t lower;
+ uint32_t size;
int idx_low = 2;
int idx_up = 3;
"Maximum Stack Depth for this router\n"
"Maximum number of label that could be stack (1-16)\n")
{
- u_int32_t msd;
+ uint32_t msd;
int idx_number = 2;
if (!ospf_sr_enabled(vty))
struct subtlv_sid_label {
/* Length is 3 (20 rightmost bits MPLS label) or 4 (32 bits SID) */
struct tlv_header header;
- u_int32_t value;
+ uint32_t value;
};
/*
#define SR_ALGORITHM_UNSET 255
#define ALGORITHM_COUNT 4
/* Only 4 algorithms supported in this code */
- u_int8_t value[ALGORITHM_COUNT];
+ uint8_t value[ALGORITHM_COUNT];
};
/* RI SID/Label Range TLV - section 3.2 */
struct tlv_header header;
/* Only 24 upper most bits are significant */
#define SID_RANGE_LABEL_LENGTH 3
- u_int32_t size;
+ uint32_t size;
/* A SID/Label sub-TLV will follow. */
struct subtlv_sid_label lower;
};
#define RI_SR_TLV_NODE_MSD 12
struct ri_sr_tlv_node_msd {
struct tlv_header header;
- u_int8_t subtype; /* always = 1 */
- u_int8_t value;
- u_int16_t padding;
+ uint8_t subtype; /* always = 1 */
+ uint8_t value;
+ uint16_t padding;
};
/*
#define EXT_SUBTLV_PREFIX_RANGE_SIZE 12
struct ext_tlv_prefix_range {
struct tlv_header header;
- u_int8_t pref_length;
- u_int8_t af;
- u_int16_t range_size;
- u_int8_t flags;
- u_int8_t reserved[3];
+ uint8_t pref_length;
+ uint8_t af;
+ uint16_t range_size;
+ uint8_t flags;
+ uint8_t reserved[3];
struct in_addr address;
};
#define EXT_SUBTLV_PREFIX_SID_SIZE 8
struct ext_subtlv_prefix_sid {
struct tlv_header header;
- u_int8_t flags;
- u_int8_t reserved;
- u_int8_t mtid;
- u_int8_t algorithm;
- u_int32_t value;
+ uint8_t flags;
+ uint8_t reserved;
+ uint8_t mtid;
+ uint8_t algorithm;
+ uint32_t value;
};
/* Adj-SID Sub-TLV - section 6.1 */
#define EXT_SUBTLV_ADJ_SID_SIZE 8
struct ext_subtlv_adj_sid {
struct tlv_header header;
- u_int8_t flags;
- u_int8_t reserved;
- u_int8_t mtid;
- u_int8_t weight;
- u_int32_t value;
+ uint8_t flags;
+ uint8_t reserved;
+ uint8_t mtid;
+ uint8_t weight;
+ uint32_t value;
};
/* LAN Adj-SID Sub-TLV - section 6.2 */
#define EXT_SUBTLV_LAN_ADJ_SID_SIZE 12
struct ext_subtlv_lan_adj_sid {
struct tlv_header header;
- u_int8_t flags;
- u_int8_t reserved;
- u_int8_t mtid;
- u_int8_t weight;
+ uint8_t flags;
+ uint8_t reserved;
+ uint8_t mtid;
+ uint8_t weight;
struct in_addr neighbor_id;
- u_int32_t value;
+ uint32_t value;
};
/*
/* Structure aggregating SRGB info retrieved from an lsa */
struct sr_srgb {
- u_int32_t range_size;
- u_int32_t lower_bound;
+ uint32_t range_size;
+ uint32_t lower_bound;
};
/* SID type to make difference between loopback interfaces and others */
bool update;
/* Flooding Scope: Area = 10 or AS = 11 */
- u_int8_t scope;
+ uint8_t scope;
/* FRR SR node */
struct sr_node *self;
/* Local SR info announced in Router Info LSA */
/* Algorithms supported by the node */
- u_int8_t algo[ALGORITHM_COUNT];
+ uint8_t algo[ALGORITHM_COUNT];
/*
* Segment Routing Global Block i.e. label range
* Only one range supported in this code
*/
struct sr_srgb srgb;
/* Maximum SID Depth supported by the node */
- u_int8_t msd;
+ uint8_t msd;
};
/* Structure aggregating all received SR info from LSAs by node */
struct sr_node {
struct in_addr adv_router; /* used to identify sender of LSA */
/* 24-bit Opaque-ID field value according to RFC 7684 specification */
- u_int32_t instance;
+ uint32_t instance;
- u_int8_t algo[ALGORITHM_COUNT]; /* Algorithms supported by the node */
+ uint8_t algo[ALGORITHM_COUNT]; /* Algorithms supported by the node */
/* Segment Routing Global Block i.e. label range */
struct sr_srgb srgb;
- u_int8_t msd; /* Maximum SID Depth */
+ uint8_t msd; /* Maximum SID Depth */
/* List of Prefix & Link advertise by this node */
struct list *ext_prefix; /* For Node SID */
struct sr_link {
struct in_addr adv_router; /* used to identify sender of LSA */
/* 24-bit Opaque-ID field value according to RFC 7684 specification */
- u_int32_t instance;
+ uint32_t instance;
/* Flags to manage this link parameters. */
- u_int32_t flags[2];
+ uint32_t flags[2];
/* Segment Routing ID */
- u_int32_t sid[2];
+ uint32_t sid[2];
enum sid_type type;
/* SR NHLFE for this link */
struct sr_prefix {
struct in_addr adv_router; /* used to identify sender of LSA */
/* 24-bit Opaque-ID field value according to RFC 7684 specification */
- u_int32_t instance;
+ uint32_t instance;
/* Flags to manage this prefix parameters. */
- u_int32_t flags;
+ uint32_t flags;
/* Segment Routing ID */
- u_int32_t sid;
+ uint32_t sid;
enum sid_type type;
/* SR NHLFE for this prefix */
extern void ospf_sr_ext_prefix_lsa_update(struct ospf_lsa *);
extern void ospf_sr_ext_prefix_lsa_delete(struct ospf_lsa *);
/* Segment Routing configuration functions */
-extern u_int32_t get_ext_link_label_value(void);
+extern uint32_t get_ext_link_label_value(void);
extern void ospf_sr_config_write_router(struct vty *);
/* Segment Routing re-routing function */
extern void ospf_sr_update_timer_add(struct ospf *);