diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-03-27 21:13:34 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-03-27 21:13:34 +0200 |
commit | d7c0a89a3a5697783a6dd89333ab660074790890 (patch) | |
tree | eefa73e502f919b524b8a345437260d4acc23083 /ospfd | |
parent | tools, doc: update checkpatch for u_int_* (diff) | |
download | frr-d7c0a89a3a5697783a6dd89333ab660074790890.tar.xz frr-d7c0a89a3a5697783a6dd89333ab660074790890.zip |
*: use C99 standard fixed-width integer types
The following types are nonstandard:
- u_char
- u_short
- u_int
- u_long
- u_int8_t
- u_int16_t
- u_int32_t
Replace them with the C99 standard types:
- uint8_t
- unsigned short
- unsigned int
- unsigned long
- uint8_t
- uint16_t
- uint32_t
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'ospfd')
46 files changed, 981 insertions, 962 deletions
diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c index b29f35d7c..0ff9d0da5 100644 --- a/ospfd/ospf_abr.c +++ b/ospfd/ospf_abr.c @@ -215,7 +215,7 @@ int ospf_area_range_set(struct ospf *ospf, struct in_addr area_id, } int ospf_area_range_cost_set(struct ospf *ospf, struct in_addr area_id, - struct prefix_ipv4 *p, u_int32_t cost) + struct prefix_ipv4 *p, uint32_t cost) { struct ospf_area *area; struct ospf_area_range *range; @@ -379,7 +379,7 @@ static void ospf_abr_nssa_check_status(struct ospf *ospf) struct listnode *lnode, *nnode; for (ALL_LIST_ELEMENTS(ospf->areas, lnode, nnode, area)) { - u_char old_state = area->NSSATranslatorState; + uint8_t old_state = area->NSSATranslatorState; if (area->external_routing != OSPF_AREA_NSSA) continue; @@ -471,7 +471,7 @@ void ospf_check_abr_status(struct ospf *ospf) int bb_act_attached = 0; int areas_configured = 0; int areas_act_attached = 0; - u_char new_flags = ospf->flags; + uint8_t new_flags = ospf->flags; if (IS_DEBUG_OSPF_EVENT) zlog_debug("ospf_check_abr_status(): Start"); @@ -585,12 +585,12 @@ static void ospf_abr_update_aggregate(struct ospf_area_range *range, range->specifics++; } -static void set_metric(struct ospf_lsa *lsa, u_int32_t metric) +static void set_metric(struct ospf_lsa *lsa, uint32_t metric) { struct summary_lsa *header; - u_char *mp; + uint8_t *mp; metric = htonl(metric); - mp = (u_char *)&metric; + mp = (uint8_t *)&metric; mp++; header = (struct summary_lsa *)lsa->data; memcpy(header->metric, mp, 3); @@ -683,18 +683,18 @@ static int ospf_abr_translate_nssa(struct ospf_area *area, struct ospf_lsa *lsa) return 0; } -static void ospf_abr_translate_nssa_range(struct prefix_ipv4 *p, u_int32_t cost) +static void ospf_abr_translate_nssa_range(struct prefix_ipv4 *p, uint32_t cost) { /* The Type-7 is created from the aggregated prefix and forwarded for lsa installation and flooding... to be added... */ } -void ospf_abr_announce_network_to_area(struct prefix_ipv4 *p, u_int32_t cost, +void ospf_abr_announce_network_to_area(struct prefix_ipv4 *p, uint32_t cost, struct ospf_area *area) { struct ospf_lsa *lsa, *old = NULL; struct summary_lsa *sl = NULL; - u_int32_t full_cost; + uint32_t full_cost; if (IS_DEBUG_OSPF_EVENT) zlog_debug("ospf_abr_announce_network_to_area(): Start"); @@ -1089,7 +1089,7 @@ static void ospf_abr_process_network_rt(struct ospf *ospf, zlog_debug("ospf_abr_process_network_rt(): Stop"); } -static void ospf_abr_announce_rtr_to_area(struct prefix_ipv4 *p, u_int32_t cost, +static void ospf_abr_announce_rtr_to_area(struct prefix_ipv4 *p, uint32_t cost, struct ospf_area *area) { struct ospf_lsa *lsa, *old = NULL; diff --git a/ospfd/ospf_abr.h b/ospfd/ospf_abr.h index 379273213..b3007622c 100644 --- a/ospfd/ospf_abr.h +++ b/ospfd/ospf_abr.h @@ -33,23 +33,23 @@ struct ospf_area_range { struct in_addr addr; /* Area range masklen. */ - u_char masklen; + uint8_t masklen; /* Flags. */ - u_char flags; + uint8_t flags; /* Number of more specific prefixes. */ int specifics; /* Addr and masklen to substitute. */ struct in_addr subst_addr; - u_char subst_masklen; + uint8_t subst_masklen; /* Range cost. */ - u_int32_t cost; + uint32_t cost; /* Configured range cost. */ - u_int32_t cost_config; + uint32_t cost_config; }; /* Prototypes. */ @@ -64,7 +64,7 @@ ospf_area_range_lookup_next(struct ospf_area *, struct in_addr *, int); extern int ospf_area_range_set(struct ospf *, struct in_addr, struct prefix_ipv4 *, int); extern int ospf_area_range_cost_set(struct ospf *, struct in_addr, - struct prefix_ipv4 *, u_int32_t); + struct prefix_ipv4 *, uint32_t); extern int ospf_area_range_unset(struct ospf *, struct in_addr, struct prefix_ipv4 *); extern int ospf_area_range_substitute_set(struct ospf *, struct in_addr, @@ -81,6 +81,6 @@ extern void ospf_check_abr_status(struct ospf *); extern void ospf_abr_task(struct ospf *); extern void ospf_schedule_abr_task(struct ospf *); -extern void ospf_abr_announce_network_to_area(struct prefix_ipv4 *, u_int32_t, +extern void ospf_abr_announce_network_to_area(struct prefix_ipv4 *, uint32_t, struct ospf_area *); #endif /* _ZEBRA_OSPF_ABR_H */ diff --git a/ospfd/ospf_api.c b/ospfd/ospf_api.c index f1a743376..8369dde82 100644 --- a/ospfd/ospf_api.c +++ b/ospfd/ospf_api.c @@ -62,7 +62,7 @@ void api_opaque_lsa_print(struct lsa_header *data) { struct opaque_lsa { struct lsa_header header; - u_char mydata[]; + uint8_t mydata[]; }; struct opaque_lsa *olsa; @@ -87,8 +87,8 @@ void api_opaque_lsa_print(struct lsa_header *data) * ----------------------------------------------------------- */ -struct msg *msg_new(u_char msgtype, void *msgbody, u_int32_t seqnum, - u_int16_t msglen) +struct msg *msg_new(uint8_t msgtype, void *msgbody, uint32_t seqnum, + uint16_t msglen) { struct msg *new; @@ -282,14 +282,14 @@ void msg_free(struct msg *msg) /* Set sequence number of message */ -void msg_set_seq(struct msg *msg, u_int32_t seqnr) +void msg_set_seq(struct msg *msg, uint32_t seqnr) { assert(msg); msg->hdr.msgseq = htonl(seqnr); } /* Get sequence number of message */ -u_int32_t msg_get_seq(struct msg *msg) +uint32_t msg_get_seq(struct msg *msg) { assert(msg); return ntohl(msg->hdr.msgseq); @@ -368,12 +368,12 @@ struct msg *msg_read(int fd) { struct msg *msg; struct apimsghdr hdr; - u_char buf[OSPF_API_MAX_MSG_SIZE]; + uint8_t buf[OSPF_API_MAX_MSG_SIZE]; int bodylen; int rlen; /* Read message header */ - rlen = readn(fd, (u_char *)&hdr, sizeof(struct apimsghdr)); + rlen = readn(fd, (uint8_t *)&hdr, sizeof(struct apimsghdr)); if (rlen < 0) { zlog_warn("msg_read: readn %s", safe_strerror(errno)); @@ -418,7 +418,7 @@ struct msg *msg_read(int fd) int msg_write(int fd, struct msg *msg) { - u_char buf[OSPF_API_MAX_MSG_SIZE]; + uint8_t buf[OSPF_API_MAX_MSG_SIZE]; int l; int wlen; @@ -452,8 +452,8 @@ int msg_write(int fd, struct msg *msg) * ----------------------------------------------------------- */ -struct msg *new_msg_register_opaque_type(u_int32_t seqnum, u_char ltype, - u_char otype) +struct msg *new_msg_register_opaque_type(uint32_t seqnum, uint8_t ltype, + uint8_t otype) { struct msg_register_opaque_type rmsg; @@ -465,10 +465,10 @@ struct msg *new_msg_register_opaque_type(u_int32_t seqnum, u_char ltype, sizeof(struct msg_register_opaque_type)); } -struct msg *new_msg_register_event(u_int32_t seqnum, +struct msg *new_msg_register_event(uint32_t seqnum, struct lsa_filter_type *filter) { - u_char buf[OSPF_API_MAX_MSG_SIZE]; + uint8_t buf[OSPF_API_MAX_MSG_SIZE]; struct msg_register_event *emsg; unsigned int len; @@ -484,9 +484,9 @@ struct msg *new_msg_register_event(u_int32_t seqnum, return msg_new(MSG_REGISTER_EVENT, emsg, seqnum, len); } -struct msg *new_msg_sync_lsdb(u_int32_t seqnum, struct lsa_filter_type *filter) +struct msg *new_msg_sync_lsdb(uint32_t seqnum, struct lsa_filter_type *filter) { - u_char buf[OSPF_API_MAX_MSG_SIZE]; + uint8_t buf[OSPF_API_MAX_MSG_SIZE]; struct msg_sync_lsdb *smsg; unsigned int len; @@ -503,7 +503,7 @@ struct msg *new_msg_sync_lsdb(u_int32_t seqnum, struct lsa_filter_type *filter) } -struct msg *new_msg_originate_request(u_int32_t seqnum, struct in_addr ifaddr, +struct msg *new_msg_originate_request(uint32_t seqnum, struct in_addr ifaddr, struct in_addr area_id, struct lsa_header *data) { @@ -527,9 +527,9 @@ struct msg *new_msg_originate_request(u_int32_t seqnum, struct in_addr ifaddr, return msg_new(MSG_ORIGINATE_REQUEST, omsg, seqnum, omsglen); } -struct msg *new_msg_delete_request(u_int32_t seqnum, struct in_addr area_id, - u_char lsa_type, u_char opaque_type, - u_int32_t opaque_id) +struct msg *new_msg_delete_request(uint32_t seqnum, struct in_addr area_id, + uint8_t lsa_type, uint8_t opaque_type, + uint32_t opaque_id) { struct msg_delete_request dmsg; dmsg.area_id = area_id; @@ -543,7 +543,7 @@ struct msg *new_msg_delete_request(u_int32_t seqnum, struct in_addr area_id, } -struct msg *new_msg_reply(u_int32_t seqnr, u_char rc) +struct msg *new_msg_reply(uint32_t seqnr, uint8_t rc) { struct msg *msg; struct msg_reply rmsg; @@ -557,8 +557,8 @@ struct msg *new_msg_reply(u_int32_t seqnr, u_char rc) return msg; } -struct msg *new_msg_ready_notify(u_int32_t seqnr, u_char lsa_type, - u_char opaque_type, struct in_addr addr) +struct msg *new_msg_ready_notify(uint32_t seqnr, uint8_t lsa_type, + uint8_t opaque_type, struct in_addr addr) { struct msg_ready_notify rmsg; @@ -571,7 +571,7 @@ struct msg *new_msg_ready_notify(u_int32_t seqnr, u_char lsa_type, sizeof(struct msg_ready_notify)); } -struct msg *new_msg_new_if(u_int32_t seqnr, struct in_addr ifaddr, +struct msg *new_msg_new_if(uint32_t seqnr, struct in_addr ifaddr, struct in_addr area_id) { struct msg_new_if nmsg; @@ -582,7 +582,7 @@ struct msg *new_msg_new_if(u_int32_t seqnr, struct in_addr ifaddr, return msg_new(MSG_NEW_IF, &nmsg, seqnr, sizeof(struct msg_new_if)); } -struct msg *new_msg_del_if(u_int32_t seqnr, struct in_addr ifaddr) +struct msg *new_msg_del_if(uint32_t seqnr, struct in_addr ifaddr) { struct msg_del_if dmsg; @@ -591,8 +591,8 @@ struct msg *new_msg_del_if(u_int32_t seqnr, struct in_addr ifaddr) return msg_new(MSG_DEL_IF, &dmsg, seqnr, sizeof(struct msg_del_if)); } -struct msg *new_msg_ism_change(u_int32_t seqnr, struct in_addr ifaddr, - struct in_addr area_id, u_char status) +struct msg *new_msg_ism_change(uint32_t seqnr, struct in_addr ifaddr, + struct in_addr area_id, uint8_t status) { struct msg_ism_change imsg; @@ -605,9 +605,9 @@ struct msg *new_msg_ism_change(u_int32_t seqnr, struct in_addr ifaddr, sizeof(struct msg_ism_change)); } -struct msg *new_msg_nsm_change(u_int32_t seqnr, struct in_addr ifaddr, +struct msg *new_msg_nsm_change(uint32_t seqnr, struct in_addr ifaddr, struct in_addr nbraddr, struct in_addr router_id, - u_char status) + uint8_t status) { struct msg_nsm_change nmsg; @@ -621,13 +621,13 @@ struct msg *new_msg_nsm_change(u_int32_t seqnr, struct in_addr ifaddr, sizeof(struct msg_nsm_change)); } -struct msg *new_msg_lsa_change_notify(u_char msgtype, u_int32_t seqnum, +struct msg *new_msg_lsa_change_notify(uint8_t msgtype, uint32_t seqnum, struct in_addr ifaddr, struct in_addr area_id, - u_char is_self_originated, + uint8_t is_self_originated, struct lsa_header *data) { - u_char buf[OSPF_API_MAX_MSG_SIZE]; + uint8_t buf[OSPF_API_MAX_MSG_SIZE]; struct msg_lsa_change_notify *nmsg; unsigned int len; diff --git a/ospfd/ospf_api.h b/ospfd/ospf_api.h index 7b055db12..c99923e7b 100644 --- a/ospfd/ospf_api.h +++ b/ospfd/ospf_api.h @@ -44,10 +44,10 @@ /* Message header structure, fields are in network byte order and aligned to four octets. */ struct apimsghdr { - u_char version; /* OSPF API protocol version */ - u_char msgtype; /* Type of message */ - u_int16_t msglen; /* Length of message w/o header */ - u_int32_t msgseq; /* Sequence number */ + uint8_t version; /* OSPF API protocol version */ + uint8_t msgtype; /* Type of message */ + uint16_t msglen; /* Length of message w/o header */ + uint32_t msgseq; /* Sequence number */ }; /* Message representation with header and body */ @@ -62,8 +62,8 @@ struct msg { }; /* Prototypes for generic messages. */ -extern struct msg *msg_new(u_char msgtype, void *msgbody, u_int32_t seqnum, - u_int16_t msglen); +extern struct msg *msg_new(uint8_t msgtype, void *msgbody, uint32_t seqnum, + uint16_t msglen); extern struct msg *msg_dup(struct msg *msg); extern void msg_print(struct msg *msg); /* XXX debug only */ extern void msg_free(struct msg *msg); @@ -76,8 +76,8 @@ extern int msg_write(int fd, struct msg *msg); #define MIN_SEQ 1 #define MAX_SEQ 2147483647 -extern void msg_set_seq(struct msg *msg, u_int32_t seqnr); -extern u_int32_t msg_get_seq(struct msg *msg); +extern void msg_set_seq(struct msg *msg, uint32_t seqnr); +extern uint32_t msg_get_seq(struct msg *msg); /* ----------------------------------------------------------- * Message fifo queues @@ -124,15 +124,15 @@ extern void msg_fifo_free(struct msg_fifo *fifo); #define MSG_NSM_CHANGE 17 struct msg_register_opaque_type { - u_char lsatype; - u_char opaquetype; - u_char pad[2]; /* padding */ + uint8_t lsatype; + uint8_t opaquetype; + uint8_t pad[2]; /* padding */ }; struct msg_unregister_opaque_type { - u_char lsatype; - u_char opaquetype; - u_char pad[2]; /* padding */ + uint8_t lsatype; + uint8_t opaquetype; + uint8_t pad[2]; /* padding */ }; /* Power2 is needed to convert LSA types into bit positions, @@ -141,25 +141,25 @@ struct msg_unregister_opaque_type { #ifdef ORIGINAL_CODING -static const u_int16_t Power2[] = {0x0, 0x1, 0x2, 0x4, 0x8, 0x10, - 0x20, 0x40, 0x80, 0x100, 0x200, 0x400, - 0x800, 0x1000, 0x2000, 0x4000, 0x8000}; +static const uint16_t Power2[] = {0x0, 0x1, 0x2, 0x4, 0x8, 0x10, + 0x20, 0x40, 0x80, 0x100, 0x200, 0x400, + 0x800, 0x1000, 0x2000, 0x4000, 0x8000}; #else -static const u_int16_t Power2[] = { +static const uint16_t Power2[] = { 0, (1 << 0), (1 << 1), (1 << 2), (1 << 3), (1 << 4), (1 << 5), (1 << 6), (1 << 7), (1 << 8), (1 << 9), (1 << 10), (1 << 11), (1 << 12), (1 << 13), (1 << 14), (1 << 15)}; #endif /* ORIGINAL_CODING */ struct lsa_filter_type { - u_int16_t typemask; /* bitmask for selecting LSA types (1..16) */ - u_char origin; /* selects according to origin. */ + uint16_t typemask; /* bitmask for selecting LSA types (1..16) */ + uint8_t origin; /* selects according to origin. */ #define NON_SELF_ORIGINATED 0 #define SELF_ORIGINATED (OSPF_LSA_SELF) #define ANY_ORIGIN 2 - u_char num_areas; /* number of areas in the filter. */ - /* areas, if any, go here. */ + uint8_t num_areas; /* number of areas in the filter. */ + /* areas, if any, go here. */ }; struct msg_register_event { @@ -183,10 +183,10 @@ struct msg_originate_request { struct msg_delete_request { struct in_addr area_id; /* "0.0.0.0" for AS-external opaque LSAs */ - u_char lsa_type; - u_char opaque_type; - u_char pad[2]; /* padding */ - u_int32_t opaque_id; + uint8_t lsa_type; + uint8_t opaque_type; + uint8_t pad[2]; /* padding */ + uint32_t opaque_id; }; struct msg_reply { @@ -202,16 +202,16 @@ struct msg_reply { #define OSPF_API_NOMEMORY (-8) #define OSPF_API_ERROR (-9) #define OSPF_API_UNDEF (-10) - u_char pad[3]; /* padding to four byte alignment */ + uint8_t pad[3]; /* padding to four byte alignment */ }; /* Message to tell client application that it ospf daemon is * ready to accept opaque LSAs for a given interface or area. */ struct msg_ready_notify { - u_char lsa_type; - u_char opaque_type; - u_char pad[2]; /* padding */ + uint8_t lsa_type; + uint8_t opaque_type; + uint8_t pad[2]; /* padding */ struct in_addr addr; /* interface address or area address */ }; @@ -224,8 +224,8 @@ struct msg_lsa_change_notify { struct in_addr ifaddr; /* Area ID. Not valid for AS-External and Opaque11 LSAs. */ struct in_addr area_id; - u_char is_self_originated; /* 1 if self originated. */ - u_char pad[3]; + uint8_t is_self_originated; /* 1 if self originated. */ + uint8_t pad[3]; struct lsa_header data; }; @@ -241,16 +241,16 @@ struct msg_del_if { struct msg_ism_change { struct in_addr ifaddr; /* interface IP address */ struct in_addr area_id; /* area this interface belongs to */ - u_char status; /* interface status (up/down) */ - u_char pad[3]; /* not used */ + uint8_t status; /* interface status (up/down) */ + uint8_t pad[3]; /* not used */ }; struct msg_nsm_change { struct in_addr ifaddr; /* attached interface */ struct in_addr nbraddr; /* Neighbor interface address */ struct in_addr router_id; /* Router ID of neighbor */ - u_char status; /* NSM status */ - u_char pad[3]; + uint8_t status; /* NSM status */ + uint8_t pad[3]; }; /* We make use of a union to define a structure that covers all @@ -285,45 +285,45 @@ struct apimsg { extern void api_opaque_lsa_print(struct lsa_header *data); /* Messages sent by client */ -extern struct msg *new_msg_register_opaque_type(u_int32_t seqnum, u_char ltype, - u_char otype); -extern struct msg *new_msg_register_event(u_int32_t seqnum, +extern struct msg *new_msg_register_opaque_type(uint32_t seqnum, uint8_t ltype, + uint8_t otype); +extern struct msg *new_msg_register_event(uint32_t seqnum, struct lsa_filter_type *filter); -extern struct msg *new_msg_sync_lsdb(u_int32_t seqnum, +extern struct msg *new_msg_sync_lsdb(uint32_t seqnum, struct lsa_filter_type *filter); -extern struct msg *new_msg_originate_request(u_int32_t seqnum, +extern struct msg *new_msg_originate_request(uint32_t seqnum, struct in_addr ifaddr, struct in_addr area_id, struct lsa_header *data); -extern struct msg *new_msg_delete_request(u_int32_t seqnum, +extern struct msg *new_msg_delete_request(uint32_t seqnum, struct in_addr area_id, - u_char lsa_type, u_char opaque_type, - u_int32_t opaque_id); + uint8_t lsa_type, uint8_t opaque_type, + uint32_t opaque_id); /* Messages sent by OSPF daemon */ -extern struct msg *new_msg_reply(u_int32_t seqnum, u_char rc); +extern struct msg *new_msg_reply(uint32_t seqnum, uint8_t rc); -extern struct msg *new_msg_ready_notify(u_int32_t seqnr, u_char lsa_type, - u_char opaque_type, +extern struct msg *new_msg_ready_notify(uint32_t seqnr, uint8_t lsa_type, + uint8_t opaque_type, struct in_addr addr); -extern struct msg *new_msg_new_if(u_int32_t seqnr, struct in_addr ifaddr, +extern struct msg *new_msg_new_if(uint32_t seqnr, struct in_addr ifaddr, struct in_addr area); -extern struct msg *new_msg_del_if(u_int32_t seqnr, struct in_addr ifaddr); +extern struct msg *new_msg_del_if(uint32_t seqnr, struct in_addr ifaddr); -extern struct msg *new_msg_ism_change(u_int32_t seqnr, struct in_addr ifaddr, - struct in_addr area, u_char status); +extern struct msg *new_msg_ism_change(uint32_t seqnr, struct in_addr ifaddr, + struct in_addr area, uint8_t status); -extern struct msg *new_msg_nsm_change(u_int32_t seqnr, struct in_addr ifaddr, +extern struct msg *new_msg_nsm_change(uint32_t seqnr, struct in_addr ifaddr, struct in_addr nbraddr, - struct in_addr router_id, u_char status); + struct in_addr router_id, uint8_t status); /* msgtype is MSG_LSA_UPDATE_NOTIFY or MSG_LSA_DELETE_NOTIFY */ -extern struct msg *new_msg_lsa_change_notify(u_char msgtype, u_int32_t seqnum, +extern struct msg *new_msg_lsa_change_notify(uint8_t msgtype, uint32_t seqnum, struct in_addr ifaddr, struct in_addr area_id, - u_char is_self_originated, + uint8_t is_self_originated, struct lsa_header *data); /* string printing functions */ diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c index 36bd49125..37735e361 100644 --- a/ospfd/ospf_apiserver.c +++ b/ospfd/ospf_apiserver.c @@ -186,8 +186,8 @@ void ospf_apiserver_term(void) /* XXX */ } -static struct ospf_apiserver *lookup_apiserver(u_char lsa_type, - u_char opaque_type) +static struct ospf_apiserver *lookup_apiserver(uint8_t lsa_type, + uint8_t opaque_type) { struct listnode *n1, *n2; struct registered_opaque_type *r; @@ -766,8 +766,8 @@ static int ospf_apiserver_send_msg(struct ospf_apiserver *apiserv, return 0; } -int ospf_apiserver_send_reply(struct ospf_apiserver *apiserv, u_int32_t seqnr, - u_char rc) +int ospf_apiserver_send_reply(struct ospf_apiserver *apiserv, uint32_t seqnr, + uint8_t rc) { struct msg *msg = new_msg_reply(seqnr, rc); int ret; @@ -831,7 +831,7 @@ int ospf_apiserver_handle_msg(struct ospf_apiserver *apiserv, struct msg *msg) */ int ospf_apiserver_register_opaque_type(struct ospf_apiserver *apiserv, - u_char lsa_type, u_char opaque_type) + uint8_t lsa_type, uint8_t opaque_type) { struct registered_opaque_type *regtype; int (*originator_func)(void *arg); @@ -895,7 +895,7 @@ int ospf_apiserver_register_opaque_type(struct ospf_apiserver *apiserv, } int ospf_apiserver_unregister_opaque_type(struct ospf_apiserver *apiserv, - u_char lsa_type, u_char opaque_type) + uint8_t lsa_type, uint8_t opaque_type) { struct listnode *node, *nnode; struct registered_opaque_type *regtype; @@ -934,8 +934,8 @@ int ospf_apiserver_unregister_opaque_type(struct ospf_apiserver *apiserv, static int apiserver_is_opaque_type_registered(struct ospf_apiserver *apiserv, - u_char lsa_type, - u_char opaque_type) + uint8_t lsa_type, + uint8_t opaque_type) { struct listnode *node, *nnode; struct registered_opaque_type *regtype; @@ -957,8 +957,8 @@ int ospf_apiserver_handle_register_opaque_type(struct ospf_apiserver *apiserv, struct msg *msg) { struct msg_register_opaque_type *rmsg; - u_char lsa_type; - u_char opaque_type; + uint8_t lsa_type; + uint8_t opaque_type; int rc = 0; /* Extract parameters from register opaque type message */ @@ -1135,8 +1135,8 @@ int ospf_apiserver_handle_unregister_opaque_type(struct ospf_apiserver *apiserv, struct msg *msg) { struct msg_unregister_opaque_type *umsg; - u_char ltype; - u_char otype; + uint8_t ltype; + uint8_t otype; int rc = 0; /* Extract parameters from unregister opaque type message */ @@ -1163,7 +1163,7 @@ int ospf_apiserver_handle_register_event(struct ospf_apiserver *apiserv, { struct msg_register_event *rmsg; int rc; - u_int32_t seqnum; + uint32_t seqnum; rmsg = (struct msg_register_event *)STREAM_DATA(msg->s); @@ -1212,7 +1212,7 @@ static int apiserver_sync_callback(struct ospf_lsa *lsa, void *p_arg, param = (struct param_t *)p_arg; apiserv = param->apiserv; - seqnum = (u_int32_t)int_arg; + seqnum = (uint32_t)int_arg; /* Check origin in filter. */ if ((param->filter->origin == ANY_ORIGIN) @@ -1260,14 +1260,14 @@ int ospf_apiserver_handle_sync_lsdb(struct ospf_apiserver *apiserv, struct msg *msg) { struct listnode *node, *nnode; - u_int32_t seqnum; + uint32_t seqnum; int rc = 0; struct msg_sync_lsdb *smsg; struct ospf_apiserver_param_t { struct ospf_apiserver *apiserv; struct lsa_filter_type *filter; } param; - u_int16_t mask; + uint16_t mask; struct route_node *rn; struct ospf_lsa *lsa; struct ospf *ospf; @@ -1290,13 +1290,13 @@ int ospf_apiserver_handle_sync_lsdb(struct ospf_apiserver *apiserv, /* Iterate over all areas. */ for (ALL_LIST_ELEMENTS(ospf->areas, node, nnode, area)) { int i; - u_int32_t *area_id = NULL; + uint32_t *area_id = NULL; /* Compare area_id with area_ids in sync request. */ if ((i = smsg->filter.num_areas) > 0) { /* Let area_id point to the list of area IDs, * which is at the end of smsg->filter. */ - area_id = (u_int32_t *)(&smsg->filter + 1); + area_id = (uint32_t *)(&smsg->filter + 1); while (i) { if (*area_id == area->area_id.s_addr) { break; @@ -1379,8 +1379,8 @@ struct ospf_lsa *ospf_apiserver_opaque_lsa_new(struct ospf_area *area, struct stream *s; struct lsa_header *newlsa; struct ospf_lsa *new = NULL; - u_char options = 0x0; - u_int16_t length; + uint8_t options = 0x0; + uint16_t length; struct ospf *ospf; @@ -1419,7 +1419,7 @@ struct ospf_lsa *ospf_apiserver_opaque_lsa_new(struct ospf_area *area, ospf->router_id); /* Set opaque-LSA body fields. */ - stream_put(s, ((u_char *)protolsa) + sizeof(struct lsa_header), + stream_put(s, ((uint8_t *)protolsa) + sizeof(struct lsa_header), ntohs(protolsa->length) - sizeof(struct lsa_header)); /* Determine length of LSA. */ @@ -1904,8 +1904,8 @@ static int apiserver_flush_opaque_type_callback(struct ospf_lsa *lsa, { struct param_t { struct ospf_apiserver *apiserv; - u_char lsa_type; - u_char opaque_type; + uint8_t lsa_type; + uint8_t opaque_type; } * param; /* Sanity check */ @@ -1927,12 +1927,12 @@ static int apiserver_flush_opaque_type_callback(struct ospf_lsa *lsa, type or a connection to an application closes and all those opaque LSAs need to be flushed the LSDB. */ void ospf_apiserver_flush_opaque_lsa(struct ospf_apiserver *apiserv, - u_char lsa_type, u_char opaque_type) + uint8_t lsa_type, uint8_t opaque_type) { struct param_t { struct ospf_apiserver *apiserv; - u_char lsa_type; - u_char opaque_type; + uint8_t lsa_type; + uint8_t opaque_type; } param; struct listnode *node, *nnode; struct ospf *ospf; @@ -2076,7 +2076,7 @@ void ospf_apiserver_show_info(struct vty *vty, struct ospf_lsa *lsa) { struct opaque_lsa { struct lsa_header header; - u_char data[1]; /* opaque data have variable length. This is + uint8_t data[1]; /* opaque data have variable length. This is start address */ }; @@ -2355,7 +2355,7 @@ void ospf_apiserver_clients_notify_nsm_change(struct ospf_neighbor *nbr) msg_free(msg); } -static void apiserver_clients_lsa_change_notify(u_char msgtype, +static void apiserver_clients_lsa_change_notify(uint8_t msgtype, struct ospf_lsa *lsa) { struct msg *msg; @@ -2390,8 +2390,8 @@ static void apiserver_clients_lsa_change_notify(u_char msgtype, /* Now send message to all clients with a matching filter */ for (ALL_LIST_ELEMENTS(apiserver_list, node, nnode, apiserv)) { struct lsa_filter_type *filter; - u_int16_t mask; - u_int32_t *area; + uint16_t mask; + uint32_t *area; int i; /* Check filter for this client. */ @@ -2408,7 +2408,7 @@ static void apiserver_clients_lsa_change_notify(u_char msgtype, } if (i > 0) { - area = (u_int32_t *)(filter + 1); + area = (uint32_t *)(filter + 1); while (i) { if (*area == area_id.s_addr) { break; @@ -2444,7 +2444,7 @@ static void apiserver_clients_lsa_change_notify(u_char msgtype, */ -static int apiserver_notify_clients_lsa(u_char msgtype, struct ospf_lsa *lsa) +static int apiserver_notify_clients_lsa(uint8_t msgtype, struct ospf_lsa *lsa) { struct msg *msg; /* default area for AS-External and Opaque11 LSAs */ diff --git a/ospfd/ospf_apiserver.h b/ospfd/ospf_apiserver.h index 59d18bfd6..89a947497 100644 --- a/ospfd/ospf_apiserver.h +++ b/ospfd/ospf_apiserver.h @@ -28,8 +28,8 @@ /* List of opaque types that application registered */ struct registered_opaque_type { - u_char lsa_type; - u_char opaque_type; + uint8_t lsa_type; + uint8_t opaque_type; }; @@ -96,7 +96,7 @@ extern int ospf_apiserver_read(struct thread *thread); extern int ospf_apiserver_sync_write(struct thread *thread); extern int ospf_apiserver_async_write(struct thread *thread); extern int ospf_apiserver_send_reply(struct ospf_apiserver *apiserv, - u_int32_t seqnr, u_char rc); + uint32_t seqnr, uint8_t rc); /* ----------------------------------------------------------- * Followings are message handler functions @@ -152,11 +152,11 @@ extern int ospf_apiserver_handle_sync_lsdb(struct ospf_apiserver *apiserv, */ extern int ospf_apiserver_register_opaque_type(struct ospf_apiserver *apiserver, - u_char lsa_type, - u_char opaque_type); + uint8_t lsa_type, + uint8_t opaque_type); extern int ospf_apiserver_unregister_opaque_type(struct ospf_apiserver *apiserver, - u_char lsa_type, u_char opaque_type); + uint8_t lsa_type, uint8_t opaque_type); extern struct ospf_lsa * ospf_apiserver_opaque_lsa_new(struct ospf_area *area, struct ospf_interface *oi, struct lsa_header *protolsa); @@ -186,8 +186,8 @@ extern void ospf_apiserver_show_info(struct vty *vty, struct ospf_lsa *lsa); extern int ospf_ospf_apiserver_lsa_originator(void *arg); extern struct ospf_lsa *ospf_apiserver_lsa_refresher(struct ospf_lsa *lsa); extern void ospf_apiserver_flush_opaque_lsa(struct ospf_apiserver *apiserv, - u_char lsa_type, - u_char opaque_type); + uint8_t lsa_type, + uint8_t opaque_type); /* ----------------------------------------------------------- * Followings are hooks when LSAs are updated or deleted @@ -200,7 +200,7 @@ extern void ospf_apiserver_flush_opaque_lsa(struct ospf_apiserver *apiserv, extern int ospf_apiserver_lsa_update(struct ospf_lsa *lsa); extern int ospf_apiserver_lsa_delete(struct ospf_lsa *lsa); -extern void ospf_apiserver_clients_lsa_change_notify(u_char msgtype, +extern void ospf_apiserver_clients_lsa_change_notify(uint8_t msgtype, struct ospf_lsa *lsa); #endif /* _OSPF_APISERVER_H */ diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c index b970c1183..18c1077da 100644 --- a/ospfd/ospf_asbr.c +++ b/ospfd/ospf_asbr.c @@ -94,7 +94,8 @@ struct ospf_route *ospf_external_route_lookup(struct ospf *ospf, /* Add an External info for AS-external-LSA. */ -struct external_info *ospf_external_info_new(u_char type, u_short instance) +struct external_info *ospf_external_info_new(uint8_t type, + unsigned short instance) { struct external_info *new; @@ -127,7 +128,7 @@ int ospf_route_map_set_compare(struct route_map_set_values *values1, /* Add an External info for AS-external-LSA. */ struct external_info * -ospf_external_info_add(struct ospf *ospf, u_char type, u_short instance, +ospf_external_info_add(struct ospf *ospf, uint8_t type, unsigned short instance, struct prefix_ipv4 p, ifindex_t ifindex, struct in_addr nexthop, route_tag_t tag) { @@ -185,8 +186,8 @@ ospf_external_info_add(struct ospf *ospf, u_char type, u_short instance, return new; } -void ospf_external_info_delete(struct ospf *ospf, u_char type, u_short instance, - struct prefix_ipv4 p) +void ospf_external_info_delete(struct ospf *ospf, uint8_t type, + unsigned short instance, struct prefix_ipv4 p) { struct route_node *rn; struct ospf_external *ext; @@ -204,8 +205,8 @@ void ospf_external_info_delete(struct ospf *ospf, u_char type, u_short instance, } } -struct external_info *ospf_external_info_lookup(struct ospf *ospf, u_char type, - u_short instance, +struct external_info *ospf_external_info_lookup(struct ospf *ospf, uint8_t type, + unsigned short instance, struct prefix_ipv4 *p) { struct route_node *rn; @@ -255,7 +256,7 @@ struct ospf_lsa *ospf_external_info_find_lsa(struct ospf *ospf, /* Update ASBR status. */ -void ospf_asbr_status_update(struct ospf *ospf, u_char status) +void ospf_asbr_status_update(struct ospf *ospf, uint8_t status) { zlog_info("ASBR[Status:%d]: Update", status); @@ -281,8 +282,8 @@ void ospf_asbr_status_update(struct ospf *ospf, u_char status) ospf_router_lsa_update(ospf); } -void ospf_redistribute_withdraw(struct ospf *ospf, u_char type, - u_short instance) +void ospf_redistribute_withdraw(struct ospf *ospf, uint8_t type, + unsigned short instance) { struct route_node *rn; struct external_info *ei; diff --git a/ospfd/ospf_asbr.h b/ospfd/ospf_asbr.h index d437314c8..370c6787b 100644 --- a/ospfd/ospf_asbr.h +++ b/ospfd/ospf_asbr.h @@ -30,9 +30,9 @@ struct route_map_set_values { /* Redistributed external information. */ struct external_info { /* Type of source protocol. */ - u_char type; + uint8_t type; - u_short instance; + unsigned short instance; /* Prefix. */ struct prefix_ipv4 p; @@ -54,23 +54,25 @@ struct external_info { #define OSPF_ASBR_CHECK_DELAY 30 extern void ospf_external_route_remove(struct ospf *, struct prefix_ipv4 *); -extern struct external_info *ospf_external_info_new(u_char, u_short); +extern struct external_info *ospf_external_info_new(uint8_t, unsigned short); extern void ospf_reset_route_map_set_values(struct route_map_set_values *); extern int ospf_route_map_set_compare(struct route_map_set_values *, struct route_map_set_values *); -extern struct external_info *ospf_external_info_add(struct ospf *, u_char, - u_short, struct prefix_ipv4, +extern struct external_info *ospf_external_info_add(struct ospf *, uint8_t, + unsigned short, + struct prefix_ipv4, ifindex_t, struct in_addr, route_tag_t); -extern void ospf_external_info_delete(struct ospf *, u_char, u_short, +extern void ospf_external_info_delete(struct ospf *, uint8_t, unsigned short, struct prefix_ipv4); -extern struct external_info * -ospf_external_info_lookup(struct ospf *, u_char, u_short, struct prefix_ipv4 *); +extern struct external_info *ospf_external_info_lookup(struct ospf *, uint8_t, + unsigned short, + struct prefix_ipv4 *); extern struct ospf_route *ospf_external_route_lookup(struct ospf *, struct prefix_ipv4 *); -extern void ospf_asbr_status_update(struct ospf *, u_char); +extern void ospf_asbr_status_update(struct ospf *, uint8_t); -extern void ospf_redistribute_withdraw(struct ospf *, u_char, u_short); +extern void ospf_redistribute_withdraw(struct ospf *, uint8_t, unsigned short); extern void ospf_asbr_check(void); extern void ospf_schedule_asbr_check(void); extern void ospf_asbr_route_install_lsa(struct ospf_lsa *); diff --git a/ospfd/ospf_ase.c b/ospfd/ospf_ase.c index 0c2ddc964..d42562486 100644 --- a/ospfd/ospf_ase.c +++ b/ospfd/ospf_ase.c @@ -241,7 +241,7 @@ ospf_ase_calculate_asbr_route (struct ospf *ospf, static struct ospf_route * ospf_ase_calculate_new_route(struct ospf_lsa *lsa, - struct ospf_route *asbr_route, u_int32_t metric) + struct ospf_route *asbr_route, uint32_t metric) { struct as_external_lsa *al; struct ospf_route *new; @@ -282,7 +282,7 @@ ospf_ase_calculate_new_route(struct ospf_lsa *lsa, int ospf_ase_calculate_route(struct ospf *ospf, struct ospf_lsa *lsa) { - u_int32_t metric; + uint32_t metric; struct as_external_lsa *al; struct ospf_route *asbr_route; struct prefix_ipv4 asbr, p; diff --git a/ospfd/ospf_bfd.c b/ospfd/ospf_bfd.c index 9254e7d24..0f7fb5077 100644 --- a/ospfd/ospf_bfd.c +++ b/ospfd/ospf_bfd.c @@ -308,7 +308,7 @@ void ospf_bfd_write_config(struct vty *vty, struct ospf_if_params *params) * ospf_bfd_show_info - Show BFD info structure */ void ospf_bfd_show_info(struct vty *vty, void *bfd_info, json_object *json_obj, - u_char use_json, int param_only) + uint8_t use_json, int param_only) { if (param_only) bfd_show_param(vty, (struct bfd_info *)bfd_info, 1, 0, use_json, @@ -322,7 +322,7 @@ void ospf_bfd_show_info(struct vty *vty, void *bfd_info, json_object *json_obj, * ospf_bfd_interface_show - Show the interface BFD configuration. */ void ospf_bfd_interface_show(struct vty *vty, struct interface *ifp, - json_object *json_interface_sub, u_char use_json) + json_object *json_interface_sub, uint8_t use_json) { struct ospf_if_params *params; @@ -336,8 +336,8 @@ void ospf_bfd_interface_show(struct vty *vty, struct interface *ifp, * ospf_bfd_if_param_set - Set the configured BFD paramter values for * interface. */ -static void ospf_bfd_if_param_set(struct interface *ifp, u_int32_t min_rx, - u_int32_t min_tx, u_int8_t detect_mult, +static void ospf_bfd_if_param_set(struct interface *ifp, uint32_t min_rx, + uint32_t min_tx, uint8_t detect_mult, int defaults) { struct ospf_if_params *params; @@ -387,9 +387,9 @@ DEFUN (ip_ospf_bfd_param, int idx_number = 3; int idx_number_2 = 4; int idx_number_3 = 5; - u_int32_t rx_val; - u_int32_t tx_val; - u_int8_t dm_val; + uint32_t rx_val; + uint32_t tx_val; + uint8_t dm_val; int ret; assert(ifp); diff --git a/ospfd/ospf_bfd.h b/ospfd/ospf_bfd.h index c940f31eb..6d7caf421 100644 --- a/ospfd/ospf_bfd.h +++ b/ospfd/ospf_bfd.h @@ -35,13 +35,13 @@ extern void ospf_bfd_trigger_event(struct ospf_neighbor *nbr, int old_state, extern void ospf_bfd_interface_show(struct vty *vty, struct interface *ifp, json_object *json_interface_sub, - u_char use_json); + uint8_t use_json); extern void ospf_bfd_info_nbr_create(struct ospf_interface *oi, struct ospf_neighbor *nbr); extern void ospf_bfd_show_info(struct vty *vty, void *bfd_info, - json_object *json_obj, u_char use_json, + json_object *json_obj, uint8_t use_json, int param_only); extern void ospf_bfd_info_free(void **bfd_info); diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index 66ab59b81..08bedadf4 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -66,7 +66,7 @@ unsigned long term_debug_ospf_te = 0; unsigned long term_debug_ospf_ext = 0; unsigned long term_debug_ospf_sr = 0; -const char *ospf_redist_string(u_int route_type) +const char *ospf_redist_string(unsigned int route_type) { return (route_type == ZEBRA_ROUTE_MAX) ? "Default" : zebra_route_string(route_type); @@ -76,7 +76,7 @@ const char *ospf_redist_string(u_int route_type) const char *ospf_area_name_string(struct ospf_area *area) { static char buf[OSPF_AREA_STRING_MAXLEN] = ""; - u_int32_t area_id; + uint32_t area_id; if (!area) return "-"; @@ -92,7 +92,7 @@ const char *ospf_area_name_string(struct ospf_area *area) const char *ospf_area_desc_string(struct ospf_area *area) { static char buf[OSPF_AREA_DESC_STRING_MAXLEN] = ""; - u_char type; + uint8_t type; if (!area) return "(incomplete)"; @@ -118,7 +118,7 @@ const char *ospf_area_desc_string(struct ospf_area *area) const char *ospf_if_name_string(struct ospf_interface *oi) { static char buf[OSPF_IF_STRING_MAXLEN] = ""; - u_int32_t ifaddr; + uint32_t ifaddr; if (!oi || !oi->address) return "inactive"; @@ -228,7 +228,7 @@ const char *ospf_timer_dump(struct thread *t, char *buf, size_t size) return ospf_timeval_dump(&result, buf, size); } -static void ospf_packet_hello_dump(struct stream *s, u_int16_t length) +static void ospf_packet_hello_dump(struct stream *s, uint16_t length) { struct ospf_hello *hello; int i; @@ -242,7 +242,7 @@ static void ospf_packet_hello_dump(struct stream *s, u_int16_t length) ospf_options_dump(hello->options)); zlog_debug(" RtrPriority %d", hello->priority); zlog_debug(" RtrDeadInterval %ld", - (u_long)ntohl(hello->dead_interval)); + (unsigned long)ntohl(hello->dead_interval)); zlog_debug(" DRouter %s", inet_ntoa(hello->d_router)); zlog_debug(" BDRouter %s", inet_ntoa(hello->bd_router)); @@ -252,7 +252,7 @@ static void ospf_packet_hello_dump(struct stream *s, u_int16_t length) zlog_debug(" Neighbor %s", inet_ntoa(hello->neighbors[i])); } -static char *ospf_dd_flags_dump(u_char flags, char *buf, size_t size) +static char *ospf_dd_flags_dump(uint8_t flags, char *buf, size_t size) { memset(buf, 0, size); @@ -263,7 +263,7 @@ static char *ospf_dd_flags_dump(u_char flags, char *buf, size_t size) return buf; } -static char *ospf_router_lsa_flags_dump(u_char flags, char *buf, size_t size) +static char *ospf_router_lsa_flags_dump(uint8_t flags, char *buf, size_t size) { memset(buf, 0, size); @@ -275,7 +275,7 @@ static char *ospf_router_lsa_flags_dump(u_char flags, char *buf, size_t size) return buf; } -static void ospf_router_lsa_dump(struct stream *s, u_int16_t length) +static void ospf_router_lsa_dump(struct stream *s, uint16_t length) { char buf[BUFSIZ]; struct router_lsa *rl; @@ -293,15 +293,15 @@ static void ospf_router_lsa_dump(struct stream *s, u_int16_t length) zlog_debug(" Link ID %s", inet_ntoa(rl->link[i].link_id)); zlog_debug(" Link Data %s", inet_ntoa(rl->link[i].link_data)); - zlog_debug(" Type %d", (u_char)rl->link[i].type); - zlog_debug(" TOS %d", (u_char)rl->link[i].tos); + zlog_debug(" Type %d", (uint8_t)rl->link[i].type); + zlog_debug(" TOS %d", (uint8_t)rl->link[i].tos); zlog_debug(" metric %d", ntohs(rl->link[i].metric)); len -= 12; } } -static void ospf_network_lsa_dump(struct stream *s, u_int16_t length) +static void ospf_network_lsa_dump(struct stream *s, uint16_t length) { struct network_lsa *nl; int i, cnt; @@ -322,7 +322,7 @@ static void ospf_network_lsa_dump(struct stream *s, u_int16_t length) inet_ntoa(nl->routers[i])); } -static void ospf_summary_lsa_dump(struct stream *s, u_int16_t length) +static void ospf_summary_lsa_dump(struct stream *s, uint16_t length) { struct summary_lsa *sl; int size; @@ -339,7 +339,7 @@ static void ospf_summary_lsa_dump(struct stream *s, u_int16_t length) GET_METRIC(sl->metric)); } -static void ospf_as_external_lsa_dump(struct stream *s, u_int16_t length) +static void ospf_as_external_lsa_dump(struct stream *s, uint16_t length) { struct as_external_lsa *al; int size; @@ -361,7 +361,7 @@ static void ospf_as_external_lsa_dump(struct stream *s, u_int16_t length) } } -static void ospf_lsa_header_list_dump(struct stream *s, u_int16_t length) +static void ospf_lsa_header_list_dump(struct stream *s, uint16_t length) { struct lsa_header *lsa; @@ -377,12 +377,12 @@ static void ospf_lsa_header_list_dump(struct stream *s, u_int16_t length) } } -static void ospf_packet_db_desc_dump(struct stream *s, u_int16_t length) +static void ospf_packet_db_desc_dump(struct stream *s, uint16_t length) { struct ospf_db_desc *dd; char dd_flags[8]; - u_int32_t gp; + uint32_t gp; gp = stream_get_getp(s); dd = (struct ospf_db_desc *)stream_pnt(s); @@ -393,7 +393,8 @@ static void ospf_packet_db_desc_dump(struct stream *s, u_int16_t length) ospf_options_dump(dd->options)); zlog_debug(" Flags %d (%s)", dd->flags, ospf_dd_flags_dump(dd->flags, dd_flags, sizeof dd_flags)); - zlog_debug(" Sequence Number 0x%08lx", (u_long)ntohl(dd->dd_seqnum)); + zlog_debug(" Sequence Number 0x%08lx", + (unsigned long)ntohl(dd->dd_seqnum)); length -= OSPF_HEADER_SIZE + OSPF_DB_DESC_MIN_SIZE; @@ -404,10 +405,10 @@ static void ospf_packet_db_desc_dump(struct stream *s, u_int16_t length) stream_set_getp(s, gp); } -static void ospf_packet_ls_req_dump(struct stream *s, u_int16_t length) +static void ospf_packet_ls_req_dump(struct stream *s, uint16_t length) { - u_int32_t sp; - u_int32_t ls_type; + uint32_t sp; + uint32_t ls_type; struct in_addr ls_id; struct in_addr adv_router; @@ -431,12 +432,12 @@ static void ospf_packet_ls_req_dump(struct stream *s, u_int16_t length) stream_set_getp(s, sp); } -static void ospf_packet_ls_upd_dump(struct stream *s, u_int16_t length) +static void ospf_packet_ls_upd_dump(struct stream *s, uint16_t length) { - u_int32_t sp; + uint32_t sp; struct lsa_header *lsa; int lsa_len; - u_int32_t count; + uint32_t count; length -= OSPF_HEADER_SIZE; @@ -493,9 +494,9 @@ static void ospf_packet_ls_upd_dump(struct stream *s, u_int16_t length) stream_set_getp(s, sp); } -static void ospf_packet_ls_ack_dump(struct stream *s, u_int16_t length) +static void ospf_packet_ls_ack_dump(struct stream *s, uint16_t length) { - u_int32_t sp; + uint32_t sp; length -= OSPF_HEADER_SIZE; sp = stream_get_getp(s); @@ -514,11 +515,11 @@ void ospf_ip_header_dump(struct ip *iph) zlog_debug("ip_hl %d", iph->ip_hl); zlog_debug("ip_tos %d", iph->ip_tos); zlog_debug("ip_len %d", iph->ip_len); - zlog_debug("ip_id %u", (u_int32_t)iph->ip_id); - zlog_debug("ip_off %u", (u_int32_t)iph->ip_off); + zlog_debug("ip_id %u", (uint32_t)iph->ip_id); + zlog_debug("ip_off %u", (uint32_t)iph->ip_off); zlog_debug("ip_ttl %d", iph->ip_ttl); zlog_debug("ip_p %d", iph->ip_p); - zlog_debug("ip_sum 0x%x", (u_int32_t)iph->ip_sum); + zlog_debug("ip_sum 0x%x", (uint32_t)iph->ip_sum); zlog_debug("ip_src %s", inet_ntoa(iph->ip_src)); zlog_debug("ip_dst %s", inet_ntoa(iph->ip_dst)); } @@ -526,7 +527,7 @@ void ospf_ip_header_dump(struct ip *iph) static void ospf_header_dump(struct ospf_header *ospfh) { char buf[9]; - u_int16_t auth_type = ntohs(ospfh->auth_type); + uint16_t auth_type = ntohs(ospfh->auth_type); zlog_debug("Header"); zlog_debug(" Version %d", ospfh->version); @@ -552,7 +553,7 @@ static void ospf_header_dump(struct ospf_header *ospfh) zlog_debug(" Key ID %d", ospfh->u.crypt.key_id); zlog_debug(" Auth Data Len %d", ospfh->u.crypt.auth_data_len); zlog_debug(" Sequence number %ld", - (u_long)ntohl(ospfh->u.crypt.crypt_seqnum)); + (unsigned long)ntohl(ospfh->u.crypt.crypt_seqnum)); break; default: zlog_debug("* This is not supported authentication type"); @@ -919,7 +920,7 @@ DEFUN (debug_ospf_instance_nsm, "NSM Timer Information\n") { int idx_number = 2; - u_short instance = 0; + unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); if (!ospf_lookup_instance(instance)) @@ -991,7 +992,7 @@ DEFUN (no_debug_ospf_instance_nsm, "NSM Timer Information\n") { int idx_number = 3; - u_short instance = 0; + unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); if (!ospf_lookup_instance(instance)) @@ -1065,7 +1066,7 @@ DEFUN (debug_ospf_instance_lsa, "LSA Refresh\n") { int idx_number = 2; - u_short instance = 0; + unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); if (!ospf_lookup_instance(instance)) @@ -1141,7 +1142,7 @@ DEFUN (no_debug_ospf_instance_lsa, "LSA Refres\n") { int idx_number = 3; - u_short instance = 0; + unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); if (!ospf_lookup_instance(instance)) @@ -1203,7 +1204,7 @@ DEFUN (debug_ospf_instance_zebra, "Zebra redistribute\n") { int idx_number = 2; - u_short instance = 0; + unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); if (!ospf_lookup_instance(instance)) @@ -1267,7 +1268,7 @@ DEFUN (no_debug_ospf_instance_zebra, "Zebra redistribute\n") { int idx_number = 3; - u_short instance = 0; + unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); if (!ospf_lookup_instance(instance)) @@ -1313,7 +1314,7 @@ DEFUN (debug_ospf_instance_event, "OSPF event information\n") { int idx_number = 2; - u_short instance = 0; + unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); if (!ospf_lookup_instance(instance)) @@ -1335,7 +1336,7 @@ DEFUN (no_debug_ospf_instance_event, "OSPF event information\n") { int idx_number = 3; - u_short instance = 0; + unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); if (!ospf_lookup_instance(instance)) @@ -1383,7 +1384,7 @@ DEFUN (debug_ospf_instance_nssa, "OSPF nssa information\n") { int idx_number = 2; - u_short instance = 0; + unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); if (!ospf_lookup_instance(instance)) @@ -1405,7 +1406,7 @@ DEFUN (no_debug_ospf_instance_nssa, "OSPF nssa information\n") { int idx_number = 3; - u_short instance = 0; + unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); if (!ospf_lookup_instance(instance)) @@ -1654,7 +1655,7 @@ DEFUN_NOSH (show_debugging_ospf_instance, { int idx_number = 3; struct ospf *ospf; - u_short instance = 0; + unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); if ((ospf = ospf_lookup_instance(instance)) == NULL) diff --git a/ospfd/ospf_dump_api.c b/ospfd/ospf_dump_api.c index 3cfe3453a..1196339c3 100644 --- a/ospfd/ospf_dump_api.c +++ b/ospfd/ospf_dump_api.c @@ -101,7 +101,7 @@ const struct message ospf_auth_type_str[] = { #define OSPF_OPTION_STR_MAXLEN 24 -char *ospf_options_dump(u_char options) +char *ospf_options_dump(uint8_t options) { static char buf[OSPF_OPTION_STR_MAXLEN]; @@ -130,7 +130,7 @@ void ospf_lsa_header_dump(struct lsa_header *lsah) zlog_debug(" Link State ID %s", inet_ntoa(lsah->id)); zlog_debug(" Advertising Router %s", inet_ntoa(lsah->adv_router)); zlog_debug(" LS sequence number 0x%lx", - (u_long)ntohl(lsah->ls_seqnum)); + (unsigned long)ntohl(lsah->ls_seqnum)); zlog_debug(" LS checksum 0x%x", ntohs(lsah->checksum)); zlog_debug(" length %d", ntohs(lsah->length)); } diff --git a/ospfd/ospf_dump_api.h b/ospfd/ospf_dump_api.h index 359522061..98fef34b1 100644 --- a/ospfd/ospf_dump_api.h +++ b/ospfd/ospf_dump_api.h @@ -37,7 +37,7 @@ extern const int ospf_link_state_id_type_msg_max; extern const int ospf_network_type_msg_max; extern const size_t ospf_auth_type_str_max; -extern char *ospf_options_dump(u_char); +extern char *ospf_options_dump(uint8_t); extern void ospf_lsa_header_dump(struct lsa_header *); #endif /* _ZEBRA_OSPF_DUMP_API_H */ diff --git a/ospfd/ospf_ext.c b/ospfd/ospf_ext.c index 10dd2f92c..ac5df3eb4 100644 --- a/ospfd/ospf_ext.c +++ b/ospfd/ospf_ext.c @@ -922,7 +922,7 @@ static struct ospf_lsa *ospf_ext_pref_lsa_new(struct ospf_area *area, struct lsa_header *lsah; struct ospf_lsa *new = NULL; struct ospf *top; - u_char options, lsa_type; + uint8_t options, lsa_type; struct in_addr lsa_id; struct in_addr router_id; uint32_t tmp; @@ -1014,7 +1014,7 @@ static struct ospf_lsa *ospf_ext_link_lsa_new(struct ospf_area *area, struct stream *s; struct lsa_header *lsah; struct ospf_lsa *new = NULL; - u_char options, lsa_type; + uint8_t options, lsa_type; struct in_addr lsa_id; uint32_t tmp; uint16_t length; diff --git a/ospfd/ospf_ia.c b/ospfd/ospf_ia.c index 9b74cb8c0..86d15480a 100644 --- a/ospfd/ospf_ia.c +++ b/ospfd/ospf_ia.c @@ -196,7 +196,7 @@ static int process_summary_lsa(struct ospf_area *area, struct route_table *rt, struct ospf_route *abr_or, *new_or; struct summary_lsa *sl; struct prefix_ipv4 p, abr; - u_int32_t metric; + uint32_t metric; if (lsa == NULL) return 0; @@ -302,7 +302,7 @@ static void ospf_update_network_route(struct ospf *ospf, struct route_table *rt, struct route_node *rn; struct ospf_route * or, *abr_or, *new_or; struct prefix_ipv4 abr; - u_int32_t cost; + uint32_t cost; abr.family = AF_INET; abr.prefix = lsa->header.adv_router; @@ -427,7 +427,7 @@ static void ospf_update_router_route(struct ospf *ospf, { struct ospf_route * or, *abr_or, *new_or; struct prefix_ipv4 abr; - u_int32_t cost; + uint32_t cost; abr.family = AF_INET; abr.prefix = lsa->header.adv_router; @@ -523,7 +523,7 @@ static int process_transit_summary_lsa(struct ospf_area *area, struct ospf *ospf = area->ospf; struct summary_lsa *sl; struct prefix_ipv4 p; - u_int32_t metric; + uint32_t metric; if (lsa == NULL) return 0; diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c index 0305305b8..52b954d6a 100644 --- a/ospfd/ospf_interface.c +++ b/ospfd/ospf_interface.c @@ -76,8 +76,8 @@ int ospf_interface_neighbor_count(struct ospf_interface *oi) int ospf_if_get_output_cost(struct ospf_interface *oi) { /* If all else fails, use default OSPF cost */ - u_int32_t cost; - u_int32_t bw, refbw; + uint32_t cost; + uint32_t bw, refbw; /* ifp speed and bw can be 0 in some platforms, use ospf default bw if bw is configured under interface it would be used. @@ -96,7 +96,7 @@ int ospf_if_get_output_cost(struct ospf_interface *oi) /* See if a cost can be calculated from the zebra processes interface bandwidth field. */ else { - cost = (u_int32_t)((double)refbw / (double)bw + (double)0.5); + cost = (uint32_t)((double)refbw / (double)bw + (double)0.5); if (cost < 1) cost = 1; else if (cost > 65535) @@ -108,7 +108,7 @@ int ospf_if_get_output_cost(struct ospf_interface *oi) void ospf_if_recalculate_output_cost(struct interface *ifp) { - u_int32_t newcost; + uint32_t newcost; struct route_node *rn; for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) { @@ -825,7 +825,7 @@ void ospf_vl_data_free(struct ospf_vl_data *vl_data) XFREE(MTYPE_OSPF_VL_DATA, vl_data); } -u_int vlink_count = 0; +unsigned int vlink_count = 0; struct ospf_interface *ospf_vl_new(struct ospf *ospf, struct ospf_vl_data *vl_data) @@ -1174,7 +1174,7 @@ void ospf_crypt_key_add(struct list *crypt, struct crypt_key *ck) listnode_add(crypt, ck); } -struct crypt_key *ospf_crypt_key_lookup(struct list *auth_crypt, u_char key_id) +struct crypt_key *ospf_crypt_key_lookup(struct list *auth_crypt, uint8_t key_id) { struct listnode *node; struct crypt_key *ck; @@ -1186,7 +1186,7 @@ struct crypt_key *ospf_crypt_key_lookup(struct list *auth_crypt, u_char key_id) return NULL; } -int ospf_crypt_key_delete(struct list *auth_crypt, u_char key_id) +int ospf_crypt_key_delete(struct list *auth_crypt, uint8_t key_id) { struct listnode *node, *nnode; struct crypt_key *ck; @@ -1202,7 +1202,7 @@ int ospf_crypt_key_delete(struct list *auth_crypt, u_char key_id) return 0; } -u_char ospf_default_iftype(struct interface *ifp) +uint8_t ospf_default_iftype(struct interface *ifp) { if (if_is_pointopoint(ifp)) return OSPF_IFTYPE_POINTOPOINT; diff --git a/ospfd/ospf_interface.h b/ospfd/ospf_interface.h index 85a24f002..73ded208c 100644 --- a/ospfd/ospf_interface.h +++ b/ospfd/ospf_interface.h @@ -47,28 +47,30 @@ ? (O)->params->P \ : IF_DEF_PARAMS((O)->ifp)->P) -#define DECLARE_IF_PARAM(T, P) T P; u_char P##__config:1 +#define DECLARE_IF_PARAM(T, P) \ + T P; \ + uint8_t P##__config : 1 #define UNSET_IF_PARAM(S, P) ((S)->P##__config) = 0 #define SET_IF_PARAM(S, P) ((S)->P##__config) = 1 struct ospf_if_params { - DECLARE_IF_PARAM(u_int32_t, + DECLARE_IF_PARAM(uint32_t, transmit_delay); /* Interface Transmisson Delay */ - DECLARE_IF_PARAM(u_int32_t, + DECLARE_IF_PARAM(uint32_t, output_cost_cmd); /* Command Interface Output Cost */ - DECLARE_IF_PARAM(u_int32_t, + DECLARE_IF_PARAM(uint32_t, retransmit_interval); /* Retransmission Interval */ - DECLARE_IF_PARAM(u_char, passive_interface); /* OSPF Interface is + DECLARE_IF_PARAM(uint8_t, passive_interface); /* OSPF Interface is passive: no sending or receiving (no need to join multicast groups) */ - DECLARE_IF_PARAM(u_char, priority); /* OSPF Interface priority */ + DECLARE_IF_PARAM(uint8_t, priority); /* OSPF Interface priority */ /* Enable OSPF on this interface with area if_area */ DECLARE_IF_PARAM(struct in_addr, if_area); - u_int32_t if_area_id_fmt; + uint32_t if_area_id_fmt; - DECLARE_IF_PARAM(u_char, type); /* type of interface */ + DECLARE_IF_PARAM(uint8_t, type); /* type of interface */ #define OSPF_IF_ACTIVE 0 #define OSPF_IF_PASSIVE 1 @@ -80,25 +82,25 @@ struct ospf_if_params { ? IF_DEF_PARAMS((O)->ifp)->passive_interface \ : (O)->ospf->passive_interface_default)) - DECLARE_IF_PARAM(u_int32_t, v_hello); /* Hello Interval */ - DECLARE_IF_PARAM(u_int32_t, v_wait); /* Router Dead Interval */ + DECLARE_IF_PARAM(uint32_t, v_hello); /* Hello Interval */ + DECLARE_IF_PARAM(uint32_t, v_wait); /* Router Dead Interval */ /* MTU mismatch check (see RFC2328, chap 10.6) */ - DECLARE_IF_PARAM(u_char, mtu_ignore); + DECLARE_IF_PARAM(uint8_t, mtu_ignore); /* Fast-Hellos */ - DECLARE_IF_PARAM(u_char, fast_hello); + DECLARE_IF_PARAM(uint8_t, fast_hello); /* Authentication data. */ - u_char auth_simple[OSPF_AUTH_SIMPLE_SIZE + 1]; /* Simple password. */ - u_char auth_simple__config : 1; + uint8_t auth_simple[OSPF_AUTH_SIMPLE_SIZE + 1]; /* Simple password. */ + uint8_t auth_simple__config : 1; DECLARE_IF_PARAM(struct list *, auth_crypt); /* List of Auth cryptographic data. */ DECLARE_IF_PARAM(int, auth_type); /* OSPF authentication type */ /* Other, non-configuration state */ - u_int32_t network_lsa_seqnum; /* Network LSA seqnum */ + uint32_t network_lsa_seqnum; /* Network LSA seqnum */ /* BFD configuration */ struct bfd_info *bfd_info; @@ -126,7 +128,7 @@ struct ospf_vl_data { struct ospf_interface *vl_oi; /* Interface data structure */ struct vertex_nexthop nexthop; /* Nexthop router and oi to use */ struct in_addr peer_addr; /* Address used to reach the peer */ - u_char flags; + uint8_t flags; }; @@ -136,8 +138,8 @@ struct ospf_vl_data { #define OSPF_VL_FLAG_APPROVED 0x01 struct crypt_key { - u_char key_id; - u_char auth_key[OSPF_AUTH_MD5_SIZE + 1]; + uint8_t key_id; + uint8_t auth_key[OSPF_AUTH_MD5_SIZE + 1]; }; /* OSPF interface structure. */ @@ -160,13 +162,13 @@ struct ospf_interface { struct ospf_fifo *obuf; /* Output queue */ /* OSPF Network Type. */ - u_char type; + uint8_t type; /* State of Interface State Machine. */ - u_char state; + uint8_t state; /* To which multicast groups do we currently belong? */ - u_char multicast_memberships; + uint8_t multicast_memberships; #define OI_MEMBER_FLAG(M) (1 << (M)) #define OI_MEMBER_COUNT(O,M) (IF_OSPF_IF_INFO(oi->ifp)->membership_counts[(M)]) #define OI_MEMBER_CHECK(O, M) \ @@ -188,8 +190,8 @@ struct ospf_interface { /* Configured varables. */ struct ospf_if_params *params; - u_int32_t crypt_seqnum; /* Cryptographic Sequence Number */ - u_int32_t output_cost; /* Acutual Interface Output Cost */ + uint32_t crypt_seqnum; /* Cryptographic Sequence Number */ + uint32_t output_cost; /* Acutual Interface Output Cost */ /* Neighbor information. */ struct route_table *nbrs; /* OSPF Neighbor List */ @@ -216,7 +218,7 @@ struct ospf_interface { } ls_ack_direct; /* Timer values. */ - u_int32_t v_ls_ack; /* Delayed Link State Acknowledgment */ + uint32_t v_ls_ack; /* Delayed Link State Acknowledgment */ /* Threads. */ struct thread *t_hello; /* timer */ @@ -229,20 +231,20 @@ struct ospf_interface { int on_write_q; /* Statistics fields. */ - u_int32_t hello_in; /* Hello message input count. */ - u_int32_t hello_out; /* Hello message output count. */ - u_int32_t db_desc_in; /* database desc. message input count. */ - u_int32_t db_desc_out; /* database desc. message output count. */ - u_int32_t ls_req_in; /* LS request message input count. */ - u_int32_t ls_req_out; /* LS request message output count. */ - u_int32_t ls_upd_in; /* LS update message input count. */ - u_int32_t ls_upd_out; /* LS update message output count. */ - u_int32_t ls_ack_in; /* LS Ack message input count. */ - u_int32_t ls_ack_out; /* LS Ack message output count. */ - u_int32_t discarded; /* discarded input count by error. */ - u_int32_t state_change; /* Number of status change. */ - - u_int32_t full_nbrs; + uint32_t hello_in; /* Hello message input count. */ + uint32_t hello_out; /* Hello message output count. */ + uint32_t db_desc_in; /* database desc. message input count. */ + uint32_t db_desc_out; /* database desc. message output count. */ + uint32_t ls_req_in; /* LS request message input count. */ + uint32_t ls_req_out; /* LS request message output count. */ + uint32_t ls_upd_in; /* LS update message input count. */ + uint32_t ls_upd_out; /* LS update message output count. */ + uint32_t ls_ack_in; /* LS Ack message input count. */ + uint32_t ls_ack_out; /* LS Ack message output count. */ + uint32_t discarded; /* discarded input count by error. */ + uint32_t state_change; /* Number of status change. */ + + uint32_t full_nbrs; QOBJ_FIELDS }; @@ -308,11 +310,11 @@ extern void ospf_vl_shut_unapproved(struct ospf *); extern int ospf_full_virtual_nbrs(struct ospf_area *); extern int ospf_vls_in_area(struct ospf_area *); -extern struct crypt_key *ospf_crypt_key_lookup(struct list *, u_char); +extern struct crypt_key *ospf_crypt_key_lookup(struct list *, uint8_t); extern struct crypt_key *ospf_crypt_key_new(void); extern void ospf_crypt_key_add(struct list *, struct crypt_key *); -extern int ospf_crypt_key_delete(struct list *, u_char); -extern u_char ospf_default_iftype(struct interface *ifp); +extern int ospf_crypt_key_delete(struct list *, uint8_t); +extern uint8_t ospf_default_iftype(struct interface *ifp); extern int ospf_interface_neighbor_count(struct ospf_interface *oi); /* Set all multicast memberships appropriately based on the type and diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index 588a8f672..fd3da45f7 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -52,9 +52,9 @@ #include "ospfd/ospf_abr.h" -u_int32_t get_metric(u_char *metric) +uint32_t get_metric(uint8_t *metric) { - u_int32_t m; + uint32_t m; m = metric[0]; m = (m << 8) + metric[1]; m = (m << 8) + metric[2]; @@ -121,28 +121,28 @@ int get_age(struct ospf_lsa *lsa) /* All the offsets are zero-based. The offsets in the RFC1008 are one-based. */ -u_int16_t ospf_lsa_checksum(struct lsa_header *lsa) +uint16_t ospf_lsa_checksum(struct lsa_header *lsa) { - u_char *buffer = (u_char *)&lsa->options; - int options_offset = buffer - (u_char *)&lsa->ls_age; /* should be 2 */ + uint8_t *buffer = (uint8_t *)&lsa->options; + int options_offset = buffer - (uint8_t *)&lsa->ls_age; /* should be 2 */ /* Skip the AGE field */ - u_int16_t len = ntohs(lsa->length) - options_offset; + uint16_t len = ntohs(lsa->length) - options_offset; /* Checksum offset starts from "options" field, not the beginning of the lsa_header struct. The offset is 14, rather than 16. */ - int checksum_offset = (u_char *)&lsa->checksum - buffer; + int checksum_offset = (uint8_t *)&lsa->checksum - buffer; return fletcher_checksum(buffer, len, checksum_offset); } int ospf_lsa_checksum_valid(struct lsa_header *lsa) { - u_char *buffer = (u_char *)&lsa->options; - int options_offset = buffer - (u_char *)&lsa->ls_age; /* should be 2 */ + uint8_t *buffer = (uint8_t *)&lsa->options; + int options_offset = buffer - (uint8_t *)&lsa->ls_age; /* should be 2 */ /* Skip the AGE field */ - u_int16_t len = ntohs(lsa->length) - options_offset; + uint16_t len = ntohs(lsa->length) - options_offset; return (fletcher_checksum(buffer, len, FLETCHER_CHECKSUM_VALIDATE) == 0); @@ -295,16 +295,16 @@ const char *dump_lsa_key(struct ospf_lsa *lsa) return buf; } -u_int32_t lsa_seqnum_increment(struct ospf_lsa *lsa) +uint32_t lsa_seqnum_increment(struct ospf_lsa *lsa) { - u_int32_t seqnum; + uint32_t seqnum; seqnum = ntohl(lsa->data->ls_seqnum) + 1; return htonl(seqnum); } -void lsa_header_set(struct stream *s, u_char options, u_char type, +void lsa_header_set(struct stream *s, uint8_t options, uint8_t type, struct in_addr id, struct in_addr router_id) { struct lsa_header *lsah; @@ -324,9 +324,9 @@ void lsa_header_set(struct stream *s, u_char options, u_char type, /* router-LSA related functions. */ /* Get router-LSA flags. */ -static u_char router_lsa_flags(struct ospf_area *area) +static uint8_t router_lsa_flags(struct ospf_area *area) { - u_char flags; + uint8_t flags; flags = area->ospf->flags; @@ -396,7 +396,7 @@ struct ospf_neighbor *ospf_nbr_lookup_ptop(struct ospf_interface *oi) /* Determine cost of link, taking RFC3137 stub-router support into * consideration */ -static u_int16_t ospf_link_cost(struct ospf_interface *oi) +static uint16_t ospf_link_cost(struct ospf_interface *oi) { /* RFC3137 stub router support */ if (!CHECK_FLAG(oi->area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED)) @@ -407,8 +407,8 @@ static u_int16_t ospf_link_cost(struct ospf_interface *oi) /* Set a link information. */ static char link_info_set(struct stream *s, struct in_addr id, - struct in_addr data, u_char type, u_char tos, - u_int16_t cost) + struct in_addr data, uint8_t type, uint8_t tos, + uint16_t cost) { /* LSA stream is initially allocated to OSPF_MAX_LSA_SIZE, suits * vast majority of cases. Some rare routers with lots of links need @@ -459,7 +459,7 @@ static int lsa_link_ptop_set(struct stream *s, struct ospf_interface *oi) int links = 0; struct ospf_neighbor *nbr; struct in_addr id, mask, data; - u_int16_t cost = ospf_link_cost(oi); + uint16_t cost = ospf_link_cost(oi); if (IS_DEBUG_OSPF(lsa, LSA_GENERATE)) zlog_debug("LSA[Type1]: Set link Point-to-Point"); @@ -504,7 +504,7 @@ static int lsa_link_broadcast_set(struct stream *s, struct ospf_interface *oi) { struct ospf_neighbor *dr; struct in_addr id, mask; - u_int16_t cost = ospf_link_cost(oi); + uint16_t cost = ospf_link_cost(oi); /* Describe Type 3 Link. */ if (oi->state == ISM_Waiting) { @@ -563,7 +563,7 @@ static int lsa_link_loopback_set(struct stream *s, struct ospf_interface *oi) static int lsa_link_virtuallink_set(struct stream *s, struct ospf_interface *oi) { struct ospf_neighbor *nbr; - u_int16_t cost = ospf_link_cost(oi); + uint16_t cost = ospf_link_cost(oi); if (oi->state == ISM_PointToPoint) if ((nbr = ospf_nbr_lookup_ptop(oi))) @@ -589,7 +589,7 @@ static int lsa_link_ptomp_set(struct stream *s, struct ospf_interface *oi) struct route_node *rn; struct ospf_neighbor *nbr = NULL; struct in_addr id, mask; - u_int16_t cost = ospf_link_cost(oi); + uint16_t cost = ospf_link_cost(oi); mask.s_addr = 0xffffffff; id.s_addr = oi->address->u.prefix4.s_addr; @@ -670,7 +670,7 @@ static int router_lsa_link_set(struct stream *s, struct ospf_area *area) static void ospf_router_lsa_body_set(struct stream *s, struct ospf_area *area) { unsigned long putp; - u_int16_t cnt; + uint16_t cnt; /* Set flags. */ stream_putc(s, router_lsa_flags(area)); @@ -1115,9 +1115,9 @@ static struct ospf_lsa *ospf_network_lsa_refresh(struct ospf_lsa *lsa) return new; } -static void stream_put_ospf_metric(struct stream *s, u_int32_t metric_value) +static void stream_put_ospf_metric(struct stream *s, uint32_t metric_value) { - u_int32_t metric; + uint32_t metric; char *mp; /* Put 0 metric. TOS metric is not supported. */ @@ -1129,7 +1129,7 @@ static void stream_put_ospf_metric(struct stream *s, u_int32_t metric_value) /* summary-LSA related functions. */ static void ospf_summary_lsa_body_set(struct stream *s, struct prefix *p, - u_int32_t metric) + uint32_t metric) { struct in_addr mask; @@ -1139,14 +1139,14 @@ static void ospf_summary_lsa_body_set(struct stream *s, struct prefix *p, stream_put_ipv4(s, mask.s_addr); /* Set # TOS. */ - stream_putc(s, (u_char)0); + stream_putc(s, (uint8_t)0); /* Set metric. */ stream_put_ospf_metric(s, metric); } static struct ospf_lsa *ospf_summary_lsa_new(struct ospf_area *area, - struct prefix *p, u_int32_t metric, + struct prefix *p, uint32_t metric, struct in_addr id) { struct stream *s; @@ -1196,7 +1196,7 @@ static struct ospf_lsa *ospf_summary_lsa_new(struct ospf_area *area, /* Originate Summary-LSA. */ struct ospf_lsa *ospf_summary_lsa_originate(struct prefix_ipv4 *p, - u_int32_t metric, + uint32_t metric, struct ospf_area *area) { struct ospf_lsa *new; @@ -1274,13 +1274,13 @@ static struct ospf_lsa *ospf_summary_lsa_refresh(struct ospf *ospf, /* summary-ASBR-LSA related functions. */ static void ospf_summary_asbr_lsa_body_set(struct stream *s, struct prefix *p, - u_int32_t metric) + uint32_t metric) { /* Put Network Mask. */ - stream_put_ipv4(s, (u_int32_t)0); + stream_put_ipv4(s, (uint32_t)0); /* Set # TOS. */ - stream_putc(s, (u_char)0); + stream_putc(s, (uint8_t)0); /* Set metric. */ stream_put_ospf_metric(s, metric); @@ -1288,7 +1288,7 @@ static void ospf_summary_asbr_lsa_body_set(struct stream *s, struct prefix *p, static struct ospf_lsa *ospf_summary_asbr_lsa_new(struct ospf_area *area, struct prefix *p, - u_int32_t metric, + uint32_t metric, struct in_addr id) { struct stream *s; @@ -1338,7 +1338,7 @@ static struct ospf_lsa *ospf_summary_asbr_lsa_new(struct ospf_area *area, /* Originate summary-ASBR-LSA. */ struct ospf_lsa *ospf_summary_asbr_lsa_originate(struct prefix_ipv4 *p, - u_int32_t metric, + uint32_t metric, struct ospf_area *area) { struct ospf_lsa *new; @@ -1501,7 +1501,7 @@ struct in_addr ospf_get_nssa_ip(struct ospf_area *area) #define DEFAULT_METRIC_TYPE EXTERNAL_METRIC_TYPE_2 -int metric_type(struct ospf *ospf, u_char src, u_short instance) +int metric_type(struct ospf *ospf, uint8_t src, unsigned short instance) { struct ospf_redist *red; @@ -1511,7 +1511,7 @@ int metric_type(struct ospf *ospf, u_char src, u_short instance) : red->dmetric.type); } -int metric_value(struct ospf *ospf, u_char src, u_short instance) +int metric_value(struct ospf *ospf, uint8_t src, unsigned short instance) { struct ospf_redist *red; @@ -1538,10 +1538,10 @@ static void ospf_external_lsa_body_set(struct stream *s, { struct prefix_ipv4 *p = &ei->p; struct in_addr mask, fwd_addr; - u_int32_t mvalue; + uint32_t mvalue; int mtype; int type; - u_short instance; + unsigned short instance; /* Put Network Mask. */ masklen2ip(p->prefixlen, &mask); @@ -2153,7 +2153,7 @@ void ospf_nssa_lsa_flush(struct ospf *ospf, struct prefix_ipv4 *p) } /* Flush an AS-external-LSA from LSDB and routing domain. */ -void ospf_external_lsa_flush(struct ospf *ospf, u_char type, +void ospf_external_lsa_flush(struct ospf *ospf, uint8_t type, struct prefix_ipv4 *p, ifindex_t ifindex /*, struct in_addr nexthop */) { @@ -2238,8 +2238,8 @@ void ospf_external_lsa_refresh_default(struct ospf *ospf) } } -void ospf_external_lsa_refresh_type(struct ospf *ospf, u_char type, - u_short instance, int force) +void ospf_external_lsa_refresh_type(struct ospf *ospf, uint8_t type, + unsigned short instance, int force) { struct route_node *rn; struct external_info *ei; @@ -2818,7 +2818,7 @@ static int ospf_maxage_lsa_remover(struct thread *thread) "LSA[Type%d:%s]: LSA 0x%lx is self-originated: ", lsa->data->type, inet_ntoa(lsa->data->id), - (u_long)lsa); + (unsigned long)lsa); if (IS_DEBUG_OSPF(lsa, LSA_FLOODING)) zlog_debug( @@ -3033,7 +3033,7 @@ int ospf_lsa_maxage_walker(struct thread *thread) return 0; } -struct ospf_lsa *ospf_lsa_lookup_by_prefix(struct ospf_lsdb *lsdb, u_char type, +struct ospf_lsa *ospf_lsa_lookup_by_prefix(struct ospf_lsdb *lsdb, uint8_t type, struct prefix_ipv4 *p, struct in_addr router_id) { @@ -3063,7 +3063,7 @@ struct ospf_lsa *ospf_lsa_lookup_by_prefix(struct ospf_lsdb *lsdb, u_char type, } struct ospf_lsa *ospf_lsa_lookup(struct ospf *ospf, struct ospf_area *area, - u_int32_t type, struct in_addr id, + uint32_t type, struct in_addr id, struct in_addr adv_router) { if (!ospf) @@ -3088,7 +3088,7 @@ struct ospf_lsa *ospf_lsa_lookup(struct ospf *ospf, struct ospf_area *area, return NULL; } -struct ospf_lsa *ospf_lsa_lookup_by_id(struct ospf_area *area, u_int32_t type, +struct ospf_lsa *ospf_lsa_lookup_by_id(struct ospf_area *area, uint32_t type, struct in_addr id) { struct ospf_lsa *lsa; @@ -3236,7 +3236,7 @@ int ospf_lsa_different(struct ospf_lsa *l1, struct ospf_lsa *l2) void ospf_lsa_flush_self_originated(struct ospf_neighbor *nbr, struct ospf_lsa *self, struct ospf_lsa *new) { - u_int32_t seqnum; + uint32_t seqnum; /* Adjust LS Sequence Number. */ seqnum = ntohl(new->data->ls_seqnum) + 1; @@ -3421,7 +3421,7 @@ int ospf_lsa_is_self_originated(struct ospf *ospf, struct ospf_lsa *lsa) /* Get unique Link State ID. */ struct in_addr ospf_lsa_unique_id(struct ospf *ospf, struct ospf_lsdb *lsdb, - u_char type, struct prefix_ipv4 *p) + uint8_t type, struct prefix_ipv4 *p) { struct ospf_lsa *lsa; struct in_addr mask, id; @@ -3473,7 +3473,7 @@ struct in_addr ospf_lsa_unique_id(struct ospf *ospf, struct ospf_lsdb *lsdb, #define LSA_ACTION_FLUSH_AREA 2 struct lsa_action { - u_char action; + uint8_t action; struct ospf_area *area; struct ospf_lsa *lsa; }; @@ -3576,7 +3576,7 @@ struct ospf_lsa *ospf_lsa_refresh(struct ospf *ospf, struct ospf_lsa *lsa) void ospf_refresher_register_lsa(struct ospf *ospf, struct ospf_lsa *lsa) { - u_int16_t index, current_index; + uint16_t index, current_index; assert(lsa->lock > 0); assert(IS_LSA_SELF(lsa)); diff --git a/ospfd/ospf_lsa.h b/ospfd/ospf_lsa.h index 94a34d4a9..f8f7b28d4 100644 --- a/ospfd/ospf_lsa.h +++ b/ospfd/ospf_lsa.h @@ -53,20 +53,20 @@ /* OSPF LSA header. */ struct lsa_header { - u_int16_t ls_age; - u_char options; - u_char type; + uint16_t ls_age; + uint8_t options; + uint8_t type; struct in_addr id; struct in_addr adv_router; - u_int32_t ls_seqnum; - u_int16_t checksum; - u_int16_t length; + uint32_t ls_seqnum; + uint16_t checksum; + uint16_t length; }; /* OSPF LSA. */ struct ospf_lsa { /* LSA origination flag. */ - u_char flags; + uint8_t flags; #define OSPF_LSA_SELF 0x01 #define OSPF_LSA_SELF_CHECKED 0x02 #define OSPF_LSA_RECEIVED 0x04 @@ -140,9 +140,9 @@ struct router_lsa_link { struct in_addr link_id; struct in_addr link_data; struct { - u_char type; - u_char tos_count; - u_int16_t metric; + uint8_t type; + uint8_t tos_count; + uint16_t metric; } m[1]; }; @@ -157,15 +157,15 @@ struct router_lsa_link { be replaced with the next revision having 1 descriptor block. */ struct router_lsa { struct lsa_header header; - u_char flags; - u_char zero; - u_int16_t links; + uint8_t flags; + uint8_t zero; + uint16_t links; struct { struct in_addr link_id; struct in_addr link_data; - u_char type; - u_char tos; - u_int16_t metric; + uint8_t type; + uint8_t tos; + uint16_t metric; } link[1]; }; @@ -182,8 +182,8 @@ struct network_lsa { struct summary_lsa { struct lsa_header header; struct in_addr mask; - u_char tos; - u_char metric[3]; + uint8_t tos; + uint8_t metric[3]; }; /* OSPF AS-external-LSAs structure. */ @@ -192,10 +192,10 @@ struct as_external_lsa { struct lsa_header header; struct in_addr mask; struct { - u_char tos; - u_char metric[3]; + uint8_t tos; + uint8_t metric[3]; struct in_addr fwd_addr; - u_int32_t route_tag; + uint32_t route_tag; } e[1]; }; @@ -222,13 +222,13 @@ extern struct timeval int2tv(int); extern struct timeval msec2tv(int); extern int get_age(struct ospf_lsa *); -extern u_int16_t ospf_lsa_checksum(struct lsa_header *); +extern uint16_t ospf_lsa_checksum(struct lsa_header *); extern int ospf_lsa_checksum_valid(struct lsa_header *); extern int ospf_lsa_refresh_delay(struct ospf_lsa *); extern const char *dump_lsa_key(struct ospf_lsa *); -extern u_int32_t lsa_seqnum_increment(struct ospf_lsa *); -extern void lsa_header_set(struct stream *, u_char, u_char, struct in_addr, +extern uint32_t lsa_seqnum_increment(struct ospf_lsa *); +extern void lsa_header_set(struct stream *, uint8_t, uint8_t, struct in_addr, struct in_addr); extern struct ospf_neighbor *ospf_nbr_lookup_ptop(struct ospf_interface *); extern int ospf_check_nbr_status(struct ospf *); @@ -252,16 +252,17 @@ extern int ospf_router_lsa_update_area(struct ospf_area *); extern void ospf_network_lsa_update(struct ospf_interface *); extern struct ospf_lsa * -ospf_summary_lsa_originate(struct prefix_ipv4 *, u_int32_t, struct ospf_area *); +ospf_summary_lsa_originate(struct prefix_ipv4 *, uint32_t, struct ospf_area *); extern struct ospf_lsa *ospf_summary_asbr_lsa_originate(struct prefix_ipv4 *, - u_int32_t, + uint32_t, struct ospf_area *); extern struct ospf_lsa *ospf_lsa_install(struct ospf *, struct ospf_interface *, struct ospf_lsa *); extern void ospf_nssa_lsa_flush(struct ospf *ospf, struct prefix_ipv4 *p); -extern void ospf_external_lsa_flush(struct ospf *, u_char, struct prefix_ipv4 *, +extern void ospf_external_lsa_flush(struct ospf *, uint8_t, + struct prefix_ipv4 *, ifindex_t /* , struct in_addr nexthop */); extern struct in_addr ospf_get_ip_from_ifp(struct ospf_interface *); @@ -271,9 +272,9 @@ extern struct ospf_lsa *ospf_external_lsa_originate(struct ospf *, extern int ospf_external_lsa_originate_timer(struct thread *); extern int ospf_default_originate_timer(struct thread *); extern struct ospf_lsa *ospf_lsa_lookup(struct ospf *ospf, struct ospf_area *, - u_int32_t, struct in_addr, + uint32_t, struct in_addr, struct in_addr); -extern struct ospf_lsa *ospf_lsa_lookup_by_id(struct ospf_area *, u_int32_t, +extern struct ospf_lsa *ospf_lsa_lookup_by_id(struct ospf_area *, uint32_t, struct in_addr); extern struct ospf_lsa *ospf_lsa_lookup_by_header(struct ospf_area *, struct lsa_header *); @@ -283,24 +284,25 @@ extern void ospf_flush_self_originated_lsas_now(struct ospf *); extern int ospf_lsa_is_self_originated(struct ospf *, struct ospf_lsa *); -extern struct ospf_lsa *ospf_lsa_lookup_by_prefix(struct ospf_lsdb *, u_char, +extern struct ospf_lsa *ospf_lsa_lookup_by_prefix(struct ospf_lsdb *, uint8_t, struct prefix_ipv4 *, struct in_addr); extern void ospf_lsa_maxage(struct ospf *, struct ospf_lsa *); -extern u_int32_t get_metric(u_char *); +extern uint32_t get_metric(uint8_t *); extern int ospf_lsa_maxage_walker(struct thread *); extern struct ospf_lsa *ospf_lsa_refresh(struct ospf *, struct ospf_lsa *); extern void ospf_external_lsa_refresh_default(struct ospf *); -extern void ospf_external_lsa_refresh_type(struct ospf *, u_char, u_short, int); +extern void ospf_external_lsa_refresh_type(struct ospf *, uint8_t, + unsigned short, int); extern struct ospf_lsa *ospf_external_lsa_refresh(struct ospf *, struct ospf_lsa *, struct external_info *, int); extern struct in_addr ospf_lsa_unique_id(struct ospf *, struct ospf_lsdb *, - u_char, struct prefix_ipv4 *); + uint8_t, struct prefix_ipv4 *); extern void ospf_schedule_lsa_flood_area(struct ospf_area *, struct ospf_lsa *); extern void ospf_schedule_lsa_flush_area(struct ospf_area *, struct ospf_lsa *); @@ -314,8 +316,8 @@ extern void ospf_discard_from_db(struct ospf *, struct ospf_lsdb *, struct ospf_lsa *); extern int is_prefix_default(struct prefix_ipv4 *); -extern int metric_type(struct ospf *, u_char, u_short); -extern int metric_value(struct ospf *, u_char, u_short); +extern int metric_type(struct ospf *, uint8_t, unsigned short); +extern int metric_value(struct ospf *, uint8_t, unsigned short); extern struct in_addr ospf_get_nssa_ip(struct ospf_area *); extern int ospf_translated_nssa_compare(struct ospf_lsa *, struct ospf_lsa *); diff --git a/ospfd/ospf_lsdb.c b/ospfd/ospf_lsdb.c index a596d3286..ef965a5f9 100644 --- a/ospfd/ospf_lsdb.c +++ b/ospfd/ospf_lsdb.c @@ -213,7 +213,7 @@ struct ospf_lsa *ospf_lsdb_lookup(struct ospf_lsdb *lsdb, struct ospf_lsa *lsa) return NULL; } -struct ospf_lsa *ospf_lsdb_lookup_by_id(struct ospf_lsdb *lsdb, u_char type, +struct ospf_lsa *ospf_lsdb_lookup_by_id(struct ospf_lsdb *lsdb, uint8_t type, struct in_addr id, struct in_addr adv_router) { @@ -240,7 +240,7 @@ struct ospf_lsa *ospf_lsdb_lookup_by_id(struct ospf_lsdb *lsdb, u_char type, } struct ospf_lsa *ospf_lsdb_lookup_by_id_next(struct ospf_lsdb *lsdb, - u_char type, struct in_addr id, + uint8_t type, struct in_addr id, struct in_addr adv_router, int first) { diff --git a/ospfd/ospf_lsdb.h b/ospfd/ospf_lsdb.h index 483107112..65c7e28fe 100644 --- a/ospfd/ospf_lsdb.h +++ b/ospfd/ospf_lsdb.h @@ -70,9 +70,9 @@ extern void ospf_lsdb_delete_all(struct ospf_lsdb *); /* Set all stats to -1 (LSA_SPF_NOT_EXPLORED). */ extern void ospf_lsdb_clean_stat(struct ospf_lsdb *lsdb); extern struct ospf_lsa *ospf_lsdb_lookup(struct ospf_lsdb *, struct ospf_lsa *); -extern struct ospf_lsa *ospf_lsdb_lookup_by_id(struct ospf_lsdb *, u_char, +extern struct ospf_lsa *ospf_lsdb_lookup_by_id(struct ospf_lsdb *, uint8_t, struct in_addr, struct in_addr); -extern struct ospf_lsa *ospf_lsdb_lookup_by_id_next(struct ospf_lsdb *, u_char, +extern struct ospf_lsa *ospf_lsdb_lookup_by_id_next(struct ospf_lsdb *, uint8_t, struct in_addr, struct in_addr, int); extern unsigned long ospf_lsdb_count_all(struct ospf_lsdb *); diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c index 364f51aa7..5bf7ec146 100644 --- a/ospfd/ospf_main.c +++ b/ospfd/ospf_main.c @@ -132,7 +132,7 @@ FRR_DAEMON_INFO(ospfd, OSPF, .vty_port = OSPF_VTY_PORT, /* OSPFd main routine. */ int main(int argc, char **argv) { - u_short instance = 0; + unsigned short instance = 0; #ifdef SUPPORT_OSPF_API /* OSPF apiserver is disabled by default. */ diff --git a/ospfd/ospf_neighbor.h b/ospfd/ospf_neighbor.h index b19cf5b3e..91dfc7a27 100644 --- a/ospfd/ospf_neighbor.h +++ b/ospfd/ospf_neighbor.h @@ -30,16 +30,16 @@ struct ospf_neighbor { struct ospf_interface *oi; /* OSPF neighbor Information */ - u_char state; /* NSM status. */ - u_char dd_flags; /* DD bit flags. */ - u_int32_t dd_seqnum; /* DD Sequence Number. */ + uint8_t state; /* NSM status. */ + uint8_t dd_flags; /* DD bit flags. */ + uint32_t dd_seqnum; /* DD Sequence Number. */ /* Neighbor Information from Hello. */ struct prefix address; /* Neighbor Interface Address. */ struct in_addr src; /* Src address. */ struct in_addr router_id; /* Router ID. */ - u_char options; /* Options. */ + uint8_t options; /* Options. */ int priority; /* Router Priority. */ struct in_addr d_router; /* Designated Router. */ struct in_addr bd_router; /* Backup Designated Router. */ @@ -51,9 +51,9 @@ struct ospf_neighbor { /* Last received Databse Description packet. */ struct { - u_char options; - u_char flags; - u_int32_t dd_seqnum; + uint8_t options; + uint8_t flags; + uint32_t dd_seqnum; } last_recv; /* LSA data. */ @@ -62,13 +62,13 @@ struct ospf_neighbor { struct ospf_lsdb ls_req; struct ospf_lsa *ls_req_last; - u_int32_t crypt_seqnum; /* Cryptographic Sequence Number. */ + uint32_t crypt_seqnum; /* Cryptographic Sequence Number. */ /* Timer values. */ - u_int32_t v_inactivity; - u_int32_t v_db_desc; - u_int32_t v_ls_req; - u_int32_t v_ls_upd; + uint32_t v_inactivity; + uint32_t v_db_desc; + uint32_t v_ls_req; + uint32_t v_ls_upd; /* Threads. */ struct thread *t_inactivity; @@ -84,7 +84,7 @@ struct ospf_neighbor { struct timeval ts_last_progress; /* last advance of NSM */ struct timeval ts_last_regress; /* last regressive NSM change */ const char *last_regress_str; /* Event which last regressed NSM */ - u_int32_t state_change; /* NSM state change counter */ + uint32_t state_change; /* NSM state change counter */ /* BFD information */ void *bfd_info; diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c index 5e11245bc..d7cca0f13 100644 --- a/ospfd/ospf_network.c +++ b/ospfd/ospf_network.c @@ -138,7 +138,7 @@ int ospf_if_drop_alldrouters(struct ospf *top, struct prefix *p, int ospf_if_ipmulticast(struct ospf *top, struct prefix *p, ifindex_t ifindex) { - u_char val; + uint8_t val; int ret, len; /* Prevent receiving self-origined multicast packets. */ diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c index b83c9dec2..1e72e3db6 100644 --- a/ospfd/ospf_nsm.c +++ b/ospfd/ospf_nsm.c @@ -614,7 +614,7 @@ static void nsm_change_state(struct ospf_neighbor *nbr, int state) { struct ospf_interface *oi = nbr->oi; struct ospf_area *vl_area = NULL; - u_char old_state; + uint8_t old_state; int x; int force = 1; diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c index 6e9cf36a3..1ae9a29a1 100644 --- a/ospfd/ospf_opaque.c +++ b/ospfd/ospf_opaque.c @@ -208,7 +208,7 @@ void ospf_opaque_type11_lsa_term(struct ospf *top) return; } -static const char *ospf_opaque_type_name(u_char opaque_type) +static const char *ospf_opaque_type_name(uint8_t opaque_type) { const char *name = "Unknown"; @@ -241,7 +241,7 @@ static const char *ospf_opaque_type_name(u_char opaque_type) if (OPAQUE_TYPE_RANGE_UNASSIGNED(opaque_type)) name = "Unassigned"; else { - u_int32_t bigger_range = opaque_type; + uint32_t bigger_range = opaque_type; /* * Get around type-limits warning: comparison is always * true due to limited range of data type @@ -261,7 +261,7 @@ static const char *ospf_opaque_type_name(u_char opaque_type) struct opaque_info_per_type; /* Forward declaration. */ struct ospf_opaque_functab { - u_char opaque_type; + uint8_t opaque_type; struct opaque_info_per_type *oipt; int (*new_if_hook)(struct interface *ifp); @@ -326,7 +326,7 @@ static void ospf_opaque_funclist_term(void) return; } -static struct list *ospf_get_opaque_funclist(u_char lsa_type) +static struct list *ospf_get_opaque_funclist(uint8_t lsa_type) { struct list *funclist = NULL; @@ -361,7 +361,7 @@ static struct list *ospf_get_opaque_funclist(u_char lsa_type) /* XXX: such a huge argument list can /not/ be healthy... */ int ospf_register_opaque_functab( - u_char lsa_type, u_char opaque_type, + uint8_t lsa_type, uint8_t opaque_type, int (*new_if_hook)(struct interface *ifp), int (*del_if_hook)(struct interface *ifp), void (*ism_change_hook)(struct ospf_interface *oi, int old_status), @@ -429,7 +429,7 @@ out: return rc; } -void ospf_delete_opaque_functab(u_char lsa_type, u_char opaque_type) +void ospf_delete_opaque_functab(uint8_t lsa_type, uint8_t opaque_type) { struct list *funclist; struct listnode *node, *nnode; @@ -467,7 +467,7 @@ ospf_opaque_functab_lookup(struct ospf_lsa *lsa) struct list *funclist; struct listnode *node; struct ospf_opaque_functab *functab; - u_char key = GET_OPAQUE_TYPE(ntohl(lsa->data->id.s_addr)); + uint8_t key = GET_OPAQUE_TYPE(ntohl(lsa->data->id.s_addr)); if ((funclist = ospf_get_opaque_funclist(lsa->data->type)) != NULL) for (ALL_LIST_ELEMENTS_RO(funclist, node, functab)) @@ -487,8 +487,8 @@ ospf_opaque_functab_lookup(struct ospf_lsa *lsa) * identified by their opaque-id. */ struct opaque_info_per_type { - u_char lsa_type; - u_char opaque_type; + uint8_t lsa_type; + uint8_t opaque_type; enum { PROC_NORMAL, PROC_SUSPEND } status; @@ -521,7 +521,7 @@ struct opaque_info_per_type { /* Opaque-LSA control information per opaque-id. */ struct opaque_info_per_id { - u_int32_t opaque_id; + uint32_t opaque_id; /* Thread for refresh/flush scheduling for this opaque-type/id. */ struct thread *t_opaque_lsa_self; @@ -665,7 +665,7 @@ lookup_opaque_info_by_type(struct ospf_lsa *lsa) struct list *listtop = NULL; struct listnode *node, *nnode; struct opaque_info_per_type *oipt = NULL; - u_char key = GET_OPAQUE_TYPE(ntohl(lsa->data->id.s_addr)); + uint8_t key = GET_OPAQUE_TYPE(ntohl(lsa->data->id.s_addr)); switch (lsa->data->type) { case OSPF_OPAQUE_LINK_LSA: @@ -746,7 +746,7 @@ lookup_opaque_info_by_id(struct opaque_info_per_type *oipt, { struct listnode *node, *nnode; struct opaque_info_per_id *oipi; - u_int32_t key = GET_OPAQUE_ID(ntohl(lsa->data->id.s_addr)); + uint32_t key = GET_OPAQUE_ID(ntohl(lsa->data->id.s_addr)); for (ALL_LIST_ELEMENTS(oipt->id_list, node, nnode, oipi)) if (oipi->opaque_id == key) @@ -1181,9 +1181,9 @@ void ospf_opaque_config_write_debug(struct vty *vty) void show_opaque_info_detail(struct vty *vty, struct ospf_lsa *lsa) { struct lsa_header *lsah = (struct lsa_header *)lsa->data; - u_int32_t lsid = ntohl(lsah->id.s_addr); - u_char opaque_type = GET_OPAQUE_TYPE(lsid); - u_int32_t opaque_id = GET_OPAQUE_ID(lsid); + uint32_t lsid = ntohl(lsah->id.s_addr); + uint8_t opaque_type = GET_OPAQUE_TYPE(lsid); + uint32_t opaque_id = GET_OPAQUE_ID(lsid); struct ospf_opaque_functab *functab; /* Switch output functionality by vty address. */ @@ -1214,7 +1214,7 @@ void show_opaque_info_detail(struct vty *vty, struct ospf_lsa *lsa) return; } -void ospf_opaque_lsa_dump(struct stream *s, u_int16_t length) +void ospf_opaque_lsa_dump(struct stream *s, uint16_t length) { struct ospf_lsa lsa; @@ -1660,15 +1660,15 @@ struct ospf_lsa *ospf_opaque_lsa_refresh(struct ospf_lsa *lsa) #define OSPF_OPAQUE_TIMER_ON(T,F,L,V) thread_add_timer_msec (master, (F), (L), (V), &(T)) static struct ospf_lsa *pseudo_lsa(struct ospf_interface *oi, - struct ospf_area *area, u_char lsa_type, - u_char opaque_type); + struct ospf_area *area, uint8_t lsa_type, + uint8_t opaque_type); static int ospf_opaque_type9_lsa_reoriginate_timer(struct thread *t); static int ospf_opaque_type10_lsa_reoriginate_timer(struct thread *t); static int ospf_opaque_type11_lsa_reoriginate_timer(struct thread *t); static int ospf_opaque_lsa_refresh_timer(struct thread *t); void ospf_opaque_lsa_reoriginate_schedule(void *lsa_type_dependent, - u_char lsa_type, u_char opaque_type) + uint8_t lsa_type, uint8_t opaque_type) { struct ospf *top = NULL; struct ospf_area dummy, *area = NULL; @@ -1827,12 +1827,12 @@ out: } static struct ospf_lsa *pseudo_lsa(struct ospf_interface *oi, - struct ospf_area *area, u_char lsa_type, - u_char opaque_type) + struct ospf_area *area, uint8_t lsa_type, + uint8_t opaque_type) { static struct ospf_lsa lsa = {0}; static struct lsa_header lsah = {0}; - u_int32_t tmp; + uint32_t tmp; lsa.oi = oi; lsa.area = area; diff --git a/ospfd/ospf_opaque.h b/ospfd/ospf_opaque.h index 4fc5699a2..96155608b 100644 --- a/ospfd/ospf_opaque.h +++ b/ospfd/ospf_opaque.h @@ -41,9 +41,9 @@ #define LSID_OPAQUE_TYPE_MASK 0xff000000 /* 8 bits */ #define LSID_OPAQUE_ID_MASK 0x00ffffff /* 24 bits */ -#define GET_OPAQUE_TYPE(lsid) (((u_int32_t)(lsid)&LSID_OPAQUE_TYPE_MASK) >> 24) +#define GET_OPAQUE_TYPE(lsid) (((uint32_t)(lsid)&LSID_OPAQUE_TYPE_MASK) >> 24) -#define GET_OPAQUE_ID(lsid) ((u_int32_t)(lsid)&LSID_OPAQUE_ID_MASK) +#define GET_OPAQUE_ID(lsid) ((uint32_t)(lsid)&LSID_OPAQUE_ID_MASK) #define SET_OPAQUE_LSID(type, id) \ ((((unsigned)(type) << 24) & LSID_OPAQUE_TYPE_MASK) \ @@ -78,20 +78,20 @@ #define VALID_OPAQUE_INFO_LEN(lsahdr) \ ((ntohs((lsahdr)->length) >= sizeof(struct lsa_header)) \ - && ((ntohs((lsahdr)->length) % sizeof(u_int32_t)) == 0)) + && ((ntohs((lsahdr)->length) % sizeof(uint32_t)) == 0)) /* * Following section defines generic TLV (type, length, value) macros, * used for various LSA opaque usage e.g. Traffic Engineering. */ struct tlv_header { - u_int16_t type; /* Type of Value */ - u_int16_t length; /* Length of Value portion only, in bytes */ + uint16_t type; /* Type of Value */ + uint16_t length; /* Length of Value portion only, in bytes */ }; #define TLV_HDR_SIZE (sizeof(struct tlv_header)) -#define TLV_BODY_SIZE(tlvh) (ROUNDUP(ntohs((tlvh)->length), sizeof(u_int32_t))) +#define TLV_BODY_SIZE(tlvh) (ROUNDUP(ntohs((tlvh)->length), sizeof(uint32_t))) #define TLV_SIZE(tlvh) (TLV_HDR_SIZE + TLV_BODY_SIZE(tlvh)) @@ -126,7 +126,7 @@ extern int ospf_opaque_type11_lsa_init(struct ospf *ospf); extern void ospf_opaque_type11_lsa_term(struct ospf *ospf); extern int ospf_register_opaque_functab( - u_char lsa_type, u_char opaque_type, + uint8_t lsa_type, uint8_t opaque_type, int (*new_if_hook)(struct interface *ifp), int (*del_if_hook)(struct interface *ifp), void (*ism_change_hook)(struct ospf_interface *oi, int old_status), @@ -139,7 +139,7 @@ extern int ospf_register_opaque_functab( struct ospf_lsa *(*lsa_refresher)(struct ospf_lsa *lsa), int (*new_lsa_hook)(struct ospf_lsa *lsa), int (*del_lsa_hook)(struct ospf_lsa *lsa)); -extern void ospf_delete_opaque_functab(u_char lsa_type, u_char opaque_type); +extern void ospf_delete_opaque_functab(uint8_t lsa_type, uint8_t opaque_type); extern int ospf_opaque_new_if(struct interface *ifp); extern int ospf_opaque_del_if(struct interface *ifp); @@ -149,7 +149,7 @@ extern void ospf_opaque_config_write_router(struct vty *vty, struct ospf *ospf); extern void ospf_opaque_config_write_if(struct vty *vty, struct interface *ifp); extern void ospf_opaque_config_write_debug(struct vty *vty); extern void show_opaque_info_detail(struct vty *vty, struct ospf_lsa *lsa); -extern void ospf_opaque_lsa_dump(struct stream *s, u_int16_t length); +extern void ospf_opaque_lsa_dump(struct stream *s, uint16_t length); extern void ospf_opaque_lsa_originate_schedule(struct ospf_interface *oi, int *init_delay); @@ -158,8 +158,8 @@ extern struct ospf_lsa *ospf_opaque_lsa_install(struct ospf_lsa *lsa, extern struct ospf_lsa *ospf_opaque_lsa_refresh(struct ospf_lsa *lsa); extern void ospf_opaque_lsa_reoriginate_schedule(void *lsa_type_dependent, - u_char lsa_type, - u_char opaque_type); + uint8_t lsa_type, + uint8_t opaque_type); extern void ospf_opaque_lsa_refresh_schedule(struct ospf_lsa *lsa); extern void ospf_opaque_lsa_flush_schedule(struct ospf_lsa *lsa); diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index 790679441..1f67c0d5a 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -81,7 +81,7 @@ const struct message ospf_packet_type_str[] = { /* Minimum (besides OSPF_HEADER_SIZE) lengths for OSPF packets of particular types, offset is the "type" field of a packet. */ -static const u_int16_t ospf_packet_minlen[] = { +static const uint16_t ospf_packet_minlen[] = { 0, OSPF_HELLO_MIN_SIZE, OSPF_DB_DESC_MIN_SIZE, @@ -92,7 +92,7 @@ static const u_int16_t ospf_packet_minlen[] = { /* Minimum (besides OSPF_LSA_HEADER_SIZE) lengths for LSAs of particular types, offset is the "LSA type" field. */ -static const u_int16_t ospf_lsa_minlen[] = { +static const uint16_t ospf_lsa_minlen[] = { 0, OSPF_ROUTER_LSA_MIN_SIZE, OSPF_NETWORK_LSA_MIN_SIZE, @@ -292,7 +292,7 @@ struct ospf_packet *ospf_packet_dup(struct ospf_packet *op) /* XXX size_t */ zlog_warn( "ospf_packet_dup stream %lu ospf_packet %u size mismatch", - (u_long)STREAM_SIZE(op->s), op->length); + (unsigned long)STREAM_SIZE(op->s), op->length); /* Reserve space for MD5 authentication that may be added later. */ new = ospf_packet_new(stream_get_endp(op->s) + OSPF_AUTH_MD5_SIZE); @@ -334,7 +334,7 @@ static int ospf_check_md5_digest(struct ospf_interface *oi, unsigned char digest[OSPF_AUTH_MD5_SIZE]; struct crypt_key *ck; struct ospf_neighbor *nbr; - u_int16_t length = ntohs(ospfh->length); + uint16_t length = ntohs(ospfh->length); /* Get secret key. */ ck = ospf_crypt_key_lookup(OSPF_IF_PARAM(oi, auth_crypt), @@ -387,9 +387,9 @@ static int ospf_make_md5_digest(struct ospf_interface *oi, unsigned char digest[OSPF_AUTH_MD5_SIZE] = {0}; MD5_CTX ctx; void *ibuf; - u_int32_t t; + uint32_t t; struct crypt_key *ck; - const u_int8_t *auth_key; + const uint8_t *auth_key; ibuf = STREAM_DATA(op->s); ospfh = (struct ospf_header *)ibuf; @@ -411,7 +411,7 @@ static int ospf_make_md5_digest(struct ospf_interface *oi, /* Get MD5 Authentication key from auth_key list. */ if (list_isempty(OSPF_IF_PARAM(oi, auth_crypt))) - auth_key = (const u_int8_t *)digest; + auth_key = (const uint8_t *)digest; else { ck = listgetdata(listtail(OSPF_IF_PARAM(oi, auth_crypt))); auth_key = ck->auth_key; @@ -434,7 +434,7 @@ static int ospf_make_md5_digest(struct ospf_interface *oi, /* XXX size_t */ zlog_warn( "ospf_make_md5_digest: length mismatch stream %lu ospf_packet %u", - (u_long)stream_get_endp(op->s), op->length); + (unsigned long)stream_get_endp(op->s), op->length); return OSPF_AUTH_MD5_SIZE; } @@ -549,10 +549,10 @@ int ospf_ls_ack_timer(struct thread *thread) #ifdef WANT_OSPF_WRITE_FRAGMENT static void ospf_write_frags(int fd, struct ospf_packet *op, struct ip *iph, struct msghdr *msg, unsigned int maxdatasize, - unsigned int mtu, int flags, u_char type) + unsigned int mtu, int flags, uint8_t type) { #define OSPF_WRITE_FRAG_SHIFT 3 - u_int16_t offset; + uint16_t offset; struct iovec *iovp; int ret; @@ -637,13 +637,13 @@ static int ospf_write(struct thread *thread) struct ip iph; struct msghdr msg; struct iovec iov[2]; - u_char type; + uint8_t type; int ret; int flags = 0; struct listnode *node; #ifdef WANT_OSPF_WRITE_FRAGMENT - static u_int16_t ipid = 0; - u_int16_t maxdatasize; + static uint16_t ipid = 0; + uint16_t maxdatasize; #endif /* WANT_OSPF_WRITE_FRAGMENT */ #define OSPF_WRITE_IPHL_SHIFT 2 int pkt_count = 0; @@ -1109,7 +1109,7 @@ static void ospf_db_desc_save_current(struct ospf_neighbor *nbr, /* Process rest of DD packet. */ static void ospf_db_desc_proc(struct stream *s, struct ospf_interface *oi, struct ospf_neighbor *nbr, - struct ospf_db_desc *dd, u_int16_t size) + struct ospf_db_desc *dd, uint16_t size) { struct ospf_lsa *new, *find; struct lsa_header *lsah; @@ -1258,7 +1258,7 @@ static int ospf_db_desc_is_dup(struct ospf_db_desc *dd, /* OSPF Database Description message read -- RFC2328 Section 10.6. */ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, struct stream *s, struct ospf_interface *oi, - u_int16_t size) + uint16_t size) { struct ospf_db_desc *dd; struct ospf_neighbor *nbr; @@ -1549,10 +1549,10 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh, /* OSPF Link State Request Read -- RFC2328 Section 10.7. */ static void ospf_ls_req(struct ip *iph, struct ospf_header *ospfh, struct stream *s, struct ospf_interface *oi, - u_int16_t size) + uint16_t size) { struct ospf_neighbor *nbr; - u_int32_t ls_type; + uint32_t ls_type; struct in_addr ls_id; struct in_addr adv_router; struct ospf_lsa *find; @@ -1651,8 +1651,8 @@ static struct list *ospf_ls_upd_list_lsa(struct ospf_neighbor *nbr, struct stream *s, struct ospf_interface *oi, size_t size) { - u_int16_t count, sum; - u_int32_t length; + uint16_t count, sum; + uint32_t length; struct lsa_header *lsah; struct ospf_lsa *lsa; struct list *lsas; @@ -1789,7 +1789,7 @@ static void ospf_upd_list_clean(struct list *lsas) /* OSPF Link State Update message read -- RFC2328 Section 13. */ static void ospf_ls_upd(struct ospf *ospf, struct ip *iph, struct ospf_header *ospfh, struct stream *s, - struct ospf_interface *oi, u_int16_t size) + struct ospf_interface *oi, uint16_t size) { struct ospf_neighbor *nbr; struct list *lsas; @@ -2190,7 +2190,7 @@ static void ospf_ls_upd(struct ospf *ospf, struct ip *iph, /* OSPF Link State Acknowledgment message read -- RFC2328 Section 13.7. */ static void ospf_ls_ack(struct ip *iph, struct ospf_header *ospfh, struct stream *s, struct ospf_interface *oi, - u_int16_t size) + uint16_t size) { struct ospf_neighbor *nbr; @@ -2254,7 +2254,7 @@ static struct stream *ospf_recv_packet(struct ospf *ospf, int fd, { int ret; struct ip *iph; - u_int16_t ip_len; + uint16_t ip_len; ifindex_t ifindex = 0; struct iovec iov; /* Header and data both require alignment. */ @@ -2277,7 +2277,7 @@ static struct stream *ospf_recv_packet(struct ospf *ospf, int fd, zlog_warn( "ospf_recv_packet: discarding runt packet of length %d " "(ip header size is %u)", - ret, (u_int)sizeof(iph)); + ret, (unsigned int)sizeof(iph)); return NULL; } @@ -2419,8 +2419,8 @@ static int ospf_check_network_mask(struct ospf_interface *oi, static int ospf_check_auth(struct ospf_interface *oi, struct ospf_header *ospfh) { struct crypt_key *ck; - u_int16_t iface_auth_type; - u_int16_t pkt_auth_type = ntohs(ospfh->auth_type); + uint16_t iface_auth_type; + uint16_t pkt_auth_type = ntohs(ospfh->auth_type); switch (pkt_auth_type) { case OSPF_AUTH_NULL: /* RFC2328 D.5.1 */ @@ -2513,15 +2513,15 @@ static int ospf_check_auth(struct ospf_interface *oi, struct ospf_header *ospfh) static int ospf_check_sum(struct ospf_header *ospfh) { - u_int32_t ret; - u_int16_t sum; + uint32_t ret; + uint16_t sum; /* clear auth_data for checksum. */ memset(ospfh->u.auth_data, 0, OSPF_AUTH_SIMPLE_SIZE); /* keep checksum and clear. */ sum = ospfh->checksum; - memset(&ospfh->checksum, 0, sizeof(u_int16_t)); + memset(&ospfh->checksum, 0, sizeof(uint16_t)); /* calculate checksum. */ ret = in_cksum(ospfh, ntohs(ospfh->length)); @@ -2538,8 +2538,8 @@ static int ospf_check_sum(struct ospf_header *ospfh) /* Verify, that given link/TOS records are properly sized/aligned and match Router-LSA "# links" and "# TOS" fields as specified in RFC2328 A.4.2. */ static unsigned ospf_router_lsa_links_examin(struct router_lsa_link *link, - u_int16_t linkbytes, - const u_int16_t num_links) + uint16_t linkbytes, + const uint16_t num_links) { unsigned counted_links = 0, thislinklen; @@ -2567,8 +2567,8 @@ static unsigned ospf_router_lsa_links_examin(struct router_lsa_link *link, /* Verify, that the given LSA is properly sized/aligned (including type-specific minimum length constraint). */ -static unsigned ospf_lsa_examin(struct lsa_header *lsah, const u_int16_t lsalen, - const u_char headeronly) +static unsigned ospf_lsa_examin(struct lsa_header *lsah, const uint16_t lsalen, + const uint8_t headeronly) { unsigned ret; struct router_lsa *rlsa; @@ -2651,16 +2651,16 @@ static unsigned ospf_lsa_examin(struct lsa_header *lsah, const u_int16_t lsalen, of deeper-level checks. */ static unsigned ospf_lsaseq_examin(struct lsa_header *lsah, /* start of buffered data */ - size_t length, const u_char headeronly, + size_t length, const uint8_t headeronly, /* When declared_num_lsas is not 0, compare it to the real number of LSAs and treat the difference as an error. */ - const u_int32_t declared_num_lsas) + const uint32_t declared_num_lsas) { - u_int32_t counted_lsas = 0; + uint32_t counted_lsas = 0; while (length) { - u_int16_t lsalen; + uint16_t lsalen; if (length < OSPF_LSA_HEADER_SIZE) { if (IS_DEBUG_OSPF_PACKET(0, RECV)) zlog_debug( @@ -2726,7 +2726,7 @@ ospf_lsaseq_examin(struct lsa_header *lsah, /* start of buffered data */ static unsigned ospf_packet_examin(struct ospf_header *oh, const unsigned bytesonwire) { - u_int16_t bytesdeclared, bytesauth; + uint16_t bytesdeclared, bytesauth; unsigned ret; struct ospf_ls_update *lsupd; @@ -2883,7 +2883,7 @@ int ospf_read(struct thread *thread) struct ospf_interface *oi; struct ip *iph; struct ospf_header *ospfh; - u_int16_t length; + uint16_t length; struct interface *ifp = NULL; struct connected *c; @@ -3114,8 +3114,8 @@ static void ospf_make_header(int type, struct ospf_interface *oi, ospfh = (struct ospf_header *)STREAM_DATA(s); - ospfh->version = (u_char)OSPF_VERSION; - ospfh->type = (u_char)type; + ospfh->version = (uint8_t)OSPF_VERSION; + ospfh->type = (uint8_t)type; ospfh->router_id = oi->ospf->router_id; @@ -3168,7 +3168,7 @@ static int ospf_make_auth(struct ospf_interface *oi, struct ospf_header *ospfh) /* Fill rest of OSPF header. */ static void ospf_fill_header(struct ospf_interface *oi, struct stream *s, - u_int16_t length) + uint16_t length) { struct ospf_header *ospfh; @@ -3191,7 +3191,7 @@ static int ospf_make_hello(struct ospf_interface *oi, struct stream *s) { struct ospf_neighbor *nbr; struct route_node *rn; - u_int16_t length = OSPF_HELLO_MIN_SIZE; + uint16_t length = OSPF_HELLO_MIN_SIZE; struct in_addr mask; unsigned long p; int flag = 0; @@ -3279,8 +3279,8 @@ static int ospf_make_db_desc(struct ospf_interface *oi, struct ospf_neighbor *nbr, struct stream *s) { struct ospf_lsa *lsa; - u_int16_t length = OSPF_DB_DESC_MIN_SIZE; - u_char options; + uint16_t length = OSPF_DB_DESC_MIN_SIZE; + uint8_t options; unsigned long pp; int i; struct ospf_lsdb *lsdb; @@ -3328,7 +3328,7 @@ static int ospf_make_db_desc(struct ospf_interface *oi, if (!CHECK_FLAG(lsa->flags, OSPF_LSA_DISCARD)) { struct lsa_header *lsah; - u_int16_t ls_age; + uint16_t ls_age; /* DD packet overflows interface MTU. */ if (length + OSPF_LSA_HEADER_SIZE @@ -3370,7 +3370,7 @@ static int ospf_make_db_desc(struct ospf_interface *oi, return length; } -static int ospf_make_ls_req_func(struct stream *s, u_int16_t *length, +static int ospf_make_ls_req_func(struct stream *s, uint16_t *length, unsigned long delta, struct ospf_neighbor *nbr, struct ospf_lsa *lsa) { @@ -3396,7 +3396,7 @@ static int ospf_make_ls_req_func(struct stream *s, u_int16_t *length, static int ospf_make_ls_req(struct ospf_neighbor *nbr, struct stream *s) { struct ospf_lsa *lsa; - u_int16_t length = OSPF_LS_REQ_MIN_SIZE; + uint16_t length = OSPF_LS_REQ_MIN_SIZE; unsigned long delta = stream_get_endp(s) + 12; struct route_table *table; struct route_node *rn; @@ -3433,7 +3433,7 @@ static int ospf_make_ls_upd(struct ospf_interface *oi, struct list *update, { struct ospf_lsa *lsa; struct listnode *node; - u_int16_t length = 0; + uint16_t length = 0; unsigned int size_noauth; unsigned long delta = stream_get_endp(s); unsigned long pp; @@ -3451,7 +3451,7 @@ static int ospf_make_ls_upd(struct ospf_interface *oi, struct list *update, while ((node = listhead(update)) != NULL) { struct lsa_header *lsah; - u_int16_t ls_age; + uint16_t ls_age; if (IS_DEBUG_OSPF_EVENT) zlog_debug("ospf_make_ls_upd: List Iteration %d", @@ -3498,7 +3498,7 @@ static int ospf_make_ls_ack(struct ospf_interface *oi, struct list *ack, struct stream *s) { struct listnode *node, *nnode; - u_int16_t length = OSPF_LS_ACK_MIN_SIZE; + uint16_t length = OSPF_LS_ACK_MIN_SIZE; unsigned long delta = stream_get_endp(s) + 24; struct ospf_lsa *lsa; @@ -3521,7 +3521,7 @@ static int ospf_make_ls_ack(struct ospf_interface *oi, struct list *ack, static void ospf_hello_send_sub(struct ospf_interface *oi, in_addr_t addr) { struct ospf_packet *op; - u_int16_t length = OSPF_HEADER_SIZE; + uint16_t length = OSPF_HEADER_SIZE; op = ospf_packet_new(oi->ifp->mtu); @@ -3695,7 +3695,7 @@ void ospf_db_desc_send(struct ospf_neighbor *nbr) { struct ospf_interface *oi; struct ospf_packet *op; - u_int16_t length = OSPF_HEADER_SIZE; + uint16_t length = OSPF_HEADER_SIZE; oi = nbr->oi; op = ospf_packet_new(oi->ifp->mtu); @@ -3751,7 +3751,7 @@ void ospf_ls_req_send(struct ospf_neighbor *nbr) { struct ospf_interface *oi; struct ospf_packet *op; - u_int16_t length = OSPF_HEADER_SIZE; + uint16_t length = OSPF_HEADER_SIZE; oi = nbr->oi; op = ospf_packet_new(oi->ifp->mtu); @@ -3890,7 +3890,7 @@ static void ospf_ls_upd_queue_send(struct ospf_interface *oi, int send_lsupd_now) { struct ospf_packet *op; - u_int16_t length = OSPF_HEADER_SIZE; + uint16_t length = OSPF_HEADER_SIZE; if (IS_DEBUG_OSPF_EVENT) zlog_debug("listcount = %d, [%s]dst %s", listcount(update), @@ -4058,7 +4058,7 @@ static void ospf_ls_ack_send_list(struct ospf_interface *oi, struct list *ack, struct in_addr dst) { struct ospf_packet *op; - u_int16_t length = OSPF_HEADER_SIZE; + uint16_t length = OSPF_HEADER_SIZE; op = ospf_packet_new(oi->ifp->mtu); diff --git a/ospfd/ospf_packet.h b/ospfd/ospf_packet.h index 78b2b81e5..a50872796 100644 --- a/ospfd/ospf_packet.h +++ b/ospfd/ospf_packet.h @@ -59,7 +59,7 @@ struct ospf_packet { struct in_addr dst; /* OSPF packet length. */ - u_int16_t length; + uint16_t length; }; /* OSPF packet queue structure. */ @@ -72,23 +72,23 @@ struct ospf_fifo { /* OSPF packet header structure. */ struct ospf_header { - u_char version; /* OSPF Version. */ - u_char type; /* Packet Type. */ - u_int16_t length; /* Packet Length. */ + uint8_t version; /* OSPF Version. */ + uint8_t type; /* Packet Type. */ + uint16_t length; /* Packet Length. */ struct in_addr router_id; /* Router ID. */ struct in_addr area_id; /* Area ID. */ - u_int16_t checksum; /* Check Sum. */ - u_int16_t auth_type; /* Authentication Type. */ + uint16_t checksum; /* Check Sum. */ + uint16_t auth_type; /* Authentication Type. */ /* Authentication Data. */ union { /* Simple Authentication. */ - u_char auth_data[OSPF_AUTH_SIMPLE_SIZE]; + uint8_t auth_data[OSPF_AUTH_SIMPLE_SIZE]; /* Cryptographic Authentication. */ struct { - u_int16_t zero; /* Should be 0. */ - u_char key_id; /* Key ID. */ - u_char auth_data_len; /* Auth Data Length. */ - u_int32_t crypt_seqnum; /* Cryptographic Sequence + uint16_t zero; /* Should be 0. */ + uint8_t key_id; /* Key ID. */ + uint8_t auth_data_len; /* Auth Data Length. */ + uint32_t crypt_seqnum; /* Cryptographic Sequence Number. */ } crypt; } u; @@ -97,10 +97,10 @@ struct ospf_header { /* OSPF Hello body format. */ struct ospf_hello { struct in_addr network_mask; - u_int16_t hello_interval; - u_char options; - u_char priority; - u_int32_t dead_interval; + uint16_t hello_interval; + uint8_t options; + uint8_t priority; + uint32_t dead_interval; struct in_addr d_router; struct in_addr bd_router; struct in_addr neighbors[1]; @@ -108,14 +108,14 @@ struct ospf_hello { /* OSPF Database Description body format. */ struct ospf_db_desc { - u_int16_t mtu; - u_char options; - u_char flags; - u_int32_t dd_seqnum; + uint16_t mtu; + uint8_t options; + uint8_t flags; + uint32_t dd_seqnum; }; struct ospf_ls_update { - u_int32_t num_lsas; + uint32_t num_lsas; }; /* Macros. */ diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c index e1d3e925c..786b19902 100644 --- a/ospfd/ospf_ri.c +++ b/ospfd/ospf_ri.c @@ -90,13 +90,13 @@ struct ospf_ri_sr_info { struct ospf_router_info { bool enabled; - u_int8_t registered; - u_int8_t scope; + uint8_t registered; + uint8_t scope; /* Flags to manage this router information. */ #define RIFLG_LSA_ENGAGED 0x1 #define RIFLG_LSA_FORCED_REFRESH 0x2 - u_int32_t flags; + uint32_t flags; /* area pointer if flooding is Type 10 Null if flooding is AS scope */ struct ospf_area *area; @@ -163,7 +163,7 @@ int ospf_router_info_init(void) return 0; } -static int ospf_router_info_register(u_int8_t scope) +static int ospf_router_info_register(uint8_t scope) { int rc = 0; @@ -260,7 +260,7 @@ struct scope_info ospf_router_info_get_flooding_scope(void) *------------------------------------------------------------------------*/ static void set_router_info_capabilities(struct ri_tlv_router_cap *ric, - u_int32_t cap) + uint32_t cap) { ric->header.type = htons(RI_TLV_CAPABILITIES); ric->header.length = htons(RI_TLV_LENGTH); @@ -270,7 +270,7 @@ static void set_router_info_capabilities(struct ri_tlv_router_cap *ric, static int set_pce_header(struct ospf_pce_info *pce) { - u_int16_t length = 0; + uint16_t length = 0; struct listnode *node; struct ri_pce_subtlv_domain *domain; struct ri_pce_subtlv_neighbor *neighbor; @@ -326,7 +326,7 @@ static void set_pce_address(struct in_addr ipv4, struct ospf_pce_info *pce) return; } -static void set_pce_path_scope(u_int32_t scope, struct ospf_pce_info *pce) +static void set_pce_path_scope(uint32_t scope, struct ospf_pce_info *pce) { /* Set PCE Scope */ @@ -337,7 +337,7 @@ static void set_pce_path_scope(u_int32_t scope, struct ospf_pce_info *pce) return; } -static void set_pce_domain(u_int16_t type, u_int32_t domain, +static void set_pce_domain(uint16_t type, uint32_t domain, struct ospf_pce_info *pce) { @@ -358,7 +358,7 @@ static void set_pce_domain(u_int16_t type, u_int32_t domain, return; } -static void unset_pce_domain(u_int16_t type, u_int32_t domain, +static void unset_pce_domain(uint16_t type, uint32_t domain, struct ospf_pce_info *pce) { struct listnode *node; @@ -387,7 +387,7 @@ static void unset_pce_domain(u_int16_t type, u_int32_t domain, } } -static void set_pce_neighbor(u_int16_t type, u_int32_t domain, +static void set_pce_neighbor(uint16_t type, uint32_t domain, struct ospf_pce_info *pce) { @@ -408,7 +408,7 @@ static void set_pce_neighbor(u_int16_t type, u_int32_t domain, return; } -static void unset_pce_neighbor(u_int16_t type, u_int32_t domain, +static void unset_pce_neighbor(uint16_t type, uint32_t domain, struct ospf_pce_info *pce) { struct listnode *node; @@ -438,7 +438,7 @@ static void unset_pce_neighbor(u_int16_t type, u_int32_t domain, } } -static void set_pce_cap_flag(u_int32_t cap, struct ospf_pce_info *pce) +static void set_pce_cap_flag(uint32_t cap, struct ospf_pce_info *pce) { /* Set PCE Capabilities flag */ @@ -529,7 +529,7 @@ static void unset_param(struct tlv_header *tlv) static void initialize_params(struct ospf_router_info *ori) { - u_int32_t cap = 0; + uint32_t cap = 0; struct ospf *top; /* @@ -735,10 +735,10 @@ static struct ospf_lsa *ospf_router_info_lsa_new() struct stream *s; struct lsa_header *lsah; struct ospf_lsa *new = NULL; - u_char options, lsa_type; + uint8_t options, lsa_type; struct in_addr lsa_id; - u_int32_t tmp; - u_int16_t length; + uint32_t tmp; + uint16_t length; /* Create a stream for LSA. */ if ((s = stream_new(OSPF_MAX_LSA_SIZE)) == NULL) { @@ -974,7 +974,7 @@ static void ospf_router_info_lsa_schedule(enum lsa_opcode opcode) 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)); @@ -1075,7 +1075,7 @@ static int ospf_router_info_lsa_update(struct ospf_lsa *lsa) * Followings are vty session control functions. *------------------------------------------------------------------------*/ -static u_int16_t show_vty_router_cap(struct vty *vty, struct tlv_header *tlvh) +static uint16_t show_vty_router_cap(struct vty *vty, struct tlv_header *tlvh) { struct ri_tlv_router_cap *top = (struct ri_tlv_router_cap *)tlvh; @@ -1088,8 +1088,8 @@ static u_int16_t show_vty_router_cap(struct vty *vty, struct tlv_header *tlvh) return TLV_SIZE(tlvh); } -static u_int16_t show_vty_pce_subtlv_address(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_pce_subtlv_address(struct vty *vty, + struct tlv_header *tlvh) { struct ri_pce_subtlv_address *top = (struct ri_pce_subtlv_address *)tlvh; @@ -1114,8 +1114,8 @@ static u_int16_t show_vty_pce_subtlv_address(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_pce_subtlv_path_scope(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_pce_subtlv_path_scope(struct vty *vty, + struct tlv_header *tlvh) { struct ri_pce_subtlv_path_scope *top = (struct ri_pce_subtlv_path_scope *)tlvh; @@ -1128,8 +1128,8 @@ static u_int16_t show_vty_pce_subtlv_path_scope(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_pce_subtlv_domain(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_pce_subtlv_domain(struct vty *vty, + struct tlv_header *tlvh) { struct ri_pce_subtlv_domain *top = (struct ri_pce_subtlv_domain *)tlvh; struct in_addr tmp; @@ -1150,8 +1150,8 @@ static u_int16_t show_vty_pce_subtlv_domain(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_pce_subtlv_neighbor(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_pce_subtlv_neighbor(struct vty *vty, + struct tlv_header *tlvh) { struct ri_pce_subtlv_neighbor *top = @@ -1176,8 +1176,8 @@ static u_int16_t show_vty_pce_subtlv_neighbor(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_pce_subtlv_cap_flag(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_pce_subtlv_cap_flag(struct vty *vty, + struct tlv_header *tlvh) { struct ri_pce_subtlv_cap_flag *top = (struct ri_pce_subtlv_cap_flag *)tlvh; @@ -1192,7 +1192,7 @@ static u_int16_t show_vty_pce_subtlv_cap_flag(struct vty *vty, 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) { if (vty != NULL) vty_out(vty, " Unknown TLV: [type(0x%x), length(0x%x)]\n", @@ -1204,11 +1204,11 @@ static u_int16_t show_vty_unknown_tlv(struct vty *vty, struct tlv_header *tlvh) return TLV_SIZE(tlvh); } -static u_int16_t show_vty_pce_info(struct vty *vty, struct tlv_header *ri, - uint32_t total) +static uint16_t show_vty_pce_info(struct vty *vty, struct tlv_header *ri, + uint32_t total) { struct tlv_header *tlvh; - u_int16_t sum = 0; + uint16_t sum = 0; for (tlvh = ri; sum < total; tlvh = TLV_HDR_NEXT(tlvh)) { switch (ntohs(tlvh->type)) { @@ -1332,7 +1332,7 @@ static void ospf_router_info_show_info(struct vty *vty, struct ospf_lsa *lsa) { 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; @@ -1442,7 +1442,7 @@ DEFUN (router_info, int idx_ipv4 = 2; char *area = (argc == 3) ? argv[idx_ipv4]->arg : NULL; - u_int8_t scope; + uint8_t scope; if (OspfRI.enabled) return CMD_SUCCESS; diff --git a/ospfd/ospf_ri.h b/ospfd/ospf_ri.h index 39ebb7200..26bcc1b62 100644 --- a/ospfd/ospf_ri.h +++ b/ospfd/ospf_ri.h @@ -78,7 +78,7 @@ struct ri_tlv_router_cap { struct tlv_header header; /* Value length is 4 bytes. */ - u_int32_t value; + uint32_t value; }; /* Capabilities bits are left align */ @@ -108,10 +108,10 @@ struct ri_pce_subtlv_address { #define PCE_ADDRESS_LENGTH_IPV4 8 #define PCE_ADDRESS_LENGTH_IPV6 20 struct { - u_int16_t type; /* Address type: 1 = IPv4, 2 = IPv6 */ + uint16_t type; /* Address type: 1 = IPv4, 2 = IPv6 */ #define PCE_ADDRESS_TYPE_IPV4 1 #define PCE_ADDRESS_TYPE_IPV6 2 - u_int16_t reserved; + uint16_t reserved; struct in_addr value; /* PCE address */ } address; }; @@ -124,7 +124,7 @@ struct ri_pce_subtlv_path_scope { * L, R, Rd, S, Sd, Y, PrefL, PrefR, PrefS and PrefY bits: * see RFC5088 page 9 */ - u_int32_t value; + uint32_t value; }; /* PCE Domain Sub-TLV */ /* Optional */ @@ -135,18 +135,18 @@ struct ri_pce_subtlv_path_scope { struct ri_pce_subtlv_domain { struct tlv_header header; /* Type = 3; Length = 8 bytes. */ - u_int16_t type; /* Domain type: 1 = OSPF Area ID, 2 = AS Number */ - u_int16_t reserved; - u_int32_t value; + uint16_t type; /* Domain type: 1 = OSPF Area ID, 2 = AS Number */ + uint16_t reserved; + uint32_t value; }; /* PCE Neighbor Sub-TLV */ /* Mandatory if R or S bit is set */ #define RI_PCE_SUBTLV_NEIGHBOR 4 struct ri_pce_subtlv_neighbor { struct tlv_header header; /* Type = 4; Length = 8 bytes. */ - u_int16_t type; /* Domain type: 1 = OSPF Area ID, 2 = AS Number */ - u_int16_t reserved; - u_int32_t value; + uint16_t type; /* Domain type: 1 = OSPF Area ID, 2 = AS Number */ + uint16_t reserved; + uint32_t value; }; /* PCE Capabilities Flags Sub-TLV */ /* Optional */ @@ -164,7 +164,7 @@ struct ri_pce_subtlv_neighbor { struct ri_pce_subtlv_cap_flag { struct tlv_header header; /* Type = 5; Length = n x 4 bytes. */ - u_int32_t value; + uint32_t value; }; /* Structure to share flooding scope info for Segment Routing */ diff --git a/ospfd/ospf_route.c b/ospfd/ospf_route.c index 60a2e2d3e..b964bbab7 100644 --- a/ospfd/ospf_route.c +++ b/ospfd/ospf_route.c @@ -449,7 +449,7 @@ void ospf_intra_add_stub(struct route_table *rt, struct router_lsa_link *link, struct vertex *v, struct ospf_area *area, int parent_is_root, int lsa_pos) { - u_int32_t cost; + uint32_t cost; struct route_node *rn; struct ospf_route * or ; struct prefix_ipv4 p; @@ -676,7 +676,7 @@ void ospf_route_table_dump(struct route_table *rt) static int ospf_asbr_route_cmp(struct ospf *ospf, struct ospf_route *r1, struct ospf_route *r2) { - u_char r1_type, r2_type; + uint8_t r1_type, r2_type; r1_type = r1->path_type; r2_type = r2->path_type; diff --git a/ospfd/ospf_route.h b/ospfd/ospf_route.h index 76df54fb3..8cb5d32a8 100644 --- a/ospfd/ospf_route.h +++ b/ospfd/ospf_route.h @@ -64,10 +64,10 @@ struct route_standard { int external_routing; /* Optional Capability. */ - u_char options; /* Get from LSA header. */ + uint8_t options; /* Get from LSA header. */ /* */ - u_char flags; /* From router-LSA */ + uint8_t flags; /* From router-LSA */ }; struct route_external { @@ -75,10 +75,10 @@ struct route_external { struct ospf_lsa *origin; /* Link State Cost Type2. */ - u_int32_t type2_cost; + uint32_t type2_cost; /* Tag value. */ - u_int32_t tag; + uint32_t tag; /* ASBR route. */ struct ospf_route *asbr; @@ -86,7 +86,7 @@ struct route_external { struct ospf_route { /* Destination Type. */ - u_char type; + uint8_t type; /* Destination ID. */ /* i.e. Link State ID. */ struct in_addr id; @@ -95,13 +95,13 @@ struct ospf_route { struct in_addr mask; /* Only valid for networks. */ /* Path Type. */ - u_char path_type; + uint8_t path_type; /* List of Paths. */ struct list *paths; /* Link State Cost. */ - u_int32_t cost; /* i.e. metric. */ + uint32_t cost; /* i.e. metric. */ /* Route specific info. */ union { diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index bec0ec039..ca711aa42 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -342,7 +342,7 @@ static struct route_map_rule_cmd route_match_tag_cmd = { struct ospf_metric { enum { metric_increment, metric_decrement, metric_absolute } type; bool used; - u_int32_t metric; + uint32_t metric; }; /* `set metric METRIC' */ @@ -382,7 +382,7 @@ static void *route_set_metric_compile(const char *arg) { struct ospf_metric *metric; - metric = XCALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(u_int32_t)); + metric = XCALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(uint32_t)); metric->used = false; if (all_digit(arg)) @@ -430,7 +430,7 @@ static route_map_result_t route_set_metric_type(void *rule, route_map_object_t type, void *object) { - u_int32_t *metric_type; + uint32_t *metric_type; struct external_info *ei; if (type == RMAP_OSPF) { @@ -447,9 +447,9 @@ static route_map_result_t route_set_metric_type(void *rule, /* set metric-type compilation. */ static void *route_set_metric_type_compile(const char *arg) { - u_int32_t *metric_type; + uint32_t *metric_type; - metric_type = XCALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(u_int32_t)); + metric_type = XCALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(uint32_t)); if (strcmp(arg, "type-1") == 0) *metric_type = EXTERNAL_METRIC_TYPE_1; else if (strcmp(arg, "type-2") == 0) diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c index 28826254e..7464b14b1 100644 --- a/ospfd/ospf_snmp.c +++ b/ospfd/ospf_snmp.c @@ -220,32 +220,32 @@ static oid ospf_trap_oid[] = {OSPF2MIB, 16, 2}; /* Not reverse mappable! */ static struct in_addr ospf_empty_addr = {.s_addr = 0}; /* Hook functions. */ -static u_char *ospfGeneralGroup(struct variable *, oid *, size_t *, int, - size_t *, WriteMethod **); -static u_char *ospfAreaEntry(struct variable *, oid *, size_t *, int, size_t *, - WriteMethod **); -static u_char *ospfStubAreaEntry(struct variable *, oid *, size_t *, int, +static uint8_t *ospfGeneralGroup(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **); -static u_char *ospfLsdbEntry(struct variable *, oid *, size_t *, int, size_t *, - WriteMethod **); -static u_char *ospfAreaRangeEntry(struct variable *, oid *, size_t *, int, +static uint8_t *ospfAreaEntry(struct variable *, oid *, size_t *, int, size_t *, + WriteMethod **); +static uint8_t *ospfStubAreaEntry(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **); -static u_char *ospfHostEntry(struct variable *, oid *, size_t *, int, size_t *, - WriteMethod **); -static u_char *ospfIfEntry(struct variable *, oid *, size_t *, int, size_t *, - WriteMethod **); -static u_char *ospfIfMetricEntry(struct variable *, oid *, size_t *, int, - size_t *, WriteMethod **); -static u_char *ospfVirtIfEntry(struct variable *, oid *, size_t *, int, - size_t *, WriteMethod **); -static u_char *ospfNbrEntry(struct variable *, oid *, size_t *, int, size_t *, +static uint8_t *ospfLsdbEntry(struct variable *, oid *, size_t *, int, size_t *, + WriteMethod **); +static uint8_t *ospfAreaRangeEntry(struct variable *, oid *, size_t *, int, + size_t *, WriteMethod **); +static uint8_t *ospfHostEntry(struct variable *, oid *, size_t *, int, size_t *, + WriteMethod **); +static uint8_t *ospfIfEntry(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **); -static u_char *ospfVirtNbrEntry(struct variable *, oid *, size_t *, int, - size_t *, WriteMethod **); -static u_char *ospfExtLsdbEntry(struct variable *, oid *, size_t *, int, +static uint8_t *ospfIfMetricEntry(struct variable *, oid *, size_t *, int, + size_t *, WriteMethod **); +static uint8_t *ospfVirtIfEntry(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **); -static u_char *ospfAreaAggregateEntry(struct variable *, oid *, size_t *, int, - size_t *, WriteMethod **); +static uint8_t *ospfNbrEntry(struct variable *, oid *, size_t *, int, size_t *, + WriteMethod **); +static uint8_t *ospfVirtNbrEntry(struct variable *, oid *, size_t *, int, + size_t *, WriteMethod **); +static uint8_t *ospfExtLsdbEntry(struct variable *, oid *, size_t *, int, + size_t *, WriteMethod **); +static uint8_t *ospfAreaAggregateEntry(struct variable *, oid *, size_t *, int, + size_t *, WriteMethod **); static struct variable ospf_variables[] = { /* OSPF general variables */ @@ -526,9 +526,9 @@ static int ospf_admin_stat(struct ospf *ospf) return 0; } -static u_char *ospfGeneralGroup(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfGeneralGroup(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct ospf *ospf; @@ -695,9 +695,9 @@ static struct ospf_area *ospfAreaLookup(struct variable *v, oid name[], return NULL; } -static u_char *ospfAreaEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfAreaEntry(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct ospf_area *area; struct in_addr addr; @@ -834,9 +834,9 @@ static struct ospf_area *ospfStubAreaLookup(struct variable *v, oid name[], return NULL; } -static u_char *ospfStubAreaEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfStubAreaEntry(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct ospf_area *area; struct in_addr addr; @@ -883,7 +883,7 @@ static u_char *ospfStubAreaEntry(struct variable *v, oid *name, size_t *length, return NULL; } -static struct ospf_lsa *lsdb_lookup_next(struct ospf_area *area, u_char *type, +static struct ospf_lsa *lsdb_lookup_next(struct ospf_area *area, uint8_t *type, int type_next, struct in_addr *ls_id, int ls_id_next, struct in_addr *router_id, @@ -919,7 +919,7 @@ static struct ospf_lsa *lsdb_lookup_next(struct ospf_area *area, u_char *type, static struct ospf_lsa *ospfLsdbLookup(struct variable *v, oid *name, size_t *length, struct in_addr *area_id, - u_char *type, struct in_addr *ls_id, + uint8_t *type, struct in_addr *ls_id, struct in_addr *router_id, int exact) { struct ospf *ospf; @@ -1057,14 +1057,14 @@ static struct ospf_lsa *ospfLsdbLookup(struct variable *v, oid *name, return NULL; } -static u_char *ospfLsdbEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfLsdbEntry(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct ospf_lsa *lsa; struct lsa_header *lsah; struct in_addr area_id; - u_char type; + uint8_t type; struct in_addr ls_id; struct in_addr router_id; struct ospf *ospf; @@ -1118,7 +1118,7 @@ static u_char *ospfLsdbEntry(struct variable *v, oid *name, size_t *length, break; case OSPFLSDBADVERTISEMENT: /* 8 */ *var_len = ntohs(lsah->length); - return (u_char *)lsah; + return (uint8_t *)lsah; break; default: return NULL; @@ -1222,9 +1222,9 @@ static struct ospf_area_range *ospfAreaRangeLookup(struct variable *v, return NULL; } -static u_char *ospfAreaRangeEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfAreaRangeEntry(struct variable *v, oid *name, + size_t *length, int exact, size_t *var_len, + WriteMethod **write_method) { struct ospf_area_range *range; struct in_addr area_id; @@ -1329,9 +1329,9 @@ static struct ospf_nbr_nbma *ospfHostLookup(struct variable *v, oid *name, return NULL; } -static u_char *ospfHostEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfHostEntry(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct ospf_nbr_nbma *nbr_nbma; struct ospf_interface *oi; @@ -1654,9 +1654,9 @@ static struct ospf_interface *ospfIfLookup(struct variable *v, oid *name, return NULL; } -static u_char *ospfIfEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfIfEntry(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { ifindex_t ifindex; struct in_addr ifaddr; @@ -1734,7 +1734,7 @@ static u_char *ospfIfEntry(struct variable *v, oid *name, size_t *length, break; case OSPFIFAUTHKEY: /* 16 */ *var_len = 0; - return (u_char *)OSPF_IF_PARAM(oi, auth_simple); + return (uint8_t *)OSPF_IF_PARAM(oi, auth_simple); break; case OSPFIFSTATUS: /* 17 */ return SNMP_INTEGER(SNMP_VALID); @@ -1821,9 +1821,9 @@ static struct ospf_interface *ospfIfMetricLookup(struct variable *v, oid *name, return NULL; } -static u_char *ospfIfMetricEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfIfMetricEntry(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { /* Currently we support metric 1 only. */ ifindex_t ifindex; @@ -2014,9 +2014,9 @@ ospfVirtIfLookup(struct variable *v, oid *name, size_t *length, return NULL; } -static u_char *ospfVirtIfEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfVirtIfEntry(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct ospf_vl_data *vl_data; struct ospf_interface *oi; @@ -2065,7 +2065,7 @@ static u_char *ospfVirtIfEntry(struct variable *v, oid *name, size_t *length, break; case OSPFVIRTIFAUTHKEY: *var_len = 0; - return (u_char *)OSPF_IF_PARAM(oi, auth_simple); + return (uint8_t *)OSPF_IF_PARAM(oi, auth_simple); break; case OSPFVIRTIFSTATUS: return SNMP_INTEGER(SNMP_VALID); @@ -2215,7 +2215,7 @@ ospfNbrState OBJECT-TYPE full (8) } */ -static int32_t ospf_snmp_neighbor_state(u_char nst) +static int32_t ospf_snmp_neighbor_state(uint8_t nst) { switch (nst) { case NSM_Attempt: @@ -2237,9 +2237,9 @@ static int32_t ospf_snmp_neighbor_state(u_char nst) } } -static u_char *ospfNbrEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfNbrEntry(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct in_addr nbr_addr; ifindex_t ifindex; @@ -2302,9 +2302,9 @@ static u_char *ospfNbrEntry(struct variable *v, oid *name, size_t *length, return NULL; } -static u_char *ospfVirtNbrEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfVirtNbrEntry(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct ospf_vl_data *vl_data; struct in_addr area_id; @@ -2330,28 +2330,28 @@ static u_char *ospfVirtNbrEntry(struct variable *v, oid *name, size_t *length, /* Return the current value of the variable */ switch (v->magic) { case OSPFVIRTNBRAREA: - return (u_char *)NULL; + return (uint8_t *)NULL; break; case OSPFVIRTNBRRTRID: - return (u_char *)NULL; + return (uint8_t *)NULL; break; case OSPFVIRTNBRIPADDR: - return (u_char *)NULL; + return (uint8_t *)NULL; break; case OSPFVIRTNBROPTIONS: - return (u_char *)NULL; + return (uint8_t *)NULL; break; case OSPFVIRTNBRSTATE: - return (u_char *)NULL; + return (uint8_t *)NULL; break; case OSPFVIRTNBREVENTS: - return (u_char *)NULL; + return (uint8_t *)NULL; break; case OSPFVIRTNBRLSRETRANSQLEN: - return (u_char *)NULL; + return (uint8_t *)NULL; break; case OSPFVIRTNBRHELLOSUPPRESSED: - return (u_char *)NULL; + return (uint8_t *)NULL; break; default: return NULL; @@ -2361,14 +2361,14 @@ static u_char *ospfVirtNbrEntry(struct variable *v, oid *name, size_t *length, } static struct ospf_lsa *ospfExtLsdbLookup(struct variable *v, oid *name, - size_t *length, u_char *type, + size_t *length, uint8_t *type, struct in_addr *ls_id, struct in_addr *router_id, int exact) { int first; oid *offset; int offsetlen; - u_char lsa_type; + uint8_t lsa_type; unsigned int len; struct ospf_lsa *lsa; struct ospf *ospf; @@ -2450,13 +2450,13 @@ static struct ospf_lsa *ospfExtLsdbLookup(struct variable *v, oid *name, return NULL; } -static u_char *ospfExtLsdbEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfExtLsdbEntry(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct ospf_lsa *lsa; struct lsa_header *lsah; - u_char type; + uint8_t type; struct in_addr ls_id; struct in_addr router_id; struct ospf *ospf; @@ -2503,7 +2503,7 @@ static u_char *ospfExtLsdbEntry(struct variable *v, oid *name, size_t *length, break; case OSPFEXTLSDBADVERTISEMENT: *var_len = ntohs(lsah->length); - return (u_char *)lsah; + return (uint8_t *)lsah; break; default: return NULL; @@ -2512,10 +2512,10 @@ static u_char *ospfExtLsdbEntry(struct variable *v, oid *name, size_t *length, return NULL; } -static u_char *ospfAreaAggregateEntry(struct variable *v, oid *name, - size_t *length, int exact, - size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfAreaAggregateEntry(struct variable *v, oid *name, + size_t *length, int exact, + size_t *var_len, + WriteMethod **write_method) { if (smux_header_table(v, name, length, exact, var_len, write_method) == MATCH_FAILED) @@ -2524,22 +2524,22 @@ static u_char *ospfAreaAggregateEntry(struct variable *v, oid *name, /* Return the current value of the variable */ switch (v->magic) { case OSPFAREAAGGREGATEAREAID: - return (u_char *)NULL; + return (uint8_t *)NULL; break; case OSPFAREAAGGREGATELSDBTYPE: - return (u_char *)NULL; + return (uint8_t *)NULL; break; case OSPFAREAAGGREGATENET: - return (u_char *)NULL; + return (uint8_t *)NULL; break; case OSPFAREAAGGREGATEMASK: - return (u_char *)NULL; + return (uint8_t *)NULL; break; case OSPFAREAAGGREGATESTATUS: - return (u_char *)NULL; + return (uint8_t *)NULL; break; case OSPFAREAAGGREGATEEFFECT: - return (u_char *)NULL; + return (uint8_t *)NULL; break; default: return NULL; diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c index f81210ffc..c6c16e716 100644 --- a/ospfd/ospf_spf.c +++ b/ospfd/ospf_spf.c @@ -360,23 +360,23 @@ static struct router_lsa_link * ospf_get_next_link(struct vertex *v, struct vertex *w, struct router_lsa_link *prev_link) { - u_char *p; - u_char *lim; - u_char lsa_type = LSA_LINK_TYPE_TRANSIT; + uint8_t *p; + uint8_t *lim; + uint8_t lsa_type = LSA_LINK_TYPE_TRANSIT; struct router_lsa_link *l; if (w->type == OSPF_VERTEX_ROUTER) lsa_type = LSA_LINK_TYPE_POINTOPOINT; if (prev_link == NULL) - p = ((u_char *)v->lsa) + OSPF_LSA_HEADER_SIZE + 4; + p = ((uint8_t *)v->lsa) + OSPF_LSA_HEADER_SIZE + 4; else { - p = (u_char *)prev_link; + p = (uint8_t *)prev_link; p += (OSPF_ROUTER_LSA_LINK_SIZE + (prev_link->m[0].tos_count * OSPF_ROUTER_LSA_TOS_SIZE)); } - lim = ((u_char *)v->lsa) + ntohs(v->lsa->length); + lim = ((uint8_t *)v->lsa) + ntohs(v->lsa->length); while (p < lim) { l = (struct router_lsa_link *)p; @@ -784,8 +784,8 @@ static void ospf_spf_next(struct vertex *v, struct ospf *ospf, struct ospf_area *area, struct pqueue *candidate) { struct ospf_lsa *w_lsa = NULL; - u_char *p; - u_char *lim; + uint8_t *p; + uint8_t *lim; struct router_lsa_link *l = NULL; struct in_addr *r; int type = 0, lsa_pos = -1, lsa_pos_next = 0; @@ -802,8 +802,8 @@ static void ospf_spf_next(struct vertex *v, struct ospf *ospf, v->type == OSPF_VERTEX_ROUTER ? "Router" : "Network", inet_ntoa(v->lsa->id)); - p = ((u_char *)v->lsa) + OSPF_LSA_HEADER_SIZE + 4; - lim = ((u_char *)v->lsa) + ntohs(v->lsa->length); + p = ((uint8_t *)v->lsa) + OSPF_LSA_HEADER_SIZE + 4; + lim = ((uint8_t *)v->lsa) + ntohs(v->lsa->length); while (p < lim) { struct vertex *w; @@ -1017,8 +1017,8 @@ static void ospf_spf_process_stubs(struct ospf_area *area, struct vertex *v, zlog_debug("ospf_process_stub():processing stubs for area %s", inet_ntoa(area->area_id)); if (v->type == OSPF_VERTEX_ROUTER) { - u_char *p; - u_char *lim; + uint8_t *p; + uint8_t *lim; struct router_lsa_link *l; struct router_lsa *rlsa; int lsa_pos = 0; @@ -1034,8 +1034,8 @@ static void ospf_spf_process_stubs(struct ospf_area *area, struct vertex *v, zlog_debug( "ospf_process_stubs(): we have %d links to process", ntohs(rlsa->links)); - p = ((u_char *)v->lsa) + OSPF_LSA_HEADER_SIZE + 4; - lim = ((u_char *)v->lsa) + ntohs(v->lsa->length); + p = ((uint8_t *)v->lsa) + OSPF_LSA_HEADER_SIZE + 4; + lim = ((uint8_t *)v->lsa) + ntohs(v->lsa->length); while (p < lim) { l = (struct router_lsa_link *)p; diff --git a/ospfd/ospf_spf.h b/ospfd/ospf_spf.h index e23f5941f..85f42bcd1 100644 --- a/ospfd/ospf_spf.h +++ b/ospfd/ospf_spf.h @@ -33,12 +33,12 @@ /* A router or network in an area */ struct vertex { - u_char flags; - u_char type; /* copied from LSA header */ + uint8_t flags; + uint8_t type; /* copied from LSA header */ struct in_addr id; /* copied from LSA header */ struct lsa_header *lsa; /* Router or Network LSA */ int *stat; /* Link to LSA status. */ - u_int32_t distance; /* from root to this vertex */ + uint32_t distance; /* from root to this vertex */ struct list *parents; /* list of parents in SPF tree */ struct list *children; /* list of children in SPF tree*/ }; diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c index c7bc129a4..e5fc3e295 100644 --- a/ospfd/ospf_sr.c +++ b/ospfd/ospf_sr.c @@ -888,7 +888,7 @@ static inline int sr_prefix_cmp(struct sr_prefix *srp1, struct sr_prefix *srp2) /* Update Segment Link of given Segment Routing Node */ static void update_ext_link_sid(struct sr_node *srn, struct sr_link *srl, - u_char lsa_flags) + uint8_t lsa_flags) { struct listnode *node; struct sr_link *lk; @@ -2313,7 +2313,7 @@ DEFUN (show_ip_opsf_srdb, int idx = 0; struct in_addr rid; struct sr_node *srn; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); json_object *json = NULL, *json_node_array = NULL; if (!OspfSR.enabled) { diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index 276a5765f..05adc5aa4 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -122,7 +122,7 @@ int ospf_mpls_te_init(void) static int ospf_mpls_te_register(enum inter_as_mode mode) { int rc = 0; - u_int8_t scope; + uint8_t scope; if (OspfMplsTE.inter_as != Off) return rc; @@ -149,7 +149,7 @@ static int ospf_mpls_te_register(enum inter_as_mode mode) static int ospf_mpls_te_unregister() { - u_int8_t scope; + uint8_t scope; if (OspfMplsTE.inter_as == Off) return 0; @@ -197,9 +197,9 @@ static void del_mpls_te_link(void *val) return; } -static u_int32_t get_mpls_te_instance_value(void) +static uint32_t get_mpls_te_instance_value(void) { - static u_int32_t seqno = 0; + static uint32_t seqno = 0; if (seqno < MAX_LEGAL_TE_INSTANCE_NUM) seqno += 1; @@ -284,7 +284,7 @@ static void set_mpls_te_router_addr(struct in_addr ipv4) static void set_linkparams_link_header(struct mpls_te_link *lp) { - u_int16_t length = 0; + uint16_t length = 0; /* TE_LINK_SUBTLV_LINK_TYPE */ if (ntohs(lp->link_type.header.type) != 0) @@ -465,7 +465,7 @@ static void set_linkparams_rmtif_ipaddr(struct mpls_te_link *lp, } static void set_linkparams_te_metric(struct mpls_te_link *lp, - u_int32_t te_metric) + uint32_t te_metric) { lp->te_metric.header.type = htons(TE_LINK_SUBTLV_TE_METRIC); lp->te_metric.header.length = htons(TE_LINK_SUBTLV_DEF_SIZE); @@ -500,7 +500,7 @@ static void set_linkparams_unrsv_bw(struct mpls_te_link *lp, int priority, } static void set_linkparams_rsc_clsclr(struct mpls_te_link *lp, - u_int32_t classcolor) + uint32_t classcolor) { lp->rsc_clsclr.header.type = htons(TE_LINK_SUBTLV_RSC_CLSCLR); lp->rsc_clsclr.header.length = htons(TE_LINK_SUBTLV_DEF_SIZE); @@ -509,7 +509,7 @@ static void set_linkparams_rsc_clsclr(struct mpls_te_link *lp, } static void set_linkparams_inter_as(struct mpls_te_link *lp, - struct in_addr addr, u_int32_t as) + struct in_addr addr, uint32_t as) { /* Set the Remote ASBR IP address and then the associated AS number */ @@ -535,8 +535,8 @@ static void unset_linkparams_inter_as(struct mpls_te_link *lp) lp->ras.value = htonl(0); } -void set_linkparams_llri(struct mpls_te_link *lp, u_int32_t local, - u_int32_t remote) +void set_linkparams_llri(struct mpls_te_link *lp, uint32_t local, + uint32_t remote) { lp->llri.header.type = htons(TE_LINK_SUBTLV_LLRI); @@ -555,10 +555,10 @@ void set_linkparams_lrrid(struct mpls_te_link *lp, struct in_addr local, lp->lrrid.remote.s_addr = remote.s_addr; } -static void set_linkparams_av_delay(struct mpls_te_link *lp, u_int32_t delay, - u_char anormal) +static void set_linkparams_av_delay(struct mpls_te_link *lp, uint32_t delay, + uint8_t anormal) { - u_int32_t tmp; + uint32_t tmp; /* Note that TLV-length field is the size of array. */ lp->av_delay.header.type = htons(TE_LINK_SUBTLV_AV_DELAY); lp->av_delay.header.length = htons(TE_LINK_SUBTLV_DEF_SIZE); @@ -569,10 +569,10 @@ static void set_linkparams_av_delay(struct mpls_te_link *lp, u_int32_t delay, return; } -static void set_linkparams_mm_delay(struct mpls_te_link *lp, u_int32_t low, - u_int32_t high, u_char anormal) +static void set_linkparams_mm_delay(struct mpls_te_link *lp, uint32_t low, + uint32_t high, uint8_t anormal) { - u_int32_t tmp; + uint32_t tmp; /* Note that TLV-length field is the size of array. */ lp->mm_delay.header.type = htons(TE_LINK_SUBTLV_MM_DELAY); lp->mm_delay.header.length = htons(TE_LINK_SUBTLV_MM_DELAY_SIZE); @@ -584,7 +584,7 @@ static void set_linkparams_mm_delay(struct mpls_te_link *lp, u_int32_t low, return; } -static void set_linkparams_delay_var(struct mpls_te_link *lp, u_int32_t jitter) +static void set_linkparams_delay_var(struct mpls_te_link *lp, uint32_t jitter) { /* Note that TLV-length field is the size of array. */ lp->delay_var.header.type = htons(TE_LINK_SUBTLV_DELAY_VAR); @@ -593,10 +593,10 @@ static void set_linkparams_delay_var(struct mpls_te_link *lp, u_int32_t jitter) return; } -static void set_linkparams_pkt_loss(struct mpls_te_link *lp, u_int32_t loss, - u_char anormal) +static void set_linkparams_pkt_loss(struct mpls_te_link *lp, uint32_t loss, + uint8_t anormal) { - u_int32_t tmp; + uint32_t tmp; /* Note that TLV-length field is the size of array. */ lp->pkt_loss.header.type = htons(TE_LINK_SUBTLV_PKT_LOSS); lp->pkt_loss.header.length = htons(TE_LINK_SUBTLV_DEF_SIZE); @@ -1145,10 +1145,10 @@ static struct ospf_lsa *ospf_mpls_te_lsa_new(struct ospf *ospf, struct stream *s; struct lsa_header *lsah; struct ospf_lsa *new = NULL; - u_char options, lsa_type = 0; + uint8_t options, lsa_type = 0; struct in_addr lsa_id; - u_int32_t tmp; - u_int16_t length; + uint32_t tmp; + uint16_t length; /* Create a stream for LSA. */ if ((s = stream_new(OSPF_MAX_LSA_SIZE)) == NULL) { @@ -1515,7 +1515,7 @@ void ospf_mpls_te_lsa_schedule(struct mpls_te_link *lp, enum lsa_opcode opcode) 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)); @@ -1598,7 +1598,7 @@ void ospf_mpls_te_lsa_schedule(struct mpls_te_link *lp, enum lsa_opcode opcode) * Followings are vty session control functions. *------------------------------------------------------------------------*/ -static u_int16_t show_vty_router_addr(struct vty *vty, struct tlv_header *tlvh) +static uint16_t show_vty_router_addr(struct vty *vty, struct tlv_header *tlvh) { struct te_tlv_router_addr *top = (struct te_tlv_router_addr *)tlvh; @@ -1610,7 +1610,7 @@ static u_int16_t show_vty_router_addr(struct vty *vty, struct tlv_header *tlvh) return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_header(struct vty *vty, struct tlv_header *tlvh) +static uint16_t show_vty_link_header(struct vty *vty, struct tlv_header *tlvh) { struct te_tlv_link *top = (struct te_tlv_link *)tlvh; @@ -1624,8 +1624,8 @@ static u_int16_t show_vty_link_header(struct vty *vty, struct tlv_header *tlvh) return TLV_HDR_SIZE; /* Here is special, not "TLV_SIZE". */ } -static u_int16_t show_vty_link_subtlv_link_type(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_link_subtlv_link_type(struct vty *vty, + struct tlv_header *tlvh) { struct te_link_subtlv_link_type *top; const char *cp = "Unknown"; @@ -1651,8 +1651,8 @@ static u_int16_t show_vty_link_subtlv_link_type(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_subtlv_link_id(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_link_subtlv_link_id(struct vty *vty, + struct tlv_header *tlvh) { struct te_link_subtlv_link_id *top; @@ -1665,8 +1665,8 @@ static u_int16_t show_vty_link_subtlv_link_id(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_subtlv_lclif_ipaddr(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_link_subtlv_lclif_ipaddr(struct vty *vty, + struct tlv_header *tlvh) { struct te_link_subtlv_lclif_ipaddr *top; int i, n; @@ -1690,8 +1690,8 @@ static u_int16_t show_vty_link_subtlv_lclif_ipaddr(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_subtlv_rmtif_ipaddr(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_link_subtlv_rmtif_ipaddr(struct vty *vty, + struct tlv_header *tlvh) { struct te_link_subtlv_rmtif_ipaddr *top; int i, n; @@ -1714,24 +1714,24 @@ static u_int16_t show_vty_link_subtlv_rmtif_ipaddr(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_subtlv_te_metric(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_link_subtlv_te_metric(struct vty *vty, + struct tlv_header *tlvh) { struct te_link_subtlv_te_metric *top; top = (struct te_link_subtlv_te_metric *)tlvh; if (vty != NULL) vty_out(vty, " Traffic Engineering Metric: %u\n", - (u_int32_t)ntohl(top->value)); + (uint32_t)ntohl(top->value)); else zlog_debug(" Traffic Engineering Metric: %u", - (u_int32_t)ntohl(top->value)); + (uint32_t)ntohl(top->value)); return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_subtlv_max_bw(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_link_subtlv_max_bw(struct vty *vty, + struct tlv_header *tlvh) { struct te_link_subtlv_max_bw *top; float fval; @@ -1747,8 +1747,8 @@ static u_int16_t show_vty_link_subtlv_max_bw(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_subtlv_max_rsv_bw(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_link_subtlv_max_rsv_bw(struct vty *vty, + struct tlv_header *tlvh) { struct te_link_subtlv_max_rsv_bw *top; float fval; @@ -1766,8 +1766,8 @@ static u_int16_t show_vty_link_subtlv_max_rsv_bw(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_subtlv_unrsv_bw(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_link_subtlv_unrsv_bw(struct vty *vty, + struct tlv_header *tlvh) { struct te_link_subtlv_unrsv_bw *top; float fval1, fval2; @@ -1797,24 +1797,24 @@ static u_int16_t show_vty_link_subtlv_unrsv_bw(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_subtlv_rsc_clsclr(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_link_subtlv_rsc_clsclr(struct vty *vty, + struct tlv_header *tlvh) { struct te_link_subtlv_rsc_clsclr *top; top = (struct te_link_subtlv_rsc_clsclr *)tlvh; if (vty != NULL) vty_out(vty, " Resource class/color: 0x%x\n", - (u_int32_t)ntohl(top->value)); + (uint32_t)ntohl(top->value)); else zlog_debug(" Resource Class/Color: 0x%x", - (u_int32_t)ntohl(top->value)); + (uint32_t)ntohl(top->value)); return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_subtlv_lrrid(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_link_subtlv_lrrid(struct vty *vty, + struct tlv_header *tlvh) { struct te_link_subtlv_lrrid *top; @@ -1835,8 +1835,8 @@ static u_int16_t show_vty_link_subtlv_lrrid(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_subtlv_llri(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_link_subtlv_llri(struct vty *vty, + struct tlv_header *tlvh) { struct te_link_subtlv_llri *top; @@ -1844,21 +1844,21 @@ static u_int16_t show_vty_link_subtlv_llri(struct vty *vty, if (vty != NULL) { vty_out(vty, " Link Local ID: %d\n", - (u_int32_t)ntohl(top->local)); + (uint32_t)ntohl(top->local)); vty_out(vty, " Link Remote ID: %d\n", - (u_int32_t)ntohl(top->remote)); + (uint32_t)ntohl(top->remote)); } else { zlog_debug(" Link Local ID: %d", - (u_int32_t)ntohl(top->local)); + (uint32_t)ntohl(top->local)); zlog_debug(" Link Remote ID: %d", - (u_int32_t)ntohl(top->remote)); + (uint32_t)ntohl(top->remote)); } return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_subtlv_rip(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_link_subtlv_rip(struct vty *vty, + struct tlv_header *tlvh) { struct te_link_subtlv_rip *top; @@ -1874,8 +1874,8 @@ static u_int16_t show_vty_link_subtlv_rip(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_subtlv_ras(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_link_subtlv_ras(struct vty *vty, + struct tlv_header *tlvh) { struct te_link_subtlv_ras *top; @@ -1891,16 +1891,16 @@ static u_int16_t show_vty_link_subtlv_ras(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_subtlv_av_delay(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_link_subtlv_av_delay(struct vty *vty, + struct tlv_header *tlvh) { struct te_link_subtlv_av_delay *top; - u_int32_t delay; - u_int32_t anomalous; + uint32_t delay; + uint32_t anomalous; top = (struct te_link_subtlv_av_delay *)tlvh; - delay = (u_int32_t)ntohl(top->value) & TE_EXT_MASK; - anomalous = (u_int32_t)ntohl(top->value) & TE_EXT_ANORMAL; + delay = (uint32_t)ntohl(top->value) & TE_EXT_MASK; + anomalous = (uint32_t)ntohl(top->value) & TE_EXT_ANORMAL; if (vty != NULL) vty_out(vty, " %s Average Link Delay: %d (micro-sec)\n", @@ -1912,17 +1912,17 @@ static u_int16_t show_vty_link_subtlv_av_delay(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_subtlv_mm_delay(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_link_subtlv_mm_delay(struct vty *vty, + struct tlv_header *tlvh) { struct te_link_subtlv_mm_delay *top; - u_int32_t low, high; - u_int32_t anomalous; + uint32_t low, high; + uint32_t anomalous; top = (struct te_link_subtlv_mm_delay *)tlvh; - low = (u_int32_t)ntohl(top->low) & TE_EXT_MASK; - anomalous = (u_int32_t)ntohl(top->low) & TE_EXT_ANORMAL; - high = (u_int32_t)ntohl(top->high); + low = (uint32_t)ntohl(top->low) & TE_EXT_MASK; + anomalous = (uint32_t)ntohl(top->low) & TE_EXT_ANORMAL; + high = (uint32_t)ntohl(top->high); if (vty != NULL) vty_out(vty, " %s Min/Max Link Delay: %d/%d (micro-sec)\n", @@ -1934,14 +1934,14 @@ static u_int16_t show_vty_link_subtlv_mm_delay(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_subtlv_delay_var(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_link_subtlv_delay_var(struct vty *vty, + struct tlv_header *tlvh) { struct te_link_subtlv_delay_var *top; - u_int32_t jitter; + uint32_t jitter; top = (struct te_link_subtlv_delay_var *)tlvh; - jitter = (u_int32_t)ntohl(top->value) & TE_EXT_MASK; + jitter = (uint32_t)ntohl(top->value) & TE_EXT_MASK; if (vty != NULL) vty_out(vty, " Delay Variation: %d (micro-sec)\n", jitter); @@ -1951,18 +1951,18 @@ static u_int16_t show_vty_link_subtlv_delay_var(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_subtlv_pkt_loss(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_link_subtlv_pkt_loss(struct vty *vty, + struct tlv_header *tlvh) { struct te_link_subtlv_pkt_loss *top; - u_int32_t loss; - u_int32_t anomalous; + uint32_t loss; + uint32_t anomalous; float fval; top = (struct te_link_subtlv_pkt_loss *)tlvh; - loss = (u_int32_t)ntohl(top->value) & TE_EXT_MASK; + loss = (uint32_t)ntohl(top->value) & TE_EXT_MASK; fval = (float)(loss * LOSS_PRECISION); - anomalous = (u_int32_t)ntohl(top->value) & TE_EXT_ANORMAL; + anomalous = (uint32_t)ntohl(top->value) & TE_EXT_ANORMAL; if (vty != NULL) vty_out(vty, " %s Link Loss: %g (%%)\n", @@ -1974,8 +1974,8 @@ static u_int16_t show_vty_link_subtlv_pkt_loss(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_subtlv_res_bw(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_link_subtlv_res_bw(struct vty *vty, + struct tlv_header *tlvh) { struct te_link_subtlv_res_bw *top; float fval; @@ -1995,8 +1995,8 @@ static u_int16_t show_vty_link_subtlv_res_bw(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_subtlv_ava_bw(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_link_subtlv_ava_bw(struct vty *vty, + struct tlv_header *tlvh) { struct te_link_subtlv_ava_bw *top; float fval; @@ -2016,8 +2016,8 @@ static u_int16_t show_vty_link_subtlv_ava_bw(struct vty *vty, return TLV_SIZE(tlvh); } -static u_int16_t show_vty_link_subtlv_use_bw(struct vty *vty, - struct tlv_header *tlvh) +static uint16_t show_vty_link_subtlv_use_bw(struct vty *vty, + struct tlv_header *tlvh) { struct te_link_subtlv_use_bw *top; float fval; @@ -2037,7 +2037,7 @@ static u_int16_t show_vty_link_subtlv_use_bw(struct vty *vty, 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) { if (vty != NULL) vty_out(vty, " Unknown TLV: [type(0x%x), length(0x%x)]\n", @@ -2049,13 +2049,12 @@ static u_int16_t show_vty_unknown_tlv(struct vty *vty, struct tlv_header *tlvh) return TLV_SIZE(tlvh); } -static u_int16_t ospf_mpls_te_show_link_subtlv(struct vty *vty, - struct tlv_header *tlvh0, - u_int16_t subtotal, - u_int16_t total) +static uint16_t ospf_mpls_te_show_link_subtlv(struct vty *vty, + struct tlv_header *tlvh0, + uint16_t subtotal, uint16_t total) { struct tlv_header *tlvh, *next; - u_int16_t sum = subtotal; + uint16_t sum = subtotal; for (tlvh = tlvh0; sum < total; tlvh = (next ? next : TLV_HDR_NEXT(tlvh))) { @@ -2133,9 +2132,9 @@ static void ospf_mpls_te_show_info(struct vty *vty, struct ospf_lsa *lsa) { struct lsa_header *lsah = (struct lsa_header *)lsa->data; struct tlv_header *tlvh, *next; - u_int16_t sum, total; - u_int16_t (*subfunc)(struct vty * vty, struct tlv_header * tlvh, - u_int16_t subtotal, u_int16_t total) = NULL; + uint16_t sum, total; + uint16_t (*subfunc)(struct vty * vty, struct tlv_header * tlvh, + uint16_t subtotal, uint16_t total) = NULL; sum = 0; total = ntohs(lsah->length) - OSPF_LSA_HEADER_SIZE; diff --git a/ospfd/ospf_te.h b/ospfd/ospf_te.h index ff9397498..06c17f07f 100644 --- a/ospfd/ospf_te.h +++ b/ospfd/ospf_te.h @@ -123,8 +123,8 @@ struct te_link_subtlv_link_type { struct { #define LINK_TYPE_SUBTLV_VALUE_PTP 1 #define LINK_TYPE_SUBTLV_VALUE_MA 2 - u_char value; - u_char padding[3]; + uint8_t value; + uint8_t padding[3]; } link_type; }; @@ -153,7 +153,7 @@ struct te_link_subtlv_rmtif_ipaddr { #define TE_LINK_SUBTLV_TE_METRIC 5 struct te_link_subtlv_te_metric { struct tlv_header header; /* Value length is 4 octets. */ - u_int32_t value; /* Link metric for TE purpose. */ + uint32_t value; /* Link metric for TE purpose. */ }; /* Link Sub-TLV: Maximum Bandwidth */ /* Optional */ @@ -182,7 +182,7 @@ struct te_link_subtlv_unrsv_bw { #define TE_LINK_SUBTLV_RSC_CLSCLR 9 struct te_link_subtlv_rsc_clsclr { struct tlv_header header; /* Value length is 4 octets. */ - u_int32_t value; /* Admin. group membership. */ + uint32_t value; /* Admin. group membership. */ }; /* For RFC6827 */ @@ -200,8 +200,8 @@ struct te_link_subtlv_lrrid { #define TE_LINK_SUBTLV_LLRI_SIZE 8 struct te_link_subtlv_llri { struct tlv_header header; /* Value length is 8 octets. */ - u_int32_t local; /* Link Local Identifier */ - u_int32_t remote; /* Link Remote Identifier */ + uint32_t local; /* Link Local Identifier */ + uint32_t remote; /* Link Remote Identifier */ }; /* Inter-RA Export Upward sub-TLV (12) and Inter-RA Export Downward sub-TLV (13) @@ -215,7 +215,7 @@ struct te_link_subtlv_llri { #define TE_LINK_SUBTLV_RAS 21 struct te_link_subtlv_ras { struct tlv_header header; /* Value length is 4 octets. */ - u_int32_t value; /* Remote AS number */ + uint32_t value; /* Remote AS number */ }; /* IPv4 Remote ASBR ID Sub-TLV */ @@ -240,7 +240,7 @@ struct te_link_subtlv_av_delay { * delay in micro-seconds only 24 bits => 0 ... 16777215 * with Anomalous Bit as Upper most bit */ - u_int32_t value; + uint32_t value; }; /* Link Sub-TLV: Low/High Link Delay */ @@ -252,9 +252,9 @@ struct te_link_subtlv_mm_delay { * low delay in micro-seconds only 24 bits => 0 ... 16777215 * with Anomalous Bit (A) as Upper most bit */ - u_int32_t low; + uint32_t low; /* high delay in micro-seconds only 24 bits => 0 ... 16777215 */ - u_int32_t high; + uint32_t high; }; /* Link Sub-TLV: Link Delay Variation i.e. Jitter */ @@ -262,7 +262,7 @@ struct te_link_subtlv_mm_delay { struct te_link_subtlv_delay_var { struct tlv_header header; /* Value length is 4 bytes. */ /* interval in micro-seconds only 24 bits => 0 ... 16777215 */ - u_int32_t value; + uint32_t value; }; /* Link Sub-TLV: Routine Unidirectional Link Packet Loss */ @@ -273,7 +273,7 @@ struct te_link_subtlv_pkt_loss { * in percentage of total traffic only 24 bits (2^24 - 2) * with Anomalous Bit as Upper most bit */ - u_int32_t value; + uint32_t value; }; /* Link Sub-TLV: Unidirectional Residual Bandwidth */ /* Optional */ @@ -311,23 +311,23 @@ enum inter_as_mode { Off, AS, Area }; struct te_link_subtlv { struct tlv_header header; union { - u_int32_t link_type; + uint32_t link_type; struct in_addr link_id; struct in_addr lclif; struct in_addr rmtif; - u_int32_t te_metric; + uint32_t te_metric; float max_bw; float max_rsv_bw; float unrsv[8]; - u_int32_t rsc_clsclr; - u_int32_t llri[2]; - u_int32_t ras; + uint32_t rsc_clsclr; + uint32_t llri[2]; + uint32_t ras; struct in_addr rip; struct in_addr lrrid[2]; - u_int32_t av_delay; - u_int32_t mm_delay; - u_int32_t delay_var; - u_int32_t pkt_loss; + uint32_t av_delay; + uint32_t mm_delay; + uint32_t delay_var; + uint32_t pkt_loss; float res_bw; float ava_bw; float use_bw; @@ -357,7 +357,7 @@ struct mpls_te_link { * is subdivided into 8-bit "unused" field and 16-bit "instance" field. * In this implementation, each Link-TLV has its own instance. */ - u_int32_t instance; + uint32_t instance; /* Reference pointer to a Zebra-interface. */ struct interface *ifp; @@ -366,10 +366,10 @@ struct mpls_te_link { struct ospf_area *area; /* Flags to manage this link parameters. */ - u_int32_t flags; + uint32_t flags; /* Type of MPLS-TE link: RFC3630, RFC5392, RFC5392 emulated, RFC6827 */ - u_int8_t type; + uint8_t type; /* Store Link-TLV in network byte order. */ /* RFC3630 & RFC6827 / RFC 6827 */ @@ -410,7 +410,7 @@ extern void ospf_mpls_te_finish(void); extern struct ospf_mpls_te *get_ospf_mpls_te(void); extern void ospf_mpls_te_update_if(struct interface *); extern void ospf_mpls_te_lsa_schedule(struct mpls_te_link *, enum lsa_opcode); -extern void set_linkparams_llri(struct mpls_te_link *, u_int32_t, u_int32_t); +extern void set_linkparams_llri(struct mpls_te_link *, uint32_t, uint32_t); extern void set_linkparams_lrrid(struct mpls_te_link *, struct in_addr, struct in_addr); diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index ee53497af..741607918 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -135,7 +135,7 @@ int ospf_oi_count(struct interface *ifp) static struct ospf *ospf_cmd_lookup_ospf(struct vty *vty, struct cmd_token *argv[], const int argc, uint32_t enable, - u_short *instance) + unsigned short *instance) { struct ospf *ospf = NULL; int idx_vrf = 0, idx_inst = 0; @@ -165,7 +165,7 @@ static struct ospf *ospf_cmd_lookup_ospf(struct vty *vty, } static void ospf_show_vrf_name(struct ospf *ospf, struct vty *vty, - json_object *json, u_char use_vrf) + json_object *json, uint8_t use_vrf) { if (use_vrf) { if (json) { @@ -199,7 +199,7 @@ DEFUN_NOSH (router_ospf, { struct ospf *ospf = NULL; int ret = CMD_SUCCESS; - u_short instance = 0; + unsigned short instance = 0; struct vrf *vrf = NULL; struct route_node *rn; struct interface *ifp; @@ -266,7 +266,7 @@ DEFUN (no_router_ospf, VRF_CMD_HELP_STR) { struct ospf *ospf; - u_short instance = 0; + unsigned short instance = 0; ospf = ospf_cmd_lookup_ospf(vty, argv, argc, 0, &instance); if (ospf == NULL) { @@ -377,7 +377,7 @@ DEFPY (no_ospf_router_id, } -static void ospf_passive_interface_default(struct ospf *ospf, u_char newval) +static void ospf_passive_interface_default(struct ospf *ospf, uint8_t newval) { struct vrf *vrf = vrf_lookup_by_id(ospf->vrf_id); struct listnode *ln; @@ -402,10 +402,10 @@ static void ospf_passive_interface_default(struct ospf *ospf, u_char newval) static void ospf_passive_interface_update_addr(struct ospf *ospf, struct interface *ifp, struct ospf_if_params *params, - u_char value, + uint8_t value, struct in_addr addr) { - u_char dflt; + uint8_t dflt; params->passive_interface = value; if (params != IF_DEF_PARAMS(ifp)) { @@ -428,7 +428,7 @@ static void ospf_passive_interface_update_addr(struct ospf *ospf, static void ospf_passive_interface_update(struct ospf *ospf, struct interface *ifp, struct ospf_if_params *params, - u_char value) + uint8_t value) { params->passive_interface = value; if (params == IF_DEF_PARAMS(ifp)) { @@ -680,7 +680,7 @@ DEFUN (ospf_area_range, struct prefix_ipv4 p; struct in_addr area_id; int format; - u_int32_t cost; + uint32_t cost; VTY_GET_OSPF_AREA_ID(area_id, format, argv[idx_ipv4_number]->arg); str2prefix_ipv4(argv[idx_ipv4_prefixlen]->arg, &p); @@ -712,7 +712,7 @@ DEFUN (ospf_area_range_cost, struct prefix_ipv4 p; struct in_addr area_id; int format; - u_int32_t cost; + uint32_t cost; VTY_GET_OSPF_AREA_ID(area_id, format, argv[idx_ipv4_number]->arg); str2prefix_ipv4(argv[idx_ipv4_prefixlen]->arg, &p); @@ -912,7 +912,7 @@ ospf_find_vl_data(struct ospf *ospf, struct ospf_vl_config_data *vl_config) : "stub"); else vty_out(vty, "Area %ld is %s\n", - (u_long)ntohl(area_id.s_addr), + (unsigned long)ntohl(area_id.s_addr), area->external_routing == OSPF_AREA_NSSA ? "nssa" : "stub"); @@ -1678,7 +1678,7 @@ DEFUN (ospf_area_default_cost, int idx_number = 3; struct ospf_area *area; struct in_addr area_id; - u_int32_t cost; + uint32_t cost; int format; struct prefix_ipv4 p; @@ -2054,7 +2054,7 @@ DEFUN (ospf_abr_type, { VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); int idx_vendor = 2; - u_char abr_type = OSPF_ABR_UNKNOWN; + uint8_t abr_type = OSPF_ABR_UNKNOWN; if (strncmp(argv[idx_vendor]->arg, "c", 1) == 0) abr_type = OSPF_ABR_CISCO; @@ -2089,7 +2089,7 @@ DEFUN (no_ospf_abr_type, { VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); int idx_vendor = 3; - u_char abr_type = OSPF_ABR_UNKNOWN; + uint8_t abr_type = OSPF_ABR_UNKNOWN; if (strncmp(argv[idx_vendor]->arg, "c", 1) == 0) abr_type = OSPF_ABR_CISCO; @@ -2542,7 +2542,7 @@ DEFUN (ospf_auto_cost_reference_bandwidth, VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); struct vrf *vrf = vrf_lookup_by_id(ospf->vrf_id); int idx_number = 2; - u_int32_t refbw; + uint32_t refbw; struct interface *ifp; refbw = strtol(argv[idx_number]->arg, NULL, 10); @@ -2597,7 +2597,7 @@ DEFUN (ospf_write_multiplier, { VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); int idx_number; - u_int32_t write_oi_count; + uint32_t write_oi_count; if (argc == 3) idx_number = 2; @@ -2644,7 +2644,7 @@ const char *ospf_abr_type_descr_str[] = {"Unknown", "Standard (RFC2328)", const char *ospf_shortcut_mode_descr_str[] = {"Default", "Enabled", "Disabled"}; static void show_ip_ospf_area(struct vty *vty, struct ospf_area *area, - json_object *json_areas, u_char use_json) + json_object *json_areas, uint8_t use_json) { json_object *json_area = NULL; @@ -2950,7 +2950,7 @@ static void show_ip_ospf_area(struct vty *vty, struct ospf_area *area, } static int show_ip_ospf_common(struct vty *vty, struct ospf *ospf, - json_object *json, u_char use_vrf) + json_object *json, uint8_t use_vrf) { struct listnode *node, *nnode; struct ospf_area *area; @@ -3264,7 +3264,7 @@ DEFUN (show_ip_ospf, JSON_STR) { struct ospf *ospf; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct listnode *node = NULL; char *vrf_name = NULL; bool all_vrf = FALSE; @@ -3272,7 +3272,7 @@ DEFUN (show_ip_ospf, int inst = 0; int idx_vrf = 0; json_object *json = NULL; - u_char use_vrf = 0; + uint8_t use_vrf = 0; if (listcount(om->ospf) == 0) return CMD_SUCCESS; @@ -3341,8 +3341,8 @@ DEFUN (show_ip_ospf_instance, { int idx_number = 3; struct ospf *ospf; - u_short instance = 0; - u_char uj = use_json(argc, argv); + unsigned short instance = 0; + uint8_t uj = use_json(argc, argv); int ret = CMD_SUCCESS; json_object *json = NULL; @@ -3371,7 +3371,7 @@ DEFUN (show_ip_ospf_instance, static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf, struct interface *ifp, json_object *json_interface_sub, - u_char use_json) + uint8_t use_json) { int is_up; struct ospf_neighbor *nbr; @@ -3687,8 +3687,8 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf, } static int show_ip_ospf_interface_common(struct vty *vty, struct ospf *ospf, - char *intf_name, u_char use_vrf, - json_object *json, u_char use_json) + char *intf_name, uint8_t use_vrf, + json_object *json, uint8_t use_json) { struct interface *ifp; struct vrf *vrf = vrf_lookup_by_id(ospf->vrf_id); @@ -3781,7 +3781,7 @@ static int show_ip_ospf_interface_common(struct vty *vty, struct ospf *ospf, static void show_ip_ospf_interface_traffic_sub(struct vty *vty, struct ospf_interface *oi, json_object *json_interface_sub, - u_char use_json) + uint8_t use_json) { if (use_json) { json_object_int_add(json_interface_sub, "ifIndex", @@ -3819,7 +3819,7 @@ static void show_ip_ospf_interface_traffic_sub(struct vty *vty, /* OSPFv2 Packet Counters */ static int show_ip_ospf_interface_traffic_common( struct vty *vty, struct ospf *ospf, char *intf_name, json_object *json, - int display_once, u_char use_vrf, u_char use_json) + int display_once, uint8_t use_vrf, uint8_t use_json) { struct vrf *vrf = NULL; struct interface *ifp = NULL; @@ -3937,14 +3937,14 @@ DEFUN (show_ip_ospf_interface, JSON_STR) { struct ospf *ospf; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct listnode *node = NULL; char *vrf_name = NULL, *intf_name = NULL; bool all_vrf = FALSE; int ret = CMD_SUCCESS; int inst = 0; int idx_vrf = 0, idx_intf = 0; - u_char use_vrf = 0; + uint8_t use_vrf = 0; json_object *json = NULL; OSPF_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); @@ -4020,8 +4020,8 @@ DEFUN (show_ip_ospf_instance_interface, int idx_number = 3; int idx_intf = 0; struct ospf *ospf; - u_short instance = 0; - u_char uj = use_json(argc, argv); + unsigned short instance = 0; + uint8_t uj = use_json(argc, argv); char *intf_name = NULL; int ret = CMD_SUCCESS; json_object *json = NULL; @@ -4070,11 +4070,11 @@ DEFUN (show_ip_ospf_interface_traffic, bool all_vrf = FALSE; int inst = 0; int idx_vrf = 0, idx_intf = 0; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); json_object *json = NULL; int ret = CMD_SUCCESS; int display_once = 0; - u_char use_vrf = 0; + uint8_t use_vrf = 0; OSPF_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); @@ -4146,7 +4146,7 @@ static void show_ip_ospf_neighbour_header(struct vty *vty) static void show_ip_ospf_neighbor_sub(struct vty *vty, struct ospf_interface *oi, - json_object *json, u_char use_json) + json_object *json, uint8_t use_json) { struct route_node *rn; struct ospf_neighbor *nbr, *prev_nbr = NULL; @@ -4257,8 +4257,8 @@ static void show_ip_ospf_neighbor_sub(struct vty *vty, } static int show_ip_ospf_neighbor_common(struct vty *vty, struct ospf *ospf, - json_object *json, u_char use_json, - u_char use_vrf) + json_object *json, uint8_t use_json, + uint8_t use_vrf) { struct ospf_interface *oi; struct listnode *node; @@ -4319,14 +4319,14 @@ DEFUN (show_ip_ospf_neighbor, JSON_STR) { struct ospf *ospf; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct listnode *node = NULL; char *vrf_name = NULL; bool all_vrf = FALSE; int ret = CMD_SUCCESS; int inst = 0; int idx_vrf = 0; - u_char use_vrf = 0; + uint8_t use_vrf = 0; json_object *json = NULL; OSPF_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); @@ -4401,8 +4401,8 @@ DEFUN (show_ip_ospf_instance_neighbor, { int idx_number = 3; struct ospf *ospf; - u_short instance = 0; - u_char uj = use_json(argc, argv); + unsigned short instance = 0; + uint8_t uj = use_json(argc, argv); json_object *json = NULL; int ret = CMD_SUCCESS; @@ -4429,8 +4429,8 @@ DEFUN (show_ip_ospf_instance_neighbor, } static int show_ip_ospf_neighbor_all_common(struct vty *vty, struct ospf *ospf, - json_object *json, u_char use_json, - u_char use_vrf) + json_object *json, uint8_t use_json, + uint8_t use_vrf) { struct listnode *node; struct ospf_interface *oi; @@ -4532,14 +4532,14 @@ DEFUN (show_ip_ospf_neighbor_all, JSON_STR) { struct ospf *ospf; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct listnode *node = NULL; char *vrf_name = NULL; bool all_vrf = FALSE; int ret = CMD_SUCCESS; int inst = 0; int idx_vrf = 0; - u_char use_vrf = 0; + uint8_t use_vrf = 0; json_object *json = NULL; OSPF_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); @@ -4613,8 +4613,8 @@ DEFUN (show_ip_ospf_instance_neighbor_all, { int idx_number = 3; struct ospf *ospf; - u_short instance = 0; - u_char uj = use_json(argc, argv); + unsigned short instance = 0; + uint8_t uj = use_json(argc, argv); json_object *json = NULL; int ret = CMD_SUCCESS; @@ -4642,7 +4642,7 @@ DEFUN (show_ip_ospf_instance_neighbor_all, static int show_ip_ospf_neighbor_int_common(struct vty *vty, struct ospf *ospf, int arg_base, struct cmd_token **argv, - u_char use_json, u_char use_vrf) + uint8_t use_json, uint8_t use_vrf) { struct interface *ifp; struct route_node *rn; @@ -4701,7 +4701,7 @@ DEFUN (show_ip_ospf_neighbor_int, { struct ospf *ospf; int idx_ifname = 4; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct listnode *node = NULL; int ret = CMD_SUCCESS; struct interface *ifp = NULL; @@ -4736,8 +4736,8 @@ DEFUN (show_ip_ospf_instance_neighbor_int, int idx_number = 3; int idx_ifname = 5; struct ospf *ospf; - u_short instance = 0; - u_char uj = use_json(argc, argv); + unsigned short instance = 0; + uint8_t uj = use_json(argc, argv); if (!uj) show_ip_ospf_neighbour_header(vty); @@ -4760,7 +4760,8 @@ DEFUN (show_ip_ospf_instance_neighbor_int, static void show_ip_ospf_nbr_nbma_detail_sub(struct vty *vty, struct ospf_interface *oi, struct ospf_nbr_nbma *nbr_nbma, - u_char use_json, json_object *json) + uint8_t use_json, + json_object *json) { char timebuf[OSPF_TIME_DUMP_SIZE]; json_object *json_sub = NULL; @@ -4837,7 +4838,8 @@ static void show_ip_ospf_nbr_nbma_detail_sub(struct vty *vty, static void show_ip_ospf_neighbor_detail_sub(struct vty *vty, struct ospf_interface *oi, struct ospf_neighbor *nbr, - json_object *json, u_char use_json) + json_object *json, + uint8_t use_json) { char timebuf[OSPF_TIME_DUMP_SIZE]; json_object *json_sub = NULL; @@ -5053,7 +5055,7 @@ static void show_ip_ospf_neighbor_detail_sub(struct vty *vty, static int show_ip_ospf_neighbor_id_common(struct vty *vty, struct ospf *ospf, int arg_base, struct cmd_token **argv, - u_char use_json, u_char use_vrf) + uint8_t use_json, uint8_t use_vrf) { struct listnode *node; struct ospf_neighbor *nbr; @@ -5114,7 +5116,7 @@ DEFUN (show_ip_ospf_neighbor_id, JSON_STR) { struct ospf *ospf; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct listnode *node = NULL; int ret = CMD_SUCCESS; @@ -5142,8 +5144,8 @@ DEFUN (show_ip_ospf_instance_neighbor_id, int idx_number = 3; int idx_router_id = 5; struct ospf *ospf; - u_short instance = 0; - u_char uj = use_json(argc, argv); + unsigned short instance = 0; + uint8_t uj = use_json(argc, argv); instance = strtoul(argv[idx_number]->arg, NULL, 10); ospf = ospf_lookup_instance(instance); @@ -5160,7 +5162,8 @@ DEFUN (show_ip_ospf_instance_neighbor_id, static int show_ip_ospf_neighbor_detail_common(struct vty *vty, struct ospf *ospf, json_object *json, - u_char use_json, u_char use_vrf) + uint8_t use_json, + uint8_t use_vrf) { struct ospf_interface *oi; struct listnode *node; @@ -5227,14 +5230,14 @@ DEFUN (show_ip_ospf_neighbor_detail, JSON_STR) { struct ospf *ospf; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct listnode *node = NULL; char *vrf_name = NULL; bool all_vrf = FALSE; int ret = CMD_SUCCESS; int inst = 0; int idx_vrf = 0; - u_char use_vrf = 0; + uint8_t use_vrf = 0; json_object *json = NULL; OSPF_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); @@ -5306,8 +5309,8 @@ DEFUN (show_ip_ospf_instance_neighbor_detail, { int idx_number = 3; struct ospf *ospf; - u_short instance = 0; - u_char uj = use_json(argc, argv); + unsigned short instance = 0; + uint8_t uj = use_json(argc, argv); json_object *json = NULL; int ret = CMD_SUCCESS; @@ -5336,8 +5339,8 @@ DEFUN (show_ip_ospf_instance_neighbor_detail, static int show_ip_ospf_neighbor_detail_all_common(struct vty *vty, struct ospf *ospf, json_object *json, - u_char use_json, - u_char use_vrf) + uint8_t use_json, + uint8_t use_vrf) { struct listnode *node; struct ospf_interface *oi; @@ -5416,14 +5419,14 @@ DEFUN (show_ip_ospf_neighbor_detail_all, JSON_STR) { struct ospf *ospf; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct listnode *node = NULL; char *vrf_name = NULL; bool all_vrf = FALSE; int ret = CMD_SUCCESS; int inst = 0; int idx_vrf = 0; - u_char use_vrf = 0; + uint8_t use_vrf = 0; json_object *json = NULL; OSPF_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); @@ -5497,8 +5500,8 @@ DEFUN (show_ip_ospf_instance_neighbor_detail_all, { int idx_number = 3; struct ospf *ospf; - u_short instance = 0; - u_char uj = use_json(argc, argv); + unsigned short instance = 0; + uint8_t uj = use_json(argc, argv); json_object *json = NULL; int ret = CMD_SUCCESS; @@ -5528,7 +5531,7 @@ static int show_ip_ospf_neighbor_int_detail_common(struct vty *vty, struct ospf *ospf, int arg_base, struct cmd_token **argv, - u_char use_json) + uint8_t use_json) { struct ospf_interface *oi; struct interface *ifp; @@ -5596,7 +5599,7 @@ DEFUN (show_ip_ospf_neighbor_int_detail, JSON_STR) { struct ospf *ospf; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct listnode *node = NULL; int ret = CMD_SUCCESS; @@ -5625,8 +5628,8 @@ DEFUN (show_ip_ospf_instance_neighbor_int_detail, int idx_number = 3; int idx_ifname = 5; struct ospf *ospf; - u_short instance = 0; - u_char uj = use_json(argc, argv); + unsigned short instance = 0; + uint8_t uj = use_json(argc, argv); instance = strtoul(argv[idx_number]->arg, NULL, 10); ospf = ospf_lookup_instance(instance); @@ -5655,7 +5658,7 @@ static int show_lsa_summary(struct vty *vty, struct ospf_lsa *lsa, int self) vty_out(vty, "%-15s ", inet_ntoa(lsa->data->id)); vty_out(vty, "%-15s %4d 0x%08lx 0x%04x", inet_ntoa(lsa->data->adv_router), LS_AGE(lsa), - (u_long)ntohl(lsa->data->ls_seqnum), + (unsigned long)ntohl(lsa->data->ls_seqnum), ntohs(lsa->data->checksum)); /* LSA specific part show. */ switch (lsa->data->type) { @@ -5688,7 +5691,8 @@ static int show_lsa_summary(struct vty *vty, struct ospf_lsa *lsa, int self) ? "E2" : "E1", inet_ntoa(p.prefix), p.prefixlen, - (u_long)ntohl(asel->e[0].route_tag)); + (unsigned long)ntohl( + asel->e[0].route_tag)); break; case OSPF_NETWORK_LSA: case OSPF_ASBR_SUMMARY_LSA: @@ -5766,7 +5770,7 @@ static void show_ip_ospf_database_header(struct vty *vty, struct ospf_lsa *lsa) vty_out(vty, " Advertising Router: %s\n", inet_ntoa(lsa->data->adv_router)); vty_out(vty, " LS Seq Number: %08lx\n", - (u_long)ntohl(lsa->data->ls_seqnum)); + (unsigned long)ntohl(lsa->data->ls_seqnum)); vty_out(vty, " Checksum: 0x%04x\n", ntohs(lsa->data->checksum)); vty_out(vty, " Length: %d\n\n", ntohs(lsa->data->length)); } @@ -6209,7 +6213,8 @@ static void show_ip_ospf_database_maxage(struct vty *vty, struct ospf *ospf) static int show_ip_ospf_database_common(struct vty *vty, struct ospf *ospf, int arg_base, int argc, - struct cmd_token **argv, u_char use_vrf) + struct cmd_token **argv, + uint8_t use_vrf) { int idx_type = 4; int type, ret; @@ -6304,7 +6309,7 @@ DEFUN (show_ip_ospf_database_max, int ret = CMD_SUCCESS; int inst = 0; int idx_vrf = 0; - u_char use_vrf = 0; + uint8_t use_vrf = 0; OSPF_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); @@ -6354,14 +6359,14 @@ DEFUN (show_ip_ospf_instance_database, "Advertising Router (as an IP address)\n") { struct ospf *ospf; - u_short instance = 0; + unsigned short instance = 0; struct listnode *node = NULL; char *vrf_name = NULL; bool all_vrf = FALSE; int ret = CMD_SUCCESS; int inst = 0; int idx = 0; - u_char use_vrf = 0; + uint8_t use_vrf = 0; if (argv_find(argv, argc, "(1-65535)", &idx)) { instance = strtoul(argv[idx]->arg, NULL, 10); @@ -6420,7 +6425,7 @@ DEFUN (show_ip_ospf_instance_database_max, { int idx_number = 3; struct ospf *ospf; - u_short instance = 0; + unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); @@ -6439,7 +6444,7 @@ static int show_ip_ospf_database_type_adv_router_common(struct vty *vty, struct ospf *ospf, int arg_base, int argc, struct cmd_token **argv, - u_char use_vrf) + uint8_t use_vrf) { int idx_type = 4; int type, ret; @@ -6504,14 +6509,14 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router, "Self-originated link states\n") { struct ospf *ospf = NULL; - u_short instance = 0; + unsigned short instance = 0; struct listnode *node = NULL; char *vrf_name = NULL; bool all_vrf = FALSE; int ret = CMD_SUCCESS; int inst = 0; int idx = 0, idx_vrf = 0; - u_char use_vrf = 0; + uint8_t use_vrf = 0; if (argv_find(argv, argc, "(1-65535)", &idx)) { instance = strtoul(argv[idx]->arg, NULL, 10); @@ -6905,7 +6910,7 @@ DEFUN (ip_ospf_message_digest_key, { VTY_DECLVAR_CONTEXT(interface, ifp); struct crypt_key *ck; - u_char key_id; + uint8_t key_id; struct in_addr addr; struct ospf_if_params *params; @@ -6935,7 +6940,7 @@ DEFUN (ip_ospf_message_digest_key, } ck = ospf_crypt_key_new(); - ck->key_id = (u_char)key_id; + ck->key_id = (uint8_t)key_id; memset(ck->auth_key, 0, OSPF_AUTH_MD5_SIZE + 1); strncpy((char *)ck->auth_key, cryptkey, OSPF_AUTH_MD5_SIZE); @@ -7035,7 +7040,7 @@ DEFUN (ip_ospf_cost, { VTY_DECLVAR_CONTEXT(interface, ifp); int idx = 0; - u_int32_t cost = OSPF_OUTPUT_COST_DEFAULT; + uint32_t cost = OSPF_OUTPUT_COST_DEFAULT; struct in_addr addr; struct ospf_if_params *params; params = IF_DEF_PARAMS(ifp); @@ -7158,8 +7163,8 @@ static int ospf_vty_dead_interval_set(struct vty *vty, const char *interval_str, const char *fast_hello_str) { VTY_DECLVAR_CONTEXT(interface, ifp); - u_int32_t seconds; - u_char hellomult; + uint32_t seconds; + uint8_t hellomult; struct in_addr addr; int ret; struct ospf_if_params *params; @@ -7366,7 +7371,7 @@ DEFUN (ip_ospf_hello_interval, struct in_addr addr; struct ospf_if_params *params; params = IF_DEF_PARAMS(ifp); - u_int32_t seconds = 0; + uint32_t seconds = 0; argv_find(argv, argc, "(1-65535)", &idx); seconds = strtol(argv[idx]->arg, NULL, 10); @@ -7705,7 +7710,7 @@ DEFUN (ip_ospf_retransmit_interval, { VTY_DECLVAR_CONTEXT(interface, ifp); int idx = 0; - u_int32_t seconds; + uint32_t seconds; struct in_addr addr; struct ospf_if_params *params; params = IF_DEF_PARAMS(ifp); @@ -7804,7 +7809,7 @@ DEFUN (ip_ospf_transmit_delay, { VTY_DECLVAR_CONTEXT(interface, ifp); int idx = 0; - u_int32_t seconds; + uint32_t seconds; struct in_addr addr; struct ospf_if_params *params; @@ -7912,7 +7917,7 @@ DEFUN (ip_ospf_area, struct ospf_if_params *params = NULL; struct route_node *rn; struct ospf *ospf = NULL; - u_short instance = 0; + unsigned short instance = 0; char *areaid; if (argv_find(argv, argc, "(1-65535)", &idx)) @@ -8013,7 +8018,7 @@ DEFUN (no_ip_ospf_area, int idx = 0; struct ospf *ospf; struct ospf_if_params *params; - u_short instance = 0; + unsigned short instance = 0; struct in_addr addr; if (argv_find(argv, argc, "(1-65535)", &idx)) @@ -8161,7 +8166,7 @@ DEFUN (ospf_redistribute_instance_source, int source; int type = -1; int metric = -1; - u_short instance; + unsigned short instance; struct ospf_redist *red; if (!ospf) @@ -8225,7 +8230,7 @@ DEFUN (no_ospf_redistribute_instance_source, VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); int idx_ospf_table = 2; int idx_number = 3; - u_int instance; + unsigned int instance; struct ospf_redist *red; int source; @@ -9257,7 +9262,8 @@ static void show_ip_ospf_route_external(struct vty *vty, struct ospf *ospf, } static int show_ip_ospf_border_routers_common(struct vty *vty, - struct ospf *ospf, u_char use_vrf) + struct ospf *ospf, + uint8_t use_vrf) { if (ospf->instance) vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance); @@ -9297,7 +9303,7 @@ DEFUN (show_ip_ospf_border_routers, int ret = CMD_SUCCESS; int inst = 0; int idx_vrf = 0; - u_char use_vrf = 0; + uint8_t use_vrf = 0; OSPF_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); @@ -9341,7 +9347,7 @@ DEFUN (show_ip_ospf_instance_border_routers, { int idx_number = 3; struct ospf *ospf; - u_short instance = 0; + unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); ospf = ospf_lookup_instance(instance); @@ -9355,7 +9361,7 @@ DEFUN (show_ip_ospf_instance_border_routers, } static int show_ip_ospf_route_common(struct vty *vty, struct ospf *ospf, - json_object *json, u_char use_vrf) + json_object *json, uint8_t use_vrf) { json_object *json_vrf = NULL; @@ -9423,8 +9429,8 @@ DEFUN (show_ip_ospf_route, int ret = CMD_SUCCESS; int inst = 0; int idx_vrf = 0; - u_char use_vrf = 0; - u_char uj = use_json(argc, argv); + uint8_t use_vrf = 0; + uint8_t uj = use_json(argc, argv); json_object *json = NULL; if (uj) @@ -9492,7 +9498,7 @@ DEFUN (show_ip_ospf_instance_route, { int idx_number = 3; struct ospf *ospf; - u_short instance = 0; + unsigned short instance = 0; instance = strtoul(argv[idx_number]->arg, NULL, 10); ospf = ospf_lookup_instance(instance); @@ -9515,7 +9521,7 @@ DEFUN (show_ip_ospf_vrfs, "Show OSPF VRFs \n" JSON_STR) { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); json_object *json = NULL; json_object *json_vrfs = NULL; struct ospf *ospf = NULL; @@ -9853,7 +9859,7 @@ static int config_write_interface(struct vty *vty) static int config_write_network_area(struct vty *vty, struct ospf *ospf) { struct route_node *rn; - u_char buf[INET_ADDRSTRLEN]; + uint8_t buf[INET_ADDRSTRLEN]; /* `network area' print. */ for (rn = route_top(ospf->networks); rn; rn = route_next(rn)) @@ -9884,7 +9890,7 @@ static int config_write_ospf_area(struct vty *vty, struct ospf *ospf) { struct listnode *node; struct ospf_area *area; - u_char buf[INET_ADDRSTRLEN]; + uint8_t buf[INET_ADDRSTRLEN]; /* Area configuration print. */ for (ALL_LIST_ELEMENTS_RO(ospf->areas, node, area)) { diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index e322f6050..23d00633d 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -384,7 +384,7 @@ void ospf_zebra_add(struct ospf *ospf, struct prefix_ipv4 *p, { struct zapi_route api; struct zapi_nexthop *api_nh; - u_char distance; + uint8_t distance; struct ospf_path *path; struct listnode *node; int count = 0; @@ -522,8 +522,8 @@ void ospf_zebra_delete_discard(struct ospf *ospf, struct prefix_ipv4 *p) inet_ntoa(p->prefix), p->prefixlen); } -struct ospf_external *ospf_external_lookup(struct ospf *ospf, u_char type, - u_short instance) +struct ospf_external *ospf_external_lookup(struct ospf *ospf, uint8_t type, + unsigned short instance) { struct list *ext_list; struct listnode *node; @@ -540,8 +540,8 @@ struct ospf_external *ospf_external_lookup(struct ospf *ospf, u_char type, return NULL; } -struct ospf_external *ospf_external_add(struct ospf *ospf, u_char type, - u_short instance) +struct ospf_external *ospf_external_add(struct ospf *ospf, uint8_t type, + unsigned short instance) { struct list *ext_list; struct ospf_external *ext; @@ -564,7 +564,7 @@ struct ospf_external *ospf_external_add(struct ospf *ospf, u_char type, return ext; } -void ospf_external_del(struct ospf *ospf, u_char type, u_short instance) +void ospf_external_del(struct ospf *ospf, uint8_t type, unsigned short instance) { struct ospf_external *ext; @@ -583,8 +583,8 @@ void ospf_external_del(struct ospf *ospf, u_char type, u_short instance) } } -struct ospf_redist *ospf_redist_lookup(struct ospf *ospf, u_char type, - u_short instance) +struct ospf_redist *ospf_redist_lookup(struct ospf *ospf, uint8_t type, + unsigned short instance) { struct list *red_list; struct listnode *node; @@ -601,8 +601,8 @@ struct ospf_redist *ospf_redist_lookup(struct ospf *ospf, u_char type, return NULL; } -struct ospf_redist *ospf_redist_add(struct ospf *ospf, u_char type, - u_short instance) +struct ospf_redist *ospf_redist_add(struct ospf *ospf, uint8_t type, + unsigned short instance) { struct list *red_list; struct ospf_redist *red; @@ -626,7 +626,7 @@ struct ospf_redist *ospf_redist_add(struct ospf *ospf, u_char type, return red; } -void ospf_redist_del(struct ospf *ospf, u_char type, u_short instance) +void ospf_redist_del(struct ospf *ospf, uint8_t type, unsigned short instance) { struct ospf_redist *red; @@ -643,7 +643,8 @@ void ospf_redist_del(struct ospf *ospf, u_char type, u_short instance) } -int ospf_is_type_redistributed(struct ospf *ospf, int type, u_short instance) +int ospf_is_type_redistributed(struct ospf *ospf, int type, + unsigned short instance) { return (DEFAULT_ROUTE_TYPE(type) ? vrf_bitmap_check(zclient->default_information, @@ -658,7 +659,7 @@ int ospf_is_type_redistributed(struct ospf *ospf, int type, u_short instance) ospf->vrf_id)))); } -int ospf_redistribute_set(struct ospf *ospf, int type, u_short instance, +int ospf_redistribute_set(struct ospf *ospf, int type, unsigned short instance, int mtype, int mvalue) { int force = 0; @@ -707,7 +708,8 @@ int ospf_redistribute_set(struct ospf *ospf, int type, u_short instance, return CMD_SUCCESS; } -int ospf_redistribute_unset(struct ospf *ospf, int type, u_short instance) +int ospf_redistribute_unset(struct ospf *ospf, int type, + unsigned short instance) { if (type == zclient->redist_default && instance == zclient->instance) return CMD_SUCCESS; @@ -846,8 +848,8 @@ int ospf_redistribute_check(struct ospf *ospf, struct external_info *ei, struct route_map_set_values save_values; struct prefix_ipv4 *p = &ei->p; struct ospf_redist *red; - u_char type = is_prefix_default(&ei->p) ? DEFAULT_ROUTE : ei->type; - u_short instance = is_prefix_default(&ei->p) ? 0 : ei->instance; + uint8_t type = is_prefix_default(&ei->p) ? DEFAULT_ROUTE : ei->type; + unsigned short instance = is_prefix_default(&ei->p) ? 0 : ei->instance; if (changed) *changed = 0; @@ -1136,7 +1138,8 @@ static int ospf_distribute_list_update_timer(struct thread *thread) } /* Update distribute-list and set timer to apply access-list. */ -void ospf_distribute_list_update(struct ospf *ospf, int type, u_short instance) +void ospf_distribute_list_update(struct ospf *ospf, int type, + unsigned short instance) { struct route_table *rt; struct ospf_external *ext; @@ -1341,7 +1344,7 @@ int ospf_distance_set(struct vty *vty, struct ospf *ospf, { int ret; struct prefix_ipv4 p; - u_char distance; + uint8_t distance; struct route_node *rn; struct ospf_distance *odistance; @@ -1426,8 +1429,8 @@ void ospf_distance_reset(struct ospf *ospf) } } -u_char ospf_distance_apply(struct ospf *ospf, struct prefix_ipv4 *p, - struct ospf_route * or) +uint8_t ospf_distance_apply(struct ospf *ospf, struct prefix_ipv4 *p, + struct ospf_route * or) { if (ospf == NULL) @@ -1491,7 +1494,7 @@ static void ospf_zebra_connected(struct zclient *zclient) zclient_send_reg_requests(zclient, VRF_DEFAULT); } -void ospf_zebra_init(struct thread_master *master, u_short instance) +void ospf_zebra_init(struct thread_master *master, unsigned short instance) { /* Allocate zebra structure. */ zclient = zclient_new_notify(master, &zclient_options_default); diff --git a/ospfd/ospf_zebra.h b/ospfd/ospf_zebra.h index 236f5a263..673730653 100644 --- a/ospfd/ospf_zebra.h +++ b/ospfd/ospf_zebra.h @@ -34,7 +34,7 @@ /* OSPF distance. */ struct ospf_distance { /* Distance value for the IP source prefix. */ - u_char distance; + uint8_t distance; /* Name of the access-list to be matched. */ char *access_list; @@ -53,23 +53,26 @@ extern int ospf_redistribute_check(struct ospf *, struct external_info *, int *); extern int ospf_distribute_check_connected(struct ospf *, struct external_info *); -extern void ospf_distribute_list_update(struct ospf *, int, u_short); +extern void ospf_distribute_list_update(struct ospf *, int, unsigned short); -extern int ospf_is_type_redistributed(struct ospf *, int, u_short); +extern int ospf_is_type_redistributed(struct ospf *, int, unsigned short); extern void ospf_distance_reset(struct ospf *); -extern u_char ospf_distance_apply(struct ospf *ospf, struct prefix_ipv4 *, - struct ospf_route *); -extern struct ospf_external *ospf_external_lookup(struct ospf *, u_char, - u_short); -extern struct ospf_external *ospf_external_add(struct ospf *, u_char, u_short); -extern void ospf_external_del(struct ospf *, u_char, u_short); -extern struct ospf_redist *ospf_redist_lookup(struct ospf *, u_char, u_short); -extern struct ospf_redist *ospf_redist_add(struct ospf *, u_char, u_short); -extern void ospf_redist_del(struct ospf *, u_char, u_short); +extern uint8_t ospf_distance_apply(struct ospf *ospf, struct prefix_ipv4 *, + struct ospf_route *); +extern struct ospf_external *ospf_external_lookup(struct ospf *, uint8_t, + unsigned short); +extern struct ospf_external *ospf_external_add(struct ospf *, uint8_t, + unsigned short); +extern void ospf_external_del(struct ospf *, uint8_t, unsigned short); +extern struct ospf_redist *ospf_redist_lookup(struct ospf *, uint8_t, + unsigned short); +extern struct ospf_redist *ospf_redist_add(struct ospf *, uint8_t, + unsigned short); +extern void ospf_redist_del(struct ospf *, uint8_t, unsigned short); -extern int ospf_redistribute_set(struct ospf *, int, u_short, int, int); -extern int ospf_redistribute_unset(struct ospf *, int, u_short); +extern int ospf_redistribute_set(struct ospf *, int, unsigned short, int, int); +extern int ospf_redistribute_unset(struct ospf *, int, unsigned short); extern int ospf_redistribute_default_set(struct ospf *, int, int, int); extern int ospf_redistribute_default_unset(struct ospf *); extern int ospf_distribute_list_out_set(struct ospf *, int, const char *); @@ -80,7 +83,7 @@ extern int ospf_distance_set(struct vty *, struct ospf *, const char *, const char *, const char *); extern int ospf_distance_unset(struct vty *, struct ospf *, const char *, const char *, const char *); -extern void ospf_zebra_init(struct thread_master *, u_short); +extern void ospf_zebra_init(struct thread_master *, unsigned short); extern void ospf_zebra_vrf_register(struct ospf *ospf); extern void ospf_zebra_vrf_deregister(struct ospf *ospf); diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index 26bbc5ee1..4cf38439c 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -223,7 +223,7 @@ static int ospf_area_id_cmp(struct ospf_area *a1, struct ospf_area *a2) } /* Allocate new ospf structure. */ -static struct ospf *ospf_new(u_short instance, const char *name) +static struct ospf *ospf_new(unsigned short instance, const char *name) { int i; struct vrf *vrf = NULL; @@ -338,7 +338,7 @@ static struct ospf *ospf_new(u_short instance, const char *name) return new; } -struct ospf *ospf_lookup_instance(u_short instance) +struct ospf *ospf_lookup_instance(unsigned short instance) { struct ospf *ospf; struct listnode *node, *nnode; @@ -374,7 +374,7 @@ static void ospf_delete(struct ospf *ospf) listnode_delete(om->ospf, ospf); } -struct ospf *ospf_lookup_by_inst_name(u_short instance, const char *name) +struct ospf *ospf_lookup_by_inst_name(unsigned short instance, const char *name) { struct ospf *ospf = NULL; struct listnode *node, *nnode; @@ -389,7 +389,7 @@ struct ospf *ospf_lookup_by_inst_name(u_short instance, const char *name) return NULL; } -struct ospf *ospf_get(u_short instance, const char *name) +struct ospf *ospf_get(unsigned short instance, const char *name) { struct ospf *ospf; @@ -413,7 +413,7 @@ struct ospf *ospf_get(u_short instance, const char *name) return ospf; } -struct ospf *ospf_get_instance(u_short instance) +struct ospf *ospf_get_instance(unsigned short instance) { struct ospf *ospf; @@ -608,7 +608,7 @@ static void ospf_finish_final(struct ospf *ospf) struct ospf_vl_data *vl_data; struct listnode *node, *nnode; int i; - u_short instance = 0; + unsigned short instance = 0; QOBJ_UNREG(ospf); @@ -1941,7 +1941,7 @@ int ospf_nbr_nbma_unset(struct ospf *ospf, struct in_addr nbr_addr) } int ospf_nbr_nbma_priority_set(struct ospf *ospf, struct in_addr nbr_addr, - u_char priority) + uint8_t priority) { struct ospf_nbr_nbma *nbr_nbma; diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h index bed446085..bc9c68d57 100644 --- a/ospfd/ospfd.h +++ b/ospfd/ospfd.h @@ -81,7 +81,7 @@ #define OSPF_LS_REFRESH_JITTER 60 struct ospf_external { - u_short instance; + unsigned short instance; struct route_table *external_info; }; @@ -94,12 +94,12 @@ struct ospf_master { struct thread_master *master; /* Various OSPF global configuration. */ - u_char options; + uint8_t options; #define OSPF_MASTER_SHUTDOWN (1 << 0) /* deferred-shutdown */ }; struct ospf_redist { - u_short instance; + unsigned short instance; /* Redistribute metric info. */ struct { @@ -121,10 +121,10 @@ struct ospf_redist { struct ospf { /* OSPF's running state based on the '[no] router ospf [<instance>]' * config. */ - u_char oi_running; + uint8_t oi_running; /* OSPF instance ID */ - u_short instance; + unsigned short instance; /* OSPF Router ID. */ struct in_addr router_id; /* Configured automatically. */ @@ -135,12 +135,12 @@ struct ospf { char *name; /* VRF name */ /* ABR/ASBR internal flags. */ - u_char flags; + uint8_t flags; #define OSPF_FLAG_ABR 0x0001 #define OSPF_FLAG_ASBR 0x0002 /* ABR type. */ - u_char abr_type; + uint8_t abr_type; #define OSPF_ABR_UNKNOWN 0 #define OSPF_ABR_STAND 1 #define OSPF_ABR_IBM 2 @@ -149,24 +149,24 @@ struct ospf { #define OSPF_ABR_DEFAULT OSPF_ABR_CISCO /* NSSA ABR */ - u_char anyNSSA; /* Bump for every NSSA attached. */ + uint8_t anyNSSA; /* Bump for every NSSA attached. */ /* Configured variables. */ - u_char config; + uint8_t config; #define OSPF_RFC1583_COMPATIBLE (1 << 0) #define OSPF_OPAQUE_CAPABLE (1 << 2) #define OSPF_LOG_ADJACENCY_CHANGES (1 << 3) #define OSPF_LOG_ADJACENCY_DETAIL (1 << 4) /* Opaque-LSA administrative flags. */ - u_char opaque; + uint8_t opaque; #define OPAQUE_OPERATION_READY_BIT (1 << 0) /* RFC3137 stub router. Configured time to stay stub / max-metric */ unsigned int stub_router_startup_time; /* seconds */ unsigned int stub_router_shutdown_time; /* seconds */ #define OSPF_STUB_ROUTER_UNCONFIGURED 0 - u_char stub_router_admin_set; + uint8_t stub_router_admin_set; #define OSPF_STUB_ROUTER_ADMINISTRATIVE_SET 1 #define OSPF_STUB_ROUTER_ADMINISTRATIVE_UNSET 0 @@ -188,7 +188,7 @@ struct ospf { #define DEFAULT_ORIGINATE_NONE 0 #define DEFAULT_ORIGINATE_ZEBRA 1 #define DEFAULT_ORIGINATE_ALWAYS 2 - u_int32_t ref_bandwidth; /* Reference Bandwidth (Kbps). */ + uint32_t ref_bandwidth; /* Reference Bandwidth (Kbps). */ struct route_table *networks; /* OSPF config networks. */ struct list *vlinks; /* Configured Virtual-Links. */ struct list *areas; /* OSPF areas. */ @@ -196,7 +196,7 @@ struct ospf { struct ospf_area *backbone; /* Pointer to the Backbone Area. */ struct list *oiflist; /* ospf interfaces */ - u_char passive_interface_default; /* passive-interface default */ + uint8_t passive_interface_default; /* passive-interface default */ /* LSDB of AS-external-LSAs. */ struct ospf_lsdb *lsdb; @@ -276,31 +276,31 @@ struct ospf { / OSPF_LSA_REFRESHER_GRANULARITY \ + 1) struct { - u_int16_t index; + uint16_t index; struct list *qs[OSPF_LSA_REFRESHER_SLOTS]; } lsa_refresh_queue; struct thread *t_lsa_refresher; time_t lsa_refresher_started; #define OSPF_LSA_REFRESH_INTERVAL_DEFAULT 10 - u_int16_t lsa_refresh_interval; + uint16_t lsa_refresh_interval; /* Distance parameter. */ - u_char distance_all; - u_char distance_intra; - u_char distance_inter; - u_char distance_external; + uint8_t distance_all; + uint8_t distance_intra; + uint8_t distance_inter; + uint8_t distance_external; /* Statistics for LSA origination. */ - u_int32_t lsa_originate_count; + uint32_t lsa_originate_count; /* Statistics for LSA used for new instantiation. */ - u_int32_t rx_lsa_count; + uint32_t rx_lsa_count; /* Counter of "ip ospf area x.x.x.x" used * for multual exclusion of network command under * router ospf or ip ospf area x under interface. */ - u_int32_t if_ospf_cli_count; + uint32_t if_ospf_cli_count; struct route_table *distance_table; @@ -343,26 +343,26 @@ struct ospf_area { #define OSPF_SHORTCUT_ENABLE 1 #define OSPF_SHORTCUT_DISABLE 2 int shortcut_capability; /* Other ABRs agree on S-bit */ - u_int32_t default_cost; /* StubDefaultCost. */ + uint32_t default_cost; /* StubDefaultCost. */ int auth_type; /* Authentication type. */ - u_char NSSATranslatorRole; /* NSSA configured role */ + uint8_t NSSATranslatorRole; /* NSSA configured role */ #define OSPF_NSSA_ROLE_NEVER 0 #define OSPF_NSSA_ROLE_CANDIDATE 1 #define OSPF_NSSA_ROLE_ALWAYS 2 - u_char NSSATranslatorState; /* NSSA operational role */ + uint8_t NSSATranslatorState; /* NSSA operational role */ #define OSPF_NSSA_TRANSLATE_DISABLED 0 #define OSPF_NSSA_TRANSLATE_ENABLED 1 int NSSATranslatorStabilityInterval; - u_char transit; /* TransitCapability. */ + uint8_t transit; /* TransitCapability. */ #define OSPF_TRANSIT_FALSE 0 #define OSPF_TRANSIT_TRUE 1 struct route_table *ranges; /* Configured Area Ranges. */ /* RFC3137 stub router state flags for area */ - u_char stub_router_state; + uint8_t stub_router_state; #define OSPF_AREA_ADMIN_STUB_ROUTED (1 << 0) /* admin stub-router set */ #define OSPF_AREA_IS_STUB_ROUTED (1 << 1) /* stub-router active */ #define OSPF_AREA_WAS_START_STUB_ROUTED (1 << 2) /* startup SR was done */ @@ -412,19 +412,19 @@ struct ospf_area { struct thread *t_opaque_lsa_self; /* Type-10 Opaque-LSAs origin. */ /* Statistics field. */ - u_int32_t spf_calculation; /* SPF Calculation Count. */ + uint32_t spf_calculation; /* SPF Calculation Count. */ /* Time stamps. */ struct timeval ts_spf; /* SPF calculation time stamp. */ /* Router count. */ - u_int32_t abr_count; /* ABR router in this area. */ - u_int32_t asbr_count; /* ASBR router in this area. */ + uint32_t abr_count; /* ABR router in this area. */ + uint32_t asbr_count; /* ASBR router in this area. */ /* Counters. */ - u_int32_t act_ints; /* Active interfaces. */ - u_int32_t full_nbrs; /* Fully adjacent neighbors. */ - u_int32_t full_vls; /* Fully adjacent virtual neighbors. */ + uint32_t act_ints; /* Active interfaces. */ + uint32_t full_nbrs; /* Fully adjacent neighbors. */ + uint32_t full_vls; /* Fully adjacent virtual neighbors. */ }; /* OSPF config network structure. */ @@ -446,16 +446,16 @@ struct ospf_nbr_nbma { struct ospf_neighbor *nbr; /* Neighbor priority. */ - u_char priority; + uint8_t priority; /* Poll timer value. */ - u_int32_t v_poll; + uint32_t v_poll; /* Poll timer thread. */ struct thread *t_poll; /* State change. */ - u_int32_t state_change; + uint32_t state_change; }; /* Macro. */ @@ -500,11 +500,11 @@ extern int ospf_zlog; extern struct zebra_privs_t ospfd_privs; /* Prototypes. */ -extern const char *ospf_redist_string(u_int route_type); -extern struct ospf *ospf_lookup_instance(u_short); -extern struct ospf *ospf_get(u_short instance, const char *name); -extern struct ospf *ospf_get_instance(u_short); -extern struct ospf *ospf_lookup_by_inst_name(u_short instance, +extern const char *ospf_redist_string(unsigned int route_type); +extern struct ospf *ospf_lookup_instance(unsigned short); +extern struct ospf *ospf_get(unsigned short instance, const char *name); +extern struct ospf *ospf_get_instance(unsigned short); +extern struct ospf *ospf_lookup_by_inst_name(unsigned short instance, const char *name); extern struct ospf *ospf_lookup_by_vrf_id(vrf_id_t vrf_id); extern void ospf_finish(struct ospf *); @@ -535,7 +535,7 @@ extern int ospf_timers_refresh_set(struct ospf *, int); extern int ospf_timers_refresh_unset(struct ospf *); extern int ospf_nbr_nbma_set(struct ospf *, struct in_addr); extern int ospf_nbr_nbma_unset(struct ospf *, struct in_addr); -extern int ospf_nbr_nbma_priority_set(struct ospf *, struct in_addr, u_char); +extern int ospf_nbr_nbma_priority_set(struct ospf *, struct in_addr, uint8_t); extern int ospf_nbr_nbma_priority_unset(struct ospf *, struct in_addr); extern int ospf_nbr_nbma_poll_interval_set(struct ospf *, struct in_addr, unsigned int); |