diff options
364 files changed, 4760 insertions, 4626 deletions
diff --git a/babeld/kernel.c b/babeld/kernel.c index 8b1b80665..7e78b6dec 100644 --- a/babeld/kernel.c +++ b/babeld/kernel.c @@ -210,7 +210,7 @@ if_eui64(int ifindex, unsigned char *eui) return -1; } - u_char len = (u_char) ifp->hw_addr_len; + uint8_t len = (uint8_t)ifp->hw_addr_len; char *tmp = (void*) ifp->hw_addr; if (len == 8) { diff --git a/bgpd/bgp_advertise.c b/bgpd/bgp_advertise.c index 29b6ca6bf..94413117c 100644 --- a/bgpd/bgp_advertise.c +++ b/bgpd/bgp_advertise.c @@ -146,7 +146,7 @@ void bgp_advertise_unintern(struct hash *hash, struct bgp_advertise_attr *baa) } int bgp_adj_out_lookup(struct peer *peer, struct bgp_node *rn, - u_int32_t addpath_tx_id) + uint32_t addpath_tx_id) { struct bgp_adj_out *adj; struct peer_af *paf; @@ -179,7 +179,7 @@ int bgp_adj_out_lookup(struct peer *peer, struct bgp_node *rn, void bgp_adj_in_set(struct bgp_node *rn, struct peer *peer, struct attr *attr, - u_int32_t addpath_id) + uint32_t addpath_id) { struct bgp_adj_in *adj; @@ -209,7 +209,7 @@ void bgp_adj_in_remove(struct bgp_node *rn, struct bgp_adj_in *bai) } int bgp_adj_in_unset(struct bgp_node *rn, struct peer *peer, - u_int32_t addpath_id) + uint32_t addpath_id) { struct bgp_adj_in *adj; struct bgp_adj_in *adj_next; diff --git a/bgpd/bgp_advertise.h b/bgpd/bgp_advertise.h index 3fdc6d8d2..920cca630 100644 --- a/bgpd/bgp_advertise.h +++ b/bgpd/bgp_advertise.h @@ -29,7 +29,7 @@ struct update_subgroup; struct bgp_advertise_fifo { struct bgp_advertise *next; struct bgp_advertise *prev; - u_int32_t count; + uint32_t count; }; /* BGP advertise attribute. */ @@ -80,7 +80,7 @@ struct bgp_adj_out { /* Prefix information. */ struct bgp_node *rn; - u_int32_t addpath_tx_id; + uint32_t addpath_tx_id; /* Advertised attribute. */ struct attr *attr; @@ -102,7 +102,7 @@ struct bgp_adj_in { struct attr *attr; /* Addpath identifier */ - u_int32_t addpath_rx_id; + uint32_t addpath_rx_id; }; /* BGP advertisement list. */ @@ -168,10 +168,10 @@ struct bgp_synchronize { : (F)->next) /* Prototypes. */ -extern int bgp_adj_out_lookup(struct peer *, struct bgp_node *, u_int32_t); +extern int bgp_adj_out_lookup(struct peer *, struct bgp_node *, uint32_t); extern void bgp_adj_in_set(struct bgp_node *, struct peer *, struct attr *, - u_int32_t); -extern int bgp_adj_in_unset(struct bgp_node *, struct peer *, u_int32_t); + uint32_t); +extern int bgp_adj_in_unset(struct bgp_node *, struct peer *, uint32_t); extern void bgp_adj_in_remove(struct bgp_node *, struct bgp_adj_in *); extern void bgp_sync_init(struct peer *); diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index c3bbb7168..e02617691 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -80,8 +80,8 @@ * NOT the internal representation! */ struct assegment_header { - u_char type; - u_char length; + uint8_t type; + uint8_t length; }; /* Hash for aspath. This is the top level structure of AS path. */ @@ -109,7 +109,7 @@ const char *aspath_segment_type_str[] = {"as-invalid", "as-set", "as-sequence", * the caller should immediately assign data to the segment, as the segment * otherwise is not generally valid */ -static struct assegment *assegment_new(u_char type, u_short length) +static struct assegment *assegment_new(uint8_t type, unsigned short length) { struct assegment *new; @@ -345,7 +345,7 @@ void aspath_unintern(struct aspath **aspath) /* Return the start or end delimiters for a particular Segment type */ #define AS_SEG_START 0 #define AS_SEG_END 1 -static char aspath_delimiter_char(u_char type, u_char which) +static char aspath_delimiter_char(uint8_t type, uint8_t which) { int i; struct { @@ -864,7 +864,7 @@ static void assegment_data_put(struct stream *s, as_t *as, int num, } } -static size_t assegment_header_put(struct stream *s, u_char type, int length) +static size_t assegment_header_put(struct stream *s, uint8_t type, int length) { size_t lenp; assert(length <= AS_SEGMENT_MAX); @@ -962,7 +962,7 @@ size_t aspath_put(struct stream *s, struct aspath *as, int use32bit) * We have no way to manage the storage, so we use a static stream * wrapper around aspath_put. */ -u_char *aspath_snmp_pathseg(struct aspath *as, size_t *varlen) +uint8_t *aspath_snmp_pathseg(struct aspath *as, size_t *varlen) { #define SNMP_PATHSEG_MAX 1024 @@ -1541,7 +1541,7 @@ struct aspath *aspath_filter_exclude(struct aspath *source, /* Add specified AS to the leftmost of aspath. */ static struct aspath *aspath_add_asns(struct aspath *aspath, as_t asno, - u_char type, unsigned num) + uint8_t type, unsigned num) { struct assegment *assegment = aspath->segments; unsigned i; @@ -1872,7 +1872,7 @@ enum as_token { /* Return next token and point for string parse. */ static const char *aspath_gettoken(const char *buf, enum as_token *token, - u_long *asno) + unsigned long *asno) { const char *p = buf; @@ -1937,8 +1937,8 @@ static const char *aspath_gettoken(const char *buf, enum as_token *token, struct aspath *aspath_str2aspath(const char *str) { enum as_token token = as_token_unknown; - u_short as_type; - u_long asno = 0; + unsigned short as_type; + unsigned long asno = 0; struct aspath *aspath; int needtype; diff --git a/bgpd/bgp_aspath.h b/bgpd/bgp_aspath.h index 0c065cc93..1acc2f67a 100644 --- a/bgpd/bgp_aspath.h +++ b/bgpd/bgp_aspath.h @@ -51,8 +51,8 @@ struct assegment { struct assegment *next; as_t *as; - u_short length; - u_char type; + unsigned short length; + uint8_t type; }; /* AS path may be include some AsSegments. */ @@ -127,6 +127,6 @@ extern struct aspath *aspath_reconcile_as4(struct aspath *, struct aspath *); extern unsigned int aspath_has_as4(struct aspath *); /* For SNMP BGP4PATHATTRASPATHSEGMENT, might be useful for debug */ -extern u_char *aspath_snmp_pathseg(struct aspath *, size_t *); +extern uint8_t *aspath_snmp_pathseg(struct aspath *, size_t *); #endif /* _QUAGGA_BGP_ASPATH_H */ diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index c3a110599..58788a895 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -693,7 +693,7 @@ struct attr *bgp_attr_intern(struct attr *attr) } /* Make network statement's attribute. */ -struct attr *bgp_attr_default_set(struct attr *attr, u_char origin) +struct attr *bgp_attr_default_set(struct attr *attr, uint8_t origin) { memset(attr, 0, sizeof(struct attr)); @@ -712,10 +712,10 @@ struct attr *bgp_attr_default_set(struct attr *attr, u_char origin) } /* Create the attributes for an aggregate */ -struct attr *bgp_attr_aggregate_intern(struct bgp *bgp, u_char origin, +struct attr *bgp_attr_aggregate_intern(struct bgp *bgp, uint8_t origin, struct aspath *aspath, struct community *community, int as_set, - u_char atomic_aggregate) + uint8_t atomic_aggregate) { struct attr attr; struct attr *new; @@ -737,7 +737,7 @@ struct attr *bgp_attr_aggregate_intern(struct bgp *bgp, u_char origin, attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP); if (community) { - u_int32_t gshut = COMMUNITY_GSHUT; + uint32_t gshut = COMMUNITY_GSHUT; /* If we are not shutting down ourselves and we are * aggregating a route that contains the GSHUT community we @@ -901,16 +901,16 @@ void bgp_attr_flush(struct attr *attr) * introduced by the sending neighbour. */ static bgp_attr_parse_ret_t -bgp_attr_malformed(struct bgp_attr_parser_args *args, u_char subcode, +bgp_attr_malformed(struct bgp_attr_parser_args *args, uint8_t subcode, bgp_size_t length) { struct peer *const peer = args->peer; - const u_int8_t flags = args->flags; + const uint8_t flags = args->flags; /* startp and length must be special-cased, as whether or not to * send the attribute data with the NOTIFY depends on the error, * the caller therefore signals this with the seperate length argument */ - u_char *notify_datap = (length > 0 ? args->startp : NULL); + uint8_t *notify_datap = (length > 0 ? args->startp : NULL); /* Only relax error handling for eBGP peers */ if (peer->sort != BGP_PEER_EBGP) { @@ -976,12 +976,12 @@ bgp_attr_malformed(struct bgp_attr_parser_args *args, u_char subcode, non-transitive" attribute. */ static void bgp_attr_flags_diagnose(struct bgp_attr_parser_args *args, - u_int8_t desired_flags /* how RFC says it must be */ - ) + uint8_t desired_flags /* how RFC says it must be */ +) { - u_char seen = 0, i; - u_char real_flags = args->flags; - const u_int8_t attr_code = args->type; + uint8_t seen = 0, i; + uint8_t real_flags = args->flags; + const uint8_t attr_code = args->type; desired_flags &= ~BGP_ATTR_FLAG_EXTLEN; real_flags &= ~BGP_ATTR_FLAG_EXTLEN; @@ -1008,41 +1008,36 @@ bgp_attr_flags_diagnose(struct bgp_attr_parser_args *args, /* Required flags for attributes. EXTLEN will be masked off when testing, * as will PARTIAL for optional+transitive attributes. */ -const u_int8_t attr_flags_values[] = { - [BGP_ATTR_ORIGIN] = BGP_ATTR_FLAG_TRANS, - [BGP_ATTR_AS_PATH] = BGP_ATTR_FLAG_TRANS, - [BGP_ATTR_NEXT_HOP] = BGP_ATTR_FLAG_TRANS, - [BGP_ATTR_MULTI_EXIT_DISC] = BGP_ATTR_FLAG_OPTIONAL, - [BGP_ATTR_LOCAL_PREF] = BGP_ATTR_FLAG_TRANS, - [BGP_ATTR_ATOMIC_AGGREGATE] = BGP_ATTR_FLAG_TRANS, - [BGP_ATTR_AGGREGATOR] = - BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, - [BGP_ATTR_COMMUNITIES] = - BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, - [BGP_ATTR_ORIGINATOR_ID] = BGP_ATTR_FLAG_OPTIONAL, - [BGP_ATTR_CLUSTER_LIST] = BGP_ATTR_FLAG_OPTIONAL, - [BGP_ATTR_MP_REACH_NLRI] = BGP_ATTR_FLAG_OPTIONAL, - [BGP_ATTR_MP_UNREACH_NLRI] = BGP_ATTR_FLAG_OPTIONAL, - [BGP_ATTR_EXT_COMMUNITIES] = - BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, - [BGP_ATTR_AS4_PATH] = - BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, - [BGP_ATTR_AS4_AGGREGATOR] = - BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, - [BGP_ATTR_PMSI_TUNNEL] = - BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, - [BGP_ATTR_LARGE_COMMUNITIES] = - BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, - [BGP_ATTR_PREFIX_SID] = - BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, +const uint8_t attr_flags_values[] = { + [BGP_ATTR_ORIGIN] = BGP_ATTR_FLAG_TRANS, + [BGP_ATTR_AS_PATH] = BGP_ATTR_FLAG_TRANS, + [BGP_ATTR_NEXT_HOP] = BGP_ATTR_FLAG_TRANS, + [BGP_ATTR_MULTI_EXIT_DISC] = BGP_ATTR_FLAG_OPTIONAL, + [BGP_ATTR_LOCAL_PREF] = BGP_ATTR_FLAG_TRANS, + [BGP_ATTR_ATOMIC_AGGREGATE] = BGP_ATTR_FLAG_TRANS, + [BGP_ATTR_AGGREGATOR] = BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, + [BGP_ATTR_COMMUNITIES] = BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, + [BGP_ATTR_ORIGINATOR_ID] = BGP_ATTR_FLAG_OPTIONAL, + [BGP_ATTR_CLUSTER_LIST] = BGP_ATTR_FLAG_OPTIONAL, + [BGP_ATTR_MP_REACH_NLRI] = BGP_ATTR_FLAG_OPTIONAL, + [BGP_ATTR_MP_UNREACH_NLRI] = BGP_ATTR_FLAG_OPTIONAL, + [BGP_ATTR_EXT_COMMUNITIES] = + BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, + [BGP_ATTR_AS4_PATH] = BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, + [BGP_ATTR_AS4_AGGREGATOR] = + BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, + [BGP_ATTR_PMSI_TUNNEL] = BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, + [BGP_ATTR_LARGE_COMMUNITIES] = + BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, + [BGP_ATTR_PREFIX_SID] = BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, }; static const size_t attr_flags_values_max = array_size(attr_flags_values) - 1; static int bgp_attr_flag_invalid(struct bgp_attr_parser_args *args) { - u_int8_t mask = BGP_ATTR_FLAG_EXTLEN; - const u_int8_t flags = args->flags; - const u_int8_t attr_code = args->type; + uint8_t mask = BGP_ATTR_FLAG_EXTLEN; + const uint8_t flags = args->flags; + const uint8_t attr_code = args->type; /* there may be attributes we don't know about */ if (attr_code > attr_flags_values_max) @@ -1531,7 +1526,7 @@ bgp_attr_community(struct bgp_attr_parser_args *args) } attr->community = - community_parse((u_int32_t *)stream_pnt(peer->curr), length); + community_parse((uint32_t *)stream_pnt(peer->curr), length); /* XXX: fix community_parse to use stream API and remove this */ stream_forward_getp(peer->curr, length); @@ -1723,7 +1718,7 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args, } { - u_char val; + uint8_t val; if ((val = stream_getc(s))) zlog_warn( "%s sent non-zero value, %u, for defunct SNPA-length field", @@ -1768,7 +1763,7 @@ int bgp_mp_unreach_parse(struct bgp_attr_parser_args *args, afi_t afi; iana_safi_t pkt_safi; safi_t safi; - u_int16_t withdraw_len; + uint16_t withdraw_len; struct peer *const peer = args->peer; struct attr *const attr = args->attr; const bgp_size_t length = args->length; @@ -1827,7 +1822,7 @@ bgp_attr_large_community(struct bgp_attr_parser_args *args) } attr->lcommunity = - lcommunity_parse((u_int8_t *)stream_pnt(peer->curr), length); + lcommunity_parse((uint8_t *)stream_pnt(peer->curr), length); /* XXX: fix ecommunity_parse to use stream API */ stream_forward_getp(peer->curr, length); @@ -1847,7 +1842,7 @@ bgp_attr_ext_communities(struct bgp_attr_parser_args *args) struct peer *const peer = args->peer; struct attr *const attr = args->attr; const bgp_size_t length = args->length; - u_char sticky = 0; + uint8_t sticky = 0; if (length == 0) { attr->ecommunity = NULL; @@ -1856,7 +1851,7 @@ bgp_attr_ext_communities(struct bgp_attr_parser_args *args) } attr->ecommunity = - ecommunity_parse((u_int8_t *)stream_pnt(peer->curr), length); + ecommunity_parse((uint8_t *)stream_pnt(peer->curr), length); /* XXX: fix ecommunity_parse to use stream API */ stream_forward_getp(peer->curr, length); @@ -1883,8 +1878,8 @@ bgp_attr_ext_communities(struct bgp_attr_parser_args *args) static int bgp_attr_encap(uint8_t type, struct peer *peer, /* IN */ bgp_size_t length, /* IN: attr's length field */ struct attr *attr, /* IN: caller already allocated */ - u_char flag, /* IN: attr's flags field */ - u_char *startp) + uint8_t flag, /* IN: attr's flags field */ + uint8_t *startp) { bgp_size_t total; uint16_t tunneltype = 0; @@ -2017,10 +2012,10 @@ bgp_attr_prefix_sid(struct bgp_attr_parser_args *args, struct attr *const attr = args->attr; int type; int length; - u_int32_t label_index; + uint32_t label_index; struct in6_addr ipv6_sid; - u_int32_t srgb_base; - u_int32_t srgb_range; + uint32_t srgb_base; + uint32_t srgb_range; int srgb_count; attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID); @@ -2116,7 +2111,7 @@ bgp_attr_pmsi_tunnel(struct bgp_attr_parser_args *args) struct peer *const peer = args->peer; struct attr *const attr = args->attr; const bgp_size_t length = args->length; - u_int8_t tnl_type; + uint8_t tnl_type; /* Verify that the receiver is expecting "ingress replication" as we * can only support that. @@ -2159,9 +2154,9 @@ static bgp_attr_parse_ret_t bgp_attr_unknown(struct bgp_attr_parser_args *args) struct transit *transit; struct peer *const peer = args->peer; struct attr *const attr = args->attr; - u_char *const startp = args->startp; - const u_char type = args->type; - const u_char flag = args->flags; + uint8_t *const startp = args->startp; + const uint8_t type = args->type; + const uint8_t flag = args->flags; const bgp_size_t length = args->length; if (bgp_debug_update(peer, NULL, NULL, 1)) @@ -2213,7 +2208,7 @@ static bgp_attr_parse_ret_t bgp_attr_unknown(struct bgp_attr_parser_args *args) /* Well-known attribute check. */ static int bgp_attr_check(struct peer *peer, struct attr *attr) { - u_char type = 0; + uint8_t type = 0; /* BGP Graceful-Restart End-of-RIB for IPv4 unicast is signaled as an * empty UPDATE. */ @@ -2264,12 +2259,12 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr, struct bgp_nlri *mp_withdraw) { int ret; - u_char flag = 0; - u_char type = 0; + uint8_t flag = 0; + uint8_t type = 0; bgp_size_t length; - u_char *startp, *endp; - u_char *attr_endp; - u_char seen[BGP_ATTR_BITMAP_SIZE]; + uint8_t *startp, *endp; + uint8_t *attr_endp; + uint8_t seen[BGP_ATTR_BITMAP_SIZE]; /* we need the as4_path only until we have synthesized the as_path with * it */ /* same goes for as4_aggregator */ @@ -2742,8 +2737,8 @@ size_t bgp_packet_mpattr_start(struct stream *s, struct peer *peer, afi_t afi, void bgp_packet_mpattr_prefix(struct stream *s, afi_t afi, safi_t safi, struct prefix *p, struct prefix_rd *prd, - mpls_label_t *label, u_int32_t num_labels, - int addpath_encode, u_int32_t addpath_tx_id, + mpls_label_t *label, uint32_t num_labels, + int addpath_encode, uint32_t addpath_tx_id, struct attr *attr) { if (safi == SAFI_MPLS_VPN) { @@ -2886,8 +2881,8 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer, struct bpacket_attr_vec_arr *vecarr, struct prefix *p, afi_t afi, safi_t safi, struct peer *from, struct prefix_rd *prd, - mpls_label_t *label, u_int32_t num_labels, - int addpath_encode, u_int32_t addpath_tx_id) + mpls_label_t *label, uint32_t num_labels, + int addpath_encode, uint32_t addpath_tx_id) { size_t cp; size_t aspath_sizep; @@ -3072,7 +3067,7 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer, */ send_as4_aggregator = 1; } else - stream_putw(s, (u_int16_t)attr->aggregator_as); + stream_putw(s, (uint16_t)attr->aggregator_as); } stream_put_ipv4(s, attr->aggregator_addr.s_addr); } @@ -3179,7 +3174,7 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer, stream_put(s, attr->ecommunity->val, attr->ecommunity->size * 8); } else { - u_int8_t *pnt; + uint8_t *pnt; int tbit; int ecom_tr_size = 0; int i; @@ -3233,7 +3228,7 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer, /* Label index attribute. */ if (safi == SAFI_LABELED_UNICAST) { if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID)) { - u_int32_t label_index; + uint32_t label_index; label_index = attr->label_index; @@ -3350,11 +3345,11 @@ size_t bgp_packet_mpunreach_start(struct stream *s, afi_t afi, safi_t safi) void bgp_packet_mpunreach_prefix(struct stream *s, struct prefix *p, afi_t afi, safi_t safi, struct prefix_rd *prd, - mpls_label_t *label, u_int32_t num_labels, - int addpath_encode, u_int32_t addpath_tx_id, + mpls_label_t *label, uint32_t num_labels, + int addpath_encode, uint32_t addpath_tx_id, struct attr *attr) { - u_char wlabel[3] = {0x80, 0x00, 0x00}; + uint8_t wlabel[3] = {0x80, 0x00, 0x00}; if (safi == SAFI_LABELED_UNICAST) { label = (mpls_label_t *)wlabel; @@ -3404,7 +3399,7 @@ void bgp_dump_routes_attr(struct stream *s, struct attr *attr, size_t aspath_lenp; struct aspath *aspath; int addpath_encode = 0; - u_int32_t addpath_tx_id = 0; + uint32_t addpath_tx_id = 0; /* Remember current pointer. */ cp = stream_get_endp(s); diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h index 5403f3254..758db4a44 100644 --- a/bgpd/bgp_attr.h +++ b/bgpd/bgp_attr.h @@ -126,19 +126,19 @@ struct attr { /* Apart from in6_addr, the remaining static attributes */ struct in_addr nexthop; - u_int32_t med; - u_int32_t local_pref; + uint32_t med; + uint32_t local_pref; ifindex_t nh_ifindex; /* Path origin attribute */ - u_char origin; + uint8_t origin; /* PMSI tunnel type (RFC 6514). */ enum pta_type pmsi_tnl_type; /* has the route-map changed any attribute? Used on the peer outbound side. */ - u_int32_t rmap_change_flags; + uint32_t rmap_change_flags; /* Multi-Protocol Nexthop, AFI IPv6 */ struct in6_addr mp_nexthop_global; @@ -165,28 +165,28 @@ struct attr { struct in_addr originator_id; /* Local weight, not actually an attribute */ - u_int32_t weight; + uint32_t weight; /* Aggregator ASN */ as_t aggregator_as; /* MP Nexthop length */ - u_char mp_nexthop_len; + uint8_t mp_nexthop_len; /* MP Nexthop preference */ - u_char mp_nexthop_prefer_global; + uint8_t mp_nexthop_prefer_global; /* Static MAC for EVPN */ - u_char sticky; + uint8_t sticky; /* Flag for default gateway extended community in EVPN */ - u_char default_gw; + uint8_t default_gw; /* route tag */ route_tag_t tag; /* Label index */ - u_int32_t label_index; + uint32_t label_index; /* MPLS label */ mpls_label_t label; @@ -201,7 +201,7 @@ struct attr { struct overlay_index evpn_overlay; /* EVPN MAC Mobility sequence number, if any. */ - u_int32_t mm_seqnum; + uint32_t mm_seqnum; /* EVPN local router-mac */ struct ethaddr rmac; @@ -227,7 +227,7 @@ struct cluster_list { struct transit { unsigned long refcnt; int length; - u_char *val; + uint8_t *val; }; /* "(void) 0" will generate a compiler error. this is a safety check to @@ -265,18 +265,17 @@ extern struct attr *bgp_attr_intern(struct attr *attr); extern void bgp_attr_unintern_sub(struct attr *); extern void bgp_attr_unintern(struct attr **); extern void bgp_attr_flush(struct attr *); -extern struct attr *bgp_attr_default_set(struct attr *attr, u_char); -extern struct attr *bgp_attr_aggregate_intern(struct bgp *, u_char, +extern struct attr *bgp_attr_default_set(struct attr *attr, uint8_t); +extern struct attr *bgp_attr_aggregate_intern(struct bgp *, uint8_t, struct aspath *, struct community *, int as_set, - u_char); + uint8_t); extern bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *, struct stream *, struct attr *, struct bpacket_attr_vec_arr *vecarr, struct prefix *, afi_t, safi_t, struct peer *, struct prefix_rd *, - mpls_label_t *, u_int32_t, int, - u_int32_t); + mpls_label_t *, uint32_t, int, uint32_t); extern void bgp_dump_routes_attr(struct stream *, struct attr *, struct prefix *); extern int attrhash_cmp(const void *, const void *); @@ -298,9 +297,9 @@ struct bgp_attr_parser_args { bgp_size_t length; /* attribute data length; */ bgp_size_t total; /* total length, inc header */ struct attr *attr; - u_int8_t type; - u_int8_t flags; - u_char *startp; + uint8_t type; + uint8_t flags; + uint8_t *startp; }; extern int bgp_mp_reach_parse(struct bgp_attr_parser_args *args, struct bgp_nlri *); @@ -324,9 +323,9 @@ extern size_t bgp_packet_mpattr_start(struct stream *s, struct peer *peer, struct attr *attr); extern void bgp_packet_mpattr_prefix(struct stream *s, afi_t afi, safi_t safi, struct prefix *p, struct prefix_rd *prd, - mpls_label_t *label, u_int32_t num_labels, - int addpath_encode, - u_int32_t addpath_tx_id, struct attr *); + mpls_label_t *label, uint32_t num_labels, + int addpath_encode, uint32_t addpath_tx_id, + struct attr *); extern size_t bgp_packet_mpattr_prefix_size(afi_t afi, safi_t safi, struct prefix *p); extern void bgp_packet_mpattr_end(struct stream *s, size_t sizep); @@ -336,12 +335,11 @@ extern size_t bgp_packet_mpunreach_start(struct stream *s, afi_t afi, extern void bgp_packet_mpunreach_prefix(struct stream *s, struct prefix *p, afi_t afi, safi_t safi, struct prefix_rd *prd, mpls_label_t *, - u_int32_t, int, u_int32_t, - struct attr *); + uint32_t, int, uint32_t, struct attr *); extern void bgp_packet_mpunreach_end(struct stream *s, size_t attrlen_pnt); -static inline int bgp_rmap_nhop_changed(u_int32_t out_rmap_flags, - u_int32_t in_rmap_flags) +static inline int bgp_rmap_nhop_changed(uint32_t out_rmap_flags, + uint32_t in_rmap_flags) { return ((CHECK_FLAG(out_rmap_flags, BATTR_RMAP_NEXTHOP_PEER_ADDRESS) || CHECK_FLAG(out_rmap_flags, BATTR_RMAP_NEXTHOP_UNCHANGED) @@ -356,7 +354,7 @@ static inline int bgp_rmap_nhop_changed(u_int32_t out_rmap_flags, : 0); } -static inline u_int32_t mac_mobility_seqnum(struct attr *attr) +static inline uint32_t mac_mobility_seqnum(struct attr *attr) { return (attr) ? attr->mm_seqnum : 0; } diff --git a/bgpd/bgp_attr_evpn.c b/bgpd/bgp_attr_evpn.c index 8d5eff9a6..d2a61b93f 100644 --- a/bgpd/bgp_attr_evpn.c +++ b/bgpd/bgp_attr_evpn.c @@ -78,7 +78,7 @@ int str2esi(const char *str, struct eth_segment_id *id) char *esi2str(struct eth_segment_id *id) { char *ptr; - u_char *val; + uint8_t *val; if (!id) return NULL; @@ -117,9 +117,9 @@ void bgp_attr_rmac(struct attr *attr, struct ethaddr *rmac) /* If there is a router mac extended community, set RMAC in attr */ for (i = 0; i < ecom->size; i++) { - u_char *pnt = NULL; - u_char type = 0; - u_char sub_type = 0; + uint8_t *pnt = NULL; + uint8_t type = 0; + uint8_t sub_type = 0; pnt = (ecom->val + (i * ECOMMUNITY_SIZE)); type = *pnt++; @@ -148,8 +148,8 @@ uint8_t bgp_attr_default_gw(struct attr *attr) /* If there is a default gw extendd community return true otherwise * return 0 */ for (i = 0; i < ecom->size; i++) { - u_char *pnt; - u_char type, sub_type; + uint8_t *pnt; + uint8_t type, sub_type; pnt = (ecom->val + (i * ECOMMUNITY_SIZE)); type = *pnt++; @@ -167,11 +167,11 @@ uint8_t bgp_attr_default_gw(struct attr *attr) * Fetch and return the sequence number from MAC Mobility extended * community, if present, else 0. */ -u_int32_t bgp_attr_mac_mobility_seqnum(struct attr *attr, u_char *sticky) +uint32_t bgp_attr_mac_mobility_seqnum(struct attr *attr, uint8_t *sticky) { struct ecommunity *ecom; int i; - u_char flags = 0; + uint8_t flags = 0; ecom = attr->ecommunity; if (!ecom || !ecom->size) @@ -184,9 +184,9 @@ u_int32_t bgp_attr_mac_mobility_seqnum(struct attr *attr, u_char *sticky) * one. */ for (i = 0; i < ecom->size; i++) { - u_char *pnt; - u_char type, sub_type; - u_int32_t seq_num; + uint8_t *pnt; + uint8_t type, sub_type; + uint32_t seq_num; pnt = (ecom->val + (i * ECOMMUNITY_SIZE)); type = *pnt++; @@ -233,12 +233,12 @@ extern int bgp_build_evpn_prefix(int evpn_type, uint32_t eth_tag, SET_IPADDR_V4(&p_evpn_p->ip); memcpy(&p_evpn_p->ip.ipaddr_v4, &src->u.prefix4, sizeof(struct in_addr)); - dst->prefixlen = (u_char)PREFIX_LEN_ROUTE_TYPE_5_IPV4; + dst->prefixlen = (uint8_t)PREFIX_LEN_ROUTE_TYPE_5_IPV4; } else { SET_IPADDR_V6(&p_evpn_p->ip); memcpy(&p_evpn_p->ip.ipaddr_v6, &src->u.prefix6, sizeof(struct in6_addr)); - dst->prefixlen = (u_char)PREFIX_LEN_ROUTE_TYPE_5_IPV6; + dst->prefixlen = (uint8_t)PREFIX_LEN_ROUTE_TYPE_5_IPV6; } } else return -1; diff --git a/bgpd/bgp_attr_evpn.h b/bgpd/bgp_attr_evpn.h index a211da8d2..cb1c131ef 100644 --- a/bgpd/bgp_attr_evpn.h +++ b/bgpd/bgp_attr_evpn.h @@ -34,11 +34,11 @@ #define MAX_ET 0xffffffff -u_long eth_tag_id; +unsigned long eth_tag_id; struct attr; struct eth_segment_id { - u_char val[ESI_LEN]; + uint8_t val[ESI_LEN]; }; union gw_addr { @@ -60,8 +60,8 @@ extern void bgp_add_routermac_ecom(struct attr *attr, extern int bgp_build_evpn_prefix(int type, uint32_t eth_tag, struct prefix *dst); extern void bgp_attr_rmac(struct attr *attr, struct ethaddr *rmac); -extern u_int32_t bgp_attr_mac_mobility_seqnum(struct attr *attr, - u_char *sticky); +extern uint32_t bgp_attr_mac_mobility_seqnum(struct attr *attr, + uint8_t *sticky); extern uint8_t bgp_attr_default_gw(struct attr *attr); #endif /* _QUAGGA_BGP_ATTR_EVPN_H */ diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index 91b6929ff..c7d624987 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -383,8 +383,8 @@ static int bgp_bfd_dest_update(int command, struct zclient *zclient, /* * bgp_bfd_peer_param_set - Set the configured BFD paramter values for peer. */ -static int bgp_bfd_peer_param_set(struct peer *peer, u_int32_t min_rx, - u_int32_t min_tx, u_int8_t detect_mult, +static int bgp_bfd_peer_param_set(struct peer *peer, uint32_t min_rx, + uint32_t min_tx, uint8_t detect_mult, int defaults) { struct peer_group *group; @@ -526,7 +526,7 @@ void bgp_bfd_peer_config_write(struct vty *vty, struct peer *peer, char *addr) /* * bgp_bfd_show_info - Show the peer BFD information. */ -void bgp_bfd_show_info(struct vty *vty, struct peer *peer, u_char use_json, +void bgp_bfd_show_info(struct vty *vty, struct peer *peer, uint8_t use_json, json_object *json_neigh) { bfd_show_info(vty, (struct bfd_info *)peer->bfd_info, @@ -571,9 +571,9 @@ DEFUN (neighbor_bfd_param, int idx_number_2 = 4; int idx_number_3 = 5; struct peer *peer; - 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; peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg); diff --git a/bgpd/bgp_bfd.h b/bgpd/bgp_bfd.h index 72d86596b..a3cfca9c0 100644 --- a/bgpd/bgp_bfd.h +++ b/bgpd/bgp_bfd.h @@ -35,7 +35,7 @@ extern void bgp_bfd_peer_config_write(struct vty *vty, struct peer *peer, char *addr); extern void bgp_bfd_show_info(struct vty *vty, struct peer *peer, - u_char use_json, json_object *json_neigh); + uint8_t use_json, json_object *json_neigh); extern int bgp_bfd_is_peer_multihop(struct peer *peer); diff --git a/bgpd/bgp_btoa.c b/bgpd/bgp_btoa.c index 4faebb538..bf2607f2e 100644 --- a/bgpd/bgp_btoa.c +++ b/bgpd/bgp_btoa.c @@ -68,12 +68,12 @@ enum MRT_MSG_TYPES { MSG_TABLE_DUMP /* routing table dump */ }; -static int attr_parse(struct stream *s, u_int16_t len) +static int attr_parse(struct stream *s, uint16_t len) { - u_int flag; - u_int type; - u_int16_t length; - u_int16_t lim; + unsigned int flag; + unsigned int type; + uint16_t length; + uint16_t lim; lim = s->getp + len; @@ -94,7 +94,7 @@ static int attr_parse(struct stream *s, u_int16_t len) switch (type) { case BGP_ATTR_ORIGIN: { - u_char origin; + uint8_t origin; origin = stream_getc(s); printf("ORIGIN: %d\n", origin); } break; @@ -134,7 +134,7 @@ int main(int argc, char **argv) int family; struct in_addr sip; struct in_addr dip; - u_int16_t viewno, seq_num; + uint16_t viewno, seq_num; struct prefix_ipv4 p; s = stream_new(10000); @@ -230,10 +230,10 @@ int main(int argc, char **argv) /* printf ("now read %d\n", len); */ if (type == MSG_TABLE_DUMP) { - u_char status; + uint8_t status; time_t originated; struct in_addr peer; - u_int16_t attrlen; + uint16_t attrlen; viewno = stream_getw(s); seq_num = stream_getw(s); diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c index 72b1098ed..8f38f5765 100644 --- a/bgpd/bgp_clist.c +++ b/bgpd/bgp_clist.c @@ -334,13 +334,13 @@ community_list_entry_lookup(struct community_list *list, const void *arg, static char *community_str_get(struct community *com, int i) { int len; - u_int32_t comval; - u_int16_t as; - u_int16_t val; + uint32_t comval; + uint16_t as; + uint16_t val; char *str; char *pnt; - memcpy(&comval, com_nthval(com, i), sizeof(u_int32_t)); + memcpy(&comval, com_nthval(com, i), sizeof(uint32_t)); comval = ntohl(comval); switch (comval) { @@ -451,11 +451,11 @@ static int community_regexp_match(struct community *com, regex_t *reg) static char *lcommunity_str_get(struct lcommunity *lcom, int i) { struct lcommunity_val lcomval; - u_int32_t globaladmin; - u_int32_t localdata1; - u_int32_t localdata2; + uint32_t globaladmin; + uint32_t localdata1; + uint32_t localdata2; char *str; - u_char *ptr; + uint8_t *ptr; char *pnt; ptr = lcom->val + (i * LCOMMUNITY_SIZE); @@ -465,7 +465,7 @@ static char *lcommunity_str_get(struct lcommunity *lcom, int i) /* Allocate memory. 48 bytes taken off bgp_lcommunity.c */ str = pnt = XMALLOC(MTYPE_LCOMMUNITY_STR, 48); - ptr = (u_char *)lcomval.val; + ptr = (uint8_t *)lcomval.val; ptr = ptr_get_be32(ptr, &globaladmin); ptr = ptr_get_be32(ptr, &localdata1); ptr = ptr_get_be32(ptr, &localdata2); @@ -549,7 +549,7 @@ static struct community * community_regexp_delete (struct community *com, regex_t * reg) { int i; - u_int32_t comval; + uint32_t comval; /* Maximum is "65535:65535" + '\0'. */ char c[12]; const char *str; @@ -560,7 +560,7 @@ community_regexp_delete (struct community *com, regex_t * reg) i = 0; while (i < com->size) { - memcpy (&comval, com_nthval (com, i), sizeof (u_int32_t)); + memcpy (&comval, com_nthval (com, i), sizeof (uint32_t)); comval = ntohl (comval); switch (comval) @@ -694,8 +694,8 @@ struct community *community_list_match_delete(struct community *com, struct community_list *list) { struct community_entry *entry; - u_int32_t val; - u_int32_t com_index_to_delete[com->size]; + uint32_t val; + uint32_t com_index_to_delete[com->size]; int delete_index = 0; int i; @@ -895,8 +895,8 @@ struct lcommunity *lcommunity_list_match_delete(struct lcommunity *lcom, struct community_list *list) { struct community_entry *entry; - u_int32_t com_index_to_delete[lcom->size]; - u_char *ptr; + uint32_t com_index_to_delete[lcom->size]; + uint8_t *ptr; int delete_index = 0; int i; diff --git a/bgpd/bgp_clist.h b/bgpd/bgp_clist.h index c21654f39..0dbde2a45 100644 --- a/bgpd/bgp_clist.h +++ b/bgpd/bgp_clist.h @@ -68,13 +68,13 @@ struct community_entry { struct community_entry *prev; /* Permit or deny. */ - u_char direct; + uint8_t direct; /* Standard or expanded. */ - u_char style; + uint8_t style; /* Any match. */ - u_char any; + uint8_t any; /* Community structure. */ union { diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c index b78edcb2f..10ce1486a 100644 --- a/bgpd/bgp_community.c +++ b/bgpd/bgp_community.c @@ -55,7 +55,7 @@ void community_free(struct community *com) } /* Add one community value to the community. */ -static void community_add_val(struct community *com, u_int32_t val) +static void community_add_val(struct community *com, uint32_t val) { com->size++; if (com->val) @@ -65,11 +65,11 @@ static void community_add_val(struct community *com, u_int32_t val) com->val = XMALLOC(MTYPE_COMMUNITY_VAL, com_length(com)); val = htonl(val); - memcpy(com_lastval(com), &val, sizeof(u_int32_t)); + memcpy(com_lastval(com), &val, sizeof(uint32_t)); } /* Delete one community. */ -void community_del_val(struct community *com, u_int32_t *val) +void community_del_val(struct community *com, uint32_t *val) { int i = 0; int c = 0; @@ -78,7 +78,7 @@ void community_del_val(struct community *com, u_int32_t *val) return; while (i < com->size) { - if (memcmp(com->val + i, val, sizeof(u_int32_t)) == 0) { + if (memcmp(com->val + i, val, sizeof(uint32_t)) == 0) { c = com->size - i - 1; if (c > 0) @@ -117,11 +117,11 @@ struct community *community_delete(struct community *com1, /* Callback function from qsort(). */ static int community_compare(const void *a1, const void *a2) { - u_int32_t v1; - u_int32_t v2; + uint32_t v1; + uint32_t v2; - memcpy(&v1, a1, sizeof(u_int32_t)); - memcpy(&v2, a2, sizeof(u_int32_t)); + memcpy(&v1, a1, sizeof(uint32_t)); + memcpy(&v2, a2, sizeof(uint32_t)); v1 = ntohl(v1); v2 = ntohl(v2); @@ -132,28 +132,28 @@ static int community_compare(const void *a1, const void *a2) return 0; } -int community_include(struct community *com, u_int32_t val) +int community_include(struct community *com, uint32_t val) { int i; val = htonl(val); for (i = 0; i < com->size; i++) - if (memcmp(&val, com_nthval(com, i), sizeof(u_int32_t)) == 0) + if (memcmp(&val, com_nthval(com, i), sizeof(uint32_t)) == 0) return 1; return 0; } -u_int32_t community_val_get(struct community *com, int i) +uint32_t community_val_get(struct community *com, int i) { - u_char *p; - u_int32_t val; + uint8_t *p; + uint32_t val; - p = (u_char *)com->val; + p = (uint8_t *)com->val; p += (i * 4); - memcpy(&val, p, sizeof(u_int32_t)); + memcpy(&val, p, sizeof(uint32_t)); return ntohl(val); } @@ -163,7 +163,7 @@ struct community *community_uniq_sort(struct community *com) { int i; struct community *new; - u_int32_t val; + uint32_t val; if (!com) return NULL; @@ -178,7 +178,7 @@ struct community *community_uniq_sort(struct community *com) community_add_val(new, val); } - qsort(new->val, new->size, sizeof(u_int32_t), community_compare); + qsort(new->val, new->size, sizeof(uint32_t), community_compare); return new; } @@ -201,9 +201,9 @@ static void set_community_string(struct community *com, bool make_json) char *pnt; int len; int first; - u_int32_t comval; - u_int16_t as; - u_int16_t val; + uint32_t comval; + uint16_t as; + uint16_t val; json_object *json_community_list = NULL; json_object *json_string = NULL; @@ -234,7 +234,7 @@ static void set_community_string(struct community *com, bool make_json) len = 0; for (i = 0; i < com->size; i++) { - memcpy(&comval, com_nthval(com, i), sizeof(u_int32_t)); + memcpy(&comval, com_nthval(com, i), sizeof(uint32_t)); comval = ntohl(comval); switch (comval) { @@ -265,7 +265,7 @@ static void set_community_string(struct community *com, bool make_json) /* Fill in string. */ for (i = 0; i < com->size; i++) { - memcpy(&comval, com_nthval(com, i), sizeof(u_int32_t)); + memcpy(&comval, com_nthval(com, i), sizeof(uint32_t)); comval = ntohl(comval); if (first) @@ -391,7 +391,7 @@ void community_unintern(struct community **com) } /* Create new community attribute. */ -struct community *community_parse(u_int32_t *pnt, u_short length) +struct community *community_parse(uint32_t *pnt, unsigned short length) { struct community tmp; struct community *new; @@ -441,7 +441,7 @@ char *community_str(struct community *com, bool make_json) hash package.*/ unsigned int community_hash_make(struct community *com) { - u_int32_t *pnt = (u_int32_t *)com->val; + uint32_t *pnt = (uint32_t *)com->val; return jhash2(pnt, com->size, 0x43ea96c1); } @@ -462,8 +462,7 @@ int community_match(const struct community *com1, const struct community *com2) /* Every community on com2 needs to be on com1 for this to match */ while (i < com1->size && j < com2->size) { - if (memcmp(com1->val + i, com2->val + j, sizeof(u_int32_t)) - == 0) + if (memcmp(com1->val + i, com2->val + j, sizeof(uint32_t)) == 0) j++; i++; } @@ -518,7 +517,7 @@ enum community_token { /* Get next community token from string. */ static const char * -community_gettoken(const char *buf, enum community_token *token, u_int32_t *val) +community_gettoken(const char *buf, enum community_token *token, uint32_t *val) { const char *p = buf; @@ -573,8 +572,8 @@ community_gettoken(const char *buf, enum community_token *token, u_int32_t *val) if (isdigit((int)*p)) { int separator = 0; int digit = 0; - u_int32_t community_low = 0; - u_int32_t community_high = 0; + uint32_t community_low = 0; + uint32_t community_high = 0; while (isdigit((int)*p) || *p == ':') { if (*p == ':') { @@ -624,7 +623,7 @@ struct community *community_str2com(const char *str) { struct community *com = NULL; struct community *com_sort = NULL; - u_int32_t val = 0; + uint32_t val = 0; enum community_token token = community_token_unknown; do { diff --git a/bgpd/bgp_community.h b/bgpd/bgp_community.h index 5016f132f..c180bea46 100644 --- a/bgpd/bgp_community.h +++ b/bgpd/bgp_community.h @@ -32,7 +32,7 @@ struct community { int size; /* Communities value. */ - u_int32_t *val; + uint32_t *val; /* Communities as a json object */ json_object *json; @@ -60,7 +60,7 @@ extern void community_init(void); extern void community_finish(void); extern void community_free(struct community *); extern struct community *community_uniq_sort(struct community *); -extern struct community *community_parse(u_int32_t *, u_short); +extern struct community *community_parse(uint32_t *, unsigned short); extern struct community *community_intern(struct community *); extern void community_unintern(struct community **); extern char *community_str(struct community *, bool make_json); @@ -73,10 +73,10 @@ extern struct community *community_merge(struct community *, extern struct community *community_delete(struct community *, struct community *); extern struct community *community_dup(struct community *); -extern int community_include(struct community *, u_int32_t); -extern void community_del_val(struct community *, u_int32_t *); +extern int community_include(struct community *, uint32_t); +extern void community_del_val(struct community *, uint32_t *); extern unsigned long community_count(void); extern struct hash *community_hash(void); -extern u_int32_t community_val_get(struct community *com, int i); +extern uint32_t community_val_get(struct community *com, int i); #endif /* _QUAGGA_BGP_COMMUNITY_H */ diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c index e2f97bf4f..1ed557e07 100644 --- a/bgpd/bgp_damp.c +++ b/bgpd/bgp_damp.c @@ -523,7 +523,7 @@ void bgp_config_write_damp(struct vty *vty) } static const char *bgp_get_reuse_time(unsigned int penalty, char *buf, - size_t len, u_char use_json, + size_t len, uint8_t use_json, json_object *json) { time_t reuse_time = 0; @@ -641,7 +641,7 @@ void bgp_damp_info_vty(struct vty *vty, struct bgp_info *binfo, } const char *bgp_damp_reuse_time_vty(struct vty *vty, struct bgp_info *binfo, - char *timebuf, size_t len, u_char use_json, + char *timebuf, size_t len, uint8_t use_json, json_object *json) { struct bgp_damp_info *bdi; diff --git a/bgpd/bgp_damp.h b/bgpd/bgp_damp.h index 1139ef839..d3b0ae42a 100644 --- a/bgpd/bgp_damp.h +++ b/bgpd/bgp_damp.h @@ -53,7 +53,7 @@ struct bgp_damp_info { int index; /* Last time message type. */ - u_char lastrecord; + uint8_t lastrecord; #define BGP_RECORD_UPDATE 1U #define BGP_RECORD_WITHDRAW 2U @@ -141,7 +141,7 @@ extern void bgp_config_write_damp(struct vty *); extern void bgp_damp_info_vty(struct vty *, struct bgp_info *, json_object *json_path); extern const char *bgp_damp_reuse_time_vty(struct vty *, struct bgp_info *, - char *, size_t, u_char, + char *, size_t, uint8_t, json_object *); extern int bgp_show_dampening_parameters(struct vty *vty, afi_t, safi_t); diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index f86726695..54fcd47e4 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -469,13 +469,13 @@ const char *bgp_notify_subcode_str(char code, char subcode) } /* extract notify admin reason if correctly present */ -const char *bgp_notify_admin_message(char *buf, size_t bufsz, u_char *data, +const char *bgp_notify_admin_message(char *buf, size_t bufsz, uint8_t *data, size_t datalen) { if (!data || datalen < 1) return NULL; - u_char len = data[0]; + uint8_t len = data[0]; if (len > 128 || len > datalen - 1) return NULL; @@ -2159,8 +2159,8 @@ int bgp_debug_zebra(struct prefix *p) const char *bgp_debug_rdpfxpath2str(afi_t afi, safi_t safi, struct prefix_rd *prd, union prefixconstptr pu, - mpls_label_t *label, u_int32_t num_labels, - int addpath_valid, u_int32_t addpath_id, + mpls_label_t *label, uint32_t num_labels, + int addpath_valid, uint32_t addpath_id, char *str, int size) { char rd_buf[RD_ADDRSTRLEN]; @@ -2192,7 +2192,7 @@ const char *bgp_debug_rdpfxpath2str(afi_t afi, safi_t safi, bgp_evpn_label2str(label, num_labels, tag_buf2, 20); sprintf(tag_buf, " label %s", tag_buf2); } else { - u_int32_t label_value; + uint32_t label_value; label_value = decode_label(label); sprintf(tag_buf, " label %u", label_value); diff --git a/bgpd/bgp_debug.h b/bgpd/bgp_debug.h index fe7ca8c46..d5dee5991 100644 --- a/bgpd/bgp_debug.h +++ b/bgpd/bgp_debug.h @@ -161,9 +161,9 @@ extern int bgp_debug_zebra(struct prefix *p); extern int bgp_debug_count(void); extern const char *bgp_debug_rdpfxpath2str(afi_t, safi_t, struct prefix_rd *, union prefixconstptr, mpls_label_t *, - u_int32_t, int, u_int32_t, char *, + uint32_t, int, uint32_t, char *, int); -const char *bgp_notify_admin_message(char *buf, size_t bufsz, u_char *data, +const char *bgp_notify_admin_message(char *buf, size_t bufsz, uint8_t *data, size_t datalen); #endif /* _QUAGGA_BGP_DEBUG_H */ diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index 4e998b1fd..d69b1c46f 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -277,7 +277,7 @@ static void bgp_dump_routes_index_table(struct bgp *bgp) if (sockunion_family(&peer->su) == AF_INET) { stream_put_in_addr(obuf, &peer->su.sin.sin_addr); } else if (sockunion_family(&peer->su) == AF_INET6) { - stream_write(obuf, (u_char *)&peer->su.sin6.sin6_addr, + stream_write(obuf, (uint8_t *)&peer->su.sin6.sin6_addr, IPV6_MAX_BYTELEN); } @@ -329,12 +329,12 @@ static struct bgp_info *bgp_dump_route_node_record(int afi, struct bgp_node *rn, if (afi == AFI_IP) { /* We'll dump only the useful bits (those not 0), but have to * align on 8 bits */ - stream_write(obuf, (u_char *)&rn->p.u.prefix4, + stream_write(obuf, (uint8_t *)&rn->p.u.prefix4, (rn->p.prefixlen + 7) / 8); } else if (afi == AFI_IP6) { /* We'll dump only the useful bits (those not 0), but have to * align on 8 bits */ - stream_write(obuf, (u_char *)&rn->p.u.prefix6, + stream_write(obuf, (uint8_t *)&rn->p.u.prefix6, (rn->p.prefixlen + 7) / 8); } diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index cea1c6baa..8b60ead38 100644 --- a/bgpd/bgp_ecommunity.c +++ b/bgpd/bgp_ecommunity.c @@ -68,7 +68,7 @@ static void ecommunity_hash_free(struct ecommunity *ecom) else return 0. */ int ecommunity_add_val(struct ecommunity *ecom, struct ecommunity_val *eval) { - u_int8_t *p; + uint8_t *p; int ret; int c; @@ -126,7 +126,7 @@ struct ecommunity *ecommunity_uniq_sort(struct ecommunity *ecom) } /* Parse Extended Communites Attribute in BGP packet. */ -struct ecommunity *ecommunity_parse(u_int8_t *pnt, u_short length) +struct ecommunity *ecommunity_parse(uint8_t *pnt, unsigned short length) { struct ecommunity tmp; struct ecommunity *new; @@ -283,8 +283,8 @@ enum ecommunity_token { * Encode BGP extended community from passed values. Supports types * defined in RFC 4360 and well-known sub-types. */ -static int ecommunity_encode(u_char type, u_char sub_type, int trans, as_t as, - struct in_addr ip, u_int32_t val, +static int ecommunity_encode(uint8_t type, uint8_t sub_type, int trans, as_t as, + struct in_addr ip, uint32_t val, struct ecommunity_val *eval) { assert(eval); @@ -338,8 +338,8 @@ static const char *ecommunity_gettoken(const char *str, char *endptr; struct in_addr ip; as_t as = 0; - u_int32_t val = 0; - u_char ecomm_type; + uint32_t val = 0; + uint8_t ecomm_type; char buf[INET_ADDRSTRLEN + 1]; /* Skip white space. */ @@ -547,7 +547,7 @@ struct ecommunity *ecommunity_str2com(const char *str, int type, return ecom; } -static int ecommunity_rt_soo_str(char *buf, u_int8_t *pnt, int type, +static int ecommunity_rt_soo_str(char *buf, uint8_t *pnt, int type, int sub_type, int format) { int len = 0; @@ -628,7 +628,7 @@ static int ecommunity_rt_soo_str(char *buf, u_int8_t *pnt, int type, char *ecommunity_ecom2str(struct ecommunity *ecom, int format, int filter) { int i; - u_int8_t *pnt; + uint8_t *pnt; int type = 0; int sub_type = 0; #define ECOMMUNITY_STR_DEFAULT_LEN 27 @@ -712,8 +712,8 @@ char *ecommunity_ecom2str(struct ecommunity *ecom, int format, int filter) (uint8_t)rmac.octet[5]); } else if (*pnt == ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY) { - u_int32_t seqnum; - u_char flags = *++pnt; + uint32_t seqnum; + uint8_t flags = *++pnt; memcpy(&seqnum, pnt + 2, 4); seqnum = ntohl(seqnum); @@ -774,7 +774,7 @@ int ecommunity_match(const struct ecommunity *ecom1, extern struct ecommunity_val *ecommunity_lookup(const struct ecommunity *ecom, uint8_t type, uint8_t subtype) { - u_int8_t *p; + uint8_t *p; int c; /* If the value already exists in the structure return 0. */ @@ -795,7 +795,7 @@ extern struct ecommunity_val *ecommunity_lookup(const struct ecommunity *ecom, extern int ecommunity_strip(struct ecommunity *ecom, uint8_t type, uint8_t subtype) { - u_int8_t *p; + uint8_t *p; int c, found = 0; /* When this is fist value, just add it. */ if (ecom == NULL || ecom->val == NULL) { diff --git a/bgpd/bgp_ecommunity.h b/bgpd/bgp_ecommunity.h index c967f8bd4..4cdb8b8ac 100644 --- a/bgpd/bgp_ecommunity.h +++ b/bgpd/bgp_ecommunity.h @@ -64,7 +64,7 @@ struct ecommunity { int size; /* Extended Communities value. */ - u_int8_t *val; + uint8_t *val; /* Human readable format string. */ char *str; @@ -90,7 +90,7 @@ struct ecommunity_val { /* * Encode BGP Route Target AS:nn. */ -static inline void encode_route_target_as(as_t as, u_int32_t val, +static inline void encode_route_target_as(as_t as, uint32_t val, struct ecommunity_val *eval) { eval->val[0] = ECOMMUNITY_ENCODE_AS; @@ -106,7 +106,7 @@ static inline void encode_route_target_as(as_t as, u_int32_t val, /* * Encode BGP Route Target IP:nn. */ -static inline void encode_route_target_ip(struct in_addr ip, u_int16_t val, +static inline void encode_route_target_ip(struct in_addr ip, uint16_t val, struct ecommunity_val *eval) { eval->val[0] = ECOMMUNITY_ENCODE_IP; @@ -119,7 +119,7 @@ static inline void encode_route_target_ip(struct in_addr ip, u_int16_t val, /* * Encode BGP Route Target AS4:nn. */ -static inline void encode_route_target_as4(as_t as, u_int16_t val, +static inline void encode_route_target_as4(as_t as, uint16_t val, struct ecommunity_val *eval) { eval->val[0] = ECOMMUNITY_ENCODE_AS4; @@ -135,7 +135,7 @@ static inline void encode_route_target_as4(as_t as, u_int16_t val, extern void ecommunity_init(void); extern void ecommunity_finish(void); extern void ecommunity_free(struct ecommunity **); -extern struct ecommunity *ecommunity_parse(u_int8_t *, u_short); +extern struct ecommunity *ecommunity_parse(uint8_t *, unsigned short); extern struct ecommunity *ecommunity_dup(struct ecommunity *); extern struct ecommunity *ecommunity_merge(struct ecommunity *, struct ecommunity *); diff --git a/bgpd/bgp_encap_types.h b/bgpd/bgp_encap_types.h index cf6f70cf5..8d1bf682a 100644 --- a/bgpd/bgp_encap_types.h +++ b/bgpd/bgp_encap_types.h @@ -82,7 +82,7 @@ struct bgp_tea_subtlv_color { /* per draft-rosen-idr-tunnel-encaps */ struct bgp_tea_subtlv_remote_endpoint { - u_char family; /* IPv4 or IPv6 */ + uint8_t family; /* IPv4 or IPv6 */ union { struct in_addr v4; struct in6_addr v6; diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index c1fc45f07..d9f99bc08 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -335,7 +335,7 @@ static int evpn_route_target_cmp(struct ecommunity *ecom1, static inline void mask_ecom_global_admin(struct ecommunity_val *dst, struct ecommunity_val *src) { - u_char type; + uint8_t type; type = src->val[0]; dst->val[0] = 0; @@ -488,7 +488,7 @@ static void evpn_convert_nexthop_to_ipv6(struct attr *attr) static int bgp_zebra_send_remote_macip(struct bgp *bgp, struct bgpevpn *vpn, struct prefix_evpn *p, struct in_addr remote_vtep_ip, int add, - u_char flags) + uint8_t flags) { struct stream *s; int ipa_len; @@ -603,7 +603,7 @@ static void build_evpn_type5_route_extcomm(struct bgp *bgp_vrf, memset(&ecom_encap, 0, sizeof(ecom_encap)); encode_encap_extcomm(tnl_type, &eval); ecom_encap.size = 1; - ecom_encap.val = (u_int8_t *)eval.val; + ecom_encap.val = (uint8_t *)eval.val; /* Add Encap */ attr->ecommunity = ecommunity_dup(&ecom_encap); @@ -653,7 +653,7 @@ static void build_evpn_route_extcomm(struct bgpevpn *vpn, struct attr *attr, bgp_encap_types tnl_type; struct listnode *node, *nnode; struct ecommunity *ecom; - u_int32_t seqnum; + uint32_t seqnum; struct list *vrf_export_rtl = NULL; /* Encap */ @@ -661,7 +661,7 @@ static void build_evpn_route_extcomm(struct bgpevpn *vpn, struct attr *attr, memset(&ecom_encap, 0, sizeof(ecom_encap)); encode_encap_extcomm(tnl_type, &eval); ecom_encap.size = 1; - ecom_encap.val = (u_int8_t *)eval.val; + ecom_encap.val = (uint8_t *)eval.val; /* Add Encap */ attr->ecommunity = ecommunity_dup(&ecom_encap); @@ -689,7 +689,7 @@ static void build_evpn_route_extcomm(struct bgpevpn *vpn, struct attr *attr, memset(&ecom_sticky, 0, sizeof(ecom_sticky)); encode_mac_mobility_extcomm(1, seqnum, &eval_sticky); ecom_sticky.size = 1; - ecom_sticky.val = (u_int8_t *)eval_sticky.val; + ecom_sticky.val = (uint8_t *)eval_sticky.val; attr->ecommunity = ecommunity_merge(attr->ecommunity, &ecom_sticky); } @@ -720,13 +720,13 @@ static void build_evpn_route_extcomm(struct bgpevpn *vpn, struct attr *attr, /* * Add MAC mobility extended community to attribute. */ -static void add_mac_mobility_to_attr(u_int32_t seq_num, struct attr *attr) +static void add_mac_mobility_to_attr(uint32_t seq_num, struct attr *attr) { struct ecommunity ecom_tmp; struct ecommunity_val eval; - u_int8_t *ecom_val_ptr; + uint8_t *ecom_val_ptr; int i; - u_int8_t *pnt; + uint8_t *pnt; int type = 0; int sub_type = 0; @@ -745,9 +745,8 @@ static void add_mac_mobility_to_attr(u_int32_t seq_num, struct attr *attr) if (type == ECOMMUNITY_ENCODE_EVPN && sub_type == ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY) { - ecom_val_ptr = - (u_int8_t *)(attr->ecommunity->val - + (i * 8)); + ecom_val_ptr = (uint8_t *)(attr->ecommunity->val + + (i * 8)); break; } } @@ -761,7 +760,7 @@ static void add_mac_mobility_to_attr(u_int32_t seq_num, struct attr *attr) else { memset(&ecom_tmp, 0, sizeof(ecom_tmp)); ecom_tmp.size = 1; - ecom_tmp.val = (u_int8_t *)eval.val; + ecom_tmp.val = (uint8_t *)eval.val; attr->ecommunity = ecommunity_merge(attr->ecommunity, &ecom_tmp); @@ -771,7 +770,7 @@ static void add_mac_mobility_to_attr(u_int32_t seq_num, struct attr *attr) /* Install EVPN route into zebra. */ static int evpn_zebra_install(struct bgp *bgp, struct bgpevpn *vpn, struct prefix_evpn *p, - struct in_addr remote_vtep_ip, u_char flags) + struct in_addr remote_vtep_ip, uint8_t flags) { int ret; @@ -848,7 +847,7 @@ static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn, afi_t afi = AFI_L2VPN; safi_t safi = SAFI_EVPN; int ret = 0; - u_char flags = 0; + uint8_t flags = 0; /* Compute the best path. */ bgp_best_selection(bgp, rn, &bgp->maxpaths[afi][safi], &old_and_new, @@ -1111,15 +1110,15 @@ static int update_evpn_type5_route(struct bgp *bgp_vrf, struct prefix_evpn *evp, static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn, afi_t afi, safi_t safi, struct bgp_node *rn, struct attr *attr, int add, int vni_table, - struct bgp_info **ri, u_char flags) + struct bgp_info **ri, uint8_t flags) { struct bgp_info *tmp_ri; struct bgp_info *local_ri, *remote_ri; struct attr *attr_new; mpls_label_t label[BGP_MAX_LABELS]; - u_int32_t num_labels = 1; + uint32_t num_labels = 1; int route_change = 1; - u_char sticky = 0; + uint8_t sticky = 0; struct prefix_evpn *evp; *ri = NULL; @@ -1167,7 +1166,7 @@ static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn, * This will ensure that local routes are preferred for g/w macs */ if (remote_ri && !CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_GW)) { - u_int32_t cur_seqnum; + uint32_t cur_seqnum; /* Add MM extended community to route. */ cur_seqnum = mac_mobility_seqnum(remote_ri->attr); @@ -1260,7 +1259,7 @@ static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn, * and schedule for processing. */ static int update_evpn_route(struct bgp *bgp, struct bgpevpn *vpn, - struct prefix_evpn *p, u_char flags) + struct prefix_evpn *p, uint8_t flags) { struct bgp_node *rn; struct attr attr; @@ -2083,8 +2082,8 @@ static int is_route_matching_for_vrf(struct bgp *bgp_vrf, struct bgp_info *ri) * matches, we're done. */ for (i = 0; i < ecom->size; i++) { - u_char *pnt; - u_char type, sub_type; + uint8_t *pnt; + uint8_t type, sub_type; struct ecommunity_val *eval; struct ecommunity_val eval_tmp; struct vrf_irt_node *irt; @@ -2150,8 +2149,8 @@ static int is_route_matching_for_vni(struct bgp *bgp, struct bgpevpn *vpn, * matches, we're done. */ for (i = 0; i < ecom->size; i++) { - u_char *pnt; - u_char type, sub_type; + uint8_t *pnt; + uint8_t type, sub_type; struct ecommunity_val *eval; struct ecommunity_val eval_tmp; struct irt_node *irt; @@ -2519,8 +2518,8 @@ static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi, * the route into matching VNIs/VRFs. */ for (i = 0; i < ecom->size; i++) { - u_char *pnt; - u_char type, sub_type; + uint8_t *pnt; + uint8_t type, sub_type; struct ecommunity_val *eval; struct ecommunity_val eval_tmp; struct irt_node *irt; /* import rt for l2vni */ @@ -2806,15 +2805,15 @@ static void withdraw_router_id_vni(struct hash_backet *backet, struct bgp *bgp) * Process received EVPN type-2 route (advertise or withdraw). */ static int process_type2_route(struct peer *peer, afi_t afi, safi_t safi, - struct attr *attr, u_char *pfx, int psize, - u_int32_t addpath_id) + struct attr *attr, uint8_t *pfx, int psize, + uint32_t addpath_id) { struct prefix_rd prd; struct prefix_evpn p; - u_char ipaddr_len; - u_char macaddr_len; + uint8_t ipaddr_len; + uint8_t macaddr_len; mpls_label_t label[BGP_MAX_LABELS]; /* holds the VNI(s) as in packet */ - u_int32_t num_labels = 0; + uint32_t num_labels = 0; int ret; /* Type-2 route should be either 33, 37 or 49 bytes or an @@ -2915,12 +2914,12 @@ static int process_type2_route(struct peer *peer, afi_t afi, safi_t safi, * Process received EVPN type-3 route (advertise or withdraw). */ static int process_type3_route(struct peer *peer, afi_t afi, safi_t safi, - struct attr *attr, u_char *pfx, int psize, - u_int32_t addpath_id) + struct attr *attr, uint8_t *pfx, int psize, + uint32_t addpath_id) { struct prefix_rd prd; struct prefix_evpn p; - u_char ipaddr_len; + uint8_t ipaddr_len; int ret; /* Type-3 route should be either 17 or 29 bytes: RD (8), Eth Tag (4), @@ -2988,14 +2987,14 @@ static int process_type3_route(struct peer *peer, afi_t afi, safi_t safi, * Process received EVPN type-5 route (advertise or withdraw). */ static int process_type5_route(struct peer *peer, afi_t afi, safi_t safi, - struct attr *attr, u_char *pfx, int psize, - u_int32_t addpath_id, int withdraw) + struct attr *attr, uint8_t *pfx, int psize, + uint32_t addpath_id, int withdraw) { struct prefix_rd prd; struct prefix_evpn p; struct bgp_route_evpn evpn; - u_char ippfx_len; - u_int32_t eth_tag; + uint8_t ippfx_len; + uint32_t eth_tag; mpls_label_t label; /* holds the VNI as in the packet */ int ret; @@ -3087,7 +3086,7 @@ static int process_type5_route(struct peer *peer, afi_t afi, safi_t safi, static void evpn_mpattr_encode_type5(struct stream *s, struct prefix *p, struct prefix_rd *prd, mpls_label_t *label, - u_int32_t num_labels, struct attr *attr) + uint32_t num_labels, struct attr *attr) { int len; char temp[16]; @@ -3547,7 +3546,7 @@ int bgp_evpn_uninstall_routes(struct bgp *bgp, struct bgpevpn *vpn) /* * TODO: Hardcoded for a maximum of 2 VNIs right now */ -char *bgp_evpn_label2str(mpls_label_t *label, u_int32_t num_labels, char *buf, +char *bgp_evpn_label2str(mpls_label_t *label, uint32_t num_labels, char *buf, int len) { vni_t vni1, vni2; @@ -3596,7 +3595,7 @@ void bgp_evpn_route2json(struct prefix_evpn *p, json_object *json) buf1, sizeof(buf1))); } else { - u_char family; + uint8_t family; family = IS_EVPN_PREFIX_IPADDR_V4(p) ? AF_INET : AF_INET6; @@ -3647,7 +3646,7 @@ char *bgp_evpn_route2str(struct prefix_evpn *p, char *buf, int len) prefix_mac2str(&p->prefix.mac, buf1, sizeof(buf1))); else { - u_char family; + uint8_t family; family = IS_EVPN_PREFIX_IPADDR_V4(p) ? AF_INET : AF_INET6; @@ -3680,8 +3679,8 @@ char *bgp_evpn_route2str(struct prefix_evpn *p, char *buf, int len) */ void bgp_evpn_encode_prefix(struct stream *s, struct prefix *p, struct prefix_rd *prd, mpls_label_t *label, - u_int32_t num_labels, struct attr *attr, - int addpath_encode, u_int32_t addpath_tx_id) + uint32_t num_labels, struct attr *attr, + int addpath_encode, uint32_t addpath_tx_id) { struct prefix_evpn *evp = (struct prefix_evpn *)p; int len, ipa_len = 0; @@ -3740,15 +3739,15 @@ void bgp_evpn_encode_prefix(struct stream *s, struct prefix *p, int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr, struct bgp_nlri *packet, int withdraw) { - u_char *pnt; - u_char *lim; + uint8_t *pnt; + uint8_t *lim; afi_t afi; safi_t safi; - u_int32_t addpath_id; + uint32_t addpath_id; int addpath_encoded; int psize = 0; - u_char rtype; - u_char rlen; + uint8_t rtype; + uint8_t rlen; struct prefix p; /* Start processing the NLRI - there may be multiple in the MP_REACH */ @@ -4192,7 +4191,7 @@ int bgp_evpn_local_macip_del(struct bgp *bgp, vni_t vni, struct ethaddr *mac, * Handle add of a local MACIP. */ int bgp_evpn_local_macip_add(struct bgp *bgp, vni_t vni, struct ethaddr *mac, - struct ipaddr *ip, u_char flags) + struct ipaddr *ip, uint8_t flags) { struct bgpevpn *vpn; struct prefix_evpn p; diff --git a/bgpd/bgp_evpn.h b/bgpd/bgp_evpn.h index 7c0d63832..343327a66 100644 --- a/bgpd/bgp_evpn.h +++ b/bgpd/bgp_evpn.h @@ -36,7 +36,7 @@ static inline int is_evpn_enabled(void) static inline void vni2label(vni_t vni, mpls_label_t *label) { - u_char *tag = (u_char *)label; + uint8_t *tag = (uint8_t *)label; tag[0] = (vni >> 16) & 0xFF; tag[1] = (vni >> 8) & 0xFF; @@ -45,12 +45,12 @@ static inline void vni2label(vni_t vni, mpls_label_t *label) static inline vni_t label2vni(mpls_label_t *label) { - u_char *tag = (u_char *)label; + uint8_t *tag = (uint8_t *)label; vni_t vni; - vni = ((u_int32_t)*tag++ << 16); - vni |= (u_int32_t)*tag++ << 8; - vni |= (u_int32_t)(*tag & 0xFF); + vni = ((uint32_t)*tag++ << 16); + vni |= (uint32_t)*tag++ << 8; + vni |= (uint32_t)(*tag & 0xFF); return vni; } @@ -86,14 +86,14 @@ extern void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf, afi_t afi, safi_t safi); extern void bgp_evpn_vrf_delete(struct bgp *bgp_vrf); extern void bgp_evpn_handle_router_id_update(struct bgp *bgp, int withdraw); -extern char *bgp_evpn_label2str(mpls_label_t *label, u_int32_t num_labels, +extern char *bgp_evpn_label2str(mpls_label_t *label, uint32_t num_labels, char *buf, int len); extern char *bgp_evpn_route2str(struct prefix_evpn *p, char *buf, int len); extern void bgp_evpn_route2json(struct prefix_evpn *p, json_object *json); extern void bgp_evpn_encode_prefix(struct stream *s, struct prefix *p, struct prefix_rd *prd, mpls_label_t *label, - u_int32_t num_labels, struct attr *attr, - int addpath_encode, u_int32_t addpath_tx_id); + uint32_t num_labels, struct attr *attr, + int addpath_encode, uint32_t addpath_tx_id); extern int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr, struct bgp_nlri *packet, int withdraw); extern int bgp_evpn_import_route(struct bgp *bgp, afi_t afi, safi_t safi, @@ -105,7 +105,7 @@ extern int bgp_evpn_local_macip_del(struct bgp *bgp, vni_t vni, struct ethaddr *mac, struct ipaddr *ip); extern int bgp_evpn_local_macip_add(struct bgp *bgp, vni_t vni, struct ethaddr *mac, struct ipaddr *ip, - u_char flags); + uint8_t flags); extern int bgp_evpn_local_l3vni_add(vni_t vni, vrf_id_t vrf_id, struct ethaddr *rmac, struct in_addr originator_ip, int filter); diff --git a/bgpd/bgp_evpn_private.h b/bgpd/bgp_evpn_private.h index ce279005d..1eecb9ecf 100644 --- a/bgpd/bgp_evpn_private.h +++ b/bgpd/bgp_evpn_private.h @@ -55,7 +55,7 @@ typedef enum { struct bgpevpn { vni_t vni; vrf_id_t tenant_vrf_id; - u_int32_t flags; + uint32_t flags; #define VNI_FLAG_CFGD 0x1 /* VNI is user configured */ #define VNI_FLAG_LIVE 0x2 /* VNI is "live" */ #define VNI_FLAG_RD_CFGD 0x4 /* RD is user configured. */ @@ -69,31 +69,31 @@ struct bgpevpn { /* Flag to indicate if we are * advertising the g/w mac ip for * this VNI*/ - u_int8_t advertise_gw_macip; + uint8_t advertise_gw_macip; - /* Flag to indicate if we are - * advertising subnet for this VNI */ - u_int8_t advertise_subnet; + /* Flag to indicate if we are + * advertising subnet for this VNI */ + uint8_t advertise_subnet; - /* Id for deriving the RD - * automatically for this VNI */ - u_int16_t rd_id; + /* Id for deriving the RD + * automatically for this VNI */ + uint16_t rd_id; - /* RD for this VNI. */ - struct prefix_rd prd; + /* RD for this VNI. */ + struct prefix_rd prd; - /* Route type 3 field */ - struct in_addr originator_ip; + /* Route type 3 field */ + struct in_addr originator_ip; - /* Import and Export RTs. */ - struct list *import_rtl; - struct list *export_rtl; + /* Import and Export RTs. */ + struct list *import_rtl; + struct list *export_rtl; - /* Route table for EVPN routes for - * this VNI. */ - struct bgp_table *route_table; + /* Route table for EVPN routes for + * this VNI. */ + struct bgp_table *route_table; - QOBJ_FIELDS + QOBJ_FIELDS }; DECLARE_QOBJ_TYPE(bgpevpn) @@ -254,7 +254,7 @@ static inline void encode_default_gw_extcomm(struct ecommunity_val *eval) eval->val[1] = ECOMMUNITY_EVPN_SUBTYPE_DEF_GW; } -static inline void encode_mac_mobility_extcomm(int static_mac, u_int32_t seq, +static inline void encode_mac_mobility_extcomm(int static_mac, uint32_t seq, struct ecommunity_val *eval) { memset(eval, 0, sizeof(*eval)); diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index 3d77199bf..8fd7cb5d1 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -56,8 +56,8 @@ struct vni_walk_ctx { static void display_vrf_import_rt(struct vty *vty, struct vrf_irt_node *irt, json_object *json) { - u_char *pnt; - u_char type, sub_type; + uint8_t *pnt; + uint8_t type, sub_type; struct ecommunity_as eas; struct ecommunity_ip eip; struct listnode *node, *nnode; @@ -71,7 +71,7 @@ static void display_vrf_import_rt(struct vty *vty, struct vrf_irt_node *irt, json_vrfs = json_object_new_array(); } - pnt = (u_char *)&irt->rt.val; + pnt = (uint8_t *)&irt->rt.val; type = *pnt++; sub_type = *pnt++; if (sub_type != ECOMMUNITY_ROUTE_TARGET) @@ -164,8 +164,8 @@ static void show_vrf_import_rt_entry(struct hash_backet *backet, void *args[]) static void display_import_rt(struct vty *vty, struct irt_node *irt, json_object *json) { - u_char *pnt; - u_char type, sub_type; + uint8_t *pnt; + uint8_t type, sub_type; struct ecommunity_as eas; struct ecommunity_ip eip; struct listnode *node, *nnode; @@ -181,7 +181,7 @@ static void display_import_rt(struct vty *vty, struct irt_node *irt, /* TODO: This needs to go into a function */ - pnt = (u_char *)&irt->rt.val; + pnt = (uint8_t *)&irt->rt.val; type = *pnt++; sub_type = *pnt++; if (sub_type != ECOMMUNITY_ROUTE_TARGET) @@ -274,10 +274,10 @@ static void bgp_evpn_show_route_rd_header(struct vty *vty, struct bgp_node *rd_rn, json_object *json) { - u_int16_t type; + uint16_t type; struct rd_as rd_as; struct rd_ip rd_ip; - u_char *pnt; + uint8_t *pnt; char rd_str[RD_ADDRSTRLEN]; pnt = rd_rn->p.u.val; @@ -495,7 +495,7 @@ static void show_vni_routes(struct bgp *bgp, struct bgpevpn *vpn, int type, struct bgp_node *rn; struct bgp_info *ri; int header = 1; - u_int32_t prefix_cnt, path_cnt; + uint32_t prefix_cnt, path_cnt; prefix_cnt = path_cnt = 0; @@ -814,7 +814,7 @@ static void show_vni_entry(struct hash_backet *backet, void *args[]) static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd, enum bgp_show_type type, void *output_arg, - int option, u_char use_json) + int option, uint8_t use_json) { afi_t afi = AFI_L2VPN; struct bgp *bgp; @@ -930,10 +930,10 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd, header = 0; } if (rd_header) { - u_int16_t type; + uint16_t type; struct rd_as rd_as; struct rd_ip rd_ip; - u_char *pnt; + uint8_t *pnt; pnt = rn->p.u.val; @@ -1103,7 +1103,7 @@ DEFUN(show_ip_bgp_l2vpn_evpn_all_neighbor_routes, union sockunion su; struct peer *peer; int ret; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); argv_find(argv, argc, "A.B.C.D", &idx_ipv4); @@ -1163,7 +1163,7 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd_neighbor_routes, union sockunion su; struct peer *peer; struct prefix_rd prd; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); argv_find(argv, argc, "ASN:NN_OR_IP-ADDRESS:NN", &idx_ext_community); argv_find(argv, argc, "A.B.C.D", &idx_ipv4); @@ -1236,7 +1236,7 @@ DEFUN(show_ip_bgp_l2vpn_evpn_all_neighbor_advertised_routes, int ret; struct peer *peer; union sockunion su; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); argv_find(argv, argc, "A.B.C.D", &idx_ipv4); @@ -1294,7 +1294,7 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd_neighbor_advertised_routes, struct peer *peer; struct prefix_rd prd; union sockunion su; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); argv_find(argv, argc, "ASN:NN_OR_IP-ADDRESS:NN", &idx_ext_community); argv_find(argv, argc, "A.B.C.D", &idx_ipv4); @@ -1807,7 +1807,7 @@ static void evpn_show_import_rts(struct vty *vty, struct bgp *bgp, static void evpn_show_routes_vni_all(struct vty *vty, struct bgp *bgp, struct in_addr vtep_ip, json_object *json) { - u_int32_t num_vnis; + uint32_t num_vnis; struct vni_walk_ctx wctx; num_vnis = hashcount(bgp->vnihash); @@ -1834,7 +1834,7 @@ static void evpn_show_route_vni_multicast(struct vty *vty, struct bgp *bgp, struct prefix_evpn p; struct bgp_node *rn; struct bgp_info *ri; - u_int32_t path_cnt = 0; + uint32_t path_cnt = 0; afi_t afi; safi_t safi; json_object *json_paths = NULL; @@ -1903,7 +1903,7 @@ static void evpn_show_route_vni_macip(struct vty *vty, struct bgp *bgp, struct prefix_evpn p; struct bgp_node *rn; struct bgp_info *ri; - u_int32_t path_cnt = 0; + uint32_t path_cnt = 0; afi_t afi; safi_t safi; json_object *json_paths = NULL; @@ -1998,7 +1998,7 @@ static void evpn_show_route_rd_macip(struct vty *vty, struct bgp *bgp, struct bgp_info *ri; afi_t afi; safi_t safi; - u_int32_t path_cnt = 0; + uint32_t path_cnt = 0; json_object *json_paths = NULL; char prefix_str[BUFSIZ]; @@ -2065,7 +2065,7 @@ static void evpn_show_route_rd(struct vty *vty, struct bgp *bgp, int rd_header = 1; afi_t afi; safi_t safi; - u_int32_t prefix_cnt, path_cnt; + uint32_t prefix_cnt, path_cnt; char rd_str[RD_ADDRSTRLEN]; json_object *json_rd = NULL; int add_rd_to_json = 0; @@ -2187,7 +2187,7 @@ static void evpn_show_all_routes(struct vty *vty, struct bgp *bgp, int type, int rd_header; afi_t afi; safi_t safi; - u_int32_t prefix_cnt, path_cnt; + uint32_t prefix_cnt, path_cnt; afi = AFI_L2VPN; safi = SAFI_EVPN; @@ -2313,7 +2313,7 @@ static void evpn_show_all_routes(struct vty *vty, struct bgp *bgp, int type, static void evpn_show_vni(struct vty *vty, struct bgp *bgp, vni_t vni, json_object *json) { - u_char found = 0; + uint8_t found = 0; struct bgpevpn *vpn; vpn = bgp_evpn_lookup_vni(bgp, vni); @@ -2906,10 +2906,10 @@ DEFUN(show_bgp_l2vpn_evpn_vni, struct bgp *bgp_def; vni_t vni; int idx = 0; - u_char uj = 0; + uint8_t uj = 0; json_object *json = NULL; - u_int32_t num_l2vnis = 0; - u_int32_t num_l3vnis = 0; + uint32_t num_l2vnis = 0; + uint32_t num_l3vnis = 0; uint32_t num_vnis = 0; struct listnode *node = NULL; struct bgp *bgp_temp = NULL; @@ -2992,7 +2992,7 @@ DEFUN(show_bgp_l2vpn_evpn_summary, JSON_STR) { int idx_vrf = 0; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); char *vrf = NULL; if (argv_find(argv, argc, "vrf", &idx_vrf)) @@ -3020,7 +3020,7 @@ DEFUN(show_bgp_l2vpn_evpn_route, struct bgp *bgp; int type_idx = 0; int type = 0; - u_char uj = 0; + uint8_t uj = 0; json_object *json = NULL; uj = use_json(argc, argv); @@ -3472,7 +3472,7 @@ DEFUN(show_bgp_l2vpn_evpn_vrf_import_rt, "Show vrf import route target\n" JSON_STR) { - u_char uj = 0; + uint8_t uj = 0; struct bgp *bgp_def = NULL; json_object *json = NULL; @@ -3509,7 +3509,7 @@ DEFUN(show_bgp_l2vpn_evpn_import_rt, JSON_STR) { struct bgp *bgp; - u_char uj = 0; + uint8_t uj = 0; json_object *json = NULL; bgp = bgp_get_default(); @@ -3902,7 +3902,7 @@ DEFUN (show_bgp_vrf_l3vni_info, json_object *json_vnis = NULL; json_object *json_export_rts = NULL; json_object *json_import_rts = NULL; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); if (uj) { json = json_object_new_object(); diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index e4a0a1d40..a625b7fd2 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -166,8 +166,8 @@ static struct peer *peer_xfer_conn(struct peer *from_peer) zlog_err( "[%s] Dropping pending packet on connection transfer:", peer->host); - u_int16_t type = stream_getc_from(peer->curr, - BGP_MARKER_SIZE + 2); + uint16_t type = stream_getc_from(peer->curr, + BGP_MARKER_SIZE + 2); bgp_dump_packet(peer, type, peer->curr); stream_free(peer->curr); peer->curr = NULL; @@ -763,8 +763,8 @@ int bgp_maxmed_onstartup_active(struct bgp *bgp) void bgp_maxmed_update(struct bgp *bgp) { - u_char maxmed_active; - u_int32_t maxmed_value; + uint8_t maxmed_active; + uint32_t maxmed_value; if (bgp->v_maxmed_admin) { maxmed_active = 1; @@ -1199,7 +1199,8 @@ static int bgp_stop_with_error(struct peer *peer) /* something went wrong, send notify and tear down */ -static int bgp_stop_with_notify(struct peer *peer, u_char code, u_char sub_code) +static int bgp_stop_with_notify(struct peer *peer, uint8_t code, + uint8_t sub_code) { /* Send notify to remote peer */ bgp_notify_send(peer, code, sub_code); diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c index 862199741..3882ff8b5 100644 --- a/bgpd/bgp_io.c +++ b/bgpd/bgp_io.c @@ -281,7 +281,7 @@ static int bgp_process_reads(struct thread *thread) */ static uint16_t bgp_write(struct peer *peer) { - u_char type; + uint8_t type; struct stream *s; int num; int update_last_write = 0; diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c index 546ed0ed6..ceca644de 100644 --- a/bgpd/bgp_label.c +++ b/bgpd/bgp_label.c @@ -48,7 +48,7 @@ int bgp_parse_fec_update(void) struct bgp *bgp; struct bgp_table *table; struct prefix p; - u_int32_t label; + uint32_t label; afi_t afi; safi_t safi; @@ -124,7 +124,7 @@ void bgp_reg_dereg_for_label(struct bgp_node *rn, struct bgp_info *ri, int reg) struct stream *s; struct prefix *p; int command; - u_int16_t flags = 0; + uint16_t flags = 0; size_t flags_pos = 0; /* Check socket. */ @@ -164,13 +164,13 @@ void bgp_reg_dereg_for_label(struct bgp_node *rn, struct bgp_info *ri, int reg) zclient_send_message(zclient); } -static int bgp_nlri_get_labels(struct peer *peer, u_char *pnt, u_char plen, +static int bgp_nlri_get_labels(struct peer *peer, uint8_t *pnt, uint8_t plen, mpls_label_t *label) { - u_char *data = pnt; - u_char *lim = pnt + plen; - u_char llen = 0; - u_char label_depth = 0; + uint8_t *data = pnt; + uint8_t *lim = pnt + plen; + uint8_t llen = 0; + uint8_t label_depth = 0; for (; data < lim; data += BGP_LABEL_BYTES) { memcpy(label, data, BGP_LABEL_BYTES); @@ -200,17 +200,17 @@ static int bgp_nlri_get_labels(struct peer *peer, u_char *pnt, u_char plen, int bgp_nlri_parse_label(struct peer *peer, struct attr *attr, struct bgp_nlri *packet) { - u_char *pnt; - u_char *lim; + uint8_t *pnt; + uint8_t *lim; struct prefix p; int psize = 0; int prefixlen; afi_t afi; safi_t safi; int addpath_encoded; - u_int32_t addpath_id; + uint32_t addpath_id; mpls_label_t label = MPLS_INVALID_LABEL; - u_char llen; + uint8_t llen; pnt = packet->nlri; lim = pnt + packet->length; diff --git a/bgpd/bgp_label.h b/bgpd/bgp_label.h index 0b5eaa712..01bf8b372 100644 --- a/bgpd/bgp_label.h +++ b/bgpd/bgp_label.h @@ -51,7 +51,7 @@ static inline int bgp_labeled_safi(safi_t safi) static inline int bgp_is_withdraw_label(mpls_label_t *label) { - u_char *pkt = (u_char *)label; + uint8_t *pkt = (uint8_t *)label; /* The check on pkt[2] for 0x00 or 0x02 is in case bgp_set_valid_label() * was called on the withdraw label */ @@ -63,7 +63,7 @@ static inline int bgp_is_withdraw_label(mpls_label_t *label) static inline int bgp_is_valid_label(mpls_label_t *label) { - u_char *t = (u_char *)label; + uint8_t *t = (uint8_t *)label; if (!t) return 0; return (t[2] & 0x02); @@ -71,14 +71,14 @@ static inline int bgp_is_valid_label(mpls_label_t *label) static inline void bgp_set_valid_label(mpls_label_t *label) { - u_char *t = (u_char *)label; + uint8_t *t = (uint8_t *)label; if (t) t[2] |= 0x02; } static inline void bgp_unset_valid_label(mpls_label_t *label) { - u_char *t = (u_char *)label; + uint8_t *t = (uint8_t *)label; if (t) t[2] &= ~0x02; } @@ -95,17 +95,17 @@ static inline void bgp_unregister_for_label(struct bgp_node *rn) } /* Label stream to value */ -static inline u_int32_t label_pton(mpls_label_t *label) +static inline uint32_t label_pton(mpls_label_t *label) { - u_char *t = (u_char *)label; + uint8_t *t = (uint8_t *)label; return ((((unsigned int)t[0]) << 12) | (((unsigned int)t[1]) << 4) | ((unsigned int)((t[2] & 0xF0) >> 4))); } /* Encode label values */ -static inline void label_ntop(u_int32_t l, int bos, mpls_label_t *label) +static inline void label_ntop(uint32_t l, int bos, mpls_label_t *label) { - u_char *t = (u_char *)label; + uint8_t *t = (uint8_t *)label; t[0] = ((l & 0x000FF000) >> 12); t[1] = ((l & 0x00000FF0) >> 4); t[2] = ((l & 0x0000000F) << 4); @@ -114,9 +114,9 @@ static inline void label_ntop(u_int32_t l, int bos, mpls_label_t *label) } /* Return BOS value of label stream */ -static inline u_char label_bos(mpls_label_t *label) +static inline uint8_t label_bos(mpls_label_t *label) { - u_char *t = (u_char *)label; + uint8_t *t = (uint8_t *)label; return (t[2] & 0x01); }; diff --git a/bgpd/bgp_lcommunity.c b/bgpd/bgp_lcommunity.c index 36980b7c2..09b3a8718 100644 --- a/bgpd/bgp_lcommunity.c +++ b/bgpd/bgp_lcommunity.c @@ -66,7 +66,7 @@ static void lcommunity_hash_free(struct lcommunity *lcom) static int lcommunity_add_val(struct lcommunity *lcom, struct lcommunity_val *lval) { - u_int8_t *p; + uint8_t *p; int ret; int c; @@ -124,7 +124,7 @@ struct lcommunity *lcommunity_uniq_sort(struct lcommunity *lcom) } /* Parse Large Communites Attribute in BGP packet. */ -struct lcommunity *lcommunity_parse(u_int8_t *pnt, u_short length) +struct lcommunity *lcommunity_parse(uint8_t *pnt, unsigned short length) { struct lcommunity tmp; struct lcommunity *new; @@ -291,9 +291,9 @@ static const char *lcommunity_gettoken(const char *str, if (isdigit((int)*p)) { int separator = 0; int digit = 0; - u_int32_t globaladmin = 0; - u_int32_t localdata1 = 0; - u_int32_t localdata2 = 0; + uint32_t globaladmin = 0; + uint32_t localdata1 = 0; + uint32_t localdata2 = 0; while (isdigit((int)*p) || *p == ':') { if (*p == ':') { @@ -375,10 +375,10 @@ struct lcommunity *lcommunity_str2com(const char *str) return lcom; } -int lcommunity_include(struct lcommunity *lcom, u_char *ptr) +int lcommunity_include(struct lcommunity *lcom, uint8_t *ptr) { int i; - u_char *lcom_ptr; + uint8_t *lcom_ptr; for (i = 0; i < lcom->size; i++) { lcom_ptr = lcom->val + (i * LCOMMUNITY_SIZE); @@ -394,14 +394,14 @@ int lcommunity_include(struct lcommunity *lcom, u_char *ptr) char *lcommunity_lcom2str(struct lcommunity *lcom, int format) { int i; - u_int8_t *pnt; + uint8_t *pnt; #define LCOMMUNITY_STR_DEFAULT_LEN 40 int str_size; int str_pnt; char *str_buf; int len = 0; int first = 1; - u_int32_t globaladmin, localdata1, localdata2; + uint32_t globaladmin, localdata1, localdata2; if (lcom->size == 0) { str_buf = XMALLOC(MTYPE_LCOMMUNITY_STR, 1); @@ -472,7 +472,7 @@ int lcommunity_match(const struct lcommunity *lcom1, } /* Delete one lcommunity. */ -void lcommunity_del_val(struct lcommunity *lcom, u_char *ptr) +void lcommunity_del_val(struct lcommunity *lcom, uint8_t *ptr) { int i = 0; int c = 0; diff --git a/bgpd/bgp_lcommunity.h b/bgpd/bgp_lcommunity.h index 7576d7a98..78841accf 100644 --- a/bgpd/bgp_lcommunity.h +++ b/bgpd/bgp_lcommunity.h @@ -38,7 +38,7 @@ struct lcommunity { int size; /* Large Communities value. */ - u_int8_t *val; + uint8_t *val; /* Human readable format string. */ char *str; @@ -54,7 +54,7 @@ struct lcommunity_val { extern void lcommunity_init(void); extern void lcommunity_finish(void); extern void lcommunity_free(struct lcommunity **); -extern struct lcommunity *lcommunity_parse(u_int8_t *, u_short); +extern struct lcommunity *lcommunity_parse(uint8_t *, unsigned short); extern struct lcommunity *lcommunity_dup(struct lcommunity *); extern struct lcommunity *lcommunity_merge(struct lcommunity *, struct lcommunity *); @@ -69,6 +69,6 @@ extern char *lcommunity_lcom2str(struct lcommunity *, int); extern int lcommunity_match(const struct lcommunity *, const struct lcommunity *); extern char *lcommunity_str(struct lcommunity *); -extern int lcommunity_include(struct lcommunity *lcom, u_char *ptr); -extern void lcommunity_del_val(struct lcommunity *lcom, u_char *ptr); +extern int lcommunity_include(struct lcommunity *lcom, uint8_t *ptr); +extern void lcommunity_del_val(struct lcommunity *lcom, uint8_t *ptr); #endif /* _QUAGGA_BGP_LCOMMUNITY_H */ diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c index 667be5084..e33f3d347 100644 --- a/bgpd/bgp_mpath.c +++ b/bgpd/bgp_mpath.c @@ -46,7 +46,7 @@ * Record maximum-paths configuration for BGP instance */ int bgp_maximum_paths_set(struct bgp *bgp, afi_t afi, safi_t safi, int peertype, - u_int16_t maxpaths, u_int16_t options) + uint16_t maxpaths, uint16_t options) { if (!bgp || (afi >= AFI_MAX) || (safi >= SAFI_MAX)) return -1; @@ -370,7 +370,7 @@ struct bgp_info *bgp_info_mpath_first(struct bgp_info *binfo) * * Given the bestpath bgp_info, return the number of multipath entries */ -u_int32_t bgp_info_mpath_count(struct bgp_info *binfo) +uint32_t bgp_info_mpath_count(struct bgp_info *binfo) { if (!binfo->mpath) return 0; @@ -382,7 +382,7 @@ u_int32_t bgp_info_mpath_count(struct bgp_info *binfo) * * Sets the count of multipaths into bestpath's mpath element */ -static void bgp_info_mpath_count_set(struct bgp_info *binfo, u_int32_t count) +static void bgp_info_mpath_count_set(struct bgp_info *binfo, uint32_t count) { struct bgp_info_mpath *mpath; if (!count && !binfo->mpath) @@ -432,7 +432,7 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_info *new_best, struct bgp_info *old_best, struct list *mp_list, struct bgp_maxpaths_cfg *mpath_cfg) { - u_int16_t maxpaths, mpath_count, old_mpath_count; + uint16_t maxpaths, mpath_count, old_mpath_count; struct listnode *mp_node, *mp_next_node; struct bgp_info *cur_mpath, *new_mpath, *next_mpath, *prev_mpath; int mpath_changed, debug; @@ -677,7 +677,7 @@ void bgp_info_mpath_aggregate_update(struct bgp_info *new_best, struct aspath *aspath; struct aspath *asmerge; struct attr *new_attr, *old_attr; - u_char origin; + uint8_t origin; struct community *community, *commerge; struct ecommunity *ecomm, *ecommerge; struct lcommunity *lcomm, *lcommerge; diff --git a/bgpd/bgp_mpath.h b/bgpd/bgp_mpath.h index 48af14eb7..1fa11d3d0 100644 --- a/bgpd/bgp_mpath.h +++ b/bgpd/bgp_mpath.h @@ -36,15 +36,15 @@ struct bgp_info_mpath { struct bgp_info *mp_info; /* When attached to best path, the number of selected multipaths */ - u_int32_t mp_count; + uint32_t mp_count; /* Aggregated attribute for advertising multipath route */ struct attr *mp_attr; }; /* Functions to support maximum-paths configuration */ -extern int bgp_maximum_paths_set(struct bgp *, afi_t, safi_t, int, u_int16_t, - u_int16_t); +extern int bgp_maximum_paths_set(struct bgp *, afi_t, safi_t, int, uint16_t, + uint16_t); extern int bgp_maximum_paths_unset(struct bgp *, afi_t, safi_t, int); /* Functions used by bgp_best_selection to record current @@ -70,7 +70,7 @@ extern struct bgp_info *bgp_info_mpath_first(struct bgp_info *); extern struct bgp_info *bgp_info_mpath_next(struct bgp_info *); /* Accessors for multipath information */ -extern u_int32_t bgp_info_mpath_count(struct bgp_info *); +extern uint32_t bgp_info_mpath_count(struct bgp_info *); extern struct attr *bgp_info_mpath_attr(struct bgp_info *); #endif /* _QUAGGA_BGP_MPATH_H */ diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 68eb35776..7320f584e 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -70,20 +70,20 @@ extern int argv_find_and_parse_vpnvx(struct cmd_token **argv, int argc, return ret; } -u_int32_t decode_label(mpls_label_t *label_pnt) +uint32_t decode_label(mpls_label_t *label_pnt) { - u_int32_t l; - u_char *pnt = (u_char *)label_pnt; + uint32_t l; + uint8_t *pnt = (uint8_t *)label_pnt; - l = ((u_int32_t)*pnt++ << 12); - l |= (u_int32_t)*pnt++ << 4; - l |= (u_int32_t)((*pnt & 0xf0) >> 4); + l = ((uint32_t)*pnt++ << 12); + l |= (uint32_t)*pnt++ << 4; + l |= (uint32_t)((*pnt & 0xf0) >> 4); return l; } void encode_label(mpls_label_t label, mpls_label_t *label_pnt) { - u_char *pnt = (u_char *)label_pnt; + uint8_t *pnt = (uint8_t *)label_pnt; if (pnt == NULL) return; *pnt++ = (label >> 12) & 0xff; @@ -94,12 +94,12 @@ void encode_label(mpls_label_t label, mpls_label_t *label_pnt) int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr, struct bgp_nlri *packet) { - u_char *pnt; - u_char *lim; + uint8_t *pnt; + uint8_t *lim; struct prefix p; int psize = 0; int prefixlen; - u_int16_t type; + uint16_t type; struct rd_as rd_as; struct rd_ip rd_ip; struct prefix_rd prd; @@ -107,7 +107,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr, afi_t afi; safi_t safi; int addpath_encoded; - u_int32_t addpath_id; + uint32_t addpath_id; /* Make prefix_rd */ prd.family = AF_UNSPEC; @@ -340,8 +340,8 @@ static int ecom_intersect(struct ecommunity *e1, struct ecommunity *e2) static struct bgp_info * leak_update(struct bgp *bgp, /* destination bgp instance */ struct bgp_node *bn, struct attr *new_attr, /* already interned */ - afi_t afi, safi_t safi, struct bgp_info *source_bi, u_char type, - u_char sub_type, mpls_label_t *label, int num_labels, void *parent, + afi_t afi, safi_t safi, struct bgp_info *source_bi, uint8_t type, + uint8_t sub_type, mpls_label_t *label, int num_labels, void *parent, struct bgp *bgp_orig, struct prefix *nexthop_orig, int debug) { struct prefix *p = &bn->p; @@ -1307,7 +1307,7 @@ DEFUN (no_vpnv6_network, int bgp_show_mpls_vpn(struct vty *vty, afi_t afi, struct prefix_rd *prd, enum bgp_show_type type, void *output_arg, int tags, - u_char use_json) + uint8_t use_json) { struct bgp *bgp; struct bgp_table *table; @@ -1485,7 +1485,7 @@ DEFUN (show_ip_bgp_vpn_all_neighbor_routes, union sockunion su; struct peer *peer; int ret; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); afi_t afi; int idx = 0; @@ -1549,7 +1549,7 @@ DEFUN (show_ip_bgp_vpn_rd_neighbor_routes, union sockunion su; struct peer *peer; struct prefix_rd prd; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); afi_t afi; int idx = 0; @@ -1627,7 +1627,7 @@ DEFUN (show_ip_bgp_vpn_all_neighbor_advertised_routes, int ret; struct peer *peer; union sockunion su; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); afi_t afi; int idx = 0; @@ -1689,7 +1689,7 @@ DEFUN (show_ip_bgp_vpn_rd_neighbor_advertised_routes, struct peer *peer; struct prefix_rd prd; union sockunion su; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); afi_t afi; int idx = 0; diff --git a/bgpd/bgp_mplsvpn.h b/bgpd/bgp_mplsvpn.h index fa3ddbac7..64303325e 100644 --- a/bgpd/bgp_mplsvpn.h +++ b/bgpd/bgp_mplsvpn.h @@ -43,14 +43,14 @@ extern void bgp_mplsvpn_init(void); extern int bgp_nlri_parse_vpn(struct peer *, struct attr *, struct bgp_nlri *); -extern u_int32_t decode_label(mpls_label_t *); +extern uint32_t decode_label(mpls_label_t *); extern void encode_label(mpls_label_t, mpls_label_t *); extern int argv_find_and_parse_vpnvx(struct cmd_token **argv, int argc, int *index, afi_t *afi); extern int bgp_show_mpls_vpn(struct vty *vty, afi_t afi, struct prefix_rd *prd, enum bgp_show_type type, void *output_arg, - int tags, u_char use_json); + int tags, uint8_t use_json); extern void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, struct bgp *bgp_vrf, struct bgp_info *info_vrf); diff --git a/bgpd/bgp_nexthop.h b/bgpd/bgp_nexthop.h index 2c5b2ab11..ed772868e 100644 --- a/bgpd/bgp_nexthop.h +++ b/bgpd/bgp_nexthop.h @@ -38,13 +38,13 @@ /* BGP nexthop cache value structure. */ struct bgp_nexthop_cache { /* IGP route's metric. */ - u_int32_t metric; + uint32_t metric; /* Nexthop number and nexthop linked list.*/ - u_char nexthop_num; + uint8_t nexthop_num; struct nexthop *nexthop; time_t last_update; - u_int16_t flags; + uint16_t flags; #define BGP_NEXTHOP_VALID (1 << 0) #define BGP_NEXTHOP_REGISTERED (1 << 1) @@ -53,7 +53,7 @@ struct bgp_nexthop_cache { #define BGP_STATIC_ROUTE (1 << 4) #define BGP_STATIC_ROUTE_EXACT_MATCH (1 << 5) - u_int16_t change_flags; + uint16_t change_flags; #define BGP_NEXTHOP_CHANGED (1 << 0) #define BGP_NEXTHOP_METRIC_CHANGED (1 << 1) diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c index 77fb61fbb..5ec63458f 100644 --- a/bgpd/bgp_open.c +++ b/bgpd/bgp_open.c @@ -51,8 +51,8 @@ Next, if we send capability to the peer we want to set my capabilty inforation at each peer. */ -void bgp_capability_vty_out(struct vty *vty, struct peer *peer, u_char use_json, - json_object *json_neigh) +void bgp_capability_vty_out(struct vty *vty, struct peer *peer, + uint8_t use_json, json_object *json_neigh) { char *pnt; char *end; @@ -271,8 +271,8 @@ static int bgp_capability_mp(struct peer *peer, struct capability_header *hdr) } static void bgp_capability_orf_not_support(struct peer *peer, iana_afi_t afi, - iana_safi_t safi, u_char type, - u_char mode) + iana_safi_t safi, uint8_t type, + uint8_t mode) { if (bgp_debug_neighbor_events(peer)) zlog_debug( @@ -295,15 +295,15 @@ static int bgp_capability_orf_entry(struct peer *peer, { struct stream *s = BGP_INPUT(peer); struct capability_mp_data mpc; - u_char num; + uint8_t num; iana_afi_t pkt_afi; afi_t afi; iana_safi_t pkt_safi; safi_t safi; - u_char type; - u_char mode; - u_int16_t sm_cap = 0; /* capability send-mode receive */ - u_int16_t rm_cap = 0; /* capability receive-mode receive */ + uint8_t type; + uint8_t mode; + uint16_t sm_cap = 0; /* capability send-mode receive */ + uint16_t rm_cap = 0; /* capability receive-mode receive */ int i; /* ORF Entry header */ @@ -433,7 +433,7 @@ static int bgp_capability_restart(struct peer *peer, struct capability_header *caphdr) { struct stream *s = BGP_INPUT(peer); - u_int16_t restart_flag_time; + uint16_t restart_flag_time; size_t end = stream_get_getp(s) + caphdr->length; /* Verify length is a multiple of 4 */ @@ -468,7 +468,7 @@ static int bgp_capability_restart(struct peer *peer, safi_t safi; iana_afi_t pkt_afi = stream_getw(s); iana_safi_t pkt_safi = stream_getc(s); - u_char flag = stream_getc(s); + uint8_t flag = stream_getc(s); /* Convert AFI, SAFI to internal values, check. */ if (bgp_map_afi_safi_iana2int(pkt_afi, pkt_safi, &afi, &safi)) { @@ -545,7 +545,7 @@ static int bgp_capability_addpath(struct peer *peer, safi_t safi; iana_afi_t pkt_afi = stream_getw(s); iana_safi_t pkt_safi = stream_getc(s); - u_char send_receive = stream_getc(s); + uint8_t send_receive = stream_getc(s); if (bgp_debug_neighbor_events(peer)) zlog_debug( @@ -659,7 +659,7 @@ static int bgp_capability_hostname(struct peer *peer, struct stream *s = BGP_INPUT(peer); char str[BGP_MAX_HOSTNAME + 1]; size_t end = stream_get_getp(s) + hdr->length; - u_char len; + uint8_t len; SET_FLAG(peer->cap, PEER_CAP_HOSTNAME_RCV); @@ -788,7 +788,7 @@ static const size_t cap_modsizes[] = { * capabilities were encountered. */ static int bgp_capability_parse(struct peer *peer, size_t length, - int *mp_capability, u_char **error) + int *mp_capability, uint8_t **error) { int ret; struct stream *s = BGP_INPUT(peer); @@ -798,7 +798,7 @@ static int bgp_capability_parse(struct peer *peer, size_t length, while (stream_get_getp(s) < end) { size_t start; - u_char *sp = stream_pnt(s); + uint8_t *sp = stream_pnt(s); struct capability_header caphdr; ret = 0; @@ -991,7 +991,7 @@ static int strict_capability_same(struct peer *peer) /* peek into option, stores ASN to *as4 if the AS4 capability was found. * Returns 0 if no as4 found, as4cap value otherwise. */ -as_t peek_for_as4_capability(struct peer *peer, u_char length) +as_t peek_for_as4_capability(struct peer *peer, uint8_t length) { struct stream *s = BGP_INPUT(peer); size_t orig_getp = stream_get_getp(s); @@ -1007,8 +1007,8 @@ as_t peek_for_as4_capability(struct peer *peer, u_char length) * correctly formatted options. */ while (stream_get_getp(s) < end) { - u_char opt_type; - u_char opt_length; + uint8_t opt_type; + uint8_t opt_length; /* Check the length. */ if (stream_get_getp(s) + 2 > end) @@ -1064,11 +1064,11 @@ end: * * @param[out] mp_capability @see bgp_capability_parse() for semantics. */ -int bgp_open_option_parse(struct peer *peer, u_char length, int *mp_capability) +int bgp_open_option_parse(struct peer *peer, uint8_t length, int *mp_capability) { int ret = 0; - u_char *error; - u_char error_data[BGP_MAX_PACKET_SIZE]; + uint8_t *error; + uint8_t error_data[BGP_MAX_PACKET_SIZE]; struct stream *s = BGP_INPUT(peer); size_t end = stream_get_getp(s) + length; @@ -1079,8 +1079,8 @@ int bgp_open_option_parse(struct peer *peer, u_char length, int *mp_capability) peer->host, length); while (stream_get_getp(s) < end) { - u_char opt_type; - u_char opt_length; + uint8_t opt_type; + uint8_t opt_length; /* Must have at least an OPEN option header */ if (STREAM_READABLE(s) < 2) { @@ -1192,10 +1192,10 @@ int bgp_open_option_parse(struct peer *peer, u_char length, int *mp_capability) } static void bgp_open_capability_orf(struct stream *s, struct peer *peer, - afi_t afi, safi_t safi, u_char code) + afi_t afi, safi_t safi, uint8_t code) { - u_char cap_len; - u_char orf_len; + uint8_t cap_len; + uint8_t orf_len; unsigned long capp; unsigned long orfp; unsigned long numberp; @@ -1262,15 +1262,15 @@ static void bgp_open_capability_orf(struct stream *s, struct peer *peer, /* Fill in capability open option to the packet. */ void bgp_open_capability(struct stream *s, struct peer *peer) { - u_char len; + uint8_t len; unsigned long cp, capp, rcapp; iana_afi_t pkt_afi; afi_t afi; safi_t safi; iana_safi_t pkt_safi; as_t local_as; - u_int32_t restart_time; - u_char afi_safi_count = 0; + uint32_t restart_time; + uint8_t afi_safi_count = 0; int adv_addpath_tx = 0; /* Remember current pointer for Opt Parm Len. */ diff --git a/bgpd/bgp_open.h b/bgpd/bgp_open.h index 83b79a589..c92fd9b0a 100644 --- a/bgpd/bgp_open.h +++ b/bgpd/bgp_open.h @@ -23,14 +23,14 @@ /* Standard header for capability TLV */ struct capability_header { - u_char code; - u_char length; + uint8_t code; + uint8_t length; }; /* Generic MP capability data */ struct capability_mp_data { uint16_t afi; /* iana_afi_t */ - u_char reserved; + uint8_t reserved; uint8_t safi; /* iana_safi_t */ }; @@ -41,11 +41,11 @@ struct capability_as4 { struct graceful_restart_af { afi_t afi; safi_t safi; - u_char flag; + uint8_t flag; }; struct capability_gr { - u_int16_t restart_flag_time; + uint16_t restart_flag_time; struct graceful_restart_af gr[]; }; @@ -93,10 +93,10 @@ struct capability_gr { #define RESTART_R_BIT 0x8000 #define RESTART_F_BIT 0x80 -extern int bgp_open_option_parse(struct peer *, u_char, int *); +extern int bgp_open_option_parse(struct peer *, uint8_t, int *); extern void bgp_open_capability(struct stream *, struct peer *); -extern void bgp_capability_vty_out(struct vty *, struct peer *, u_char, +extern void bgp_capability_vty_out(struct vty *, struct peer *, uint8_t, json_object *); -extern as_t peek_for_as4_capability(struct peer *, u_char); +extern as_t peek_for_as4_capability(struct peer *, uint8_t); #endif /* _QUAGGA_BGP_OPEN_H */ diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index d17c33441..3c7bb65fd 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -67,7 +67,7 @@ * @param type the packet type * @return the size of the stream */ -int bgp_packet_set_marker(struct stream *s, u_char type) +int bgp_packet_set_marker(struct stream *s, uint8_t type) { int i; @@ -497,7 +497,7 @@ void bgp_keepalive_send(struct peer *peer) void bgp_open_send(struct peer *peer) { struct stream *s; - u_int16_t send_holdtime; + uint16_t send_holdtime; as_t local_as; if (PEER_OR_GROUP_TIMER_SET(peer)) @@ -518,9 +518,8 @@ void bgp_open_send(struct peer *peer) /* Set open packet values. */ stream_putc(s, BGP_VERSION_4); /* BGP version */ - stream_putw(s, - (local_as <= BGP_AS_MAX) ? (u_int16_t)local_as - : BGP_AS_TRANS); + stream_putw(s, (local_as <= BGP_AS_MAX) ? (uint16_t)local_as + : BGP_AS_TRANS); stream_putw(s, send_holdtime); /* Hold Time */ stream_put_in_addr(s, &peer->local_id); /* BGP Identifier */ @@ -560,7 +559,7 @@ void bgp_open_send(struct peer *peer) static int bgp_write_notify(struct peer *peer) { int ret, val; - u_char type; + uint8_t type; struct stream *s; /* There should be at least one packet. */ @@ -643,8 +642,8 @@ static int bgp_write_notify(struct peer *peer) * @param data Data portion * @param datalen length of data portion */ -void bgp_notify_send_with_data(struct peer *peer, u_char code, u_char sub_code, - u_char *data, size_t datalen) +void bgp_notify_send_with_data(struct peer *peer, uint8_t code, + uint8_t sub_code, uint8_t *data, size_t datalen) { struct stream *s; int length; @@ -753,7 +752,7 @@ void bgp_notify_send_with_data(struct peer *peer, u_char code, u_char sub_code, * @param code BGP error code * @param sub_code BGP error subcode */ -void bgp_notify_send(struct peer *peer, u_char code, u_char sub_code) +void bgp_notify_send(struct peer *peer, uint8_t code, uint8_t sub_code) { bgp_notify_send_with_data(peer, code, sub_code, NULL, 0); } @@ -769,7 +768,8 @@ void bgp_notify_send(struct peer *peer, u_char code, u_char sub_code) * @param remove Whether to remove ORF for specified AFI/SAFI */ void bgp_route_refresh_send(struct peer *peer, afi_t afi, safi_t safi, - u_char orf_type, u_char when_to_refresh, int remove) + uint8_t orf_type, uint8_t when_to_refresh, + int remove) { struct stream *s; struct bgp_filter *filter; @@ -800,7 +800,7 @@ void bgp_route_refresh_send(struct peer *peer, afi_t afi, safi_t safi, if (orf_type == ORF_TYPE_PREFIX || orf_type == ORF_TYPE_PREFIX_OLD) if (remove || filter->plist[FILTER_IN].plist) { - u_int16_t orf_len; + uint16_t orf_len; unsigned long orfp; orf_refresh = 1; @@ -1033,24 +1033,24 @@ static int bgp_collision_detect(struct peer *new, struct in_addr remote_id) static int bgp_open_receive(struct peer *peer, bgp_size_t size) { int ret; - u_char version; - u_char optlen; - u_int16_t holdtime; - u_int16_t send_holdtime; + uint8_t version; + uint8_t optlen; + uint16_t holdtime; + uint16_t send_holdtime; as_t remote_as; as_t as4 = 0; struct in_addr remote_id; int mp_capability; - u_int8_t notify_data_remote_as[2]; - u_int8_t notify_data_remote_as4[4]; - u_int8_t notify_data_remote_id[4]; - u_int16_t *holdtime_ptr; + uint8_t notify_data_remote_as[2]; + uint8_t notify_data_remote_as4[4]; + uint8_t notify_data_remote_id[4]; + uint16_t *holdtime_ptr; /* Parse open packet. */ version = stream_getc(peer->curr); memcpy(notify_data_remote_as, stream_pnt(peer->curr), 2); remote_as = stream_getw(peer->curr); - holdtime_ptr = (u_int16_t *)stream_pnt(peer->curr); + holdtime_ptr = (uint16_t *)stream_pnt(peer->curr); holdtime = stream_getw(peer->curr); memcpy(notify_data_remote_id, stream_pnt(peer->curr), 4); remote_id.s_addr = stream_get_ipv4(peer->curr); @@ -1158,7 +1158,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size) /* Peer BGP version check. */ if (version != BGP_VERSION_4) { - u_int16_t maxver = htons(BGP_VERSION_4); + uint16_t maxver = htons(BGP_VERSION_4); /* XXX this reply may not be correct if version < 4 XXX */ if (bgp_debug_neighbor_events(peer)) zlog_debug( @@ -1167,7 +1167,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size) /* Data must be in network byte order here */ bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_UNSUP_VERSION, - (u_int8_t *)&maxver, 2); + (uint8_t *)&maxver, 2); return BGP_Stop; } @@ -1225,7 +1225,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size) if (holdtime < 3 && holdtime != 0) { bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_UNACEP_HOLDTIME, - (u_char *)holdtime_ptr, 2); + (uint8_t *)holdtime_ptr, 2); return BGP_Stop; } @@ -1367,7 +1367,7 @@ static int bgp_keepalive_receive(struct peer *peer, bgp_size_t size) static int bgp_update_receive(struct peer *peer, bgp_size_t size) { int ret, nlri_ret; - u_char *end; + uint8_t *end; struct stream *s; struct attr attr; bgp_size_t attribute_len; @@ -1680,7 +1680,7 @@ static int bgp_notify_receive(struct peer *peer, bgp_size_t size) stream_getc(peer->curr)); strcpy(bgp_notify.data, c); } - bgp_notify.raw_data = (u_char *)peer->notify.data; + bgp_notify.raw_data = (uint8_t *)peer->notify.data; } bgp_notify_print(peer, &bgp_notify, "received"); @@ -1764,10 +1764,10 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size) } if (size != BGP_MSG_ROUTE_REFRESH_MIN_SIZE - BGP_HEADER_SIZE) { - u_char *end; - u_char when_to_refresh; - u_char orf_type; - u_int16_t orf_len; + uint8_t *end; + uint8_t when_to_refresh; + uint8_t orf_type; + uint16_t orf_len; if (size - (BGP_MSG_ROUTE_REFRESH_MIN_SIZE - BGP_HEADER_SIZE) < 5) { @@ -1792,8 +1792,8 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size) uint8_t *p_pnt = stream_pnt(s); uint8_t *p_end = stream_pnt(s) + orf_len; struct orf_prefix orfp; - u_char common = 0; - u_int32_t seq; + uint8_t common = 0; + uint32_t seq; int psize; char name[BUFSIZ]; int ret = CMD_SUCCESS; @@ -1839,12 +1839,12 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size) name); break; } - ok = ((u_int32_t)(p_end - p_pnt) - >= sizeof(u_int32_t)); + ok = ((uint32_t)(p_end - p_pnt) + >= sizeof(uint32_t)); if (ok) { memcpy(&seq, p_pnt, - sizeof(u_int32_t)); - p_pnt += sizeof(u_int32_t); + sizeof(uint32_t)); + p_pnt += sizeof(uint32_t); orfp.seq = ntohl(seq); } else p_pnt = p_end; @@ -1988,13 +1988,13 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size) * @param size size of the packet * @return as in summary */ -static int bgp_capability_msg_parse(struct peer *peer, u_char *pnt, +static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt, bgp_size_t length) { - u_char *end; + uint8_t *end; struct capability_mp_data mpc; struct capability_header *hdr; - u_char action; + uint8_t action; iana_afi_t pkt_afi; afi_t afi; iana_safi_t pkt_safi; @@ -2106,7 +2106,7 @@ static int bgp_capability_msg_parse(struct peer *peer, u_char *pnt, */ int bgp_capability_receive(struct peer *peer, bgp_size_t size) { - u_char *pnt; + uint8_t *pnt; /* Fetch pointer. */ pnt = stream_pnt(peer->curr); @@ -2171,7 +2171,7 @@ int bgp_process_packet(struct thread *thread) unsigned int processed = 0; while (processed < rpkt_quanta_old) { - u_char type = 0; + uint8_t type = 0; bgp_size_t size; char notify_data_length[2]; diff --git a/bgpd/bgp_packet.h b/bgpd/bgp_packet.h index 008f2b814..06a190585 100644 --- a/bgpd/bgp_packet.h +++ b/bgpd/bgp_packet.h @@ -39,11 +39,11 @@ /* Packet send and receive function prototypes. */ extern void bgp_keepalive_send(struct peer *); extern void bgp_open_send(struct peer *); -extern void bgp_notify_send(struct peer *, u_int8_t, u_int8_t); -extern void bgp_notify_send_with_data(struct peer *, u_int8_t, u_int8_t, - u_int8_t *, size_t); -extern void bgp_route_refresh_send(struct peer *, afi_t, safi_t, u_char, u_char, - int); +extern void bgp_notify_send(struct peer *, uint8_t, uint8_t); +extern void bgp_notify_send_with_data(struct peer *, uint8_t, uint8_t, + uint8_t *, size_t); +extern void bgp_route_refresh_send(struct peer *, afi_t, safi_t, uint8_t, + uint8_t, int); extern void bgp_capability_send(struct peer *, afi_t, safi_t, int, int); extern void bgp_default_update_send(struct peer *, struct attr *, afi_t, safi_t, struct peer *); @@ -58,7 +58,7 @@ extern void bgp_update_restarted_peers(struct peer *); extern void bgp_update_implicit_eors(struct peer *); extern void bgp_check_update_delay(struct bgp *); -extern int bgp_packet_set_marker(struct stream *s, u_char type); +extern int bgp_packet_set_marker(struct stream *s, uint8_t type); extern int bgp_packet_set_size(struct stream *s); extern int bgp_generate_updgrp_packets(struct thread *); diff --git a/bgpd/bgp_rd.c b/bgpd/bgp_rd.c index ae1ec7b84..64e083d1e 100644 --- a/bgpd/bgp_rd.c +++ b/bgpd/bgp_rd.c @@ -36,57 +36,57 @@ #include "bgpd/rfapi/rfapi_backend.h" #endif -u_int16_t decode_rd_type(u_char *pnt) +uint16_t decode_rd_type(uint8_t *pnt) { - u_int16_t v; + uint16_t v; - v = ((u_int16_t)*pnt++ << 8); + v = ((uint16_t)*pnt++ << 8); #if ENABLE_BGP_VNC /* * VNC L2 stores LHI in lower byte, so omit it */ if (v != RD_TYPE_VNC_ETH) - v |= (u_int16_t)*pnt; + v |= (uint16_t)*pnt; #else /* duplicate code for clarity */ - v |= (u_int16_t)*pnt; + v |= (uint16_t)*pnt; #endif return v; } -void encode_rd_type(u_int16_t v, u_char *pnt) +void encode_rd_type(uint16_t v, uint8_t *pnt) { - *((u_int16_t *)pnt) = htons(v); + *((uint16_t *)pnt) = htons(v); } /* type == RD_TYPE_AS */ -void decode_rd_as(u_char *pnt, struct rd_as *rd_as) +void decode_rd_as(uint8_t *pnt, struct rd_as *rd_as) { - rd_as->as = (u_int16_t)*pnt++ << 8; - rd_as->as |= (u_int16_t)*pnt++; + rd_as->as = (uint16_t)*pnt++ << 8; + rd_as->as |= (uint16_t)*pnt++; ptr_get_be32(pnt, &rd_as->val); } /* type == RD_TYPE_AS4 */ -void decode_rd_as4(u_char *pnt, struct rd_as *rd_as) +void decode_rd_as4(uint8_t *pnt, struct rd_as *rd_as) { pnt = ptr_get_be32(pnt, &rd_as->as); - rd_as->val = ((u_int16_t)*pnt++ << 8); - rd_as->val |= (u_int16_t)*pnt; + rd_as->val = ((uint16_t)*pnt++ << 8); + rd_as->val |= (uint16_t)*pnt; } /* type == RD_TYPE_IP */ -void decode_rd_ip(u_char *pnt, struct rd_ip *rd_ip) +void decode_rd_ip(uint8_t *pnt, struct rd_ip *rd_ip) { memcpy(&rd_ip->ip, pnt, 4); pnt += 4; - rd_ip->val = ((u_int16_t)*pnt++ << 8); - rd_ip->val |= (u_int16_t)*pnt; + rd_ip->val = ((uint16_t)*pnt++ << 8); + rd_ip->val |= (uint16_t)*pnt; } #if ENABLE_BGP_VNC /* type == RD_TYPE_VNC_ETH */ -void decode_rd_vnc_eth(u_char *pnt, struct rd_vnc_eth *rd_vnc_eth) +void decode_rd_vnc_eth(uint8_t *pnt, struct rd_vnc_eth *rd_vnc_eth) { rd_vnc_eth->type = RD_TYPE_VNC_ETH; rd_vnc_eth->local_nve_id = pnt[1]; @@ -161,8 +161,8 @@ out: char *prefix_rd2str(struct prefix_rd *prd, char *buf, size_t size) { - u_char *pnt; - u_int16_t type; + uint8_t *pnt; + uint16_t type; struct rd_as rd_as; struct rd_ip rd_ip; diff --git a/bgpd/bgp_rd.h b/bgpd/bgp_rd.h index cbc449ed4..a8ea83a4a 100644 --- a/bgpd/bgp_rd.h +++ b/bgpd/bgp_rd.h @@ -35,33 +35,33 @@ #define RD_ADDRSTRLEN 28 struct rd_as { - u_int16_t type; + uint16_t type; as_t as; - u_int32_t val; + uint32_t val; }; struct rd_ip { - u_int16_t type; + uint16_t type; struct in_addr ip; - u_int16_t val; + uint16_t val; }; #if ENABLE_BGP_VNC struct rd_vnc_eth { - u_int16_t type; + uint16_t type; uint8_t local_nve_id; struct ethaddr macaddr; }; #endif -extern u_int16_t decode_rd_type(u_char *pnt); -extern void encode_rd_type(u_int16_t, u_char *); +extern uint16_t decode_rd_type(uint8_t *pnt); +extern void encode_rd_type(uint16_t, uint8_t *); -extern void decode_rd_as(u_char *pnt, struct rd_as *rd_as); -extern void decode_rd_as4(u_char *pnt, struct rd_as *rd_as); -extern void decode_rd_ip(u_char *pnt, struct rd_ip *rd_ip); +extern void decode_rd_as(uint8_t *pnt, struct rd_as *rd_as); +extern void decode_rd_as4(uint8_t *pnt, struct rd_as *rd_as); +extern void decode_rd_ip(uint8_t *pnt, struct rd_ip *rd_ip); #if ENABLE_BGP_VNC -extern void decode_rd_vnc_eth(u_char *pnt, struct rd_vnc_eth *rd_vnc_eth); +extern void decode_rd_vnc_eth(uint8_t *pnt, struct rd_vnc_eth *rd_vnc_eth); #endif extern int str2prefix_rd(const char *, struct prefix_rd *); diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index e0c54e084..a37e709f1 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -337,7 +337,7 @@ static int bgp_label_index_differs(struct bgp_info *ri1, struct bgp_info *ri2) /* Set/unset bgp_info flags, adjusting any other state as needed. * This is here primarily to keep prefix-count in check. */ -void bgp_info_set_flag(struct bgp_node *rn, struct bgp_info *ri, u_int32_t flag) +void bgp_info_set_flag(struct bgp_node *rn, struct bgp_info *ri, uint32_t flag) { SET_FLAG(ri->flags, flag); @@ -351,7 +351,7 @@ void bgp_info_set_flag(struct bgp_node *rn, struct bgp_info *ri, u_int32_t flag) } void bgp_info_unset_flag(struct bgp_node *rn, struct bgp_info *ri, - u_int32_t flag) + uint32_t flag) { UNSET_FLAG(ri->flags, flag); @@ -366,7 +366,7 @@ void bgp_info_unset_flag(struct bgp_node *rn, struct bgp_info *ri, /* Get MED value. If MED value is missing and "bgp bestpath missing-as-worst" is specified, treat it as the worst value. */ -static u_int32_t bgp_med_value(struct attr *attr, struct bgp *bgp) +static uint32_t bgp_med_value(struct attr *attr, struct bgp *bgp) { if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC)) return attr->med; @@ -397,12 +397,12 @@ static int bgp_info_cmp(struct bgp *bgp, struct bgp_info *new, struct attr *newattr, *existattr; bgp_peer_sort_t new_sort; bgp_peer_sort_t exist_sort; - u_int32_t new_pref; - u_int32_t exist_pref; - u_int32_t new_med; - u_int32_t exist_med; - u_int32_t new_weight; - u_int32_t exist_weight; + uint32_t new_pref; + uint32_t exist_pref; + uint32_t new_med; + uint32_t exist_med; + uint32_t new_weight; + uint32_t exist_weight; uint32_t newm, existm; struct in_addr new_id; struct in_addr exist_id; @@ -413,8 +413,8 @@ static int bgp_info_cmp(struct bgp *bgp, struct bgp_info *new, int ret = 0; char new_buf[PATH_ADDPATH_STR_BUFFER]; char exist_buf[PATH_ADDPATH_STR_BUFFER]; - u_int32_t new_mm_seq; - u_int32_t exist_mm_seq; + uint32_t new_mm_seq; + uint32_t exist_mm_seq; *paths_eq = 0; @@ -1181,7 +1181,7 @@ static int bgp_output_modifier(struct peer *peer, struct prefix *p, struct bgp_info info; route_map_result_t ret; struct route_map *rmap = NULL; - u_char rmap_type; + uint8_t rmap_type; /* * So if we get to this point and have no rmap_name @@ -1323,7 +1323,7 @@ void bgp_attr_add_gshut_community(struct attr *attr) } -static void subgroup_announce_reset_nhop(u_char family, struct attr *attr) +static void subgroup_announce_reset_nhop(uint8_t family, struct attr *attr) { if (family == AF_INET) attr->nexthop.s_addr = 0; @@ -1992,7 +1992,7 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn, int subgroup_process_announce_selected(struct update_subgroup *subgrp, struct bgp_info *selected, struct bgp_node *rn, - u_int32_t addpath_tx_id) + uint32_t addpath_tx_id) { struct prefix *p; struct peer *onlypeer; @@ -2521,7 +2521,7 @@ int bgp_maximum_prefix_overflow(struct peer *peer, afi_t afi, safi_t safi, pkt_afi = afi_int2iana(afi); pkt_safi = safi_int2iana(safi); { - u_int8_t ndata[7]; + uint8_t ndata[7]; ndata[0] = (pkt_afi >> 8); ndata[1] = pkt_afi; @@ -2644,7 +2644,7 @@ static void bgp_rib_withdraw(struct bgp_node *rn, struct bgp_info *ri, bgp_rib_remove(rn, ri, peer, afi, safi); } -struct bgp_info *info_make(int type, int sub_type, u_short instance, +struct bgp_info *info_make(int type, int sub_type, unsigned short instance, struct peer *peer, struct attr *attr, struct bgp_node *rn) { @@ -2772,10 +2772,10 @@ static int bgp_update_martian_nexthop(struct bgp *bgp, afi_t afi, safi_t safi, return ret; } -int bgp_update(struct peer *peer, struct prefix *p, u_int32_t addpath_id, +int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id, struct attr *attr, afi_t afi, safi_t safi, int type, int sub_type, struct prefix_rd *prd, mpls_label_t *label, - u_int32_t num_labels, int soft_reconfig, + uint32_t num_labels, int soft_reconfig, struct bgp_route_evpn *evpn) { int ret; @@ -3424,10 +3424,10 @@ filtered: return 0; } -int bgp_withdraw(struct peer *peer, struct prefix *p, u_int32_t addpath_id, +int bgp_withdraw(struct peer *peer, struct prefix *p, uint32_t addpath_id, struct attr *attr, afi_t afi, safi_t safi, int type, int sub_type, struct prefix_rd *prd, mpls_label_t *label, - u_int32_t num_labels, struct bgp_route_evpn *evpn) + uint32_t num_labels, struct bgp_route_evpn *evpn) { struct bgp *bgp; char pfx_buf[BGP_PRD_PATH_STRLEN]; @@ -3629,7 +3629,7 @@ static void bgp_soft_reconfig_table(struct peer *peer, afi_t afi, safi_t safi, continue; struct bgp_info *ri = rn->info; - u_int32_t num_labels = 0; + uint32_t num_labels = 0; mpls_label_t *label_pnt = NULL; if (ri && ri->extra) @@ -4087,15 +4087,15 @@ static int bgp_addpath_encode_rx(struct peer *peer, afi_t afi, safi_t safi) int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, struct bgp_nlri *packet) { - u_char *pnt; - u_char *lim; + uint8_t *pnt; + uint8_t *lim; struct prefix p; int psize; int ret; afi_t afi; safi_t safi; int addpath_encoded; - u_int32_t addpath_id; + uint32_t addpath_id; pnt = packet->nlri; lim = pnt + packet->length; @@ -4548,7 +4548,7 @@ static void bgp_static_update_safi(struct bgp *bgp, struct prefix *p, #if ENABLE_BGP_VNC mpls_label_t label = 0; #endif - u_int32_t num_labels = 0; + uint32_t num_labels = 0; union gw_addr add; assert(bgp_static); @@ -4713,14 +4713,14 @@ static void bgp_static_update_safi(struct bgp *bgp, struct prefix *p, route should be installed as valid. */ static int bgp_static_set(struct vty *vty, const char *negate, const char *ip_str, afi_t afi, safi_t safi, - const char *rmap, int backdoor, u_int32_t label_index) + const char *rmap, int backdoor, uint32_t label_index) { VTY_DECLVAR_CONTEXT(bgp, bgp); int ret; struct prefix p; struct bgp_static *bgp_static; struct bgp_node *rn; - u_char need_update = 0; + uint8_t need_update = 0; /* Convert IP prefix string to struct prefix. */ ret = str2prefix(ip_str, &p); @@ -5329,10 +5329,10 @@ DEFPY(ipv6_bgp_network, */ struct bgp_aggregate { /* Summary-only flag. */ - u_char summary_only; + uint8_t summary_only; /* AS set generation. */ - u_char as_set; + uint8_t as_set; /* Route-map for aggregated route. */ struct route_map *map; @@ -5363,20 +5363,20 @@ static void bgp_aggregate_route(struct bgp *bgp, struct prefix *p, struct bgp_table *table; struct bgp_node *top; struct bgp_node *rn; - u_char origin; + uint8_t origin; struct aspath *aspath = NULL; struct aspath *asmerge = NULL; struct community *community = NULL; struct community *commerge = NULL; #if defined(AGGREGATE_NEXTHOP_CHECK) struct in_addr nexthop; - u_int32_t med = 0; + uint32_t med = 0; #endif struct bgp_info *ri; struct bgp_info *new; int first = 1; unsigned long match = 0; - u_char atomic_aggregate = 0; + uint8_t atomic_aggregate = 0; /* Record adding route's nexthop and med. */ if (rinew) { @@ -5624,12 +5624,12 @@ static void bgp_aggregate_add(struct bgp *bgp, struct prefix *p, afi_t afi, struct bgp_info *new; struct bgp_info *ri; unsigned long match; - u_char origin = BGP_ORIGIN_IGP; + uint8_t origin = BGP_ORIGIN_IGP; struct aspath *aspath = NULL; struct aspath *asmerge = NULL; struct community *community = NULL; struct community *commerge = NULL; - u_char atomic_aggregate = 0; + uint8_t atomic_aggregate = 0; table = bgp->rib[afi][safi]; @@ -5852,7 +5852,7 @@ static int bgp_aggregate_unset(struct vty *vty, const char *prefix_str, } static int bgp_aggregate_set(struct vty *vty, const char *prefix_str, afi_t afi, - safi_t safi, u_char summary_only, u_char as_set) + safi_t safi, uint8_t summary_only, uint8_t as_set) { VTY_DECLVAR_CONTEXT(bgp, bgp); int ret; @@ -6039,7 +6039,8 @@ DEFUN (no_ipv6_aggregate_address, void bgp_redistribute_add(struct bgp *bgp, struct prefix *p, const union g_addr *nexthop, ifindex_t ifindex, enum nexthop_types_t nhtype, uint32_t metric, - u_char type, u_short instance, route_tag_t tag) + uint8_t type, unsigned short instance, + route_tag_t tag) { struct bgp_info *new; struct bgp_info *bi; @@ -6196,8 +6197,8 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p, aspath_unintern(&attr.aspath); } -void bgp_redistribute_delete(struct bgp *bgp, struct prefix *p, u_char type, - u_short instance) +void bgp_redistribute_delete(struct bgp *bgp, struct prefix *p, uint8_t type, + unsigned short instance) { afi_t afi; struct bgp_node *rn; @@ -6232,7 +6233,7 @@ void bgp_redistribute_delete(struct bgp *bgp, struct prefix *p, u_char type, /* Withdraw specified route type's route. */ void bgp_redistribute_withdraw(struct bgp *bgp, afi_t afi, int type, - u_short instance) + unsigned short instance) { struct bgp_node *rn; struct bgp_info *ri; @@ -6266,7 +6267,7 @@ static void route_vty_out_route(struct prefix *p, struct vty *vty, json_object *json) { int len = 0; - u_int32_t destination; + uint32_t destination; char buf[BUFSIZ]; if (p->family == AF_INET) { @@ -6694,7 +6695,7 @@ void route_vty_out(struct vty *vty, struct prefix *p, struct bgp_info *binfo, /* called from terminal list command */ void route_vty_out_tmp(struct vty *vty, struct prefix *p, struct attr *attr, - safi_t safi, u_char use_json, json_object *json_ar) + safi_t safi, uint8_t use_json, json_object *json_ar) { json_object *json_status = NULL; json_object *json_net = NULL; @@ -7019,7 +7020,7 @@ void route_vty_out_overlay(struct vty *vty, struct prefix *p, /* dampening route */ static void damp_route_vty_out(struct vty *vty, struct prefix *p, struct bgp_info *binfo, int display, safi_t safi, - u_char use_json, json_object *json) + uint8_t use_json, json_object *json) { struct attr *attr; int len; @@ -7082,7 +7083,7 @@ static void damp_route_vty_out(struct vty *vty, struct prefix *p, /* flap route */ static void flap_route_vty_out(struct vty *vty, struct prefix *p, struct bgp_info *binfo, int display, safi_t safi, - u_char use_json, json_object *json) + uint8_t use_json, json_object *json) { struct attr *attr; struct bgp_damp_info *bdi; @@ -8072,7 +8073,7 @@ static int bgp_show_community(struct vty *vty, struct bgp *bgp, static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi, struct bgp_table *table, enum bgp_show_type type, - void *output_arg, u_char use_json, char *rd, + void *output_arg, uint8_t use_json, char *rd, int is_last, unsigned long *output_cum, unsigned long *total_cum, unsigned long *json_header_depth) @@ -8180,7 +8181,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi, continue; } if (type == bgp_show_type_cidr_only) { - u_int32_t destination; + uint32_t destination; destination = ntohl(rn->p.u.prefix4.s_addr); if (IN_CLASSC(destination) @@ -8357,7 +8358,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi, int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, safi_t safi, struct bgp_table *table, struct prefix_rd *prd_match, enum bgp_show_type type, void *output_arg, - u_char use_json) + uint8_t use_json) { struct bgp_node *rn, *next; unsigned long output_cum = 0; @@ -8397,7 +8398,7 @@ int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, safi_t safi, return CMD_SUCCESS; } static int bgp_show(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, - enum bgp_show_type type, void *output_arg, u_char use_json) + enum bgp_show_type type, void *output_arg, uint8_t use_json) { struct bgp_table *table; unsigned long json_header_depth = 0; @@ -8429,7 +8430,7 @@ static int bgp_show(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, } static void bgp_show_all_instances_routes_vty(struct vty *vty, afi_t afi, - safi_t safi, u_char use_json) + safi_t safi, uint8_t use_json) { struct listnode *node, *nnode; struct bgp *bgp; @@ -8629,7 +8630,8 @@ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp, struct bgp_table *rib, const char *ip_str, afi_t afi, safi_t safi, struct prefix_rd *prd, int prefix_check, - enum bgp_path_type pathtype, u_char use_json) + enum bgp_path_type pathtype, + uint8_t use_json) { int ret; int header; @@ -8759,7 +8761,7 @@ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp, static int bgp_show_route(struct vty *vty, struct bgp *bgp, const char *ip_str, afi_t afi, safi_t safi, struct prefix_rd *prd, int prefix_check, enum bgp_path_type pathtype, - u_char use_json) + uint8_t use_json) { if (!bgp) { bgp = bgp_get_default(); @@ -8783,7 +8785,7 @@ static int bgp_show_route(struct vty *vty, struct bgp *bgp, const char *ip_str, static int bgp_show_lcommunity(struct vty *vty, struct bgp *bgp, int argc, struct cmd_token **argv, afi_t afi, safi_t safi, - u_char uj) + uint8_t uj) { struct lcommunity *lcom; struct buffer *b; @@ -8820,7 +8822,7 @@ static int bgp_show_lcommunity(struct vty *vty, struct bgp *bgp, int argc, static int bgp_show_lcommunity_list(struct vty *vty, struct bgp *bgp, const char *lcom, afi_t afi, safi_t safi, - u_char uj) + uint8_t uj) { struct community_list *list; @@ -9126,7 +9128,7 @@ DEFUN (show_ip_bgp_route, char *prefix = NULL; struct bgp *bgp = NULL; enum bgp_path_type path_type; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); int idx = 0; @@ -9363,7 +9365,7 @@ static int bgp_show_prefix_longer(struct vty *vty, struct bgp *bgp, } static struct peer *peer_lookup_in_view(struct vty *vty, struct bgp *bgp, - const char *ip_str, u_char use_json) + const char *ip_str, uint8_t use_json) { int ret; struct peer *peer; @@ -9762,7 +9764,7 @@ static int bgp_peer_count_walker(struct thread *t) } static int bgp_peer_counts(struct vty *vty, struct peer *peer, afi_t afi, - safi_t safi, u_char use_json) + safi_t safi, uint8_t use_json) { struct peer_pcounts pcounts = {.peer = peer}; unsigned int i; @@ -9908,7 +9910,7 @@ DEFUN (show_ip_bgp_vpn_neighbor_prefix_counts, { int idx_peer = 6; struct peer *peer; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); peer = peer_lookup_in_view(vty, NULL, argv[idx_peer]->arg, uj); if (!peer) @@ -9981,7 +9983,7 @@ DEFUN (show_ip_bgp_l2vpn_evpn_all_route_prefix, static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, int in, const char *rmap_name, - u_char use_json, json_object *json) + uint8_t use_json, json_object *json) { struct bgp_table *table; struct bgp_adj_in *ain; @@ -10205,7 +10207,7 @@ static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi, static int peer_adj_routes(struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, int in, const char *rmap_name, - u_char use_json) + uint8_t use_json) { json_object *json = NULL; @@ -10347,7 +10349,7 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter, argv_find(argv, argc, "neighbors", &idx); peerstr = argv[++idx]->arg; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); ret = str2sockunion(peerstr, &su); if (ret < 0) { @@ -10391,7 +10393,7 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter, static int bgp_show_neighbor_route(struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, - enum bgp_show_type type, u_char use_json) + enum bgp_show_type type, uint8_t use_json) { /* labeled-unicast routes live in the unicast table */ if (safi == SAFI_LABELED_UNICAST) @@ -10476,7 +10478,7 @@ struct bgp_table *bgp_distance_table[AFI_MAX][SAFI_MAX]; struct bgp_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; @@ -10532,7 +10534,7 @@ static int bgp_distance_set(struct vty *vty, const char *distance_str, afi_t afi; safi_t safi; struct prefix p; - u_char distance; + uint8_t distance; struct bgp_node *rn; struct bgp_distance *bdistance; @@ -10619,8 +10621,8 @@ static int bgp_distance_unset(struct vty *vty, const char *distance_str, } /* Apply BGP information to distance method. */ -u_char bgp_distance_apply(struct prefix *p, struct bgp_info *rinfo, afi_t afi, - safi_t safi, struct bgp *bgp) +uint8_t bgp_distance_apply(struct prefix *p, struct bgp_info *rinfo, afi_t afi, + safi_t safi, struct bgp *bgp) { struct bgp_node *rn; struct prefix q; @@ -11197,7 +11199,7 @@ void bgp_config_write_network(struct vty *vty, struct bgp *bgp, afi_t afi, /* "network" configuration display. */ if (bgp_option_check(BGP_OPT_CONFIG_CISCO) && afi == AFI_IP) { - u_int32_t destination; + uint32_t destination; struct in_addr netmask; destination = ntohl(p->u.prefix4.s_addr); diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h index 748c4f911..e1e43bbde 100644 --- a/bgpd/bgp_route.h +++ b/bgpd/bgp_route.h @@ -76,11 +76,11 @@ struct bgp_info_extra { int suppress; /* Nexthop reachability check. */ - u_int32_t igpmetric; + uint32_t igpmetric; /* MPLS label(s) - VNI(s) for EVPN-VxLAN */ mpls_label_t label[BGP_MAX_LABELS]; - u_int32_t num_labels; + uint32_t num_labels; #if ENABLE_BGP_VNC union { @@ -97,7 +97,7 @@ struct bgp_info_extra { void *hme; /* encap monitor, if this is a VPN route */ struct prefix_rd rd; /* import: route's route-distinguisher */ - u_char un_family; /* family of cached un address, 0 if + uint8_t un_family; /* family of cached un address, 0 if unset */ union { struct in_addr addr4; @@ -174,7 +174,7 @@ struct bgp_info { int lock; /* BGP information status. */ - u_int16_t flags; + uint16_t flags; #define BGP_INFO_IGP_CHANGED (1 << 0) #define BGP_INFO_DAMPED (1 << 1) #define BGP_INFO_HISTORY (1 << 2) @@ -191,11 +191,11 @@ struct bgp_info { #define BGP_INFO_RIB_ATTR_CHG (1 << 13) /* BGP route type. This can be static, RIP, OSPF, BGP etc. */ - u_char type; + uint8_t type; /* When above type is BGP. This sub type specify BGP sub type information. */ - u_char sub_type; + uint8_t sub_type; #define BGP_ROUTE_NORMAL 0 #define BGP_ROUTE_STATIC 1 #define BGP_ROUTE_AGGREGATE 2 @@ -205,11 +205,11 @@ struct bgp_info { #endif #define BGP_ROUTE_IMPORTED 5 /* from another bgp instance/safi */ - u_short instance; + unsigned short instance; /* Addpath identifiers */ - u_int32_t addpath_rx_id; - u_int32_t addpath_tx_id; + uint32_t addpath_rx_id; + uint32_t addpath_tx_id; }; /* Structure used in BGP path selection */ @@ -224,20 +224,20 @@ struct bgp_static { int backdoor; /* Label index configuration; applies to LU prefixes. */ - u_int32_t label_index; + uint32_t label_index; #define BGP_INVALID_LABEL_INDEX 0xFFFFFFFF /* Import check status. */ - u_char valid; + uint8_t valid; /* IGP metric. */ - u_int32_t igpmetric; + uint32_t igpmetric; /* IGP nexthop. */ struct in_addr igpnexthop; /* Atomic set reference count (ie cause of pathlimit) */ - u_int32_t atomic; + uint32_t atomic; /* BGP redistribute route-map. */ struct { @@ -348,9 +348,8 @@ extern void bgp_info_add(struct bgp_node *rn, struct bgp_info *ri); extern void bgp_info_reap(struct bgp_node *rn, struct bgp_info *ri); extern void bgp_info_delete(struct bgp_node *rn, struct bgp_info *ri); extern struct bgp_info_extra *bgp_info_extra_get(struct bgp_info *); -extern void bgp_info_set_flag(struct bgp_node *, struct bgp_info *, u_int32_t); -extern void bgp_info_unset_flag(struct bgp_node *, struct bgp_info *, - u_int32_t); +extern void bgp_info_set_flag(struct bgp_node *, struct bgp_info *, uint32_t); +extern void bgp_info_unset_flag(struct bgp_node *, struct bgp_info *, uint32_t); extern void bgp_info_path_with_addpath_rx_str(struct bgp_info *ri, char *buf); extern int bgp_nlri_parse_ip(struct peer *, struct attr *, struct bgp_nlri *); @@ -360,11 +359,11 @@ extern int bgp_maximum_prefix_overflow(struct peer *, afi_t, safi_t, int); extern void bgp_redistribute_add(struct bgp *bgp, struct prefix *p, const union g_addr *nexthop, ifindex_t ifindex, enum nexthop_types_t nhtype, uint32_t metric, - u_char type, u_short instance, + uint8_t type, unsigned short instance, route_tag_t tag); -extern void bgp_redistribute_delete(struct bgp *, struct prefix *, u_char, - u_short); -extern void bgp_redistribute_withdraw(struct bgp *, afi_t, int, u_short); +extern void bgp_redistribute_delete(struct bgp *, struct prefix *, uint8_t, + unsigned short); +extern void bgp_redistribute_withdraw(struct bgp *, afi_t, int, unsigned short); extern void bgp_static_add(struct bgp *); extern void bgp_static_delete(struct bgp *); @@ -384,13 +383,12 @@ extern int bgp_static_unset_safi(afi_t afi, safi_t safi, struct vty *, const char *, const char *, const char *); /* this is primarily for MPLS-VPN */ -extern int bgp_update(struct peer *, struct prefix *, u_int32_t, struct attr *, +extern int bgp_update(struct peer *, struct prefix *, uint32_t, struct attr *, afi_t, safi_t, int, int, struct prefix_rd *, - mpls_label_t *, u_int32_t, int, struct bgp_route_evpn *); -extern int bgp_withdraw(struct peer *, struct prefix *, u_int32_t, - struct attr *, afi_t, safi_t, int, int, - struct prefix_rd *, mpls_label_t *, u_int32_t, - struct bgp_route_evpn *); + mpls_label_t *, uint32_t, int, struct bgp_route_evpn *); +extern int bgp_withdraw(struct peer *, struct prefix *, uint32_t, struct attr *, + afi_t, safi_t, int, int, struct prefix_rd *, + mpls_label_t *, uint32_t, struct bgp_route_evpn *); /* for bgp_nexthop and bgp_damp */ extern void bgp_process(struct bgp *, struct bgp_node *, afi_t, safi_t); @@ -411,22 +409,22 @@ extern void bgp_aggregate_increment(struct bgp *, struct prefix *, extern void bgp_aggregate_decrement(struct bgp *, struct prefix *, struct bgp_info *, afi_t, safi_t); -extern u_char bgp_distance_apply(struct prefix *, struct bgp_info *, afi_t, - safi_t, struct bgp *); +extern uint8_t bgp_distance_apply(struct prefix *, struct bgp_info *, afi_t, + safi_t, struct bgp *); extern afi_t bgp_node_afi(struct vty *); extern safi_t bgp_node_safi(struct vty *); -extern struct bgp_info *info_make(int type, int sub_type, u_short instance, - struct peer *peer, struct attr *attr, - struct bgp_node *rn); +extern struct bgp_info *info_make(int type, int sub_type, + unsigned short instance, struct peer *peer, + struct attr *attr, struct bgp_node *rn); extern void route_vty_out(struct vty *, struct prefix *, struct bgp_info *, int, safi_t, json_object *); extern void route_vty_out_tag(struct vty *, struct prefix *, struct bgp_info *, int, safi_t, json_object *); extern void route_vty_out_tmp(struct vty *, struct prefix *, struct attr *, - safi_t, u_char, json_object *); + safi_t, uint8_t, json_object *); extern void route_vty_out_overlay(struct vty *vty, struct prefix *p, struct bgp_info *binfo, int display, json_object *json); @@ -434,7 +432,7 @@ extern void route_vty_out_overlay(struct vty *vty, struct prefix *p, extern int subgroup_process_announce_selected(struct update_subgroup *subgrp, struct bgp_info *selected, struct bgp_node *rn, - u_int32_t addpath_tx_id); + uint32_t addpath_tx_id); extern int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri, struct update_subgroup *subgrp, @@ -474,5 +472,5 @@ extern void route_vty_out_detail(struct vty *vty, struct bgp *bgp, extern int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, safi_t safi, struct bgp_table *table, struct prefix_rd *prd, enum bgp_show_type type, void *output_arg, - u_char use_json); + uint8_t use_json); #endif /* _QUAGGA_BGP_ROUTE_H */ diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 5a265b6c9..4cc889286 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -122,12 +122,12 @@ o Local extensions #define RMAP_VALUE_SUB 2 struct rmap_value { - u_int8_t action; - u_int8_t variable; - u_int32_t value; + uint8_t action; + uint8_t variable; + uint32_t value; }; -static int route_value_match(struct rmap_value *rv, u_int32_t value) +static int route_value_match(struct rmap_value *rv, uint32_t value) { if (rv->variable == 0 && value == rv->value) return RMAP_MATCH; @@ -135,10 +135,10 @@ static int route_value_match(struct rmap_value *rv, u_int32_t value) return RMAP_NOMATCH; } -static u_int32_t route_value_adjust(struct rmap_value *rv, u_int32_t current, - struct peer *peer) +static uint32_t route_value_adjust(struct rmap_value *rv, uint32_t current, + struct peer *peer) { - u_int32_t value; + uint32_t value; switch (rv->variable) { case 1: @@ -165,7 +165,7 @@ static u_int32_t route_value_adjust(struct rmap_value *rv, u_int32_t current, static void *route_value_compile(const char *arg) { - u_int8_t action = RMAP_VALUE_SET, var = 0; + uint8_t action = RMAP_VALUE_SET, var = 0; unsigned long larg = 0; char *endptr = NULL; struct rmap_value *rv; @@ -723,10 +723,10 @@ static route_map_result_t route_match_evpn_route_type(void *rule, route_map_object_t type, void *object) { - u_char route_type = 0; + uint8_t route_type = 0; if (type == RMAP_BGP) { - route_type = *((u_char *)rule); + route_type = *((uint8_t *)rule); if (route_type == prefix->u.prefix_evpn.route_type) return RMAP_MATCH; @@ -738,9 +738,9 @@ static route_map_result_t route_match_evpn_route_type(void *rule, /* Route map `route-type' match statement. */ static void *route_match_evpn_route_type_compile(const char *arg) { - u_char *route_type = NULL; + uint8_t *route_type = NULL; - route_type = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(u_char)); + route_type = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(uint8_t)); if (strncmp(arg, "ma", 2) == 0) *route_type = BGP_EVPN_MAC_IP_ROUTE; @@ -771,7 +771,7 @@ static route_map_result_t route_match_local_pref(void *rule, route_map_object_t type, void *object) { - u_int32_t *local_pref; + uint32_t *local_pref; struct bgp_info *bgp_info; if (type == RMAP_BGP) { @@ -790,7 +790,7 @@ static route_map_result_t route_match_local_pref(void *rule, `arg' is local-pref value */ static void *route_match_local_pref_compile(const char *arg) { - u_int32_t *local_pref; + uint32_t *local_pref; char *endptr = NULL; unsigned long tmpval; @@ -803,7 +803,7 @@ static void *route_match_local_pref_compile(const char *arg) if (*endptr != '\0' || errno || tmpval > UINT32_MAX) return NULL; - local_pref = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(u_int32_t)); + local_pref = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(uint32_t)); if (!local_pref) return local_pref; @@ -1073,7 +1073,7 @@ static route_map_result_t route_match_origin(void *rule, struct prefix *prefix, route_map_object_t type, void *object) { - u_char *origin; + uint8_t *origin; struct bgp_info *bgp_info; if (type == RMAP_BGP) { @@ -1089,9 +1089,9 @@ static route_map_result_t route_match_origin(void *rule, struct prefix *prefix, static void *route_match_origin_compile(const char *arg) { - u_char *origin; + uint8_t *origin; - origin = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(u_char)); + origin = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(uint8_t)); if (strcmp(arg, "igp") == 0) *origin = 0; @@ -1362,7 +1362,7 @@ static route_map_result_t route_set_local_pref(void *rule, { struct rmap_value *rv; struct bgp_info *bgp_info; - u_int32_t locpref = 0; + uint32_t locpref = 0; if (type == RMAP_BGP) { /* Fetch routemap's rule information. */ @@ -1424,7 +1424,7 @@ static route_map_result_t route_set_metric(void *rule, struct prefix *prefix, { struct rmap_value *rv; struct bgp_info *bgp_info; - u_int32_t med = 0; + uint32_t med = 0; if (type == RMAP_BGP) { /* Fetch routemap's rule information. */ @@ -2035,7 +2035,7 @@ static route_map_result_t route_set_origin(void *rule, struct prefix *prefix, route_map_object_t type, void *object) { - u_char *origin; + uint8_t *origin; struct bgp_info *bgp_info; if (type == RMAP_BGP) { @@ -2051,9 +2051,9 @@ static route_map_result_t route_set_origin(void *rule, struct prefix *prefix, /* Compile function for origin set. */ static void *route_set_origin_compile(const char *arg) { - u_char *origin; + uint8_t *origin; - origin = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(u_char)); + origin = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(uint8_t)); if (strcmp(arg, "igp") == 0) *origin = 0; @@ -2205,7 +2205,7 @@ static route_map_result_t route_set_label_index(void *rule, { struct rmap_value *rv; struct bgp_info *bgp_info; - u_int32_t label_index; + uint32_t label_index; if (type == RMAP_BGP) { /* Fetch routemap's rule information. */ diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c index 7c9a134b0..75ba1609d 100644 --- a/bgpd/bgp_rpki.c +++ b/bgpd/bgp_rpki.c @@ -179,7 +179,7 @@ static void *route_match_compile(const char *arg) { int *rpki_status; - rpki_status = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(u_char)); + rpki_status = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(uint8_t)); if (strcmp(arg, "valid") == 0) *rpki_status = RPKI_VALID; diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c index 90ffa9da3..2c7e4e043 100644 --- a/bgpd/bgp_snmp.c +++ b/bgpd/bgp_snmp.c @@ -125,19 +125,19 @@ static oid bgp_trap_oid[] = {BGP4MIB, 0}; static struct in_addr bgp_empty_addr = {.s_addr = 0}; /* Hook functions. */ -static u_char *bgpVersion(struct variable *, oid[], size_t *, int, size_t *, - WriteMethod **); -static u_char *bgpLocalAs(struct variable *, oid[], size_t *, int, size_t *, - WriteMethod **); -static u_char *bgpPeerTable(struct variable *, oid[], size_t *, int, size_t *, - WriteMethod **); -static u_char *bgpRcvdPathAttrTable(struct variable *, oid[], size_t *, int, - size_t *, WriteMethod **); -static u_char *bgpIdentifier(struct variable *, oid[], size_t *, int, size_t *, +static uint8_t *bgpVersion(struct variable *, oid[], size_t *, int, size_t *, + WriteMethod **); +static uint8_t *bgpLocalAs(struct variable *, oid[], size_t *, int, size_t *, + WriteMethod **); +static uint8_t *bgpPeerTable(struct variable *, oid[], size_t *, int, size_t *, WriteMethod **); -static u_char *bgp4PathAttrTable(struct variable *, oid[], size_t *, int, - size_t *, WriteMethod **); -/* static u_char *bgpTraps (); */ +static uint8_t *bgpRcvdPathAttrTable(struct variable *, oid[], size_t *, int, + size_t *, WriteMethod **); +static uint8_t *bgpIdentifier(struct variable *, oid[], size_t *, int, size_t *, + WriteMethod **); +static uint8_t *bgp4PathAttrTable(struct variable *, oid[], size_t *, int, + size_t *, WriteMethod **); +/* static uint8_t *bgpTraps (); */ static struct variable bgp_variables[] = { /* BGP version. */ @@ -315,11 +315,11 @@ static struct variable bgp_variables[] = { }; -static u_char *bgpVersion(struct variable *v, oid name[], size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *bgpVersion(struct variable *v, oid name[], size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { - static u_char version; + static uint8_t version; if (smux_header_generic(v, name, length, exact, var_len, write_method) == MATCH_FAILED) @@ -330,12 +330,12 @@ static u_char *bgpVersion(struct variable *v, oid name[], size_t *length, /* Return octet string length 1. */ *var_len = 1; - return (u_char *)&version; + return (uint8_t *)&version; } -static u_char *bgpLocalAs(struct variable *v, oid name[], size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *bgpLocalAs(struct variable *v, oid name[], size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct bgp *bgp; @@ -443,9 +443,9 @@ static struct peer *bgpPeerTable_lookup(struct variable *v, oid name[], } /* BGP write methods. */ -static int write_bgpPeerTable(int action, u_char *var_val, u_char var_val_type, - size_t var_val_len, u_char *statP, oid *name, - size_t length) +static int write_bgpPeerTable(int action, uint8_t *var_val, + uint8_t var_val_type, size_t var_val_len, + uint8_t *statP, oid *name, size_t length) { struct in_addr addr; struct peer *peer; @@ -506,9 +506,9 @@ static int write_bgpPeerTable(int action, u_char *var_val, u_char var_val_type, return SNMP_ERR_NOERROR; } -static u_char *bgpPeerTable(struct variable *v, oid name[], size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *bgpPeerTable(struct variable *v, oid name[], size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { static struct in_addr addr; struct peer *peer; @@ -588,11 +588,11 @@ static u_char *bgpPeerTable(struct variable *v, oid name[], size_t *length, return SNMP_INTEGER(PEER_TOTAL_TX(peer)); break; case BGPPEERLASTERROR: { - static u_char lasterror[2]; + static uint8_t lasterror[2]; lasterror[0] = peer->notify.code; lasterror[1] = peer->notify.subcode; *var_len = 2; - return (u_char *)&lasterror; + return (uint8_t *)&lasterror; } break; case BGPPEERFSMESTABLISHEDTRANSITIONS: return SNMP_INTEGER(peer->established); @@ -644,9 +644,9 @@ static u_char *bgpPeerTable(struct variable *v, oid name[], size_t *length, return NULL; } -static u_char *bgpIdentifier(struct variable *v, oid name[], size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *bgpIdentifier(struct variable *v, oid name[], size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct bgp *bgp; @@ -661,9 +661,9 @@ static u_char *bgpIdentifier(struct variable *v, oid name[], size_t *length, return SNMP_IPADDRESS(bgp->router_id); } -static u_char *bgpRcvdPathAttrTable(struct variable *v, oid name[], - size_t *length, int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *bgpRcvdPathAttrTable(struct variable *v, oid name[], + size_t *length, int exact, size_t *var_len, + WriteMethod **write_method) { /* Received Path Attribute Table. This table contains, one entry per path to a network, path attributes received from all peers @@ -805,9 +805,9 @@ static struct bgp_info *bgp4PathAttrLookup(struct variable *v, oid name[], return NULL; } -static u_char *bgp4PathAttrTable(struct variable *v, oid name[], size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *bgp4PathAttrTable(struct variable *v, oid name[], + size_t *length, int exact, size_t *var_len, + WriteMethod **write_method) { struct bgp *bgp; struct bgp_info *binfo; diff --git a/bgpd/bgp_table.h b/bgpd/bgp_table.h index a4f3b604c..9afc2adbb 100644 --- a/bgpd/bgp_table.h +++ b/bgpd/bgp_table.h @@ -58,7 +58,7 @@ struct bgp_node { mpls_label_t local_label; uint64_t version; - u_char flags; + uint8_t flags; #define BGP_NODE_PROCESS_SCHEDULED (1 << 0) #define BGP_NODE_USER_CLEAR (1 << 1) #define BGP_NODE_LABEL_CHANGED (1 << 2) diff --git a/bgpd/bgp_updgrp.h b/bgpd/bgp_updgrp.h index 233fe5d14..c1cbca6dc 100644 --- a/bgpd/bgp_updgrp.h +++ b/bgpd/bgp_updgrp.h @@ -77,7 +77,7 @@ typedef enum { BGP_ATTR_VEC_NH = 0, BGP_ATTR_VEC_MAX } bpacket_attr_vec_type; typedef struct { - u_int32_t flags; + uint32_t flags; unsigned long offset; } bpacket_attr_vec; @@ -139,19 +139,19 @@ struct update_group { uint64_t id; time_t uptime; - u_int32_t join_events; - u_int32_t prune_events; - u_int32_t merge_events; - u_int32_t updgrp_switch_events; - u_int32_t peer_refreshes_combined; - u_int32_t adj_count; - u_int32_t split_events; - u_int32_t merge_checks_triggered; + uint32_t join_events; + uint32_t prune_events; + uint32_t merge_events; + uint32_t updgrp_switch_events; + uint32_t peer_refreshes_combined; + uint32_t adj_count; + uint32_t split_events; + uint32_t merge_checks_triggered; - u_int32_t subgrps_created; - u_int32_t subgrps_deleted; + uint32_t subgrps_created; + uint32_t subgrps_deleted; - u_int32_t num_dbg_en_peers; + uint32_t num_dbg_en_peers; }; /* @@ -214,7 +214,7 @@ struct update_subgroup { struct hash *hash; struct thread *t_coalesce; - u_int32_t v_coalesce; + uint32_t v_coalesce; struct thread *t_merge_check; @@ -236,25 +236,25 @@ struct update_subgroup { uint64_t subgroup_id; } split_from; - u_int32_t join_events; - u_int32_t prune_events; + uint32_t join_events; + uint32_t prune_events; /* * This is bumped up when another subgroup merges into this one. */ - u_int32_t merge_events; - u_int32_t updgrp_switch_events; - u_int32_t peer_refreshes_combined; - u_int32_t adj_count; - u_int32_t split_events; - u_int32_t merge_checks_triggered; + uint32_t merge_events; + uint32_t updgrp_switch_events; + uint32_t peer_refreshes_combined; + uint32_t adj_count; + uint32_t split_events; + uint32_t merge_checks_triggered; uint64_t id; - u_int16_t sflags; + uint16_t sflags; /* Subgroup flags, see below */ - u_int16_t flags; + uint16_t flags; }; /* @@ -302,7 +302,7 @@ struct updwalk_context { int policy_route_update; updgrp_walkcb cb; void *context; - u_int8_t flags; + uint8_t flags; #define UPDWALK_FLAGS_ADVQUEUE (1 << 0) #define UPDWALK_FLAGS_ADVERTISED (1 << 1) @@ -449,7 +449,7 @@ extern void update_group_announce_rrclients(struct bgp *bgp); extern void peer_af_announce_route(struct peer_af *paf, int combine); extern struct bgp_adj_out *bgp_adj_out_alloc(struct update_subgroup *subgrp, struct bgp_node *rn, - u_int32_t addpath_tx_id); + uint32_t addpath_tx_id); extern void bgp_adj_out_remove_subgroup(struct bgp_node *rn, struct bgp_adj_out *adj, struct update_subgroup *subgrp); @@ -458,7 +458,7 @@ extern void bgp_adj_out_set_subgroup(struct bgp_node *rn, struct attr *attr, struct bgp_info *binfo); extern void bgp_adj_out_unset_subgroup(struct bgp_node *rn, struct update_subgroup *subgrp, - char withdraw, u_int32_t addpath_tx_id); + char withdraw, uint32_t addpath_tx_id); void subgroup_announce_table(struct update_subgroup *subgrp, struct bgp_table *table); extern void subgroup_trigger_write(struct update_subgroup *subgrp); diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c index e66e5a540..d55500657 100644 --- a/bgpd/bgp_updgrp_adv.c +++ b/bgpd/bgp_updgrp_adv.c @@ -57,7 +57,7 @@ static inline struct bgp_adj_out *adj_lookup(struct bgp_node *rn, struct update_subgroup *subgrp, - u_int32_t addpath_tx_id) + uint32_t addpath_tx_id) { struct bgp_adj_out *adj; struct peer *peer; @@ -207,7 +207,7 @@ static int group_announce_route_walkcb(struct update_group *updgrp, void *arg) } static void subgrp_show_adjq_vty(struct update_subgroup *subgrp, - struct vty *vty, u_int8_t flags) + struct vty *vty, uint8_t flags) { struct bgp_table *table; struct bgp_adj_out *adj; @@ -280,7 +280,7 @@ static int updgrp_show_adj_walkcb(struct update_group *updgrp, void *arg) } static void updgrp_show_adj(struct bgp *bgp, afi_t afi, safi_t safi, - struct vty *vty, uint64_t id, u_int8_t flags) + struct vty *vty, uint64_t id, uint8_t flags) { struct updwalk_context ctx; memset(&ctx, 0, sizeof(ctx)); @@ -370,7 +370,7 @@ static int update_group_announce_rrc_walkcb(struct update_group *updgrp, */ struct bgp_adj_out *bgp_adj_out_alloc(struct update_subgroup *subgrp, struct bgp_node *rn, - u_int32_t addpath_tx_id) + uint32_t addpath_tx_id) { struct bgp_adj_out *adj; @@ -487,7 +487,7 @@ void bgp_adj_out_set_subgroup(struct bgp_node *rn, */ void bgp_adj_out_unset_subgroup(struct bgp_node *rn, struct update_subgroup *subgrp, char withdraw, - u_int32_t addpath_tx_id) + uint32_t addpath_tx_id) { struct bgp_adj_out *adj; struct bgp_advertise *adv; diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c index 1d50cb1ca..8ba7902a5 100644 --- a/bgpd/bgp_updgrp_packet.c +++ b/bgpd/bgp_updgrp_packet.c @@ -396,7 +396,7 @@ struct stream *bpacket_reformat_for_peer(struct bpacket *pkt, vec = &pkt->arr.entries[BGP_ATTR_VEC_NH]; if (CHECK_FLAG(vec->flags, BPKT_ATTRVEC_FLAGS_UPDATED)) { - u_int8_t nhlen; + uint8_t nhlen; afi_t nhafi = AFI_MAX; /* NH AFI is based on nhlen! */ int route_map_sets_nh; nhlen = stream_getc_from(s, vec->offset); @@ -699,10 +699,10 @@ struct bpacket *subgroup_update_packet(struct update_subgroup *subgrp) int num_pfx = 0; int addpath_encode = 0; int addpath_overhead = 0; - u_int32_t addpath_tx_id = 0; + uint32_t addpath_tx_id = 0; struct prefix_rd *prd = NULL; mpls_label_t label = MPLS_INVALID_LABEL, *label_pnt = NULL; - u_int32_t num_labels = 0; + uint32_t num_labels = 0; if (!subgrp) return NULL; @@ -937,7 +937,7 @@ struct bpacket *subgroup_withdraw_packet(struct update_subgroup *subgrp) size_t mp_start = 0; size_t attrlen_pos = 0; size_t mplen_pos = 0; - u_char first_time = 1; + uint8_t first_time = 1; afi_t afi; safi_t safi; int space_remaining = 0; @@ -945,7 +945,7 @@ struct bpacket *subgroup_withdraw_packet(struct update_subgroup *subgrp) int num_pfx = 0; int addpath_encode = 0; int addpath_overhead = 0; - u_int32_t addpath_tx_id = 0; + uint32_t addpath_tx_id = 0; struct prefix_rd *prd = NULL; diff --git a/bgpd/bgp_vpn.c b/bgpd/bgp_vpn.c index 4661e195a..80bd2cd79 100644 --- a/bgpd/bgp_vpn.c +++ b/bgpd/bgp_vpn.c @@ -32,7 +32,7 @@ int show_adj_route_vpn(struct vty *vty, struct peer *peer, struct prefix_rd *prd, afi_t afi, safi_t safi, - u_char use_json) + uint8_t use_json) { struct bgp *bgp; struct bgp_table *table; @@ -124,14 +124,14 @@ int show_adj_route_vpn(struct vty *vty, struct peer *peer, } if (rd_header) { - u_int16_t type; + uint16_t type; struct rd_as rd_as; struct rd_ip rd_ip = {0}; #if ENABLE_BGP_VNC struct rd_vnc_eth rd_vnc_eth = { 0}; #endif - u_char *pnt; + uint8_t *pnt; pnt = rn->p.u.val; diff --git a/bgpd/bgp_vpn.h b/bgpd/bgp_vpn.h index d2a2cb4a5..98b4d9f18 100644 --- a/bgpd/bgp_vpn.h +++ b/bgpd/bgp_vpn.h @@ -25,6 +25,6 @@ extern int show_adj_route_vpn(struct vty *vty, struct peer *peer, struct prefix_rd *prd, afi_t afi, safi_t safi, - u_char use_json); + uint8_t use_json); #endif /* _QUAGGA_BGP_VPN_H */ diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 3f51c1509..475a8ea74 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1111,11 +1111,11 @@ DEFUN (no_bgp_confederation_peers, * @set: 1 for setting values, 0 for removing the max-paths config. */ static int bgp_maxpaths_config_vty(struct vty *vty, int peer_type, - const char *mpaths, u_int16_t options, + const char *mpaths, uint16_t options, int set) { VTY_DECLVAR_CONTEXT(bgp, bgp); - u_int16_t maxpaths = 0; + uint16_t maxpaths = 0; int ret; afi_t afi; safi_t safi; @@ -1257,8 +1257,8 @@ static int bgp_update_delay_config_vty(struct vty *vty, const char *delay, const char *wait) { VTY_DECLVAR_CONTEXT(bgp, bgp); - u_int16_t update_delay; - u_int16_t establish_wait; + uint16_t update_delay; + uint16_t establish_wait; update_delay = strtoul(delay, NULL, 10); @@ -1779,7 +1779,7 @@ DEFUN (bgp_graceful_restart_stalepath_time, { VTY_DECLVAR_CONTEXT(bgp, bgp); int idx_number = 3; - u_int32_t stalepath; + uint32_t stalepath; stalepath = strtoul(argv[idx_number]->arg, NULL, 10); bgp->stalepath_time = stalepath; @@ -1796,7 +1796,7 @@ DEFUN (bgp_graceful_restart_restart_time, { VTY_DECLVAR_CONTEXT(bgp, bgp); int idx_number = 3; - u_int32_t restart; + uint32_t restart; restart = strtoul(argv[idx_number]->arg, NULL, 10); bgp->restart_time = restart; @@ -2292,7 +2292,7 @@ DEFUN (bgp_default_local_preference, { VTY_DECLVAR_CONTEXT(bgp, bgp); int idx_number = 3; - u_int32_t local_pref; + uint32_t local_pref; local_pref = strtoul(argv[idx_number]->arg, NULL, 10); @@ -2329,7 +2329,7 @@ DEFUN (bgp_default_subgroup_pkt_queue_max, { VTY_DECLVAR_CONTEXT(bgp, bgp); int idx_number = 3; - u_int32_t max_size; + uint32_t max_size; max_size = strtoul(argv[idx_number]->arg, NULL, 10); @@ -3404,7 +3404,7 @@ ALIAS_HIDDEN(no_neighbor_set_peer_group, no_neighbor_set_peer_group_hidden_cmd, "Peer-group name\n") static int peer_flag_modify_vty(struct vty *vty, const char *ip_str, - u_int16_t flag, int set) + uint16_t flag, int set) { int ret; struct peer *peer; @@ -3436,14 +3436,13 @@ static int peer_flag_modify_vty(struct vty *vty, const char *ip_str, return bgp_vty_return(vty, ret); } -static int peer_flag_set_vty(struct vty *vty, const char *ip_str, - u_int16_t flag) +static int peer_flag_set_vty(struct vty *vty, const char *ip_str, uint16_t flag) { return peer_flag_modify_vty(vty, ip_str, flag, 1); } static int peer_flag_unset_vty(struct vty *vty, const char *ip_str, - u_int16_t flag) + uint16_t flag) { return peer_flag_modify_vty(vty, ip_str, flag, 0); } @@ -3608,7 +3607,7 @@ DEFUN (no_neighbor_capability_enhe, } static int peer_af_flag_modify_vty(struct vty *vty, const char *peer_str, - afi_t afi, safi_t safi, u_int32_t flag, + afi_t afi, safi_t safi, uint32_t flag, int set) { int ret; @@ -3627,13 +3626,13 @@ static int peer_af_flag_modify_vty(struct vty *vty, const char *peer_str, } static int peer_af_flag_set_vty(struct vty *vty, const char *peer_str, - afi_t afi, safi_t safi, u_int32_t flag) + afi_t afi, safi_t safi, uint32_t flag) { return peer_af_flag_modify_vty(vty, peer_str, afi, safi, flag, 1); } static int peer_af_flag_unset_vty(struct vty *vty, const char *peer_str, - afi_t afi, safi_t safi, u_int32_t flag) + afi_t afi, safi_t safi, uint32_t flag) { return peer_af_flag_modify_vty(vty, peer_str, afi, safi, flag, 0); } @@ -3653,7 +3652,7 @@ DEFUN (neighbor_capability_orf_prefix, { int idx_peer = 1; int idx_send_recv = 5; - u_int16_t flag = 0; + uint16_t flag = 0; if (strmatch(argv[idx_send_recv]->text, "send")) flag = PEER_FLAG_ORF_PREFIX_SM; @@ -3697,7 +3696,7 @@ DEFUN (no_neighbor_capability_orf_prefix, { int idx_peer = 2; int idx_send_recv = 6; - u_int16_t flag = 0; + uint16_t flag = 0; if (strmatch(argv[idx_send_recv]->text, "send")) flag = PEER_FLAG_ORF_PREFIX_SM; @@ -4072,7 +4071,7 @@ DEFUN (neighbor_send_community_type, "Send Large Community attributes\n") { int idx = 0; - u_int32_t flag = 0; + uint32_t flag = 0; char *peer = argv[1]->arg; @@ -4338,7 +4337,7 @@ DEFUN (neighbor_attr_unchanged, int idx = 0; char *peer_str = argv[1]->arg; struct peer *peer; - u_int16_t flags = 0; + uint16_t flags = 0; afi_t afi = bgp_node_afi(vty); safi_t safi = bgp_node_safi(vty); @@ -4408,7 +4407,7 @@ DEFUN (no_neighbor_attr_unchanged, { int idx = 0; char *peer = argv[2]->arg; - u_int16_t flags = 0; + uint16_t flags = 0; if (argv_find(argv, argc, "as-path", &idx)) SET_FLAG(flags, PEER_FLAG_AS_PATH_UNCHANGED); @@ -4747,7 +4746,7 @@ static int peer_port_vty(struct vty *vty, const char *ip_str, int afi, const char *port_str) { struct peer *peer; - u_int16_t port; + uint16_t port; struct servent *sp; peer = peer_lookup_vty(vty, ip_str); @@ -4924,8 +4923,8 @@ static int peer_timers_set_vty(struct vty *vty, const char *ip_str, { int ret; struct peer *peer; - u_int32_t keepalive; - u_int32_t holdtime; + uint32_t keepalive; + uint32_t holdtime; peer = peer_and_group_lookup_vty(vty, ip_str); if (!peer) @@ -4990,7 +4989,7 @@ static int peer_timers_connect_set_vty(struct vty *vty, const char *ip_str, { int ret; struct peer *peer; - u_int32_t connect; + uint32_t connect; peer = peer_and_group_lookup_vty(vty, ip_str); if (!peer) @@ -5052,7 +5051,7 @@ static int peer_advertise_interval_vty(struct vty *vty, const char *ip_str, { int ret; struct peer *peer; - u_int32_t routeadv = 0; + uint32_t routeadv = 0; peer = peer_and_group_lookup_vty(vty, ip_str); if (!peer) @@ -5107,7 +5106,7 @@ DEFUN (bgp_set_route_map_delay_timer, "0 disables the timer, no route updates happen when route-maps change\n") { int idx_number = 3; - u_int32_t rmap_delay_timer; + uint32_t rmap_delay_timer; if (argv[idx_number]->arg) { rmap_delay_timer = strtoul(argv[idx_number]->arg, NULL, 10); @@ -5658,9 +5657,9 @@ static int peer_maximum_prefix_set_vty(struct vty *vty, const char *ip_str, { int ret; struct peer *peer; - u_int32_t max; - u_char threshold; - u_int16_t restart; + uint32_t max; + uint8_t threshold; + uint16_t restart; peer = peer_and_group_lookup_vty(vty, ip_str); if (!peer) @@ -7026,7 +7025,7 @@ DEFUN (show_bgp_vrfs, struct list *inst = bm->bgp; struct listnode *node; struct bgp *bgp; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); json_object *json = NULL; json_object *json_vrfs = NULL; int count = 0; @@ -7347,7 +7346,7 @@ static void bgp_show_bestpath_json(struct bgp *bgp, json_object *json) /* Show BGP peer's summary information. */ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi, - u_char use_json, json_object *json) + uint8_t use_json, json_object *json) { struct peer *peer; struct listnode *node, *nnode; @@ -7762,7 +7761,7 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi, } static void bgp_show_summary_afi_safi(struct vty *vty, struct bgp *bgp, int afi, - int safi, u_char use_json, + int safi, uint8_t use_json, json_object *json) { int is_first = 1; @@ -7824,7 +7823,7 @@ static void bgp_show_summary_afi_safi(struct vty *vty, struct bgp *bgp, int afi, } static void bgp_show_all_instances_summary_vty(struct vty *vty, afi_t afi, - safi_t safi, u_char use_json) + safi_t safi, uint8_t use_json) { struct listnode *node, *nnode; struct bgp *bgp; @@ -7861,7 +7860,7 @@ static void bgp_show_all_instances_summary_vty(struct vty *vty, afi_t afi, } int bgp_show_summary_vty(struct vty *vty, const char *name, afi_t afi, - safi_t safi, u_char use_json) + safi_t safi, uint8_t use_json) { struct bgp *bgp; @@ -7999,9 +7998,9 @@ enum show_type { show_all, show_peer }; static void bgp_show_peer_afi_orf_cap(struct vty *vty, struct peer *p, afi_t afi, safi_t safi, - u_int16_t adv_smcap, u_int16_t adv_rmcap, - u_int16_t rcv_smcap, u_int16_t rcv_rmcap, - u_char use_json, json_object *json_pref) + uint16_t adv_smcap, uint16_t adv_rmcap, + uint16_t rcv_smcap, uint16_t rcv_rmcap, + uint8_t use_json, json_object *json_pref) { /* Send-Mode */ if (CHECK_FLAG(p->af_cap[afi][safi], adv_smcap) @@ -8061,7 +8060,7 @@ static void bgp_show_peer_afi_orf_cap(struct vty *vty, struct peer *p, } static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi, - safi_t safi, u_char use_json, + safi_t safi, uint8_t use_json, json_object *json_neigh) { struct bgp_filter *filter; @@ -8636,7 +8635,7 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi, } } -static void bgp_show_peer(struct vty *vty, struct peer *p, u_char use_json, +static void bgp_show_peer(struct vty *vty, struct peer *p, uint8_t use_json, json_object *json) { struct bgp *bgp; @@ -8647,8 +8646,8 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, u_char use_json, const char *code_str; afi_t afi; safi_t safi; - u_int16_t i; - u_char *msg; + uint16_t i; + uint8_t *msg; json_object *json_neigh = NULL; time_t epoch_tbuf; @@ -10083,7 +10082,7 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, u_char use_json, msg_str = bgp_notify_admin_message( msgbuf, sizeof(msgbuf), - (u_char *)p->notify.data, + (uint8_t *)p->notify.data, p->notify.length); if (msg_str) json_object_string_add( @@ -10119,7 +10118,7 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, u_char use_json, msg_str = bgp_notify_admin_message( msgbuf, sizeof(msgbuf), - (u_char *)p->notify.data, + (uint8_t *)p->notify.data, p->notify.length); if (msg_str) vty_out(vty, @@ -10373,7 +10372,7 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, u_char use_json, static int bgp_show_neighbor(struct vty *vty, struct bgp *bgp, enum show_type type, union sockunion *su, - const char *conf_if, u_char use_json, + const char *conf_if, uint8_t use_json, json_object *json) { struct listnode *node, *nnode; @@ -10430,7 +10429,7 @@ static int bgp_show_neighbor(struct vty *vty, struct bgp *bgp, static void bgp_show_all_instances_neighbors_vty(struct vty *vty, enum show_type type, const char *ip_str, - u_char use_json) + uint8_t use_json) { struct listnode *node, *nnode; struct bgp *bgp; @@ -10497,7 +10496,7 @@ static void bgp_show_all_instances_neighbors_vty(struct vty *vty, static int bgp_show_neighbor_vty(struct vty *vty, const char *name, enum show_type type, const char *ip_str, - u_char use_json) + uint8_t use_json) { int ret; struct bgp *bgp; @@ -10572,7 +10571,7 @@ DEFUN (show_ip_bgp_neighbors, char *sh_arg = NULL; enum show_type sh_type; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); int idx = 0; @@ -11084,7 +11083,7 @@ DEFUN (bgp_redistribute_ipv4_metric, int idx_protocol = 1; int idx_number = 3; int type; - u_int32_t metric; + uint32_t metric; struct bgp_redist *red; type = proto_redistnum(AFI_IP, argv[idx_protocol]->text); @@ -11121,7 +11120,7 @@ DEFUN (bgp_redistribute_ipv4_rmap_metric, int idx_word = 3; int idx_number = 5; int type; - u_int32_t metric; + uint32_t metric; struct bgp_redist *red; type = proto_redistnum(AFI_IP, argv[idx_protocol]->text); @@ -11163,7 +11162,7 @@ DEFUN (bgp_redistribute_ipv4_metric_rmap, int idx_number = 3; int idx_word = 5; int type; - u_int32_t metric; + uint32_t metric; struct bgp_redist *red; type = proto_redistnum(AFI_IP, argv[idx_protocol]->text); @@ -11201,8 +11200,8 @@ DEFUN (bgp_redistribute_ipv4_ospf, VTY_DECLVAR_CONTEXT(bgp, bgp); int idx_ospf_table = 1; int idx_number = 2; - u_short instance; - u_short protocol; + unsigned short instance; + unsigned short protocol; instance = strtoul(argv[idx_number]->arg, NULL, 10); @@ -11237,7 +11236,7 @@ DEFUN (bgp_redistribute_ipv4_ospf_rmap, int idx_number = 2; int idx_word = 4; struct bgp_redist *red; - u_short instance; + unsigned short instance; int protocol; if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0) @@ -11275,9 +11274,9 @@ DEFUN (bgp_redistribute_ipv4_ospf_metric, int idx_ospf_table = 1; int idx_number = 2; int idx_number_2 = 4; - u_int32_t metric; + uint32_t metric; struct bgp_redist *red; - u_short instance; + unsigned short instance; int protocol; if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0) @@ -11320,9 +11319,9 @@ DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric, int idx_number = 2; int idx_word = 4; int idx_number_2 = 6; - u_int32_t metric; + uint32_t metric; struct bgp_redist *red; - u_short instance; + unsigned short instance; int protocol; if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0) @@ -11369,9 +11368,9 @@ DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap, int idx_number = 2; int idx_number_2 = 4; int idx_word = 6; - u_int32_t metric; + uint32_t metric; struct bgp_redist *red; - u_short instance; + unsigned short instance; int protocol; if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0) @@ -11417,7 +11416,7 @@ DEFUN (no_bgp_redistribute_ipv4_ospf, VTY_DECLVAR_CONTEXT(bgp, bgp); int idx_ospf_table = 2; int idx_number = 3; - u_short instance; + unsigned short instance; int protocol; if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0) @@ -11533,7 +11532,7 @@ DEFUN (bgp_redistribute_ipv6_metric, int idx_protocol = 1; int idx_number = 3; int type; - u_int32_t metric; + uint32_t metric; struct bgp_redist *red; type = proto_redistnum(AFI_IP6, argv[idx_protocol]->text); @@ -11563,7 +11562,7 @@ DEFUN (bgp_redistribute_ipv6_rmap_metric, int idx_word = 3; int idx_number = 5; int type; - u_int32_t metric; + uint32_t metric; struct bgp_redist *red; type = proto_redistnum(AFI_IP6, argv[idx_protocol]->text); @@ -11594,7 +11593,7 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap, int idx_number = 3; int idx_word = 5; int type; - u_int32_t metric; + uint32_t metric; struct bgp_redist *red; type = proto_redistnum(AFI_IP6, argv[idx_protocol]->text); diff --git a/bgpd/bgp_vty.h b/bgpd/bgp_vty.h index f77ebb610..7a9546e3e 100644 --- a/bgpd/bgp_vty.h +++ b/bgpd/bgp_vty.h @@ -70,7 +70,7 @@ extern int bgp_vty_find_and_parse_afi_safi_bgp(struct vty *vty, int argc, int *idx, afi_t *afi, safi_t *safi, struct bgp **bgp); extern int bgp_show_summary_vty(struct vty *vty, const char *name, afi_t afi, - safi_t safi, u_char use_json); + safi_t safi, uint8_t use_json); extern void bgp_vpn_policy_config_write_afi(struct vty *vty, struct bgp *bgp, afi_t afi); #endif /* _QUAGGA_BGP_VTY_H */ diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 1e3b2a4f4..77416e3cf 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -979,10 +979,10 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p, int nh_family; unsigned int valid_nh_count = 0; int has_valid_label = 0; - u_char distance; + uint8_t distance; struct peer *peer; struct bgp_info *mpinfo; - u_int32_t metric; + uint32_t metric; struct attr local_attr; struct bgp_info local_info; struct bgp_info *mpinfo_cp = &local_info; @@ -1367,8 +1367,8 @@ void bgp_zebra_withdraw(struct prefix *p, struct bgp_info *info, zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); } -struct bgp_redist *bgp_redist_lookup(struct bgp *bgp, afi_t afi, u_char type, - u_short instance) +struct bgp_redist *bgp_redist_lookup(struct bgp *bgp, afi_t afi, uint8_t type, + unsigned short instance) { struct list *red_list; struct listnode *node; @@ -1385,8 +1385,8 @@ struct bgp_redist *bgp_redist_lookup(struct bgp *bgp, afi_t afi, u_char type, return NULL; } -struct bgp_redist *bgp_redist_add(struct bgp *bgp, afi_t afi, u_char type, - u_short instance) +struct bgp_redist *bgp_redist_add(struct bgp *bgp, afi_t afi, uint8_t type, + unsigned short instance) { struct list *red_list; struct bgp_redist *red; @@ -1408,8 +1408,8 @@ struct bgp_redist *bgp_redist_add(struct bgp *bgp, afi_t afi, u_char type, return red; } -static void bgp_redist_del(struct bgp *bgp, afi_t afi, u_char type, - u_short instance) +static void bgp_redist_del(struct bgp *bgp, afi_t afi, uint8_t type, + unsigned short instance) { struct bgp_redist *red; @@ -1424,7 +1424,8 @@ static void bgp_redist_del(struct bgp *bgp, afi_t afi, u_char type, } /* Other routes redistribution into BGP. */ -int bgp_redistribute_set(struct bgp *bgp, afi_t afi, int type, u_short instance) +int bgp_redistribute_set(struct bgp *bgp, afi_t afi, int type, + unsigned short instance) { /* Return if already redistribute flag is set. */ @@ -1471,7 +1472,7 @@ int bgp_redistribute_set(struct bgp *bgp, afi_t afi, int type, u_short instance) } int bgp_redistribute_resend(struct bgp *bgp, afi_t afi, int type, - u_short instance) + unsigned short instance) { /* Don't try to send if we're not connected to Zebra or Zebra doesn't * know of this instance. @@ -1509,7 +1510,7 @@ int bgp_redistribute_rmap_set(struct bgp_redist *red, const char *name) /* Redistribute with metric specification. */ int bgp_redistribute_metric_set(struct bgp *bgp, struct bgp_redist *red, - afi_t afi, int type, u_int32_t metric) + afi_t afi, int type, uint32_t metric) { struct bgp_node *rn; struct bgp_info *ri; @@ -1547,7 +1548,7 @@ int bgp_redistribute_metric_set(struct bgp *bgp, struct bgp_redist *red, /* Unset redistribution. */ int bgp_redistribute_unreg(struct bgp *bgp, afi_t afi, int type, - u_short instance) + unsigned short instance) { struct bgp_redist *red; @@ -1586,7 +1587,7 @@ int bgp_redistribute_unreg(struct bgp *bgp, afi_t afi, int type, /* Unset redistribution. */ int bgp_redistribute_unset(struct bgp *bgp, afi_t afi, int type, - u_short instance) + unsigned short instance) { struct bgp_redist *red; @@ -1893,7 +1894,7 @@ static int bgp_zebra_process_local_macip(int command, struct zclient *zclient, int ipa_len; char buf[ETHER_ADDR_STRLEN]; char buf1[INET6_ADDRSTRLEN]; - u_char flags; + uint8_t flags; memset(&ip, 0, sizeof(ip)); s = zclient->ibuf; diff --git a/bgpd/bgp_zebra.h b/bgpd/bgp_zebra.h index c30f63039..68c495cf8 100644 --- a/bgpd/bgp_zebra.h +++ b/bgpd/bgp_zebra.h @@ -42,16 +42,17 @@ extern void bgp_zebra_terminate_radv(struct bgp *bgp, struct peer *peer); extern void bgp_zebra_instance_register(struct bgp *); extern void bgp_zebra_instance_deregister(struct bgp *); -extern struct bgp_redist *bgp_redist_lookup(struct bgp *, afi_t, u_char, - u_short); -extern struct bgp_redist *bgp_redist_add(struct bgp *, afi_t, u_char, u_short); -extern int bgp_redistribute_set(struct bgp *, afi_t, int, u_short); -extern int bgp_redistribute_resend(struct bgp *, afi_t, int, u_short); +extern struct bgp_redist *bgp_redist_lookup(struct bgp *, afi_t, uint8_t, + unsigned short); +extern struct bgp_redist *bgp_redist_add(struct bgp *, afi_t, uint8_t, + unsigned short); +extern int bgp_redistribute_set(struct bgp *, afi_t, int, unsigned short); +extern int bgp_redistribute_resend(struct bgp *, afi_t, int, unsigned short); extern int bgp_redistribute_rmap_set(struct bgp_redist *, const char *); extern int bgp_redistribute_metric_set(struct bgp *, struct bgp_redist *, afi_t, - int, u_int32_t); -extern int bgp_redistribute_unset(struct bgp *, afi_t, int, u_short); -extern int bgp_redistribute_unreg(struct bgp *, afi_t, int, u_short); + int, uint32_t); +extern int bgp_redistribute_unset(struct bgp *, afi_t, int, unsigned short); +extern int bgp_redistribute_unreg(struct bgp *, afi_t, int, unsigned short); extern struct interface *if_lookup_by_ipv4(struct in_addr *, vrf_id_t); extern struct interface *if_lookup_by_ipv4_exact(struct in_addr *, vrf_id_t); diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index c1c1ee07d..515d90e04 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -376,7 +376,7 @@ time_t bgp_clock(void) } /* BGP timer configuration. */ -int bgp_timers_set(struct bgp *bgp, u_int32_t keepalive, u_int32_t holdtime) +int bgp_timers_set(struct bgp *bgp, uint32_t keepalive, uint32_t holdtime) { bgp->default_keepalive = (keepalive < holdtime / 3 ? keepalive : holdtime / 3); @@ -589,7 +589,7 @@ int bgp_confederation_peers_remove(struct bgp *bgp, as_t as) } /* Local preference configuration. */ -int bgp_default_local_preference_set(struct bgp *bgp, u_int32_t local_pref) +int bgp_default_local_preference_set(struct bgp *bgp, uint32_t local_pref) { if (!bgp) return -1; @@ -610,8 +610,7 @@ int bgp_default_local_preference_unset(struct bgp *bgp) } /* Local preference configuration. */ -int bgp_default_subgroup_pkt_queue_max_set(struct bgp *bgp, - u_int32_t queue_size) +int bgp_default_subgroup_pkt_queue_max_set(struct bgp *bgp, uint32_t queue_size) { if (!bgp) return -1; @@ -796,15 +795,14 @@ static int peer_hash_same(const void *p1, const void *p2) == CHECK_FLAG(peer2->flags, PEER_FLAG_CONFIG_NODE)); } -int peer_af_flag_check(struct peer *peer, afi_t afi, safi_t safi, - u_int32_t flag) +int peer_af_flag_check(struct peer *peer, afi_t afi, safi_t safi, uint32_t flag) { return CHECK_FLAG(peer->af_flags[afi][safi], flag); } /* Return true if flag is set for the peer but not the peer-group */ static int peergroup_af_flag_check(struct peer *peer, afi_t afi, safi_t safi, - u_int32_t flag) + uint32_t flag) { struct peer *g_peer = NULL; @@ -1302,7 +1300,7 @@ static int bgp_peer_conf_if_to_su_update_v4(struct peer *peer, { struct connected *ifc; struct prefix p; - u_int32_t addr; + uint32_t addr; struct listnode *node; /* If our IPv4 address on the interface is /30 or /31, we can derive the @@ -3717,16 +3715,16 @@ static void peer_change_action(struct peer *peer, afi_t afi, safi_t safi, struct peer_flag_action { /* Peer's flag. */ - u_int32_t flag; + uint32_t flag; /* This flag can be set for peer-group member. */ - u_char not_for_member; + uint8_t not_for_member; /* Action when the flag is changed. */ enum peer_change_type type; /* Peer down cause */ - u_char peer_down; + uint8_t peer_down; }; static const struct peer_flag_action peer_flag_action_list[] = { @@ -3773,7 +3771,7 @@ static const struct peer_flag_action peer_af_flag_action_list[] = { /* Proper action set. */ static int peer_flag_action_set(const struct peer_flag_action *action_list, int size, struct peer_flag_action *action, - u_int32_t flag) + uint32_t flag) { int i; int found = 0; @@ -3817,7 +3815,7 @@ static int peer_flag_action_set(const struct peer_flag_action *action_list, return found; } -static void peer_flag_modify_action(struct peer *peer, u_int32_t flag) +static void peer_flag_modify_action(struct peer *peer, uint32_t flag) { if (flag == PEER_FLAG_SHUTDOWN) { if (CHECK_FLAG(peer->flags, flag)) { @@ -3848,7 +3846,7 @@ static void peer_flag_modify_action(struct peer *peer, u_int32_t flag) msglen = 128; if (msglen) { - u_char msgbuf[129]; + uint8_t msgbuf[129]; msgbuf[0] = msglen; memcpy(msgbuf + 1, msg, msglen); @@ -3882,7 +3880,7 @@ static void peer_flag_modify_action(struct peer *peer, u_int32_t flag) } /* Change specified peer flag. */ -static int peer_flag_modify(struct peer *peer, u_int32_t flag, int set) +static int peer_flag_modify(struct peer *peer, uint32_t flag, int set) { int found; int size; @@ -3955,18 +3953,18 @@ static int peer_flag_modify(struct peer *peer, u_int32_t flag, int set) return 0; } -int peer_flag_set(struct peer *peer, u_int32_t flag) +int peer_flag_set(struct peer *peer, uint32_t flag) { return peer_flag_modify(peer, flag, 1); } -int peer_flag_unset(struct peer *peer, u_int32_t flag) +int peer_flag_unset(struct peer *peer, uint32_t flag) { return peer_flag_modify(peer, flag, 0); } static int peer_af_flag_modify(struct peer *peer, afi_t afi, safi_t safi, - u_int32_t flag, int set) + uint32_t flag, int set) { int found; int size; @@ -4122,13 +4120,12 @@ static int peer_af_flag_modify(struct peer *peer, afi_t afi, safi_t safi, return 0; } -int peer_af_flag_set(struct peer *peer, afi_t afi, safi_t safi, u_int32_t flag) +int peer_af_flag_set(struct peer *peer, afi_t afi, safi_t safi, uint32_t flag) { return peer_af_flag_modify(peer, afi, safi, flag, 1); } -int peer_af_flag_unset(struct peer *peer, afi_t afi, safi_t safi, - u_int32_t flag) +int peer_af_flag_unset(struct peer *peer, afi_t afi, safi_t safi, uint32_t flag) { return peer_af_flag_modify(peer, afi, safi, flag, 0); } @@ -4560,7 +4557,7 @@ int peer_default_originate_unset(struct peer *peer, afi_t afi, safi_t safi) return 0; } -int peer_port_set(struct peer *peer, u_int16_t port) +int peer_port_set(struct peer *peer, uint16_t port) { peer->port = port; return 0; @@ -4599,7 +4596,7 @@ static void peer_on_policy_change(struct peer *peer, afi_t afi, safi_t safi, /* neighbor weight. */ -int peer_weight_set(struct peer *peer, afi_t afi, safi_t safi, u_int16_t weight) +int peer_weight_set(struct peer *peer, afi_t afi, safi_t safi, uint16_t weight) { struct peer_group *group; struct listnode *node, *nnode; @@ -4679,7 +4676,7 @@ int peer_weight_unset(struct peer *peer, afi_t afi, safi_t safi) return 0; } -int peer_timers_set(struct peer *peer, u_int32_t keepalive, u_int32_t holdtime) +int peer_timers_set(struct peer *peer, uint32_t keepalive, uint32_t holdtime) { struct peer_group *group; struct listnode *node, *nnode; @@ -4760,7 +4757,7 @@ int peer_timers_unset(struct peer *peer) return 0; } -int peer_timers_connect_set(struct peer *peer, u_int32_t connect) +int peer_timers_connect_set(struct peer *peer, uint32_t connect) { struct peer_group *group; struct listnode *node, *nnode; @@ -4813,7 +4810,7 @@ int peer_timers_connect_unset(struct peer *peer) return 0; } -int peer_advertise_interval_set(struct peer *peer, u_int32_t routeadv) +int peer_advertise_interval_set(struct peer *peer, uint32_t routeadv) { struct peer_group *group; struct listnode *node, *nnode; @@ -5880,8 +5877,8 @@ int peer_unsuppress_map_unset(struct peer *peer, afi_t afi, safi_t safi) } int peer_maximum_prefix_set(struct peer *peer, afi_t afi, safi_t safi, - u_int32_t max, u_char threshold, int warning, - u_int16_t restart) + uint32_t max, uint8_t threshold, int warning, + uint16_t restart) { struct peer_group *group; struct listnode *node, *nnode; @@ -6225,7 +6222,7 @@ int peer_clear_soft(struct peer *peer, afi_t afi, safi_t safi, || CHECK_FLAG(peer->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))) { struct bgp_filter *filter = &peer->filter[afi][safi]; - u_char prefix_type; + uint8_t prefix_type; if (CHECK_FLAG(peer->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) @@ -6279,7 +6276,7 @@ int peer_clear_soft(struct peer *peer, afi_t afi, safi_t safi, } /* Display peer uptime.*/ -char *peer_uptime(time_t uptime2, char *buf, size_t len, u_char use_json, +char *peer_uptime(time_t uptime2, char *buf, size_t len, uint8_t use_json, json_object *json) { time_t uptime1, epoch_tbuf; @@ -6289,7 +6286,7 @@ char *peer_uptime(time_t uptime2, char *buf, size_t len, u_char use_json, if (len < BGP_UPTIME_LEN) { if (!use_json) { zlog_warn("peer_uptime (): buffer shortage %lu", - (u_long)len); + (unsigned long)len); /* XXX: should return status instead of buf... */ snprintf(buf, len, "<error> "); } diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index d4c2a1aba..10d6e0397 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -60,9 +60,9 @@ enum { AS_UNSPECIFIED = 0, }; /* Typedef BGP specific types. */ -typedef u_int32_t as_t; -typedef u_int16_t as16_t; /* we may still encounter 16 Bit asnums */ -typedef u_int16_t bgp_size_t; +typedef uint32_t as_t; +typedef uint16_t as16_t; /* we may still encounter 16 Bit asnums */ +typedef uint16_t bgp_size_t; #define max(a, b) \ ({ \ @@ -112,7 +112,7 @@ struct bgp_master { struct list *listen_sockets; /* BGP port number. */ - u_int16_t port; + uint16_t port; /* Listener address */ char *address; @@ -121,7 +121,7 @@ struct bgp_master { time_t start_time; /* Various BGP global configuration. */ - u_char options; + uint8_t options; #define BGP_OPT_NO_FIB (1 << 0) #define BGP_OPT_MULTIPLE_INSTANCE (1 << 1) #define BGP_OPT_CONFIG_CISCO (1 << 2) @@ -132,7 +132,7 @@ struct bgp_master { /* timer to dampen route map changes */ struct thread *t_rmap_update; /* Handle route map updates */ - u_int32_t rmap_update_timer; /* Route map update timer */ + uint32_t rmap_update_timer; /* Route map update timer */ #define RMAP_DEFAULT_UPDATE_TIMER 5 /* disabled by default */ /* Id space for automatic RD derivation for an EVI/VRF */ @@ -149,11 +149,11 @@ struct bgp_rmap { }; struct bgp_redist { - u_short instance; + unsigned short instance; /* BGP redistribute metric configuration. */ - u_char redist_metric_flag; - u_int32_t redist_metric; + uint8_t redist_metric_flag; + uint32_t redist_metric; /* BGP redistribute route-map. */ struct bgp_rmap rmap; @@ -216,23 +216,23 @@ struct bgp { * Global statistics for update groups. */ struct { - u_int32_t join_events; - u_int32_t prune_events; - u_int32_t merge_events; - u_int32_t split_events; - u_int32_t updgrp_switch_events; - u_int32_t peer_refreshes_combined; - u_int32_t adj_count; - u_int32_t merge_checks_triggered; - - u_int32_t updgrps_created; - u_int32_t updgrps_deleted; - u_int32_t subgrps_created; - u_int32_t subgrps_deleted; + uint32_t join_events; + uint32_t prune_events; + uint32_t merge_events; + uint32_t split_events; + uint32_t updgrp_switch_events; + uint32_t peer_refreshes_combined; + uint32_t adj_count; + uint32_t merge_checks_triggered; + + uint32_t updgrps_created; + uint32_t updgrps_deleted; + uint32_t subgrps_created; + uint32_t subgrps_deleted; } update_group_stats; /* BGP configuration. */ - u_int16_t config; + uint16_t config; #define BGP_CONFIG_CLUSTER_ID (1 << 0) #define BGP_CONFIG_CONFEDERATION (1 << 1) @@ -252,45 +252,45 @@ struct bgp { struct thread *t_startup; /* start-up timer on only once at the beginning */ - u_int32_t v_maxmed_onstartup; /* Duration of max-med on start-up */ + uint32_t v_maxmed_onstartup; /* Duration of max-med on start-up */ #define BGP_MAXMED_ONSTARTUP_UNCONFIGURED 0 /* 0 means off, its the default */ - u_int32_t maxmed_onstartup_value; /* Max-med value when active on - start-up */ + uint32_t maxmed_onstartup_value; /* Max-med value when active on + start-up */ struct thread *t_maxmed_onstartup; /* non-null when max-med onstartup is on */ - u_char maxmed_onstartup_over; /* Flag to make it effective only once */ + uint8_t maxmed_onstartup_over; /* Flag to make it effective only once */ - u_char v_maxmed_admin; /* 1/0 if max-med administrative is on/off */ + uint8_t v_maxmed_admin; /* 1/0 if max-med administrative is on/off */ #define BGP_MAXMED_ADMIN_UNCONFIGURED 0 /* Off by default */ - u_int32_t maxmed_admin_value; /* Max-med value when administrative in on - */ + uint32_t maxmed_admin_value; /* Max-med value when administrative in on + */ #define BGP_MAXMED_VALUE_DEFAULT 4294967294 /* Maximum by default */ - u_char maxmed_active; /* 1/0 if max-med is active or not */ - u_int32_t maxmed_value; /* Max-med value when its active */ + uint8_t maxmed_active; /* 1/0 if max-med is active or not */ + uint32_t maxmed_value; /* Max-med value when its active */ /* BGP update delay on startup */ struct thread *t_update_delay; struct thread *t_establish_wait; - u_char update_delay_over; - u_char main_zebra_update_hold; - u_char main_peers_update_hold; - u_int16_t v_update_delay; - u_int16_t v_establish_wait; + uint8_t update_delay_over; + uint8_t main_zebra_update_hold; + uint8_t main_peers_update_hold; + uint16_t v_update_delay; + uint16_t v_establish_wait; char update_delay_begin_time[64]; char update_delay_end_time[64]; char update_delay_zebra_resume_time[64]; char update_delay_peers_resume_time[64]; - u_int32_t established; - u_int32_t restarted_peers; - u_int32_t implicit_eors; - u_int32_t explicit_eors; + uint32_t established; + uint32_t restarted_peers; + uint32_t implicit_eors; + uint32_t explicit_eors; #define BGP_UPDATE_DELAY_DEF 0 #define BGP_UPDATE_DELAY_MIN 0 #define BGP_UPDATE_DELAY_MAX 3600 /* BGP flags. */ - u_int32_t flags; + uint32_t flags; #define BGP_FLAG_ALWAYS_COMPARE_MED (1 << 0) #define BGP_FLAG_DETERMINISTIC_MED (1 << 1) #define BGP_FLAG_MED_MISSING_AS_WORST (1 << 2) @@ -315,7 +315,7 @@ struct bgp { #define BGP_FLAG_GRACEFUL_SHUTDOWN (1 << 21) /* BGP Per AF flags */ - u_int16_t af_flags[AFI_MAX][SAFI_MAX]; + uint16_t af_flags[AFI_MAX][SAFI_MAX]; #define BGP_CONFIG_DAMPENING (1 << 0) #define BGP_CONFIG_VRF_TO_MPLSVPN_EXPORT (1 << 1) #define BGP_CONFIG_MPLSVPN_TO_VRF_IMPORT (1 << 2) @@ -357,36 +357,36 @@ struct bgp { struct list *redist[AFI_MAX][ZEBRA_ROUTE_MAX]; /* Allocate MPLS labels */ - u_char allocate_mpls_labels[AFI_MAX][SAFI_MAX]; + uint8_t allocate_mpls_labels[AFI_MAX][SAFI_MAX]; /* timer to re-evaluate neighbor default-originate route-maps */ struct thread *t_rmap_def_originate_eval; #define RMAP_DEFAULT_ORIGINATE_EVAL_TIMER 5 /* BGP distance configuration. */ - u_char distance_ebgp[AFI_MAX][SAFI_MAX]; - u_char distance_ibgp[AFI_MAX][SAFI_MAX]; - u_char distance_local[AFI_MAX][SAFI_MAX]; + uint8_t distance_ebgp[AFI_MAX][SAFI_MAX]; + uint8_t distance_ibgp[AFI_MAX][SAFI_MAX]; + uint8_t distance_local[AFI_MAX][SAFI_MAX]; /* BGP default local-preference. */ - u_int32_t default_local_pref; + uint32_t default_local_pref; /* BGP default subgroup pkt queue max */ - u_int32_t default_subgroup_pkt_queue_max; + uint32_t default_subgroup_pkt_queue_max; /* BGP default timer. */ - u_int32_t default_holdtime; - u_int32_t default_keepalive; + uint32_t default_holdtime; + uint32_t default_keepalive; /* BGP graceful restart */ - u_int32_t restart_time; - u_int32_t stalepath_time; + uint32_t restart_time; + uint32_t stalepath_time; /* Maximum-paths configuration */ struct bgp_maxpaths_cfg { - u_int16_t maxpaths_ebgp; - u_int16_t maxpaths_ibgp; - u_int16_t ibgp_flags; + uint16_t maxpaths_ebgp; + uint16_t maxpaths_ibgp; + uint16_t ibgp_flags; #define BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN (1 << 0) } maxpaths[AFI_MAX][SAFI_MAX]; @@ -401,7 +401,7 @@ struct bgp { /* Auto-shutdown new peers */ bool autoshutdown; - u_int32_t addpath_tx_id; + uint32_t addpath_tx_id; int addpath_tx_used[AFI_MAX][SAFI_MAX]; #if ENABLE_BGP_VNC @@ -510,11 +510,11 @@ struct peer_group { /* BGP Notify message format. */ struct bgp_notify { - u_char code; - u_char subcode; + uint8_t code; + uint8_t subcode; char *data; bgp_size_t length; - u_char *raw_data; + uint8_t *raw_data; }; /* Next hop self address. */ @@ -536,7 +536,7 @@ struct bgp_nexthop { #define BGP_RD_SIZE 8 struct bgp_rd { - u_char val[BGP_RD_SIZE]; + uint8_t val[BGP_RD_SIZE]; }; #define RMAP_IN 0 @@ -720,13 +720,13 @@ struct peer { struct bgp_nexthop nexthop; /* Nexthop */ /* Peer address family configuration. */ - u_char afc[AFI_MAX][SAFI_MAX]; - u_char afc_nego[AFI_MAX][SAFI_MAX]; - u_char afc_adv[AFI_MAX][SAFI_MAX]; - u_char afc_recv[AFI_MAX][SAFI_MAX]; + uint8_t afc[AFI_MAX][SAFI_MAX]; + uint8_t afc_nego[AFI_MAX][SAFI_MAX]; + uint8_t afc_adv[AFI_MAX][SAFI_MAX]; + uint8_t afc_recv[AFI_MAX][SAFI_MAX]; /* Capability flags (reset in bgp_stop) */ - u_int32_t cap; + uint32_t cap; #define PEER_CAP_REFRESH_ADV (1 << 0) /* refresh advertised */ #define PEER_CAP_REFRESH_OLD_RCV (1 << 1) /* refresh old received */ #define PEER_CAP_REFRESH_NEW_RCV (1 << 2) /* refresh rfc received */ @@ -746,7 +746,7 @@ struct peer { #define PEER_CAP_HOSTNAME_RCV (1 << 16) /* hostname received */ /* Capability flags (reset in bgp_stop) */ - u_int32_t af_cap[AFI_MAX][SAFI_MAX]; + uint32_t af_cap[AFI_MAX][SAFI_MAX]; #define PEER_CAP_ORF_PREFIX_SM_ADV (1 << 0) /* send-mode advertised */ #define PEER_CAP_ORF_PREFIX_RM_ADV (1 << 1) /* receive-mode advertised */ #define PEER_CAP_ORF_PREFIX_SM_RCV (1 << 2) /* send-mode received */ @@ -764,7 +764,7 @@ struct peer { #define PEER_CAP_ENHE_AF_NEGO (1 << 14) /* Extended nexthop afi/safi negotiated */ /* Global configuration flags. */ - u_int32_t flags; + uint32_t flags; #define PEER_FLAG_PASSIVE (1 << 0) /* passive mode */ #define PEER_FLAG_SHUTDOWN (1 << 1) /* shutdown */ #define PEER_FLAG_DONT_CAPABILITY (1 << 2) /* dont-capability */ @@ -786,10 +786,10 @@ struct peer { char *tx_shutdown_message; /* NSF mode (graceful restart) */ - u_char nsf[AFI_MAX][SAFI_MAX]; + uint8_t nsf[AFI_MAX][SAFI_MAX]; /* Per AF configuration flags. */ - u_int32_t af_flags[AFI_MAX][SAFI_MAX]; + uint32_t af_flags[AFI_MAX][SAFI_MAX]; #define PEER_FLAG_SEND_COMMUNITY (1 << 0) /* send-community */ #define PEER_FLAG_SEND_EXT_COMMUNITY (1 << 1) /* send-community ext. */ #define PEER_FLAG_NEXTHOP_SELF (1 << 2) /* next-hop-self */ @@ -828,7 +828,7 @@ struct peer { } default_rmap[AFI_MAX][SAFI_MAX]; /* Peer status flags. */ - u_int16_t sflags; + uint16_t sflags; #define PEER_STATUS_ACCEPT_PEER (1 << 0) /* accept peer */ #define PEER_STATUS_PREFIX_OVERFLOW (1 << 1) /* prefix-overflow */ #define PEER_STATUS_CAPABILITY_OPEN (1 << 2) /* capability open send */ @@ -838,7 +838,7 @@ struct peer { #define PEER_STATUS_NSF_WAIT (1 << 6) /* wait comeback peer */ /* Peer status af flags (reset in bgp_stop) */ - u_int16_t af_sflags[AFI_MAX][SAFI_MAX]; + uint16_t af_sflags[AFI_MAX][SAFI_MAX]; #define PEER_STATUS_ORF_PREFIX_SEND (1 << 0) /* prefix-list send peer */ #define PEER_STATUS_ORF_WAIT_REFRESH (1 << 1) /* wait refresh received peer */ #define PEER_STATUS_PREFIX_THRESHOLD (1 << 2) /* exceed prefix-threshold */ @@ -847,7 +847,7 @@ struct peer { #define PEER_STATUS_EOR_RECEIVED (1 << 5) /* end-of-rib received from peer */ /* Default attribute value for the peer. */ - u_int32_t config; + uint32_t config; #define PEER_CONFIG_TIMER (1 << 0) /* keepalive & holdtime */ #define PEER_CONFIG_CONNECT (1 << 1) /* connect */ #define PEER_CONFIG_ROUTEADV (1 << 2) /* route advertise */ @@ -934,11 +934,11 @@ struct peer { _Atomic uint32_t dynamic_cap_out; /* Dynamic Capability output count. */ /* BGP state count */ - u_int32_t established; /* Established */ - u_int32_t dropped; /* Dropped */ + uint32_t established; /* Established */ + uint32_t dropped; /* Dropped */ /* Update delay related fields */ - u_char update_delay_over; /* When this is set, BGP is no more waiting + uint8_t update_delay_over; /* When this is set, BGP is no more waiting for EOR */ /* Syncronization list and time. */ @@ -972,8 +972,8 @@ struct peer { /* Max prefix count. */ unsigned long pmax[AFI_MAX][SAFI_MAX]; - u_char pmax_threshold[AFI_MAX][SAFI_MAX]; - u_int16_t pmax_restart[AFI_MAX][SAFI_MAX]; + uint8_t pmax_threshold[AFI_MAX][SAFI_MAX]; + uint16_t pmax_restart[AFI_MAX][SAFI_MAX]; #define MAXIMUM_PREFIX_THRESHOLD_DEFAULT 75 /* allowas-in. */ @@ -1011,10 +1011,10 @@ struct peer { #define PEER_DOWN_IF_DOWN 25 /* Interface down */ #define PEER_DOWN_NBR_ADDR_DEL 26 /* Peer address lost */ unsigned long last_reset_cause_size; - u_char last_reset_cause[BGP_MAX_PACKET_SIZE]; + uint8_t last_reset_cause[BGP_MAX_PACKET_SIZE]; /* The kind of route-map Flags.*/ - u_char rmap_type; + uint8_t rmap_type; #define PEER_RMAP_TYPE_IN (1 << 0) /* neighbor route-map in */ #define PEER_RMAP_TYPE_OUT (1 << 1) /* neighbor route-map out */ #define PEER_RMAP_TYPE_NETWORK (1 << 2) /* network route-map */ @@ -1053,7 +1053,7 @@ struct bgp_nlri { uint8_t safi; /* iana_safi_t */ /* Pointer to NLRI byte stream. */ - u_char *nlri; + uint8_t *nlri; /* Length of whole NLRI. */ bgp_size_t length; @@ -1354,7 +1354,7 @@ extern struct peer *peer_create(union sockunion *, const char *, struct bgp *, struct peer_group *); extern struct peer *peer_create_accept(struct bgp *); extern void peer_xfer_config(struct peer *dst, struct peer *src); -extern char *peer_uptime(time_t, char *, size_t, u_char, json_object *); +extern char *peer_uptime(time_t, char *, size_t, uint8_t, json_object *); extern int bgp_config_write(struct vty *); @@ -1395,14 +1395,13 @@ extern int bgp_confederation_peers_check(struct bgp *, as_t); extern int bgp_confederation_peers_add(struct bgp *, as_t); extern int bgp_confederation_peers_remove(struct bgp *, as_t); -extern int bgp_timers_set(struct bgp *, u_int32_t keepalive, - u_int32_t holdtime); +extern int bgp_timers_set(struct bgp *, uint32_t keepalive, uint32_t holdtime); extern int bgp_timers_unset(struct bgp *); -extern int bgp_default_local_preference_set(struct bgp *, u_int32_t); +extern int bgp_default_local_preference_set(struct bgp *, uint32_t); extern int bgp_default_local_preference_unset(struct bgp *); -extern int bgp_default_subgroup_pkt_queue_max_set(struct bgp *bgp, u_int32_t); +extern int bgp_default_subgroup_pkt_queue_max_set(struct bgp *bgp, uint32_t); extern int bgp_default_subgroup_pkt_queue_max_unset(struct bgp *bgp); extern int bgp_listen_limit_set(struct bgp *, int); @@ -1428,12 +1427,12 @@ extern int peer_group_bind(struct bgp *, union sockunion *, struct peer *, struct peer_group *, as_t *); extern int peer_group_unbind(struct bgp *, struct peer *, struct peer_group *); -extern int peer_flag_set(struct peer *, u_int32_t); -extern int peer_flag_unset(struct peer *, u_int32_t); +extern int peer_flag_set(struct peer *, uint32_t); +extern int peer_flag_unset(struct peer *, uint32_t); -extern int peer_af_flag_set(struct peer *, afi_t, safi_t, u_int32_t); -extern int peer_af_flag_unset(struct peer *, afi_t, safi_t, u_int32_t); -extern int peer_af_flag_check(struct peer *, afi_t, safi_t, u_int32_t); +extern int peer_af_flag_set(struct peer *, afi_t, safi_t, uint32_t); +extern int peer_af_flag_unset(struct peer *, afi_t, safi_t, uint32_t); +extern int peer_af_flag_check(struct peer *, afi_t, safi_t, uint32_t); extern int peer_ebgp_multihop_set(struct peer *, int); extern int peer_ebgp_multihop_unset(struct peer *); @@ -1450,20 +1449,20 @@ extern int peer_default_originate_set(struct peer *, afi_t, safi_t, const char *); extern int peer_default_originate_unset(struct peer *, afi_t, safi_t); -extern int peer_port_set(struct peer *, u_int16_t); +extern int peer_port_set(struct peer *, uint16_t); extern int peer_port_unset(struct peer *); -extern int peer_weight_set(struct peer *, afi_t, safi_t, u_int16_t); +extern int peer_weight_set(struct peer *, afi_t, safi_t, uint16_t); extern int peer_weight_unset(struct peer *, afi_t, safi_t); -extern int peer_timers_set(struct peer *, u_int32_t keepalive, - u_int32_t holdtime); +extern int peer_timers_set(struct peer *, uint32_t keepalive, + uint32_t holdtime); extern int peer_timers_unset(struct peer *); -extern int peer_timers_connect_set(struct peer *, u_int32_t); +extern int peer_timers_connect_set(struct peer *, uint32_t); extern int peer_timers_connect_unset(struct peer *); -extern int peer_advertise_interval_set(struct peer *, u_int32_t); +extern int peer_advertise_interval_set(struct peer *, uint32_t); extern int peer_advertise_interval_unset(struct peer *); extern void peer_interface_set(struct peer *, const char *); @@ -1495,8 +1494,8 @@ extern int peer_password_unset(struct peer *); extern int peer_unsuppress_map_unset(struct peer *, afi_t, safi_t); -extern int peer_maximum_prefix_set(struct peer *, afi_t, safi_t, u_int32_t, - u_char, int, u_int16_t); +extern int peer_maximum_prefix_set(struct peer *, afi_t, safi_t, uint32_t, + uint8_t, int, uint16_t); extern int peer_maximum_prefix_unset(struct peer *, afi_t, safi_t); extern int peer_clear(struct peer *, struct listnode **); diff --git a/bgpd/rfapi/rfapi_backend.h b/bgpd/rfapi/rfapi_backend.h index 4455d66a2..bcd894b88 100644 --- a/bgpd/rfapi/rfapi_backend.h +++ b/bgpd/rfapi/rfapi_backend.h @@ -37,13 +37,14 @@ void bgp_rfapi_destroy(struct bgp *bgp, struct rfapi *h); extern void rfapiProcessUpdate(struct peer *peer, void *rfd, struct prefix *p, struct prefix_rd *prd, struct attr *attr, - afi_t afi, safi_t safi, u_char type, - u_char sub_type, uint32_t *label); + afi_t afi, safi_t safi, uint8_t type, + uint8_t sub_type, uint32_t *label); extern void rfapiProcessWithdraw(struct peer *peer, void *rfd, struct prefix *p, struct prefix_rd *prd, struct attr *attr, - afi_t afi, safi_t safi, u_char type, int kill); + afi_t afi, safi_t safi, uint8_t type, + int kill); extern void rfapiProcessPeerDown(struct peer *peer); diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index 348f1557e..d5208f696 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -503,7 +503,7 @@ int rfapiGetUnAddrOfVpnBi(struct bgp_info *bi, struct prefix *p) */ static struct bgp_info *rfapiBgpInfoCreate(struct attr *attr, struct peer *peer, void *rfd, struct prefix_rd *prd, - u_char type, u_char sub_type, + uint8_t type, uint8_t sub_type, uint32_t *label) { struct bgp_info *new; @@ -2879,7 +2879,7 @@ typedef void(rfapi_bi_filtered_import_f)(struct rfapi_import_table *, int, struct peer *, void *, struct prefix *, struct prefix *, afi_t, struct prefix_rd *, struct attr *, - u_char, u_char, uint32_t *); + uint8_t, uint8_t, uint32_t *); static void rfapiExpireEncapNow(struct rfapi_import_table *it, @@ -2932,8 +2932,8 @@ static void rfapiBgpInfoFilteredImportEncap( struct prefix *aux_prefix, /* Unused for encap routes */ afi_t afi, struct prefix_rd *prd, struct attr *attr, /* part of bgp_info */ - u_char type, /* part of bgp_info */ - u_char sub_type, /* part of bgp_info */ + uint8_t type, /* part of bgp_info */ + uint8_t sub_type, /* part of bgp_info */ uint32_t *label) /* part of bgp_info */ { struct route_table *rt = NULL; @@ -3391,8 +3391,8 @@ void rfapiBgpInfoFilteredImportVPN( struct prefix *aux_prefix, /* AFI_L2VPN: optional IP */ afi_t afi, struct prefix_rd *prd, struct attr *attr, /* part of bgp_info */ - u_char type, /* part of bgp_info */ - u_char sub_type, /* part of bgp_info */ + uint8_t type, /* part of bgp_info */ + uint8_t sub_type, /* part of bgp_info */ uint32_t *label) /* part of bgp_info */ { struct route_table *rt = NULL; @@ -3869,8 +3869,8 @@ static void rfapiBgpInfoFilteredImportBadSafi( struct prefix *aux_prefix, /* AFI_L2VPN: optional IP */ afi_t afi, struct prefix_rd *prd, struct attr *attr, /* part of bgp_info */ - u_char type, /* part of bgp_info */ - u_char sub_type, /* part of bgp_info */ + uint8_t type, /* part of bgp_info */ + uint8_t sub_type, /* part of bgp_info */ uint32_t *label) /* part of bgp_info */ { vnc_zlog_debug_verbose("%s: Error, bad safi", __func__); @@ -3896,8 +3896,8 @@ rfapiBgpInfoFilteredImportFunction(safi_t safi) void rfapiProcessUpdate(struct peer *peer, void *rfd, /* set when looped from RFP/RFAPI */ struct prefix *p, struct prefix_rd *prd, - struct attr *attr, afi_t afi, safi_t safi, u_char type, - u_char sub_type, uint32_t *label) + struct attr *attr, afi_t afi, safi_t safi, uint8_t type, + uint8_t sub_type, uint32_t *label) { struct bgp *bgp; struct rfapi *h; @@ -3981,7 +3981,7 @@ void rfapiProcessUpdate(struct peer *peer, void rfapiProcessWithdraw(struct peer *peer, void *rfd, struct prefix *p, struct prefix_rd *prd, struct attr *attr, afi_t afi, - safi_t safi, u_char type, int kill) + safi_t safi, uint8_t type, int kill) { struct bgp *bgp; struct rfapi *h; @@ -4232,7 +4232,7 @@ static void rfapiBgpTableFilteredImport(struct bgp *bgp, struct bgp_info *bi; for (bi = rn2->info; bi; bi = bi->next) { - u_int32_t label = 0; + uint32_t label = 0; if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) diff --git a/bgpd/rfapi/rfapi_import.h b/bgpd/rfapi/rfapi_import.h index fc5bb01ce..84b7ca3a7 100644 --- a/bgpd/rfapi/rfapi_import.h +++ b/bgpd/rfapi/rfapi_import.h @@ -148,8 +148,8 @@ extern void rfapiBgpInfoFilteredImportVPN( struct prefix *aux_prefix, /* AFI_ETHER: optional IP */ afi_t afi, struct prefix_rd *prd, struct attr *attr, /* part of bgp_info */ - u_char type, /* part of bgp_info */ - u_char sub_type, /* part of bgp_info */ + uint8_t type, /* part of bgp_info */ + uint8_t sub_type, /* part of bgp_info */ uint32_t *label); /* part of bgp_info */ extern struct rfapi_next_hop_entry *rfapiEthRouteNode2NextHopList( diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index c5b3094b1..5fb44bb49 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -1068,7 +1068,7 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream, inet_ntop(pfx_vn.family, &pfx_vn.u.prefix, buf_ntop, BUFSIZ)); if (bi->extra) { - u_int32_t l = decode_label(&bi->extra->label[0]); + uint32_t l = decode_label(&bi->extra->label[0]); snprintf(buf_vn, BUFSIZ, "Label: %d", l); } else /* should never happen */ { @@ -1180,7 +1180,7 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream, } } if (tun_type != BGP_ENCAP_TYPE_MPLS && bi->extra) { - u_int32_t l = decode_label(&bi->extra->label[0]); + uint32_t l = decode_label(&bi->extra->label[0]); if (!MPLS_LABEL_IS_NULL(l)) { fp(out, " Label: %d", l); if (nlines == 1) @@ -1631,7 +1631,7 @@ void rfapiPrintDescriptor(struct vty *vty, struct rfapi_descriptor *rfd) } for (afi = AFI_IP; afi < AFI_MAX; ++afi) { - u_char family; + uint8_t family; family = afi2family(afi); if (!family) diff --git a/bgpd/rfapi/vnc_export_table.h b/bgpd/rfapi/vnc_export_table.h index aa38233e8..3ccf8661e 100644 --- a/bgpd/rfapi/vnc_export_table.h +++ b/bgpd/rfapi/vnc_export_table.h @@ -39,8 +39,8 @@ struct vnc_export_info { struct vnc_export_info *next; struct route_node *node; struct peer *peer; - u_char type; - u_char subtype; + uint8_t type; + uint8_t subtype; uint32_t lifetime; struct thread *timer; }; diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c index 4f5416643..4bc5535e1 100644 --- a/bgpd/rfapi/vnc_import_bgp.c +++ b/bgpd/rfapi/vnc_import_bgp.c @@ -124,14 +124,14 @@ struct prefix_bag { struct bgp_info *ubi; /* unicast route */ }; -static const u_char maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0, - 0xf8, 0xfc, 0xfe, 0xff}; +static const uint8_t maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0, + 0xf8, 0xfc, 0xfe, 0xff}; int vnc_prefix_cmp(void *pfx1, void *pfx2) { int offset; int shift; - u_char mask; + uint8_t mask; struct prefix *p1 = pfx1; struct prefix *p2 = pfx2; @@ -154,8 +154,8 @@ int vnc_prefix_cmp(void *pfx1, void *pfx2) } /* Set both prefix's head pointer. */ - const u_char *pp1 = (const u_char *)&p1->u.prefix; - const u_char *pp2 = (const u_char *)&p2->u.prefix; + const uint8_t *pp1 = (const uint8_t *)&p1->u.prefix; + const uint8_t *pp2 = (const uint8_t *)&p2->u.prefix; while (offset--) { if (*pp1 < *pp2) @@ -1762,7 +1762,7 @@ static void vnc_import_bgp_exterior_add_route_it( bi_interior = bi_interior->next) { struct prefix_rd *prd; struct attr new_attr; - u_int32_t label = 0; + uint32_t label = 0; if (!is_usable_interior_route(bi_interior)) continue; @@ -1941,7 +1941,7 @@ void vnc_import_bgp_exterior_del_route( for (bi_interior = rn->info; bi_interior; bi_interior = bi_interior->next) { struct prefix_rd *prd; - u_int32_t label = 0; + uint32_t label = 0; if (!is_usable_interior_route(bi_interior)) continue; @@ -2102,7 +2102,7 @@ void vnc_import_bgp_exterior_add_route_interior( struct prefix_rd *prd; struct attr new_attr; - u_int32_t label = 0; + uint32_t label = 0; ++count; /* debugging */ @@ -2194,7 +2194,7 @@ void vnc_import_bgp_exterior_add_route_interior( struct bgp_info *bi; struct prefix_rd *prd; struct attr new_attr; - u_int32_t label = 0; + uint32_t label = 0; /* do pull-down */ @@ -2336,7 +2336,7 @@ void vnc_import_bgp_exterior_add_route_interior( struct prefix_rd *prd; struct attr new_attr; - u_int32_t label = 0; + uint32_t label = 0; /* do pull-down */ @@ -2476,7 +2476,7 @@ void vnc_import_bgp_exterior_del_route_interior( &cursor)) { struct prefix_rd *prd; - u_int32_t label = 0; + uint32_t label = 0; if (bi_interior->extra) { prd = &bi_interior->extra->vnc.import.rd; @@ -2549,7 +2549,7 @@ void vnc_import_bgp_exterior_del_route_interior( struct prefix_rd *prd; struct attr new_attr; - u_int32_t label = 0; + uint32_t label = 0; if (bi->type == ZEBRA_ROUTE_BGP_DIRECT_EXT) continue; diff --git a/bgpd/rfapi/vnc_zebra.c b/bgpd/rfapi/vnc_zebra.c index 6afcd21a1..7d564ef11 100644 --- a/bgpd/rfapi/vnc_zebra.c +++ b/bgpd/rfapi/vnc_zebra.c @@ -58,7 +58,7 @@ static struct zclient *zclient_vnc = NULL; /* * Routes coming from zebra get added to VNC here */ -static void vnc_redistribute_add(struct prefix *p, u_int32_t metric, +static void vnc_redistribute_add(struct prefix *p, uint32_t metric, uint8_t type) { struct bgp *bgp = bgp_get_default(); @@ -436,7 +436,7 @@ static void vnc_zebra_route_msg(struct prefix *p, unsigned int nhp_count, static void -nve_list_to_nh_array(u_char family, struct list *nve_list, +nve_list_to_nh_array(uint8_t family, struct list *nve_list, unsigned int *nh_count_ret, void **nh_ary_ret, /* returned address array */ void **nhp_ary_ret) /* returned pointer array */ diff --git a/doc/developer/cli.rst b/doc/developer/cli.rst index 82dd8af1b..d740e42dc 100644 --- a/doc/developer/cli.rst +++ b/doc/developer/cli.rst @@ -650,7 +650,7 @@ struct cmd\_token struct cmd_token { enum cmd_token_type type; // token type - u_char attr; // token attributes + uint8_t attr; // token attributes bool allowrepeat; // matcher allowed to match token repetitively? char *text; // token text diff --git a/doc/developer/next-hop-tracking.rst b/doc/developer/next-hop-tracking.rst index 284db1ef5..25e2d1fe1 100644 --- a/doc/developer/next-hop-tracking.rst +++ b/doc/developer/next-hop-tracking.rst @@ -264,19 +264,19 @@ Zebra data structure RNH table:: - O - / \ - O O - / \ - O O - - struct rnh - { - u_char flags; - struct route_entry *state; - struct list *client_list; - struct route_node *node; - }; + . O + / \ + O O + / \ + O O + + struct rnh + { + uint8_t flags; + struct route_entry *state; + struct list *client_list; + struct route_node *node; + }; User interface changes ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/developer/workflow.rst b/doc/developer/workflow.rst index ff66007f8..0114a6ddb 100644 --- a/doc/developer/workflow.rst +++ b/doc/developer/workflow.rst @@ -496,6 +496,35 @@ For GNU coding style, use ``indent`` with the following invocation: indent -nut -nfc1 file_for_submission.c + +Historically, FRR used fixed-width integral types that do not exist in any +standard but were defined by most platforms at some point. Officially these +types are not guaranteed to exist. Therefore, please use the fixed-width +integral types introduced in the C99 standard when contributing new code to +FRR. If you need to convert a large amount of code to use the correct types, +there is a shell script in :file:`tools/convert-fixedwidth.sh` that will do the +necessary replacements. + ++-----------+--------------------------+ +| Incorrect | Correct | ++===========+==========================+ +| u_int8_t | uint8_t | ++-----------+--------------------------+ +| u_int16_t | uint16_t | ++-----------+--------------------------+ +| u_int32_t | uint32_t | ++-----------+--------------------------+ +| u_int64_t | uint64_t | ++-----------+--------------------------+ +| u_char | uint8_t or unsigned char | ++-----------+--------------------------+ +| u_short | unsigned short | ++-----------+--------------------------+ +| u_int | unsigned int | ++-----------+--------------------------+ +| u_long | unsigned long | ++-----------+--------------------------+ + Exceptions ^^^^^^^^^^ diff --git a/eigrpd/eigrp_dump.c b/eigrpd/eigrp_dump.c index 8857be78e..651a9339d 100644 --- a/eigrpd/eigrp_dump.c +++ b/eigrpd/eigrp_dump.c @@ -117,11 +117,11 @@ void eigrp_ip_header_dump(struct ip *iph) zlog_debug("ip_hl %u", iph->ip_hl); zlog_debug("ip_tos %u", iph->ip_tos); zlog_debug("ip_len %u", 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 %u", iph->ip_ttl); zlog_debug("ip_p %u", 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)); } @@ -156,7 +156,7 @@ const char *eigrp_if_name_string(struct eigrp_interface *ei) const char *eigrp_topology_ip_string(struct eigrp_prefix_entry *tn) { static char buf[EIGRP_IF_STRING_MAXLEN] = ""; - u_int32_t ifaddr; + uint32_t ifaddr; ifaddr = ntohl(tn->destination->u.prefix4.s_addr); snprintf(buf, EIGRP_IF_STRING_MAXLEN, "%u.%u.%u.%u", @@ -169,7 +169,7 @@ const char *eigrp_topology_ip_string(struct eigrp_prefix_entry *tn) const char *eigrp_if_ip_string(struct eigrp_interface *ei) { static char buf[EIGRP_IF_STRING_MAXLEN] = ""; - u_int32_t ifaddr; + uint32_t ifaddr; if (!ei) return "inactive"; @@ -185,7 +185,7 @@ const char *eigrp_if_ip_string(struct eigrp_interface *ei) const char *eigrp_neigh_ip_string(struct eigrp_neighbor *nbr) { static char buf[EIGRP_IF_STRING_MAXLEN] = ""; - u_int32_t ifaddr; + uint32_t ifaddr; ifaddr = ntohl(nbr->src.s_addr); snprintf(buf, EIGRP_IF_STRING_MAXLEN, "%u.%u.%u.%u", diff --git a/eigrpd/eigrp_fsm.c b/eigrpd/eigrp_fsm.c index a4ee5b11d..4107d4409 100644 --- a/eigrpd/eigrp_fsm.c +++ b/eigrpd/eigrp_fsm.c @@ -170,7 +170,7 @@ struct { }, }; -static const char *packet_type2str(u_char packet_type) +static const char *packet_type2str(uint8_t packet_type) { if (packet_type == EIGRP_OPC_UPDATE) return "Update"; @@ -264,7 +264,7 @@ eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg) // struct eigrp *eigrp = msg->eigrp; struct eigrp_prefix_entry *prefix = msg->prefix; struct eigrp_nexthop_entry *entry = msg->entry; - u_char actual_state = prefix->state; + uint8_t actual_state = prefix->state; enum metric_change change; if (entry == NULL) { diff --git a/eigrpd/eigrp_hello.c b/eigrpd/eigrp_hello.c index bba028f1e..6d7467051 100644 --- a/eigrpd/eigrp_hello.c +++ b/eigrpd/eigrp_hello.c @@ -108,7 +108,7 @@ int eigrp_hello_timer(struct thread *thread) * @param[in] nbr neighbor the ACK should be sent to * @param[in] param pointer packet TLV is stored to * - * @return u_int16_t number of bytes added to packet stream + * @return uint16_t number of bytes added to packet stream * * @par * Encode Parameter TLV, used to convey metric weights and the hold time. @@ -183,7 +183,7 @@ eigrp_hello_parameter_decode(struct eigrp_neighbor *nbr, return nbr; } -static u_char +static uint8_t eigrp_hello_authentication_decode(struct stream *s, struct eigrp_tlv_hdr_type *tlv_header, struct eigrp_neighbor *nbr) @@ -268,15 +268,15 @@ static void eigrp_peer_termination_decode(struct eigrp_neighbor *nbr, * @param[in] nbr_addr pointer to neighbor address for Peer * Termination TLV * - * @return u_int16_t number of bytes added to packet stream + * @return uint16_t number of bytes added to packet stream * * @par * Function used to encode Peer Termination TLV to Hello packet. */ -static u_int16_t eigrp_peer_termination_encode(struct stream *s, - struct in_addr *nbr_addr) +static uint16_t eigrp_peer_termination_encode(struct stream *s, + struct in_addr *nbr_addr) { - u_int16_t length = EIGRP_TLV_PEER_TERMINATION_LEN; + uint16_t length = EIGRP_TLV_PEER_TERMINATION_LEN; /* fill in type and length */ stream_putw(s, EIGRP_TLV_PEER_TERMINATION); @@ -405,8 +405,8 @@ void eigrp_hello_receive(struct eigrp *eigrp, struct ip *iph, inet_ntoa(nbr->src)); } -u_int32_t FRR_MAJOR; -u_int32_t FRR_MINOR; +uint32_t FRR_MAJOR; +uint32_t FRR_MINOR; void eigrp_sw_version_initialize(void) { @@ -428,16 +428,16 @@ void eigrp_sw_version_initialize(void) * * @param[in,out] s packet stream TLV is stored to * - * @return u_int16_t number of bytes added to packet stream + * @return uint16_t number of bytes added to packet stream * * @par * Store the software version in the specified location. * This consists of two bytes of OS version, and two bytes of EIGRP * revision number. */ -static u_int16_t eigrp_sw_version_encode(struct stream *s) +static uint16_t eigrp_sw_version_encode(struct stream *s) { - u_int16_t length = EIGRP_TLV_SW_VERSION_LEN; + uint16_t length = EIGRP_TLV_SW_VERSION_LEN; // setup the tlv fields stream_putw(s, EIGRP_TLV_SW_VERSION); @@ -464,9 +464,9 @@ static u_int16_t eigrp_sw_version_encode(struct stream *s) * If doing mutli-topology, then store the supported TID list. * This is currently a place holder function */ -static u_int16_t eigrp_tidlist_encode(struct stream *s) +static uint16_t eigrp_tidlist_encode(struct stream *s) { - // u_int16_t length = EIGRP_TLV_SW_VERSION_LEN; + // uint16_t length = EIGRP_TLV_SW_VERSION_LEN; return 0; } @@ -475,15 +475,15 @@ static u_int16_t eigrp_tidlist_encode(struct stream *s) * * @param[in,out] s packet stream TLV is stored to * - * @return u_int16_t number of bytes added to packet stream + * @return uint16_t number of bytes added to packet stream * * @par * Part of conditional receive process * */ -static u_int16_t eigrp_sequence_encode(struct stream *s) +static uint16_t eigrp_sequence_encode(struct stream *s) { - u_int16_t length = EIGRP_TLV_SEQ_BASE_LEN; + uint16_t length = EIGRP_TLV_SEQ_BASE_LEN; struct eigrp *eigrp; struct eigrp_interface *ei; struct listnode *node, *node2, *nnode2; @@ -507,7 +507,7 @@ static u_int16_t eigrp_sequence_encode(struct stream *s) for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, ei)) { for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr)) { if (nbr->multicast_queue->count > 0) { - length += (u_int16_t)stream_put_ipv4( + length += (uint16_t)stream_put_ipv4( s, nbr->src.s_addr); found = 1; } @@ -532,15 +532,15 @@ static u_int16_t eigrp_sequence_encode(struct stream *s) * * @param[in,out] s packet stream TLV is stored to * - * @return u_int16_t number of bytes added to packet stream + * @return uint16_t number of bytes added to packet stream * * @par * Part of conditional receive process * */ -static u_int16_t eigrp_next_sequence_encode(struct stream *s) +static uint16_t eigrp_next_sequence_encode(struct stream *s) { - u_int16_t length = EIGRP_NEXT_SEQUENCE_TLV_SIZE; + uint16_t length = EIGRP_NEXT_SEQUENCE_TLV_SIZE; struct eigrp *eigrp; eigrp = eigrp_lookup(); @@ -562,7 +562,7 @@ static u_int16_t eigrp_next_sequence_encode(struct stream *s) * @param[in] ei pointer to interface hello packet came in on * @param[in,out] s packet stream TLV is stored to * - * @return u_int16_t number of bytes added to packet stream + * @return uint16_t number of bytes added to packet stream * * @par * Encode Parameter TLV, used to convey metric weights and the hold time. @@ -571,10 +571,10 @@ static u_int16_t eigrp_next_sequence_encode(struct stream *s) * Note the addition of K6 for the new extended metrics, and does not apply to * older TLV packet formats. */ -static u_int16_t eigrp_hello_parameter_encode(struct eigrp_interface *ei, - struct stream *s, u_char flags) +static uint16_t eigrp_hello_parameter_encode(struct eigrp_interface *ei, + struct stream *s, uint8_t flags) { - u_int16_t length = EIGRP_TLV_PARAMETER_LEN; + uint16_t length = EIGRP_TLV_PARAMETER_LEN; // add in the parameters TLV stream_putw(s, EIGRP_TLV_PARAMETER); @@ -622,12 +622,12 @@ static u_int16_t eigrp_hello_parameter_encode(struct eigrp_interface *ei, * */ static struct eigrp_packet *eigrp_hello_encode(struct eigrp_interface *ei, - in_addr_t addr, u_int32_t ack, - u_char flags, + in_addr_t addr, uint32_t ack, + uint8_t flags, struct in_addr *nbr_addr) { struct eigrp_packet *ep; - u_int16_t length = EIGRP_HEADER_LEN; + uint16_t length = EIGRP_HEADER_LEN; // allocate a new packet to be sent ep = eigrp_packet_new(ei->ifp->mtu, NULL); @@ -749,7 +749,7 @@ void eigrp_hello_send_ack(struct eigrp_neighbor *nbr) * sending. If no packets are currently queues, the packet will be * sent immadiatly */ -void eigrp_hello_send(struct eigrp_interface *ei, u_char flags, +void eigrp_hello_send(struct eigrp_interface *ei, uint8_t flags, struct in_addr *nbr_addr) { struct eigrp_packet *ep = NULL; diff --git a/eigrpd/eigrp_interface.c b/eigrpd/eigrp_interface.c index 2897e262c..cd459fdc4 100644 --- a/eigrpd/eigrp_interface.c +++ b/eigrpd/eigrp_interface.c @@ -320,7 +320,7 @@ void eigrp_if_set_multicast(struct eigrp_interface *ei) } } -u_char eigrp_default_iftype(struct interface *ifp) +uint8_t eigrp_default_iftype(struct interface *ifp) { if (if_is_pointopoint(ifp)) return EIGRP_IFTYPE_POINTOPOINT; @@ -413,32 +413,32 @@ struct eigrp_interface *eigrp_if_lookup_by_name(struct eigrp *eigrp, return NULL; } -u_int32_t eigrp_bandwidth_to_scaled(u_int32_t bandwidth) +uint32_t eigrp_bandwidth_to_scaled(uint32_t bandwidth) { uint64_t temp_bandwidth = (256ull * 10000000) / bandwidth; temp_bandwidth = temp_bandwidth < EIGRP_MAX_METRIC ? temp_bandwidth : EIGRP_MAX_METRIC; - return (u_int32_t)temp_bandwidth; + return (uint32_t)temp_bandwidth; } -u_int32_t eigrp_scaled_to_bandwidth(u_int32_t scaled) +uint32_t eigrp_scaled_to_bandwidth(uint32_t scaled) { uint64_t temp_scaled = scaled * (256ull * 10000000); temp_scaled = temp_scaled < EIGRP_MAX_METRIC ? temp_scaled : EIGRP_MAX_METRIC; - return (u_int32_t)temp_scaled; + return (uint32_t)temp_scaled; } -u_int32_t eigrp_delay_to_scaled(u_int32_t delay) +uint32_t eigrp_delay_to_scaled(uint32_t delay) { return delay * 256; } -u_int32_t eigrp_scaled_to_delay(u_int32_t scaled) +uint32_t eigrp_scaled_to_delay(uint32_t scaled) { return scaled / 256; } diff --git a/eigrpd/eigrp_interface.h b/eigrpd/eigrp_interface.h index 0999c938f..a18b0b701 100644 --- a/eigrpd/eigrp_interface.h +++ b/eigrpd/eigrp_interface.h @@ -44,7 +44,7 @@ extern struct eigrp_interface *eigrp_if_new(struct eigrp *, struct interface *, extern int eigrp_if_up(struct eigrp_interface *); extern void eigrp_if_stream_set(struct eigrp_interface *); extern void eigrp_if_set_multicast(struct eigrp_interface *); -extern u_char eigrp_default_iftype(struct interface *); +extern uint8_t eigrp_default_iftype(struct interface *); extern void eigrp_if_free(struct eigrp_interface *, int); extern int eigrp_if_down(struct eigrp_interface *); extern void eigrp_if_stream_unset(struct eigrp_interface *); @@ -58,10 +58,10 @@ extern struct eigrp_interface *eigrp_if_lookup_by_name(struct eigrp *, /* Simulate down/up on the interface. */ extern void eigrp_if_reset(struct interface *); -extern u_int32_t eigrp_bandwidth_to_scaled(u_int32_t); -extern u_int32_t eigrp_scaled_to_bandwidth(u_int32_t); -extern u_int32_t eigrp_delay_to_scaled(u_int32_t); -extern u_int32_t eigrp_scaled_to_delay(u_int32_t); +extern uint32_t eigrp_bandwidth_to_scaled(uint32_t); +extern uint32_t eigrp_scaled_to_bandwidth(uint32_t); +extern uint32_t eigrp_delay_to_scaled(uint32_t); +extern uint32_t eigrp_scaled_to_delay(uint32_t); #endif /* ZEBRA_EIGRP_INTERFACE_H_ */ diff --git a/eigrpd/eigrp_neighbor.c b/eigrpd/eigrp_neighbor.c index 77bd93f6b..3bf75072a 100644 --- a/eigrpd/eigrp_neighbor.c +++ b/eigrpd/eigrp_neighbor.c @@ -206,12 +206,12 @@ int holddown_timer_expired(struct thread *thread) return 0; } -u_char eigrp_nbr_state_get(struct eigrp_neighbor *nbr) +uint8_t eigrp_nbr_state_get(struct eigrp_neighbor *nbr) { return (nbr->state); } -void eigrp_nbr_state_set(struct eigrp_neighbor *nbr, u_char state) +void eigrp_nbr_state_set(struct eigrp_neighbor *nbr, uint8_t state) { nbr->state = state; @@ -302,7 +302,7 @@ int eigrp_nbr_count_get(void) struct listnode *node, *node2, *nnode2; struct eigrp_neighbor *nbr; struct eigrp *eigrp = eigrp_lookup(); - u_int32_t counter; + uint32_t counter; if (eigrp == NULL) { zlog_debug("EIGRP Routing Process not enabled"); diff --git a/eigrpd/eigrp_neighbor.h b/eigrpd/eigrp_neighbor.h index b939e25e5..21a8c6a00 100644 --- a/eigrpd/eigrp_neighbor.h +++ b/eigrpd/eigrp_neighbor.h @@ -43,8 +43,8 @@ extern int holddown_timer_expired(struct thread *); extern int eigrp_neighborship_check(struct eigrp_neighbor *, struct TLV_Parameter_Type *); extern void eigrp_nbr_state_update(struct eigrp_neighbor *); -extern void eigrp_nbr_state_set(struct eigrp_neighbor *, u_char state); -extern u_char eigrp_nbr_state_get(struct eigrp_neighbor *); +extern void eigrp_nbr_state_set(struct eigrp_neighbor *, uint8_t state); +extern uint8_t eigrp_nbr_state_get(struct eigrp_neighbor *); extern int eigrp_nbr_count_get(void); extern const char *eigrp_nbr_state_str(struct eigrp_neighbor *); extern struct eigrp_neighbor *eigrp_nbr_lookup_by_addr(struct eigrp_interface *, diff --git a/eigrpd/eigrp_network.c b/eigrpd/eigrp_network.c index a70a7fc76..2578fecb3 100644 --- a/eigrpd/eigrp_network.c +++ b/eigrpd/eigrp_network.c @@ -150,7 +150,7 @@ void eigrp_adjust_sndbuflen(struct eigrp *eigrp, unsigned int buflen) int eigrp_if_ipmulticast(struct eigrp *top, struct prefix *p, unsigned int ifindex) { - u_char val; + uint8_t val; int ret, len; val = 0; @@ -368,8 +368,8 @@ int eigrp_network_unset(struct eigrp *eigrp, struct prefix *p) return 1; } -u_int32_t eigrp_calculate_metrics(struct eigrp *eigrp, - struct eigrp_metrics metric) +uint32_t eigrp_calculate_metrics(struct eigrp *eigrp, + struct eigrp_metrics metric) { uint64_t temp_metric; temp_metric = 0; @@ -396,13 +396,13 @@ u_int32_t eigrp_calculate_metrics(struct eigrp *eigrp, + eigrp->k_values[3]); if (temp_metric <= EIGRP_MAX_METRIC) - return (u_int32_t)temp_metric; + return (uint32_t)temp_metric; else return EIGRP_MAX_METRIC; } -u_int32_t eigrp_calculate_total_metrics(struct eigrp *eigrp, - struct eigrp_nexthop_entry *entry) +uint32_t eigrp_calculate_total_metrics(struct eigrp *eigrp, + struct eigrp_nexthop_entry *entry) { struct eigrp_interface *ei = entry->ei; @@ -412,9 +412,9 @@ u_int32_t eigrp_calculate_total_metrics(struct eigrp *eigrp, + (uint64_t)eigrp_delay_to_scaled(ei->params.delay); entry->total_metric.delay = temp_delay > EIGRP_MAX_METRIC ? EIGRP_MAX_METRIC - : (u_int32_t)temp_delay; + : (uint32_t)temp_delay; - u_int32_t bw = eigrp_bandwidth_to_scaled(ei->params.bandwidth); + uint32_t bw = eigrp_bandwidth_to_scaled(ei->params.bandwidth); entry->total_metric.bandwidth = entry->total_metric.bandwidth > bw ? bw : entry->total_metric.bandwidth; @@ -422,8 +422,8 @@ u_int32_t eigrp_calculate_total_metrics(struct eigrp *eigrp, return eigrp_calculate_metrics(eigrp, entry->total_metric); } -u_char eigrp_metrics_is_same(struct eigrp_metrics metric1, - struct eigrp_metrics metric2) +uint8_t eigrp_metrics_is_same(struct eigrp_metrics metric1, + struct eigrp_metrics metric2) { if ((metric1.bandwidth == metric2.bandwidth) && (metric1.delay == metric2.delay) diff --git a/eigrpd/eigrp_network.h b/eigrpd/eigrp_network.h index 77bd1416f..b3c76bbec 100644 --- a/eigrpd/eigrp_network.h +++ b/eigrpd/eigrp_network.h @@ -43,10 +43,11 @@ extern int eigrp_if_drop_allspfrouters(struct eigrp *top, struct prefix *p, unsigned int ifindex); extern void eigrp_adjust_sndbuflen(struct eigrp *, unsigned int); -extern u_int32_t eigrp_calculate_metrics(struct eigrp *, struct eigrp_metrics); -extern u_int32_t eigrp_calculate_total_metrics(struct eigrp *, - struct eigrp_nexthop_entry *); -extern u_char eigrp_metrics_is_same(struct eigrp_metrics, struct eigrp_metrics); +extern uint32_t eigrp_calculate_metrics(struct eigrp *, struct eigrp_metrics); +extern uint32_t eigrp_calculate_total_metrics(struct eigrp *, + struct eigrp_nexthop_entry *); +extern uint8_t eigrp_metrics_is_same(struct eigrp_metrics, + struct eigrp_metrics); extern void eigrp_external_routes_refresh(struct eigrp *, int); #endif /* EIGRP_NETWORK_H_ */ diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c index e2cd44429..990d1dc08 100644 --- a/eigrpd/eigrp_packet.c +++ b/eigrpd/eigrp_packet.c @@ -87,14 +87,14 @@ static int eigrp_retrans_count_exceeded(struct eigrp_packet *ep, } int eigrp_make_md5_digest(struct eigrp_interface *ei, struct stream *s, - u_char flags) + uint8_t flags) { struct key *key = NULL; struct keychain *keychain; unsigned char digest[EIGRP_AUTH_TYPE_MD5_LEN]; MD5_CTX ctx; - u_char *ibuf; + uint8_t *ibuf; size_t backup_get, backup_end; struct TLV_MD5_Authentication_Type *auth_TLV; @@ -157,14 +157,14 @@ int eigrp_make_md5_digest(struct eigrp_interface *ei, struct stream *s, int eigrp_check_md5_digest(struct stream *s, struct TLV_MD5_Authentication_Type *authTLV, - struct eigrp_neighbor *nbr, u_char flags) + struct eigrp_neighbor *nbr, uint8_t flags) { MD5_CTX ctx; unsigned char digest[EIGRP_AUTH_TYPE_MD5_LEN]; unsigned char orig[EIGRP_AUTH_TYPE_MD5_LEN]; struct key *key = NULL; struct keychain *keychain; - u_char *ibuf; + uint8_t *ibuf; size_t backup_end; struct TLV_MD5_Authentication_Type *auth_TLV; struct eigrp_header *eigrph; @@ -242,7 +242,7 @@ int eigrp_check_md5_digest(struct stream *s, } int eigrp_make_sha256_digest(struct eigrp_interface *ei, struct stream *s, - u_char flags) + uint8_t flags) { struct key *key = NULL; struct keychain *keychain; @@ -304,7 +304,7 @@ int eigrp_make_sha256_digest(struct eigrp_interface *ei, struct stream *s, int eigrp_check_sha256_digest(struct stream *s, struct TLV_SHA256_Authentication_Type *authTLV, - struct eigrp_neighbor *nbr, u_char flags) + struct eigrp_neighbor *nbr, uint8_t flags) { return 1; } @@ -319,13 +319,13 @@ int eigrp_write(struct thread *thread) struct ip iph; struct msghdr msg; struct iovec iov[2]; - u_int32_t seqno, ack; + uint32_t seqno, ack; int ret; int flags = 0; struct listnode *node; #ifdef WANT_EIGRP_WRITE_FRAGMENT - static u_int16_t ipid = 0; + static uint16_t ipid = 0; #endif /* WANT_EIGRP_WRITE_FRAGMENT */ #define EIGRP_WRITE_IPHL_SHIFT 2 @@ -479,8 +479,8 @@ int eigrp_read(struct thread *thread) struct interface *ifp; struct eigrp_neighbor *nbr; - u_int16_t opcode = 0; - u_int16_t length = 0; + uint16_t opcode = 0; + uint16_t length = 0; /* first of all get interface pointer. */ eigrp = THREAD_ARG(thread); @@ -706,7 +706,7 @@ static struct stream *eigrp_recv_packet(int fd, struct interface **ifp, { int ret; struct ip *iph; - u_int16_t ip_len; + uint16_t ip_len; unsigned int ifindex = 0; struct iovec iov; /* Header and data both require alignment. */ @@ -729,7 +729,7 @@ static struct stream *eigrp_recv_packet(int fd, struct interface **ifp, zlog_warn( "eigrp_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; } @@ -864,7 +864,7 @@ void eigrp_send_packet_reliably(struct eigrp_neighbor *nbr) /* Calculate EIGRP checksum */ void eigrp_packet_checksum(struct eigrp_interface *ei, struct stream *s, - u_int16_t length) + uint16_t length) { struct eigrp_header *eigrph; @@ -876,16 +876,15 @@ void eigrp_packet_checksum(struct eigrp_interface *ei, struct stream *s, /* Make EIGRP header. */ void eigrp_packet_header_init(int type, struct eigrp *eigrp, struct stream *s, - u_int32_t flags, u_int32_t sequence, - u_int32_t ack) + uint32_t flags, uint32_t sequence, uint32_t ack) { struct eigrp_header *eigrph; stream_reset(s); eigrph = (struct eigrp_header *)STREAM_DATA(s); - eigrph->version = (u_char)EIGRP_HEADER_VERSION; - eigrph->opcode = (u_char)type; + eigrph->version = (uint8_t)EIGRP_HEADER_VERSION; + eigrph->opcode = (uint8_t)type; eigrph->checksum = 0; eigrph->vrid = htons(eigrp->vrid); @@ -1159,10 +1158,10 @@ struct TLV_IPv4_Internal_type *eigrp_read_ipv4_tlv(struct stream *s) return tlv; } -u_int16_t eigrp_add_internalTLV_to_stream(struct stream *s, - struct eigrp_prefix_entry *pe) +uint16_t eigrp_add_internalTLV_to_stream(struct stream *s, + struct eigrp_prefix_entry *pe) { - u_int16_t length; + uint16_t length; stream_putw(s, EIGRP_TLV_IPv4_INT); switch (pe->destination->prefixlen) { @@ -1245,8 +1244,8 @@ u_int16_t eigrp_add_internalTLV_to_stream(struct stream *s, return length; } -u_int16_t eigrp_add_authTLV_MD5_to_stream(struct stream *s, - struct eigrp_interface *ei) +uint16_t eigrp_add_authTLV_MD5_to_stream(struct stream *s, + struct eigrp_interface *ei) { struct key *key; struct keychain *keychain; @@ -1285,8 +1284,8 @@ u_int16_t eigrp_add_authTLV_MD5_to_stream(struct stream *s, return 0; } -u_int16_t eigrp_add_authTLV_SHA256_to_stream(struct stream *s, - struct eigrp_interface *ei) +uint16_t eigrp_add_authTLV_SHA256_to_stream(struct stream *s, + struct eigrp_interface *ei) { struct key *key; struct keychain *keychain; diff --git a/eigrpd/eigrp_packet.h b/eigrpd/eigrp_packet.h index 00e1c7eac..f354615fd 100644 --- a/eigrpd/eigrp_packet.h +++ b/eigrpd/eigrp_packet.h @@ -42,9 +42,9 @@ extern struct eigrp_packet *eigrp_packet_duplicate(struct eigrp_packet *, extern void eigrp_packet_free(struct eigrp_packet *); extern void eigrp_packet_delete(struct eigrp_interface *); extern void eigrp_packet_header_init(int, struct eigrp *, struct stream *, - u_int32_t, u_int32_t, u_int32_t); + uint32_t, uint32_t, uint32_t); extern void eigrp_packet_checksum(struct eigrp_interface *, struct stream *, - u_int16_t); + uint16_t); extern struct eigrp_fifo *eigrp_fifo_new(void); extern struct eigrp_packet *eigrp_fifo_next(struct eigrp_fifo *); @@ -56,12 +56,12 @@ extern void eigrp_fifo_reset(struct eigrp_fifo *); extern void eigrp_send_packet_reliably(struct eigrp_neighbor *); extern struct TLV_IPv4_Internal_type *eigrp_read_ipv4_tlv(struct stream *); -extern u_int16_t eigrp_add_internalTLV_to_stream(struct stream *, - struct eigrp_prefix_entry *); -extern u_int16_t eigrp_add_authTLV_MD5_to_stream(struct stream *, - struct eigrp_interface *); -extern u_int16_t eigrp_add_authTLV_SHA256_to_stream(struct stream *, - struct eigrp_interface *); +extern uint16_t eigrp_add_internalTLV_to_stream(struct stream *, + struct eigrp_prefix_entry *); +extern uint16_t eigrp_add_authTLV_MD5_to_stream(struct stream *, + struct eigrp_interface *); +extern uint16_t eigrp_add_authTLV_SHA256_to_stream(struct stream *, + struct eigrp_interface *); extern int eigrp_unack_packet_retrans(struct thread *); extern int eigrp_unack_multicast_packet_retrans(struct thread *); @@ -71,7 +71,7 @@ extern int eigrp_unack_multicast_packet_retrans(struct thread *); * eigrp_hello.c */ extern void eigrp_sw_version_initialize(void); -extern void eigrp_hello_send(struct eigrp_interface *, u_char, +extern void eigrp_hello_send(struct eigrp_interface *, uint8_t, struct in_addr *); extern void eigrp_hello_send_ack(struct eigrp_neighbor *); extern void eigrp_hello_receive(struct eigrp *, struct ip *, @@ -108,7 +108,7 @@ extern void eigrp_send_query(struct eigrp_interface *); extern void eigrp_query_receive(struct eigrp *, struct ip *, struct eigrp_header *, struct stream *, struct eigrp_interface *, int); -extern u_int32_t eigrp_query_send_all(struct eigrp *); +extern uint32_t eigrp_query_send_all(struct eigrp *); /* * These externs are found in eigrp_reply.c @@ -143,15 +143,15 @@ extern struct TLV_SHA256_Authentication_Type *eigrp_authTLV_SHA256_new(void); extern void eigrp_authTLV_SHA256_free(struct TLV_SHA256_Authentication_Type *); extern int eigrp_make_md5_digest(struct eigrp_interface *, struct stream *, - u_char); + uint8_t); extern int eigrp_check_md5_digest(struct stream *, struct TLV_MD5_Authentication_Type *, - struct eigrp_neighbor *, u_char); + struct eigrp_neighbor *, uint8_t); extern int eigrp_make_sha256_digest(struct eigrp_interface *, struct stream *, - u_char); + uint8_t); extern int eigrp_check_sha256_digest(struct stream *, struct TLV_SHA256_Authentication_Type *, - struct eigrp_neighbor *, u_char); + struct eigrp_neighbor *, uint8_t); extern void eigrp_IPv4_InternalTLV_free(struct TLV_IPv4_Internal_type *); diff --git a/eigrpd/eigrp_query.c b/eigrpd/eigrp_query.c index 72780f7a0..00234bb35 100644 --- a/eigrpd/eigrp_query.c +++ b/eigrpd/eigrp_query.c @@ -54,12 +54,12 @@ #include "eigrpd/eigrp_fsm.h" #include "eigrpd/eigrp_memory.h" -u_int32_t eigrp_query_send_all(struct eigrp *eigrp) +uint32_t eigrp_query_send_all(struct eigrp *eigrp) { struct eigrp_interface *iface; struct listnode *node, *node2, *nnode2; struct eigrp_prefix_entry *pe; - u_int32_t counter; + uint32_t counter; if (eigrp == NULL) { zlog_debug("EIGRP Routing Process not enabled"); @@ -93,8 +93,8 @@ void eigrp_query_receive(struct eigrp *eigrp, struct ip *iph, struct TLV_IPv4_Internal_type *tlv; struct prefix dest_addr; - u_int16_t type; - u_int16_t length; + uint16_t type; + uint16_t length; /* increment statistics. */ ei->query_in++; @@ -111,7 +111,7 @@ void eigrp_query_receive(struct eigrp *eigrp, struct ip *iph, type = stream_getw(s); switch (type) { case EIGRP_TLV_IPv4_INT: - stream_set_getp(s, s->getp - sizeof(u_int16_t)); + stream_set_getp(s, s->getp - sizeof(uint16_t)); tlv = eigrp_read_ipv4_tlv(s); @@ -161,7 +161,7 @@ void eigrp_query_receive(struct eigrp *eigrp, struct ip *iph, void eigrp_send_query(struct eigrp_interface *ei) { struct eigrp_packet *ep = NULL; - u_int16_t length = EIGRP_HEADER_LEN; + uint16_t length = EIGRP_HEADER_LEN; struct listnode *node, *nnode, *node2, *nnode2; struct eigrp_neighbor *nbr; struct eigrp_prefix_entry *pe; diff --git a/eigrpd/eigrp_reply.c b/eigrpd/eigrp_reply.c index ae2d0c090..a702c1fbd 100644 --- a/eigrpd/eigrp_reply.c +++ b/eigrpd/eigrp_reply.c @@ -63,7 +63,7 @@ void eigrp_send_reply(struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe) { struct eigrp_packet *ep; - u_int16_t length = EIGRP_HEADER_LEN; + uint16_t length = EIGRP_HEADER_LEN; struct eigrp_interface *ei = nbr->ei; struct eigrp *eigrp = ei->eigrp; struct eigrp_prefix_entry *pe2; @@ -132,7 +132,7 @@ void eigrp_reply_receive(struct eigrp *eigrp, struct ip *iph, struct eigrp_neighbor *nbr; struct TLV_IPv4_Internal_type *tlv; - u_int16_t type; + uint16_t type; /* increment statistics. */ ei->reply_in++; @@ -153,7 +153,7 @@ void eigrp_reply_receive(struct eigrp *eigrp, struct ip *iph, struct prefix dest_addr; - stream_set_getp(s, s->getp - sizeof(u_int16_t)); + stream_set_getp(s, s->getp - sizeof(uint16_t)); tlv = eigrp_read_ipv4_tlv(s); diff --git a/eigrpd/eigrp_routemap.c b/eigrpd/eigrp_routemap.c index 9f80c6c01..ee8d5f758 100644 --- a/eigrpd/eigrp_routemap.c +++ b/eigrpd/eigrp_routemap.c @@ -255,8 +255,8 @@ static route_map_result_t route_match_metric(void *rule, struct prefix *prefix, route_map_object_t type, void *object) { - // u_int32_t *metric; - // u_int32_t check; + // uint32_t *metric; + // uint32_t check; // struct rip_info *rinfo; // struct eigrp_nexthop_entry *te; // struct eigrp_prefix_entry *pe; @@ -286,9 +286,9 @@ static route_map_result_t route_match_metric(void *rule, struct prefix *prefix, /* Route map `match metric' match statement. `arg' is METRIC value */ static void *route_match_metric_compile(const char *arg) { - // u_int32_t *metric; + // uint32_t *metric; // - // metric = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t)); + // metric = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (uint32_t)); // *metric = atoi (arg); // // if(*metric > 0) @@ -529,7 +529,7 @@ static struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd = { static route_map_result_t route_match_tag(void *rule, struct prefix *prefix, route_map_object_t type, void *object) { - // u_short *tag; + // unsigned short *tag; // struct rip_info *rinfo; // // if (type == RMAP_EIGRP) @@ -549,9 +549,9 @@ static route_map_result_t route_match_tag(void *rule, struct prefix *prefix, /* Route map `match tag' match statement. `arg' is TAG value */ static void *route_match_tag_compile(const char *arg) { - // u_short *tag; + // unsigned short *tag; // - // tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short)); + // tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (unsigned short)); // *tag = atoi (arg); // // return tag; @@ -721,7 +721,7 @@ static struct route_map_rule_cmd route_set_ip_nexthop_cmd = { static route_map_result_t route_set_tag(void *rule, struct prefix *prefix, route_map_object_t type, void *object) { - // u_short *tag; + // unsigned short *tag; // struct rip_info *rinfo; // // if(type == RMAP_RIP) @@ -738,12 +738,12 @@ static route_map_result_t route_set_tag(void *rule, struct prefix *prefix, } /* Route map `tag' compile function. Given string is converted - to u_short. */ + to unsigned short. */ static void *route_set_tag_compile(const char *arg) { - // u_short *tag; + // unsigned short *tag; // - // tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short)); + // tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (unsigned short)); // *tag = atoi (arg); // // return tag; diff --git a/eigrpd/eigrp_siaquery.c b/eigrpd/eigrp_siaquery.c index 70df29c1f..d398d7572 100644 --- a/eigrpd/eigrp_siaquery.c +++ b/eigrpd/eigrp_siaquery.c @@ -62,7 +62,7 @@ void eigrp_siaquery_receive(struct eigrp *eigrp, struct ip *iph, struct eigrp_neighbor *nbr; struct TLV_IPv4_Internal_type *tlv; - u_int16_t type; + uint16_t type; /* increment statistics. */ ei->siaQuery_in++; @@ -80,7 +80,7 @@ void eigrp_siaquery_receive(struct eigrp *eigrp, struct ip *iph, if (type == EIGRP_TLV_IPv4_INT) { struct prefix dest_addr; - stream_set_getp(s, s->getp - sizeof(u_int16_t)); + stream_set_getp(s, s->getp - sizeof(uint16_t)); tlv = eigrp_read_ipv4_tlv(s); @@ -117,7 +117,7 @@ void eigrp_send_siaquery(struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe) { struct eigrp_packet *ep; - u_int16_t length = EIGRP_HEADER_LEN; + uint16_t length = EIGRP_HEADER_LEN; ep = eigrp_packet_new(nbr->ei->ifp->mtu, nbr); diff --git a/eigrpd/eigrp_siareply.c b/eigrpd/eigrp_siareply.c index b71e80cfc..3b7a82b66 100644 --- a/eigrpd/eigrp_siareply.c +++ b/eigrpd/eigrp_siareply.c @@ -61,7 +61,7 @@ void eigrp_siareply_receive(struct eigrp *eigrp, struct ip *iph, struct eigrp_neighbor *nbr; struct TLV_IPv4_Internal_type *tlv; - u_int16_t type; + uint16_t type; /* increment statistics. */ ei->siaReply_in++; @@ -79,7 +79,7 @@ void eigrp_siareply_receive(struct eigrp *eigrp, struct ip *iph, if (type == EIGRP_TLV_IPv4_INT) { struct prefix dest_addr; - stream_set_getp(s, s->getp - sizeof(u_int16_t)); + stream_set_getp(s, s->getp - sizeof(uint16_t)); tlv = eigrp_read_ipv4_tlv(s); @@ -116,7 +116,7 @@ void eigrp_send_siareply(struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe) { struct eigrp_packet *ep; - u_int16_t length = EIGRP_HEADER_LEN; + uint16_t length = EIGRP_HEADER_LEN; ep = eigrp_packet_new(nbr->ei->ifp->mtu, nbr); diff --git a/eigrpd/eigrp_snmp.c b/eigrpd/eigrp_snmp.c index 5647476a6..e418b4034 100644 --- a/eigrpd/eigrp_snmp.c +++ b/eigrpd/eigrp_snmp.c @@ -167,16 +167,16 @@ oid eigrp_oid[] = {EIGRPMIB}; #define UINTEGER ASN_UNSIGNED /* Hook functions. */ -static u_char *eigrpVpnEntry(struct variable *, oid *, size_t *, int, size_t *, - WriteMethod **); -static u_char *eigrpTraffStatsEntry(struct variable *, oid *, size_t *, int, - size_t *, WriteMethod **); -static u_char *eigrpTopologyEntry(struct variable *, oid *, size_t *, int, - size_t *, WriteMethod **); -static u_char *eigrpPeerEntry(struct variable *, oid *, size_t *, int, size_t *, +static uint8_t *eigrpVpnEntry(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **); -static u_char *eigrpInterfaceEntry(struct variable *, oid *, size_t *, int, +static uint8_t *eigrpTraffStatsEntry(struct variable *, oid *, size_t *, int, + size_t *, WriteMethod **); +static uint8_t *eigrpTopologyEntry(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **); +static uint8_t *eigrpPeerEntry(struct variable *, oid *, size_t *, int, + size_t *, WriteMethod **); +static uint8_t *eigrpInterfaceEntry(struct variable *, oid *, size_t *, int, + size_t *, WriteMethod **); struct variable eigrp_variables[] = { @@ -599,9 +599,9 @@ static struct eigrp_neighbor *eigrpNbrLookup(struct variable *v, oid *name, } -static u_char *eigrpVpnEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *eigrpVpnEntry(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct eigrp *eigrp; @@ -657,9 +657,9 @@ static uint32_t eigrp_neighbor_count(struct eigrp *eigrp) } -static u_char *eigrpTraffStatsEntry(struct variable *v, oid *name, - size_t *length, int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *eigrpTraffStatsEntry(struct variable *v, oid *name, + size_t *length, int exact, size_t *var_len, + WriteMethod **write_method) { struct eigrp *eigrp; struct eigrp_interface *ei; @@ -913,9 +913,9 @@ static u_char *eigrpTraffStatsEntry(struct variable *v, oid *name, return NULL; } -static u_char *eigrpTopologyEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *eigrpTopologyEntry(struct variable *v, oid *name, + size_t *length, int exact, size_t *var_len, + WriteMethod **write_method) { struct eigrp *eigrp; struct eigrp_interface *ei; @@ -1061,9 +1061,9 @@ static u_char *eigrpTopologyEntry(struct variable *v, oid *name, size_t *length, return NULL; } -static u_char *eigrpPeerEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *eigrpPeerEntry(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct eigrp *eigrp; struct eigrp_interface *ei; @@ -1194,9 +1194,9 @@ static u_char *eigrpPeerEntry(struct variable *v, oid *name, size_t *length, return NULL; } -static u_char *eigrpInterfaceEntry(struct variable *v, oid *name, - size_t *length, int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *eigrpInterfaceEntry(struct variable *v, oid *name, + size_t *length, int exact, size_t *var_len, + WriteMethod **write_method) { struct eigrp *eigrp; struct eigrp_interface *ei; @@ -1383,13 +1383,13 @@ static u_char *eigrpInterfaceEntry(struct variable *v, oid *name, on this interface. */ keylist = keychain_list_get(); for (ALL_LIST_ELEMENTS(keylist, node, nnode, keychain)) { - return (u_char *)keychain->name; + return (uint8_t *)keychain->name; } if (eigrp && keychain) { *var_len = str_len(keychain->name); - return (u_char *)keychain->name; + return (uint8_t *)keychain->name; } else - return (u_char *)"TEST"; + return (uint8_t *)"TEST"; break; default: return NULL; diff --git a/eigrpd/eigrp_structs.h b/eigrpd/eigrp_structs.h index ea281fc97..95bcfe50e 100644 --- a/eigrpd/eigrp_structs.h +++ b/eigrpd/eigrp_structs.h @@ -52,43 +52,43 @@ struct eigrp_master { time_t start_time; /* Various EIGRP global configuration. */ - u_char options; + uint8_t options; #define EIGRP_MASTER_SHUTDOWN (1 << 0) /* deferred-shutdown */ }; struct eigrp_metrics { - u_int32_t delay; - u_int32_t bandwidth; + uint32_t delay; + uint32_t bandwidth; unsigned char mtu[3]; - u_char hop_count; - u_char reliability; - u_char load; - u_char tag; - u_char flags; + uint8_t hop_count; + uint8_t reliability; + uint8_t load; + uint8_t tag; + uint8_t flags; }; struct eigrp { - u_int16_t AS; /* Autonomous system number */ - u_int16_t vrid; /* Virtual Router ID */ - u_char k_values[6]; /*Array for K values configuration*/ - u_char variance; /*Metric variance multiplier*/ - u_char max_paths; /*Maximum allowed paths for 1 prefix*/ + uint16_t AS; /* Autonomous system number */ + uint16_t vrid; /* Virtual Router ID */ + uint8_t k_values[6]; /*Array for K values configuration*/ + uint8_t variance; /*Metric variance multiplier*/ + uint8_t max_paths; /*Maximum allowed paths for 1 prefix*/ /*Name of this EIGRP instance*/ char *name; /* EIGRP Router ID. */ - u_int32_t router_id; /* Configured automatically. */ - u_int32_t router_id_static; /* Configured manually. */ + uint32_t router_id; /* Configured automatically. */ + uint32_t router_id_static; /* Configured manually. */ struct list *eiflist; /* eigrp interfaces */ - u_char passive_interface_default; /* passive-interface default */ + uint8_t passive_interface_default; /* passive-interface default */ unsigned int fd; unsigned int maxsndbuflen; - u_int32_t sequence_number; /*Global EIGRP sequence number*/ + uint32_t sequence_number; /*Global EIGRP sequence number*/ struct stream *ibuf; struct list *oi_write_q; @@ -128,7 +128,7 @@ struct eigrp { char *name; struct route_map *map; int metric_config; - u_int32_t metric; + uint32_t metric; } route_map[ZEBRA_ROUTE_MAX]; QOBJ_FIELDS @@ -136,14 +136,14 @@ struct eigrp { DECLARE_QOBJ_TYPE(eigrp) struct eigrp_if_params { - u_char passive_interface; - u_int32_t v_hello; - u_int16_t v_wait; - u_char type; /* type of interface */ - u_int32_t bandwidth; - u_int32_t delay; - u_char reliability; - u_char load; + uint8_t passive_interface; + uint32_t v_hello; + uint16_t v_wait; + uint8_t type; /* type of interface */ + uint32_t bandwidth; + uint32_t delay; + uint8_t reliability; + uint8_t load; char *auth_keychain; /* Associated keychain with interface*/ int auth_type; /* EIGRP authentication type */ @@ -172,10 +172,10 @@ struct eigrp_interface { /* To which multicast groups do we currently belong? */ - u_char multicast_memberships; + uint8_t multicast_memberships; /* EIGRP Network Type. */ - u_char type; + uint8_t type; struct prefix *address; /* Interface prefix */ struct connected *connected; /* Pointer to connected */ @@ -190,22 +190,22 @@ struct eigrp_interface { int on_write_q; /* Statistics fields. */ - u_int32_t hello_in; /* Hello message input count. */ - u_int32_t update_in; /* Update message input count. */ - u_int32_t query_in; /* Querry message input count. */ - u_int32_t reply_in; /* Reply message input count. */ - u_int32_t hello_out; /* Hello message output count. */ - u_int32_t update_out; /* Update message output count. */ - u_int32_t query_out; /* Query message output count. */ - u_int32_t reply_out; /* Reply message output count. */ - u_int32_t siaQuery_in; - u_int32_t siaQuery_out; - u_int32_t siaReply_in; - u_int32_t siaReply_out; - u_int32_t ack_out; - u_int32_t ack_in; - - u_int32_t crypt_seqnum; /* Cryptographic Sequence Number */ + uint32_t hello_in; /* Hello message input count. */ + uint32_t update_in; /* Update message input count. */ + uint32_t query_in; /* Querry message input count. */ + uint32_t reply_in; /* Reply message input count. */ + uint32_t hello_out; /* Hello message output count. */ + uint32_t update_out; /* Update message output count. */ + uint32_t query_out; /* Query message output count. */ + uint32_t reply_out; /* Reply message output count. */ + uint32_t siaQuery_in; + uint32_t siaQuery_out; + uint32_t siaReply_in; + uint32_t siaReply_out; + uint32_t ack_out; + uint32_t ack_in; + + uint32_t crypt_seqnum; /* Cryptographic Sequence Number */ /* Access-list. */ struct access_list *list[EIGRP_FILTER_MAX]; @@ -231,30 +231,32 @@ struct eigrp_neighbor { struct eigrp_interface *ei; /* EIGRP neighbor Information */ - u_char state; /* neigbor status. */ + uint8_t state; /* neigbor status. */ - u_int32_t recv_sequence_number; /* Last received sequence Number. */ - u_int32_t init_sequence_number; + uint32_t recv_sequence_number; /* Last received sequence Number. */ + uint32_t init_sequence_number; /*If packet is unacknowledged, we try to send it again 16 times*/ - u_char retrans_counter; + uint8_t retrans_counter; struct in_addr src; /* Neighbor Src address. */ - u_char os_rel_major; // system version - just for show - u_char os_rel_minor; // system version - just for show - u_char tlv_rel_major; // eigrp version - tells us what TLV format to use - u_char tlv_rel_minor; // eigrp version - tells us what TLV format to use + uint8_t os_rel_major; // system version - just for show + uint8_t os_rel_minor; // system version - just for show + uint8_t tlv_rel_major; // eigrp version - tells us what TLV format to + // use + uint8_t tlv_rel_minor; // eigrp version - tells us what TLV format to + // use - u_char K1; - u_char K2; - u_char K3; - u_char K4; - u_char K5; - u_char K6; + uint8_t K1; + uint8_t K2; + uint8_t K3; + uint8_t K4; + uint8_t K5; + uint8_t K6; /* Timer values. */ - u_int16_t v_holddown; + uint16_t v_holddown; /* Threads. */ struct thread *t_holddown; @@ -264,7 +266,7 @@ struct eigrp_neighbor { struct eigrp_fifo *retrans_queue; struct eigrp_fifo *multicast_queue; - u_int32_t crypt_seqnum; /* Cryptographic Sequence Number. */ + uint32_t crypt_seqnum; /* Cryptographic Sequence Number. */ /* prefixes not received from neighbor during Graceful restart */ struct list *nbr_gr_prefixes; @@ -291,12 +293,12 @@ struct eigrp_packet { struct thread *t_retrans_timer; /*Packet retransmission counter*/ - u_char retrans_counter; + uint8_t retrans_counter; - u_int32_t sequence_number; + uint32_t sequence_number; /* EIGRP packet length. */ - u_int16_t length; + uint16_t length; struct eigrp_neighbor *nbr; }; @@ -309,14 +311,14 @@ struct eigrp_fifo { }; struct eigrp_header { - u_char version; - u_char opcode; - u_int16_t checksum; - u_int32_t flags; - u_int32_t sequence; - u_int32_t ack; - u_int16_t vrid; - u_int16_t ASNumber; + uint8_t version; + uint8_t opcode; + uint16_t checksum; + uint32_t flags; + uint32_t sequence; + uint32_t ack; + uint16_t vrid; + uint16_t ASNumber; char *tlv[0]; } __attribute__((packed)); @@ -332,109 +334,109 @@ struct eigrp_header { * +-----+------------------+ */ struct eigrp_tlv_hdr_type { - u_int16_t type; - u_int16_t length; + uint16_t type; + uint16_t length; uint8_t value[0]; } __attribute__((packed)); struct TLV_Parameter_Type { - u_int16_t type; - u_int16_t length; - u_char K1; - u_char K2; - u_char K3; - u_char K4; - u_char K5; - u_char K6; - u_int16_t hold_time; + uint16_t type; + uint16_t length; + uint8_t K1; + uint8_t K2; + uint8_t K3; + uint8_t K4; + uint8_t K5; + uint8_t K6; + uint16_t hold_time; } __attribute__((packed)); struct TLV_MD5_Authentication_Type { - u_int16_t type; - u_int16_t length; - u_int16_t auth_type; - u_int16_t auth_length; - u_int32_t key_id; - u_int32_t key_sequence; - u_char Nullpad[8]; - u_char digest[EIGRP_AUTH_TYPE_MD5_LEN]; + uint16_t type; + uint16_t length; + uint16_t auth_type; + uint16_t auth_length; + uint32_t key_id; + uint32_t key_sequence; + uint8_t Nullpad[8]; + uint8_t digest[EIGRP_AUTH_TYPE_MD5_LEN]; } __attribute__((packed)); struct TLV_SHA256_Authentication_Type { - u_int16_t type; - u_int16_t length; - u_int16_t auth_type; - u_int16_t auth_length; - u_int32_t key_id; - u_int32_t key_sequence; - u_char Nullpad[8]; - u_char digest[EIGRP_AUTH_TYPE_SHA256_LEN]; + uint16_t type; + uint16_t length; + uint16_t auth_type; + uint16_t auth_length; + uint32_t key_id; + uint32_t key_sequence; + uint8_t Nullpad[8]; + uint8_t digest[EIGRP_AUTH_TYPE_SHA256_LEN]; } __attribute__((packed)); struct TLV_Sequence_Type { - u_int16_t type; - u_int16_t length; - u_char addr_length; + uint16_t type; + uint16_t length; + uint8_t addr_length; struct in_addr *addresses; } __attribute__((packed)); struct TLV_Next_Multicast_Sequence { - u_int16_t type; - u_int16_t length; - u_int32_t multicast_sequence; + uint16_t type; + uint16_t length; + uint32_t multicast_sequence; } __attribute__((packed)); struct TLV_Software_Type { - u_int16_t type; - u_int16_t length; - u_char vender_major; - u_char vender_minor; - u_char eigrp_major; - u_char eigrp_minor; + uint16_t type; + uint16_t length; + uint8_t vender_major; + uint8_t vender_minor; + uint8_t eigrp_major; + uint8_t eigrp_minor; } __attribute__((packed)); struct TLV_IPv4_Internal_type { - u_int16_t type; - u_int16_t length; + uint16_t type; + uint16_t length; struct in_addr forward; /*Metrics*/ struct eigrp_metrics metric; - u_char prefix_length; + uint8_t prefix_length; unsigned char destination_part[4]; struct in_addr destination; } __attribute__((packed)); struct TLV_IPv4_External_type { - u_int16_t type; - u_int16_t length; + uint16_t type; + uint16_t length; struct in_addr next_hop; struct in_addr originating_router; - u_int32_t originating_as; - u_int32_t administrative_tag; - u_int32_t external_metric; - u_int16_t reserved; - u_char external_protocol; - u_char external_flags; + uint32_t originating_as; + uint32_t administrative_tag; + uint32_t external_metric; + uint16_t reserved; + uint8_t external_protocol; + uint8_t external_flags; /*Metrics*/ struct eigrp_metrics metric; - u_char prefix_length; + uint8_t prefix_length; unsigned char destination_part[4]; struct in_addr destination; } __attribute__((packed)); /* EIGRP Peer Termination TLV - used for hard restart */ struct TLV_Peer_Termination_type { - u_int16_t type; - u_int16_t length; - u_char unknown; - u_int32_t neighbor_ip; + uint16_t type; + uint16_t length; + uint8_t unknown; + uint32_t neighbor_ip; } __attribute__((packed)); /* Who executed Graceful restart */ @@ -445,15 +447,15 @@ enum GR_type { EIGRP_GR_MANUAL, EIGRP_GR_FILTER }; /* EIGRP Topology table node structure */ struct eigrp_prefix_entry { struct list *entries, *rij; - u_int32_t fdistance; // FD - u_int32_t rdistance; // RD - u_int32_t distance; // D + uint32_t fdistance; // FD + uint32_t rdistance; // RD + uint32_t distance; // D struct eigrp_metrics reported_metric; // RD for sending - u_char nt; // network type - u_char state; // route fsm state - u_char af; // address family - u_char req_action; // required action + uint8_t nt; // network type + uint8_t state; // route fsm state + uint8_t af; // address family + uint8_t req_action; // required action struct prefix *destination; @@ -468,15 +470,15 @@ struct eigrp_prefix_entry { /* EIGRP Topology table record structure */ struct eigrp_nexthop_entry { struct eigrp_prefix_entry *prefix; - u_int32_t reported_distance; // distance reported by neighbor - u_int32_t distance; // sum of reported distance and link cost to - // advertised neighbor + uint32_t reported_distance; // distance reported by neighbor + uint32_t distance; // sum of reported distance and link cost to + // advertised neighbor struct eigrp_metrics reported_metric; struct eigrp_metrics total_metric; struct eigrp_neighbor *adv_router; // ip address of advertising neighbor - u_char flags; // used for marking successor and FS + uint8_t flags; // used for marking successor and FS struct eigrp_interface *ei; // pointer for case of connected entry }; @@ -491,7 +493,7 @@ typedef enum { /* EIGRP Finite State Machine */ struct eigrp_fsm_action_message { - u_char packet_type; // UPDATE, QUERY, SIAQUERY, SIAREPLY + uint8_t packet_type; // UPDATE, QUERY, SIAQUERY, SIAREPLY struct eigrp *eigrp; // which thread sent mesg struct eigrp_neighbor *adv_router; // advertising neighbor struct eigrp_nexthop_entry *entry; diff --git a/eigrpd/eigrp_topology.c b/eigrpd/eigrp_topology.c index bab47ea13..2d1bc46e6 100644 --- a/eigrpd/eigrp_topology.c +++ b/eigrpd/eigrp_topology.c @@ -362,7 +362,7 @@ eigrp_topology_update_distance(struct eigrp_fsm_action_message *msg) struct eigrp_prefix_entry *prefix = msg->prefix; struct eigrp_nexthop_entry *entry = msg->entry; enum metric_change change = METRIC_SAME; - u_int32_t new_reported_distance; + uint32_t new_reported_distance; assert(entry); diff --git a/eigrpd/eigrp_update.c b/eigrpd/eigrp_update.c index baaf7f689..bd80ea366 100644 --- a/eigrpd/eigrp_update.c +++ b/eigrpd/eigrp_update.c @@ -176,13 +176,13 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph, struct TLV_IPv4_Internal_type *tlv; struct eigrp_prefix_entry *pe; struct eigrp_nexthop_entry *ne; - u_int32_t flags; - u_int16_t type; - u_int16_t length; - u_char same; + uint32_t flags; + uint16_t type; + uint16_t length; + uint8_t same; struct prefix dest_addr; - u_char graceful_restart; - u_char graceful_restart_final; + uint8_t graceful_restart; + uint8_t graceful_restart_final; struct list *nbr_prefixes = NULL; /* increment statistics. */ @@ -297,7 +297,7 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph, type = stream_getw(s); switch (type) { case EIGRP_TLV_IPv4_INT: - stream_set_getp(s, s->getp - sizeof(u_int16_t)); + stream_set_getp(s, s->getp - sizeof(uint16_t)); tlv = eigrp_read_ipv4_tlv(s); @@ -418,7 +418,7 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph, void eigrp_update_send_init(struct eigrp_neighbor *nbr) { struct eigrp_packet *ep; - u_int16_t length = EIGRP_HEADER_LEN; + uint16_t length = EIGRP_HEADER_LEN; ep = eigrp_packet_new(nbr->ei->ifp->mtu, nbr); @@ -463,7 +463,7 @@ void eigrp_update_send_init(struct eigrp_neighbor *nbr) static void eigrp_update_place_on_nbr_queue(struct eigrp_neighbor *nbr, struct eigrp_packet *ep, - u_int32_t seq_no, int length) + uint32_t seq_no, int length) { if ((nbr->ei->params.auth_type == EIGRP_AUTH_TYPE_MD5) && (nbr->ei->params.auth_keychain != NULL)) { @@ -525,15 +525,15 @@ static void eigrp_update_send_to_all_nbrs(struct eigrp_interface *ei, void eigrp_update_send_EOT(struct eigrp_neighbor *nbr) { struct eigrp_packet *ep; - u_int16_t length = EIGRP_HEADER_LEN; + uint16_t length = EIGRP_HEADER_LEN; struct eigrp_nexthop_entry *te; struct eigrp_prefix_entry *pe; struct listnode *node2, *nnode2; struct eigrp_interface *ei = nbr->ei; struct eigrp *eigrp = ei->eigrp; struct prefix *dest_addr; - u_int32_t seq_no = eigrp->sequence_number; - u_int16_t mtu = ei->ifp->mtu; + uint32_t seq_no = eigrp->sequence_number; + uint16_t mtu = ei->ifp->mtu; struct route_node *rn; ep = eigrp_packet_new(mtu, nbr); @@ -600,15 +600,15 @@ void eigrp_update_send(struct eigrp_interface *ei) struct eigrp_packet *ep; struct listnode *node, *nnode; struct eigrp_prefix_entry *pe; - u_char has_tlv; + uint8_t has_tlv; struct eigrp *eigrp = ei->eigrp; struct prefix *dest_addr; - u_int32_t seq_no = eigrp->sequence_number; + uint32_t seq_no = eigrp->sequence_number; if (ei->nbrs->count == 0) return; - u_int16_t length = EIGRP_HEADER_LEN; + uint16_t length = EIGRP_HEADER_LEN; ep = eigrp_packet_new(ei->ifp->mtu, NULL); @@ -634,7 +634,7 @@ void eigrp_update_send(struct eigrp_interface *ei) continue; if ((length + EIGRP_TLV_MAX_IPV4_BYTE) - > (u_int16_t)ei->ifp->mtu) { + > (uint16_t)ei->ifp->mtu) { if ((ei->params.auth_type == EIGRP_AUTH_TYPE_MD5) && (ei->params.auth_keychain != NULL)) { eigrp_make_md5_digest(ei, ep->s, @@ -743,13 +743,13 @@ void eigrp_update_send_all(struct eigrp *eigrp, static void eigrp_update_send_GR_part(struct eigrp_neighbor *nbr) { struct eigrp_packet *ep; - u_int16_t length = EIGRP_HEADER_LEN; + uint16_t length = EIGRP_HEADER_LEN; struct eigrp_prefix_entry *pe; struct prefix *dest_addr; struct eigrp_interface *ei = nbr->ei; struct eigrp *eigrp = ei->eigrp; struct list *prefixes; - u_int32_t flags; + uint32_t flags; unsigned int send_prefixes; struct route_node *rn; diff --git a/eigrpd/eigrp_vty.c b/eigrpd/eigrp_vty.c index 96c96411f..190c18777 100644 --- a/eigrpd/eigrp_vty.c +++ b/eigrpd/eigrp_vty.c @@ -608,7 +608,7 @@ DEFUN (eigrp_if_delay, VTY_DECLVAR_CONTEXT(interface, ifp); struct eigrp_interface *ei = ifp->info; struct eigrp *eigrp; - u_int32_t delay; + uint32_t delay; eigrp = eigrp_lookup(); if (eigrp == NULL) { @@ -666,7 +666,7 @@ DEFUN (eigrp_if_bandwidth, { VTY_DECLVAR_CONTEXT(interface, ifp); struct eigrp_interface *ei = ifp->info; - u_int32_t bandwidth; + uint32_t bandwidth; struct eigrp *eigrp; eigrp = eigrp_lookup(); @@ -727,7 +727,7 @@ DEFUN (eigrp_if_ip_hellointerval, { VTY_DECLVAR_CONTEXT(interface, ifp); struct eigrp_interface *ei = ifp->info; - u_int32_t hello; + uint32_t hello; struct eigrp *eigrp; eigrp = eigrp_lookup(); @@ -790,7 +790,7 @@ DEFUN (eigrp_if_ip_holdinterval, { VTY_DECLVAR_CONTEXT(interface, ifp); struct eigrp_interface *ei = ifp->info; - u_int32_t hold; + uint32_t hold; struct eigrp *eigrp; eigrp = eigrp_lookup(); @@ -821,7 +821,7 @@ DEFUN (eigrp_ip_summary_address, "Summary <network>/<length>, e.g. 192.168.0.0/16\n") { // VTY_DECLVAR_CONTEXT(interface, ifp); - // u_int32_t AS; + // uint32_t AS; struct eigrp *eigrp; eigrp = eigrp_lookup(); @@ -848,7 +848,7 @@ DEFUN (no_eigrp_ip_summary_address, "Summary <network>/<length>, e.g. 192.168.0.0/16\n") { // VTY_DECLVAR_CONTEXT(interface, ifp); - // u_int32_t AS; + // uint32_t AS; struct eigrp *eigrp; eigrp = eigrp_lookup(); @@ -1120,7 +1120,7 @@ DEFUN (eigrp_variance, "Metric variance multiplier\n") { struct eigrp *eigrp; - u_char variance; + uint8_t variance; eigrp = eigrp_lookup(); if (eigrp == NULL) { @@ -1164,7 +1164,7 @@ DEFUN (eigrp_maximum_paths, "Number of paths\n") { struct eigrp *eigrp; - u_char max; + uint8_t max; eigrp = eigrp_lookup(); if (eigrp == NULL) { diff --git a/eigrpd/eigrpd.c b/eigrpd/eigrpd.c index fd7a23323..24d1253cb 100644 --- a/eigrpd/eigrpd.c +++ b/eigrpd/eigrpd.c @@ -96,7 +96,7 @@ void eigrp_router_id_update(struct eigrp *eigrp) { struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); struct interface *ifp; - u_int32_t router_id, router_id_old; + uint32_t router_id, router_id_old; router_id_old = eigrp->router_id; diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c index a6e1a55a9..81495d0a7 100644 --- a/isisd/isis_adjacency.c +++ b/isisd/isis_adjacency.c @@ -51,7 +51,7 @@ extern struct isis *isis; -static struct isis_adjacency *adj_alloc(const u_char *id) +static struct isis_adjacency *adj_alloc(const uint8_t *id) { struct isis_adjacency *adj; @@ -61,7 +61,7 @@ static struct isis_adjacency *adj_alloc(const u_char *id) return adj; } -struct isis_adjacency *isis_new_adj(const u_char *id, const u_char *snpa, +struct isis_adjacency *isis_new_adj(const uint8_t *id, const uint8_t *snpa, int level, struct isis_circuit *circuit) { struct isis_adjacency *adj; @@ -96,7 +96,7 @@ struct isis_adjacency *isis_new_adj(const u_char *id, const u_char *snpa, return adj; } -struct isis_adjacency *isis_adj_lookup(const u_char *sysid, struct list *adjdb) +struct isis_adjacency *isis_adj_lookup(const uint8_t *sysid, struct list *adjdb) { struct isis_adjacency *adj; struct listnode *node; @@ -108,7 +108,7 @@ struct isis_adjacency *isis_adj_lookup(const u_char *sysid, struct list *adjdb) return NULL; } -struct isis_adjacency *isis_adj_lookup_snpa(const u_char *ssnpa, +struct isis_adjacency *isis_adj_lookup_snpa(const uint8_t *ssnpa, struct list *adjdb) { struct listnode *node; diff --git a/isisd/isis_adjacency.h b/isisd/isis_adjacency.h index 2c3bd19af..2f39378c0 100644 --- a/isisd/isis_adjacency.h +++ b/isisd/isis_adjacency.h @@ -69,9 +69,9 @@ struct isis_dis_record { }; struct isis_adjacency { - u_char snpa[ETH_ALEN]; /* NeighbourSNPAAddress */ - u_char sysid[ISIS_SYS_ID_LEN]; /* neighbourSystemIdentifier */ - u_char lanid[ISIS_SYS_ID_LEN + 1]; /* LAN id on bcast circuits */ + uint8_t snpa[ETH_ALEN]; /* NeighbourSNPAAddress */ + uint8_t sysid[ISIS_SYS_ID_LEN]; /* neighbourSystemIdentifier */ + uint8_t lanid[ISIS_SYS_ID_LEN + 1]; /* LAN id on bcast circuits */ int dischanges[ISIS_LEVELS]; /* how many DIS changes ? */ /* an array of N levels for M records */ struct isis_dis_record dis_record[DIS_RECORDS * ISIS_LEVELS]; @@ -86,13 +86,13 @@ struct isis_adjacency { struct in6_addr *ipv6_addresses; unsigned int ipv6_address_count; struct in6_addr router_address6; - u_char prio[ISIS_LEVELS]; /* priorityOfNeighbour for DIS */ + uint8_t prio[ISIS_LEVELS]; /* priorityOfNeighbour for DIS */ int circuit_t; /* from hello PDU hdr */ int level; /* level (1 or 2) */ enum isis_system_type sys_type; /* neighbourSystemType */ - u_int16_t hold_time; /* entryRemainingTime */ - u_int32_t last_upd; - u_int32_t last_flap; /* last time the adj flapped */ + uint16_t hold_time; /* entryRemainingTime */ + uint32_t last_upd; + uint32_t last_flap; /* last time the adj flapped */ enum isis_threeway_state threeway_state; uint32_t ext_circuit_id; int flaps; /* number of adjacency flaps */ @@ -104,10 +104,11 @@ struct isis_adjacency { struct isis_threeway_adj; -struct isis_adjacency *isis_adj_lookup(const u_char *sysid, struct list *adjdb); -struct isis_adjacency *isis_adj_lookup_snpa(const u_char *ssnpa, +struct isis_adjacency *isis_adj_lookup(const uint8_t *sysid, + struct list *adjdb); +struct isis_adjacency *isis_adj_lookup_snpa(const uint8_t *ssnpa, struct list *adjdb); -struct isis_adjacency *isis_new_adj(const u_char *id, const u_char *snpa, +struct isis_adjacency *isis_new_adj(const uint8_t *id, const uint8_t *snpa, int level, struct isis_circuit *circuit); void isis_delete_adj(void *adj); void isis_adj_process_threeway(struct isis_adjacency *adj, diff --git a/isisd/isis_bpf.c b/isisd/isis_bpf.c index 872bc5bc7..2cc2fefd9 100644 --- a/isisd/isis_bpf.c +++ b/isisd/isis_bpf.c @@ -54,20 +54,20 @@ struct bpf_insn llcfilter[] = { 3), /* check second byte */ BPF_STMT(BPF_LD + BPF_B + BPF_ABS, ETHER_HDR_LEN + 2), BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 0x03, 0, 1), /* check third byte */ - BPF_STMT(BPF_RET + BPF_K, (u_int)-1), + BPF_STMT(BPF_RET + BPF_K, (unsigned int)-1), BPF_STMT(BPF_RET + BPF_K, 0)}; -u_int readblen = 0; -u_char *readbuff = NULL; +unsigned int readblen = 0; +uint8_t *readbuff = NULL; /* * Table 9 - Architectural constants for use with ISO 8802 subnetworks * ISO 10589 - 8.4.8 */ -u_char ALL_L1_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x14}; -u_char ALL_L2_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x15}; -u_char ALL_ISS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x05}; -u_char ALL_ESS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x04}; +uint8_t ALL_L1_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x14}; +uint8_t ALL_L2_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x15}; +uint8_t ALL_ISS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x05}; +uint8_t ALL_ESS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x04}; static char sock_buff[8192]; @@ -76,9 +76,9 @@ static int open_bpf_dev(struct isis_circuit *circuit) int i = 0, fd; char bpfdev[128]; struct ifreq ifr; - u_int blen, immediate; + unsigned int blen, immediate; #ifdef BIOCSSEESENT - u_int seesent; + unsigned int seesent; #endif struct timeval timeout; struct bpf_program bpf_prog; @@ -214,10 +214,10 @@ end: return retval; } -int isis_recv_pdu_bcast(struct isis_circuit *circuit, u_char *ssnpa) +int isis_recv_pdu_bcast(struct isis_circuit *circuit, uint8_t *ssnpa) { int bytesread = 0, bytestoread, offset, one = 1, err = ISIS_OK; - u_char *buff_ptr; + uint8_t *buff_ptr; struct bpf_hdr *bpf_hdr; assert(circuit->fd > 0); diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index 2c443c71f..6f4d72cb1 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -209,7 +209,7 @@ void isis_circuit_add_addr(struct isis_circuit *circuit, struct prefix_ipv6 *ipv6; if (connected->address->family == AF_INET) { - u_int32_t addr = connected->address->u.prefix4.s_addr; + uint32_t addr = connected->address->u.prefix4.s_addr; addr = ntohl(addr); if (IPV4_NET0(addr) || IPV4_NET127(addr) || IN_CLASSD(addr) || IPV4_LINKLOCAL(addr)) @@ -1235,7 +1235,7 @@ ferr_r isis_circuit_passwd_unset(struct isis_circuit *circuit) } static int isis_circuit_passwd_set(struct isis_circuit *circuit, - u_char passwd_type, const char *passwd) + uint8_t passwd_type, const char *passwd) { int len; diff --git a/isisd/isis_circuit.h b/isisd/isis_circuit.h index 246279c6f..8dbd7ac49 100644 --- a/isisd/isis_circuit.h +++ b/isisd/isis_circuit.h @@ -37,26 +37,26 @@ struct isis_lsp; struct password { struct password *next; int len; - u_char *pass; + uint8_t *pass; }; struct metric { - u_char metric_default; - u_char metric_error; - u_char metric_expense; - u_char metric_delay; + uint8_t metric_default; + uint8_t metric_error; + uint8_t metric_expense; + uint8_t metric_delay; }; struct isis_bcast_info { - u_char snpa[ETH_ALEN]; /* SNPA of this circuit */ + uint8_t snpa[ETH_ALEN]; /* SNPA of this circuit */ char run_dr_elect[2]; /* Should we run dr election ? */ struct thread *t_run_dr[2]; /* DR election thread */ struct thread *t_send_lan_hello[2]; /* send LAN IIHs in this thread */ struct list *adjdb[2]; /* adjacency dbs */ struct list *lan_neighs[2]; /* list of lx neigh snpa */ char is_dr[2]; /* Are we level x DR ? */ - u_char l1_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-1 DR */ - u_char l2_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-2 DR */ + uint8_t l1_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-1 DR */ + uint8_t l2_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-2 DR */ struct thread *t_refresh_pseudo_lsp[2]; /* refresh pseudo-node LSPs */ }; @@ -67,7 +67,7 @@ struct isis_p2p_info { struct isis_circuit { int state; - u_char circuit_id; /* l1/l2 bcast CircuitID */ + uint8_t circuit_id; /* l1/l2 bcast CircuitID */ struct isis_area *area; /* back pointer to the area */ struct interface *interface; /* interface info from z */ int fd; /* IS-IS l1/2 socket */ @@ -89,7 +89,7 @@ struct isis_circuit { * circuit */ /* there is no real point in two streams, just for programming kicker */ - int (*rx)(struct isis_circuit *circuit, u_char *ssnpa); + int (*rx)(struct isis_circuit *circuit, uint8_t *ssnpa); struct stream *rcv_stream; /* Stream for receiving */ int (*tx)(struct isis_circuit *circuit, int level); struct stream *snd_stream; /* Stream for sending */ @@ -104,7 +104,7 @@ struct isis_circuit { struct isis_bcast_info bc; struct isis_p2p_info p2p; } u; - u_char priority[2]; /* l1/2 IS configured priority */ + uint8_t priority[2]; /* l1/2 IS configured priority */ int pad_hellos; /* add padding to Hello PDUs ? */ char ext_domain; /* externalDomain (boolean) */ int lsp_regenerate_pending[ISIS_LEVELS]; @@ -114,12 +114,12 @@ struct isis_circuit { struct isis_passwd passwd; /* Circuit rx/tx password */ int is_type; /* circuit is type == level of circuit * differentiated from circuit type (media) */ - u_int32_t hello_interval[2]; /* l1HelloInterval in msecs */ - u_int16_t hello_multiplier[2]; /* l1HelloMultiplier */ - u_int16_t csnp_interval[2]; /* level-1 csnp-interval in seconds */ - u_int16_t psnp_interval[2]; /* level-1 psnp-interval in seconds */ - u_int8_t metric[2]; - u_int32_t te_metric[2]; + uint32_t hello_interval[2]; /* l1HelloInterval in msecs */ + uint16_t hello_multiplier[2]; /* l1HelloMultiplier */ + uint16_t csnp_interval[2]; /* level-1 csnp-interval in seconds */ + uint16_t psnp_interval[2]; /* level-1 psnp-interval in seconds */ + uint8_t metric[2]; + uint32_t te_metric[2]; struct mpls_te_circuit *mtc; /* Support for MPLS-TE parameters - see isis_te.[c,h] */ int ip_router; /* Route IP ? */ @@ -129,20 +129,20 @@ struct isis_circuit { int ipv6_router; /* Route IPv6 ? */ struct list *ipv6_link; /* our link local IPv6 addresses */ struct list *ipv6_non_link; /* our non-link local IPv6 addresses */ - u_int16_t upadjcount[2]; + uint16_t upadjcount[2]; #define ISIS_CIRCUIT_FLAPPED_AFTER_SPF 0x01 - u_char flags; + uint8_t flags; bool disable_threeway_adj; /* * Counters as in 10589--11.2.5.9 */ - u_int32_t adj_state_changes; /* changesInAdjacencyState */ - u_int32_t init_failures; /* intialisationFailures */ - u_int32_t ctrl_pdus_rxed; /* controlPDUsReceived */ - u_int32_t ctrl_pdus_txed; /* controlPDUsSent */ - u_int32_t + uint32_t adj_state_changes; /* changesInAdjacencyState */ + uint32_t init_failures; /* intialisationFailures */ + uint32_t ctrl_pdus_rxed; /* controlPDUsReceived */ + uint32_t ctrl_pdus_txed; /* controlPDUsSent */ + uint32_t desig_changes[2]; /* lanLxDesignatedIntermediateSystemChanges */ - u_int32_t rej_adjacencies; /* rejectedAdjacencies */ + uint32_t rej_adjacencies; /* rejectedAdjacencies */ QOBJ_FIELDS }; diff --git a/isisd/isis_common.h b/isisd/isis_common.h index b157bb183..809a3980d 100644 --- a/isisd/isis_common.h +++ b/isisd/isis_common.h @@ -28,30 +28,30 @@ * Area Address */ struct area_addr { - u_char addr_len; - u_char area_addr[20]; + uint8_t addr_len; + uint8_t area_addr[20]; }; struct isis_passwd { - u_char len; + uint8_t len; #define ISIS_PASSWD_TYPE_UNUSED 0 #define ISIS_PASSWD_TYPE_CLEARTXT 1 #define ISIS_PASSWD_TYPE_HMAC_MD5 54 #define ISIS_PASSWD_TYPE_PRIVATE 255 - u_char type; + uint8_t type; /* Authenticate SNPs? */ #define SNP_AUTH_SEND 0x01 #define SNP_AUTH_RECV 0x02 - u_char snp_auth; - u_char passwd[255]; + uint8_t snp_auth; + uint8_t passwd[255]; }; /* * Supported Protocol IDs */ struct nlpids { - u_char count; - u_char nlpids[4]; /* FIXME: enough ? */ + uint8_t count; + uint8_t nlpids[4]; /* FIXME: enough ? */ }; #endif diff --git a/isisd/isis_dlpi.c b/isisd/isis_dlpi.c index ccde4fbbe..718f3a898 100644 --- a/isisd/isis_dlpi.c +++ b/isisd/isis_dlpi.c @@ -54,14 +54,14 @@ static t_uscalar_t dlpi_ctl[1024]; /* DLPI control messages */ * ISO 10589 - 8.4.8 */ -u_char ALL_L1_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x14}; -u_char ALL_L2_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x15}; -u_char ALL_ISS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x05}; -u_char ALL_ESS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x04}; +uint8_t ALL_L1_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x14}; +uint8_t ALL_L2_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x15}; +uint8_t ALL_ISS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x05}; +uint8_t ALL_ESS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x04}; -static u_char sock_buff[8192]; +static uint8_t sock_buff[8192]; -static u_short pf_filter[] = { +static unsigned short pf_filter[] = { ENF_PUSHWORD + 0, /* Get the SSAP/DSAP values */ ENF_PUSHLIT | ENF_CAND, /* Check them */ ISO_SAP | (ISO_SAP << 8), @@ -248,23 +248,23 @@ static int dlpibind(int fd) return 0; } -static int dlpimcast(int fd, const u_char *mcaddr) +static int dlpimcast(int fd, const uint8_t *mcaddr) { struct { dl_enabmulti_req_t der; - u_char addr[ETHERADDRL]; + uint8_t addr[ETHERADDRL]; } dler; memset(&dler, 0, sizeof(dler)); dler.der.dl_primitive = DL_ENABMULTI_REQ; dler.der.dl_addr_length = sizeof(dler.addr); - dler.der.dl_addr_offset = dler.addr - (u_char *)&dler; + dler.der.dl_addr_offset = dler.addr - (uint8_t *)&dler; memcpy(dler.addr, mcaddr, sizeof(dler.addr)); dlpisend(fd, &dler, sizeof(dler), NULL, 0, 0); return dlpiok(fd, dler.der.dl_primitive); } -static int dlpiaddr(int fd, u_char *addr) +static int dlpiaddr(int fd, uint8_t *addr) { dl_phys_addr_req_t dpar; dl_phys_addr_ack_t *dpaa = (dl_phys_addr_ack_t *)dlpi_ctl; @@ -443,7 +443,7 @@ static int open_dlpi_dev(struct isis_circuit *circuit) struct strioctl sioc; pfil.Pf_Priority = 0; - pfil.Pf_FilterLen = sizeof(pf_filter) / sizeof(u_short); + pfil.Pf_FilterLen = sizeof(pf_filter) / sizeof(unsigned short); memcpy(pfil.Pf_Filter, pf_filter, sizeof(pf_filter)); /* pfmod does not support transparent ioctls */ sioc.ic_cmd = PFIOCSETF; @@ -495,7 +495,7 @@ end: return retval; } -int isis_recv_pdu_bcast(struct isis_circuit *circuit, u_char *ssnpa) +int isis_recv_pdu_bcast(struct isis_circuit *circuit, uint8_t *ssnpa) { struct pollfd fds[1]; struct strbuf ctlbuf, databuf; @@ -561,7 +561,7 @@ int isis_send_pdu_bcast(struct isis_circuit *circuit, int level) { dl_unitdata_req_t *dur = (dl_unitdata_req_t *)dlpi_ctl; char *dstaddr; - u_short *dstsap; + unsigned short *dstsap; int buflen; int rv; @@ -583,9 +583,9 @@ int isis_send_pdu_bcast(struct isis_circuit *circuit, int level) dstaddr = (char *)(dur + 1); if (circuit->sap_length < 0) { - dstsap = (u_short *)(dstaddr + ETHERADDRL); + dstsap = (unsigned short *)(dstaddr + ETHERADDRL); } else { - dstsap = (u_short *)dstaddr; + dstsap = (unsigned short *)dstaddr; dstaddr += circuit->sap_length; } if (level == 1) diff --git a/isisd/isis_dr.c b/isisd/isis_dr.c index 84b0bb973..99506a243 100644 --- a/isisd/isis_dr.c +++ b/isisd/isis_dr.c @@ -126,7 +126,7 @@ int isis_dr_elect(struct isis_circuit *circuit, int level) struct listnode *node; struct isis_adjacency *adj, *adj_dr = NULL; struct list *list = list_new(); - u_char own_prio; + uint8_t own_prio; int biggest_prio = -1; int cmp_res, retval = ISIS_OK; @@ -223,7 +223,7 @@ int isis_dr_elect(struct isis_circuit *circuit, int level) int isis_dr_resign(struct isis_circuit *circuit, int level) { - u_char id[ISIS_SYS_ID_LEN + 2]; + uint8_t id[ISIS_SYS_ID_LEN + 2]; zlog_debug("isis_dr_resign l%d", level); @@ -274,7 +274,7 @@ int isis_dr_resign(struct isis_circuit *circuit, int level) int isis_dr_commence(struct isis_circuit *circuit, int level) { - u_char old_dr[ISIS_SYS_ID_LEN + 2]; + uint8_t old_dr[ISIS_SYS_ID_LEN + 2]; if (isis->debugs & DEBUG_EVENTS) zlog_debug("isis_dr_commence l%d", level); diff --git a/isisd/isis_dynhn.c b/isisd/isis_dynhn.c index 17b043444..1d29d1086 100644 --- a/isisd/isis_dynhn.c +++ b/isisd/isis_dynhn.c @@ -76,7 +76,7 @@ static int dyn_cache_cleanup(struct thread *thread) return ISIS_OK; } -struct isis_dynhn *dynhn_find_by_id(const u_char *id) +struct isis_dynhn *dynhn_find_by_id(const uint8_t *id) { struct listnode *node = NULL; struct isis_dynhn *dyn = NULL; @@ -100,7 +100,7 @@ struct isis_dynhn *dynhn_find_by_name(const char *hostname) return NULL; } -void isis_dynhn_insert(const u_char *id, const char *hostname, int level) +void isis_dynhn_insert(const uint8_t *id, const char *hostname, int level) { struct isis_dynhn *dyn; @@ -116,7 +116,7 @@ void isis_dynhn_insert(const u_char *id, const char *hostname, int level) dyn->refresh = time(NULL); } -void isis_dynhn_remove(const u_char *id) +void isis_dynhn_remove(const uint8_t *id) { struct isis_dynhn *dyn; diff --git a/isisd/isis_dynhn.h b/isisd/isis_dynhn.h index 635d79f3f..27133bd3f 100644 --- a/isisd/isis_dynhn.h +++ b/isisd/isis_dynhn.h @@ -24,16 +24,16 @@ #define _ZEBRA_ISIS_DYNHN_H struct isis_dynhn { - u_char id[ISIS_SYS_ID_LEN]; + uint8_t id[ISIS_SYS_ID_LEN]; char hostname[256]; time_t refresh; int level; }; void dyn_cache_init(void); -void isis_dynhn_insert(const u_char *id, const char *hostname, int level); -void isis_dynhn_remove(const u_char *id); -struct isis_dynhn *dynhn_find_by_id(const u_char *id); +void isis_dynhn_insert(const uint8_t *id, const char *hostname, int level); +void isis_dynhn_remove(const uint8_t *id); +struct isis_dynhn *dynhn_find_by_id(const uint8_t *id); struct isis_dynhn *dynhn_find_by_name(const char *hostname); void dynhn_print_all(struct vty *vty); diff --git a/isisd/isis_events.c b/isisd/isis_events.c index bc3543992..349ec262c 100644 --- a/isisd/isis_events.c +++ b/isisd/isis_events.c @@ -256,7 +256,7 @@ int isis_event_dis_status_change(struct thread *thread) } void isis_event_auth_failure(char *area_tag, const char *error_string, - u_char *sysid) + uint8_t *sysid) { if (isis->debugs & DEBUG_EVENTS) zlog_debug("ISIS-Evt (%s) Authentication failure %s from %s", diff --git a/isisd/isis_events.h b/isisd/isis_events.h index 0ed2059c6..c3d8cf046 100644 --- a/isisd/isis_events.h +++ b/isisd/isis_events.h @@ -43,6 +43,6 @@ int isis_event_dis_status_change(struct thread *thread); #define AUTH_ERROR_TYPE_SNP 2 #define AUTH_ERROR_TYPE_HELLO 1 void isis_event_auth_failure(char *area_tag, const char *error_string, - u_char *sysid); + uint8_t *sysid); #endif /* _ZEBRA_ISIS_EVENTS_H */ diff --git a/isisd/isis_flags.c b/isisd/isis_flags.c index e28d90d3d..b1ece94e8 100644 --- a/isisd/isis_flags.c +++ b/isisd/isis_flags.c @@ -68,9 +68,9 @@ void flags_free_index(struct flags *flags, long int index) return; } -int flags_any_set(u_int32_t *flags) +int flags_any_set(uint32_t *flags) { - u_int32_t zero[ISIS_MAX_CIRCUITS]; + uint32_t zero[ISIS_MAX_CIRCUITS]; memset(zero, 0x00, ISIS_MAX_CIRCUITS * 4); return bcmp(flags, zero, ISIS_MAX_CIRCUITS * 4); diff --git a/isisd/isis_flags.h b/isisd/isis_flags.h index 7d9572a2c..b3449e1e5 100644 --- a/isisd/isis_flags.h +++ b/isisd/isis_flags.h @@ -39,7 +39,7 @@ struct flags { void flags_initialize(struct flags *flags); long int flags_get_index(struct flags *flags); void flags_free_index(struct flags *flags, long int index); -int flags_any_set(u_int32_t *flags); +int flags_any_set(uint32_t *flags); #define _ISIS_SET_FLAG(F, C) \ { \ diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index b2ba8b393..95fa38223 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -63,7 +63,7 @@ static int lsp_l2_refresh(struct thread *thread); static int lsp_l1_refresh_pseudo(struct thread *thread); static int lsp_l2_refresh_pseudo(struct thread *thread); -int lsp_id_cmp(u_char *id1, u_char *id2) +int lsp_id_cmp(uint8_t *id1, uint8_t *id2) { return memcmp(id1, id2, ISIS_SYS_ID_LEN + 2); } @@ -77,7 +77,7 @@ dict_t *lsp_db_init(void) return dict; } -struct isis_lsp *lsp_search(u_char *id, dict_t *lspdb) +struct isis_lsp *lsp_search(uint8_t *id, dict_t *lspdb) { dnode_t *node; @@ -87,7 +87,7 @@ struct isis_lsp *lsp_search(u_char *id, dict_t *lspdb) zlog_debug("searching db"); for (dn = dict_first(lspdb); dn; dn = dict_next(lspdb, dn)) { zlog_debug("%s\t%pX", - rawlspid_print((u_char *)dnode_getkey(dn)), + rawlspid_print((uint8_t *)dnode_getkey(dn)), dnode_get(dn)); } #endif /* EXTREME DEBUG */ @@ -176,7 +176,7 @@ static void lsp_remove_frags(struct list *frags, dict_t *lspdb) return; } -void lsp_search_and_destroy(u_char *id, dict_t *lspdb) +void lsp_search_and_destroy(uint8_t *id, dict_t *lspdb) { dnode_t *node; struct isis_lsp *lsp; @@ -392,9 +392,9 @@ static void lsp_seqno_update(struct isis_lsp *lsp0) return; } -static u_int8_t lsp_bits_generate(int level, int overload_bit, int attached_bit) +static uint8_t lsp_bits_generate(int level, int overload_bit, int attached_bit) { - u_int8_t lsp_bits = 0; + uint8_t lsp_bits = 0; if (level == IS_LEVEL_1) lsp_bits = IS_LEVEL_1; else @@ -498,7 +498,7 @@ struct isis_lsp *lsp_new_from_recv(struct isis_lsp_hdr *hdr, return lsp; } -struct isis_lsp *lsp_new(struct isis_area *area, u_char *lsp_id, +struct isis_lsp *lsp_new(struct isis_area *area, uint8_t *lsp_id, uint16_t rem_lifetime, uint32_t seqno, uint8_t lsp_bits, uint16_t checksum, struct isis_lsp *lsp0, int level) @@ -541,7 +541,7 @@ void lsp_insert(struct isis_lsp *lsp, dict_t *lspdb) /* * Build a list of LSPs with non-zero ht bounded by start and stop ids */ -void lsp_build_list_nonzero_ht(u_char *start_id, u_char *stop_id, +void lsp_build_list_nonzero_ht(uint8_t *start_id, uint8_t *stop_id, struct list *list, dict_t *lspdb) { dnode_t *first, *last, *curr; @@ -584,10 +584,10 @@ static void lsp_set_time(struct isis_lsp *lsp) stream_putw_at(lsp->pdu, 10, lsp->hdr.rem_lifetime); } -static void lspid_print(u_char *lsp_id, u_char *trg, char dynhost, char frag) +static void lspid_print(uint8_t *lsp_id, uint8_t *trg, char dynhost, char frag) { struct isis_dynhn *dyn = NULL; - u_char id[SYSID_STRLEN]; + uint8_t id[SYSID_STRLEN]; if (dynhost) dyn = dynhn_find_by_id(lsp_id); @@ -632,7 +632,7 @@ static const char *lsp_bits2string(uint8_t lsp_bits) /* this function prints the lsp on show isis database */ void lsp_print(struct isis_lsp *lsp, struct vty *vty, char dynhost) { - u_char LSPid[255]; + uint8_t LSPid[255]; char age_out[8]; lspid_print(lsp->hdr.lsp_id, LSPid, dynhost, 1); @@ -685,9 +685,9 @@ int lsp_print_all(struct vty *vty, dict_t *lspdb, char detail, char dynhost) return lsp_count; } -static u_int16_t lsp_rem_lifetime(struct isis_area *area, int level) +static uint16_t lsp_rem_lifetime(struct isis_area *area, int level) { - u_int16_t rem_lifetime; + uint16_t rem_lifetime; /* Add jitter to configured LSP lifetime */ rem_lifetime = @@ -704,11 +704,11 @@ static u_int16_t lsp_rem_lifetime(struct isis_area *area, int level) return rem_lifetime; } -static u_int16_t lsp_refresh_time(struct isis_lsp *lsp, u_int16_t rem_lifetime) +static uint16_t lsp_refresh_time(struct isis_lsp *lsp, uint16_t rem_lifetime) { struct isis_area *area = lsp->area; int level = lsp->level; - u_int16_t refresh_time; + uint16_t refresh_time; /* Add jitter to LSP refresh time */ refresh_time = @@ -1147,9 +1147,9 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area) int lsp_generate(struct isis_area *area, int level) { struct isis_lsp *oldlsp, *newlsp; - u_int32_t seq_num = 0; - u_char lspid[ISIS_SYS_ID_LEN + 2]; - u_int16_t rem_lifetime, refresh_time; + uint32_t seq_num = 0; + uint8_t lspid[ISIS_SYS_ID_LEN + 2]; + uint16_t rem_lifetime, refresh_time; if ((area == NULL) || (area->is_type & level) != level) return ISIS_ERROR; @@ -1217,8 +1217,8 @@ static int lsp_regenerate(struct isis_area *area, int level) dict_t *lspdb; struct isis_lsp *lsp, *frag; struct listnode *node; - u_char lspid[ISIS_SYS_ID_LEN + 2]; - u_int16_t rem_lifetime, refresh_time; + uint8_t lspid[ISIS_SYS_ID_LEN + 2]; + uint16_t rem_lifetime, refresh_time; if ((area == NULL) || (area->is_type & level) != level) return ISIS_ERROR; @@ -1324,7 +1324,7 @@ static int lsp_l2_refresh(struct thread *thread) int lsp_regenerate_schedule(struct isis_area *area, int level, int all_pseudo) { struct isis_lsp *lsp; - u_char id[ISIS_SYS_ID_LEN + 2]; + uint8_t id[ISIS_SYS_ID_LEN + 2]; time_t now, diff; long timeout; struct listnode *cnode; @@ -1521,8 +1521,8 @@ int lsp_generate_pseudo(struct isis_circuit *circuit, int level) { dict_t *lspdb = circuit->area->lspdb[level - 1]; struct isis_lsp *lsp; - u_char lsp_id[ISIS_SYS_ID_LEN + 2]; - u_int16_t rem_lifetime, refresh_time; + uint8_t lsp_id[ISIS_SYS_ID_LEN + 2]; + uint16_t rem_lifetime, refresh_time; if ((circuit->is_type & level) != level || (circuit->state != C_STATE_UP) @@ -1583,8 +1583,8 @@ static int lsp_regenerate_pseudo(struct isis_circuit *circuit, int level) { dict_t *lspdb = circuit->area->lspdb[level - 1]; struct isis_lsp *lsp; - u_char lsp_id[ISIS_SYS_ID_LEN + 2]; - u_int16_t rem_lifetime, refresh_time; + uint8_t lsp_id[ISIS_SYS_ID_LEN + 2]; + uint16_t rem_lifetime, refresh_time; if ((circuit->is_type & level) != level || (circuit->state != C_STATE_UP) @@ -1641,7 +1641,7 @@ static int lsp_regenerate_pseudo(struct isis_circuit *circuit, int level) static int lsp_l1_refresh_pseudo(struct thread *thread) { struct isis_circuit *circuit; - u_char id[ISIS_SYS_ID_LEN + 2]; + uint8_t id[ISIS_SYS_ID_LEN + 2]; circuit = THREAD_ARG(thread); @@ -1663,7 +1663,7 @@ static int lsp_l1_refresh_pseudo(struct thread *thread) static int lsp_l2_refresh_pseudo(struct thread *thread) { struct isis_circuit *circuit; - u_char id[ISIS_SYS_ID_LEN + 2]; + uint8_t id[ISIS_SYS_ID_LEN + 2]; circuit = THREAD_ARG(thread); @@ -1685,7 +1685,7 @@ static int lsp_l2_refresh_pseudo(struct thread *thread) int lsp_regenerate_schedule_pseudo(struct isis_circuit *circuit, int level) { struct isis_lsp *lsp; - u_char lsp_id[ISIS_SYS_ID_LEN + 2]; + uint8_t lsp_id[ISIS_SYS_ID_LEN + 2]; time_t now, diff; long timeout; int lvl; @@ -1796,7 +1796,7 @@ int lsp_tick(struct thread *thread) struct listnode *lspnode, *cnode; dnode_t *dnode, *dnode_next; int level; - u_int16_t rem_lifetime; + uint16_t rem_lifetime; time_t now = monotime(NULL); lsp_list = list_new(); @@ -1905,7 +1905,7 @@ int lsp_tick(struct thread *thread) return ISIS_OK; } -void lsp_purge_pseudo(u_char *id, struct isis_circuit *circuit, int level) +void lsp_purge_pseudo(uint8_t *id, struct isis_circuit *circuit, int level) { struct isis_lsp *lsp; diff --git a/isisd/isis_lsp.h b/isisd/isis_lsp.h index 550e7a064..d531cb157 100644 --- a/isisd/isis_lsp.h +++ b/isisd/isis_lsp.h @@ -37,8 +37,8 @@ struct isis_lsp { struct list *frags; struct isis_lsp *zero_lsp; } lspu; - u_int32_t SRMflags[ISIS_MAX_CIRCUITS]; - u_int32_t SSNflags[ISIS_MAX_CIRCUITS]; + uint32_t SRMflags[ISIS_MAX_CIRCUITS]; + uint32_t SSNflags[ISIS_MAX_CIRCUITS]; int level; /* L1 or L2? */ int scheduled; /* scheduled for sending */ time_t installed; @@ -68,14 +68,14 @@ struct isis_lsp *lsp_new_from_recv(struct isis_lsp_hdr *hdr, struct stream *stream, struct isis_lsp *lsp0, struct isis_area *area, int level); void lsp_insert(struct isis_lsp *lsp, dict_t *lspdb); -struct isis_lsp *lsp_search(u_char *id, dict_t *lspdb); +struct isis_lsp *lsp_search(uint8_t *id, dict_t *lspdb); -void lsp_build_list(u_char *start_id, u_char *stop_id, u_char num_lsps, +void lsp_build_list(uint8_t *start_id, uint8_t *stop_id, uint8_t num_lsps, struct list *list, dict_t *lspdb); -void lsp_build_list_nonzero_ht(u_char *start_id, u_char *stop_id, +void lsp_build_list_nonzero_ht(uint8_t *start_id, uint8_t *stop_id, struct list *list, dict_t *lspdb); -void lsp_search_and_destroy(u_char *id, dict_t *lspdb); -void lsp_purge_pseudo(u_char *id, struct isis_circuit *circuit, int level); +void lsp_search_and_destroy(uint8_t *id, dict_t *lspdb); +void lsp_purge_pseudo(uint8_t *id, struct isis_circuit *circuit, int level); void lsp_purge_non_exist(int level, struct isis_lsp_hdr *hdr, struct isis_area *area); @@ -89,7 +89,7 @@ void lsp_purge_non_exist(int level, struct isis_lsp_hdr *hdr, memcpy((I), isis->sysid, ISIS_SYS_ID_LEN); \ (I)[ISIS_SYS_ID_LEN] = 0; \ (I)[ISIS_SYS_ID_LEN + 1] = 0 -int lsp_id_cmp(u_char *id1, u_char *id2); +int lsp_id_cmp(uint8_t *id1, uint8_t *id2); int lsp_compare(char *areatag, struct isis_lsp *lsp, uint32_t seqno, uint16_t checksum, uint16_t rem_lifetime); void lsp_update(struct isis_lsp *lsp, struct isis_lsp_hdr *hdr, diff --git a/isisd/isis_misc.c b/isisd/isis_misc.c index 0a1d9aaa1..c24917454 100644 --- a/isisd/isis_misc.c +++ b/isisd/isis_misc.c @@ -56,7 +56,7 @@ char nlpidstring[30]; /* * This converts the isonet to its printable format */ -const char *isonet_print(const u_char *from, int len) +const char *isonet_print(const uint8_t *from, int len) { int i = 0; char *pos = isonet; @@ -87,11 +87,11 @@ const char *isonet_print(const u_char *from, int len) * Returns 0 on error, length of buff on ok * extract dot from the dotted str, and insert all the number in a buff */ -int dotformat2buff(u_char *buff, const char *dotted) +int dotformat2buff(uint8_t *buff, const char *dotted) { int dotlen, len = 0; const char *pos = dotted; - u_char number[3]; + uint8_t number[3]; int nextdotpos = 2; number[2] = '\0'; @@ -136,11 +136,11 @@ int dotformat2buff(u_char *buff, const char *dotted) /* * conversion of XXXX.XXXX.XXXX to memory */ -int sysid2buff(u_char *buff, const char *dotted) +int sysid2buff(uint8_t *buff, const char *dotted) { int len = 0; const char *pos = dotted; - u_char number[3]; + uint8_t number[3]; number[2] = '\0'; // surely not a sysid_string if not 14 length @@ -304,17 +304,17 @@ const char *syst2string(int type) /* * Print functions - we print to static vars */ -const char *snpa_print(const u_char *from) +const char *snpa_print(const uint8_t *from) { return isis_format_id(from, ISIS_SYS_ID_LEN); } -const char *sysid_print(const u_char *from) +const char *sysid_print(const uint8_t *from) { return isis_format_id(from, ISIS_SYS_ID_LEN); } -const char *rawlspid_print(const u_char *from) +const char *rawlspid_print(const uint8_t *from) { return isis_format_id(from, 8); } @@ -355,10 +355,10 @@ const char *isis_format_id(const uint8_t *id, size_t len) return rv; } -const char *time2string(u_int32_t time) +const char *time2string(uint32_t time) { char *pos = datestring; - u_int32_t rest; + uint32_t rest; if (time == 0) return "-"; @@ -421,7 +421,7 @@ unsigned long isis_jitter(unsigned long timer, unsigned long jitter) return timer; } -struct in_addr newprefix2inaddr(u_char *prefix_start, u_char prefix_masklen) +struct in_addr newprefix2inaddr(uint8_t *prefix_start, uint8_t prefix_masklen) { memset(&new_prefix, 0, sizeof(new_prefix)); memcpy(&new_prefix, prefix_start, @@ -435,7 +435,7 @@ struct in_addr newprefix2inaddr(u_char *prefix_start, u_char prefix_masklen) * Returns the dynamic hostname associated with the passed system ID. * If no dynamic hostname found then returns formatted system ID. */ -const char *print_sys_hostname(const u_char *sysid) +const char *print_sys_hostname(const uint8_t *sysid) { struct isis_dynhn *dyn; diff --git a/isisd/isis_misc.h b/isisd/isis_misc.h index b81db34df..c551fde7d 100644 --- a/isisd/isis_misc.h +++ b/isisd/isis_misc.h @@ -29,27 +29,27 @@ const char *circuit_t2string(int); const char *circuit_state2string(int state); const char *circuit_type2string(int type); const char *syst2string(int); -struct in_addr newprefix2inaddr(u_char *prefix_start, u_char prefix_masklen); +struct in_addr newprefix2inaddr(uint8_t *prefix_start, uint8_t prefix_masklen); /* * Converting input to memory stored format * return value of 0 indicates wrong input */ -int dotformat2buff(u_char *, const char *); -int sysid2buff(u_char *, const char *); +int dotformat2buff(uint8_t *, const char *); +int sysid2buff(uint8_t *, const char *); /* * Printing functions */ -const char *isonet_print(const u_char *, int len); -const char *sysid_print(const u_char *); -const char *snpa_print(const u_char *); -const char *rawlspid_print(const u_char *); +const char *isonet_print(const uint8_t *, int len); +const char *sysid_print(const uint8_t *); +const char *snpa_print(const uint8_t *); +const char *rawlspid_print(const uint8_t *); const char *isis_format_id(const uint8_t *id, size_t len); -const char *time2string(u_int32_t); +const char *time2string(uint32_t); const char *nlpid2str(uint8_t nlpid); /* typedef struct nlpids nlpids; */ char *nlpid2string(struct nlpids *); -const char *print_sys_hostname(const u_char *sysid); +const char *print_sys_hostname(const uint8_t *sysid); void zlog_dump_data(void *data, int len); /* diff --git a/isisd/isis_network.h b/isisd/isis_network.h index 4b2531606..cc8605d2e 100644 --- a/isisd/isis_network.h +++ b/isisd/isis_network.h @@ -24,13 +24,13 @@ #ifndef _ZEBRA_ISIS_NETWORK_H #define _ZEBRA_ISIS_NETWORK_H -extern u_char ALL_L1_ISYSTEMS[]; -extern u_char ALL_L2_ISYSTEMS[]; +extern uint8_t ALL_L1_ISYSTEMS[]; +extern uint8_t ALL_L2_ISYSTEMS[]; int isis_sock_init(struct isis_circuit *circuit); -int isis_recv_pdu_bcast(struct isis_circuit *circuit, u_char *ssnpa); -int isis_recv_pdu_p2p(struct isis_circuit *circuit, u_char *ssnpa); +int isis_recv_pdu_bcast(struct isis_circuit *circuit, uint8_t *ssnpa); +int isis_recv_pdu_p2p(struct isis_circuit *circuit, uint8_t *ssnpa); int isis_send_pdu_bcast(struct isis_circuit *circuit, int level); int isis_send_pdu_p2p(struct isis_circuit *circuit, int level); diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index ebcf197a3..7a6c4dd2d 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -60,7 +60,7 @@ static int ack_lsp(struct isis_lsp_hdr *hdr, struct isis_circuit *circuit, { unsigned long lenp; int retval; - u_int16_t length; + uint16_t length; uint8_t pdu_type = (level == IS_LEVEL_1) ? L1_PARTIAL_SEQ_NUM : L2_PARTIAL_SEQ_NUM; @@ -80,7 +80,7 @@ static int ack_lsp(struct isis_lsp_hdr *hdr, struct isis_circuit *circuit, stream_putl(circuit->snd_stream, hdr->seqno); stream_putw(circuit->snd_stream, hdr->checksum); - length = (u_int16_t)stream_get_endp(circuit->snd_stream); + length = (uint16_t)stream_get_endp(circuit->snd_stream); /* Update PDU length */ stream_putw_at(circuit->snd_stream, lenp, length); @@ -99,7 +99,7 @@ static int ack_lsp(struct isis_lsp_hdr *hdr, struct isis_circuit *circuit, struct iih_info { struct isis_circuit *circuit; - u_char *ssnpa; + uint8_t *ssnpa; int level; uint8_t circ_type; @@ -462,9 +462,9 @@ static int process_lan_hello(struct iih_info *iih) } if (adj->dis_record[iih->level - 1].dis == ISIS_IS_DIS) { - u_char *dis = (iih->level == 1) - ? iih->circuit->u.bc.l1_desig_is - : iih->circuit->u.bc.l2_desig_is; + uint8_t *dis = (iih->level == 1) + ? iih->circuit->u.bc.l1_desig_is + : iih->circuit->u.bc.l2_desig_is; if (memcmp(dis, iih->dis, ISIS_SYS_ID_LEN + 1)) { thread_add_event(master, isis_event_dis_status_change, @@ -538,7 +538,7 @@ static int pdu_len_validate(uint16_t pdu_len, struct isis_circuit *circuit) } static int process_hello(uint8_t pdu_type, struct isis_circuit *circuit, - u_char *ssnpa) + uint8_t *ssnpa) { bool p2p_hello = (pdu_type == P2P_HELLO); int level = p2p_hello ? 0 @@ -689,7 +689,7 @@ out: * Section 7.3.15.1 - Action on receipt of a link state PDU */ static int process_lsp(uint8_t pdu_type, struct isis_circuit *circuit, - const u_char *ssnpa) + const uint8_t *ssnpa) { int level = (pdu_type == L1_LINK_STATE) ? ISIS_LEVEL1 : ISIS_LEVEL2; @@ -1052,7 +1052,7 @@ out: */ static int process_snp(uint8_t pdu_type, struct isis_circuit *circuit, - const u_char *ssnpa) + const uint8_t *ssnpa) { bool is_csnp = (pdu_type == L1_COMPLETE_SEQ_NUM || pdu_type == L2_COMPLETE_SEQ_NUM); @@ -1337,7 +1337,7 @@ static int pdu_size(uint8_t pdu_type, uint8_t *size) * PDU Dispatcher */ -int isis_handle_pdu(struct isis_circuit *circuit, u_char *ssnpa) +int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa) { int retval = ISIS_OK; @@ -1445,7 +1445,7 @@ int isis_handle_pdu(struct isis_circuit *circuit, u_char *ssnpa) int isis_receive(struct thread *thread) { struct isis_circuit *circuit; - u_char ssnpa[ETH_ALEN]; + uint8_t ssnpa[ETH_ALEN]; int retval; /* @@ -1522,9 +1522,9 @@ static void put_hello_hdr(struct isis_circuit *circuit, int level, stream_putw(circuit->snd_stream, 0); /* length is filled in later */ if (circuit->circ_type == CIRCUIT_T_BROADCAST) { - u_char *desig_is = (level == IS_LEVEL_1) - ? circuit->u.bc.l1_desig_is - : circuit->u.bc.l2_desig_is; + uint8_t *desig_is = (level == IS_LEVEL_1) + ? circuit->u.bc.l1_desig_is + : circuit->u.bc.l2_desig_is; stream_putc(circuit->snd_stream, circuit->priority[level - 1]); stream_put(circuit->snd_stream, desig_is, ISIS_SYS_ID_LEN + 1); } else { @@ -1847,7 +1847,7 @@ int send_csnp(struct isis_circuit *circuit, int level) memcpy(start, stop, ISIS_SYS_ID_LEN + 2); loop = 0; for (int i = ISIS_SYS_ID_LEN + 1; i >= 0; --i) { - if (start[i] < (u_char)0xff) { + if (start[i] < (uint8_t)0xff) { start[i] += 1; loop = 1; break; diff --git a/isisd/isis_pdu.h b/isisd/isis_pdu.h index 2d9100c10..c69bfedea 100644 --- a/isisd/isis_pdu.h +++ b/isisd/isis_pdu.h @@ -50,13 +50,13 @@ */ struct esis_fixed_hdr { - u_char idrp; - u_char length; - u_char version; - u_char id_len; - u_char pdu_type; - u_int16_t holdtime; - u_int16_t checksum; + uint8_t idrp; + uint8_t length; + uint8_t version; + uint8_t id_len; + uint8_t pdu_type; + uint16_t holdtime; + uint16_t checksum; } __attribute__((packed)); #define ESIS_FIXED_HDR_LEN 9 @@ -90,12 +90,12 @@ struct esis_fixed_hdr { * +-------+-------+-------+-------+-------+-------+-------+-------+ */ struct isis_lan_hello_hdr { - u_char circuit_t; - u_char source_id[ISIS_SYS_ID_LEN]; - u_int16_t hold_time; - u_int16_t pdu_len; - u_char prio; - u_char lan_id[ISIS_SYS_ID_LEN + 1]; + uint8_t circuit_t; + uint8_t source_id[ISIS_SYS_ID_LEN]; + uint16_t hold_time; + uint16_t pdu_len; + uint8_t prio; + uint8_t lan_id[ISIS_SYS_ID_LEN + 1]; } __attribute__((packed)); #define ISIS_LANHELLO_HDRLEN 19 @@ -115,11 +115,11 @@ struct isis_lan_hello_hdr { * +-------+-------+-------+-------+-------+-------+-------+-------+ */ struct isis_p2p_hello_hdr { - u_char circuit_t; - u_char source_id[ISIS_SYS_ID_LEN]; - u_int16_t hold_time; - u_int16_t pdu_len; - u_char local_id; + uint8_t circuit_t; + uint8_t source_id[ISIS_SYS_ID_LEN]; + uint16_t hold_time; + uint16_t pdu_len; + uint8_t local_id; } __attribute__((packed)); #define ISIS_P2PHELLO_HDRLEN 12 @@ -161,10 +161,10 @@ struct isis_lsp_hdr { * +-------+-------+-------+-------+-------+-------+-------+-------+ */ struct isis_complete_seqnum_hdr { - u_int16_t pdu_len; - u_char source_id[ISIS_SYS_ID_LEN + 1]; - u_char start_lsp_id[ISIS_SYS_ID_LEN + 2]; - u_char stop_lsp_id[ISIS_SYS_ID_LEN + 2]; + uint16_t pdu_len; + uint8_t source_id[ISIS_SYS_ID_LEN + 1]; + uint8_t start_lsp_id[ISIS_SYS_ID_LEN + 2]; + uint8_t stop_lsp_id[ISIS_SYS_ID_LEN + 2]; }; #define ISIS_CSNP_HDRLEN 25 @@ -179,8 +179,8 @@ struct isis_complete_seqnum_hdr { * +---------------------------------------------------------------+ */ struct isis_partial_seqnum_hdr { - u_int16_t pdu_len; - u_char source_id[ISIS_SYS_ID_LEN + 1]; + uint16_t pdu_len; + uint8_t source_id[ISIS_SYS_ID_LEN + 1]; }; #define ISIS_PSNP_HDRLEN 9 @@ -215,5 +215,5 @@ int send_l2_psnp(struct thread *thread); int send_lsp(struct thread *thread); void fill_fixed_hdr(uint8_t pdu_type, struct stream *stream); int send_hello(struct isis_circuit *circuit, int level); -int isis_handle_pdu(struct isis_circuit *circuit, u_char *ssnpa); +int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa); #endif /* _ZEBRA_ISIS_PDU_H */ diff --git a/isisd/isis_pfpacket.c b/isisd/isis_pfpacket.c index 852ad49c8..6e56870eb 100644 --- a/isisd/isis_pfpacket.c +++ b/isisd/isis_pfpacket.c @@ -67,10 +67,10 @@ static struct sock_fprog bpf = { * ISO 10589 - 8.4.8 */ -u_char ALL_L1_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x14}; -u_char ALL_L2_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x15}; -u_char ALL_ISS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x05}; -u_char ALL_ESS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x04}; +uint8_t ALL_L1_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x14}; +uint8_t ALL_L2_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x15}; +uint8_t ALL_ISS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x05}; +uint8_t ALL_ESS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x04}; static uint8_t discard_buff[8192]; static uint8_t sock_buff[8192]; @@ -216,7 +216,7 @@ end: return retval; } -static inline int llc_check(u_char *llc) +static inline int llc_check(uint8_t *llc) { if (*llc != ISO_SAP || *(llc + 1) != ISO_SAP || *(llc + 2) != 3) return 0; @@ -224,11 +224,11 @@ static inline int llc_check(u_char *llc) return 1; } -int isis_recv_pdu_bcast(struct isis_circuit *circuit, u_char *ssnpa) +int isis_recv_pdu_bcast(struct isis_circuit *circuit, uint8_t *ssnpa) { int bytesread, addr_len; struct sockaddr_ll s_addr; - u_char llc[LLC_LEN]; + uint8_t llc[LLC_LEN]; addr_len = sizeof(s_addr); @@ -300,7 +300,7 @@ int isis_recv_pdu_bcast(struct isis_circuit *circuit, u_char *ssnpa) return ISIS_OK; } -int isis_recv_pdu_p2p(struct isis_circuit *circuit, u_char *ssnpa) +int isis_recv_pdu_p2p(struct isis_circuit *circuit, uint8_t *ssnpa) { int bytesread, addr_len; struct sockaddr_ll s_addr; diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c index 48fcf449c..9c61512df 100644 --- a/isisd/isis_redist.c +++ b/isisd/isis_redist.c @@ -239,7 +239,7 @@ static void isis_redist_ensure_default(struct isis *isis, int family) } /* Handle notification about route being added */ -void isis_redist_add(int type, struct prefix *p, u_char distance, +void isis_redist_add(int type, struct prefix *p, uint8_t distance, uint32_t metric) { int family = p->family; diff --git a/isisd/isis_redist.h b/isisd/isis_redist.h index 2bd40e849..c12363d50 100644 --- a/isisd/isis_redist.h +++ b/isisd/isis_redist.h @@ -30,7 +30,7 @@ struct isis_ext_info { int origin; uint32_t metric; - u_char distance; + uint8_t distance; }; struct isis_redist { @@ -46,7 +46,7 @@ struct vty; struct route_table *get_ext_reach(struct isis_area *area, int family, int level); -void isis_redist_add(int type, struct prefix *p, u_char distance, +void isis_redist_add(int type, struct prefix *p, uint8_t distance, uint32_t metric); void isis_redist_delete(int type, struct prefix *p); int isis_redist_config_write(struct vty *vty, struct isis_area *area, diff --git a/isisd/isis_route.c b/isisd/isis_route.c index ad769f988..c98e16e2b 100644 --- a/isisd/isis_route.c +++ b/isisd/isis_route.c @@ -273,7 +273,7 @@ static int isis_route_info_same_attrib(struct isis_route_info *new, } static int isis_route_info_same(struct isis_route_info *new, - struct isis_route_info *old, u_char family) + struct isis_route_info *old, uint8_t family) { struct listnode *node; struct isis_nexthop *nexthop; @@ -317,15 +317,15 @@ static int isis_route_info_same(struct isis_route_info *new, return 1; } -struct isis_route_info *isis_route_create(struct prefix *prefix, u_int32_t cost, - u_int32_t depth, +struct isis_route_info *isis_route_create(struct prefix *prefix, uint32_t cost, + uint32_t depth, struct list *adjacencies, struct isis_area *area, int level) { struct route_node *route_node; struct isis_route_info *rinfo_new, *rinfo_old, *route_info = NULL; char buff[PREFIX2STR_BUFFER]; - u_char family; + uint8_t family; family = prefix->family; /* for debugs */ diff --git a/isisd/isis_route.h b/isisd/isis_route.h index 6c7d9aea9..82f37c29f 100644 --- a/isisd/isis_route.h +++ b/isisd/isis_route.h @@ -43,15 +43,15 @@ struct isis_route_info { #define ISIS_ROUTE_FLAG_ACTIVE 0x01 /* active route for the prefix */ #define ISIS_ROUTE_FLAG_ZEBRA_SYNCED 0x02 /* set when route synced to zebra */ #define ISIS_ROUTE_FLAG_ZEBRA_RESYNC 0x04 /* set when route needs to sync */ - u_char flag; - u_int32_t cost; - u_int32_t depth; + uint8_t flag; + uint32_t cost; + uint32_t depth; struct list *nexthops; struct list *nexthops6; }; -struct isis_route_info *isis_route_create(struct prefix *prefix, u_int32_t cost, - u_int32_t depth, +struct isis_route_info *isis_route_create(struct prefix *prefix, uint32_t cost, + uint32_t depth, struct list *adjacencies, struct isis_area *area, int level); diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index dc86d4c10..a55a0e190 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -81,12 +81,12 @@ struct isis_vertex { enum vertextype type; union { - u_char id[ISIS_SYS_ID_LEN + 1]; + uint8_t id[ISIS_SYS_ID_LEN + 1]; struct prefix prefix; } N; - u_int32_t d_N; /* d(N) Distance from this IS */ - u_int16_t depth; /* The depth in the imaginary tree */ + uint32_t d_N; /* d(N) Distance from this IS */ + uint16_t depth; /* The depth in the imaginary tree */ struct list *Adj_N; /* {Adj(N)} next hop or neighbor list */ struct list *parents; /* list of parents for ECMP */ uint64_t insert_counter; @@ -413,7 +413,7 @@ static void isis_vertex_id_init(struct isis_vertex *vertex, void *id, vertex->type = vtype; if (VTYPE_IS(vtype) || VTYPE_ES(vtype)) { - memcpy(vertex->N.id, (u_char *)id, ISIS_SYS_ID_LEN + 1); + memcpy(vertex->N.id, (uint8_t *)id, ISIS_SYS_ID_LEN + 1); } else if (VTYPE_IP(vtype)) { memcpy(&vertex->N.prefix, (struct prefix *)id, sizeof(struct prefix)); @@ -573,10 +573,10 @@ void spftree_area_adj_del(struct isis_area *area, struct isis_adjacency *adj) * associated with the given system ID. */ static struct isis_lsp *isis_root_system_lsp(struct isis_area *area, int level, - u_char *sysid) + uint8_t *sysid) { struct isis_lsp *lsp; - u_char lspid[ISIS_SYS_ID_LEN + 2]; + uint8_t lspid[ISIS_SYS_ID_LEN + 2]; memcpy(lspid, sysid, ISIS_SYS_ID_LEN); LSP_PSEUDO_ID(lspid) = 0; @@ -591,14 +591,14 @@ static struct isis_lsp *isis_root_system_lsp(struct isis_area *area, int level, * Add this IS to the root of SPT */ static struct isis_vertex *isis_spf_add_root(struct isis_spftree *spftree, - u_char *sysid) + uint8_t *sysid) { struct isis_vertex *vertex; struct isis_lsp *lsp; #ifdef EXTREME_DEBUG char buff[PREFIX2STR_BUFFER]; #endif /* EXTREME_DEBUG */ - u_char id[ISIS_SYS_ID_LEN + 1]; + uint8_t id[ISIS_SYS_ID_LEN + 1]; memcpy(id, sysid, ISIS_SYS_ID_LEN); LSP_PSEUDO_ID(id) = 0; @@ -805,14 +805,14 @@ static void process_N(struct isis_spftree *spftree, enum vertextype vtype, */ static int isis_spf_process_lsp(struct isis_spftree *spftree, struct isis_lsp *lsp, uint32_t cost, - uint16_t depth, u_char *root_sysid, + uint16_t depth, uint8_t *root_sysid, struct isis_vertex *parent) { bool pseudo_lsp = LSP_PSEUDO_ID(lsp->hdr.lsp_id); struct listnode *fragnode = NULL; uint32_t dist; enum vertextype vtype; - static const u_char null_sysid[ISIS_SYS_ID_LEN]; + static const uint8_t null_sysid[ISIS_SYS_ID_LEN]; struct isis_mt_router_info *mt_router_info = NULL; if (!lsp->tlvs) @@ -973,7 +973,8 @@ lspfragloop: } static int isis_spf_preload_tent(struct isis_spftree *spftree, - u_char *root_sysid, struct isis_vertex *parent) + uint8_t *root_sysid, + struct isis_vertex *parent) { struct isis_circuit *circuit; struct listnode *cnode, *anode, *ipnode; @@ -984,8 +985,8 @@ static int isis_spf_preload_tent(struct isis_spftree *spftree, struct prefix_ipv4 *ipv4; struct prefix prefix; int retval = ISIS_OK; - u_char lsp_id[ISIS_SYS_ID_LEN + 2]; - static u_char null_lsp_id[ISIS_SYS_ID_LEN + 2]; + uint8_t lsp_id[ISIS_SYS_ID_LEN + 2]; + static uint8_t null_lsp_id[ISIS_SYS_ID_LEN + 2]; struct prefix_ipv6 *ipv6; struct isis_circuit_mt_setting *circuit_mt; @@ -1252,13 +1253,13 @@ static void init_spt(struct isis_spftree *spftree, int mtid, int level, } static int isis_run_spf(struct isis_area *area, int level, int family, - u_char *sysid, struct timeval *nowtv) + uint8_t *sysid, struct timeval *nowtv) { int retval = ISIS_OK; struct isis_vertex *vertex; struct isis_vertex *root_vertex; struct isis_spftree *spftree = NULL; - u_char lsp_id[ISIS_SYS_ID_LEN + 2]; + uint8_t lsp_id[ISIS_SYS_ID_LEN + 2]; struct isis_lsp *lsp; struct route_table *table = NULL; struct timeval time_now; @@ -1446,7 +1447,7 @@ int isis_spf_schedule(struct isis_area *area, int level) } static void isis_print_paths(struct vty *vty, struct isis_vertex_queue *queue, - u_char *root_sysid) + uint8_t *root_sysid) { struct listnode *node; struct isis_vertex *vertex; @@ -1586,7 +1587,7 @@ void isis_spf_print(struct isis_spftree *spftree, struct vty *vty) vty_out(vty, "\n"); vty_out(vty, " last run duration : %u usec\n", - (u_int32_t)spftree->last_run_duration); + (uint32_t)spftree->last_run_duration); vty_out(vty, " run count : %u\n", spftree->runcount); } diff --git a/isisd/isis_te.c b/isisd/isis_te.c index 5de936a6e..d7d9ad0d4 100644 --- a/isisd/isis_te.c +++ b/isisd/isis_te.c @@ -316,7 +316,7 @@ uint8_t subtlvs_len(struct mpls_te_circuit *mtc) /* Following are various functions to set MPLS TE parameters */ static void set_circuitparams_admin_grp(struct mpls_te_circuit *mtc, - u_int32_t admingrp) + uint32_t admingrp) { SUBTLV_TYPE(mtc->admin_grp) = TE_SUBTLV_ADMIN_GRP; SUBTLV_LEN(mtc->admin_grp) = SUBTLV_DEF_SIZE; @@ -325,8 +325,8 @@ static void set_circuitparams_admin_grp(struct mpls_te_circuit *mtc, } static void __attribute__((unused)) -set_circuitparams_llri(struct mpls_te_circuit *mtc, u_int32_t local, - u_int32_t remote) +set_circuitparams_llri(struct mpls_te_circuit *mtc, uint32_t local, + uint32_t remote) { SUBTLV_TYPE(mtc->llri) = TE_SUBTLV_LLRI; SUBTLV_LEN(mtc->llri) = TE_SUBTLV_LLRI_SIZE; @@ -381,7 +381,7 @@ static void set_circuitparams_unrsv_bw(struct mpls_te_circuit *mtc, } static void set_circuitparams_te_metric(struct mpls_te_circuit *mtc, - u_int32_t te_metric) + uint32_t te_metric) { SUBTLV_TYPE(mtc->te_metric) = TE_SUBTLV_TE_METRIC; SUBTLV_LEN(mtc->te_metric) = TE_SUBTLV_TE_METRIC_SIZE; @@ -392,7 +392,7 @@ static void set_circuitparams_te_metric(struct mpls_te_circuit *mtc, } static void set_circuitparams_inter_as(struct mpls_te_circuit *mtc, - 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 */ @@ -419,9 +419,9 @@ static void unset_circuitparams_inter_as(struct mpls_te_circuit *mtc) } static void set_circuitparams_av_delay(struct mpls_te_circuit *mtc, - u_int32_t delay, u_char anormal) + uint32_t delay, uint8_t anormal) { - u_int32_t tmp; + uint32_t tmp; /* Note that TLV-length field is the size of array. */ SUBTLV_TYPE(mtc->av_delay) = TE_SUBTLV_AV_DELAY; SUBTLV_LEN(mtc->av_delay) = SUBTLV_DEF_SIZE; @@ -433,10 +433,10 @@ static void set_circuitparams_av_delay(struct mpls_te_circuit *mtc, } static void set_circuitparams_mm_delay(struct mpls_te_circuit *mtc, - u_int32_t low, u_int32_t high, - u_char anormal) + 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. */ SUBTLV_TYPE(mtc->mm_delay) = TE_SUBTLV_MM_DELAY; SUBTLV_LEN(mtc->mm_delay) = TE_SUBTLV_MM_DELAY_SIZE; @@ -449,7 +449,7 @@ static void set_circuitparams_mm_delay(struct mpls_te_circuit *mtc, } static void set_circuitparams_delay_var(struct mpls_te_circuit *mtc, - u_int32_t jitter) + uint32_t jitter) { /* Note that TLV-length field is the size of array. */ SUBTLV_TYPE(mtc->delay_var) = TE_SUBTLV_DELAY_VAR; @@ -459,9 +459,9 @@ static void set_circuitparams_delay_var(struct mpls_te_circuit *mtc, } static void set_circuitparams_pkt_loss(struct mpls_te_circuit *mtc, - u_int32_t loss, u_char anormal) + uint32_t loss, uint8_t anormal) { - u_int32_t tmp; + uint32_t tmp; /* Note that TLV-length field is the size of array. */ SUBTLV_TYPE(mtc->pkt_loss) = TE_SUBTLV_PKT_LOSS; SUBTLV_LEN(mtc->pkt_loss) = SUBTLV_DEF_SIZE; @@ -670,16 +670,16 @@ void isis_mpls_te_update(struct interface *ifp) * Followings are vty session control functions. *------------------------------------------------------------------------*/ -static u_char print_subtlv_admin_grp(struct sbuf *buf, int indent, - struct te_subtlv_admin_grp *tlv) +static uint8_t print_subtlv_admin_grp(struct sbuf *buf, int indent, + struct te_subtlv_admin_grp *tlv) { sbuf_push(buf, indent, "Administrative Group: 0x%" PRIx32 "\n", ntohl(tlv->value)); return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE); } -static u_char print_subtlv_llri(struct sbuf *buf, int indent, - struct te_subtlv_llri *tlv) +static uint8_t print_subtlv_llri(struct sbuf *buf, int indent, + struct te_subtlv_llri *tlv) { sbuf_push(buf, indent, "Link Local ID: %" PRIu32 "\n", ntohl(tlv->local)); @@ -689,8 +689,8 @@ static u_char print_subtlv_llri(struct sbuf *buf, int indent, return (SUBTLV_HDR_SIZE + TE_SUBTLV_LLRI_SIZE); } -static u_char print_subtlv_local_ipaddr(struct sbuf *buf, int indent, - struct te_subtlv_local_ipaddr *tlv) +static uint8_t print_subtlv_local_ipaddr(struct sbuf *buf, int indent, + struct te_subtlv_local_ipaddr *tlv) { sbuf_push(buf, indent, "Local Interface IP Address(es): %s\n", inet_ntoa(tlv->value)); @@ -698,8 +698,8 @@ static u_char print_subtlv_local_ipaddr(struct sbuf *buf, int indent, return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE); } -static u_char print_subtlv_rmt_ipaddr(struct sbuf *buf, int indent, - struct te_subtlv_rmt_ipaddr *tlv) +static uint8_t print_subtlv_rmt_ipaddr(struct sbuf *buf, int indent, + struct te_subtlv_rmt_ipaddr *tlv) { sbuf_push(buf, indent, "Remote Interface IP Address(es): %s\n", inet_ntoa(tlv->value)); @@ -707,8 +707,8 @@ static u_char print_subtlv_rmt_ipaddr(struct sbuf *buf, int indent, return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE); } -static u_char print_subtlv_max_bw(struct sbuf *buf, int indent, - struct te_subtlv_max_bw *tlv) +static uint8_t print_subtlv_max_bw(struct sbuf *buf, int indent, + struct te_subtlv_max_bw *tlv) { float fval; @@ -719,8 +719,8 @@ static u_char print_subtlv_max_bw(struct sbuf *buf, int indent, return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE); } -static u_char print_subtlv_max_rsv_bw(struct sbuf *buf, int indent, - struct te_subtlv_max_rsv_bw *tlv) +static uint8_t print_subtlv_max_rsv_bw(struct sbuf *buf, int indent, + struct te_subtlv_max_rsv_bw *tlv) { float fval; @@ -732,8 +732,8 @@ static u_char print_subtlv_max_rsv_bw(struct sbuf *buf, int indent, return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE); } -static u_char print_subtlv_unrsv_bw(struct sbuf *buf, int indent, - struct te_subtlv_unrsv_bw *tlv) +static uint8_t print_subtlv_unrsv_bw(struct sbuf *buf, int indent, + struct te_subtlv_unrsv_bw *tlv) { float fval1, fval2; int i; @@ -751,10 +751,10 @@ static u_char print_subtlv_unrsv_bw(struct sbuf *buf, int indent, return (SUBTLV_HDR_SIZE + TE_SUBTLV_UNRSV_SIZE); } -static u_char print_subtlv_te_metric(struct sbuf *buf, int indent, - struct te_subtlv_te_metric *tlv) +static uint8_t print_subtlv_te_metric(struct sbuf *buf, int indent, + struct te_subtlv_te_metric *tlv) { - u_int32_t te_metric; + uint32_t te_metric; te_metric = tlv->value[2] | tlv->value[1] << 8 | tlv->value[0] << 16; sbuf_push(buf, indent, "Traffic Engineering Metric: %u\n", te_metric); @@ -762,8 +762,8 @@ static u_char print_subtlv_te_metric(struct sbuf *buf, int indent, return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE); } -static u_char print_subtlv_ras(struct sbuf *buf, int indent, - struct te_subtlv_ras *tlv) +static uint8_t print_subtlv_ras(struct sbuf *buf, int indent, + struct te_subtlv_ras *tlv) { sbuf_push(buf, indent, "Inter-AS TE Remote AS number: %" PRIu32 "\n", ntohl(tlv->value)); @@ -771,8 +771,8 @@ static u_char print_subtlv_ras(struct sbuf *buf, int indent, return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE); } -static u_char print_subtlv_rip(struct sbuf *buf, int indent, - struct te_subtlv_rip *tlv) +static uint8_t print_subtlv_rip(struct sbuf *buf, int indent, + struct te_subtlv_rip *tlv) { sbuf_push(buf, indent, "Inter-AS TE Remote ASBR IP address: %s\n", inet_ntoa(tlv->value)); @@ -780,14 +780,14 @@ static u_char print_subtlv_rip(struct sbuf *buf, int indent, return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE); } -static u_char print_subtlv_av_delay(struct sbuf *buf, int indent, - struct te_subtlv_av_delay *tlv) +static uint8_t print_subtlv_av_delay(struct sbuf *buf, int indent, + struct te_subtlv_av_delay *tlv) { - u_int32_t delay; - u_int32_t A; + uint32_t delay; + uint32_t A; - delay = (u_int32_t)ntohl(tlv->value) & TE_EXT_MASK; - A = (u_int32_t)ntohl(tlv->value) & TE_EXT_ANORMAL; + delay = (uint32_t)ntohl(tlv->value) & TE_EXT_MASK; + A = (uint32_t)ntohl(tlv->value) & TE_EXT_ANORMAL; sbuf_push(buf, indent, "%s Average Link Delay: %" PRIu32 " (micro-sec)\n", @@ -796,15 +796,15 @@ static u_char print_subtlv_av_delay(struct sbuf *buf, int indent, return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE); } -static u_char print_subtlv_mm_delay(struct sbuf *buf, int indent, - struct te_subtlv_mm_delay *tlv) +static uint8_t print_subtlv_mm_delay(struct sbuf *buf, int indent, + struct te_subtlv_mm_delay *tlv) { - u_int32_t low, high; - u_int32_t A; + uint32_t low, high; + uint32_t A; - low = (u_int32_t)ntohl(tlv->low) & TE_EXT_MASK; - A = (u_int32_t)ntohl(tlv->low) & TE_EXT_ANORMAL; - high = (u_int32_t)ntohl(tlv->high) & TE_EXT_MASK; + low = (uint32_t)ntohl(tlv->low) & TE_EXT_MASK; + A = (uint32_t)ntohl(tlv->low) & TE_EXT_ANORMAL; + high = (uint32_t)ntohl(tlv->high) & TE_EXT_MASK; sbuf_push(buf, indent, "%s Min/Max Link Delay: %" PRIu32 " / %" PRIu32 " (micro-sec)\n", A ? "Anomalous" : "Normal", low, high); @@ -812,12 +812,12 @@ static u_char print_subtlv_mm_delay(struct sbuf *buf, int indent, return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE); } -static u_char print_subtlv_delay_var(struct sbuf *buf, int indent, - struct te_subtlv_delay_var *tlv) +static uint8_t print_subtlv_delay_var(struct sbuf *buf, int indent, + struct te_subtlv_delay_var *tlv) { - u_int32_t jitter; + uint32_t jitter; - jitter = (u_int32_t)ntohl(tlv->value) & TE_EXT_MASK; + jitter = (uint32_t)ntohl(tlv->value) & TE_EXT_MASK; sbuf_push(buf, indent, "Delay Variation: %" PRIu32 " (micro-sec)\n", jitter); @@ -825,16 +825,16 @@ static u_char print_subtlv_delay_var(struct sbuf *buf, int indent, return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE); } -static u_char print_subtlv_pkt_loss(struct sbuf *buf, int indent, - struct te_subtlv_pkt_loss *tlv) +static uint8_t print_subtlv_pkt_loss(struct sbuf *buf, int indent, + struct te_subtlv_pkt_loss *tlv) { - u_int32_t loss; - u_int32_t A; + uint32_t loss; + uint32_t A; float fval; - loss = (u_int32_t)ntohl(tlv->value) & TE_EXT_MASK; + loss = (uint32_t)ntohl(tlv->value) & TE_EXT_MASK; fval = (float)(loss * LOSS_PRECISION); - A = (u_int32_t)ntohl(tlv->value) & TE_EXT_ANORMAL; + A = (uint32_t)ntohl(tlv->value) & TE_EXT_ANORMAL; sbuf_push(buf, indent, "%s Link Packet Loss: %g (%%)\n", A ? "Anomalous" : "Normal", fval); @@ -842,8 +842,8 @@ static u_char print_subtlv_pkt_loss(struct sbuf *buf, int indent, return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE); } -static u_char print_subtlv_res_bw(struct sbuf *buf, int indent, - struct te_subtlv_res_bw *tlv) +static uint8_t print_subtlv_res_bw(struct sbuf *buf, int indent, + struct te_subtlv_res_bw *tlv) { float fval; @@ -855,8 +855,8 @@ static u_char print_subtlv_res_bw(struct sbuf *buf, int indent, return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE); } -static u_char print_subtlv_ava_bw(struct sbuf *buf, int indent, - struct te_subtlv_ava_bw *tlv) +static uint8_t print_subtlv_ava_bw(struct sbuf *buf, int indent, + struct te_subtlv_ava_bw *tlv) { float fval; @@ -868,8 +868,8 @@ static u_char print_subtlv_ava_bw(struct sbuf *buf, int indent, return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE); } -static u_char print_subtlv_use_bw(struct sbuf *buf, int indent, - struct te_subtlv_use_bw *tlv) +static uint8_t print_subtlv_use_bw(struct sbuf *buf, int indent, + struct te_subtlv_use_bw *tlv) { float fval; @@ -881,11 +881,11 @@ static u_char print_subtlv_use_bw(struct sbuf *buf, int indent, return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE); } -static u_char print_unknown_tlv(struct sbuf *buf, int indent, - struct subtlv_header *tlvh) +static uint8_t print_unknown_tlv(struct sbuf *buf, int indent, + struct subtlv_header *tlvh) { int i, rtn = 1; - u_char *v = (u_char *)tlvh; + uint8_t *v = (uint8_t *)tlvh; if (tlvh->length != 0) { sbuf_push(buf, indent, diff --git a/isisd/isis_te.h b/isisd/isis_te.h index 91bcb7269..e9eff08cd 100644 --- a/isisd/isis_te.h +++ b/isisd/isis_te.h @@ -77,8 +77,8 @@ * used for Traffic Engineering. */ struct subtlv_header { - u_char type; /* sub_TLV_XXX type (see above) */ - u_char length; /* Value portion only, in byte */ + uint8_t type; /* sub_TLV_XXX type (see above) */ + uint8_t length; /* Value portion only, in byte */ }; #define MAX_SUBTLV_SIZE 256 @@ -102,7 +102,7 @@ struct subtlv_header { #define TE_SUBTLV_ADMIN_GRP 3 struct te_subtlv_admin_grp { struct subtlv_header header; /* Value length is 4 octets. */ - u_int32_t value; /* Admin. group membership. */ + uint32_t value; /* Admin. group membership. */ } __attribute__((__packed__)); /* Link Local/Remote Identifiers - RFC 5307 */ @@ -110,8 +110,8 @@ struct te_subtlv_admin_grp { #define TE_SUBTLV_LLRI_SIZE 8 struct te_subtlv_llri { struct subtlv_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 */ } __attribute__((__packed__)); /* Link Sub-TLV: Local Interface IP Address - RFC 5305 */ @@ -155,14 +155,14 @@ struct te_subtlv_unrsv_bw { #define TE_SUBTLV_TE_METRIC_SIZE 3 struct te_subtlv_te_metric { struct subtlv_header header; /* Value length is 4 octets. */ - u_char value[3]; /* Link metric for TE purpose. */ + uint8_t value[3]; /* Link metric for TE purpose. */ } __attribute__((__packed__)); /* Remote AS Number sub-TLV - RFC5316 */ #define TE_SUBTLV_RAS 24 struct te_subtlv_ras { struct subtlv_header header; /* Value length is 4 octets. */ - u_int32_t value; /* Remote AS number */ + uint32_t value; /* Remote AS number */ } __attribute__((__packed__)); /* IPv4 Remote ASBR ID Sub-TLV - RFC5316 */ @@ -178,7 +178,7 @@ struct te_subtlv_rip { #define TE_SUBTLV_AV_DELAY 33 struct te_subtlv_av_delay { struct subtlv_header header; /* Value length is 4 bytes. */ - u_int32_t value; /* Average delay in micro-seconds only 24 bits => 0 ... + uint32_t value; /* Average delay in micro-seconds only 24 bits => 0 ... 16777215 with Anomalous Bit (A) as Upper most bit */ } __attribute__((__packed__)); @@ -188,10 +188,10 @@ struct te_subtlv_av_delay { #define TE_SUBTLV_MM_DELAY_SIZE 8 struct te_subtlv_mm_delay { struct subtlv_header header; /* Value length is 8 bytes. */ - u_int32_t low; /* low delay in micro-seconds only 24 bits => 0 ... + uint32_t low; /* low delay in micro-seconds only 24 bits => 0 ... 16777215 with Anomalous Bit (A) as Upper most bit */ - u_int32_t high; /* high delay in micro-seconds only 24 bits => 0 ... + uint32_t high; /* high delay in micro-seconds only 24 bits => 0 ... 16777215 */ } __attribute__((__packed__)); @@ -199,7 +199,7 @@ struct te_subtlv_mm_delay { #define TE_SUBTLV_DELAY_VAR 35 struct te_subtlv_delay_var { struct subtlv_header header; /* Value length is 4 bytes. */ - u_int32_t value; /* interval in micro-seconds only 24 bits => 0 ... + uint32_t value; /* interval in micro-seconds only 24 bits => 0 ... 16777215 */ } __attribute__((__packed__)); @@ -207,7 +207,7 @@ struct te_subtlv_delay_var { #define TE_SUBTLV_PKT_LOSS 36 struct te_subtlv_pkt_loss { struct subtlv_header header; /* Value length is 4 bytes. */ - u_int32_t + uint32_t value; /* in percentage of total traffic only 24 bits (2^24 - 2) with Anomalous Bit (A) as Upper most bit */ } __attribute__((__packed__)); @@ -253,7 +253,7 @@ struct isis_mpls_te { status_t status; /* L1, L1-L2, L2-Only */ - u_int8_t level; + uint8_t level; /* RFC5316 */ interas_mode_t inter_as; @@ -275,10 +275,10 @@ struct mpls_te_circuit { /* Type of MPLS-TE circuit: STD_TE(RFC5305), INTER_AS(RFC5316), * INTER_AS_EMU(RFC5316 emulated) */ - u_int8_t type; + uint8_t type; /* Total size of sub_tlvs */ - u_char length; + uint8_t length; /* Store subTLV in network byte order. */ /* RFC5305 */ diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c index 66a19e150..d51eb3e51 100644 --- a/isisd/isis_tlvs.c +++ b/isisd/isis_tlvs.c @@ -2757,7 +2757,7 @@ void isis_tlvs_add_area_addresses(struct isis_tlvs *tlvs, void isis_tlvs_add_lan_neighbors(struct isis_tlvs *tlvs, struct list *neighbors) { struct listnode *node; - u_char *snpa; + uint8_t *snpa; for (ALL_LIST_ELEMENTS_RO(neighbors, node, snpa)) { struct isis_lan_neighbor *n = diff --git a/isisd/isis_vty.c b/isisd/isis_vty.c index 66d79b2e9..ce2952c13 100644 --- a/isisd/isis_vty.c +++ b/isisd/isis_vty.c @@ -635,8 +635,8 @@ DEFUN (isis_hello_interval, return CMD_WARNING_CONFIG_FAILED; } - circuit->hello_interval[0] = (u_int16_t)interval; - circuit->hello_interval[1] = (u_int16_t)interval; + circuit->hello_interval[0] = (uint16_t)interval; + circuit->hello_interval[1] = (uint16_t)interval; return CMD_SUCCESS; } @@ -682,7 +682,7 @@ DEFUN (isis_hello_interval_l1, return CMD_WARNING_CONFIG_FAILED; } - circuit->hello_interval[0] = (u_int16_t)interval; + circuit->hello_interval[0] = (uint16_t)interval; return CMD_SUCCESS; } @@ -728,7 +728,7 @@ DEFUN (isis_hello_interval_l2, return CMD_WARNING_CONFIG_FAILED; } - circuit->hello_interval[1] = (u_int16_t)interval; + circuit->hello_interval[1] = (uint16_t)interval; return CMD_SUCCESS; } @@ -774,8 +774,8 @@ DEFUN (isis_hello_multiplier, return CMD_WARNING_CONFIG_FAILED; } - circuit->hello_multiplier[0] = (u_int16_t)mult; - circuit->hello_multiplier[1] = (u_int16_t)mult; + circuit->hello_multiplier[0] = (uint16_t)mult; + circuit->hello_multiplier[1] = (uint16_t)mult; return CMD_SUCCESS; } @@ -822,7 +822,7 @@ DEFUN (isis_hello_multiplier_l1, return CMD_WARNING_CONFIG_FAILED; } - circuit->hello_multiplier[0] = (u_int16_t)mult; + circuit->hello_multiplier[0] = (uint16_t)mult; return CMD_SUCCESS; } @@ -869,7 +869,7 @@ DEFUN (isis_hello_multiplier_l2, return CMD_WARNING_CONFIG_FAILED; } - circuit->hello_multiplier[1] = (u_int16_t)mult; + circuit->hello_multiplier[1] = (uint16_t)mult; return CMD_SUCCESS; } @@ -962,8 +962,8 @@ DEFUN (csnp_interval, return CMD_WARNING_CONFIG_FAILED; } - circuit->csnp_interval[0] = (u_int16_t)interval; - circuit->csnp_interval[1] = (u_int16_t)interval; + circuit->csnp_interval[0] = (uint16_t)interval; + circuit->csnp_interval[1] = (uint16_t)interval; return CMD_SUCCESS; } @@ -1009,7 +1009,7 @@ DEFUN (csnp_interval_l1, return CMD_WARNING_CONFIG_FAILED; } - circuit->csnp_interval[0] = (u_int16_t)interval; + circuit->csnp_interval[0] = (uint16_t)interval; return CMD_SUCCESS; } @@ -1055,7 +1055,7 @@ DEFUN (csnp_interval_l2, return CMD_WARNING_CONFIG_FAILED; } - circuit->csnp_interval[1] = (u_int16_t)interval; + circuit->csnp_interval[1] = (uint16_t)interval; return CMD_SUCCESS; } @@ -1100,8 +1100,8 @@ DEFUN (psnp_interval, return CMD_WARNING_CONFIG_FAILED; } - circuit->psnp_interval[0] = (u_int16_t)interval; - circuit->psnp_interval[1] = (u_int16_t)interval; + circuit->psnp_interval[0] = (uint16_t)interval; + circuit->psnp_interval[1] = (uint16_t)interval; return CMD_SUCCESS; } @@ -1147,7 +1147,7 @@ DEFUN (psnp_interval_l1, return CMD_WARNING_CONFIG_FAILED; } - circuit->psnp_interval[0] = (u_int16_t)interval; + circuit->psnp_interval[0] = (uint16_t)interval; return CMD_SUCCESS; } @@ -1193,7 +1193,7 @@ DEFUN (psnp_interval_l2, return CMD_WARNING_CONFIG_FAILED; } - circuit->psnp_interval[1] = (u_int16_t)interval; + circuit->psnp_interval[1] = (uint16_t)interval; return CMD_SUCCESS; } @@ -1618,7 +1618,7 @@ DEFUN (spf_interval, { int idx_number = 1; VTY_DECLVAR_CONTEXT(isis_area, area); - u_int16_t interval; + uint16_t interval; interval = atoi(argv[idx_number]->arg); area->min_spf_interval[0] = interval; @@ -1655,7 +1655,7 @@ DEFUN (spf_interval_l1, { int idx_number = 2; VTY_DECLVAR_CONTEXT(isis_area, area); - u_int16_t interval; + uint16_t interval; interval = atoi(argv[idx_number]->arg); area->min_spf_interval[0] = interval; @@ -1687,7 +1687,7 @@ DEFUN (spf_interval_l2, { int idx_number = 2; VTY_DECLVAR_CONTEXT(isis_area, area); - u_int16_t interval; + uint16_t interval; interval = atoi(argv[idx_number]->arg); area->min_spf_interval[1] = interval; @@ -1934,8 +1934,9 @@ DEFUN (no_lsp_refresh_interval, static int area_passwd_set(struct vty *vty, int level, int (*type_set)(struct isis_area *area, int level, - const char *passwd, u_char snp_auth), - const char *passwd, u_char snp_auth) + const char *passwd, + uint8_t snp_auth), + const char *passwd, uint8_t snp_auth) { VTY_DECLVAR_CONTEXT(isis_area, area); @@ -1963,7 +1964,7 @@ DEFUN (area_passwd_md5, int idx_password = 0; int idx_word = 2; int idx_type = 5; - u_char snp_auth = 0; + uint8_t snp_auth = 0; int level = strmatch(argv[idx_password]->text, "domain-password") ? IS_LEVEL_2 : IS_LEVEL_1; @@ -2006,7 +2007,7 @@ DEFUN (area_passwd_clear, int idx_password = 0; int idx_word = 2; int idx_type = 5; - u_char snp_auth = 0; + uint8_t snp_auth = 0; int level = strmatch(argv[idx_password]->text, "domain-password") ? IS_LEVEL_2 : IS_LEVEL_1; diff --git a/isisd/isisd.c b/isisd/isisd.c index 6d64e0770..6f04d7208 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -324,7 +324,7 @@ int area_net_title(struct vty *vty, const char *net_title) struct area_addr *addrp; struct listnode *node; - u_char buff[255]; + uint8_t buff[255]; /* We check that we are not over the maximal number of addresses */ if (listcount(area->area_addrs) >= isis->max_area_addrs) { @@ -411,7 +411,7 @@ int area_clear_net_title(struct vty *vty, const char *net_title) VTY_DECLVAR_CONTEXT(isis_area, area); struct area_addr addr, *addrp = NULL; struct listnode *node; - u_char buff[255]; + uint8_t buff[255]; addr.addr_len = dotformat2buff(buff, net_title); if (addr.addr_len < 8 || addr.addr_len > 20) { @@ -528,7 +528,7 @@ int show_isis_neighbor_common(struct vty *vty, const char *id, char detail) struct list *adjdb; struct isis_adjacency *adj; struct isis_dynhn *dynhn; - u_char sysid[ISIS_SYS_ID_LEN]; + uint8_t sysid[ISIS_SYS_ID_LEN]; int i; if (!isis) { @@ -597,7 +597,7 @@ int clear_isis_neighbor_common(struct vty *vty, const char *id) struct list *adjdb; struct isis_adjacency *adj; struct isis_dynhn *dynhn; - u_char sysid[ISIS_SYS_ID_LEN]; + uint8_t sysid[ISIS_SYS_ID_LEN]; int i; if (!isis) { @@ -1374,9 +1374,9 @@ static int show_isis_database(struct vty *vty, const char *argv, int ui_level) struct isis_lsp *lsp; struct isis_dynhn *dynhn; const char *pos = argv; - u_char lspid[ISIS_SYS_ID_LEN + 2]; + uint8_t lspid[ISIS_SYS_ID_LEN + 2]; char sysid[255]; - u_char number[3]; + uint8_t number[3]; int level, lsp_count; if (isis->area_list->count == 0) @@ -1401,7 +1401,7 @@ static int show_isis_database(struct vty *vty, const char *argv, int ui_level) if (strncmp(pos, "-", 1) == 0) { memcpy(number, ++pos, 2); lspid[ISIS_SYS_ID_LEN + 1] = - (u_char)strtol((char *)number, NULL, 16); + (uint8_t)strtol((char *)number, NULL, 16); pos -= 4; if (strncmp(pos, ".", 1) != 0) return CMD_WARNING; @@ -1409,7 +1409,7 @@ static int show_isis_database(struct vty *vty, const char *argv, int ui_level) if (strncmp(pos, ".", 1) == 0) { memcpy(number, ++pos, 2); lspid[ISIS_SYS_ID_LEN] = - (u_char)strtol((char *)number, NULL, 16); + (uint8_t)strtol((char *)number, NULL, 16); sysid[pos - argv - 1] = '\0'; } } @@ -1626,8 +1626,8 @@ void isis_area_lsp_mtu_set(struct isis_area *area, unsigned int lsp_mtu) } static int isis_area_passwd_set(struct isis_area *area, int level, - u_char passwd_type, const char *passwd, - u_char snp_auth) + uint8_t passwd_type, const char *passwd, + uint8_t snp_auth) { struct isis_passwd *dest; struct isis_passwd modified; @@ -1667,14 +1667,14 @@ int isis_area_passwd_unset(struct isis_area *area, int level) } int isis_area_passwd_cleartext_set(struct isis_area *area, int level, - const char *passwd, u_char snp_auth) + const char *passwd, uint8_t snp_auth) { return isis_area_passwd_set(area, level, ISIS_PASSWD_TYPE_CLEARTXT, passwd, snp_auth); } int isis_area_passwd_hmac_md5_set(struct isis_area *area, int level, - const char *passwd, u_char snp_auth) + const char *passwd, uint8_t snp_auth) { return isis_area_passwd_set(area, level, ISIS_PASSWD_TYPE_HMAC_MD5, passwd, snp_auth); diff --git a/isisd/isisd.h b/isisd/isisd.h index 85d3974fa..d1ad9f3b8 100644 --- a/isisd/isisd.h +++ b/isisd/isisd.h @@ -40,17 +40,17 @@ extern struct zebra_privs_t isisd_privs; /* #define EXTREME_DICT_DEBUG */ struct isis { - u_long process_id; + unsigned long process_id; int sysid_set; - u_char sysid[ISIS_SYS_ID_LEN]; /* SystemID for this IS */ - u_int32_t router_id; /* Router ID from zebra */ + uint8_t sysid[ISIS_SYS_ID_LEN]; /* SystemID for this IS */ + uint32_t router_id; /* Router ID from zebra */ struct list *area_list; /* list of IS-IS areas */ struct list *init_circ_list; struct list *nexthops; /* IPv4 next hops from this IS */ struct list *nexthops6; /* IPv6 next hops from this IS */ - u_char max_area_addrs; /* maximumAreaAdresses */ + uint8_t max_area_addrs; /* maximumAreaAdresses */ struct area_addr *man_area_addrs; /* manualAreaAddresses */ - u_int32_t debugs; /* bitmap for debug */ + uint32_t debugs; /* bitmap for debug */ time_t uptime; /* when did we start */ struct thread *t_dync_clean; /* dynamic hostname cache cleanup thread */ uint32_t circuit_ids_used[8]; /* 256 bits to track circuit ids 1 through 255 */ @@ -103,27 +103,27 @@ struct isis_area { char *area_tag; /* area addresses for this area */ struct list *area_addrs; - u_int16_t max_lsp_lifetime[ISIS_LEVELS]; + uint16_t max_lsp_lifetime[ISIS_LEVELS]; char is_type; /* level-1 level-1-2 or level-2-only */ /* are we overloaded? */ char overload_bit; /* L1/L2 router identifier for inter-area traffic */ char attached_bit; - u_int16_t lsp_refresh[ISIS_LEVELS]; + uint16_t lsp_refresh[ISIS_LEVELS]; /* minimum time allowed before lsp retransmission */ - u_int16_t lsp_gen_interval[ISIS_LEVELS]; + uint16_t lsp_gen_interval[ISIS_LEVELS]; /* min interval between between consequtive SPFs */ - u_int16_t min_spf_interval[ISIS_LEVELS]; + uint16_t min_spf_interval[ISIS_LEVELS]; /* the percentage of LSP mtu size used, before generating a new frag */ int lsp_frag_threshold; int ip_circuits; /* logging adjacency changes? */ - u_char log_adj_changes; + uint8_t log_adj_changes; /* multi topology settings */ struct list *mt_settings; int ipv6_circuits; /* Counters */ - u_int32_t circuit_state_changes; + uint32_t circuit_state_changes; struct isis_redist redist_settings[REDIST_PROTOCOL_COUNT] [ZEBRA_ROUTE_MAX + 1][ISIS_LEVELS]; struct route_table *ext_reach[REDIST_PROTOCOL_COUNT][ISIS_LEVELS]; @@ -158,9 +158,9 @@ void isis_area_lsp_refresh_set(struct isis_area *area, int level, /* IS_LEVEL_1 sets area_passwd, IS_LEVEL_2 domain_passwd */ int isis_area_passwd_unset(struct isis_area *area, int level); int isis_area_passwd_cleartext_set(struct isis_area *area, int level, - const char *passwd, u_char snp_auth); + const char *passwd, uint8_t snp_auth); int isis_area_passwd_hmac_md5_set(struct isis_area *area, int level, - const char *passwd, u_char snp_auth); + const char *passwd, uint8_t snp_auth); void isis_vty_init(void); /* Master of threads. */ diff --git a/isisd/iso_checksum.c b/isisd/iso_checksum.c index 25a870991..0da6d5fc8 100644 --- a/isisd/iso_checksum.c +++ b/isisd/iso_checksum.c @@ -45,11 +45,11 @@ * Based on Annex C.4 of ISO/IEC 8473 */ -int iso_csum_verify(u_char *buffer, int len, uint16_t csum, int offset) +int iso_csum_verify(uint8_t *buffer, int len, uint16_t csum, int offset) { - u_int16_t checksum; - u_int32_t c0; - u_int32_t c1; + uint16_t checksum; + uint32_t c0; + uint32_t c1; c0 = csum & 0xff00; c1 = csum & 0x00ff; diff --git a/isisd/iso_checksum.h b/isisd/iso_checksum.h index 5ba371fb4..357c75fa5 100644 --- a/isisd/iso_checksum.h +++ b/isisd/iso_checksum.h @@ -23,6 +23,6 @@ #ifndef _ZEBRA_ISO_CSUM_H #define _ZEBRA_ISO_CSUM_H -int iso_csum_verify(u_char *buffer, int len, uint16_t csum, int offset); +int iso_csum_verify(uint8_t *buffer, int len, uint16_t csum, int offset); #endif /* _ZEBRA_ISO_CSUM_H */ diff --git a/ldpd/lde.c b/ldpd/lde.c index 5aa53fd39..03b62b482 100644 --- a/ldpd/lde.c +++ b/ldpd/lde.c @@ -56,7 +56,7 @@ static void lde_map_free(void *); static int lde_address_add(struct lde_nbr *, struct lde_addr *); static int lde_address_del(struct lde_nbr *, struct lde_addr *); static void lde_address_list_free(struct lde_nbr *); -static void zclient_sync_init(u_short instance); +static void zclient_sync_init(unsigned short instance); static void lde_label_list_init(void); static int lde_get_label_chunk(void); static void on_get_label_chunk_response(uint32_t start, uint32_t end); @@ -1626,8 +1626,7 @@ lde_address_list_free(struct lde_nbr *ln) } } -static void -zclient_sync_init(u_short instance) +static void zclient_sync_init(unsigned short instance) { /* Initialize special zclient for synchronous message exchanges. */ zclient_sync = zclient_new_notify(master, &zclient_options_default); diff --git a/ldpd/ldp_zebra.c b/ldpd/ldp_zebra.c index a12a4b913..c8b775cb8 100644 --- a/ldpd/ldp_zebra.c +++ b/ldpd/ldp_zebra.c @@ -142,9 +142,9 @@ zebra_send_mpls_labels(int cmd, struct kroute *kr) stream_put_in_addr(s, &kr->nexthop.v4); break; case AF_INET6: - stream_write(s, (u_char *)&kr->prefix.v6, 16); + stream_write(s, (uint8_t *)&kr->prefix.v6, 16); stream_putc(s, kr->prefixlen); - stream_write(s, (u_char *)&kr->nexthop.v6, 16); + stream_write(s, (uint8_t *)&kr->nexthop.v6, 16); break; default: fatalx("kr_change: unknown af"); diff --git a/ldpd/ldpd.h b/ldpd/ldpd.h index 4824f1720..ed0a5407b 100644 --- a/ldpd/ldpd.h +++ b/ldpd/ldpd.h @@ -159,7 +159,7 @@ struct ldpd_init { char group[256]; char ctl_sock_path[MAXPATHLEN]; char zclient_serv_path[MAXPATHLEN]; - u_short instance; + unsigned short instance; }; union ldpd_addr { diff --git a/lib/agentx.c b/lib/agentx.c index f8845f146..302bbf0a4 100644 --- a/lib/agentx.c +++ b/lib/agentx.c @@ -230,7 +230,7 @@ int smux_trap(struct variable *vp, size_t vp_len, const oid *ename, size_t enamelen, const oid *name, size_t namelen, const oid *iname, size_t inamelen, const struct trap_object *trapobj, size_t trapobjlen, - u_char sptrap) + uint8_t sptrap) { oid objid_snmptrap[] = {1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0}; size_t objid_snmptrap_len = sizeof objid_snmptrap / sizeof(oid); @@ -248,7 +248,7 @@ int smux_trap(struct variable *vp, size_t vp_len, const oid *ename, notification_oid_len = enamelen + 1; snmp_varlist_add_variable(¬ification_vars, objid_snmptrap, objid_snmptrap_len, ASN_OBJECT_ID, - (u_char *)notification_oid, + (uint8_t *)notification_oid, notification_oid_len * sizeof(oid)); /* Provided bindings */ @@ -256,7 +256,7 @@ int smux_trap(struct variable *vp, size_t vp_len, const oid *ename, unsigned int j; oid oid[MAX_OID_LEN]; size_t oid_len, onamelen; - u_char *val; + uint8_t *val; size_t val_len; WriteMethod *wm = NULL; struct variable cvp; @@ -84,8 +84,8 @@ void bfd_info_free(struct bfd_info **bfd_info) * bfd_validate_param - Validate the BFD paramter information. */ int bfd_validate_param(struct vty *vty, const char *dm_str, const char *rx_str, - const char *tx_str, u_int8_t *dm_val, u_int32_t *rx_val, - u_int32_t *tx_val) + const char *tx_str, uint8_t *dm_val, uint32_t *rx_val, + uint32_t *tx_val) { *dm_val = strtoul(dm_str, NULL, 10); *rx_val = strtoul(rx_str, NULL, 10); @@ -96,9 +96,8 @@ int bfd_validate_param(struct vty *vty, const char *dm_str, const char *rx_str, /* * bfd_set_param - Set the configured BFD paramter values */ -void bfd_set_param(struct bfd_info **bfd_info, u_int32_t min_rx, - u_int32_t min_tx, u_int8_t detect_mult, int defaults, - int *command) +void bfd_set_param(struct bfd_info **bfd_info, uint32_t min_rx, uint32_t min_tx, + uint8_t detect_mult, int defaults, int *command) { if (!*bfd_info) { *bfd_info = bfd_info_create(); @@ -343,7 +342,7 @@ static void bfd_last_update(time_t last_update, char *buf, size_t len) * bfd_show_param - Show the BFD parameter information. */ void bfd_show_param(struct vty *vty, struct bfd_info *bfd_info, int bfd_tag, - int extra_space, u_char use_json, json_object *json_obj) + int extra_space, uint8_t use_json, json_object *json_obj) { json_object *json_bfd = NULL; @@ -379,7 +378,7 @@ void bfd_show_param(struct vty *vty, struct bfd_info *bfd_info, int bfd_tag, * bfd_show_status - Show the BFD status information. */ static void bfd_show_status(struct vty *vty, struct bfd_info *bfd_info, - int bfd_tag, int extra_space, u_char use_json, + int bfd_tag, int extra_space, uint8_t use_json, json_object *json_bfd) { char time_buf[32]; @@ -403,7 +402,7 @@ static void bfd_show_status(struct vty *vty, struct bfd_info *bfd_info, * bfd_show_info - Show the BFD information. */ void bfd_show_info(struct vty *vty, struct bfd_info *bfd_info, int multihop, - int extra_space, u_char use_json, json_object *json_obj) + int extra_space, uint8_t use_json, json_object *json_obj) { json_object *json_bfd = NULL; @@ -37,7 +37,7 @@ #define BFD_GBL_FLAG_IN_SHUTDOWN (1 << 0) /* The daemon in shutdown */ struct bfd_gbl { - u_int16_t flags; + uint16_t flags; }; #define BFD_FLAG_PARAM_CFG (1 << 0) /* parameters have been configured */ @@ -55,12 +55,12 @@ enum bfd_sess_type { }; struct bfd_info { - u_int16_t flags; - u_int8_t detect_mult; - u_int32_t desired_min_tx; - u_int32_t required_min_rx; + uint16_t flags; + uint8_t detect_mult; + uint32_t desired_min_tx; + uint32_t required_min_rx; time_t last_update; - u_int8_t status; + uint8_t status; enum bfd_sess_type type; }; @@ -70,11 +70,11 @@ extern void bfd_info_free(struct bfd_info **bfd_info); extern int bfd_validate_param(struct vty *vty, const char *dm_str, const char *rx_str, const char *tx_str, - u_int8_t *dm_val, u_int32_t *rx_val, - u_int32_t *tx_val); + uint8_t *dm_val, uint32_t *rx_val, + uint32_t *tx_val); -extern void bfd_set_param(struct bfd_info **bfd_info, u_int32_t min_rx, - u_int32_t min_tx, u_int8_t detect_mult, int defaults, +extern void bfd_set_param(struct bfd_info **bfd_info, uint32_t min_rx, + uint32_t min_tx, uint8_t detect_mult, int defaults, int *command); extern void bfd_peer_sendmsg(struct zclient *zclient, struct bfd_info *bfd_info, int family, void *dst_ip, void *src_ip, @@ -90,11 +90,11 @@ extern struct interface *bfd_get_peer_info(struct stream *s, struct prefix *dp, const char *bfd_get_status_str(int status); extern void bfd_show_param(struct vty *vty, struct bfd_info *bfd_info, - int bfd_tag, int extra_space, u_char use_json, + int bfd_tag, int extra_space, uint8_t use_json, json_object *json_obj); extern void bfd_show_info(struct vty *vty, struct bfd_info *bfd_info, - int multihop, int extra_space, u_char use_json, + int multihop, int extra_space, uint8_t use_json, json_object *json_obj); extern void bfd_client_sendmsg(struct zclient *zclient, int command); diff --git a/lib/buffer.c b/lib/buffer.c index 191fbf875..03202f125 100644 --- a/lib/buffer.c +++ b/lib/buffer.c @@ -174,7 +174,7 @@ void buffer_put(struct buffer *b, const void *p, size_t size) } /* Insert character into the buffer. */ -void buffer_putc(struct buffer *b, u_char c) +void buffer_putc(struct buffer *b, uint8_t c) { buffer_put(b, &c, 1); } @@ -336,7 +336,7 @@ buffer_status_t buffer_flush_window(struct buffer *b, int fd, int width, "%s: growing iov array to %d; " "width %d, height %d, size %lu", __func__, iov_alloc, width, height, - (u_long)b->size); + (unsigned long)b->size); iov = XREALLOC(MTYPE_TMP, iov, iov_alloc * sizeof(*iov)); } else { @@ -456,7 +456,7 @@ in one shot. */ zlog_err( "%s: corruption detected: buffer queue empty, " "but written is %lu", - __func__, (u_long)written); + __func__, (unsigned long)written); break; } if (written < d->cp - d->sp) { diff --git a/lib/buffer.h b/lib/buffer.h index 130c677da..0c945a2ac 100644 --- a/lib/buffer.h +++ b/lib/buffer.h @@ -37,7 +37,7 @@ extern void buffer_free(struct buffer *); /* Add the given data to the end of the buffer. */ extern void buffer_put(struct buffer *, const void *, size_t); /* Add a single character to the end of the buffer. */ -extern void buffer_putc(struct buffer *, u_char); +extern void buffer_putc(struct buffer *, uint8_t); /* Add a NUL-terminated string to the end of the buffer. */ extern void buffer_putstr(struct buffer *, const char *); /* Add given data, inline-expanding \n to \r\n */ diff --git a/lib/checksum.c b/lib/checksum.c index 8eef73e24..18e385047 100644 --- a/lib/checksum.c +++ b/lib/checksum.c @@ -12,10 +12,10 @@ int /* return checksum in low-order 16 bits */ in_cksum(void *parg, int nbytes) { - u_short *ptr = parg; + unsigned short *ptr = parg; register long sum; /* assumes long == 32 bits */ - u_short oddbyte; - register u_short answer; /* assumes u_short == 16 bits */ + unsigned short oddbyte; + register unsigned short answer; /* assumes unsigned short == 16 bits */ /* * Our algorithm is simple, using a 32-bit accumulator (sum), @@ -32,7 +32,7 @@ int /* return checksum in low-order 16 bits */ /* mop up an odd byte, if necessary */ if (nbytes == 1) { oddbyte = 0; /* make sure top half is zero */ - *((u_char *)&oddbyte) = *(u_char *)ptr; /* one byte only */ + *((uint8_t *)&oddbyte) = *(uint8_t *)ptr; /* one byte only */ sum += oddbyte; } @@ -53,13 +53,13 @@ int /* return checksum in low-order 16 bits */ index required in the specification ISO 8473, Annex C.1 */ /* calling with offset == FLETCHER_CHECKSUM_VALIDATE will validate the checksum without modifying the buffer; a valid checksum returns 0 */ -u_int16_t fletcher_checksum(u_char *buffer, const size_t len, - const uint16_t offset) +uint16_t fletcher_checksum(uint8_t *buffer, const size_t len, + const uint16_t offset) { - u_int8_t *p; + uint8_t *p; int x, y, c0, c1; - u_int16_t checksum = 0; - u_int16_t *csum; + uint16_t checksum = 0; + uint16_t *csum; size_t partial_len, i, left = len; if (offset != FLETCHER_CHECKSUM_VALIDATE) @@ -67,7 +67,7 @@ u_int16_t fletcher_checksum(u_char *buffer, const size_t len, { assert(offset < (len - 1)); /* account for two bytes of checksum */ - csum = (u_int16_t *)(buffer + offset); + csum = (uint16_t *)(buffer + offset); *(csum) = 0; } diff --git a/lib/checksum.h b/lib/checksum.h index aecaaf6bc..c2764e35f 100644 --- a/lib/checksum.h +++ b/lib/checksum.h @@ -1,4 +1,4 @@ extern int in_cksum(void *, int); #define FLETCHER_CHECKSUM_VALIDATE 0xffff -extern u_int16_t fletcher_checksum(u_char *, const size_t len, - const uint16_t offset); +extern uint16_t fletcher_checksum(uint8_t *, const size_t len, + const uint16_t offset); diff --git a/lib/command_graph.c b/lib/command_graph.c index f00b12653..3e8261cb3 100644 --- a/lib/command_graph.c +++ b/lib/command_graph.c @@ -32,7 +32,7 @@ DEFINE_MTYPE_STATIC(LIB, CMD_TEXT, "Command Token Help") DEFINE_MTYPE(LIB, CMD_ARG, "Command Argument") DEFINE_MTYPE_STATIC(LIB, CMD_VAR, "Command Argument Name") -struct cmd_token *cmd_token_new(enum cmd_token_type type, u_char attr, +struct cmd_token *cmd_token_new(enum cmd_token_type type, uint8_t attr, const char *text, const char *desc) { struct cmd_token *token = @@ -198,7 +198,7 @@ static bool cmd_nodes_equal(struct graph_node *ga, struct graph_node *gb) } static void cmd_fork_bump_attr(struct graph_node *gn, struct graph_node *join, - u_char attr) + uint8_t attr) { size_t i; struct cmd_token *tok = gn->data; diff --git a/lib/filter.c b/lib/filter.c index ac7348221..5f391aa76 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -161,8 +161,8 @@ static int filter_match_cisco(struct filter *mfilter, struct prefix *p) { struct filter_cisco *filter; struct in_addr mask; - u_int32_t check_addr; - u_int32_t check_mask; + uint32_t check_addr; + uint32_t check_mask; filter = &mfilter->u.cfilter; check_addr = p->u.prefix4.s_addr & ~filter->addr_mask.s_addr; @@ -176,20 +176,20 @@ struct if_stats { /* Link Parameters for Traffic Engineering */ struct if_link_params { - u_int32_t lp_status; /* Status of Link Parameters: */ - u_int32_t te_metric; /* Traffic Engineering metric */ + uint32_t lp_status; /* Status of Link Parameters: */ + uint32_t te_metric; /* Traffic Engineering metric */ float default_bw; float max_bw; /* Maximum Bandwidth */ float max_rsv_bw; /* Maximum Reservable Bandwidth */ float unrsv_bw[MAX_CLASS_TYPE]; /* Unreserved Bandwidth per Class Type (8) */ - u_int32_t admin_grp; /* Administrative group */ - u_int32_t rmt_as; /* Remote AS number */ + uint32_t admin_grp; /* Administrative group */ + uint32_t rmt_as; /* Remote AS number */ struct in_addr rmt_ip; /* Remote IP address */ - u_int32_t av_delay; /* Link Average Delay */ - u_int32_t min_delay; /* Link Min Delay */ - u_int32_t max_delay; /* Link Max Delay */ - u_int32_t delay_var; /* Link Delay Variation */ + uint32_t av_delay; /* Link Average Delay */ + uint32_t min_delay; /* Link Min Delay */ + uint32_t max_delay; /* Link Max Delay */ + uint32_t delay_var; /* Link Delay Variation */ float pkt_loss; /* Link Packet Loss */ float res_bw; /* Residual Bandwidth */ float ava_bw; /* Available Bandwidth */ @@ -224,7 +224,7 @@ struct interface { #define IFINDEX_INTERNAL 0 /* Zebra internal interface status */ - u_char status; + uint8_t status; #define ZEBRA_INTERFACE_ACTIVE (1 << 0) #define ZEBRA_INTERFACE_SUB (1 << 1) #define ZEBRA_INTERFACE_LINKDETECTION (1 << 2) @@ -247,7 +247,7 @@ struct interface { /* Link-layer information and hardware address */ enum zebra_link_type ll_type; - u_char hw_addr[INTERFACE_HWADDR_MAX]; + uint8_t hw_addr[INTERFACE_HWADDR_MAX]; int hw_addr_len; /* interface bandwidth, kbits */ @@ -347,7 +347,7 @@ struct connected { struct interface *ifp; /* Flags for configuration. */ - u_char conf; + uint8_t conf; #define ZEBRA_IFC_REAL (1 << 0) #define ZEBRA_IFC_CONFIGURED (1 << 1) #define ZEBRA_IFC_QUEUED (1 << 2) @@ -367,7 +367,7 @@ struct connected { */ /* Flags for connected address. */ - u_char flags; + uint8_t flags; #define ZEBRA_IFA_SECONDARY (1 << 0) #define ZEBRA_IFA_PEER (1 << 1) #define ZEBRA_IFA_UNNUMBERED (1 << 2) diff --git a/lib/imsg-buffer.c b/lib/imsg-buffer.c index ba1e26820..b83f1f76f 100644 --- a/lib/imsg-buffer.c +++ b/lib/imsg-buffer.c @@ -59,7 +59,7 @@ struct ibuf *ibuf_dynamic(size_t len, size_t max) int ibuf_realloc(struct ibuf *buf, size_t len) { - u_char *b; + uint8_t *b; /* on static buffers max is eq size and so the following fails */ if (buf->wpos + len > buf->max) { diff --git a/lib/imsg.c b/lib/imsg.c index 1c2f480aa..0ea1dd630 100644 --- a/lib/imsg.c +++ b/lib/imsg.c @@ -193,8 +193,8 @@ ssize_t imsg_get(struct imsgbuf *ibuf, struct imsg *imsg) return (datalen + IMSG_HEADER_SIZE); } -int imsg_compose(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, - pid_t pid, int fd, const void *data, u_int16_t datalen) +int imsg_compose(struct imsgbuf *ibuf, uint32_t type, uint32_t peerid, + pid_t pid, int fd, const void *data, uint16_t datalen) { struct ibuf *wbuf; @@ -211,7 +211,7 @@ int imsg_compose(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, return (1); } -int imsg_composev(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, +int imsg_composev(struct imsgbuf *ibuf, uint32_t type, uint32_t peerid, pid_t pid, int fd, const struct iovec *iov, int iovcnt) { struct ibuf *wbuf; @@ -235,8 +235,8 @@ int imsg_composev(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, } /* ARGSUSED */ -struct ibuf *imsg_create(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, - pid_t pid, u_int16_t datalen) +struct ibuf *imsg_create(struct imsgbuf *ibuf, uint32_t type, uint32_t peerid, + pid_t pid, uint16_t datalen) { struct ibuf *wbuf; struct imsg_hdr hdr; @@ -261,7 +261,7 @@ struct ibuf *imsg_create(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, return (wbuf); } -int imsg_add(struct ibuf *msg, const void *data, u_int16_t datalen) +int imsg_add(struct ibuf *msg, const void *data, uint16_t datalen) { if (datalen) if (ibuf_add(msg, data, datalen) == -1) { @@ -281,7 +281,7 @@ void imsg_close(struct imsgbuf *ibuf, struct ibuf *msg) if (msg->fd != -1) hdr->flags |= IMSGF_HASFD; - hdr->len = (u_int16_t)msg->wpos; + hdr->len = (uint16_t)msg->wpos; ibuf_close(&ibuf->w, msg); } diff --git a/lib/imsg.h b/lib/imsg.h index ddaf71344..eed7074e4 100644 --- a/lib/imsg.h +++ b/lib/imsg.h @@ -27,7 +27,7 @@ struct ibuf { TAILQ_ENTRY(ibuf) entry; - u_char *buf; + uint8_t *buf; size_t size; size_t max; size_t wpos; @@ -37,13 +37,13 @@ struct ibuf { struct msgbuf { TAILQ_HEAD(, ibuf) bufs; - u_int32_t queued; + uint32_t queued; int fd; }; struct ibuf_read { - u_char buf[IBUF_READ_SIZE]; - u_char *rptr; + uint8_t buf[IBUF_READ_SIZE]; + uint8_t *rptr; size_t wpos; }; @@ -63,11 +63,11 @@ struct imsgbuf { #define IMSGF_HASFD 1 struct imsg_hdr { - u_int32_t type; - u_int16_t len; - u_int16_t flags; - u_int32_t peerid; - u_int32_t pid; + uint32_t type; + uint16_t len; + uint16_t flags; + uint32_t peerid; + uint32_t pid; }; struct imsg { @@ -97,13 +97,12 @@ void msgbuf_drain(struct msgbuf *, size_t); void imsg_init(struct imsgbuf *, int); ssize_t imsg_read(struct imsgbuf *); ssize_t imsg_get(struct imsgbuf *, struct imsg *); -int imsg_compose(struct imsgbuf *, u_int32_t, u_int32_t, pid_t, int, - const void *, u_int16_t); -int imsg_composev(struct imsgbuf *, u_int32_t, u_int32_t, pid_t, int, +int imsg_compose(struct imsgbuf *, uint32_t, uint32_t, pid_t, int, const void *, + uint16_t); +int imsg_composev(struct imsgbuf *, uint32_t, uint32_t, pid_t, int, const struct iovec *, int); -struct ibuf *imsg_create(struct imsgbuf *, u_int32_t, u_int32_t, pid_t, - u_int16_t); -int imsg_add(struct ibuf *, const void *, u_int16_t); +struct ibuf *imsg_create(struct imsgbuf *, uint32_t, uint32_t, pid_t, uint16_t); +int imsg_add(struct ibuf *, const void *, uint16_t); void imsg_close(struct imsgbuf *, struct ibuf *); void imsg_free(struct imsg *); int imsg_flush(struct imsgbuf *); diff --git a/lib/ipaddr.h b/lib/ipaddr.h index 44bde45ad..33591cb4e 100644 --- a/lib/ipaddr.h +++ b/lib/ipaddr.h @@ -37,7 +37,7 @@ enum ipaddr_type_t { struct ipaddr { enum ipaddr_type_t ipa_type; union { - u_char addr; + uint8_t addr; struct in_addr _v4_addr; struct in6_addr _v6_addr; } ip; @@ -95,7 +95,7 @@ static inline char *ipaddr2str(struct ipaddr *ip, char *buf, int size) static inline void ipv4_to_ipv4_mapped_ipv6(struct in6_addr *in6, struct in_addr in) { - u_int32_t addr_type = htonl(0xFFFF); + uint32_t addr_type = htonl(0xFFFF); memset(in6, 0, sizeof(struct in6_addr)); memcpy((char *)in6 + 8, &addr_type, sizeof(addr_type)); diff --git a/lib/jhash.c b/lib/jhash.c index b943997b1..cb6946f37 100644 --- a/lib/jhash.c +++ b/lib/jhash.c @@ -59,22 +59,22 @@ * of bytes. No alignment or length assumptions are made about * the input key. */ -u_int32_t jhash(const void *key, u_int32_t length, u_int32_t initval) +uint32_t jhash(const void *key, uint32_t length, uint32_t initval) { - u_int32_t a, b, c, len; - const u_int8_t *k = key; + uint32_t a, b, c, len; + const uint8_t *k = key; len = length; a = b = JHASH_GOLDEN_RATIO; c = initval; while (len >= 12) { - a += (k[0] + ((u_int32_t)k[1] << 8) + ((u_int32_t)k[2] << 16) - + ((u_int32_t)k[3] << 24)); - b += (k[4] + ((u_int32_t)k[5] << 8) + ((u_int32_t)k[6] << 16) - + ((u_int32_t)k[7] << 24)); - c += (k[8] + ((u_int32_t)k[9] << 8) + ((u_int32_t)k[10] << 16) - + ((u_int32_t)k[11] << 24)); + a += (k[0] + ((uint32_t)k[1] << 8) + ((uint32_t)k[2] << 16) + + ((uint32_t)k[3] << 24)); + b += (k[4] + ((uint32_t)k[5] << 8) + ((uint32_t)k[6] << 16) + + ((uint32_t)k[7] << 24)); + c += (k[8] + ((uint32_t)k[9] << 8) + ((uint32_t)k[10] << 16) + + ((uint32_t)k[11] << 24)); __jhash_mix(a, b, c); @@ -85,34 +85,34 @@ u_int32_t jhash(const void *key, u_int32_t length, u_int32_t initval) c += length; switch (len) { case 11: - c += ((u_int32_t)k[10] << 24); + c += ((uint32_t)k[10] << 24); /* fallthru */ case 10: - c += ((u_int32_t)k[9] << 16); + c += ((uint32_t)k[9] << 16); /* fallthru */ case 9: - c += ((u_int32_t)k[8] << 8); + c += ((uint32_t)k[8] << 8); /* fallthru */ case 8: - b += ((u_int32_t)k[7] << 24); + b += ((uint32_t)k[7] << 24); /* fallthru */ case 7: - b += ((u_int32_t)k[6] << 16); + b += ((uint32_t)k[6] << 16); /* fallthru */ case 6: - b += ((u_int32_t)k[5] << 8); + b += ((uint32_t)k[5] << 8); /* fallthru */ case 5: b += k[4]; /* fallthru */ case 4: - a += ((u_int32_t)k[3] << 24); + a += ((uint32_t)k[3] << 24); /* fallthru */ case 3: - a += ((u_int32_t)k[2] << 16); + a += ((uint32_t)k[2] << 16); /* fallthru */ case 2: - a += ((u_int32_t)k[1] << 8); + a += ((uint32_t)k[1] << 8); /* fallthru */ case 1: a += k[0]; @@ -123,12 +123,12 @@ u_int32_t jhash(const void *key, u_int32_t length, u_int32_t initval) return c; } -/* A special optimized version that handles 1 or more of u_int32_ts. - * The length parameter here is the number of u_int32_ts in the key. +/* A special optimized version that handles 1 or more of uint32_ts. + * The length parameter here is the number of uint32_ts in the key. */ -u_int32_t jhash2(const u_int32_t *k, u_int32_t length, u_int32_t initval) +uint32_t jhash2(const uint32_t *k, uint32_t length, uint32_t initval) { - u_int32_t a, b, c, len; + uint32_t a, b, c, len; a = b = JHASH_GOLDEN_RATIO; c = initval; @@ -165,7 +165,7 @@ u_int32_t jhash2(const u_int32_t *k, u_int32_t length, u_int32_t initval) * NOTE: In partilar the "c += length; __jhash_mix(a,b,c);" normally * done at the end is not done here. */ -u_int32_t jhash_3words(u_int32_t a, u_int32_t b, u_int32_t c, u_int32_t initval) +uint32_t jhash_3words(uint32_t a, uint32_t b, uint32_t c, uint32_t initval) { a += JHASH_GOLDEN_RATIO; b += JHASH_GOLDEN_RATIO; @@ -176,12 +176,12 @@ u_int32_t jhash_3words(u_int32_t a, u_int32_t b, u_int32_t c, u_int32_t initval) return c; } -u_int32_t jhash_2words(u_int32_t a, u_int32_t b, u_int32_t initval) +uint32_t jhash_2words(uint32_t a, uint32_t b, uint32_t initval) { return jhash_3words(a, b, 0, initval); } -u_int32_t jhash_1word(u_int32_t a, u_int32_t initval) +uint32_t jhash_1word(uint32_t a, uint32_t initval) { return jhash_3words(a, 0, 0, initval); } diff --git a/lib/jhash.h b/lib/jhash.h index 74ce6a323..f8ab4209a 100644 --- a/lib/jhash.h +++ b/lib/jhash.h @@ -24,13 +24,12 @@ * of bytes. No alignment or length assumptions are made about * the input key. */ -extern u_int32_t jhash(const void *key, u_int32_t length, u_int32_t initval); +extern uint32_t jhash(const void *key, uint32_t length, uint32_t initval); -/* A special optimized version that handles 1 or more of u_int32_ts. - * The length parameter here is the number of u_int32_ts in the key. +/* A special optimized version that handles 1 or more of uint32_ts. + * The length parameter here is the number of uint32_ts in the key. */ -extern u_int32_t jhash2(const u_int32_t *k, u_int32_t length, - u_int32_t initval); +extern uint32_t jhash2(const uint32_t *k, uint32_t length, uint32_t initval); /* A special ultra-optimized versions that knows they are hashing exactly * 3, 2 or 1 word(s). @@ -38,9 +37,9 @@ extern u_int32_t jhash2(const u_int32_t *k, u_int32_t length, * NOTE: In partilar the "c += length; __jhash_mix(a,b,c);" normally * done at the end is not done here. */ -extern u_int32_t jhash_3words(u_int32_t a, u_int32_t b, u_int32_t c, - u_int32_t initval); -extern u_int32_t jhash_2words(u_int32_t a, u_int32_t b, u_int32_t initval); -extern u_int32_t jhash_1word(u_int32_t a, u_int32_t initval); +extern uint32_t jhash_3words(uint32_t a, uint32_t b, uint32_t c, + uint32_t initval); +extern uint32_t jhash_2words(uint32_t a, uint32_t b, uint32_t initval); +extern uint32_t jhash_1word(uint32_t a, uint32_t initval); #endif /* _QUAGGA_JHASH_H */ diff --git a/lib/keychain.c b/lib/keychain.c index 39807cc7c..c3e1a6d3c 100644 --- a/lib/keychain.c +++ b/lib/keychain.c @@ -124,7 +124,7 @@ static void keychain_delete(struct keychain *keychain) keychain_free(keychain); } -static struct key *key_lookup(const struct keychain *keychain, u_int32_t index) +static struct key *key_lookup(const struct keychain *keychain, uint32_t index) { struct listnode *node; struct key *key; @@ -137,7 +137,7 @@ static struct key *key_lookup(const struct keychain *keychain, u_int32_t index) } struct key *key_lookup_for_accept(const struct keychain *keychain, - u_int32_t index) + uint32_t index) { struct listnode *node; struct key *key; @@ -197,7 +197,7 @@ struct key *key_lookup_for_send(const struct keychain *keychain) return NULL; } -static struct key *key_get(const struct keychain *keychain, u_int32_t index) +static struct key *key_get(const struct keychain *keychain, uint32_t index) { struct key *key; @@ -270,7 +270,7 @@ DEFUN_NOSH (key, int idx_number = 1; VTY_DECLVAR_CONTEXT(keychain, keychain); struct key *key; - u_int32_t index; + uint32_t index; index = strtoul(argv[idx_number]->arg, NULL, 10); key = key_get(keychain, index); @@ -289,7 +289,7 @@ DEFUN (no_key, int idx_number = 2; VTY_DECLVAR_CONTEXT(keychain, keychain); struct key *key; - u_int32_t index; + uint32_t index; index = strtoul(argv[idx_number]->arg, NULL, 10); key = key_lookup(keychain, index); @@ -469,7 +469,7 @@ static int key_lifetime_duration_set(struct vty *vty, struct key_range *krange, const char *duration_str) { time_t time_start; - u_int32_t duration; + uint32_t duration; time_start = key_str2time(stime_str, sday_str, smonth_str, syear_str); if (time_start < 0) { diff --git a/lib/keychain.h b/lib/keychain.h index ab016f35c..49da9ba45 100644 --- a/lib/keychain.h +++ b/lib/keychain.h @@ -36,11 +36,11 @@ struct key_range { time_t start; time_t end; - u_char duration; + uint8_t duration; }; struct key { - u_int32_t index; + uint32_t index; char *string; @@ -53,7 +53,7 @@ DECLARE_QOBJ_TYPE(key) extern void keychain_init(void); extern struct keychain *keychain_lookup(const char *); -extern struct key *key_lookup_for_accept(const struct keychain *, u_int32_t); +extern struct key *key_lookup_for_accept(const struct keychain *, uint32_t); extern struct key *key_match_for_accept(const struct keychain *, const char *); extern struct key *key_lookup_for_send(const struct keychain *); @@ -296,7 +296,7 @@ static char *str_append(char *dst, int len, const char *src) return dst; } -static char *num_append(char *s, int len, u_long x) +static char *num_append(char *s, int len, unsigned long x) { char buf[30]; char *t; @@ -312,7 +312,7 @@ static char *num_append(char *s, int len, u_long x) } #if defined(SA_SIGINFO) || defined(HAVE_STACK_TRACE) -static char *hex_append(char *s, int len, u_long x) +static char *hex_append(char *s, int len, unsigned long x) { char buf[30]; char *t; @@ -321,7 +321,7 @@ static char *hex_append(char *s, int len, u_long x) return str_append(s, len, "0"); *(t = &buf[sizeof(buf) - 1]) = '\0'; while (x && (t > buf)) { - u_int cc = (x % 16); + unsigned int cc = (x % 16); *--t = ((cc < 10) ? ('0' + cc) : ('a' + cc - 10)); x /= 16; } @@ -446,10 +446,10 @@ void zlog_signal(int signo, const char *action s = num_append(LOC, now); #ifdef SA_SIGINFO s = str_append(LOC, " (si_addr 0x"); - s = hex_append(LOC, (u_long)(siginfo->si_addr)); + s = hex_append(LOC, (unsigned long)(siginfo->si_addr)); if (program_counter) { s = str_append(LOC, ", PC 0x"); - s = hex_append(LOC, (u_long)program_counter); + s = hex_append(LOC, (unsigned long)program_counter); } s = str_append(LOC, "); "); #else /* SA_SIGINFO */ @@ -596,7 +596,8 @@ void zlog_backtrace_sigsafe(int priority, void *program_counter) s = str_append(LOC, "[bt "); s = num_append(LOC, i); s = str_append(LOC, "] 0x"); - s = hex_append(LOC, (u_long)(array[i])); + s = hex_append( + LOC, (unsigned long)(array[i])); } *s = '\0'; if (priority @@ -720,11 +721,11 @@ void memory_oom(size_t size, const char *name) } /* Open log stream */ -void openzlog(const char *progname, const char *protoname, u_short instance, - int syslog_flags, int syslog_facility) +void openzlog(const char *progname, const char *protoname, + unsigned short instance, int syslog_flags, int syslog_facility) { struct zlog *zl; - u_int i; + unsigned int i; zl = XCALLOC(MTYPE_ZLOG, sizeof(struct zlog)); @@ -969,9 +970,9 @@ static const struct zebra_desc_table command_types[] = { static const struct zebra_desc_table unknown = {0, "unknown", '?'}; -static const struct zebra_desc_table *zroute_lookup(u_int zroute) +static const struct zebra_desc_table *zroute_lookup(unsigned int zroute) { - u_int i; + unsigned int i; if (zroute >= array_size(route_types)) { zlog_err("unknown zebra route type: %u", zroute); @@ -992,12 +993,12 @@ static const struct zebra_desc_table *zroute_lookup(u_int zroute) return &unknown; } -const char *zebra_route_string(u_int zroute) +const char *zebra_route_string(unsigned int zroute) { return zroute_lookup(zroute)->string; } -char zebra_route_char(u_int zroute) +char zebra_route_char(unsigned int zroute) { return zroute_lookup(zroute)->chr; } diff --git a/lib/log_int.h b/lib/log_int.h index 56823fb97..a7f8be9ae 100644 --- a/lib/log_int.h +++ b/lib/log_int.h @@ -27,7 +27,7 @@ struct zlog { const char *ident; /* daemon name (first arg to openlog) */ const char *protoname; - u_short instance; + unsigned short instance; int maxlvl[ZLOG_NUM_DESTS]; /* maximum priority to send to associated logging destination */ int default_lvl; /* maxlvl to use if none is specified */ @@ -64,7 +64,7 @@ typedef struct { } md5_ctxt; extern void md5_init(md5_ctxt *); -extern void md5_loop(md5_ctxt *, const void *, u_int); +extern void md5_loop(md5_ctxt *, const void *, unsigned int); extern void md5_pad(md5_ctxt *); extern void md5_result(uint8_t *, md5_ctxt *); diff --git a/lib/mpls.h b/lib/mpls.h index 1a1819c2c..4e5c70cf8 100644 --- a/lib/mpls.h +++ b/lib/mpls.h @@ -124,8 +124,8 @@ enum lsp_types_t { /* Encode a label stack entry from fields; convert to network byte-order as * the Netlink interface expects MPLS labels to be in this format. */ -static inline mpls_lse_t mpls_lse_encode(mpls_label_t label, u_int32_t ttl, - u_int32_t exp, u_int32_t bos) +static inline mpls_lse_t mpls_lse_encode(mpls_label_t label, uint32_t ttl, + uint32_t exp, uint32_t bos) { mpls_lse_t lse; lse = htonl((label << MPLS_LS_LABEL_SHIFT) | (exp << MPLS_LS_EXP_SHIFT) @@ -139,8 +139,7 @@ static inline mpls_lse_t mpls_lse_encode(mpls_label_t label, u_int32_t ttl, * Netlink interface. */ static inline void mpls_lse_decode(mpls_lse_t lse, mpls_label_t *label, - u_int32_t *ttl, u_int32_t *exp, - u_int32_t *bos) + uint32_t *ttl, uint32_t *exp, uint32_t *bos) { mpls_lse_t local_lse; diff --git a/lib/network.c b/lib/network.c index 3f72b7141..6d3350ad4 100644 --- a/lib/network.c +++ b/lib/network.c @@ -24,7 +24,7 @@ #include "network.h" /* Read nbytes from fd and store into ptr. */ -int readn(int fd, u_char *ptr, int nbytes) +int readn(int fd, uint8_t *ptr, int nbytes) { int nleft; int nread; @@ -47,7 +47,7 @@ int readn(int fd, u_char *ptr, int nbytes) } /* Write nbytes from ptr to fd. */ -int writen(int fd, const u_char *ptr, int nbytes) +int writen(int fd, const uint8_t *ptr, int nbytes) { int nleft; int nwritten; @@ -105,12 +105,12 @@ int set_cloexec(int fd) float htonf(float host) { - u_int32_t lu1, lu2; + uint32_t lu1, lu2; float convert; - memcpy(&lu1, &host, sizeof(u_int32_t)); + memcpy(&lu1, &host, sizeof(uint32_t)); lu2 = htonl(lu1); - memcpy(&convert, &lu2, sizeof(u_int32_t)); + memcpy(&convert, &lu2, sizeof(uint32_t)); return convert; } diff --git a/lib/network.h b/lib/network.h index 4faf992bc..4703dc9b6 100644 --- a/lib/network.h +++ b/lib/network.h @@ -25,8 +25,8 @@ /* Both readn and writen are deprecated and will be removed. They are not suitable for use with non-blocking file descriptors. */ -extern int readn(int, u_char *, int); -extern int writen(int, const u_char *, int); +extern int readn(int, uint8_t *, int); +extern int writen(int, const uint8_t *, int); /* Set the file descriptor to use non-blocking I/O. Returns 0 for success, -1 on error. */ diff --git a/lib/nexthop.c b/lib/nexthop.c index fb7ccc169..b1e9582b2 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -216,7 +216,7 @@ bool nexthop_same(const struct nexthop *nh1, const struct nexthop *nh2) /* Update nexthop with label information. */ void nexthop_add_labels(struct nexthop *nexthop, enum lsp_types_t type, - u_int8_t num_labels, mpls_label_t *label) + uint8_t num_labels, mpls_label_t *label) { struct mpls_label_stack *nh_label; int i; diff --git a/lib/nexthop.h b/lib/nexthop.h index 568243d3a..036fc5b88 100644 --- a/lib/nexthop.h +++ b/lib/nexthop.h @@ -71,7 +71,7 @@ struct nexthop { enum nexthop_types_t type; - u_char flags; + uint8_t flags; #define NEXTHOP_FLAG_ACTIVE (1 << 0) /* This nexthop is alive. */ #define NEXTHOP_FLAG_FIB (1 << 1) /* FIB nexthop. */ #define NEXTHOP_FLAG_RECURSIVE (1 << 2) /* Recursive nexthop. */ @@ -114,7 +114,7 @@ struct nexthop *nexthop_new(void); void nexthop_free(struct nexthop *nexthop); void nexthops_free(struct nexthop *nexthop); -void nexthop_add_labels(struct nexthop *, enum lsp_types_t, u_int8_t, +void nexthop_add_labels(struct nexthop *, enum lsp_types_t, uint8_t, mpls_label_t *); void nexthop_del_labels(struct nexthop *); @@ -26,7 +26,7 @@ #include "linklist.h" #include "vty.h" -typedef u_int32_t ns_id_t; +typedef uint32_t ns_id_t; /* the default NS ID */ #define NS_UNKNOWN UINT32_MAX diff --git a/lib/pid_output.c b/lib/pid_output.c index 9a7307bc4..023a166f2 100644 --- a/lib/pid_output.c +++ b/lib/pid_output.c @@ -71,7 +71,8 @@ pid_t pid_output(const char *path) else if (ftruncate(fd, pidsize) < 0) zlog_err( "Could not truncate pid_file %s to %u bytes: %s", - path, (u_int)pidsize, safe_strerror(errno)); + path, (unsigned int)pidsize, + safe_strerror(errno)); } return pid; } diff --git a/lib/plist.c b/lib/plist.c index 9dd5e561a..01b55f9f1 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -1812,8 +1812,8 @@ static int config_write_prefix_afi(afi_t afi, struct vty *vty) } struct stream *prefix_bgp_orf_entry(struct stream *s, struct prefix_list *plist, - u_char init_flag, u_char permit_flag, - u_char deny_flag) + uint8_t init_flag, uint8_t permit_flag, + uint8_t deny_flag) { struct prefix_list_entry *pentry; @@ -1821,15 +1821,15 @@ struct stream *prefix_bgp_orf_entry(struct stream *s, struct prefix_list *plist, return s; for (pentry = plist->head; pentry; pentry = pentry->next) { - u_char flag = init_flag; + uint8_t flag = init_flag; struct prefix *p = &pentry->prefix; flag |= (pentry->type == PREFIX_PERMIT ? permit_flag : deny_flag); stream_putc(s, flag); - stream_putl(s, (u_int32_t)pentry->seq); - stream_putc(s, (u_char)pentry->ge); - stream_putc(s, (u_char)pentry->le); + stream_putl(s, (uint32_t)pentry->seq); + stream_putc(s, (uint8_t)pentry->ge); + stream_putc(s, (uint8_t)pentry->le); stream_put_prefix(s, p); } @@ -1893,7 +1893,7 @@ void prefix_bgp_orf_remove_all(afi_t afi, char *name) /* return prefix count */ int prefix_bgp_show_prefix_list(struct vty *vty, afi_t afi, char *name, - u_char use_json) + uint8_t use_json) { struct prefix_list *plist; struct prefix_list_entry *pentry; diff --git a/lib/plist.h b/lib/plist.h index 9662f0311..67e345a48 100644 --- a/lib/plist.h +++ b/lib/plist.h @@ -35,9 +35,9 @@ enum prefix_list_type { struct prefix_list; struct orf_prefix { - u_int32_t seq; - u_char ge; - u_char le; + uint32_t seq; + uint8_t ge; + uint8_t le; struct prefix p; }; @@ -67,10 +67,10 @@ prefix_list_apply_which_prefix(struct prefix_list *plist, struct prefix **which, extern struct prefix_list *prefix_bgp_orf_lookup(afi_t, const char *); extern struct stream *prefix_bgp_orf_entry(struct stream *, - struct prefix_list *, u_char, u_char, - u_char); + struct prefix_list *, uint8_t, + uint8_t, uint8_t); extern int prefix_bgp_orf_set(char *, afi_t, struct orf_prefix *, int, int); extern void prefix_bgp_orf_remove_all(afi_t, char *); -extern int prefix_bgp_show_prefix_list(struct vty *, afi_t, char *, u_char); +extern int prefix_bgp_show_prefix_list(struct vty *, afi_t, char *, uint8_t); #endif /* _QUAGGA_PLIST_H */ diff --git a/lib/prefix.c b/lib/prefix.c index 134403949..003ce992b 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -31,8 +31,8 @@ DEFINE_MTYPE_STATIC(LIB, PREFIX, "Prefix") /* Maskbit. */ -static const u_char maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0, - 0xf8, 0xfc, 0xfe, 0xff}; +static const uint8_t maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0, + 0xf8, 0xfc, 0xfe, 0xff}; static const struct in6_addr maskbytes6[] = { /* /0 */ {{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -441,7 +441,7 @@ int is_zero_mac(struct ethaddr *mac) return 1; } -unsigned int prefix_bit(const u_char *prefix, const u_char prefixlen) +unsigned int prefix_bit(const uint8_t *prefix, const uint8_t prefixlen) { unsigned int offset = prefixlen / 8; unsigned int shift = 7 - (prefixlen % 8); @@ -449,9 +449,9 @@ unsigned int prefix_bit(const u_char *prefix, const u_char prefixlen) return (prefix[offset] >> shift) & 1; } -unsigned int prefix6_bit(const struct in6_addr *prefix, const u_char prefixlen) +unsigned int prefix6_bit(const struct in6_addr *prefix, const uint8_t prefixlen) { - return prefix_bit((const u_char *)&prefix->s6_addr, prefixlen); + return prefix_bit((const uint8_t *)&prefix->s6_addr, prefixlen); } int str2family(const char *string) @@ -533,15 +533,15 @@ int prefix_match(const struct prefix *n, const struct prefix *p) { int offset; int shift; - const u_char *np, *pp; + const uint8_t *np, *pp; /* If n's prefix is longer than p's one return 0. */ if (n->prefixlen > p->prefixlen) return 0; /* Set both prefix's head pointer. */ - np = (const u_char *)&n->u.prefix; - pp = (const u_char *)&p->u.prefix; + np = (const uint8_t *)&n->u.prefix; + pp = (const uint8_t *)&p->u.prefix; offset = n->prefixlen / PNBBY; shift = n->prefixlen % PNBBY; @@ -562,11 +562,11 @@ int prefix_match_network_statement(const struct prefix *n, { int offset; int shift; - const u_char *np, *pp; + const uint8_t *np, *pp; /* Set both prefix's head pointer. */ - np = (const u_char *)&n->u.prefix; - pp = (const u_char *)&p->u.prefix; + np = (const uint8_t *)&n->u.prefix; + pp = (const uint8_t *)&p->u.prefix; offset = n->prefixlen / PNBBY; shift = n->prefixlen % PNBBY; @@ -659,8 +659,8 @@ int prefix_cmp(const struct prefix *p1, const struct prefix *p2) int shift; /* Set both prefix's head pointer. */ - const u_char *pp1 = (const u_char *)&p1->u.prefix; - const u_char *pp2 = (const u_char *)&p2->u.prefix; + const uint8_t *pp1 = (const uint8_t *)&p1->u.prefix; + const uint8_t *pp2 = (const uint8_t *)&p2->u.prefix; if (p1->family != p2->family || p1->prefixlen != p2->prefixlen) return 1; @@ -689,11 +689,11 @@ int prefix_common_bits(const struct prefix *p1, const struct prefix *p2) { int pos, bit; int length = 0; - u_char xor ; + uint8_t xor ; /* Set both prefix's head pointer. */ - const u_char *pp1 = (const u_char *)&p1->u.prefix; - const u_char *pp2 = (const u_char *)&p2->u.prefix; + const uint8_t *pp1 = (const uint8_t *)&p1->u.prefix; + const uint8_t *pp2 = (const uint8_t *)&p2->u.prefix; if (p1->family == AF_INET) length = IPV4_MAX_BYTELEN; @@ -787,7 +787,7 @@ int str2prefix_ipv4(const char *str, struct prefix_ipv4 *p) XFREE(MTYPE_TMP, cp); /* Get prefix length. */ - plen = (u_char)atoi(++pnt); + plen = (uint8_t)atoi(++pnt); if (plen > IPV4_MAX_PREFIXLEN) return 0; @@ -821,7 +821,7 @@ int str2prefix_eth(const char *str, struct prefix_eth *p) if (pnt) { /* Get prefix length. */ - plen = (u_char)atoi(++pnt); + plen = (uint8_t)atoi(++pnt); if (plen > 48) { ret = 0; goto done; @@ -883,7 +883,7 @@ void masklen2ip(const int masklen, struct in_addr *netmask) /* Convert IP address's netmask into integer. We assume netmask is sequential one. Argument netmask should be network byte order. */ -u_char ip_masklen(struct in_addr netmask) +uint8_t ip_masklen(struct in_addr netmask) { uint32_t tmp = ~ntohl(netmask.s_addr); if (tmp) @@ -953,7 +953,7 @@ int str2prefix_ipv6(const char *str, struct prefix_ipv6 *p) XFREE(MTYPE_TMP, cp); if (ret == 0) return 0; - plen = (u_char)atoi(++pnt); + plen = (uint8_t)atoi(++pnt); if (plen > IPV6_MAX_BITLEN) return 0; p->prefixlen = plen; @@ -964,7 +964,7 @@ int str2prefix_ipv6(const char *str, struct prefix_ipv6 *p) } /* Convert struct in6_addr netmask into integer. - * FIXME return u_char as ip_maskleni() does. */ + * FIXME return uint8_t as ip_maskleni() does. */ int ip6_masklen(struct in6_addr netmask) { int len = 0; @@ -996,14 +996,14 @@ void masklen2ip6(const int masklen, struct in6_addr *netmask) void apply_mask_ipv6(struct prefix_ipv6 *p) { - u_char *pnt; + uint8_t *pnt; int index; int offset; index = p->prefixlen / 8; if (index < 16) { - pnt = (u_char *)&p->prefix; + pnt = (uint8_t *)&p->prefix; offset = p->prefixlen % 8; pnt[index] &= maskbit[offset]; @@ -1135,7 +1135,7 @@ int str2prefix(const char *str, struct prefix *p) static const char *prefixevpn2str(const struct prefix *p, char *str, int size) { - u_char family; + uint8_t family; char buf[PREFIX2STR_BUFFER]; char buf2[ETHER_ADDR_STRLEN]; @@ -1244,7 +1244,7 @@ int all_digit(const char *str) void apply_classful_mask_ipv4(struct prefix_ipv4 *p) { - u_int32_t destination; + uint32_t destination; destination = ntohl(p->prefix.s_addr); @@ -1292,8 +1292,8 @@ int netmask_str2prefix_str(const char *net_str, const char *mask_str, { struct in_addr network; struct in_addr mask; - u_char prefixlen; - u_int32_t destination; + uint8_t prefixlen; + uint32_t destination; int ret; ret = inet_aton(net_str, &network); diff --git a/lib/prefix.h b/lib/prefix.h index 172422581..133264f99 100644 --- a/lib/prefix.h +++ b/lib/prefix.h @@ -45,7 +45,7 @@ * own to simplify internal handling */ struct ethaddr { - u_char octet[ETH_ALEN]; + uint8_t octet[ETH_ALEN]; } __attribute__((packed)); @@ -58,15 +58,15 @@ struct ethaddr { /* EVPN address (RFC 7432) */ struct evpn_addr { - u_char route_type; - u_char ip_prefix_length; + uint8_t route_type; + uint8_t ip_prefix_length; struct ethaddr mac; uint32_t eth_tag; struct ipaddr ip; #if 0 union { - u_char addr; + uint8_t addr; struct in_addr v4_addr; struct in6_addr v6_addr; } ip; @@ -108,10 +108,10 @@ struct evpn_addr { /* FRR generic prefix structure. */ struct prefix { - u_char family; - u_char prefixlen; + uint8_t family; + uint8_t prefixlen; union { - u_char prefix; + uint8_t prefix; struct in_addr prefix4; struct in6_addr prefix6; struct { @@ -119,7 +119,7 @@ struct prefix { struct in_addr adv_router; } lp; struct ethaddr prefix_eth; /* AF_ETHERNET */ - u_char val[16]; + uint8_t val[16]; uintptr_t ptr; struct evpn_addr prefix_evpn; /* AF_EVPN */ } u __attribute__((aligned(8))); @@ -127,56 +127,56 @@ struct prefix { /* IPv4 prefix structure. */ struct prefix_ipv4 { - u_char family; - u_char prefixlen; + uint8_t family; + uint8_t prefixlen; struct in_addr prefix __attribute__((aligned(8))); }; /* IPv6 prefix structure. */ struct prefix_ipv6 { - u_char family; - u_char prefixlen; + uint8_t family; + uint8_t prefixlen; struct in6_addr prefix __attribute__((aligned(8))); }; struct prefix_ls { - u_char family; - u_char prefixlen; + uint8_t family; + uint8_t prefixlen; struct in_addr id __attribute__((aligned(8))); struct in_addr adv_router; }; /* Prefix for routing distinguisher. */ struct prefix_rd { - u_char family; - u_char prefixlen; - u_char val[8] __attribute__((aligned(8))); + uint8_t family; + uint8_t prefixlen; + uint8_t val[8] __attribute__((aligned(8))); }; /* Prefix for ethernet. */ struct prefix_eth { - u_char family; - u_char prefixlen; + uint8_t family; + uint8_t prefixlen; struct ethaddr eth_addr __attribute__((aligned(8))); /* AF_ETHERNET */ }; /* EVPN prefix structure. */ struct prefix_evpn { - u_char family; - u_char prefixlen; + uint8_t family; + uint8_t prefixlen; struct evpn_addr prefix __attribute__((aligned(8))); }; /* Prefix for a generic pointer */ struct prefix_ptr { - u_char family; - u_char prefixlen; + uint8_t family; + uint8_t prefixlen; uintptr_t prefix __attribute__((aligned(8))); }; struct prefix_sg { - u_char family; - u_char prefixlen; + uint8_t family; + uint8_t prefixlen; struct in_addr src __attribute__((aligned(8))); struct in_addr grp; }; @@ -235,11 +235,11 @@ static inline void ipv4_addr_copy(struct in_addr *dst, } #define IPV4_ADDR_COPY(D,S) ipv4_addr_copy((D), (S)) -#define IPV4_NET0(a) ((((u_int32_t) (a)) & 0xff000000) == 0x00000000) -#define IPV4_NET127(a) ((((u_int32_t) (a)) & 0xff000000) == 0x7f000000) -#define IPV4_LINKLOCAL(a) ((((u_int32_t) (a)) & 0xffff0000) == 0xa9fe0000) -#define IPV4_CLASS_DE(a) ((((u_int32_t) (a)) & 0xe0000000) == 0xe0000000) -#define IPV4_MC_LINKLOCAL(a) ((((u_int32_t) (a)) & 0xffffff00) == 0xe0000000) +#define IPV4_NET0(a) ((((uint32_t)(a)) & 0xff000000) == 0x00000000) +#define IPV4_NET127(a) ((((uint32_t)(a)) & 0xff000000) == 0x7f000000) +#define IPV4_LINKLOCAL(a) ((((uint32_t)(a)) & 0xffff0000) == 0xa9fe0000) +#define IPV4_CLASS_DE(a) ((((uint32_t)(a)) & 0xe0000000) == 0xe0000000) +#define IPV4_MC_LINKLOCAL(a) ((((uint32_t)(a)) & 0xffffff00) == 0xe0000000) /* Max bit/byte length of IPv6 address. */ #define IPV6_MAX_BYTELEN 16 @@ -275,9 +275,9 @@ extern const char *safi2str(safi_t safi); extern const char *afi2str(afi_t afi); /* Check bit of the prefix. */ -extern unsigned int prefix_bit(const u_char *prefix, const u_char prefixlen); +extern unsigned int prefix_bit(const uint8_t *prefix, const uint8_t prefixlen); extern unsigned int prefix6_bit(const struct in6_addr *prefix, - const u_char prefixlen); + const uint8_t prefixlen); extern struct prefix *prefix_new(void); extern void prefix_free(struct prefix *); @@ -318,7 +318,7 @@ extern void apply_mask_ipv4(struct prefix_ipv4 *); extern int prefix_ipv4_any(const struct prefix_ipv4 *); extern void apply_classful_mask_ipv4(struct prefix_ipv4 *); -extern u_char ip_masklen(struct in_addr); +extern uint8_t ip_masklen(struct in_addr); extern void masklen2ip(const int, struct in_addr *); /* returns the network portion of the host address */ extern in_addr_t ipv4_network_addr(in_addr_t hostaddr, int masklen); diff --git a/lib/sigevent.c b/lib/sigevent.c index d55f368df..d299760fa 100644 --- a/lib/sigevent.c +++ b/lib/sigevent.c @@ -284,7 +284,7 @@ static void trap_default_signals(void) }; static const struct { const int *sigs; - u_int nsigs; + unsigned int nsigs; void (*handler)(int signo #ifdef SA_SIGINFO , @@ -296,10 +296,10 @@ static void trap_default_signals(void) {exit_signals, array_size(exit_signals), exit_handler}, {ignore_signals, array_size(ignore_signals), NULL}, }; - u_int i; + unsigned int i; for (i = 0; i < array_size(sigmap); i++) { - u_int j; + unsigned int j; for (j = 0; j < sigmap[i].nsigs; j++) { struct sigaction oact; diff --git a/lib/smux.c b/lib/smux.c index 9a0063df2..51abfccba 100644 --- a/lib/smux.c +++ b/lib/smux.c @@ -56,7 +56,7 @@ struct subtree { /* Tree's oid. */ oid name[MAX_OID_LEN]; - u_char name_len; + uint8_t name_len; /* List of the variables. */ struct variable *variables; @@ -189,11 +189,11 @@ static int smux_socket(void) } static void smux_getresp_send(oid objid[], size_t objid_len, long reqid, - long errstat, long errindex, u_char val_type, + long errstat, long errindex, uint8_t val_type, void *arg, size_t arg_len) { - u_char buf[BUFSIZ]; - u_char *ptr, *h1, *h1e, *h2, *h2e; + uint8_t buf[BUFSIZ]; + uint8_t *ptr, *h1, *h1e, *h2, *h2e; size_t len, length; ptr = buf; @@ -207,30 +207,33 @@ static void smux_getresp_send(oid objid[], size_t objid_len, long reqid, h1 = ptr; /* Place holder h1 for complete sequence */ - ptr = asn_build_sequence(ptr, &len, (u_char)SMUX_GETRSP, 0); + ptr = asn_build_sequence(ptr, &len, (uint8_t)SMUX_GETRSP, 0); h1e = ptr; - ptr = asn_build_int(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE - | ASN_INTEGER), - &reqid, sizeof(reqid)); + ptr = asn_build_int( + ptr, &len, + (uint8_t)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), &reqid, + sizeof(reqid)); if (debug_smux) zlog_debug("SMUX GETRSP errstat: %ld", errstat); - ptr = asn_build_int(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE - | ASN_INTEGER), - &errstat, sizeof(errstat)); + ptr = asn_build_int( + ptr, &len, + (uint8_t)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), + &errstat, sizeof(errstat)); if (debug_smux) zlog_debug("SMUX GETRSP errindex: %ld", errindex); - ptr = asn_build_int(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE - | ASN_INTEGER), - &errindex, sizeof(errindex)); + ptr = asn_build_int( + ptr, &len, + (uint8_t)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), + &errindex, sizeof(errindex)); h2 = ptr; /* Place holder h2 for one variable */ ptr = asn_build_sequence(ptr, &len, - (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), 0); + (uint8_t)(ASN_SEQUENCE | ASN_CONSTRUCTOR), 0); h2e = ptr; ptr = snmp_build_var_op(ptr, objid, &objid_len, val_type, arg_len, arg, @@ -238,10 +241,11 @@ static void smux_getresp_send(oid objid[], size_t objid_len, long reqid, /* Now variable size is known, fill in size */ asn_build_sequence(h2, &length, - (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), ptr - h2e); + (uint8_t)(ASN_SEQUENCE | ASN_CONSTRUCTOR), + ptr - h2e); /* Fill in size of whole sequence */ - asn_build_sequence(h1, &length, (u_char)SMUX_GETRSP, ptr - h1e); + asn_build_sequence(h1, &length, (uint8_t)SMUX_GETRSP, ptr - h1e); if (debug_smux) zlog_debug("SMUX getresp send: %td", (ptr - buf)); @@ -249,14 +253,14 @@ static void smux_getresp_send(oid objid[], size_t objid_len, long reqid, send(smux_sock, buf, (ptr - buf), 0); } -static u_char *smux_var(u_char *ptr, size_t len, oid objid[], size_t *objid_len, - size_t *var_val_len, u_char *var_val_type, - void **var_value) +static uint8_t *smux_var(uint8_t *ptr, size_t len, oid objid[], + size_t *objid_len, size_t *var_val_len, + uint8_t *var_val_type, void **var_value) { - u_char type; - u_char val_type; + uint8_t type; + uint8_t val_type; size_t val_len; - u_char *val; + uint8_t *val; if (debug_smux) zlog_debug("SMUX var parse: len %zd", len); @@ -347,7 +351,7 @@ static u_char *smux_var(u_char *ptr, size_t len, oid objid[], size_t *objid_len, ucd-snmp smux and as such suppose, that the peer receives in the message only one variable. Fortunately, IBM seems to do the same in AIX. */ -static int smux_set(oid *reqid, size_t *reqid_len, u_char val_type, void *val, +static int smux_set(oid *reqid, size_t *reqid_len, uint8_t val_type, void *val, size_t val_len, int action) { int j; @@ -357,7 +361,7 @@ static int smux_set(oid *reqid, size_t *reqid_len, u_char val_type, void *val, oid *suffix; size_t suffix_len; int result; - u_char *statP = NULL; + uint8_t *statP = NULL; WriteMethod *write_method = NULL; struct listnode *node, *nnode; @@ -414,7 +418,7 @@ static int smux_set(oid *reqid, size_t *reqid_len, u_char val_type, void *val, return SNMP_ERR_NOSUCHNAME; } -static int smux_get(oid *reqid, size_t *reqid_len, int exact, u_char *val_type, +static int smux_get(oid *reqid, size_t *reqid_len, int exact, uint8_t *val_type, void **val, size_t *val_len) { int j; @@ -481,7 +485,7 @@ static int smux_get(oid *reqid, size_t *reqid_len, int exact, u_char *val_type, } static int smux_getnext(oid *reqid, size_t *reqid_len, int exact, - u_char *val_type, void **val, size_t *val_len) + uint8_t *val_type, void **val, size_t *val_len) { int j; oid save[MAX_OID_LEN]; @@ -572,9 +576,9 @@ static int smux_getnext(oid *reqid, size_t *reqid_len, int exact, } /* GET message header. */ -static u_char *smux_parse_get_header(u_char *ptr, size_t *len, long *reqid) +static uint8_t *smux_parse_get_header(uint8_t *ptr, size_t *len, long *reqid) { - u_char type; + uint8_t type; long errstat; long errindex; @@ -600,12 +604,12 @@ static u_char *smux_parse_get_header(u_char *ptr, size_t *len, long *reqid) return ptr; } -static void smux_parse_set(u_char *ptr, size_t len, int action) +static void smux_parse_set(uint8_t *ptr, size_t len, int action) { long reqid; oid oid[MAX_OID_LEN]; size_t oid_len; - u_char val_type; + uint8_t val_type; void *val; size_t val_len; int ret; @@ -633,12 +637,12 @@ static void smux_parse_set(u_char *ptr, size_t len, int action) 0); } -static void smux_parse_get(u_char *ptr, size_t len, int exact) +static void smux_parse_get(uint8_t *ptr, size_t len, int exact) { long reqid; oid oid[MAX_OID_LEN]; size_t oid_len; - u_char val_type; + uint8_t val_type; void *val; size_t val_len; int ret; @@ -669,7 +673,7 @@ static void smux_parse_get(u_char *ptr, size_t len, int exact) } /* Parse SMUX_CLOSE message. */ -static void smux_parse_close(u_char *ptr, int len) +static void smux_parse_close(uint8_t *ptr, int len) { long reason = 0; @@ -681,9 +685,9 @@ static void smux_parse_close(u_char *ptr, int len) } /* SMUX_RRSP message. */ -static void smux_parse_rrsp(u_char *ptr, size_t len) +static void smux_parse_rrsp(uint8_t *ptr, size_t len) { - u_char val; + uint8_t val; long errstat; ptr = asn_parse_int(ptr, &len, &val, &errstat, sizeof(errstat)); @@ -693,17 +697,17 @@ static void smux_parse_rrsp(u_char *ptr, size_t len) } /* Parse SMUX message. */ -static int smux_parse(u_char *ptr, size_t len) +static int smux_parse(uint8_t *ptr, size_t len) { /* This buffer we'll use for SOUT message. We could allocate it with malloc and save only static pointer/lenght, but IMHO static buffer is a faster solusion. */ - static u_char sout_save_buff[SMUXMAXPKTSIZE]; + static uint8_t sout_save_buff[SMUXMAXPKTSIZE]; static int sout_save_len = 0; int len_income = len; /* see note below: YYY */ - u_char type; - u_char rollback; + uint8_t type; + uint8_t rollback; rollback = ptr[2]; /* important only for SMUX_SOUT */ @@ -813,7 +817,7 @@ static int smux_read(struct thread *t) { int sock; int len; - u_char buf[SMUXMAXPKTSIZE]; + uint8_t buf[SMUXMAXPKTSIZE]; int ret; /* Clear thread. */ @@ -864,8 +868,8 @@ static int smux_read(struct thread *t) static int smux_open(int sock) { - u_char buf[BUFSIZ]; - u_char *ptr; + uint8_t buf[BUFSIZ]; + uint8_t *ptr; size_t len; long version; const char progname[] = FRR_SMUX_NAME "-" FRR_VERSION; @@ -880,32 +884,36 @@ static int smux_open(int sock) len = BUFSIZ; /* SMUX Header. As placeholder. */ - ptr = asn_build_header(ptr, &len, (u_char)SMUX_OPEN, 0); + ptr = asn_build_header(ptr, &len, (uint8_t)SMUX_OPEN, 0); /* SMUX Open. */ version = 0; - ptr = asn_build_int(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE - | ASN_INTEGER), - &version, sizeof(version)); + ptr = asn_build_int( + ptr, &len, + (uint8_t)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), + &version, sizeof(version)); /* SMUX connection oid. */ - ptr = asn_build_objid(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE - | ASN_OBJECT_ID), - smux_oid, smux_oid_len); + ptr = asn_build_objid( + ptr, &len, + (uint8_t)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID), + smux_oid, smux_oid_len); /* SMUX connection description. */ - ptr = asn_build_string(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE - | ASN_OCTET_STR), - (const u_char *)progname, strlen(progname)); + ptr = asn_build_string( + ptr, &len, + (uint8_t)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR), + (const uint8_t *)progname, strlen(progname)); /* SMUX connection password. */ - ptr = asn_build_string(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE - | ASN_OCTET_STR), - (u_char *)smux_passwd, strlen(smux_passwd)); + ptr = asn_build_string( + ptr, &len, + (uint8_t)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR), + (uint8_t *)smux_passwd, strlen(smux_passwd)); /* Fill in real SMUX header. We exclude ASN header size (2). */ len = BUFSIZ; - asn_build_header(buf, &len, (u_char)SMUX_OPEN, (ptr - buf) - 2); + asn_build_header(buf, &len, (uint8_t)SMUX_OPEN, (ptr - buf) - 2); return send(sock, buf, (ptr - buf), 0); } @@ -919,15 +927,15 @@ int smux_trap(struct variable *vp, size_t vp_len, const oid *ename, size_t enamelen, const oid *name, size_t namelen, const oid *iname, size_t inamelen, const struct trap_object *trapobj, size_t trapobjlen, - u_char sptrap) + uint8_t sptrap) { unsigned int i; - u_char buf[BUFSIZ]; - u_char *ptr; + uint8_t buf[BUFSIZ]; + uint8_t *ptr; size_t len, length; struct in_addr addr; unsigned long val; - u_char *h1, *h1e; + uint8_t *h1, *h1e; ptr = buf; len = BUFSIZ; @@ -938,42 +946,46 @@ int smux_trap(struct variable *vp, size_t vp_len, const oid *ename, return 0; /* SMUX header. */ - ptr = asn_build_header(ptr, &len, (u_char)SMUX_TRAP, 0); + ptr = asn_build_header(ptr, &len, (uint8_t)SMUX_TRAP, 0); /* Sub agent enterprise oid. */ - ptr = asn_build_objid(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE - | ASN_OBJECT_ID), - smux_oid, smux_oid_len); + ptr = asn_build_objid( + ptr, &len, + (uint8_t)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID), + smux_oid, smux_oid_len); /* IP address. */ addr.s_addr = 0; - ptr = asn_build_string(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE - | ASN_IPADDRESS), - (u_char *)&addr, sizeof(addr)); + ptr = asn_build_string( + ptr, &len, + (uint8_t)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_IPADDRESS), + (uint8_t *)&addr, sizeof(addr)); /* Generic trap integer. */ val = SNMP_TRAP_ENTERPRISESPECIFIC; - ptr = asn_build_int(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE - | ASN_INTEGER), - (long *)&val, sizeof(val)); + ptr = asn_build_int( + ptr, &len, + (uint8_t)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), + (long *)&val, sizeof(val)); /* Specific trap integer. */ val = sptrap; - ptr = asn_build_int(ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE - | ASN_INTEGER), - (long *)&val, sizeof(val)); + ptr = asn_build_int( + ptr, &len, + (uint8_t)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), + (long *)&val, sizeof(val)); /* Timeticks timestamp. */ val = 0; ptr = asn_build_unsigned_int( ptr, &len, - (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_TIMETICKS), &val, + (uint8_t)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_TIMETICKS), &val, sizeof(val)); /* Variables. */ h1 = ptr; ptr = asn_build_sequence(ptr, &len, - (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), 0); + (uint8_t)(ASN_SEQUENCE | ASN_CONSTRUCTOR), 0); /* Iteration for each objects. */ @@ -984,7 +996,7 @@ int smux_trap(struct variable *vp, size_t vp_len, const oid *ename, size_t oid_len; void *val; size_t val_len; - u_char val_type; + uint8_t val_type; /* Make OID. */ if (trapobj[i].namelen > 0) { @@ -1013,7 +1025,7 @@ int smux_trap(struct variable *vp, size_t vp_len, const oid *ename, } smux_oid_dump("Trap", oid, oid_len); zlog_info("BUFSIZ: %d // oid_len: %lu", BUFSIZ, - (u_long)oid_len); + (unsigned long)oid_len); } ret = smux_get(oid, &oid_len, 1, &val_type, &val, &val_len); @@ -1028,19 +1040,20 @@ int smux_trap(struct variable *vp, size_t vp_len, const oid *ename, /* Now variable size is known, fill in size */ asn_build_sequence(h1, &length, - (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), ptr - h1e); + (uint8_t)(ASN_SEQUENCE | ASN_CONSTRUCTOR), + ptr - h1e); /* Fill in size of whole sequence */ len = BUFSIZ; - asn_build_header(buf, &len, (u_char)SMUX_TRAP, (ptr - buf) - 2); + asn_build_header(buf, &len, (uint8_t)SMUX_TRAP, (ptr - buf) - 2); return send(smux_sock, buf, (ptr - buf), 0); } static int smux_register(int sock) { - u_char buf[BUFSIZ]; - u_char *ptr; + uint8_t buf[BUFSIZ]; + uint8_t *ptr; int ret; size_t len; long priority; @@ -1055,26 +1068,26 @@ static int smux_register(int sock) len = BUFSIZ; /* SMUX RReq Header. */ - ptr = asn_build_header(ptr, &len, (u_char)SMUX_RREQ, 0); + ptr = asn_build_header(ptr, &len, (uint8_t)SMUX_RREQ, 0); /* Register MIB tree. */ - ptr = asn_build_objid( - ptr, &len, - (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID), - subtree->name, subtree->name_len); + ptr = asn_build_objid(ptr, &len, + (uint8_t)(ASN_UNIVERSAL | ASN_PRIMITIVE + | ASN_OBJECT_ID), + subtree->name, subtree->name_len); /* Priority. */ priority = -1; ptr = asn_build_int( ptr, &len, - (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), + (uint8_t)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), &priority, sizeof(priority)); /* Operation. */ operation = 2; /* Register R/W */ ptr = asn_build_int( ptr, &len, - (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), + (uint8_t)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), &operation, sizeof(operation)); if (debug_smux) { @@ -1085,7 +1098,8 @@ static int smux_register(int sock) } len = BUFSIZ; - asn_build_header(buf, &len, (u_char)SMUX_RREQ, (ptr - buf) - 2); + asn_build_header(buf, &len, (uint8_t)SMUX_RREQ, + (ptr - buf) - 2); ret = send(sock, buf, (ptr - buf), 0); if (ret < 0) return ret; diff --git a/lib/smux.h b/lib/smux.h index 987414c0d..9adfacb3e 100644 --- a/lib/smux.h +++ b/lib/smux.h @@ -59,11 +59,11 @@ struct trap_object { #define SNMP_INTEGER(V) \ (*var_len = sizeof(snmp_int_val), snmp_int_val = V, \ - (u_char *)&snmp_int_val) + (uint8_t *)&snmp_int_val) #define SNMP_IPADDRESS(V) \ (*var_len = sizeof(struct in_addr), snmp_in_addr_val = V, \ - (u_char *)&snmp_in_addr_val) + (uint8_t *)&snmp_in_addr_val) extern void smux_init(struct thread_master *tm); extern void smux_register_mib(const char *, struct variable *, size_t, int, @@ -96,7 +96,7 @@ extern int smux_header_table(struct variable *, oid *, size_t *, int, size_t *, */ extern int smux_trap(struct variable *, size_t, const oid *, size_t, const oid *, size_t, const oid *, size_t, - const struct trap_object *, size_t, u_char); + const struct trap_object *, size_t, uint8_t); extern int oid_compare(const oid *, int, const oid *, int); extern void oid2in_addr(oid[], int, struct in_addr *); diff --git a/lib/snmp.c b/lib/snmp.c index fefd7ba37..f11d9dc8c 100644 --- a/lib/snmp.c +++ b/lib/snmp.c @@ -53,12 +53,12 @@ void *oid_copy(void *dest, const void *src, size_t size) void oid2in_addr(oid oid[], int len, struct in_addr *addr) { int i; - u_char *pnt; + uint8_t *pnt; if (len == 0) return; - pnt = (u_char *)addr; + pnt = (uint8_t *)addr; for (i = 0; i < len; i++) *pnt++ = oid[i]; @@ -67,12 +67,12 @@ void oid2in_addr(oid oid[], int len, struct in_addr *addr) void oid_copy_addr(oid oid[], struct in_addr *addr, int len) { int i; - u_char *pnt; + uint8_t *pnt; if (len == 0) return; - pnt = (u_char *)addr; + pnt = (uint8_t *)addr; for (i = 0; i < len; i++) oid[i] = *pnt++; diff --git a/lib/sockopt.c b/lib/sockopt.c index d100991a3..1d8d9990d 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -56,7 +56,7 @@ void setsockopt_so_sendbuf(const int sock, int size) int getsockopt_so_sendbuf(const int sock) { - u_int32_t optval; + uint32_t optval; socklen_t optlen = sizeof(optval); int ret = getsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char *)&optval, &optlen); @@ -382,7 +382,7 @@ int setsockopt_ipv4_multicast_if(int sock, struct in_addr if_addr, #endif } -int setsockopt_ipv4_multicast_loop(int sock, u_char val) +int setsockopt_ipv4_multicast_loop(int sock, uint8_t val) { int ret; @@ -584,9 +584,9 @@ int sockopt_tcp_signature(int sock, union sockunion *su, const char *password) #define TCP_MD5_AUTH_ADD 1 #define TCP_MD5_AUTH_DEL 2 struct tcp_rfc2385_cmd { - u_int8_t command; /* Command - Add/Delete */ - u_int32_t address; /* IPV4 address associated */ - u_int8_t keylen; /* MD5 Key len (do NOT assume 0 terminated + uint8_t command; /* Command - Add/Delete */ + uint32_t address; /* IPV4 address associated */ + uint8_t keylen; /* MD5 Key len (do NOT assume 0 terminated ascii) */ void *key; /* MD5 Key */ } cmd; diff --git a/lib/sockopt.h b/lib/sockopt.h index 7be36222d..f54f60ffd 100644 --- a/lib/sockopt.h +++ b/lib/sockopt.h @@ -81,7 +81,7 @@ extern int setsockopt_ipv4_multicast(int sock, int optname, struct in_addr if_addr, unsigned int mcast_addr, ifindex_t ifindex); -extern int setsockopt_ipv4_multicast_loop(int sock, u_char val); +extern int setsockopt_ipv4_multicast_loop(int sock, uint8_t val); extern int setsockopt_ipv4_tos(int sock, int tos); diff --git a/lib/sockunion.c b/lib/sockunion.c index ab8d8be3e..28a7f647c 100644 --- a/lib/sockunion.c +++ b/lib/sockunion.c @@ -486,18 +486,18 @@ size_t sockunion_get_addrlen(const union sockunion *su) return family2addrsize(sockunion_family(su)); } -const u_char *sockunion_get_addr(const union sockunion *su) +const uint8_t *sockunion_get_addr(const union sockunion *su) { switch (sockunion_family(su)) { case AF_INET: - return (const u_char *)&su->sin.sin_addr.s_addr; + return (const uint8_t *)&su->sin.sin_addr.s_addr; case AF_INET6: - return (const u_char *)&su->sin6.sin6_addr; + return (const uint8_t *)&su->sin6.sin6_addr; } return NULL; } -void sockunion_set(union sockunion *su, int family, const u_char *addr, +void sockunion_set(union sockunion *su, int family, const uint8_t *addr, size_t bytes) { if (family2addrsize(family) != bytes) @@ -622,10 +622,10 @@ static int in6addr_cmp(const struct in6_addr *addr1, const struct in6_addr *addr2) { unsigned int i; - const u_char *p1, *p2; + const uint8_t *p1, *p2; - p1 = (const u_char *)addr1; - p2 = (const u_char *)addr2; + p1 = (const uint8_t *)addr1; + p2 = (const uint8_t *)addr2; for (i = 0; i < sizeof(struct in6_addr); i++) { if (p1[i] > p2[i]) diff --git a/lib/sockunion.h b/lib/sockunion.h index 67a7a4627..b585aee5b 100644 --- a/lib/sockunion.h +++ b/lib/sockunion.h @@ -73,8 +73,8 @@ extern unsigned int sockunion_hash(const union sockunion *); extern size_t family2addrsize(int family); extern size_t sockunion_get_addrlen(const union sockunion *); -extern const u_char *sockunion_get_addr(const union sockunion *); -extern void sockunion_set(union sockunion *, int family, const u_char *addr, +extern const uint8_t *sockunion_get_addr(const union sockunion *); +extern void sockunion_set(union sockunion *, int family, const uint8_t *addr, size_t bytes); extern union sockunion *sockunion_str2su(const char *str); diff --git a/lib/stream.c b/lib/stream.c index 3c08d4454..927a3d3d5 100644 --- a/lib/stream.c +++ b/lib/stream.c @@ -171,7 +171,7 @@ struct stream *stream_dupcat(struct stream *s1, struct stream *s2, size_t stream_resize(struct stream *s, size_t newsize) { - u_char *newdata; + uint8_t *newdata; STREAM_VERIFY_SANE(s); newdata = XREALLOC(MTYPE_STREAM_DATA, s->data, newsize); @@ -299,11 +299,11 @@ void stream_get(void *dst, struct stream *s, size_t size) } /* Get next character from the stream. */ -inline bool stream_getc2(struct stream *s, u_char *byte) +inline bool stream_getc2(struct stream *s, uint8_t *byte) { STREAM_VERIFY_SANE(s); - if (STREAM_READABLE(s) < sizeof(u_char)) { + if (STREAM_READABLE(s) < sizeof(uint8_t)) { STREAM_BOUND_WARN2(s, "get char"); return false; } @@ -312,13 +312,13 @@ inline bool stream_getc2(struct stream *s, u_char *byte) return true; } -u_char stream_getc(struct stream *s) +uint8_t stream_getc(struct stream *s) { - u_char c; + uint8_t c; STREAM_VERIFY_SANE(s); - if (STREAM_READABLE(s) < sizeof(u_char)) { + if (STREAM_READABLE(s) < sizeof(uint8_t)) { STREAM_BOUND_WARN(s, "get char"); return 0; } @@ -328,13 +328,13 @@ u_char stream_getc(struct stream *s) } /* Get next character from the stream. */ -u_char stream_getc_from(struct stream *s, size_t from) +uint8_t stream_getc_from(struct stream *s, size_t from) { - u_char c; + uint8_t c; STREAM_VERIFY_SANE(s); - if (!GETP_VALID(s, from + sizeof(u_char))) { + if (!GETP_VALID(s, from + sizeof(uint8_t))) { STREAM_BOUND_WARN(s, "get char"); return 0; } @@ -360,13 +360,13 @@ inline bool stream_getw2(struct stream *s, uint16_t *word) } /* Get next word from the stream. */ -u_int16_t stream_getw(struct stream *s) +uint16_t stream_getw(struct stream *s) { - u_int16_t w; + uint16_t w; STREAM_VERIFY_SANE(s); - if (STREAM_READABLE(s) < sizeof(u_int16_t)) { + if (STREAM_READABLE(s) < sizeof(uint16_t)) { STREAM_BOUND_WARN(s, "get "); return 0; } @@ -378,13 +378,13 @@ u_int16_t stream_getw(struct stream *s) } /* Get next word from the stream. */ -u_int16_t stream_getw_from(struct stream *s, size_t from) +uint16_t stream_getw_from(struct stream *s, size_t from) { - u_int16_t w; + uint16_t w; STREAM_VERIFY_SANE(s); - if (!GETP_VALID(s, from + sizeof(u_int16_t))) { + if (!GETP_VALID(s, from + sizeof(uint16_t))) { STREAM_BOUND_WARN(s, "get "); return 0; } @@ -396,9 +396,9 @@ u_int16_t stream_getw_from(struct stream *s, size_t from) } /* Get next 3-byte from the stream. */ -u_int32_t stream_get3_from(struct stream *s, size_t from) +uint32_t stream_get3_from(struct stream *s, size_t from) { - u_int32_t l; + uint32_t l; STREAM_VERIFY_SANE(s); @@ -414,9 +414,9 @@ u_int32_t stream_get3_from(struct stream *s, size_t from) return l; } -u_int32_t stream_get3(struct stream *s) +uint32_t stream_get3(struct stream *s) { - u_int32_t l; + uint32_t l; STREAM_VERIFY_SANE(s); @@ -433,13 +433,13 @@ u_int32_t stream_get3(struct stream *s) } /* Get next long word from the stream. */ -u_int32_t stream_getl_from(struct stream *s, size_t from) +uint32_t stream_getl_from(struct stream *s, size_t from) { - u_int32_t l; + uint32_t l; STREAM_VERIFY_SANE(s); - if (!GETP_VALID(s, from + sizeof(u_int32_t))) { + if (!GETP_VALID(s, from + sizeof(uint32_t))) { STREAM_BOUND_WARN(s, "get long"); return 0; } @@ -482,13 +482,13 @@ inline bool stream_getl2(struct stream *s, uint32_t *l) return true; } -u_int32_t stream_getl(struct stream *s) +uint32_t stream_getl(struct stream *s) { - u_int32_t l; + uint32_t l; STREAM_VERIFY_SANE(s); - if (STREAM_READABLE(s) < sizeof(u_int32_t)) { + if (STREAM_READABLE(s) < sizeof(uint32_t)) { STREAM_BOUND_WARN(s, "get long"); return 0; } @@ -549,19 +549,19 @@ uint64_t stream_getq(struct stream *s) } /* Get next long word from the stream. */ -u_int32_t stream_get_ipv4(struct stream *s) +uint32_t stream_get_ipv4(struct stream *s) { - u_int32_t l; + uint32_t l; STREAM_VERIFY_SANE(s); - if (STREAM_READABLE(s) < sizeof(u_int32_t)) { + if (STREAM_READABLE(s) < sizeof(uint32_t)) { STREAM_BOUND_WARN(s, "get ipv4"); return 0; } - memcpy(&l, s->data + s->getp, sizeof(u_int32_t)); - s->getp += sizeof(u_int32_t); + memcpy(&l, s->data + s->getp, sizeof(uint32_t)); + s->getp += sizeof(uint32_t); return l; } @@ -615,37 +615,37 @@ void stream_put(struct stream *s, const void *src, size_t size) } /* Put character to the stream. */ -int stream_putc(struct stream *s, u_char c) +int stream_putc(struct stream *s, uint8_t c) { STREAM_VERIFY_SANE(s); - if (STREAM_WRITEABLE(s) < sizeof(u_char)) { + if (STREAM_WRITEABLE(s) < sizeof(uint8_t)) { STREAM_BOUND_WARN(s, "put"); return 0; } s->data[s->endp++] = c; - return sizeof(u_char); + return sizeof(uint8_t); } /* Put word to the stream. */ -int stream_putw(struct stream *s, u_int16_t w) +int stream_putw(struct stream *s, uint16_t w) { STREAM_VERIFY_SANE(s); - if (STREAM_WRITEABLE(s) < sizeof(u_int16_t)) { + if (STREAM_WRITEABLE(s) < sizeof(uint16_t)) { STREAM_BOUND_WARN(s, "put"); return 0; } - s->data[s->endp++] = (u_char)(w >> 8); - s->data[s->endp++] = (u_char)w; + s->data[s->endp++] = (uint8_t)(w >> 8); + s->data[s->endp++] = (uint8_t)w; return 2; } /* Put long word to the stream. */ -int stream_put3(struct stream *s, u_int32_t l) +int stream_put3(struct stream *s, uint32_t l) { STREAM_VERIFY_SANE(s); @@ -654,27 +654,27 @@ int stream_put3(struct stream *s, u_int32_t l) return 0; } - s->data[s->endp++] = (u_char)(l >> 16); - s->data[s->endp++] = (u_char)(l >> 8); - s->data[s->endp++] = (u_char)l; + s->data[s->endp++] = (uint8_t)(l >> 16); + s->data[s->endp++] = (uint8_t)(l >> 8); + s->data[s->endp++] = (uint8_t)l; return 3; } /* Put long word to the stream. */ -int stream_putl(struct stream *s, u_int32_t l) +int stream_putl(struct stream *s, uint32_t l) { STREAM_VERIFY_SANE(s); - if (STREAM_WRITEABLE(s) < sizeof(u_int32_t)) { + if (STREAM_WRITEABLE(s) < sizeof(uint32_t)) { STREAM_BOUND_WARN(s, "put"); return 0; } - s->data[s->endp++] = (u_char)(l >> 24); - s->data[s->endp++] = (u_char)(l >> 16); - s->data[s->endp++] = (u_char)(l >> 8); - s->data[s->endp++] = (u_char)l; + s->data[s->endp++] = (uint8_t)(l >> 24); + s->data[s->endp++] = (uint8_t)(l >> 16); + s->data[s->endp++] = (uint8_t)(l >> 8); + s->data[s->endp++] = (uint8_t)l; return 4; } @@ -689,14 +689,14 @@ int stream_putq(struct stream *s, uint64_t q) return 0; } - s->data[s->endp++] = (u_char)(q >> 56); - s->data[s->endp++] = (u_char)(q >> 48); - s->data[s->endp++] = (u_char)(q >> 40); - s->data[s->endp++] = (u_char)(q >> 32); - s->data[s->endp++] = (u_char)(q >> 24); - s->data[s->endp++] = (u_char)(q >> 16); - s->data[s->endp++] = (u_char)(q >> 8); - s->data[s->endp++] = (u_char)q; + s->data[s->endp++] = (uint8_t)(q >> 56); + s->data[s->endp++] = (uint8_t)(q >> 48); + s->data[s->endp++] = (uint8_t)(q >> 40); + s->data[s->endp++] = (uint8_t)(q >> 32); + s->data[s->endp++] = (uint8_t)(q >> 24); + s->data[s->endp++] = (uint8_t)(q >> 16); + s->data[s->endp++] = (uint8_t)(q >> 8); + s->data[s->endp++] = (uint8_t)q; return 8; } @@ -721,11 +721,11 @@ int stream_putd(struct stream *s, double d) return stream_putq(s, u.o); } -int stream_putc_at(struct stream *s, size_t putp, u_char c) +int stream_putc_at(struct stream *s, size_t putp, uint8_t c) { STREAM_VERIFY_SANE(s); - if (!PUT_AT_VALID(s, putp + sizeof(u_char))) { + if (!PUT_AT_VALID(s, putp + sizeof(uint8_t))) { STREAM_BOUND_WARN(s, "put"); return 0; } @@ -735,22 +735,22 @@ int stream_putc_at(struct stream *s, size_t putp, u_char c) return 1; } -int stream_putw_at(struct stream *s, size_t putp, u_int16_t w) +int stream_putw_at(struct stream *s, size_t putp, uint16_t w) { STREAM_VERIFY_SANE(s); - if (!PUT_AT_VALID(s, putp + sizeof(u_int16_t))) { + if (!PUT_AT_VALID(s, putp + sizeof(uint16_t))) { STREAM_BOUND_WARN(s, "put"); return 0; } - s->data[putp] = (u_char)(w >> 8); - s->data[putp + 1] = (u_char)w; + s->data[putp] = (uint8_t)(w >> 8); + s->data[putp + 1] = (uint8_t)w; return 2; } -int stream_put3_at(struct stream *s, size_t putp, u_int32_t l) +int stream_put3_at(struct stream *s, size_t putp, uint32_t l) { STREAM_VERIFY_SANE(s); @@ -758,25 +758,25 @@ int stream_put3_at(struct stream *s, size_t putp, u_int32_t l) STREAM_BOUND_WARN(s, "put"); return 0; } - s->data[putp] = (u_char)(l >> 16); - s->data[putp + 1] = (u_char)(l >> 8); - s->data[putp + 2] = (u_char)l; + s->data[putp] = (uint8_t)(l >> 16); + s->data[putp + 1] = (uint8_t)(l >> 8); + s->data[putp + 2] = (uint8_t)l; return 3; } -int stream_putl_at(struct stream *s, size_t putp, u_int32_t l) +int stream_putl_at(struct stream *s, size_t putp, uint32_t l) { STREAM_VERIFY_SANE(s); - if (!PUT_AT_VALID(s, putp + sizeof(u_int32_t))) { + if (!PUT_AT_VALID(s, putp + sizeof(uint32_t))) { STREAM_BOUND_WARN(s, "put"); return 0; } - s->data[putp] = (u_char)(l >> 24); - s->data[putp + 1] = (u_char)(l >> 16); - s->data[putp + 2] = (u_char)(l >> 8); - s->data[putp + 3] = (u_char)l; + s->data[putp] = (uint8_t)(l >> 24); + s->data[putp + 1] = (uint8_t)(l >> 16); + s->data[putp + 2] = (uint8_t)(l >> 8); + s->data[putp + 3] = (uint8_t)l; return 4; } @@ -789,31 +789,31 @@ int stream_putq_at(struct stream *s, size_t putp, uint64_t q) STREAM_BOUND_WARN(s, "put"); return 0; } - s->data[putp] = (u_char)(q >> 56); - s->data[putp + 1] = (u_char)(q >> 48); - s->data[putp + 2] = (u_char)(q >> 40); - s->data[putp + 3] = (u_char)(q >> 32); - s->data[putp + 4] = (u_char)(q >> 24); - s->data[putp + 5] = (u_char)(q >> 16); - s->data[putp + 6] = (u_char)(q >> 8); - s->data[putp + 7] = (u_char)q; + s->data[putp] = (uint8_t)(q >> 56); + s->data[putp + 1] = (uint8_t)(q >> 48); + s->data[putp + 2] = (uint8_t)(q >> 40); + s->data[putp + 3] = (uint8_t)(q >> 32); + s->data[putp + 4] = (uint8_t)(q >> 24); + s->data[putp + 5] = (uint8_t)(q >> 16); + s->data[putp + 6] = (uint8_t)(q >> 8); + s->data[putp + 7] = (uint8_t)q; return 8; } /* Put long word to the stream. */ -int stream_put_ipv4(struct stream *s, u_int32_t l) +int stream_put_ipv4(struct stream *s, uint32_t l) { STREAM_VERIFY_SANE(s); - if (STREAM_WRITEABLE(s) < sizeof(u_int32_t)) { + if (STREAM_WRITEABLE(s) < sizeof(uint32_t)) { STREAM_BOUND_WARN(s, "put"); return 0; } - memcpy(s->data + s->endp, &l, sizeof(u_int32_t)); - s->endp += sizeof(u_int32_t); + memcpy(s->data + s->endp, &l, sizeof(uint32_t)); + s->endp += sizeof(uint32_t); - return sizeof(u_int32_t); + return sizeof(uint32_t); } /* Put long word to the stream. */ @@ -821,15 +821,15 @@ int stream_put_in_addr(struct stream *s, struct in_addr *addr) { STREAM_VERIFY_SANE(s); - if (STREAM_WRITEABLE(s) < sizeof(u_int32_t)) { + if (STREAM_WRITEABLE(s) < sizeof(uint32_t)) { STREAM_BOUND_WARN(s, "put"); return 0; } - memcpy(s->data + s->endp, addr, sizeof(u_int32_t)); - s->endp += sizeof(u_int32_t); + memcpy(s->data + s->endp, addr, sizeof(uint32_t)); + s->endp += sizeof(uint32_t); - return sizeof(u_int32_t); + return sizeof(uint32_t); } /* Put in_addr at location in the stream. */ @@ -862,7 +862,7 @@ int stream_put_in6_addr_at(struct stream *s, size_t putp, struct in6_addr *addr) /* Put prefix by nlri type format. */ int stream_put_prefix_addpath(struct stream *s, struct prefix *p, - int addpath_encode, u_int32_t addpath_tx_id) + int addpath_encode, uint32_t addpath_tx_id) { size_t psize; size_t psize_with_addpath; @@ -876,16 +876,16 @@ int stream_put_prefix_addpath(struct stream *s, struct prefix *p, else psize_with_addpath = psize; - if (STREAM_WRITEABLE(s) < (psize_with_addpath + sizeof(u_char))) { + if (STREAM_WRITEABLE(s) < (psize_with_addpath + sizeof(uint8_t))) { STREAM_BOUND_WARN(s, "put"); return 0; } if (addpath_encode) { - s->data[s->endp++] = (u_char)(addpath_tx_id >> 24); - s->data[s->endp++] = (u_char)(addpath_tx_id >> 16); - s->data[s->endp++] = (u_char)(addpath_tx_id >> 8); - s->data[s->endp++] = (u_char)addpath_tx_id; + s->data[s->endp++] = (uint8_t)(addpath_tx_id >> 24); + s->data[s->endp++] = (uint8_t)(addpath_tx_id >> 16); + s->data[s->endp++] = (uint8_t)(addpath_tx_id >> 8); + s->data[s->endp++] = (uint8_t)addpath_tx_id; } s->data[s->endp++] = p->prefixlen; @@ -905,7 +905,7 @@ int stream_put_labeled_prefix(struct stream *s, struct prefix *p, mpls_label_t *label) { size_t psize; - u_char *label_pnt = (u_char *)label; + uint8_t *label_pnt = (uint8_t *)label; STREAM_VERIFY_SANE(s); @@ -1060,7 +1060,7 @@ size_t stream_write(struct stream *s, const void *ptr, size_t size) * Use stream_get_pnt_to if you must, but decoding streams properly * is preferred */ -u_char *stream_pnt(struct stream *s) +uint8_t *stream_pnt(struct stream *s) { STREAM_VERIFY_SANE(s); return s->data + s->getp; diff --git a/lib/stream.h b/lib/stream.h index e738040d3..8011fc096 100644 --- a/lib/stream.h +++ b/lib/stream.h @@ -148,7 +148,7 @@ extern size_t stream_resize(struct stream *, size_t); extern size_t stream_get_getp(struct stream *); extern size_t stream_get_endp(struct stream *); extern size_t stream_get_size(struct stream *); -extern u_char *stream_get_data(struct stream *); +extern uint8_t *stream_get_data(struct stream *); /** * Create a new stream structure; copy offset bytes from s1 to the new @@ -165,43 +165,43 @@ extern void stream_forward_endp(struct stream *, size_t); /* steam_put: NULL source zeroes out size_t bytes of stream */ extern void stream_put(struct stream *, const void *, size_t); -extern int stream_putc(struct stream *, u_char); -extern int stream_putc_at(struct stream *, size_t, u_char); -extern int stream_putw(struct stream *, u_int16_t); -extern int stream_putw_at(struct stream *, size_t, u_int16_t); -extern int stream_put3(struct stream *, u_int32_t); -extern int stream_put3_at(struct stream *, size_t, u_int32_t); -extern int stream_putl(struct stream *, u_int32_t); -extern int stream_putl_at(struct stream *, size_t, u_int32_t); +extern int stream_putc(struct stream *, uint8_t); +extern int stream_putc_at(struct stream *, size_t, uint8_t); +extern int stream_putw(struct stream *, uint16_t); +extern int stream_putw_at(struct stream *, size_t, uint16_t); +extern int stream_put3(struct stream *, uint32_t); +extern int stream_put3_at(struct stream *, size_t, uint32_t); +extern int stream_putl(struct stream *, uint32_t); +extern int stream_putl_at(struct stream *, size_t, uint32_t); extern int stream_putq(struct stream *, uint64_t); extern int stream_putq_at(struct stream *, size_t, uint64_t); -extern int stream_put_ipv4(struct stream *, u_int32_t); +extern int stream_put_ipv4(struct stream *, uint32_t); extern int stream_put_in_addr(struct stream *, struct in_addr *); extern int stream_put_in_addr_at(struct stream *, size_t, struct in_addr *); extern int stream_put_in6_addr_at(struct stream *, size_t, struct in6_addr *); extern int stream_put_prefix_addpath(struct stream *, struct prefix *, int addpath_encode, - u_int32_t addpath_tx_id); + uint32_t addpath_tx_id); extern int stream_put_prefix(struct stream *, struct prefix *); extern int stream_put_labeled_prefix(struct stream *, struct prefix *, mpls_label_t *); extern void stream_get(void *, struct stream *, size_t); extern bool stream_get2(void *data, struct stream *s, size_t size); extern void stream_get_from(void *, struct stream *, size_t, size_t); -extern u_char stream_getc(struct stream *); -extern bool stream_getc2(struct stream *s, u_char *byte); -extern u_char stream_getc_from(struct stream *, size_t); -extern u_int16_t stream_getw(struct stream *); +extern uint8_t stream_getc(struct stream *); +extern bool stream_getc2(struct stream *s, uint8_t *byte); +extern uint8_t stream_getc_from(struct stream *, size_t); +extern uint16_t stream_getw(struct stream *); extern bool stream_getw2(struct stream *s, uint16_t *word); -extern u_int16_t stream_getw_from(struct stream *, size_t); -extern u_int32_t stream_get3(struct stream *); -extern u_int32_t stream_get3_from(struct stream *, size_t); -extern u_int32_t stream_getl(struct stream *); +extern uint16_t stream_getw_from(struct stream *, size_t); +extern uint32_t stream_get3(struct stream *); +extern uint32_t stream_get3_from(struct stream *, size_t); +extern uint32_t stream_getl(struct stream *); extern bool stream_getl2(struct stream *s, uint32_t *l); -extern u_int32_t stream_getl_from(struct stream *, size_t); +extern uint32_t stream_getl_from(struct stream *, size_t); extern uint64_t stream_getq(struct stream *); extern uint64_t stream_getq_from(struct stream *, size_t); -extern u_int32_t stream_get_ipv4(struct stream *); +extern uint32_t stream_get_ipv4(struct stream *); /* IEEE-754 floats */ extern float stream_getf(struct stream *); @@ -238,7 +238,7 @@ extern int stream_flush(struct stream *, int); extern int stream_empty(struct stream *); /* is the stream empty? */ /* deprecated */ -extern u_char *stream_pnt(struct stream *); +extern uint8_t *stream_pnt(struct stream *); /* Stream fifo. */ extern struct stream_fifo *stream_fifo_new(void); diff --git a/lib/table.c b/lib/table.c index 76062cd10..bf63609bc 100644 --- a/lib/table.c +++ b/lib/table.c @@ -142,20 +142,20 @@ static void route_table_free(struct route_table *rt) } /* Utility mask array. */ -static const u_char maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0, - 0xf8, 0xfc, 0xfe, 0xff}; +static const uint8_t maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0, + 0xf8, 0xfc, 0xfe, 0xff}; /* Common prefix route genaration. */ static void route_common(const struct prefix *n, const struct prefix *p, struct prefix *new) { int i; - u_char diff; - u_char mask; + uint8_t diff; + uint8_t mask; - const u_char *np = (const u_char *)&n->u.prefix; - const u_char *pp = (const u_char *)&p->u.prefix; - u_char *newp = (u_char *)&new->u.prefix; + const uint8_t *np = (const uint8_t *)&n->u.prefix; + const uint8_t *pp = (const uint8_t *)&p->u.prefix; + uint8_t *newp = (uint8_t *)&new->u.prefix; for (i = 0; i < p->prefixlen / 8; i++) { if (np[i] == pp[i]) @@ -277,8 +277,8 @@ struct route_node *route_node_get(struct route_table *const table, struct route_node *node; struct route_node *match; struct route_node *inserted; - u_char prefixlen = p->prefixlen; - const u_char *prefix = &p->u.prefix; + uint8_t prefixlen = p->prefixlen; + const uint8_t *prefix = &p->u.prefix; apply_mask((struct prefix *)p); node = hash_get(table->hash, (void *)p, NULL); diff --git a/lib/thread.c b/lib/thread.c index d26be1541..f3129e39e 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -621,7 +621,7 @@ struct timeval thread_timer_remain(struct thread *thread) } /* Get new thread. */ -static struct thread *thread_get(struct thread_master *m, u_char type, +static struct thread *thread_get(struct thread_master *m, uint8_t type, int (*func)(struct thread *), void *arg, debugargdef) { diff --git a/lib/vlan.h b/lib/vlan.h index 5e735aac1..6d15e62df 100644 --- a/lib/vlan.h +++ b/lib/vlan.h @@ -23,7 +23,7 @@ #define __VLAN_H__ /* VLAN Identifier */ -typedef u_int16_t vlanid_t; +typedef uint16_t vlanid_t; #define VLANID_MAX 4095 #endif /* __VLAN_H__ */ @@ -343,10 +343,11 @@ void *vrf_info_lookup(vrf_id_t vrf_id) #define VRF_BITMAP_BIT_OFFSET(_id) ((_id) % VRF_BITMAP_NUM_OF_BITS_IN_GROUP) #define VRF_BITMAP_INDEX_IN_GROUP(_bit_offset) ((_bit_offset) / CHAR_BIT) -#define VRF_BITMAP_FLAG(_bit_offset) (((u_char)1) << ((_bit_offset) % CHAR_BIT)) +#define VRF_BITMAP_FLAG(_bit_offset) \ + (((uint8_t)1) << ((_bit_offset) % CHAR_BIT)) struct vrf_bitmap { - u_char *groups[VRF_BITMAP_NUM_OF_GROUPS]; + uint8_t *groups[VRF_BITMAP_NUM_OF_GROUPS]; }; vrf_bitmap_t vrf_bitmap_init(void) @@ -373,8 +374,8 @@ void vrf_bitmap_free(vrf_bitmap_t bmap) void vrf_bitmap_set(vrf_bitmap_t bmap, vrf_id_t vrf_id) { struct vrf_bitmap *bm = (struct vrf_bitmap *)bmap; - u_char group = VRF_BITMAP_GROUP(vrf_id); - u_char offset = VRF_BITMAP_BIT_OFFSET(vrf_id); + uint8_t group = VRF_BITMAP_GROUP(vrf_id); + uint8_t offset = VRF_BITMAP_BIT_OFFSET(vrf_id); if (bmap == VRF_BITMAP_NULL || vrf_id == VRF_UNKNOWN) return; @@ -390,8 +391,8 @@ void vrf_bitmap_set(vrf_bitmap_t bmap, vrf_id_t vrf_id) void vrf_bitmap_unset(vrf_bitmap_t bmap, vrf_id_t vrf_id) { struct vrf_bitmap *bm = (struct vrf_bitmap *)bmap; - u_char group = VRF_BITMAP_GROUP(vrf_id); - u_char offset = VRF_BITMAP_BIT_OFFSET(vrf_id); + uint8_t group = VRF_BITMAP_GROUP(vrf_id); + uint8_t offset = VRF_BITMAP_BIT_OFFSET(vrf_id); if (bmap == VRF_BITMAP_NULL || vrf_id == VRF_UNKNOWN || bm->groups[group] == NULL) @@ -404,8 +405,8 @@ void vrf_bitmap_unset(vrf_bitmap_t bmap, vrf_id_t vrf_id) int vrf_bitmap_check(vrf_bitmap_t bmap, vrf_id_t vrf_id) { struct vrf_bitmap *bm = (struct vrf_bitmap *)bmap; - u_char group = VRF_BITMAP_GROUP(vrf_id); - u_char offset = VRF_BITMAP_BIT_OFFSET(vrf_id); + uint8_t group = VRF_BITMAP_GROUP(vrf_id); + uint8_t offset = VRF_BITMAP_BIT_OFFSET(vrf_id); if (bmap == VRF_BITMAP_NULL || vrf_id == VRF_UNKNOWN || bm->groups[group] == NULL) @@ -73,7 +73,7 @@ struct vrf { char name[VRF_NAMSIZ + 1]; /* Zebra internal VRF status */ - u_char status; + uint8_t status; #define VRF_ACTIVE (1 << 0) /* VRF is up in kernel */ #define VRF_CONFIGURED (1 << 1) /* VRF has some FRR configuration */ @@ -160,9 +160,9 @@ int vty_out(struct vty *vty, const char *format, ...) /* Pointer p must point out buffer. */ if (vty->type != VTY_TERM) - buffer_put(vty->obuf, (u_char *)p, len); + buffer_put(vty->obuf, (uint8_t *)p, len); else - buffer_put_crlf(vty->obuf, (u_char *)p, len); + buffer_put_crlf(vty->obuf, (uint8_t *)p, len); /* If p is not different with buf, it is allocated buffer. */ if (p != buf) @@ -1243,12 +1243,12 @@ static int vty_telnet_option(struct vty *vty, unsigned char *buf, int nbytes) "RFC 1073 violation detected: telnet NAWS option " "should send %d characters, but we received %lu", TELNET_NAWS_SB_LEN, - (u_long)vty->sb_len); + (unsigned long)vty->sb_len); else if (sizeof(vty->sb_buf) < TELNET_NAWS_SB_LEN) zlog_err( "Bug detected: sizeof(vty->sb_buf) %lu < %d, " "too small to handle the telnet NAWS option", - (u_long)sizeof(vty->sb_buf), + (unsigned long)sizeof(vty->sb_buf), TELNET_NAWS_SB_LEN); else { vty->width = ((vty->sb_buf[1] << 8) @@ -2057,7 +2057,7 @@ static int vtysh_read(struct thread *thread) struct vty *vty; unsigned char buf[VTY_READ_BUFSIZ]; unsigned char *p; - u_char header[4] = {0, 0, 0, 0}; + uint8_t header[4] = {0, 0, 0, 0}; sock = THREAD_FD(thread); vty = THREAD_ARG(thread); diff --git a/lib/vxlan.h b/lib/vxlan.h index 75c7b9734..ba3dbb05c 100644 --- a/lib/vxlan.h +++ b/lib/vxlan.h @@ -23,7 +23,7 @@ #define __VXLAN_H__ /* VxLAN Network Identifier - 24-bit (RFC 7348) */ -typedef u_int32_t vni_t; +typedef uint32_t vni_t; #define VNI_MAX 16777215 /* (2^24 - 1) */ #endif /* __VXLAN_H__ */ diff --git a/lib/workqueue.h b/lib/workqueue.h index c9785de09..fe1700f8d 100644 --- a/lib/workqueue.h +++ b/lib/workqueue.h @@ -106,7 +106,7 @@ struct work_queue { } cycles; /* cycle counts */ /* private state */ - u_int16_t flags; /* user set flag */ + uint16_t flags; /* user set flag */ }; /* User API */ diff --git a/lib/zclient.c b/lib/zclient.c index 2cac71ac4..4659bce1b 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -88,10 +88,11 @@ void zclient_free(struct zclient *zclient) XFREE(MTYPE_ZCLIENT, zclient); } -u_short *redist_check_instance(struct redist_proto *red, u_short instance) +unsigned short *redist_check_instance(struct redist_proto *red, + unsigned short instance) { struct listnode *node; - u_short *id; + unsigned short *id; if (!red->instances) return NULL; @@ -103,23 +104,23 @@ u_short *redist_check_instance(struct redist_proto *red, u_short instance) return NULL; } -void redist_add_instance(struct redist_proto *red, u_short instance) +void redist_add_instance(struct redist_proto *red, unsigned short instance) { - u_short *in; + unsigned short *in; red->enabled = 1; if (!red->instances) red->instances = list_new(); - in = XMALLOC(MTYPE_REDIST_INST, sizeof(u_short)); + in = XMALLOC(MTYPE_REDIST_INST, sizeof(unsigned short)); *in = instance; listnode_add(red->instances, in); } -void redist_del_instance(struct redist_proto *red, u_short instance) +void redist_del_instance(struct redist_proto *red, unsigned short instance) { - u_short *id; + unsigned short *id; id = redist_check_instance(red, instance); if (!id) @@ -294,9 +295,9 @@ void zclient_create_header(struct stream *s, uint16_t command, vrf_id_t vrf_id) stream_putw(s, command); } -int zclient_read_header(struct stream *s, int sock, u_int16_t *size, - u_char *marker, u_char *version, vrf_id_t *vrf_id, - u_int16_t *cmd) +int zclient_read_header(struct stream *s, int sock, uint16_t *size, + uint8_t *marker, uint8_t *version, vrf_id_t *vrf_id, + uint16_t *cmd) { if (stream_read(s, sock, ZEBRA_HEADER_SIZE) != ZEBRA_HEADER_SIZE) return -1; @@ -423,7 +424,7 @@ void zclient_send_reg_requests(struct zclient *zclient, vrf_id_t vrf_id) continue; struct listnode *node; - u_short *id; + unsigned short *id; for (ALL_LIST_ELEMENTS_RO( zclient->mi_redist[afi][i] @@ -488,7 +489,7 @@ void zclient_send_dereg_requests(struct zclient *zclient, vrf_id_t vrf_id) continue; struct listnode *node; - u_short *id; + unsigned short *id; for (ALL_LIST_ELEMENTS_RO( zclient->mi_redist[afi][i] @@ -594,8 +595,8 @@ int zclient_start(struct zclient *zclient) /* Initialize zebra client. Argument redist_default is unwanted redistribute route type. */ -void zclient_init(struct zclient *zclient, int redist_default, u_short instance, - struct zebra_privs_t *privs) +void zclient_init(struct zclient *zclient, int redist_default, + unsigned short instance, struct zebra_privs_t *privs) { int afi, i; @@ -730,7 +731,7 @@ int zclient_send_rnh(struct zclient *zclient, int command, struct prefix *p, * * XXX: No attention paid to alignment. */ -int zapi_ipv4_route(u_char cmd, struct zclient *zclient, struct prefix_ipv4 *p, +int zapi_ipv4_route(uint8_t cmd, struct zclient *zclient, struct prefix_ipv4 *p, struct zapi_ipv4 *api) { int i; @@ -765,7 +766,7 @@ int zapi_ipv4_route(u_char cmd, struct zclient *zclient, struct prefix_ipv4 *p, /* Put prefix information. */ psize = PSIZE(p->prefixlen); stream_putc(s, p->prefixlen); - stream_write(s, (u_char *)&p->prefix, psize); + stream_write(s, (uint8_t *)&p->prefix, psize); /* Nexthop, ifindex, distance and metric information. */ if (CHECK_FLAG(api->message, ZAPI_MESSAGE_NEXTHOP)) { @@ -800,7 +801,7 @@ int zapi_ipv4_route(u_char cmd, struct zclient *zclient, struct prefix_ipv4 *p, return zclient_send_message(zclient); } -int zapi_ipv4_route_ipv6_nexthop(u_char cmd, struct zclient *zclient, +int zapi_ipv4_route_ipv6_nexthop(uint8_t cmd, struct zclient *zclient, struct prefix_ipv4 *p, struct zapi_ipv6 *api) { int i; @@ -835,7 +836,7 @@ int zapi_ipv4_route_ipv6_nexthop(u_char cmd, struct zclient *zclient, /* Put prefix information. */ psize = PSIZE(p->prefixlen); stream_putc(s, p->prefixlen); - stream_write(s, (u_char *)&p->prefix, psize); + stream_write(s, (uint8_t *)&p->prefix, psize); /* Nexthop, ifindex, distance and metric information. */ if (CHECK_FLAG(api->message, ZAPI_MESSAGE_NEXTHOP)) { @@ -843,7 +844,7 @@ int zapi_ipv4_route_ipv6_nexthop(u_char cmd, struct zclient *zclient, for (i = 0; i < api->nexthop_num; i++) { stream_putc(s, NEXTHOP_TYPE_IPV6); - stream_write(s, (u_char *)api->nexthop[i], 16); + stream_write(s, (uint8_t *)api->nexthop[i], 16); /* For labeled-unicast, each nexthop is followed by * label. */ if (CHECK_FLAG(api->message, ZAPI_MESSAGE_LABEL)) @@ -870,7 +871,7 @@ int zapi_ipv4_route_ipv6_nexthop(u_char cmd, struct zclient *zclient, return zclient_send_message(zclient); } -int zapi_ipv6_route(u_char cmd, struct zclient *zclient, struct prefix_ipv6 *p, +int zapi_ipv6_route(uint8_t cmd, struct zclient *zclient, struct prefix_ipv6 *p, struct prefix_ipv6 *src_p, struct zapi_ipv6 *api) { int i; @@ -909,12 +910,12 @@ int zapi_ipv6_route(u_char cmd, struct zclient *zclient, struct prefix_ipv6 *p, /* Put prefix information. */ psize = PSIZE(p->prefixlen); stream_putc(s, p->prefixlen); - stream_write(s, (u_char *)&p->prefix, psize); + stream_write(s, (uint8_t *)&p->prefix, psize); if (CHECK_FLAG(api->message, ZAPI_MESSAGE_SRCPFX)) { psize = PSIZE(src_p->prefixlen); stream_putc(s, src_p->prefixlen); - stream_write(s, (u_char *)&src_p->prefix, psize); + stream_write(s, (uint8_t *)&src_p->prefix, psize); } /* Nexthop, ifindex, distance and metric information. */ @@ -923,7 +924,7 @@ int zapi_ipv6_route(u_char cmd, struct zclient *zclient, struct prefix_ipv6 *p, for (i = 0; i < api->nexthop_num; i++) { stream_putc(s, NEXTHOP_TYPE_IPV6); - stream_write(s, (u_char *)api->nexthop[i], 16); + stream_write(s, (uint8_t *)api->nexthop[i], 16); /* For labeled-unicast, each nexthop is followed by * label. */ if (CHECK_FLAG(api->message, ZAPI_MESSAGE_LABEL)) @@ -950,7 +951,7 @@ int zapi_ipv6_route(u_char cmd, struct zclient *zclient, struct prefix_ipv6 *p, return zclient_send_message(zclient); } -int zclient_route_send(u_char cmd, struct zclient *zclient, +int zclient_route_send(uint8_t cmd, struct zclient *zclient, struct zapi_route *api) { if (zapi_route_encode(cmd, zclient->obuf, api) < 0) @@ -958,7 +959,7 @@ int zclient_route_send(u_char cmd, struct zclient *zclient, return zclient_send_message(zclient); } -int zapi_route_encode(u_char cmd, struct stream *s, struct zapi_route *api) +int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api) { struct zapi_nexthop *api_nh; int i; @@ -979,12 +980,12 @@ int zapi_route_encode(u_char cmd, struct stream *s, struct zapi_route *api) stream_putc(s, api->prefix.family); psize = PSIZE(api->prefix.prefixlen); stream_putc(s, api->prefix.prefixlen); - stream_write(s, (u_char *)&api->prefix.u.prefix, psize); + stream_write(s, (uint8_t *)&api->prefix.u.prefix, psize); if (CHECK_FLAG(api->message, ZAPI_MESSAGE_SRCPFX)) { psize = PSIZE(api->src_prefix.prefixlen); stream_putc(s, api->src_prefix.prefixlen); - stream_write(s, (u_char *)&api->src_prefix.prefix, psize); + stream_write(s, (uint8_t *)&api->src_prefix.prefix, psize); } /* Nexthops. */ @@ -1023,11 +1024,11 @@ int zapi_route_encode(u_char cmd, struct stream *s, struct zapi_route *api) stream_putl(s, api_nh->ifindex); break; case NEXTHOP_TYPE_IPV6: - stream_write(s, (u_char *)&api_nh->gate.ipv6, + stream_write(s, (uint8_t *)&api_nh->gate.ipv6, 16); break; case NEXTHOP_TYPE_IPV6_IFINDEX: - stream_write(s, (u_char *)&api_nh->gate.ipv6, + stream_write(s, (uint8_t *)&api_nh->gate.ipv6, 16); stream_putl(s, api_nh->ifindex); break; @@ -1364,7 +1365,7 @@ stream_failure: * sending client */ int zebra_redistribute_send(int command, struct zclient *zclient, afi_t afi, - int type, u_short instance, vrf_id_t vrf_id) + int type, unsigned short instance, vrf_id_t vrf_id) { struct stream *s; @@ -1385,7 +1386,7 @@ int zebra_redistribute_send(int command, struct zclient *zclient, afi_t afi, static void zclient_stream_get_prefix(struct stream *s, struct prefix *p) { size_t plen = prefix_blen(p); - u_char c; + uint8_t c; p->prefixlen = 0; if (plen == 0) @@ -1597,7 +1598,7 @@ struct interface *zebra_interface_link_params_read(struct stream *s) void zebra_interface_if_set_value(struct stream *s, struct interface *ifp) { - u_char link_params_status = 0; + uint8_t link_params_status = 0; /* Read interface's index. */ if_set_index(ifp, stream_getl(s)); @@ -1700,7 +1701,7 @@ size_t zebra_interface_link_params_write(struct stream *s, static int memconstant(const void *s, int c, size_t n) { - const u_char *p = s; + const uint8_t *p = s; while (n-- > 0) if (*p++ != c) @@ -1717,7 +1718,7 @@ struct connected *zebra_interface_address_read(int type, struct stream *s, struct connected *ifc; struct prefix p, d, *dp; int plen; - u_char ifc_flags; + uint8_t ifc_flags; memset(&p, 0, sizeof(p)); memset(&d, 0, sizeof(d)); @@ -1882,14 +1883,14 @@ struct interface *zebra_interface_vrf_update_read(struct stream *s, /* filter unwanted messages until the expected one arrives */ static int zclient_read_sync_response(struct zclient *zclient, - u_int16_t expected_cmd) + uint16_t expected_cmd) { struct stream *s; - u_int16_t size = -1; - u_char marker; - u_char version; + uint16_t size = -1; + uint8_t marker; + uint8_t version; vrf_id_t vrf_id; - u_int16_t cmd; + uint16_t cmd; fd_set readfds; int ret; @@ -1932,7 +1933,7 @@ int lm_label_manager_connect(struct zclient *zclient) { int ret; struct stream *s; - u_char result; + uint8_t result; if (zclient_debug) zlog_debug("Connecting to Label Manager"); @@ -1999,12 +2000,12 @@ int lm_label_manager_connect(struct zclient *zclient) * @param end To write last assigned chunk label to * @result 0 on success, -1 otherwise */ -int lm_get_label_chunk(struct zclient *zclient, u_char keep, +int lm_get_label_chunk(struct zclient *zclient, uint8_t keep, uint32_t chunk_size, uint32_t *start, uint32_t *end) { int ret; struct stream *s; - u_char response_keep; + uint8_t response_keep; if (zclient_debug) zlog_debug("Getting Label Chunk"); @@ -2144,7 +2145,7 @@ int zebra_send_pw(struct zclient *zclient, int command, struct zapi_pw *pw) stream_put_in_addr(s, &pw->nexthop.ipv4); break; case AF_INET6: - stream_write(s, (u_char *)&pw->nexthop.ipv6, 16); + stream_write(s, (uint8_t *)&pw->nexthop.ipv6, 16); break; default: zlog_err("%s: unknown af", __func__); @@ -2247,7 +2248,8 @@ static int zclient_read(struct thread *thread) struct stream *ns; zlog_warn( "%s: message size %u exceeds buffer size %lu, expanding...", - __func__, length, (u_long)STREAM_SIZE(zclient->ibuf)); + __func__, length, + (unsigned long)STREAM_SIZE(zclient->ibuf)); ns = stream_new(length); stream_copy(ns, zclient->ibuf); stream_free(zclient->ibuf); @@ -2452,7 +2454,7 @@ static int zclient_read(struct thread *thread) } void zclient_redistribute(int command, struct zclient *zclient, afi_t afi, - int type, u_short instance, vrf_id_t vrf_id) + int type, unsigned short instance, vrf_id_t vrf_id) { if (instance) { diff --git a/lib/zclient.h b/lib/zclient.h index 803348844..b51c51846 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -135,7 +135,7 @@ typedef enum { } zebra_message_types_t; struct redist_proto { - u_char enabled; + uint8_t enabled; struct list *instances; }; @@ -173,8 +173,8 @@ struct zclient { struct thread *t_write; /* Redistribute information. */ - u_char redist_default; /* clients protocol */ - u_short instance; + uint8_t redist_default; /* clients protocol */ + unsigned short instance; struct redist_proto mi_redist[AFI_MAX][ZEBRA_ROUTE_MAX]; vrf_bitmap_t redist[AFI_MAX][ZEBRA_ROUTE_MAX]; @@ -270,12 +270,12 @@ struct zapi_nexthop { * to encode/decode. */ struct zapi_route { - u_char type; - u_short instance; + uint8_t type; + unsigned short instance; - u_int32_t flags; + uint32_t flags; - u_char message; + uint8_t message; /* * This is an enum but we are going to treat it as a uint8_t @@ -286,16 +286,16 @@ struct zapi_route { struct prefix prefix; struct prefix_ipv6 src_prefix; - u_int16_t nexthop_num; + uint16_t nexthop_num; struct zapi_nexthop nexthops[MULTIPATH_NUM]; - u_char distance; + uint8_t distance; - u_int32_t metric; + uint32_t metric; route_tag_t tag; - u_int32_t mtu; + uint32_t mtu; vrf_id_t vrf_id; @@ -306,31 +306,31 @@ struct zapi_route { /* Zebra IPv4 route message API. */ struct zapi_ipv4 { - u_char type; - u_short instance; + uint8_t type; + unsigned short instance; - u_int32_t flags; + uint32_t flags; - u_char message; + uint8_t message; safi_t safi; - u_char nexthop_num; + uint8_t nexthop_num; struct in_addr **nexthop; - u_char ifindex_num; + uint8_t ifindex_num; ifindex_t *ifindex; - u_char label_num; + uint8_t label_num; unsigned int *label; - u_char distance; + uint8_t distance; - u_int32_t metric; + uint32_t metric; route_tag_t tag; - u_int32_t mtu; + uint32_t mtu; vrf_id_t vrf_id; }; @@ -394,7 +394,7 @@ extern struct zclient *zclient_new_notify(struct thread_master *m, zclient_new_notify((A), &zclient_options_default); \ CPP_WARN("Please transition to using zclient_new_notify"); -extern void zclient_init(struct zclient *, int, u_short, +extern void zclient_init(struct zclient *, int, unsigned short, struct zebra_privs_t *privs); extern int zclient_start(struct zclient *); extern void zclient_stop(struct zclient *); @@ -403,9 +403,10 @@ extern void zclient_free(struct zclient *); extern int zclient_socket_connect(struct zclient *); -extern u_short *redist_check_instance(struct redist_proto *, u_short); -extern void redist_add_instance(struct redist_proto *, u_short); -extern void redist_del_instance(struct redist_proto *, u_short); +extern unsigned short *redist_check_instance(struct redist_proto *, + unsigned short); +extern void redist_add_instance(struct redist_proto *, unsigned short); +extern void redist_del_instance(struct redist_proto *, unsigned short); /* * Send to zebra that the specified vrf is using label to resolve @@ -434,11 +435,12 @@ extern void zclient_send_interface_radv_req(struct zclient *zclient, /* Send redistribute command to zebra daemon. Do not update zclient state. */ extern int zebra_redistribute_send(int command, struct zclient *, afi_t, - int type, u_short instance, vrf_id_t vrf_id); + int type, unsigned short instance, + vrf_id_t vrf_id); /* If state has changed, update state and call zebra_redistribute_send. */ extern void zclient_redistribute(int command, struct zclient *, afi_t, int type, - u_short instance, vrf_id_t vrf_id); + unsigned short instance, vrf_id_t vrf_id); /* If state has changed, update state and send the command to zebra. */ extern void zclient_redistribute_default(int command, struct zclient *, @@ -483,9 +485,9 @@ extern void zclient_create_header(struct stream *, uint16_t, vrf_id_t); * - a marker mismatch was detected * - header size field specified more data than could be read */ -extern int zclient_read_header(struct stream *s, int sock, u_int16_t *size, - u_char *marker, u_char *version, - vrf_id_t *vrf_id, u_int16_t *cmd); +extern int zclient_read_header(struct stream *s, int sock, uint16_t *size, + uint8_t *marker, uint8_t *version, + vrf_id_t *vrf_id, uint16_t *cmd); /* * Parse header from ZAPI message stream into struct zmsghdr. * This function assumes the stream getp points at the first byte of the header. @@ -524,14 +526,14 @@ CPP_NOTICE("zapi_ipv4_route, zapi_ipv6_route, zapi_ipv4_route_ipv6_nexthop as we #endif /* clang-format on */ -extern int zapi_ipv4_route(u_char, struct zclient *, struct prefix_ipv4 *, +extern int zapi_ipv4_route(uint8_t, struct zclient *, struct prefix_ipv4 *, struct zapi_ipv4 *) __attribute__((deprecated)); extern struct interface *zebra_interface_link_params_read(struct stream *); extern size_t zebra_interface_link_params_write(struct stream *, struct interface *); extern int lm_label_manager_connect(struct zclient *zclient); -extern int lm_get_label_chunk(struct zclient *zclient, u_char keep, +extern int lm_get_label_chunk(struct zclient *zclient, uint8_t keep, uint32_t chunk_size, uint32_t *start, uint32_t *end); extern int lm_release_label_chunk(struct zclient *zclient, uint32_t start, @@ -545,47 +547,47 @@ extern void zebra_read_pw_status_update(int command, struct zclient *zclient, /* IPv6 prefix add and delete function prototype. */ struct zapi_ipv6 { - u_char type; - u_short instance; + uint8_t type; + unsigned short instance; - u_int32_t flags; + uint32_t flags; - u_char message; + uint8_t message; safi_t safi; - u_char nexthop_num; + uint8_t nexthop_num; struct in6_addr **nexthop; - u_char ifindex_num; + uint8_t ifindex_num; ifindex_t *ifindex; - u_char label_num; + uint8_t label_num; unsigned int *label; - u_char distance; + uint8_t distance; - u_int32_t metric; + uint32_t metric; route_tag_t tag; - u_int32_t mtu; + uint32_t mtu; vrf_id_t vrf_id; }; -extern int zapi_ipv6_route(u_char cmd, struct zclient *zclient, +extern int zapi_ipv6_route(uint8_t cmd, struct zclient *zclient, struct prefix_ipv6 *p, struct prefix_ipv6 *src_p, struct zapi_ipv6 *api) __attribute__((deprecated)); -extern int zapi_ipv4_route_ipv6_nexthop(u_char, struct zclient *, +extern int zapi_ipv4_route_ipv6_nexthop(uint8_t, struct zclient *, struct prefix_ipv4 *, struct zapi_ipv6 *) __attribute__((deprecated)); -extern int zclient_route_send(u_char, struct zclient *, struct zapi_route *); +extern int zclient_route_send(uint8_t, struct zclient *, struct zapi_route *); extern int zclient_send_rnh(struct zclient *zclient, int command, struct prefix *p, bool exact_match, vrf_id_t vrf_id); -extern int zapi_route_encode(u_char, struct stream *, struct zapi_route *); +extern int zapi_route_encode(uint8_t, struct stream *, struct zapi_route *); extern int zapi_route_decode(struct stream *, struct zapi_route *); bool zapi_route_notify_decode(struct stream *s, struct prefix *p, uint32_t *tableid, diff --git a/lib/zebra.h b/lib/zebra.h index 923f6f77c..ec530397b 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -27,9 +27,9 @@ #ifdef SUNOS_5 #define _XPG4_2 -typedef unsigned int u_int32_t; -typedef unsigned short u_int16_t; -typedef unsigned char u_int8_t; +typedef unsigned int uint32_t; +typedef unsigned short uint16_t; +typedef unsigned char uint8_t; #endif /* SUNOS_5 */ #include <unistd.h> @@ -494,8 +494,8 @@ typedef enum { ((atomic_store_explicit(PV, 0, memory_order_seq_cst))) /* Zebra types. Used in Zserv message header. */ -typedef u_int16_t zebra_size_t; -typedef u_int16_t zebra_command_t; +typedef uint16_t zebra_size_t; +typedef uint16_t zebra_command_t; /* VRF ID type. */ typedef uint32_t vrf_id_t; diff --git a/nhrpd/nhrp_interface.c b/nhrpd/nhrp_interface.c index fba045dae..054a375cb 100644 --- a/nhrpd/nhrp_interface.c +++ b/nhrpd/nhrp_interface.c @@ -134,7 +134,7 @@ static void nhrp_interface_update_nbma(struct interface *ifp) debugf(NHRP_DEBUG_IF, "%s: GRE: %x %x %x", ifp->name, nifp->grekey, nifp->linkidx, saddr.s_addr); if (saddr.s_addr) - sockunion_set(&nbma, AF_INET, (u_char *)&saddr.s_addr, + sockunion_set(&nbma, AF_INET, (uint8_t *)&saddr.s_addr, sizeof(saddr.s_addr)); else if (!nbmaifp && nifp->linkidx != IFINDEX_INTERNAL) nbmaifp = diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c index 7ffb80724..163f2dbff 100644 --- a/ospf6d/ospf6_abr.c +++ b/ospf6d/ospf6_abr.c @@ -152,7 +152,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, struct ospf6_inter_prefix_lsa *prefix_lsa; struct ospf6_inter_router_lsa *router_lsa; struct ospf6_route_table *summary_table = NULL; - u_int16_t type; + uint16_t type; char buf[PREFIX2STR_BUFFER]; int is_debug = 0; @@ -506,11 +506,11 @@ void ospf6_abr_range_reset_cost(struct ospf6 *ospf6) OSPF6_ABR_RANGE_CLEAR_COST(range); } -static inline u_int32_t ospf6_abr_range_compute_cost(struct ospf6_route *range, - struct ospf6 *o) +static inline uint32_t ospf6_abr_range_compute_cost(struct ospf6_route *range, + struct ospf6 *o) { struct ospf6_route *ro; - u_int32_t cost = 0; + uint32_t cost = 0; for (ro = ospf6_route_match_head(&range->prefix, o->route_table); ro; ro = ospf6_route_match_next(&range->prefix, ro)) { @@ -524,7 +524,7 @@ static inline u_int32_t ospf6_abr_range_compute_cost(struct ospf6_route *range, } static inline int -ospf6_abr_range_summary_needs_update(struct ospf6_route *range, u_int32_t cost) +ospf6_abr_range_summary_needs_update(struct ospf6_route *range, uint32_t cost) { int redo_summary = 0; @@ -560,7 +560,7 @@ ospf6_abr_range_summary_needs_update(struct ospf6_route *range, u_int32_t cost) static void ospf6_abr_range_update(struct ospf6_route *range) { - u_int32_t cost = 0; + uint32_t cost = 0; struct listnode *node, *nnode; struct ospf6_area *oa; int summary_orig = 0; @@ -686,11 +686,11 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) struct ospf6_route_table *table = NULL; struct ospf6_route *range, *route, *old = NULL; struct ospf6_route *abr_entry; - u_char type = 0; + uint8_t type = 0; char options[3] = {0, 0, 0}; - u_int8_t prefix_options = 0; - u_int32_t cost = 0; - u_char router_bits = 0; + uint8_t prefix_options = 0; + uint32_t cost = 0; + uint8_t router_bits = 0; char buf[PREFIX2STR_BUFFER]; int is_debug = 0; struct ospf6_inter_prefix_lsa *prefix_lsa = NULL; @@ -933,11 +933,11 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) } } -void ospf6_abr_examin_brouter(u_int32_t router_id) +void ospf6_abr_examin_brouter(uint32_t router_id) { struct ospf6_lsa *lsa; struct ospf6_area *oa; - u_int16_t type; + uint16_t type; if (ospf6_is_router_abr(ospf6)) oa = ospf6->backbone; @@ -964,7 +964,7 @@ void ospf6_abr_examin_brouter(u_int32_t router_id) void ospf6_abr_reimport(struct ospf6_area *oa) { struct ospf6_lsa *lsa; - u_int16_t type; + uint16_t type; type = htons(OSPF6_LSTYPE_INTER_ROUTER); for (ALL_LSDB_TYPED(oa->lsdb, type, lsa)) @@ -1025,7 +1025,7 @@ static int ospf6_inter_area_prefix_lsa_show(struct vty *vty, lsa->header); vty_out(vty, " Metric: %lu\n", - (u_long)OSPF6_ABR_SUMMARY_METRIC(prefix_lsa)); + (unsigned long)OSPF6_ABR_SUMMARY_METRIC(prefix_lsa)); ospf6_prefix_options_printbuf(prefix_lsa->prefix.prefix_options, buf, sizeof(buf)); @@ -1069,7 +1069,7 @@ static int ospf6_inter_area_router_lsa_show(struct vty *vty, ospf6_options_printbuf(router_lsa->options, buf, sizeof(buf)); vty_out(vty, " Options: %s\n", buf); vty_out(vty, " Metric: %lu\n", - (u_long)OSPF6_ABR_SUMMARY_METRIC(router_lsa)); + (unsigned long)OSPF6_ABR_SUMMARY_METRIC(router_lsa)); inet_ntop(AF_INET, &router_lsa->router_id, buf, sizeof(buf)); vty_out(vty, " Destination Router ID: %s\n", buf); diff --git a/ospf6d/ospf6_abr.h b/ospf6d/ospf6_abr.h index 61a6a7342..abc383463 100644 --- a/ospf6d/ospf6_abr.h +++ b/ospf6d/ospf6_abr.h @@ -35,17 +35,17 @@ extern unsigned char conf_debug_ospf6_abr; /* Inter-Area-Prefix-LSA */ #define OSPF6_INTER_PREFIX_LSA_MIN_SIZE 4U /* w/o IPv6 prefix */ struct ospf6_inter_prefix_lsa { - u_int32_t metric; + uint32_t metric; struct ospf6_prefix prefix; }; /* Inter-Area-Router-LSA */ #define OSPF6_INTER_ROUTER_LSA_FIX_SIZE 12U struct ospf6_inter_router_lsa { - u_char mbz; - u_char options[3]; - u_int32_t metric; - u_int32_t router_id; + uint8_t mbz; + uint8_t options[3]; + uint32_t metric; + uint32_t router_id; }; #define OSPF6_ABR_SUMMARY_METRIC(E) (ntohl ((E)->metric & htonl (0x00ffffff))) @@ -68,7 +68,7 @@ extern void ospf6_abr_originate_summary(struct ospf6_route *route); extern void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa); extern void ospf6_abr_defaults_to_stub(struct ospf6 *); -extern void ospf6_abr_examin_brouter(u_int32_t router_id); +extern void ospf6_abr_examin_brouter(uint32_t router_id); extern void ospf6_abr_reimport(struct ospf6_area *oa); extern void ospf6_abr_range_reset_cost(struct ospf6 *ospf6); extern void ospf6_abr_prefix_resummarize(struct ospf6 *ospf6); diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index 0a7280603..2cab69aac 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -199,7 +199,7 @@ static void ospf6_area_no_summary_unset(struct ospf6 *ospf6, * @param o - ospf6 instance * @param df - display format for area ID */ -struct ospf6_area *ospf6_area_create(u_int32_t area_id, struct ospf6 *o, int df) +struct ospf6_area *ospf6_area_create(uint32_t area_id, struct ospf6 *o, int df) { struct ospf6_area *oa; @@ -298,7 +298,7 @@ void ospf6_area_delete(struct ospf6_area *oa) XFREE(MTYPE_OSPF6_AREA, oa); } -struct ospf6_area *ospf6_area_lookup(u_int32_t area_id, struct ospf6 *ospf6) +struct ospf6_area *ospf6_area_lookup(uint32_t area_id, struct ospf6 *ospf6) { struct ospf6_area *oa; struct listnode *n; @@ -384,7 +384,7 @@ void ospf6_area_show(struct vty *vty, struct ospf6_area *oa) #define OSPF6_CMD_AREA_GET(str, oa) \ { \ char *ep; \ - u_int32_t area_id = htonl(strtoul(str, &ep, 10)); \ + uint32_t area_id = htonl(strtoul(str, &ep, 10)); \ if (*ep && inet_pton(AF_INET, str, &area_id) != 1) { \ vty_out(vty, "Malformed Area-ID: %s\n", str); \ return CMD_SUCCESS; \ @@ -416,7 +416,7 @@ DEFUN (area_range, struct ospf6_area *oa; struct prefix prefix; struct ospf6_route *range; - u_int32_t cost = OSPF_AREA_RANGE_COST_UNSPEC; + uint32_t cost = OSPF_AREA_RANGE_COST_UNSPEC; OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, oa); @@ -810,7 +810,7 @@ DEFUN (show_ipv6_ospf6_area_spf_tree, "Show SPF tree\n") { int idx_ipv4 = 4; - u_int32_t area_id; + uint32_t area_id; struct ospf6_area *oa; struct ospf6_vertex *root; struct ospf6_route *route; @@ -856,12 +856,12 @@ DEFUN (show_ipv6_ospf6_simulate_spf_tree_root, { int idx_ipv4 = 5; int idx_ipv4_2 = 7; - u_int32_t area_id; + uint32_t area_id; struct ospf6_area *oa; struct ospf6_vertex *root; struct ospf6_route *route; struct prefix prefix; - u_int32_t router_id; + uint32_t router_id; struct ospf6_route_table *spf_table; unsigned char tmp_debug_ospf6_spf = 0; diff --git a/ospf6d/ospf6_area.h b/ospf6d/ospf6_area.h index a44a432a0..eaf3e5c6d 100644 --- a/ospf6d/ospf6_area.h +++ b/ospf6d/ospf6_area.h @@ -28,7 +28,7 @@ struct ospf6_area { struct ospf6 *ospf6; /* Area-ID */ - u_int32_t area_id; + uint32_t area_id; #define OSPF6_AREA_FMT_DOTTEDQUAD 1 #define OSPF6_AREA_FMT_DECIMAL 2 @@ -36,10 +36,10 @@ struct ospf6_area { char name[16]; /* flag */ - u_char flag; + uint8_t flag; /* OSPF Option */ - u_char options[3]; + uint8_t options[3]; /* Summary routes to be originated (includes Configured Address Ranges) */ @@ -60,11 +60,11 @@ struct ospf6_area { struct ospf6_route_table *spf_table; struct ospf6_route_table *route_table; - u_int32_t spf_calculation; /* SPF calculation count */ + uint32_t spf_calculation; /* SPF calculation count */ struct thread *thread_router_lsa; struct thread *thread_intra_prefix_lsa; - u_int32_t router_lsa_size_limit; + uint32_t router_lsa_size_limit; /* Area announce list */ struct { @@ -117,9 +117,9 @@ struct ospf6_area { /* prototypes */ extern int ospf6_area_cmp(void *va, void *vb); -extern struct ospf6_area *ospf6_area_create(u_int32_t, struct ospf6 *, int); +extern struct ospf6_area *ospf6_area_create(uint32_t, struct ospf6 *, int); extern void ospf6_area_delete(struct ospf6_area *); -extern struct ospf6_area *ospf6_area_lookup(u_int32_t, struct ospf6 *); +extern struct ospf6_area *ospf6_area_lookup(uint32_t, struct ospf6 *); extern void ospf6_area_enable(struct ospf6_area *); extern void ospf6_area_disable(struct ospf6_area *); diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index cd930f6c0..1b46b9c68 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -813,8 +813,8 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa, void ospf6_asbr_lsentry_add(struct ospf6_route *asbr_entry) { struct ospf6_lsa *lsa; - u_int16_t type; - u_int32_t router; + uint16_t type; + uint32_t router; if (!CHECK_FLAG(asbr_entry->flag, OSPF6_ROUTE_BEST)) { char buf[16]; @@ -835,8 +835,8 @@ void ospf6_asbr_lsentry_add(struct ospf6_route *asbr_entry) void ospf6_asbr_lsentry_remove(struct ospf6_route *asbr_entry) { struct ospf6_lsa *lsa; - u_int16_t type; - u_int32_t router; + uint16_t type; + uint32_t router; type = htons(OSPF6_LSTYPE_AS_EXTERNAL); router = ospf6_linkstate_prefix_adv_router(&asbr_entry->prefix); @@ -997,7 +997,8 @@ void ospf6_asbr_send_externals_to_area(struct ospf6_area *oa) } void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, - struct prefix *prefix, u_int nexthop_num, + struct prefix *prefix, + unsigned int nexthop_num, struct in6_addr *nexthop, route_tag_t tag) { int ret; @@ -1486,7 +1487,7 @@ ospf6_routemap_rule_set_metric(void *rule, struct prefix *prefix, static void *ospf6_routemap_rule_set_metric_compile(const char *arg) { - u_int32_t metric; + uint32_t metric; char *endp; metric = strtoul(arg, &endp, 0); if (metric > OSPF_LS_INFINITY || *endp != '\0') @@ -1740,7 +1741,7 @@ static int ospf6_as_external_lsa_show(struct vty *vty, struct ospf6_lsa *lsa) vty_out(vty, " Bits: %s\n", buf); vty_out(vty, " Metric: %5lu\n", - (u_long)OSPF6_ASBR_METRIC(external)); + (unsigned long)OSPF6_ASBR_METRIC(external)); ospf6_prefix_options_printbuf(external->prefix.prefix_options, buf, sizeof(buf)); @@ -1773,7 +1774,7 @@ static void ospf6_asbr_external_route_show(struct vty *vty, { struct ospf6_external_info *info = route->route_option; char prefix[PREFIX2STR_BUFFER], id[16], forwarding[64]; - u_int32_t tmp_id; + uint32_t tmp_id; prefix2str(&route->prefix, prefix, sizeof(prefix)); tmp_id = ntohl(info->id); @@ -1788,8 +1789,9 @@ static void ospf6_asbr_external_route_show(struct vty *vty, vty_out(vty, "%c %-32s %-15s type-%d %5lu %s\n", zebra_route_char(info->type), prefix, id, route->path.metric_type, - (u_long)(route->path.metric_type == 2 ? route->path.u.cost_e2 - : route->path.cost), + (unsigned long)(route->path.metric_type == 2 + ? route->path.u.cost_e2 + : route->path.cost), forwarding); } diff --git a/ospf6d/ospf6_asbr.h b/ospf6d/ospf6_asbr.h index bd160a645..9890ef061 100644 --- a/ospf6d/ospf6_asbr.h +++ b/ospf6d/ospf6_asbr.h @@ -39,7 +39,7 @@ struct ospf6_external_info { int type; /* Originating Link State ID */ - u_int32_t id; + uint32_t id; struct in6_addr forwarding; @@ -51,7 +51,7 @@ struct ospf6_external_info { /* AS-External-LSA */ #define OSPF6_AS_EXTERNAL_LSA_MIN_SIZE 4U /* w/o IPv6 prefix */ struct ospf6_as_external_lsa { - u_int32_t bits_metric; + uint32_t bits_metric; struct ospf6_prefix prefix; /* followed by none or one forwarding address */ @@ -79,7 +79,7 @@ extern void ospf6_asbr_lsentry_remove(struct ospf6_route *asbr_entry); extern int ospf6_asbr_is_asbr(struct ospf6 *o); extern void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, struct prefix *prefix, - u_int nexthop_num, + unsigned int nexthop_num, struct in6_addr *nexthop, route_tag_t tag); extern void ospf6_asbr_redistribute_remove(int type, ifindex_t ifindex, diff --git a/ospf6d/ospf6_bfd.c b/ospf6d/ospf6_bfd.c index e28af9d06..795512136 100644 --- a/ospf6d/ospf6_bfd.c +++ b/ospf6d/ospf6_bfd.c @@ -295,8 +295,8 @@ void ospf6_bfd_write_config(struct vty *vty, struct ospf6_interface *oi) * ospf6_bfd_if_param_set - Set the configured BFD paramter values for * interface. */ -static void ospf6_bfd_if_param_set(struct ospf6_interface *oi, u_int32_t min_rx, - u_int32_t min_tx, u_int8_t detect_mult, +static void ospf6_bfd_if_param_set(struct ospf6_interface *oi, uint32_t min_rx, + uint32_t min_tx, uint8_t detect_mult, int defaults) { int command = 0; @@ -344,9 +344,9 @@ DEFUN (ipv6_ospf6_bfd_param, int idx_number_2 = 4; int idx_number_3 = 5; struct ospf6_interface *oi; - 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/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 852429221..7c60749d7 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -101,7 +101,7 @@ static void ospf6_interface_lsdb_hook_remove(struct ospf6_lsa *lsa) ospf6_interface_lsdb_hook(lsa, ospf6_lsremove_to_spf_reason(lsa)); } -static u_char ospf6_default_iftype(struct interface *ifp) +static uint8_t ospf6_default_iftype(struct interface *ifp) { if (if_is_pointopoint(ifp)) return OSPF_IFTYPE_POINTOPOINT; @@ -111,11 +111,11 @@ static u_char ospf6_default_iftype(struct interface *ifp) return OSPF_IFTYPE_BROADCAST; } -static u_int32_t ospf6_interface_get_cost(struct ospf6_interface *oi) +static uint32_t ospf6_interface_get_cost(struct ospf6_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; /* interface speed and bw can be 0 in some platforms, * use ospf default bw. If bw is configured then it would @@ -134,7 +134,7 @@ static u_int32_t ospf6_interface_get_cost(struct ospf6_interface *oi) if (CHECK_FLAG(oi->flag, OSPF6_INTERFACE_NOAUTOCOST)) cost = oi->cost; 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 > UINT32_MAX) @@ -161,7 +161,7 @@ static void ospf6_interface_force_recalculate_cost(struct ospf6_interface *oi) static void ospf6_interface_recalculate_cost(struct ospf6_interface *oi) { - u_int32_t newcost; + uint32_t newcost; newcost = ospf6_interface_get_cost(oi); if (newcost == oi->cost) @@ -494,10 +494,10 @@ void ospf6_interface_connected_route_update(struct interface *ifp) OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB(oi->area); } -static void ospf6_interface_state_change(u_char next_state, +static void ospf6_interface_state_change(uint8_t next_state, struct ospf6_interface *oi) { - u_char prev_state; + uint8_t prev_state; prev_state = oi->state; oi->state = next_state; @@ -610,12 +610,12 @@ static struct ospf6_neighbor *better_drouter(struct ospf6_neighbor *a, return a; } -static u_char dr_election(struct ospf6_interface *oi) +static uint8_t dr_election(struct ospf6_interface *oi) { struct listnode *node, *nnode; struct ospf6_neighbor *on, *drouter, *bdrouter, myself; struct ospf6_neighbor *best_drouter, *best_bdrouter; - u_char next_state = 0; + uint8_t next_state = 0; drouter = bdrouter = NULL; best_drouter = best_bdrouter = NULL; @@ -1346,7 +1346,7 @@ DEFUN (auto_cost_reference_bandwidth, struct ospf6_area *oa; struct ospf6_interface *oi; struct listnode *i, *j; - u_int32_t refbw; + uint32_t refbw; refbw = strtol(argv[idx_number]->arg, NULL, 10); if (refbw < 1 || refbw > 4294967) { diff --git a/ospf6d/ospf6_interface.h b/ospf6d/ospf6_interface.h index 9b9952beb..553e89a22 100644 --- a/ospf6d/ospf6_interface.h +++ b/ospf6d/ospf6_interface.h @@ -48,50 +48,50 @@ struct ospf6_interface { /* Interface ID; use interface->ifindex */ /* ospf6 instance id */ - u_char instance_id; + uint8_t instance_id; /* I/F transmission delay */ - u_int32_t transdelay; + uint32_t transdelay; /* Network Type */ - u_char type; + uint8_t type; /* Router Priority */ - u_char priority; + uint8_t priority; /* Time Interval */ - u_int16_t hello_interval; - u_int16_t dead_interval; - u_int32_t rxmt_interval; + uint16_t hello_interval; + uint16_t dead_interval; + uint32_t rxmt_interval; - u_int32_t state_change; + uint32_t state_change; /* Cost */ - u_int32_t cost; + uint32_t cost; /* I/F MTU */ - u_int32_t ifmtu; + uint32_t ifmtu; /* Configured MTU */ - u_int32_t c_ifmtu; + uint32_t c_ifmtu; /* Interface State */ - u_char state; + uint8_t state; /* Interface socket setting trial counter, resets on success */ - u_char sso_try_cnt; + uint8_t sso_try_cnt; /* OSPF6 Interface flag */ char flag; /* MTU mismatch check */ - u_char mtu_ignore; + uint8_t mtu_ignore; /* Decision of DR Election */ - u_int32_t drouter; - u_int32_t bdrouter; - u_int32_t prev_drouter; - u_int32_t prev_bdrouter; + uint32_t drouter; + uint32_t bdrouter; + uint32_t prev_drouter; + uint32_t prev_bdrouter; /* Linklocal LSA Database: includes Link-LSA */ struct ospf6_lsdb *lsdb; @@ -119,17 +119,17 @@ struct ospf6_interface { void *bfd_info; /* Statistics Fields */ - u_int32_t hello_in; - u_int32_t hello_out; - u_int32_t db_desc_in; - u_int32_t db_desc_out; - u_int32_t ls_req_in; - u_int32_t ls_req_out; - u_int32_t ls_upd_in; - u_int32_t ls_upd_out; - u_int32_t ls_ack_in; - u_int32_t ls_ack_out; - u_int32_t discarded; + uint32_t hello_in; + uint32_t hello_out; + uint32_t db_desc_in; + uint32_t db_desc_out; + uint32_t ls_req_in; + uint32_t ls_req_out; + uint32_t ls_upd_in; + uint32_t ls_upd_out; + uint32_t ls_ack_in; + uint32_t ls_ack_out; + uint32_t discarded; QOBJ_FIELDS }; diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index 0b7755a3f..1872c6bd3 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -49,8 +49,8 @@ #include "ospf6_spf.h" unsigned char conf_debug_ospf6_brouter = 0; -u_int32_t conf_debug_ospf6_brouter_specific_router_id; -u_int32_t conf_debug_ospf6_brouter_specific_area_id; +uint32_t conf_debug_ospf6_brouter_specific_router_id; +uint32_t conf_debug_ospf6_brouter_specific_area_id; #define MAX_LSA_PAYLOAD (1024 + 256) /******************************/ @@ -189,15 +189,15 @@ int ospf6_router_lsa_originate(struct thread *thread) struct ospf6_lsa_header *lsa_header; struct ospf6_lsa *lsa; - u_int32_t link_state_id = 0; + uint32_t link_state_id = 0; struct listnode *node, *nnode; struct listnode *j; struct ospf6_interface *oi; struct ospf6_neighbor *on, *drouter = NULL; struct ospf6_router_lsa *router_lsa; struct ospf6_router_lsdesc *lsdesc; - u_int16_t type; - u_int32_t router; + uint16_t type; + uint32_t router; int count; oa = (struct ospf6_area *)THREAD_ARG(thread); @@ -461,7 +461,7 @@ int ospf6_network_lsa_originate(struct thread *thread) struct ospf6_neighbor *on; struct ospf6_link_lsa *link_lsa; struct listnode *i; - u_int16_t type; + uint16_t type; oi = (struct ospf6_interface *)THREAD_ARG(thread); oi->thread_network_lsa = NULL; @@ -1142,7 +1142,7 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread) struct ospf6_route_table *route_advertise; struct ospf6_link_lsa *link_lsa; char *start, *end, *current; - u_int16_t type; + uint16_t type; char buf[PREFIX2STR_BUFFER]; oi = (struct ospf6_interface *)THREAD_ARG(thread); @@ -1505,7 +1505,7 @@ void ospf6_intra_prefix_lsa_remove(struct ospf6_lsa *lsa) void ospf6_intra_route_calculation(struct ospf6_area *oa) { struct ospf6_route *route, *nroute; - u_int16_t type; + uint16_t type; struct ospf6_lsa *lsa; void (*hook_add)(struct ospf6_route *) = NULL; void (*hook_remove)(struct ospf6_route *) = NULL; @@ -1558,7 +1558,7 @@ void ospf6_intra_route_calculation(struct ospf6_area *oa) static void ospf6_brouter_debug_print(struct ospf6_route *brouter) { - u_int32_t brouter_id; + uint32_t brouter_id; char brouter_name[16]; char area_name[16]; char destination[64]; @@ -1614,7 +1614,7 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa) struct ospf6_route *brouter, *nbrouter, *copy; void (*hook_add)(struct ospf6_route *) = NULL; void (*hook_remove)(struct ospf6_route *) = NULL; - u_int32_t brouter_id; + uint32_t brouter_id; char brouter_name[16]; if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID(oa->area_id)) @@ -1861,7 +1861,7 @@ DEFUN (debug_ospf6_brouter_router, ) { int idx_ipv4 = 4; - u_int32_t router_id; + uint32_t router_id; inet_pton(AF_INET, argv[idx_ipv4]->arg, &router_id); OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ON(router_id); return CMD_SUCCESS; @@ -1892,7 +1892,7 @@ DEFUN (debug_ospf6_brouter_area, ) { int idx_ipv4 = 4; - u_int32_t area_id; + uint32_t area_id; inet_pton(AF_INET, argv[idx_ipv4]->arg, &area_id); OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ON(area_id); return CMD_SUCCESS; diff --git a/ospf6d/ospf6_intra.h b/ospf6d/ospf6_intra.h index 07f0f124e..2abcce8c8 100644 --- a/ospf6d/ospf6_intra.h +++ b/ospf6d/ospf6_intra.h @@ -23,8 +23,8 @@ /* Debug option */ extern unsigned char conf_debug_ospf6_brouter; -extern u_int32_t conf_debug_ospf6_brouter_specific_router_id; -extern u_int32_t conf_debug_ospf6_brouter_specific_area_id; +extern uint32_t conf_debug_ospf6_brouter_specific_router_id; +extern uint32_t conf_debug_ospf6_brouter_specific_area_id; #define OSPF6_DEBUG_BROUTER_SUMMARY 0x01 #define OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER 0x02 #define OSPF6_DEBUG_BROUTER_SPECIFIC_AREA 0x04 @@ -73,20 +73,20 @@ extern u_int32_t conf_debug_ospf6_brouter_specific_area_id; /* Router-LSA */ #define OSPF6_ROUTER_LSA_MIN_SIZE 4U struct ospf6_router_lsa { - u_char bits; - u_char options[3]; + uint8_t bits; + uint8_t options[3]; /* followed by ospf6_router_lsdesc(s) */ }; /* Link State Description in Router-LSA */ #define OSPF6_ROUTER_LSDESC_FIX_SIZE 16U struct ospf6_router_lsdesc { - u_char type; - u_char reserved; - u_int16_t metric; /* output cost */ - u_int32_t interface_id; - u_int32_t neighbor_interface_id; - u_int32_t neighbor_router_id; + uint8_t type; + uint8_t reserved; + uint16_t metric; /* output cost */ + uint32_t interface_id; + uint32_t neighbor_interface_id; + uint32_t neighbor_router_id; }; #define OSPF6_ROUTER_LSDESC_POINTTOPOINT 1 @@ -117,15 +117,15 @@ enum stub_router_mode { /* Network-LSA */ #define OSPF6_NETWORK_LSA_MIN_SIZE 4U struct ospf6_network_lsa { - u_char reserved; - u_char options[3]; + uint8_t reserved; + uint8_t options[3]; /* followed by ospf6_netowrk_lsd(s) */ }; /* Link State Description in Router-LSA */ #define OSPF6_NETWORK_LSDESC_FIX_SIZE 4U struct ospf6_network_lsdesc { - u_int32_t router_id; + uint32_t router_id; }; #define NETWORK_LSDESC_GET_NBR_ROUTERID(x) \ (((struct ospf6_network_lsdesc *)(x))->router_id) @@ -133,20 +133,20 @@ struct ospf6_network_lsdesc { /* Link-LSA */ #define OSPF6_LINK_LSA_MIN_SIZE 24U /* w/o 1st IPv6 prefix */ struct ospf6_link_lsa { - u_char priority; - u_char options[3]; + uint8_t priority; + uint8_t options[3]; struct in6_addr linklocal_addr; - u_int32_t prefix_num; + uint32_t prefix_num; /* followed by ospf6 prefix(es) */ }; /* Intra-Area-Prefix-LSA */ #define OSPF6_INTRA_PREFIX_LSA_MIN_SIZE 12U /* w/o 1st IPv6 prefix */ struct ospf6_intra_prefix_lsa { - u_int16_t prefix_num; - u_int16_t ref_type; - u_int32_t ref_id; - u_int32_t ref_adv_router; + uint16_t prefix_num; + uint16_t ref_type; + uint32_t ref_id; + uint32_t ref_adv_router; /* followed by ospf6 prefix(es) */ }; @@ -213,11 +213,11 @@ struct ospf6_intra_prefix_lsa { } while (0) /* Function Prototypes */ -extern char *ospf6_router_lsdesc_lookup(u_char type, u_int32_t interface_id, - u_int32_t neighbor_interface_id, - u_int32_t neighbor_router_id, +extern char *ospf6_router_lsdesc_lookup(uint8_t type, uint32_t interface_id, + uint32_t neighbor_interface_id, + uint32_t neighbor_router_id, struct ospf6_lsa *lsa); -extern char *ospf6_network_lsdesc_lookup(u_int32_t router_id, +extern char *ospf6_network_lsdesc_lookup(uint32_t router_id, struct ospf6_lsa *lsa); extern int ospf6_router_is_stub_router(struct ospf6_lsa *lsa); diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index e060879f4..8b720b6d8 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -47,11 +47,11 @@ vector ospf6_lsa_handler_vector; static int ospf6_unknown_lsa_show(struct vty *vty, struct ospf6_lsa *lsa) { - u_char *start, *end, *current; + uint8_t *start, *end, *current; char byte[4]; - start = (u_char *)lsa->header + sizeof(struct ospf6_lsa_header); - end = (u_char *)lsa->header + ntohs(lsa->header->length); + start = (uint8_t *)lsa->header + sizeof(struct ospf6_lsa_header); + end = (uint8_t *)lsa->header + ntohs(lsa->header->length); vty_out(vty, " Unknown contents:\n"); for (current = start; current < end; current++) { @@ -84,7 +84,7 @@ void ospf6_install_lsa_handler(const struct ospf6_lsa_handler *handler) vector_set_index(ospf6_lsa_handler_vector, index, (void *)handler); } -const struct ospf6_lsa_handler *ospf6_get_lsa_handler(u_int16_t type) +const struct ospf6_lsa_handler *ospf6_get_lsa_handler(uint16_t type) { const struct ospf6_lsa_handler *handler = NULL; unsigned int index = ntohs(type) & OSPF6_LSTYPE_FCODE_MASK; @@ -100,7 +100,7 @@ const struct ospf6_lsa_handler *ospf6_get_lsa_handler(u_int16_t type) return handler; } -const char *ospf6_lstype_name(u_int16_t type) +const char *ospf6_lstype_name(uint16_t type) { static char buf[8]; const struct ospf6_lsa_handler *handler; @@ -113,7 +113,7 @@ const char *ospf6_lstype_name(u_int16_t type) return buf; } -const char *ospf6_lstype_short_name(u_int16_t type) +const char *ospf6_lstype_short_name(uint16_t type) { static char buf[8]; const struct ospf6_lsa_handler *handler; @@ -126,7 +126,7 @@ const char *ospf6_lstype_short_name(u_int16_t type) return buf; } -u_char ospf6_lstype_debug(u_int16_t type) +uint8_t ospf6_lstype_debug(uint16_t type) { const struct ospf6_lsa_handler *handler; handler = ospf6_get_lsa_handler(type); @@ -207,11 +207,11 @@ void ospf6_lsa_age_set(struct ospf6_lsa *lsa) /* this function calculates current age from its birth, then update age field of LSA header. return value is current age */ -u_int16_t ospf6_lsa_age_current(struct ospf6_lsa *lsa) +uint16_t ospf6_lsa_age_current(struct ospf6_lsa *lsa) { struct timeval now; - u_int32_t ulage; - u_int16_t age; + uint32_t ulage; + uint16_t age; assert(lsa); assert(lsa->header); @@ -237,7 +237,7 @@ u_int16_t ospf6_lsa_age_current(struct ospf6_lsa *lsa) } /* update age field of LSA header with adding InfTransDelay */ -void ospf6_lsa_age_update_to_send(struct ospf6_lsa *lsa, u_int32_t transdelay) +void ospf6_lsa_age_update_to_send(struct ospf6_lsa *lsa, uint32_t transdelay) { unsigned short age; @@ -292,8 +292,8 @@ void ospf6_lsa_premature_aging(struct ospf6_lsa *lsa) int ospf6_lsa_compare(struct ospf6_lsa *a, struct ospf6_lsa *b) { int32_t seqnuma, seqnumb; - u_int16_t cksuma, cksumb; - u_int16_t agea, ageb; + uint16_t cksuma, cksumb; + uint16_t agea, ageb; assert(a && a->header); assert(b && b->header); @@ -355,7 +355,7 @@ void ospf6_lsa_header_print_raw(struct ospf6_lsa_header *header) zlog_debug(" [%s Id:%s Adv:%s]", ospf6_lstype_name(header->type), id, adv_router); zlog_debug(" Age: %4hu SeqNum: %#08lx Cksum: %04hx Len: %d", - ntohs(header->age), (u_long)ntohl(header->seqnum), + ntohs(header->age), (unsigned long)ntohl(header->seqnum), ntohs(header->checksum), ntohs(header->length)); } @@ -394,13 +394,13 @@ void ospf6_lsa_show_summary(struct vty *vty, struct ospf6_lsa *lsa) vty_out(vty, "%-4s %-15s%-15s%4hu %8lx %30s\n", ospf6_lstype_short_name(lsa->header->type), id, adv_router, ospf6_lsa_age_current(lsa), - (u_long)ntohl(lsa->header->seqnum), + (unsigned long)ntohl(lsa->header->seqnum), handler->lh_get_prefix_str(lsa, buf, sizeof(buf), 0)); } else if (type != OSPF6_LSTYPE_UNKNOWN) { sprintf(tmpbuf, "%-4s %-15s%-15s%4hu %8lx", ospf6_lstype_short_name(lsa->header->type), id, adv_router, ospf6_lsa_age_current(lsa), - (u_long)ntohl(lsa->header->seqnum)); + (unsigned long)ntohl(lsa->header->seqnum)); while (handler->lh_get_prefix_str(lsa, buf, sizeof(buf), cnt) != NULL) { @@ -411,17 +411,17 @@ void ospf6_lsa_show_summary(struct vty *vty, struct ospf6_lsa *lsa) vty_out(vty, "%-4s %-15s%-15s%4hu %8lx\n", ospf6_lstype_short_name(lsa->header->type), id, adv_router, ospf6_lsa_age_current(lsa), - (u_long)ntohl(lsa->header->seqnum)); + (unsigned long)ntohl(lsa->header->seqnum)); } } void ospf6_lsa_show_dump(struct vty *vty, struct ospf6_lsa *lsa) { - u_char *start, *end, *current; + uint8_t *start, *end, *current; char byte[4]; - start = (u_char *)lsa->header; - end = (u_char *)lsa->header + ntohs(lsa->header->length); + start = (uint8_t *)lsa->header; + end = (uint8_t *)lsa->header + ntohs(lsa->header->length); vty_out(vty, "\n"); vty_out(vty, "%s:\n", lsa->name); @@ -456,7 +456,7 @@ void ospf6_lsa_show_internal(struct vty *vty, struct ospf6_lsa *lsa) vty_out(vty, "Link State ID: %s\n", id); vty_out(vty, "Advertising Router: %s\n", adv_router); vty_out(vty, "LS Sequence Number: %#010lx\n", - (u_long)ntohl(lsa->header->seqnum)); + (unsigned long)ntohl(lsa->header->seqnum)); vty_out(vty, "CheckSum: %#06hx Length: %hu\n", ntohs(lsa->header->checksum), ntohs(lsa->header->length)); vty_out(vty, "Flag: %x \n", lsa->flag); @@ -490,7 +490,7 @@ void ospf6_lsa_show(struct vty *vty, struct ospf6_lsa *lsa) vty_out(vty, "Link State ID: %s\n", id); vty_out(vty, "Advertising Router: %s\n", adv_router); vty_out(vty, "LS Sequence Number: %#010lx\n", - (u_long)ntohl(lsa->header->seqnum)); + (unsigned long)ntohl(lsa->header->seqnum)); vty_out(vty, "CheckSum: %#06hx Length: %hu\n", ntohs(lsa->header->checksum), ntohs(lsa->header->length)); vty_out(vty, "Duration: %s\n", duration); @@ -512,7 +512,7 @@ struct ospf6_lsa *ospf6_lsa_create(struct ospf6_lsa_header *header) { struct ospf6_lsa *lsa = NULL; struct ospf6_lsa_header *new_header = NULL; - u_int16_t lsa_size = 0; + uint16_t lsa_size = 0; /* size of the entire LSA */ lsa_size = ntohs(header->length); /* XXX vulnerable */ @@ -743,26 +743,28 @@ void ospf6_flush_self_originated_lsas_now(void) one-based. */ unsigned short ospf6_lsa_checksum(struct ospf6_lsa_header *lsa_header) { - u_char *buffer = (u_char *)&lsa_header->type; - int type_offset = buffer - (u_char *)&lsa_header->age; /* should be 2 */ + uint8_t *buffer = (uint8_t *)&lsa_header->type; + int type_offset = + buffer - (uint8_t *)&lsa_header->age; /* should be 2 */ /* Skip the AGE field */ - u_int16_t len = ntohs(lsa_header->length) - type_offset; + uint16_t len = ntohs(lsa_header->length) - type_offset; /* Checksum offset starts from "type" field, not the beginning of the lsa_header struct. The offset is 14, rather than 16. */ - int checksum_offset = (u_char *)&lsa_header->checksum - buffer; + int checksum_offset = (uint8_t *)&lsa_header->checksum - buffer; return (unsigned short)fletcher_checksum(buffer, len, checksum_offset); } int ospf6_lsa_checksum_valid(struct ospf6_lsa_header *lsa_header) { - u_char *buffer = (u_char *)&lsa_header->type; - int type_offset = buffer - (u_char *)&lsa_header->age; /* should be 2 */ + uint8_t *buffer = (uint8_t *)&lsa_header->type; + int type_offset = + buffer - (uint8_t *)&lsa_header->age; /* should be 2 */ /* Skip the AGE field */ - u_int16_t len = ntohs(lsa_header->length) - type_offset; + uint16_t len = ntohs(lsa_header->length) - type_offset; return (fletcher_checksum(buffer, len, FLETCHER_CHECKSUM_VALIDATE) == 0); @@ -874,7 +876,7 @@ DEFUN (no_debug_ospf6_lsa_type, { int idx_lsa = 4; int idx_type = 5; - u_int i; + unsigned int i; struct ospf6_lsa_handler *handler = NULL; for (i = 0; i < vector_active(ospf6_lsa_handler_vector); i++) { @@ -915,7 +917,7 @@ void install_element_ospf6_debug_lsa(void) int config_write_ospf6_debug_lsa(struct vty *vty) { - u_int i; + unsigned int i; const struct ospf6_lsa_handler *handler; for (i = 0; i < vector_active(ospf6_lsa_handler_vector); i++) { diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h index 4bf56a8c1..e88d10ad7 100644 --- a/ospf6d/ospf6_lsa.h +++ b/ospf6d/ospf6_lsa.h @@ -78,13 +78,13 @@ /* LSA Header */ #define OSPF6_LSA_HEADER_SIZE 20U struct ospf6_lsa_header { - u_int16_t age; /* LS age */ - u_int16_t type; /* LS type */ - u_int32_t id; /* Link State ID */ - u_int32_t adv_router; /* Advertising Router */ - u_int32_t seqnum; /* LS sequence number */ - u_int16_t checksum; /* LS checksum */ - u_int16_t length; /* LSA length */ + uint16_t age; /* LS age */ + uint16_t type; /* LS type */ + uint32_t id; /* Link State ID */ + uint32_t adv_router; /* Advertising Router */ + uint32_t seqnum; /* LS sequence number */ + uint16_t checksum; /* LS checksum */ + uint16_t length; /* LSA length */ }; #define OSPF6_LSA_HEADER_END(h) ((caddr_t)(h) + sizeof(struct ospf6_lsa_header)) @@ -138,7 +138,7 @@ struct ospf6_lsa { struct ospf6_lsa_handler { const struct { - u_int16_t type; /* host byte order */ + uint16_t type; /* host byte order */ const char *name; const char *short_name; int (*show)(struct vty *, struct ospf6_lsa *); @@ -150,7 +150,7 @@ struct ospf6_lsa_handler { #define lh_short_name s.short_name #define lh_show s.show #define lh_get_prefix_str s.get_prefix_str - u_char debug; + uint8_t debug; #define lh_debug debug }; @@ -208,13 +208,13 @@ extern vector ospf6_lsa_handler_vector; /* Function Prototypes */ -extern const char *ospf6_lstype_name(u_int16_t type); -extern const char *ospf6_lstype_short_name(u_int16_t type); -extern u_char ospf6_lstype_debug(u_int16_t type); +extern const char *ospf6_lstype_name(uint16_t type); +extern const char *ospf6_lstype_short_name(uint16_t type); +extern uint8_t ospf6_lstype_debug(uint16_t type); extern int ospf6_lsa_is_differ(struct ospf6_lsa *lsa1, struct ospf6_lsa *lsa2); extern int ospf6_lsa_is_changed(struct ospf6_lsa *lsa1, struct ospf6_lsa *lsa2); -extern u_int16_t ospf6_lsa_age_current(struct ospf6_lsa *); -extern void ospf6_lsa_age_update_to_send(struct ospf6_lsa *, u_int32_t); +extern uint16_t ospf6_lsa_age_current(struct ospf6_lsa *); +extern void ospf6_lsa_age_update_to_send(struct ospf6_lsa *, uint32_t); extern void ospf6_lsa_premature_aging(struct ospf6_lsa *); extern int ospf6_lsa_compare(struct ospf6_lsa *, struct ospf6_lsa *); @@ -241,11 +241,11 @@ extern int ospf6_lsa_refresh(struct thread *); extern unsigned short ospf6_lsa_checksum(struct ospf6_lsa_header *); extern int ospf6_lsa_checksum_valid(struct ospf6_lsa_header *); -extern int ospf6_lsa_prohibited_duration(u_int16_t type, u_int32_t id, - u_int32_t adv_router, void *scope); +extern int ospf6_lsa_prohibited_duration(uint16_t type, uint32_t id, + uint32_t adv_router, void *scope); extern void ospf6_install_lsa_handler(const struct ospf6_lsa_handler *handler); -extern const struct ospf6_lsa_handler *ospf6_get_lsa_handler(u_int16_t type); +extern const struct ospf6_lsa_handler *ospf6_get_lsa_handler(uint16_t type); extern void ospf6_lsa_init(void); extern void ospf6_lsa_terminate(void); diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c index f17b558e8..5e02c0c91 100644 --- a/ospf6d/ospf6_lsdb.c +++ b/ospf6d/ospf6_lsdb.c @@ -173,8 +173,8 @@ void ospf6_lsdb_remove(struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb) ospf6_lsdb_count_assert(lsdb); } -struct ospf6_lsa *ospf6_lsdb_lookup(u_int16_t type, u_int32_t id, - u_int32_t adv_router, +struct ospf6_lsa *ospf6_lsdb_lookup(uint16_t type, uint32_t id, + uint32_t adv_router, struct ospf6_lsdb *lsdb) { struct route_node *node; @@ -196,8 +196,8 @@ struct ospf6_lsa *ospf6_lsdb_lookup(u_int16_t type, u_int32_t id, return (struct ospf6_lsa *)node->info; } -struct ospf6_lsa *ospf6_lsdb_lookup_next(u_int16_t type, u_int32_t id, - u_int32_t adv_router, +struct ospf6_lsa *ospf6_lsdb_lookup_next(uint16_t type, uint32_t id, + uint32_t adv_router, struct ospf6_lsdb *lsdb) { struct route_node *node; @@ -355,7 +355,7 @@ int ospf6_lsdb_maxage_remover(struct ospf6_lsdb *lsdb) } void ospf6_lsdb_show(struct vty *vty, enum ospf_lsdb_show_level level, - u_int16_t *type, u_int32_t *id, u_int32_t *adv_router, + uint16_t *type, uint32_t *id, uint32_t *adv_router, struct ospf6_lsdb *lsdb) { struct ospf6_lsa *lsa; @@ -403,11 +403,11 @@ void ospf6_lsdb_show(struct vty *vty, enum ospf_lsdb_show_level level, } } -u_int32_t ospf6_new_ls_id(u_int16_t type, u_int32_t adv_router, - struct ospf6_lsdb *lsdb) +uint32_t ospf6_new_ls_id(uint16_t type, uint32_t adv_router, + struct ospf6_lsdb *lsdb) { struct ospf6_lsa *lsa; - u_int32_t id = 1, tmp_id; + uint32_t id = 1, tmp_id; /* This routine is curently invoked only for Inter-Prefix LSAs for * non-summarized routes (no area/range). @@ -424,13 +424,13 @@ u_int32_t ospf6_new_ls_id(u_int16_t type, u_int32_t adv_router, id++; } - return ((u_int32_t)htonl(id)); + return ((uint32_t)htonl(id)); } /* Decide new LS sequence number to originate. note return value is network byte order */ -u_int32_t ospf6_new_ls_seqnum(u_int16_t type, u_int32_t id, - u_int32_t adv_router, struct ospf6_lsdb *lsdb) +uint32_t ospf6_new_ls_seqnum(uint16_t type, uint32_t id, uint32_t adv_router, + struct ospf6_lsdb *lsdb) { struct ospf6_lsa *lsa; signed long seqnum = 0; @@ -442,5 +442,5 @@ u_int32_t ospf6_new_ls_seqnum(u_int16_t type, u_int32_t id, else seqnum = (signed long)ntohl(lsa->header->seqnum) + 1; - return ((u_int32_t)htonl(seqnum)); + return ((uint32_t)htonl(seqnum)); } diff --git a/ospf6d/ospf6_lsdb.h b/ospf6d/ospf6_lsdb.h index 41e54b5d8..3b32e3ecf 100644 --- a/ospf6d/ospf6_lsdb.h +++ b/ospf6d/ospf6_lsdb.h @@ -28,7 +28,7 @@ struct ospf6_lsdb { void *data; /* data structure that holds this lsdb */ struct route_table *table; - u_int32_t count; + uint32_t count; void (*hook_add)(struct ospf6_lsa *); void (*hook_remove)(struct ospf6_lsa *); }; @@ -37,11 +37,11 @@ struct ospf6_lsdb { extern struct ospf6_lsdb *ospf6_lsdb_create(void *data); extern void ospf6_lsdb_delete(struct ospf6_lsdb *lsdb); -extern struct ospf6_lsa *ospf6_lsdb_lookup(u_int16_t type, u_int32_t id, - u_int32_t adv_router, +extern struct ospf6_lsa *ospf6_lsdb_lookup(uint16_t type, uint32_t id, + uint32_t adv_router, struct ospf6_lsdb *lsdb); -extern struct ospf6_lsa *ospf6_lsdb_lookup_next(u_int16_t type, u_int32_t id, - u_int32_t adv_router, +extern struct ospf6_lsa *ospf6_lsdb_lookup_next(uint16_t type, uint32_t id, + uint32_t adv_router, struct ospf6_lsdb *lsdb); extern void ospf6_lsdb_add(struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb); @@ -83,14 +83,14 @@ enum ospf_lsdb_show_level { }; extern void ospf6_lsdb_show(struct vty *vty, enum ospf_lsdb_show_level level, - u_int16_t *type, u_int32_t *id, - u_int32_t *adv_router, struct ospf6_lsdb *lsdb); + uint16_t *type, uint32_t *id, uint32_t *adv_router, + struct ospf6_lsdb *lsdb); -extern u_int32_t ospf6_new_ls_id(u_int16_t type, u_int32_t adv_router, - struct ospf6_lsdb *lsdb); -extern u_int32_t ospf6_new_ls_seqnum(u_int16_t type, u_int32_t id, - u_int32_t adv_router, - struct ospf6_lsdb *lsdb); +extern uint32_t ospf6_new_ls_id(uint16_t type, uint32_t adv_router, + struct ospf6_lsdb *lsdb); +extern uint32_t ospf6_new_ls_seqnum(uint16_t type, uint32_t id, + uint32_t adv_router, + struct ospf6_lsdb *lsdb); extern int ospf6_lsdb_maxage_remover(struct ospf6_lsdb *lsdb); #endif /* OSPF6_LSDB_H */ diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index f32cd6e7e..c608a0110 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -59,7 +59,7 @@ static const struct message ospf6_message_type_str[] = { /* Minimum (besides the standard OSPF packet header) lengths for OSPF packets of particular types, offset is the "type" field. */ -const u_int16_t ospf6_packet_minlen[OSPF6_MESSAGE_TYPE_ALL] = { +const uint16_t ospf6_packet_minlen[OSPF6_MESSAGE_TYPE_ALL] = { 0, OSPF6_HELLO_MIN_SIZE, OSPF6_DB_DESC_MIN_SIZE, @@ -69,7 +69,7 @@ const u_int16_t ospf6_packet_minlen[OSPF6_MESSAGE_TYPE_ALL] = { /* Minimum (besides the standard LSA header) lengths for LSAs of particular types, offset is the "LSA function code" portion of "LSA type" field. */ -const u_int16_t ospf6_lsa_minlen[OSPF6_LSTYPE_SIZE] = { +const uint16_t ospf6_lsa_minlen[OSPF6_LSTYPE_SIZE] = { 0, /* 0x2001 */ OSPF6_ROUTER_LSA_MIN_SIZE, /* 0x2002 */ OSPF6_NETWORK_LSA_MIN_SIZE, @@ -113,15 +113,15 @@ void ospf6_hello_print(struct ospf6_header *oh) ospf6_options_printbuf(hello->options, options, sizeof(options)); zlog_debug(" I/F-Id:%ld Priority:%d Option:%s", - (u_long)ntohl(hello->interface_id), hello->priority, + (unsigned long)ntohl(hello->interface_id), hello->priority, options); zlog_debug(" HelloInterval:%hu DeadInterval:%hu", ntohs(hello->hello_interval), ntohs(hello->dead_interval)); zlog_debug(" DR:%s BDR:%s", drouter, bdrouter); for (p = (char *)((caddr_t)hello + sizeof(struct ospf6_hello)); - p + sizeof(u_int32_t) <= OSPF6_MESSAGE_END(oh); - p += sizeof(u_int32_t)) { + p + sizeof(uint32_t) <= OSPF6_MESSAGE_END(oh); + p += sizeof(uint32_t)) { inet_ntop(AF_INET, (void *)p, neighbor, sizeof(neighbor)); zlog_debug(" Neighbor: %s", neighbor); } @@ -149,7 +149,7 @@ void ospf6_dbdesc_print(struct ospf6_header *oh) (CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_IBIT) ? "I" : "-"), (CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_MBIT) ? "M" : "-"), (CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_MSBIT) ? "m" : "s"), - (u_long)ntohl(dbdesc->seqnum)); + (unsigned long)ntohl(dbdesc->seqnum)); for (p = (char *)((caddr_t)dbdesc + sizeof(struct ospf6_dbdesc)); p + sizeof(struct ospf6_lsa_header) <= OSPF6_MESSAGE_END(oh); @@ -184,7 +184,7 @@ void ospf6_lsreq_print(struct ospf6_header *oh) void ospf6_lsupdate_print(struct ospf6_header *oh) { struct ospf6_lsupdate *lsupdate; - u_long num; + unsigned long num; char *p; ospf6_header_print(oh); @@ -278,9 +278,9 @@ static void ospf6_hello_recv(struct in6_addr *src, struct in6_addr *dst, /* TwoWay check */ for (p = (char *)((caddr_t)hello + sizeof(struct ospf6_hello)); - p + sizeof(u_int32_t) <= OSPF6_MESSAGE_END(oh); - p += sizeof(u_int32_t)) { - u_int32_t *router_id = (u_int32_t *)p; + p + sizeof(uint32_t) <= OSPF6_MESSAGE_END(oh); + p += sizeof(uint32_t)) { + uint32_t *router_id = (uint32_t *)p; if (*router_id == oi->area->ospf6->router_id) twoway++; @@ -429,7 +429,7 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh, if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) zlog_debug( "Sequence number mismatch (%#lx expected)", - (u_long)on->dbdesc_seqnum); + (unsigned long)on->dbdesc_seqnum); thread_add_event(master, seqnumber_mismatch, on, 0, NULL); return; @@ -647,7 +647,7 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh, if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) zlog_debug( "Sequence number mismatch (%#lx expected)", - (u_long)on->dbdesc_seqnum + 1); + (unsigned long)on->dbdesc_seqnum + 1); thread_add_event(master, seqnumber_mismatch, on, 0, NULL); return; @@ -873,12 +873,12 @@ static void ospf6_lsreq_recv(struct in6_addr *src, struct in6_addr *dst, static unsigned ospf6_prefixes_examin( struct ospf6_prefix *current, /* start of buffer */ unsigned length, - const u_int32_t req_num_pfxs /* always compared with the actual number + const uint32_t req_num_pfxs /* always compared with the actual number of prefixes */ - ) +) { - u_char requested_pfx_bytes; - u_int32_t real_num_pfxs = 0; + uint8_t requested_pfx_bytes; + uint32_t real_num_pfxs = 0; while (length) { if (length < OSPF6_PREFIX_MIN_SIZE) { @@ -929,15 +929,15 @@ static unsigned ospf6_prefixes_examin( LSA type in network byte order, uses in host byte order and passes to ospf6_lstype_name() in network byte order again. */ static unsigned ospf6_lsa_examin(struct ospf6_lsa_header *lsah, - const u_int16_t lsalen, - const u_char headeronly) + const uint16_t lsalen, + const uint8_t headeronly) { struct ospf6_intra_prefix_lsa *intra_prefix_lsa; struct ospf6_as_external_lsa *as_external_lsa; struct ospf6_link_lsa *link_lsa; unsigned exp_length; - u_int8_t ltindex; - u_int16_t lsatype; + uint8_t ltindex; + uint16_t lsatype; /* In case an additional minimum length constraint is defined for current @@ -1103,16 +1103,16 @@ static unsigned ospf6_lsa_examin(struct ospf6_lsa_header *lsah, of deeper-level checks. */ static unsigned ospf6_lsaseq_examin(struct ospf6_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 < OSPF6_LSA_HEADER_SIZE) { if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, RECV)) @@ -1490,13 +1490,13 @@ static void ospf6_lsack_recv(struct in6_addr *src, struct in6_addr *dst, assert(p == OSPF6_MESSAGE_END(oh)); } -static u_char *recvbuf = NULL; -static u_char *sendbuf = NULL; +static uint8_t *recvbuf = NULL; +static uint8_t *sendbuf = NULL; static unsigned int iobuflen = 0; int ospf6_iobuf_size(unsigned int size) { - u_char *recvnew, *sendnew; + uint8_t *recvnew, *sendnew; if (size <= iobuflen) return iobuflen; @@ -1728,7 +1728,7 @@ int ospf6_hello_send(struct thread *thread) struct ospf6_interface *oi; struct ospf6_header *oh; struct ospf6_hello *hello; - u_char *p; + uint8_t *p; struct listnode *node, *nnode; struct ospf6_neighbor *on; @@ -1767,13 +1767,13 @@ int ospf6_hello_send(struct thread *thread) hello->drouter = oi->drouter; hello->bdrouter = oi->bdrouter; - p = (u_char *)((caddr_t)hello + sizeof(struct ospf6_hello)); + p = (uint8_t *)((caddr_t)hello + sizeof(struct ospf6_hello)); for (ALL_LIST_ELEMENTS(oi->neighbor_list, node, nnode, on)) { if (on->state < OSPF6_NEIGHBOR_INIT) continue; - if (p - sendbuf + sizeof(u_int32_t) > ospf6_packet_max(oi)) { + if (p - sendbuf + sizeof(uint32_t) > ospf6_packet_max(oi)) { if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_HELLO, SEND)) zlog_debug( @@ -1781,8 +1781,8 @@ int ospf6_hello_send(struct thread *thread) break; } - memcpy(p, &on->router_id, sizeof(u_int32_t)); - p += sizeof(u_int32_t); + memcpy(p, &on->router_id, sizeof(uint32_t)); + p += sizeof(uint32_t); } oh->type = OSPF6_MESSAGE_TYPE_HELLO; @@ -1799,7 +1799,7 @@ int ospf6_dbdesc_send(struct thread *thread) struct ospf6_neighbor *on; struct ospf6_header *oh; struct ospf6_dbdesc *dbdesc; - u_char *p; + uint8_t *p; struct ospf6_lsa *lsa; struct in6_addr *dst; @@ -1839,7 +1839,7 @@ int ospf6_dbdesc_send(struct thread *thread) dbdesc->seqnum = htonl(on->dbdesc_seqnum); /* if this is not initial one, set LSA headers in dbdesc */ - p = (u_char *)((caddr_t)dbdesc + sizeof(struct ospf6_dbdesc)); + p = (uint8_t *)((caddr_t)dbdesc + sizeof(struct ospf6_dbdesc)); if (!CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT)) { for (ALL_LSDB(on->dbdesc_list, lsa)) { ospf6_lsa_age_update_to_send(lsa, @@ -1915,7 +1915,7 @@ int ospf6_lsreq_send(struct thread *thread) struct ospf6_neighbor *on; struct ospf6_header *oh; struct ospf6_lsreq_entry *e; - u_char *p; + uint8_t *p; struct ospf6_lsa *lsa, *last_req; on = (struct ospf6_neighbor *)THREAD_ARG(thread); @@ -1942,7 +1942,7 @@ int ospf6_lsreq_send(struct thread *thread) last_req = NULL; /* set Request entries in lsreq */ - p = (u_char *)((caddr_t)oh + sizeof(struct ospf6_header)); + p = (uint8_t *)((caddr_t)oh + sizeof(struct ospf6_header)); for (ALL_LSDB(on->request_list, lsa)) { /* MTU check */ if (p - sendbuf + sizeof(struct ospf6_lsreq_entry) @@ -2026,7 +2026,7 @@ int ospf6_lsupdate_send_neighbor(struct thread *thread) struct ospf6_neighbor *on; struct ospf6_header *oh; struct ospf6_lsupdate *lsupdate; - u_char *p; + uint8_t *p; int lsa_cnt; struct ospf6_lsa *lsa; @@ -2048,7 +2048,7 @@ int ospf6_lsupdate_send_neighbor(struct thread *thread) lsupdate = (struct ospf6_lsupdate *)((caddr_t)oh + sizeof(struct ospf6_header)); - p = (u_char *)((caddr_t)lsupdate + sizeof(struct ospf6_lsupdate)); + p = (uint8_t *)((caddr_t)lsupdate + sizeof(struct ospf6_lsupdate)); lsa_cnt = 0; /* lsupdate_list lists those LSA which doesn't need to be @@ -2071,8 +2071,9 @@ int ospf6_lsupdate_send_neighbor(struct thread *thread) + sizeof(struct ospf6_header)); - p = (u_char *)((caddr_t)lsupdate - + sizeof(struct ospf6_lsupdate)); + p = (uint8_t *)((caddr_t)lsupdate + + sizeof(struct + ospf6_lsupdate)); lsa_cnt = 0; } } @@ -2101,7 +2102,7 @@ int ospf6_lsupdate_send_neighbor(struct thread *thread) oh = (struct ospf6_header *)sendbuf; lsupdate = (struct ospf6_lsupdate *)((caddr_t)oh + sizeof(struct ospf6_header)); - p = (u_char *)((caddr_t)lsupdate + sizeof(struct ospf6_lsupdate)); + p = (uint8_t *)((caddr_t)lsupdate + sizeof(struct ospf6_lsupdate)); lsa_cnt = 0; for (ALL_LSDB(on->retrans_list, lsa)) { @@ -2130,8 +2131,9 @@ int ospf6_lsupdate_send_neighbor(struct thread *thread) *)((caddr_t)oh + sizeof(struct ospf6_header)); - p = (u_char *)((caddr_t)lsupdate - + sizeof(struct ospf6_lsupdate)); + p = (uint8_t *)((caddr_t)lsupdate + + sizeof(struct + ospf6_lsupdate)); lsa_cnt = 0; } } @@ -2173,7 +2175,7 @@ int ospf6_lsupdate_send_neighbor_now(struct ospf6_neighbor *on, { struct ospf6_header *oh; struct ospf6_lsupdate *lsupdate; - u_char *p; + uint8_t *p; int lsa_cnt = 0; memset(sendbuf, 0, iobuflen); @@ -2181,7 +2183,7 @@ int ospf6_lsupdate_send_neighbor_now(struct ospf6_neighbor *on, lsupdate = (struct ospf6_lsupdate *)((caddr_t)oh + sizeof(struct ospf6_header)); - p = (u_char *)((caddr_t)lsupdate + sizeof(struct ospf6_lsupdate)); + p = (uint8_t *)((caddr_t)lsupdate + sizeof(struct ospf6_lsupdate)); ospf6_lsa_age_update_to_send(lsa, on->ospf6_if->transdelay); memcpy(p, lsa->header, OSPF6_LSA_SIZE(lsa->header)); p += OSPF6_LSA_SIZE(lsa->header); @@ -2207,7 +2209,7 @@ int ospf6_lsupdate_send_interface(struct thread *thread) struct ospf6_interface *oi; struct ospf6_header *oh; struct ospf6_lsupdate *lsupdate; - u_char *p; + uint8_t *p; int lsa_cnt; struct ospf6_lsa *lsa; @@ -2232,7 +2234,7 @@ int ospf6_lsupdate_send_interface(struct thread *thread) lsupdate = (struct ospf6_lsupdate *)((caddr_t)oh + sizeof(struct ospf6_header)); - p = (u_char *)((caddr_t)lsupdate + sizeof(struct ospf6_lsupdate)); + p = (uint8_t *)((caddr_t)lsupdate + sizeof(struct ospf6_lsupdate)); lsa_cnt = 0; for (ALL_LSDB(oi->lsupdate_list, lsa)) { @@ -2258,8 +2260,9 @@ int ospf6_lsupdate_send_interface(struct thread *thread) + sizeof(struct ospf6_header)); - p = (u_char *)((caddr_t)lsupdate - + sizeof(struct ospf6_lsupdate)); + p = (uint8_t *)((caddr_t)lsupdate + + sizeof(struct + ospf6_lsupdate)); lsa_cnt = 0; } } @@ -2294,7 +2297,7 @@ int ospf6_lsack_send_neighbor(struct thread *thread) { struct ospf6_neighbor *on; struct ospf6_header *oh; - u_char *p; + uint8_t *p; struct ospf6_lsa *lsa; int lsa_cnt = 0; @@ -2316,7 +2319,7 @@ int ospf6_lsack_send_neighbor(struct thread *thread) memset(sendbuf, 0, iobuflen); oh = (struct ospf6_header *)sendbuf; - p = (u_char *)((caddr_t)oh + sizeof(struct ospf6_header)); + p = (uint8_t *)((caddr_t)oh + sizeof(struct ospf6_header)); for (ALL_LSDB(on->lsack_list, lsa)) { /* MTU check */ @@ -2336,8 +2339,8 @@ int ospf6_lsack_send_neighbor(struct thread *thread) memset(sendbuf, 0, iobuflen); oh = (struct ospf6_header *)sendbuf; - p = (u_char *)((caddr_t)oh - + sizeof(struct ospf6_header)); + p = (uint8_t *)((caddr_t)oh + + sizeof(struct ospf6_header)); lsa_cnt = 0; } } @@ -2372,7 +2375,7 @@ int ospf6_lsack_send_interface(struct thread *thread) { struct ospf6_interface *oi; struct ospf6_header *oh; - u_char *p; + uint8_t *p; struct ospf6_lsa *lsa; int lsa_cnt = 0; @@ -2395,7 +2398,7 @@ int ospf6_lsack_send_interface(struct thread *thread) memset(sendbuf, 0, iobuflen); oh = (struct ospf6_header *)sendbuf; - p = (u_char *)((caddr_t)oh + sizeof(struct ospf6_header)); + p = (uint8_t *)((caddr_t)oh + sizeof(struct ospf6_header)); for (ALL_LSDB(oi->lsack_list, lsa)) { /* MTU check */ diff --git a/ospf6d/ospf6_message.h b/ospf6d/ospf6_message.h index d867bd025..d24b7f894 100644 --- a/ospf6d/ospf6_message.h +++ b/ospf6d/ospf6_message.h @@ -46,14 +46,14 @@ extern unsigned char conf_debug_ospf6_message[]; /* OSPFv3 packet header */ #define OSPF6_HEADER_SIZE 16U struct ospf6_header { - u_char version; - u_char type; - u_int16_t length; - u_int32_t router_id; - u_int32_t area_id; - u_int16_t checksum; - u_char instance_id; - u_char reserved; + uint8_t version; + uint8_t type; + uint16_t length; + uint32_t router_id; + uint32_t area_id; + uint16_t checksum; + uint8_t instance_id; + uint8_t reserved; }; #define OSPF6_MESSAGE_END(H) ((caddr_t) (H) + ntohs ((H)->length)) @@ -62,24 +62,24 @@ struct ospf6_header { #define OSPF6_HELLO_MIN_SIZE 20U struct ospf6_hello { ifindex_t interface_id; - u_char priority; - u_char options[3]; - u_int16_t hello_interval; - u_int16_t dead_interval; - u_int32_t drouter; - u_int32_t bdrouter; + uint8_t priority; + uint8_t options[3]; + uint16_t hello_interval; + uint16_t dead_interval; + uint32_t drouter; + uint32_t bdrouter; /* Followed by Router-IDs */ }; /* Database Description */ #define OSPF6_DB_DESC_MIN_SIZE 12U struct ospf6_dbdesc { - u_char reserved1; - u_char options[3]; - u_int16_t ifmtu; - u_char reserved2; - u_char bits; - u_int32_t seqnum; + uint8_t reserved1; + uint8_t options[3]; + uint16_t ifmtu; + uint8_t reserved2; + uint8_t bits; + uint32_t seqnum; /* Followed by LSA Headers */ }; @@ -92,16 +92,16 @@ struct ospf6_dbdesc { /* It is just a sequence of entries below */ #define OSPF6_LSREQ_LSDESC_FIX_SIZE 12U struct ospf6_lsreq_entry { - u_int16_t reserved; /* Must Be Zero */ - u_int16_t type; /* LS type */ - u_int32_t id; /* Link State ID */ - u_int32_t adv_router; /* Advertising Router */ + uint16_t reserved; /* Must Be Zero */ + uint16_t type; /* LS type */ + uint32_t id; /* Link State ID */ + uint32_t adv_router; /* Advertising Router */ }; /* Link State Update */ #define OSPF6_LS_UPD_MIN_SIZE 4U struct ospf6_lsupdate { - u_int32_t lsa_number; + uint32_t lsa_number; /* Followed by LSAs */ }; diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index 16bf2fd8e..6455f606b 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -62,7 +62,7 @@ int ospf6_neighbor_cmp(void *va, void *vb) return (ntohl(ona->router_id) < ntohl(onb->router_id) ? -1 : 1); } -struct ospf6_neighbor *ospf6_neighbor_lookup(u_int32_t router_id, +struct ospf6_neighbor *ospf6_neighbor_lookup(uint32_t router_id, struct ospf6_interface *oi) { struct listnode *n; @@ -76,7 +76,7 @@ struct ospf6_neighbor *ospf6_neighbor_lookup(u_int32_t router_id, } /* create ospf6_neighbor */ -struct ospf6_neighbor *ospf6_neighbor_create(u_int32_t router_id, +struct ospf6_neighbor *ospf6_neighbor_create(uint32_t router_id, struct ospf6_interface *oi) { struct ospf6_neighbor *on; @@ -147,10 +147,10 @@ void ospf6_neighbor_delete(struct ospf6_neighbor *on) XFREE(MTYPE_OSPF6_NEIGHBOR, on); } -static void ospf6_neighbor_state_change(u_char next_state, +static void ospf6_neighbor_state_change(uint8_t next_state, struct ospf6_neighbor *on, int event) { - u_char prev_state; + uint8_t prev_state; prev_state = on->state; on->state = next_state; @@ -708,7 +708,7 @@ static void ospf6_neighbor_show_detail(struct vty *vty, (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MBIT) ? "More " : ""), (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MSBIT) ? "Master" : "Slave"), - (u_long)ntohl(on->dbdesc_seqnum)); + (unsigned long)ntohl(on->dbdesc_seqnum)); vty_out(vty, " Summary-List: %d LSAs\n", on->summary_list->count); for (ALL_LSDB(on->summary_list, lsa)) @@ -826,7 +826,7 @@ DEFUN (show_ipv6_ospf6_neighbor_one, struct ospf6_area *oa; struct listnode *i, *j, *k; void (*showfunc)(struct vty *, struct ospf6_neighbor *); - u_int32_t router_id; + uint32_t router_id; OSPF6_CMD_CHECK_RUNNING(); showfunc = ospf6_neighbor_show_detail; @@ -909,7 +909,7 @@ DEFUN (no_debug_ospf6, DEBUG_STR OSPF6_STR) { - u_int i; + unsigned int i; struct ospf6_lsa_handler *handler = NULL; OSPF6_DEBUG_ABR_OFF(); diff --git a/ospf6d/ospf6_neighbor.h b/ospf6d/ospf6_neighbor.h index 529f586f1..0c4926edb 100644 --- a/ospf6d/ospf6_neighbor.h +++ b/ospf6d/ospf6_neighbor.h @@ -41,25 +41,25 @@ struct ospf6_neighbor { struct ospf6_interface *ospf6_if; /* Neighbor state */ - u_char state; + uint8_t state; /* timestamp of last changing state */ - u_int32_t state_change; + uint32_t state_change; struct timeval last_changed; /* Neighbor Router ID */ - u_int32_t router_id; + uint32_t router_id; /* Neighbor Interface ID */ ifindex_t ifindex; /* Router Priority of this neighbor */ - u_char priority; + uint8_t priority; - u_int32_t drouter; - u_int32_t bdrouter; - u_int32_t prev_drouter; - u_int32_t prev_bdrouter; + uint32_t drouter; + uint32_t bdrouter; + uint32_t prev_drouter; + uint32_t prev_bdrouter; /* Options field (Capability) */ char options[3]; @@ -68,8 +68,8 @@ struct ospf6_neighbor { struct in6_addr linklocal_addr; /* For Database Exchange */ - u_char dbdesc_bits; - u_int32_t dbdesc_seqnum; + uint8_t dbdesc_bits; + uint32_t dbdesc_seqnum; /* Last received Database Description packet */ struct ospf6_dbdesc dbdesc_last; @@ -145,9 +145,9 @@ extern const char *ospf6_neighbor_state_str[]; int ospf6_neighbor_cmp(void *va, void *vb); void ospf6_neighbor_dbex_init(struct ospf6_neighbor *on); -struct ospf6_neighbor *ospf6_neighbor_lookup(u_int32_t, +struct ospf6_neighbor *ospf6_neighbor_lookup(uint32_t, struct ospf6_interface *); -struct ospf6_neighbor *ospf6_neighbor_create(u_int32_t, +struct ospf6_neighbor *ospf6_neighbor_create(uint32_t, struct ospf6_interface *); void ospf6_neighbor_delete(struct ospf6_neighbor *); diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c index 9f81bb89f..4790d8f01 100644 --- a/ospf6d/ospf6_network.c +++ b/ospf6d/ospf6_network.c @@ -38,9 +38,9 @@ struct in6_addr alldrouters6; /* setsockopt MulticastLoop to off */ static void ospf6_reset_mcastloop(void) { - u_int off = 0; + unsigned int off = 0; if (setsockopt(ospf6_sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &off, - sizeof(u_int)) + sizeof(unsigned int)) < 0) zlog_warn("Network: reset IPV6_MULTICAST_LOOP failed: %s", safe_strerror(errno)); @@ -156,7 +156,7 @@ int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst, struct cmsghdr *scmsgp; union { struct cmsghdr hdr; - u_char buf[CMSG_SPACE(sizeof(struct in6_pktinfo))]; + uint8_t buf[CMSG_SPACE(sizeof(struct in6_pktinfo))]; } cmsgbuf; struct in6_pktinfo *pktinfo; struct sockaddr_in6 dst_sin6; @@ -212,7 +212,7 @@ int ospf6_recvmsg(struct in6_addr *src, struct in6_addr *dst, int retval; struct msghdr rmsghdr; struct cmsghdr *rcmsgp; - u_char cmsgbuf[CMSG_SPACE(sizeof(struct in6_pktinfo))]; + uint8_t cmsgbuf[CMSG_SPACE(sizeof(struct in6_pktinfo))]; struct in6_pktinfo *pktinfo; struct sockaddr_in6 src_sin6; diff --git a/ospf6d/ospf6_proto.c b/ospf6d/ospf6_proto.c index d0ab67655..4b56a64b7 100644 --- a/ospf6d/ospf6_proto.c +++ b/ospf6d/ospf6_proto.c @@ -26,10 +26,10 @@ void ospf6_prefix_apply_mask(struct ospf6_prefix *op) { - u_char *pnt, mask; + uint8_t *pnt, mask; int index, offset; - pnt = (u_char *)((caddr_t)op + sizeof(struct ospf6_prefix)); + pnt = (uint8_t *)((caddr_t)op + sizeof(struct ospf6_prefix)); index = op->prefix_length / 8; offset = op->prefix_length % 8; mask = 0xff << (8 - offset); @@ -48,7 +48,7 @@ void ospf6_prefix_apply_mask(struct ospf6_prefix *op) pnt[index++] = 0; } -void ospf6_prefix_options_printbuf(u_int8_t prefix_options, char *buf, int size) +void ospf6_prefix_options_printbuf(uint8_t prefix_options, char *buf, int size) { snprintf(buf, size, "xxx"); } @@ -63,7 +63,7 @@ void ospf6_capability_printbuf(char capability, char *buf, int size) snprintf(buf, size, "----%c%c%c%c", w, v, e, b); } -void ospf6_options_printbuf(u_char *options, char *buf, int size) +void ospf6_options_printbuf(uint8_t *options, char *buf, int size) { const char *dc, *r, *n, *mc, *e, *v6; dc = (OSPF6_OPT_ISSET(options, OSPF6_OPT_DC) ? "DC" : "--"); diff --git a/ospf6d/ospf6_proto.h b/ospf6d/ospf6_proto.h index 591919085..ca2804c47 100644 --- a/ospf6d/ospf6_proto.h +++ b/ospf6d/ospf6_proto.h @@ -53,11 +53,11 @@ /* OSPF6 Prefix */ #define OSPF6_PREFIX_MIN_SIZE 4U /* .length == 0 */ struct ospf6_prefix { - u_int8_t prefix_length; - u_int8_t prefix_options; + uint8_t prefix_length; + uint8_t prefix_options; union { - u_int16_t _prefix_metric; - u_int16_t _prefix_referenced_lstype; + uint16_t _prefix_metric; + uint16_t _prefix_referenced_lstype; } u; #define prefix_metric u._prefix_metric #define prefix_refer_lstype u._prefix_referenced_lstype @@ -92,9 +92,9 @@ struct ospf6_prefix { } while (0) extern void ospf6_prefix_apply_mask(struct ospf6_prefix *op); -extern void ospf6_prefix_options_printbuf(u_int8_t prefix_options, char *buf, +extern void ospf6_prefix_options_printbuf(uint8_t prefix_options, char *buf, int size); extern void ospf6_capability_printbuf(char capability, char *buf, int size); -extern void ospf6_options_printbuf(u_char *options, char *buf, int size); +extern void ospf6_options_printbuf(uint8_t *options, char *buf, int size); #endif /* OSPF6_PROTO_H */ diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index 87f3f6edc..4d436792d 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -122,7 +122,7 @@ static char *ospf6_route_table_name(struct ospf6_route_table *table) return name; } -void ospf6_linkstate_prefix(u_int32_t adv_router, u_int32_t id, +void ospf6_linkstate_prefix(uint32_t adv_router, uint32_t id, struct prefix *prefix) { memset(prefix, 0, sizeof(struct prefix)); @@ -134,7 +134,7 @@ void ospf6_linkstate_prefix(u_int32_t adv_router, u_int32_t id, void ospf6_linkstate_prefix2str(struct prefix *prefix, char *buf, int size) { - u_int32_t adv_router, id; + uint32_t adv_router, id; char adv_router_str[16], id_str[16]; memcpy(&adv_router, &prefix->u.prefix6.s6_addr[0], 4); memcpy(&id, &prefix->u.prefix6.s6_addr[4], 4); @@ -1245,7 +1245,7 @@ static void ospf6_route_show_table_match(struct vty *vty, int detail, } static void ospf6_route_show_table_type(struct vty *vty, int detail, - u_char type, + uint8_t type, struct ospf6_route_table *table) { struct ospf6_route *route; @@ -1288,7 +1288,7 @@ int ospf6_route_table_show(struct vty *vty, int argc_start, int argc, int isprefix = 0; int i, ret; struct prefix prefix; - u_char type = 0; + uint8_t type = 0; memset(&prefix, 0, sizeof(struct prefix)); @@ -1375,7 +1375,7 @@ static void ospf6_linkstate_show_header(struct vty *vty) static void ospf6_linkstate_show(struct vty *vty, struct ospf6_route *route) { - u_int32_t router, id; + uint32_t router, id; char routername[16], idname[16], rbits[16], options[16]; router = ospf6_linkstate_prefix_adv_router(&route->prefix); @@ -1501,7 +1501,7 @@ void ospf6_brouter_show_header(struct vty *vty) void ospf6_brouter_show(struct vty *vty, struct ospf6_route *route) { - u_int32_t adv_router; + uint32_t adv_router; char adv[16], rbits[16], options[16], area[16]; adv_router = ospf6_linkstate_prefix_adv_router(&route->prefix); diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h index b759828c3..7ad1f19fc 100644 --- a/ospf6d/ospf6_route.h +++ b/ospf6d/ospf6_route.h @@ -63,9 +63,9 @@ struct ospf6_nexthop { /* Path */ struct ospf6_ls_origin { - u_int16_t type; - u_int32_t id; - u_int32_t adv_router; + uint16_t type; + uint32_t id; + uint32_t adv_router; }; struct ospf6_path { @@ -73,29 +73,29 @@ struct ospf6_path { struct ospf6_ls_origin origin; /* Router bits */ - u_char router_bits; + uint8_t router_bits; /* Optional Capabilities */ - u_char options[3]; + uint8_t options[3]; /* Prefix Options */ - u_char prefix_options; + uint8_t prefix_options; /* Associated Area */ - u_int32_t area_id; + uint32_t area_id; /* Path-type */ - u_char type; - u_char subtype; /* only used for redistribute i.e ZEBRA_ROUTE_XXX */ + uint8_t type; + uint8_t subtype; /* only used for redistribute i.e ZEBRA_ROUTE_XXX */ /* Cost */ - u_int8_t metric_type; - u_int32_t cost; + uint8_t metric_type; + uint32_t cost; union { - u_int32_t cost_e2; - u_int32_t cost_config; + uint32_t cost_e2; + uint32_t cost_config; } u; - u_int32_t tag; + uint32_t tag; /* nh list for this path */ struct list *nh_list; @@ -126,7 +126,7 @@ struct ospf6_route { unsigned int lock; /* Destination Type */ - u_char type; + uint8_t type; /* XXX: It would likely be better to use separate struct in_addr's * for the advertising router-ID and prefix IDs, instead of stuffing @@ -141,13 +141,13 @@ struct ospf6_route { struct timeval changed; /* flag */ - u_char flag; + uint8_t flag; /* route option */ void *route_option; /* link state id for advertising */ - u_int32_t linkstate_id; + uint32_t linkstate_id; /* path */ struct ospf6_path path; @@ -184,7 +184,7 @@ struct ospf6_route_table { /* patricia tree */ struct route_table *table; - u_int32_t count; + uint32_t count; bitfield_t idspace; @@ -256,7 +256,7 @@ extern const char *ospf6_path_type_substr[OSPF6_PATH_TYPE_MAX]; #define ADV_ROUTER_IN_PREFIX(x) ((x)->u.lp.id.s_addr) /* Function prototype */ -extern void ospf6_linkstate_prefix(u_int32_t adv_router, u_int32_t id, +extern void ospf6_linkstate_prefix(uint32_t adv_router, uint32_t id, struct prefix *prefix); extern void ospf6_linkstate_prefix2str(struct prefix *prefix, char *buf, int size); diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c index ed1d8bee7..376950e84 100644 --- a/ospf6d/ospf6_snmp.c +++ b/ospf6d/ospf6_snmp.c @@ -209,16 +209,16 @@ static oid ospfv3_oid[] = {OSPFv3MIB}; static oid ospfv3_trap_oid[] = {OSPFv3MIB, 0}; /* Hook functions. */ -static u_char *ospfv3GeneralGroup(struct variable *, oid *, size_t *, int, +static uint8_t *ospfv3GeneralGroup(struct variable *, oid *, size_t *, int, + size_t *, WriteMethod **); +static uint8_t *ospfv3AreaEntry(struct variable *, oid *, size_t *, int, + size_t *, WriteMethod **); +static uint8_t *ospfv3WwLsdbEntry(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **); -static u_char *ospfv3AreaEntry(struct variable *, oid *, size_t *, int, +static uint8_t *ospfv3NbrEntry(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **); -static u_char *ospfv3WwLsdbEntry(struct variable *, oid *, size_t *, int, - size_t *, WriteMethod **); -static u_char *ospfv3NbrEntry(struct variable *, oid *, size_t *, int, size_t *, +static uint8_t *ospfv3IfEntry(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **); -static u_char *ospfv3IfEntry(struct variable *, oid *, size_t *, int, size_t *, - WriteMethod **); static struct variable ospfv3_variables[] = { /* OSPF general variables */ @@ -631,12 +631,12 @@ static struct variable ospfv3_variables[] = { {1, 9, 1, 15}}, }; -static u_char *ospfv3GeneralGroup(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfv3GeneralGroup(struct variable *v, oid *name, + size_t *length, int exact, size_t *var_len, + WriteMethod **write_method) { - u_int16_t sum; - u_int32_t count; + uint16_t sum; + uint32_t count; struct ospf6_lsa *lsa = NULL; /* Check whether the instance identifier is valid */ @@ -728,15 +728,15 @@ static u_char *ospfv3GeneralGroup(struct variable *v, oid *name, size_t *length, return NULL; } -static u_char *ospfv3AreaEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfv3AreaEntry(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct ospf6_area *oa, *area = NULL; struct ospf6_lsa *lsa = NULL; - u_int32_t area_id = 0; - u_int32_t count; - u_int16_t sum; + uint32_t area_id = 0; + uint32_t count; + uint16_t sum; struct listnode *node; unsigned int len; char a[16]; @@ -758,7 +758,7 @@ static u_char *ospfv3AreaEntry(struct variable *v, oid *name, size_t *length, inet_ntop(AF_INET, &area_id, a, sizeof(a)); zlog_debug("SNMP access by area: %s, exact=%d len=%d length=%lu", a, - exact, len, (u_long)*length); + exact, len, (unsigned long)*length); for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) { if (area == NULL) { @@ -779,7 +779,7 @@ static u_char *ospfv3AreaEntry(struct variable *v, oid *name, size_t *length, inet_ntop(AF_INET, &area->area_id, a, sizeof(a)); zlog_debug("SNMP found area: %s, exact=%d len=%d length=%lu", a, exact, - len, (u_long)*length); + len, (unsigned long)*length); switch (v->magic) { case OSPFv3IMPORTASEXTERN: @@ -833,15 +833,15 @@ static int if_icmp_func(struct interface *ifp1, struct interface *ifp2) return (ifp1->ifindex - ifp2->ifindex); } -static u_char *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); struct ospf6_lsa *lsa = NULL; ifindex_t ifindex; uint32_t area_id, id, instid, adv_router; - u_int16_t type; + uint16_t type; int len; oid *offset; int offsetlen; @@ -1027,7 +1027,7 @@ static u_char *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length, break; case OSPFv3WWLSDBADVERTISEMENT: *var_len = ntohs(lsa->header->length); - return (u_char *)lsa->header; + return (uint8_t *)lsa->header; break; case OSPFv3WWLSDBTYPEKNOWN: return SNMP_INTEGER(OSPF6_LSA_IS_KNOWN(lsa->header->type) @@ -1038,9 +1038,9 @@ static u_char *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length, return NULL; } -static u_char *ospfv3IfEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfv3IfEntry(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); ifindex_t ifindex = 0; @@ -1052,7 +1052,7 @@ static u_char *ospfv3IfEntry(struct variable *v, oid *name, size_t *length, struct list *ifslist; oid *offset; int offsetlen, len; - u_int32_t sum; + uint32_t sum; if (smux_header_table(v, name, length, exact, var_len, write_method) == MATCH_FAILED) @@ -1191,9 +1191,9 @@ static u_char *ospfv3IfEntry(struct variable *v, oid *name, size_t *length, return NULL; } -static u_char *ospfv3NbrEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfv3NbrEntry(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); ifindex_t ifindex = 0; @@ -1301,7 +1301,7 @@ static u_char *ospfv3NbrEntry(struct variable *v, oid *name, size_t *length, return SNMP_INTEGER(2); /* IPv6 only */ case OSPFv3NBRADDRESS: *var_len = sizeof(struct in6_addr); - return (u_char *)&on->linklocal_addr; + return (uint8_t *)&on->linklocal_addr; case OSPFv3NBROPTIONS: return SNMP_INTEGER(on->options[2]); case OSPFv3NBRPRIORITY: diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index 8d32f3505..28c345982 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -139,10 +139,10 @@ static struct ospf6_vertex *ospf6_vertex_create(struct ospf6_lsa *lsa) v->lsa = lsa; /* capability bits + options */ - v->capability = *(u_char *)(OSPF6_LSA_HEADER_END(lsa->header)); - v->options[0] = *(u_char *)(OSPF6_LSA_HEADER_END(lsa->header) + 1); - v->options[1] = *(u_char *)(OSPF6_LSA_HEADER_END(lsa->header) + 2); - v->options[2] = *(u_char *)(OSPF6_LSA_HEADER_END(lsa->header) + 3); + v->capability = *(uint8_t *)(OSPF6_LSA_HEADER_END(lsa->header)); + v->options[0] = *(uint8_t *)(OSPF6_LSA_HEADER_END(lsa->header) + 1); + v->options[1] = *(uint8_t *)(OSPF6_LSA_HEADER_END(lsa->header) + 2); + v->options[2] = *(uint8_t *)(OSPF6_LSA_HEADER_END(lsa->header) + 3); v->nh_list = list_new(); v->nh_list->cmp = (int (*)(void *, void *))ospf6_nexthop_cmp; @@ -166,8 +166,8 @@ static struct ospf6_lsa *ospf6_lsdesc_lsa(caddr_t lsdesc, struct ospf6_vertex *v) { struct ospf6_lsa *lsa = NULL; - u_int16_t type = 0; - u_int32_t id = 0, adv_router = 0; + uint16_t type = 0; + uint32_t id = 0, adv_router = 0; if (VERTEX_IS_TYPE(NETWORK, v)) { type = htons(OSPF6_LSTYPE_ROUTER); @@ -262,8 +262,8 @@ static void ospf6_nexthop_calc(struct ospf6_vertex *w, struct ospf6_vertex *v, int i; ifindex_t ifindex; struct ospf6_interface *oi; - u_int16_t type; - u_int32_t adv_router; + uint16_t type; + uint32_t adv_router; struct ospf6_lsa *lsa; struct ospf6_link_lsa *link_lsa; char buf[64]; @@ -456,7 +456,7 @@ void ospf6_spf_reason_string(unsigned int reason, char *buf, int size) /* RFC2328 16.1. Calculating the shortest-path tree for an area */ /* RFC2740 3.8.1. Calculating the shortest path tree for an area */ -void ospf6_spf_calculation(u_int32_t router_id, +void ospf6_spf_calculation(uint32_t router_id, struct ospf6_route_table *result_table, struct ospf6_area *oa) { @@ -966,7 +966,7 @@ struct ospf6_lsa *ospf6_create_single_router_lsa(struct ospf6_area *area, uint8_t *new_header = NULL; const struct route_node *end = NULL; uint16_t lsa_length, total_lsa_length = 0, num_lsa = 0; - u_int16_t type = 0; + uint16_t type = 0; char ifbuf[16]; uint32_t interface_id; caddr_t lsd; diff --git a/ospf6d/ospf6_spf.h b/ospf6d/ospf6_spf.h index f294b8d34..da95ec80a 100644 --- a/ospf6d/ospf6_spf.h +++ b/ospf6d/ospf6_spf.h @@ -36,7 +36,7 @@ extern unsigned char conf_debug_ospf6_spf; /* Transit Vertex */ struct ospf6_vertex { /* type of this vertex */ - u_int8_t type; + uint8_t type; /* Vertex Identifier */ struct prefix vertex_id; @@ -51,16 +51,16 @@ struct ospf6_vertex { struct ospf6_lsa *lsa; /* Distance from Root (i.e. Cost) */ - u_int32_t cost; + uint32_t cost; /* Router hops to this node */ - u_char hops; + uint8_t hops; /* capability bits */ - u_char capability; + uint8_t capability; /* Optional capabilities */ - u_char options[3]; + uint8_t options[3]; /* For tree display */ struct ospf6_vertex *parent; @@ -136,7 +136,7 @@ static inline unsigned int ospf6_lsremove_to_spf_reason(struct ospf6_lsa *lsa) } extern void ospf6_spf_table_finish(struct ospf6_route_table *result_table); -extern void ospf6_spf_calculation(u_int32_t router_id, +extern void ospf6_spf_calculation(uint32_t router_id, struct ospf6_route_table *result_table, struct ospf6_area *oa); extern void ospf6_spf_schedule(struct ospf6 *ospf, unsigned int reason); diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 630b717fb..3f1b30b9e 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -365,7 +365,7 @@ DEFUN(ospf6_router_id, int idx = 0; int ret; const char *router_id_str; - u_int32_t router_id; + uint32_t router_id; struct ospf6_area *oa; struct listnode *node; @@ -663,7 +663,7 @@ DEFUN (ospf6_interface_area, struct ospf6_area *oa; struct ospf6_interface *oi; struct interface *ifp; - u_int32_t area_id; + uint32_t area_id; /* find/create ospf6 interface */ ifp = if_get_by_name(argv[idx_ifname]->arg, VRF_DEFAULT, 0); @@ -722,7 +722,7 @@ DEFUN (no_ospf6_interface_area, struct ospf6_interface *oi; struct ospf6_area *oa; struct interface *ifp; - u_int32_t area_id; + uint32_t area_id; ifp = if_lookup_by_name(argv[idx_ifname]->arg, VRF_DEFAULT); if (ifp == NULL) { diff --git a/ospf6d/ospf6_top.h b/ospf6d/ospf6_top.h index 3ffcad056..381027dcf 100644 --- a/ospf6d/ospf6_top.h +++ b/ospf6d/ospf6_top.h @@ -32,10 +32,10 @@ struct ospf6_master { /* OSPFv3 top level data structure */ struct ospf6 { /* my router id */ - u_int32_t router_id; + uint32_t router_id; /* static router id */ - u_int32_t router_id_static; + uint32_t router_id_static; struct in_addr router_id_zebra; @@ -55,7 +55,7 @@ struct ospf6 { struct ospf6_route_table *external_table; struct route_table *external_id_table; - u_int32_t external_id; + uint32_t external_id; /* redistribute route-map */ struct { @@ -63,10 +63,10 @@ struct ospf6 { struct route_map *map; } rmap[ZEBRA_ROUTE_MAX]; - u_char flag; + uint8_t flag; /* Configured flags */ - u_char config_flags; + uint8_t config_flags; #define OSPF6_LOG_ADJACENCY_CHANGES (1 << 0) #define OSPF6_LOG_ADJACENCY_DETAIL (1 << 1) @@ -91,13 +91,13 @@ struct ospf6 { struct thread *maxage_remover; struct thread *t_distribute_update; /* Distirbute update timer. */ - u_int32_t ref_bandwidth; + uint32_t ref_bandwidth; /* Distance parameters */ - 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; struct route_table *distance_table; diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index 0decc09a2..8c2e706d1 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -468,7 +468,7 @@ int ospf6_distance_set(struct vty *vty, struct ospf6 *o, { int ret; struct prefix_ipv6 p; - u_char distance; + uint8_t distance; struct route_node *rn; struct ospf6_distance *odistance; @@ -553,7 +553,7 @@ void ospf6_distance_reset(struct ospf6 *o) } } -u_char ospf6_distance_apply(struct prefix_ipv6 *p, struct ospf6_route * or) +uint8_t ospf6_distance_apply(struct prefix_ipv6 *p, struct ospf6_route * or) { struct ospf6 *o; diff --git a/ospf6d/ospf6_zebra.h b/ospf6d/ospf6_zebra.h index 8ab999336..e2f778fa7 100644 --- a/ospf6d/ospf6_zebra.h +++ b/ospf6d/ospf6_zebra.h @@ -34,7 +34,7 @@ extern unsigned char conf_debug_ospf6_zebra; /* OSPF6 distance */ struct ospf6_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; @@ -55,7 +55,7 @@ extern void ospf6_zebra_delete_discard(struct ospf6_route *request); struct ospf6; extern void ospf6_distance_reset(struct ospf6 *); -extern u_char ospf6_distance_apply(struct prefix_ipv6 *, struct ospf6_route *); +extern uint8_t ospf6_distance_apply(struct prefix_ipv6 *, struct ospf6_route *); extern int ospf6_distance_set(struct vty *, struct ospf6 *, const char *, const char *, const char *); diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index 58a39156d..8d6d5b4a2 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -126,9 +126,9 @@ static int parse_show_level(int idx_level, int argc, struct cmd_token **argv) return level; } -static u_int16_t parse_type_spec(int idx_lsa, int argc, struct cmd_token **argv) +static uint16_t parse_type_spec(int idx_lsa, int argc, struct cmd_token **argv) { - u_int16_t type = 0; + uint16_t type = 0; if (argc > idx_lsa) { if (strmatch(argv[idx_lsa]->text, "router")) @@ -220,7 +220,7 @@ DEFUN (show_ipv6_ospf6_database_type, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; + uint16_t type = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -282,7 +282,7 @@ DEFUN (show_ipv6_ospf6_database_id, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int32_t id = 0; + uint32_t id = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -333,7 +333,7 @@ DEFUN (show_ipv6_ospf6_database_router, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int32_t adv_router = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router); @@ -434,8 +434,8 @@ DEFUN (show_ipv6_ospf6_database_type_id, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t id = 0; + uint16_t type = 0; + uint32_t id = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -508,8 +508,8 @@ DEFUN (show_ipv6_ospf6_database_type_router, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t adv_router = 0; + uint16_t type = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -575,8 +575,8 @@ DEFUN (show_ipv6_ospf6_database_id_router, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int32_t id = 0; - u_int32_t adv_router = 0; + uint32_t id = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); inet_pton(AF_INET, argv[idx_ls_id]->arg, &id); @@ -628,8 +628,8 @@ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int32_t id = 0; - u_int32_t adv_router = 0; + uint32_t id = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router); @@ -687,9 +687,9 @@ DEFUN (show_ipv6_ospf6_database_type_id_router, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t id = 0; - u_int32_t adv_router = 0; + uint16_t type = 0; + uint32_t id = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -765,9 +765,9 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t id = 0; - u_int32_t adv_router = 0; + uint16_t type = 0; + uint32_t id = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -828,7 +828,7 @@ DEFUN (show_ipv6_ospf6_database_self_originated, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int32_t adv_router = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); level = parse_show_level(idx_level, argc, argv); @@ -884,8 +884,8 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t adv_router = 0; + uint16_t type = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -959,9 +959,9 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t adv_router = 0; - u_int32_t id = 0; + uint16_t type = 0; + uint32_t adv_router = 0; + uint32_t id = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -1034,9 +1034,9 @@ DEFUN (show_ipv6_ospf6_database_type_id_self_originated, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t adv_router = 0; - u_int32_t id = 0; + uint16_t type = 0; + uint32_t adv_router = 0; + uint32_t id = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -1090,7 +1090,7 @@ DEFUN (show_ipv6_ospf6_border_routers, "Show detailed output\n") { int idx_ipv4 = 4; - u_int32_t adv_router; + uint32_t adv_router; struct ospf6_route *ro; struct prefix prefix; diff --git a/ospfclient/ospf_apiclient.c b/ospfclient/ospf_apiclient.c index bdac0e49a..5b46059d7 100644 --- a/ospfclient/ospf_apiclient.c +++ b/ospfclient/ospf_apiclient.c @@ -303,7 +303,7 @@ int ospf_apiclient_close(struct ospf_apiclient *oclient) static int ospf_apiclient_send_request(struct ospf_apiclient *oclient, struct msg *msg) { - u_int32_t reqseq; + uint32_t reqseq; struct msg_reply *msgreply; int rc; @@ -341,10 +341,10 @@ static int ospf_apiclient_send_request(struct ospf_apiclient *oclient, * ----------------------------------------------------------- */ -static u_int32_t ospf_apiclient_get_seqnr(void) +static uint32_t ospf_apiclient_get_seqnr(void) { - static u_int32_t seqnr = MIN_SEQ; - u_int32_t tmp; + static uint32_t seqnr = MIN_SEQ; + uint32_t tmp; tmp = seqnr; /* Increment sequence number */ @@ -364,8 +364,8 @@ static u_int32_t ospf_apiclient_get_seqnr(void) /* * Synchronous request to register opaque type. */ -int ospf_apiclient_register_opaque_type(struct ospf_apiclient *cl, u_char ltype, - u_char otype) +int ospf_apiclient_register_opaque_type(struct ospf_apiclient *cl, + uint8_t ltype, uint8_t otype) { struct msg *msg; int rc; @@ -424,15 +424,15 @@ out: int ospf_apiclient_lsa_originate(struct ospf_apiclient *oclient, struct in_addr ifaddr, struct in_addr area_id, - u_char lsa_type, u_char opaque_type, - u_int32_t opaque_id, void *opaquedata, + uint8_t lsa_type, uint8_t opaque_type, + uint32_t opaque_id, void *opaquedata, int opaquelen) { struct msg *msg; int rc; - u_char buf[OSPF_MAX_LSA_SIZE]; + uint8_t buf[OSPF_MAX_LSA_SIZE]; struct lsa_header *lsah; - u_int32_t tmp; + uint32_t tmp; /* We can only originate opaque LSAs */ @@ -455,7 +455,7 @@ int ospf_apiclient_lsa_originate(struct ospf_apiclient *oclient, lsah->checksum = 0; lsah->length = htons(sizeof(struct lsa_header) + opaquelen); - memcpy(((u_char *)lsah) + sizeof(struct lsa_header), opaquedata, + memcpy(((uint8_t *)lsah) + sizeof(struct lsa_header), opaquedata, opaquelen); msg = new_msg_originate_request(ospf_apiclient_get_seqnr(), ifaddr, @@ -470,8 +470,8 @@ int ospf_apiclient_lsa_originate(struct ospf_apiclient *oclient, } int ospf_apiclient_lsa_delete(struct ospf_apiclient *oclient, - struct in_addr area_id, u_char lsa_type, - u_char opaque_type, u_int32_t opaque_id) + struct in_addr area_id, uint8_t lsa_type, + uint8_t opaque_type, uint32_t opaque_id) { struct msg *msg; int rc; @@ -655,18 +655,18 @@ static void ospf_apiclient_msghandle(struct ospf_apiclient *oclient, void ospf_apiclient_register_callback( struct ospf_apiclient *oclient, - void (*ready_notify)(u_char lsa_type, u_char opaque_type, + void (*ready_notify)(uint8_t lsa_type, uint8_t opaque_type, struct in_addr addr), void (*new_if)(struct in_addr ifaddr, struct in_addr area_id), void (*del_if)(struct in_addr ifaddr), void (*ism_change)(struct in_addr ifaddr, struct in_addr area_id, - u_char status), + uint8_t status), void (*nsm_change)(struct in_addr ifaddr, struct in_addr nbraddr, - struct in_addr router_id, u_char status), + struct in_addr router_id, uint8_t status), void (*update_notify)(struct in_addr ifaddr, struct in_addr area_id, - u_char self_origin, struct lsa_header *lsa), + uint8_t self_origin, struct lsa_header *lsa), void (*delete_notify)(struct in_addr ifaddr, struct in_addr area_id, - u_char self_origin, struct lsa_header *lsa)) + uint8_t self_origin, struct lsa_header *lsa)) { assert(oclient); assert(update_notify); diff --git a/ospfclient/ospf_apiclient.h b/ospfclient/ospf_apiclient.h index 916a2d8ed..6d1eb7f64 100644 --- a/ospfclient/ospf_apiclient.h +++ b/ospfclient/ospf_apiclient.h @@ -30,18 +30,18 @@ struct ospf_apiclient { int fd_async; /* Pointer to callback functions */ - void (*ready_notify)(u_char lsa_type, u_char opaque_type, + void (*ready_notify)(uint8_t lsa_type, uint8_t opaque_type, struct in_addr addr); void (*new_if)(struct in_addr ifaddr, struct in_addr area_id); void (*del_if)(struct in_addr ifaddr); void (*ism_change)(struct in_addr ifaddr, struct in_addr area_id, - u_char status); + uint8_t status); void (*nsm_change)(struct in_addr ifaddr, struct in_addr nbraddr, - struct in_addr router_id, u_char status); + struct in_addr router_id, uint8_t status); void (*update_notify)(struct in_addr ifaddr, struct in_addr area_id, - u_char self_origin, struct lsa_header *lsa); + uint8_t self_origin, struct lsa_header *lsa); void (*delete_notify)(struct in_addr ifaddr, struct in_addr area_id, - u_char self_origin, struct lsa_header *lsa); + uint8_t self_origin, struct lsa_header *lsa); }; @@ -58,27 +58,27 @@ int ospf_apiclient_close(struct ospf_apiclient *oclient); /* Synchronous request to register opaque type. */ int ospf_apiclient_register_opaque_type(struct ospf_apiclient *oclient, - u_char ltype, u_char otype); + uint8_t ltype, uint8_t otype); /* Synchronous request to register event mask. */ int ospf_apiclient_register_events(struct ospf_apiclient *oclient, - u_int32_t mask); + uint32_t mask); /* Register callback functions.*/ void ospf_apiclient_register_callback( struct ospf_apiclient *oclient, - void (*ready_notify)(u_char lsa_type, u_char opaque_type, + void (*ready_notify)(uint8_t lsa_type, uint8_t opaque_type, struct in_addr addr), void (*new_if)(struct in_addr ifaddr, struct in_addr area_id), void (*del_if)(struct in_addr ifaddr), void (*ism_change)(struct in_addr ifaddr, struct in_addr area_id, - u_char status), + uint8_t status), void (*nsm_change)(struct in_addr ifaddr, struct in_addr nbraddr, - struct in_addr router_id, u_char status), + struct in_addr router_id, uint8_t status), void (*update_notify)(struct in_addr ifaddr, struct in_addr area_id, - u_char selforig, struct lsa_header *lsa), + uint8_t selforig, struct lsa_header *lsa), void (*delete_notify)(struct in_addr ifaddr, struct in_addr area_id, - u_char selforig, struct lsa_header *lsa)); + uint8_t selforig, struct lsa_header *lsa)); /* Synchronous request to synchronize LSDB. */ int ospf_apiclient_sync_lsdb(struct ospf_apiclient *oclient); @@ -86,16 +86,16 @@ int ospf_apiclient_sync_lsdb(struct ospf_apiclient *oclient); /* Synchronous request to originate or update opaque LSA. */ int ospf_apiclient_lsa_originate(struct ospf_apiclient *oclient, struct in_addr ifaddr, struct in_addr area_id, - u_char lsa_type, u_char opaque_type, - u_int32_t opaque_id, void *opaquedata, + uint8_t lsa_type, uint8_t opaque_type, + uint32_t opaque_id, void *opaquedata, int opaquelen); /* Synchronous request to delete opaque LSA. Parameter opaque_id is in host byte order */ int ospf_apiclient_lsa_delete(struct ospf_apiclient *oclient, - struct in_addr area_id, u_char lsa_type, - u_char opaque_type, u_int32_t opaque_id); + struct in_addr area_id, uint8_t lsa_type, + uint8_t opaque_type, uint32_t opaque_id); /* Fetch async message and handle it */ int ospf_apiclient_handle_async(struct ospf_apiclient *oclient); diff --git a/ospfclient/ospfclient.c b/ospfclient/ospfclient.c index 03b543a78..f5f994517 100644 --- a/ospfclient/ospfclient.c +++ b/ospfclient/ospfclient.c @@ -72,7 +72,7 @@ char **args; /* Our opaque LSAs have the following format. */ struct my_opaque_lsa { struct lsa_header hdr; /* include common LSA header */ - u_char data[4]; /* our own data format then follows here */ + uint8_t data[4]; /* our own data format then follows here */ }; @@ -109,13 +109,13 @@ static int lsa_inject(struct thread *t) struct ospf_apiclient *cl; struct in_addr ifaddr; 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; void *opaquedata; int opaquelen; - static u_int32_t counter = 1; /* Incremented each time invoked */ + static uint32_t counter = 1; /* Incremented each time invoked */ int rc; cl = THREAD_ARG(t); @@ -135,7 +135,7 @@ static int lsa_inject(struct thread *t) opaque_type = atoi(args[3]); opaque_id = atoi(args[4]); opaquedata = &counter; - opaquelen = sizeof(u_int32_t); + opaquelen = sizeof(uint32_t); printf("Originating/updating LSA with counter=%d... ", counter); rc = ospf_apiclient_lsa_originate(cl, ifaddr, area_id, lsa_type, @@ -182,7 +182,7 @@ static int lsa_read(struct thread *thread) */ static void lsa_update_callback(struct in_addr ifaddr, struct in_addr area_id, - u_char is_self_originated, + uint8_t is_self_originated, struct lsa_header *lsa) { printf("lsa_update_callback: "); @@ -198,7 +198,7 @@ static void lsa_update_callback(struct in_addr ifaddr, struct in_addr area_id, if (lsa->type == OSPF_ROUTER_LSA) { struct router_lsa *rl = (struct router_lsa) lsa; ... - u_int16_t links = rl->links; + uint16_t links = rl->links; ... } */ @@ -207,7 +207,7 @@ static void lsa_update_callback(struct in_addr ifaddr, struct in_addr area_id, } static void lsa_delete_callback(struct in_addr ifaddr, struct in_addr area_id, - u_char is_self_originated, + uint8_t is_self_originated, struct lsa_header *lsa) { printf("lsa_delete_callback: "); @@ -218,7 +218,7 @@ static void lsa_delete_callback(struct in_addr ifaddr, struct in_addr area_id, ospf_lsa_header_dump(lsa); } -static void ready_callback(u_char lsa_type, u_char opaque_type, +static void ready_callback(uint8_t lsa_type, uint8_t opaque_type, struct in_addr addr) { printf("ready_callback: lsa_type: %d opaque_type: %d addr=%s\n", @@ -246,7 +246,7 @@ static void del_if_callback(struct in_addr ifaddr) } static void ism_change_callback(struct in_addr ifaddr, struct in_addr area_id, - u_char state) + uint8_t state) { printf("ism_change: ifaddr: %s ", inet_ntoa(ifaddr)); printf("area_id: %s\n", inet_ntoa(area_id)); @@ -255,7 +255,7 @@ static void ism_change_callback(struct in_addr ifaddr, struct in_addr area_id, } static void nsm_change_callback(struct in_addr ifaddr, struct in_addr nbraddr, - struct in_addr router_id, u_char state) + struct in_addr router_id, uint8_t state) { printf("nsm_change: ifaddr: %s ", inet_ntoa(ifaddr)); printf("nbraddr: %s\n", inet_ntoa(nbraddr)); 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); diff --git a/pimd/mtracebis.c b/pimd/mtracebis.c index 5c8229175..ce83b420b 100644 --- a/pimd/mtracebis.c +++ b/pimd/mtracebis.c @@ -251,7 +251,7 @@ static int recv_response(int fd, int *hops, struct igmp_mtrace *mtracer) struct igmp_mtrace *mtrace; int mtrace_len; int responses; - u_short sum; + unsigned short sum; recvd = recvfrom(fd, mtrace_buf, IP_AND_MTRACE_BUF_LEN, 0, NULL, 0); diff --git a/pimd/pim_bfd.c b/pimd/pim_bfd.c index 29ff337d9..f5772174b 100644 --- a/pimd/pim_bfd.c +++ b/pimd/pim_bfd.c @@ -62,7 +62,7 @@ void pim_bfd_write_config(struct vty *vty, struct interface *ifp) * pim_bfd_show_info - Show BFD info structure */ void pim_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, @@ -179,8 +179,8 @@ void pim_bfd_trigger_event(struct pim_interface *pim_ifp, * pim_bfd_if_param_set - Set the configured BFD paramter values for * interface. */ -void pim_bfd_if_param_set(struct interface *ifp, u_int32_t min_rx, - u_int32_t min_tx, u_int8_t detect_mult, int defaults) +void pim_bfd_if_param_set(struct interface *ifp, uint32_t min_rx, + uint32_t min_tx, uint8_t detect_mult, int defaults) { struct pim_interface *pim_ifp = ifp->info; int command = 0; diff --git a/pimd/pim_bfd.h b/pimd/pim_bfd.h index 316d3c1e2..0dfd80839 100644 --- a/pimd/pim_bfd.h +++ b/pimd/pim_bfd.h @@ -28,9 +28,9 @@ void pim_bfd_init(void); void pim_bfd_write_config(struct vty *vty, struct interface *ifp); void pim_bfd_show_info(struct vty *vty, void *bfd_info, json_object *json_obj, - u_char use_json, int param_only); -void pim_bfd_if_param_set(struct interface *ifp, u_int32_t min_rx, - u_int32_t min_tx, u_int8_t detect_mult, int defaults); + uint8_t use_json, int param_only); +void pim_bfd_if_param_set(struct interface *ifp, uint32_t min_rx, + uint32_t min_tx, uint8_t detect_mult, int defaults); int pim_bfd_reg_dereg_all_nbr(struct interface *ifp, int command); void pim_bfd_trigger_event(struct pim_interface *pim_ifp, struct pim_neighbor *nbr, uint8_t nbr_up); diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 803e7bb01..6432c0da7 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -432,7 +432,7 @@ static void pim_show_membership_helper(struct vty *vty, json_object_object_add(json_iface, ch_grp_str, json_row); } static void pim_show_membership(struct pim_instance *pim, struct vty *vty, - u_char uj) + uint8_t uj) { struct pim_interface *pim_ifp; struct pim_ifchannel *ch; @@ -549,7 +549,7 @@ static void pim_print_ifp_flags(struct vty *vty, struct interface *ifp, } static void igmp_show_interfaces(struct pim_instance *pim, struct vty *vty, - u_char uj) + uint8_t uj) { struct interface *ifp; time_t now; @@ -634,7 +634,7 @@ static void igmp_show_interfaces(struct pim_instance *pim, struct vty *vty, static void igmp_show_interfaces_single(struct pim_instance *pim, struct vty *vty, const char *ifname, - u_char uj) + uint8_t uj) { struct igmp_sock *igmp; struct interface *ifp; @@ -894,7 +894,7 @@ static void igmp_show_interface_join(struct pim_instance *pim, struct vty *vty) static void pim_show_interfaces_single(struct pim_instance *pim, struct vty *vty, const char *ifname, - u_char uj) + uint8_t uj) { struct in_addr ifaddr; struct interface *ifp; @@ -1295,7 +1295,7 @@ static void pim_show_interfaces_single(struct pim_instance *pim, } static void pim_show_interfaces(struct pim_instance *pim, struct vty *vty, - u_char uj) + uint8_t uj) { struct interface *ifp; struct listnode *upnode; @@ -1388,7 +1388,7 @@ static void pim_show_interfaces(struct pim_instance *pim, struct vty *vty, } static void pim_show_interface_traffic(struct pim_instance *pim, - struct vty *vty, u_char uj) + struct vty *vty, uint8_t uj) { struct interface *ifp = NULL; struct pim_interface *pim_ifp = NULL; @@ -1468,7 +1468,7 @@ static void pim_show_interface_traffic(struct pim_instance *pim, static void pim_show_interface_traffic_single(struct pim_instance *pim, struct vty *vty, - const char *ifname, u_char uj) + const char *ifname, uint8_t uj) { struct interface *ifp = NULL; struct pim_interface *pim_ifp = NULL; @@ -1557,7 +1557,7 @@ static void pim_show_interface_traffic_single(struct pim_instance *pim, static void pim_show_join_helper(struct vty *vty, struct pim_interface *pim_ifp, struct pim_ifchannel *ch, json_object *json, - time_t now, u_char uj) + time_t now, uint8_t uj) { char ch_src_str[INET_ADDRSTRLEN]; char ch_grp_str[INET_ADDRSTRLEN]; @@ -1620,7 +1620,7 @@ static void pim_show_join_helper(struct vty *vty, struct pim_interface *pim_ifp, } } -static void pim_show_join(struct pim_instance *pim, struct vty *vty, u_char uj) +static void pim_show_join(struct pim_instance *pim, struct vty *vty, uint8_t uj) { struct pim_interface *pim_ifp; struct pim_ifchannel *ch; @@ -1654,7 +1654,7 @@ static void pim_show_join(struct pim_instance *pim, struct vty *vty, u_char uj) } static void pim_show_neighbors_single(struct pim_instance *pim, struct vty *vty, - const char *neighbor, u_char uj) + const char *neighbor, uint8_t uj) { struct listnode *neighnode; struct interface *ifp; @@ -1864,7 +1864,7 @@ static void pim_show_neighbors_single(struct pim_instance *pim, struct vty *vty, static void pim_show_state(struct pim_instance *pim, struct vty *vty, const char *src_or_group, const char *group, - u_char uj) + uint8_t uj) { struct channel_oil *c_oil; struct listnode *node; @@ -2065,7 +2065,7 @@ static void pim_show_state(struct pim_instance *pim, struct vty *vty, } static void pim_show_neighbors(struct pim_instance *pim, struct vty *vty, - u_char uj) + uint8_t uj) { struct listnode *neighnode; struct interface *ifp; @@ -2261,7 +2261,7 @@ static const char *pim_reg_state2brief_str(enum pim_reg_state reg_state, } static void pim_show_upstream(struct pim_instance *pim, struct vty *vty, - u_char uj) + uint8_t uj) { struct listnode *upnode; struct pim_upstream *up; @@ -2406,7 +2406,7 @@ static void pim_show_join_desired_helper(struct pim_instance *pim, struct vty *vty, struct pim_interface *pim_ifp, struct pim_ifchannel *ch, - json_object *json, u_char uj) + json_object *json, uint8_t uj) { struct pim_upstream *up = ch->upstream; json_object *json_group = NULL; @@ -2462,7 +2462,7 @@ static void pim_show_join_desired_helper(struct pim_instance *pim, } static void pim_show_join_desired(struct pim_instance *pim, struct vty *vty, - u_char uj) + uint8_t uj) { struct pim_interface *pim_ifp; struct pim_ifchannel *ch; @@ -2498,7 +2498,7 @@ static void pim_show_join_desired(struct pim_instance *pim, struct vty *vty, } static void pim_show_upstream_rpf(struct pim_instance *pim, struct vty *vty, - u_char uj) + uint8_t uj) { struct listnode *upnode; struct pim_upstream *up; @@ -2631,7 +2631,7 @@ static void show_scan_oil_stats(struct pim_instance *pim, struct vty *vty, uptime_mroute_del, (long long)pim->mroute_del_events); } -static void pim_show_rpf(struct pim_instance *pim, struct vty *vty, u_char uj) +static void pim_show_rpf(struct pim_instance *pim, struct vty *vty, uint8_t uj) { struct listnode *up_node; struct pim_upstream *up; @@ -2755,7 +2755,7 @@ static void pim_show_nexthop(struct pim_instance *pim, struct vty *vty) } static void igmp_show_groups(struct pim_instance *pim, struct vty *vty, - u_char uj) + uint8_t uj) { struct interface *ifp; time_t now; @@ -3306,7 +3306,7 @@ DEFUN (show_ip_igmp_interface, { int idx = 2; struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); if (!vrf) return CMD_WARNING; @@ -3333,7 +3333,7 @@ DEFUN (show_ip_igmp_interface_vrf_all, JSON_STR) { int idx = 2; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct vrf *vrf; bool first = true; @@ -3389,7 +3389,7 @@ DEFUN (show_ip_igmp_join_vrf_all, VRF_CMD_HELP_STR "IGMP static join information\n") { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct vrf *vrf; bool first = true; @@ -3423,7 +3423,7 @@ DEFUN (show_ip_igmp_groups, { int idx = 2; struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); if (!vrf) return CMD_WARNING; @@ -3443,7 +3443,7 @@ DEFUN (show_ip_igmp_groups_vrf_all, IGMP_GROUP_STR JSON_STR) { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct vrf *vrf; bool first = true; @@ -3621,7 +3621,7 @@ DEFUN (show_ip_pim_interface, { int idx = 2; struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); if (!vrf) return CMD_WARNING; @@ -3648,7 +3648,7 @@ DEFUN (show_ip_pim_interface_vrf_all, JSON_STR) { int idx = 6; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct vrf *vrf; bool first = true; @@ -3687,7 +3687,7 @@ DEFUN (show_ip_pim_join, { int idx = 2; struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); if (!vrf) return CMD_WARNING; @@ -3707,7 +3707,7 @@ DEFUN (show_ip_pim_join_vrf_all, "PIM interface join information\n" JSON_STR) { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct vrf *vrf; bool first = true; @@ -3741,7 +3741,7 @@ DEFUN (show_ip_pim_local_membership, { int idx = 2; struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); if (!vrf) return CMD_WARNING; @@ -3765,7 +3765,7 @@ DEFUN (show_ip_pim_neighbor, { int idx = 2; struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); if (!vrf) return CMD_WARNING; @@ -3792,7 +3792,7 @@ DEFUN (show_ip_pim_neighbor_vrf_all, JSON_STR) { int idx = 2; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct vrf *vrf; bool first = true; @@ -3855,7 +3855,7 @@ DEFUN (show_ip_pim_state, const char *group = NULL; int idx = 2; struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); if (!vrf) return CMD_WARNING; @@ -3889,7 +3889,7 @@ DEFUN (show_ip_pim_state_vrf_all, const char *src_or_group = NULL; const char *group = NULL; int idx = 2; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct vrf *vrf; bool first = true; @@ -3932,7 +3932,7 @@ DEFUN (show_ip_pim_upstream, { int idx = 2; struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); if (!vrf) return CMD_WARNING; @@ -3952,7 +3952,7 @@ DEFUN (show_ip_pim_upstream_vrf_all, "PIM upstream information\n" JSON_STR) { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct vrf *vrf; bool first = true; @@ -3984,7 +3984,7 @@ DEFUN (show_ip_pim_upstream_join_desired, { int idx = 2; struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); if (!vrf) return CMD_WARNING; @@ -4006,7 +4006,7 @@ DEFUN (show_ip_pim_upstream_rpf, { int idx = 2; struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); if (!vrf) return CMD_WARNING; @@ -4028,7 +4028,7 @@ DEFUN (show_ip_pim_rp, { int idx = 2; struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); if (!vrf) return CMD_WARNING; @@ -4048,7 +4048,7 @@ DEFUN (show_ip_pim_rp_vrf_all, "PIM RP information\n" JSON_STR) { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct vrf *vrf; bool first = true; @@ -4082,7 +4082,7 @@ DEFUN (show_ip_pim_rpf, { int idx = 2; struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); if (!vrf) return CMD_WARNING; @@ -4102,7 +4102,7 @@ DEFUN (show_ip_pim_rpf_vrf_all, "PIM cached source rpf information\n" JSON_STR) { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct vrf *vrf; bool first = true; @@ -4249,7 +4249,7 @@ DEFUN (show_ip_pim_interface_traffic, { int idx = 2; struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); if (!vrf) return CMD_WARNING; @@ -4373,7 +4373,7 @@ DEFUN (show_ip_multicast_vrf_all, VRF_CMD_HELP_STR "Multicast global information\n") { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct vrf *vrf; bool first = true; @@ -4396,7 +4396,7 @@ DEFUN (show_ip_multicast_vrf_all, } static void show_mroute(struct pim_instance *pim, struct vty *vty, bool fill, - u_char uj) + uint8_t uj) { struct listnode *node; struct channel_oil *c_oil; @@ -4730,7 +4730,7 @@ DEFUN (show_ip_mroute, "Fill in Assumed data\n" JSON_STR) { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); bool fill = false; int idx = 2; struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); @@ -4755,7 +4755,7 @@ DEFUN (show_ip_mroute_vrf_all, "Fill in Assumed data\n" JSON_STR) { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); int idx = 4; struct vrf *vrf; bool first = true; @@ -4863,7 +4863,7 @@ DEFUN (show_ip_mroute_count_vrf_all, VRF_CMD_HELP_STR "Route and packet count data\n") { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct vrf *vrf; bool first = true; @@ -5454,7 +5454,7 @@ DEFUN (no_ip_pim_ssm_prefix_list_name, } static void ip_pim_ssm_show_group_range(struct pim_instance *pim, - struct vty *vty, u_char uj) + struct vty *vty, uint8_t uj) { struct pim_ssm *ssm = pim->ssm_info; const char *range_str = @@ -5483,7 +5483,7 @@ DEFUN (show_ip_pim_ssm_range, { int idx = 2; struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); if (!vrf) return CMD_WARNING; @@ -5494,7 +5494,7 @@ DEFUN (show_ip_pim_ssm_range, } static void ip_pim_ssm_show_group_type(struct pim_instance *pim, - struct vty *vty, u_char uj, + struct vty *vty, uint8_t uj, const char *group) { struct in_addr group_addr; @@ -5536,7 +5536,7 @@ DEFUN (show_ip_pim_group_type, { int idx = 2; struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); if (!vrf) return CMD_WARNING; @@ -7439,9 +7439,9 @@ DEFUN (ip_pim_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; struct pim_interface *pim_ifp = ifp->info; @@ -7787,7 +7787,7 @@ static void print_empty_json_obj(struct vty *vty) } static void ip_msdp_show_mesh_group(struct pim_instance *pim, struct vty *vty, - u_char uj) + uint8_t uj) { struct listnode *mbrnode; struct pim_msdp_mg_mbr *mbr; @@ -7864,7 +7864,7 @@ DEFUN (show_ip_msdp_mesh_group, "MSDP mesh-group information\n" JSON_STR) { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); int idx = 2; struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); @@ -7886,7 +7886,7 @@ DEFUN (show_ip_msdp_mesh_group_vrf_all, "MSDP mesh-group information\n" JSON_STR) { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct vrf *vrf; bool first = true; @@ -7909,7 +7909,7 @@ DEFUN (show_ip_msdp_mesh_group_vrf_all, } static void ip_msdp_show_peers(struct pim_instance *pim, struct vty *vty, - u_char uj) + uint8_t uj) { struct listnode *mpnode; struct pim_msdp_peer *mp; @@ -7963,7 +7963,7 @@ static void ip_msdp_show_peers(struct pim_instance *pim, struct vty *vty, } static void ip_msdp_show_peers_detail(struct pim_instance *pim, struct vty *vty, - const char *peer, u_char uj) + const char *peer, uint8_t uj) { struct listnode *mpnode; struct pim_msdp_peer *mp; @@ -8079,7 +8079,7 @@ DEFUN (show_ip_msdp_peer_detail, "peer ip address\n" JSON_STR) { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); int idx = 2; struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); @@ -8114,7 +8114,7 @@ DEFUN (show_ip_msdp_peer_detail_vrf_all, JSON_STR) { int idx = 2; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct vrf *vrf; bool first = true; @@ -8142,7 +8142,7 @@ DEFUN (show_ip_msdp_peer_detail_vrf_all, } static void ip_msdp_show_sa(struct pim_instance *pim, struct vty *vty, - u_char uj) + uint8_t uj) { struct listnode *sanode; struct pim_msdp_sa *sa; @@ -8219,7 +8219,7 @@ static void ip_msdp_show_sa(struct pim_instance *pim, struct vty *vty, static void ip_msdp_show_sa_entry_detail(struct pim_msdp_sa *sa, const char *src_str, const char *grp_str, struct vty *vty, - u_char uj, json_object *json) + uint8_t uj, json_object *json) { char rp_str[INET_ADDRSTRLEN]; char peer_str[INET_ADDRSTRLEN]; @@ -8283,7 +8283,7 @@ static void ip_msdp_show_sa_entry_detail(struct pim_msdp_sa *sa, } static void ip_msdp_show_sa_detail(struct pim_instance *pim, struct vty *vty, - u_char uj) + uint8_t uj) { struct listnode *sanode; struct pim_msdp_sa *sa; @@ -8320,7 +8320,7 @@ DEFUN (show_ip_msdp_sa_detail, "Detailed output\n" JSON_STR) { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); int idx = 2; struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); @@ -8343,7 +8343,7 @@ DEFUN (show_ip_msdp_sa_detail_vrf_all, "Detailed output\n" JSON_STR) { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct vrf *vrf; bool first = true; @@ -8366,7 +8366,7 @@ DEFUN (show_ip_msdp_sa_detail_vrf_all, } static void ip_msdp_show_sa_addr(struct pim_instance *pim, struct vty *vty, - const char *addr, u_char uj) + const char *addr, uint8_t uj) { struct listnode *sanode; struct pim_msdp_sa *sa; @@ -8395,7 +8395,7 @@ static void ip_msdp_show_sa_addr(struct pim_instance *pim, struct vty *vty, } static void ip_msdp_show_sa_sg(struct pim_instance *pim, struct vty *vty, - const char *src, const char *grp, u_char uj) + const char *src, const char *grp, uint8_t uj) { struct listnode *sanode; struct pim_msdp_sa *sa; @@ -8435,7 +8435,7 @@ DEFUN (show_ip_msdp_sa_sg, "group ip\n" JSON_STR) { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct vrf *vrf; int idx = 2; @@ -8472,7 +8472,7 @@ DEFUN (show_ip_msdp_sa_sg_vrf_all, "group ip\n" JSON_STR) { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); struct vrf *vrf; bool first = true; int idx = 2; diff --git a/pimd/pim_igmp_mtrace.c b/pimd/pim_igmp_mtrace.c index b183492e3..8274d08a2 100644 --- a/pimd/pim_igmp_mtrace.c +++ b/pimd/pim_igmp_mtrace.c @@ -174,7 +174,7 @@ static int mtrace_send_packet(struct interface *ifp, int fd; char if_str[INET_ADDRSTRLEN]; char rsp_str[INET_ADDRSTRLEN]; - u_char ttl; + uint8_t ttl; memset(&to, 0, sizeof(to)); to.sin_family = AF_INET; diff --git a/pimd/pim_nht.h b/pimd/pim_nht.h index 72ed777bf..77e25dcd7 100644 --- a/pimd/pim_nht.h +++ b/pimd/pim_nht.h @@ -33,13 +33,13 @@ struct pim_nexthop_cache { struct pim_rpf rpf; /* IGP route's metric. */ - u_int32_t metric; + uint32_t metric; uint32_t distance; /* Nexthop number and nexthop linked list. */ - u_char nexthop_num; + uint8_t nexthop_num; struct nexthop *nexthop; int64_t last_update; - u_int16_t flags; + uint16_t flags; #define PIM_NEXTHOP_VALID (1 << 0) struct list *rp_list; diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c index 239536118..7491e695f 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -976,7 +976,7 @@ int pim_rp_check_is_my_ip_address(struct pim_instance *pim, } void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, - u_char uj) + uint8_t uj) { struct rp_info *rp_info; struct rp_info *prev_rp_info = NULL; diff --git a/pimd/pim_rp.h b/pimd/pim_rp.h index e07d65137..e0631b27b 100644 --- a/pimd/pim_rp.h +++ b/pimd/pim_rp.h @@ -68,7 +68,7 @@ struct pim_rpf *pim_rp_g(struct pim_instance *pim, struct in_addr group); #define RP(P, G) pim_rp_g ((P), (G)) void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, - u_char uj); + uint8_t uj); void pim_resolve_rp_nh(struct pim_instance *pim); int pim_rp_list_cmp(void *v1, void *v2); #endif diff --git a/pimd/pim_sock.c b/pimd/pim_sock.c index a5a842cee..8f311391e 100644 --- a/pimd/pim_sock.c +++ b/pimd/pim_sock.c @@ -107,7 +107,7 @@ int pim_socket_bind(int fd, struct interface *ifp) } int pim_socket_mcast(int protocol, struct in_addr ifaddr, struct interface *ifp, - u_char loop) + uint8_t loop) { int rcvbuf = 1024 * 1024 * 8; #ifdef HAVE_STRUCT_IP_MREQN_IMR_IFINDEX diff --git a/pimd/pim_sock.h b/pimd/pim_sock.h index 358dd39a4..98db6fecd 100644 --- a/pimd/pim_sock.h +++ b/pimd/pim_sock.h @@ -39,7 +39,7 @@ int pim_socket_bind(int fd, struct interface *ifp); void pim_socket_ip_hdr(int fd); int pim_socket_raw(int protocol); int pim_socket_mcast(int protocol, struct in_addr ifaddr, struct interface *ifp, - u_char loop); + uint8_t loop); int pim_socket_join(int fd, struct in_addr group, struct in_addr ifaddr, ifindex_t ifindex); int pim_socket_join_source(int fd, ifindex_t ifindex, struct in_addr group_addr, diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c index 8006148f9..c29679bf3 100644 --- a/pimd/pim_zlookup.c +++ b/pimd/pim_zlookup.c @@ -144,8 +144,8 @@ static int zclient_read_nexthop(struct pim_instance *pim, int num_ifindex = 0; struct stream *s; uint16_t length; - u_char marker; - u_char version; + uint8_t marker; + uint8_t version; vrf_id_t vrf_id; uint16_t command = 0; struct in_addr raddr; @@ -515,8 +515,8 @@ int pim_zlookup_sg_statistics(struct channel_oil *c_oil) int err; uint16_t length = 0; vrf_id_t vrf_id; - u_char marker; - u_char version; + uint8_t marker; + uint8_t version; stream_reset(s); err = zclient_read_header(s, zlookup->sock, &length, &marker, @@ -40,7 +40,7 @@ */ #define qpb_address_family_set qpb__address_family__set static inline int qpb__address_family__set(Qpb__AddressFamily *pb_family, - u_char family) + uint8_t family) { switch (family) { case AF_INET: @@ -63,7 +63,7 @@ static inline int qpb__address_family__set(Qpb__AddressFamily *pb_family, */ #define qpb_address_family_get qpb__address_family__get static inline int qpb__address_family__get(Qpb__AddressFamily pb_family, - u_char *family) + uint8_t *family) { switch (pb_family) { @@ -115,7 +115,7 @@ static inline Qpb__L3Prefix *qpb__l3_prefix__create(qpb_allocator_t *allocator, */ #define qpb_l3_prefix_get qpb__l3_prefix__get static inline int qpb__l3_prefix__get(const Qpb__L3Prefix *pb_prefix, - u_char family, struct prefix *prefix) + uint8_t family, struct prefix *prefix) { switch (family) { @@ -262,7 +262,7 @@ static inline int qpb__ipv6_address__get(const Qpb__Ipv6Address *v6, #define qpb_l3_address_create qpb__l3_address__create static inline Qpb__L3Address * qpb__l3_address__create(qpb_allocator_t *allocator, union g_addr *addr, - u_char family) + uint8_t family) { Qpb__L3Address *l3_addr; @@ -298,7 +298,7 @@ qpb__l3_address__create(qpb_allocator_t *allocator, union g_addr *addr, */ #define qpb_l3_address_get qpb__l3_address__get static inline int qpb__l3_address__get(const Qpb__L3Address *l3_addr, - u_char *family, union g_addr *addr) + uint8_t *family, union g_addr *addr) { if (l3_addr->v4) { qpb__ipv4_address__get(l3_addr->v4, &addr->ipv4); diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 3a773f245..5a3f34120 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -133,7 +133,7 @@ void rip_interface_multicast_set(int sock, struct connected *connected) } /* Send RIP request packet to specified interface. */ -static void rip_request_interface_send(struct interface *ifp, u_char version) +static void rip_request_interface_send(struct interface *ifp, uint8_t version) { struct sockaddr_in to; diff --git a/ripd/rip_offset.c b/ripd/rip_offset.c index 0e0230c9d..ab14c3176 100644 --- a/ripd/rip_offset.c +++ b/ripd/rip_offset.c @@ -185,7 +185,7 @@ static int rip_offset_list_unset(struct vty *vty, const char *alist, /* If metric is modifed return 1. */ int rip_offset_list_apply_in(struct prefix_ipv4 *p, struct interface *ifp, - u_int32_t *metric) + uint32_t *metric) { struct rip_offset_list *offset; struct access_list *alist; @@ -221,7 +221,7 @@ int rip_offset_list_apply_in(struct prefix_ipv4 *p, struct interface *ifp, /* If metric is modifed return 1. */ int rip_offset_list_apply_out(struct prefix_ipv4 *p, struct interface *ifp, - u_int32_t *metric) + uint32_t *metric) { struct rip_offset_list *offset; struct access_list *alist; diff --git a/ripd/rip_peer.c b/ripd/rip_peer.c index 0a6337bf7..ae62835a7 100644 --- a/ripd/rip_peer.c +++ b/ripd/rip_peer.c @@ -105,7 +105,7 @@ static struct rip_peer *rip_peer_get(struct in_addr *addr) return peer; } -void rip_peer_update(struct sockaddr_in *from, u_char version) +void rip_peer_update(struct sockaddr_in *from, uint8_t version) { struct rip_peer *peer; peer = rip_peer_get(&from->sin_addr); diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c index 40e7ed915..2c0232487 100644 --- a/ripd/rip_routemap.c +++ b/ripd/rip_routemap.c @@ -37,7 +37,7 @@ struct rip_metric_modifier { enum { metric_increment, metric_decrement, metric_absolute } type; bool used; - u_int8_t metric; + uint8_t metric; }; /* Hook function for updating route_map assignment. */ @@ -62,8 +62,8 @@ static route_map_result_t route_match_metric(void *rule, struct prefix *prefix, route_map_object_t type, void *object) { - u_int32_t *metric; - u_int32_t check; + uint32_t *metric; + uint32_t check; struct rip_info *rinfo; if (type == RMAP_RIP) { @@ -85,9 +85,9 @@ static route_map_result_t route_match_metric(void *rule, struct prefix *prefix, /* Route map `match metric' match statement. `arg' is METRIC value */ static void *route_match_metric_compile(const char *arg) { - u_int32_t *metric; + uint32_t *metric; - metric = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(u_int32_t)); + metric = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(uint32_t)); *metric = atoi(arg); if (*metric > 0) diff --git a/ripd/rip_snmp.c b/ripd/rip_snmp.c index 45bb2e377..917e532e0 100644 --- a/ripd/rip_snmp.c +++ b/ripd/rip_snmp.c @@ -88,14 +88,14 @@ static oid rip_oid[] = {RIPV2MIB}; static struct route_table *rip_ifaddr_table; /* Hook functions. */ -static u_char *rip2Globals(struct variable *, oid[], size_t *, int, size_t *, - WriteMethod **); -static u_char *rip2IfStatEntry(struct variable *, oid[], size_t *, int, - size_t *, WriteMethod **); -static u_char *rip2IfConfAddress(struct variable *, oid[], size_t *, int, - size_t *, WriteMethod **); -static u_char *rip2PeerTable(struct variable *, oid[], size_t *, int, size_t *, - WriteMethod **); +static uint8_t *rip2Globals(struct variable *, oid[], size_t *, int, size_t *, + WriteMethod **); +static uint8_t *rip2IfStatEntry(struct variable *, oid[], size_t *, int, + size_t *, WriteMethod **); +static uint8_t *rip2IfConfAddress(struct variable *, oid[], size_t *, int, + size_t *, WriteMethod **); +static uint8_t *rip2PeerTable(struct variable *, oid[], size_t *, int, size_t *, + WriteMethod **); static struct variable rip_variables[] = { /* RIP Global Counters. */ @@ -152,9 +152,9 @@ static struct variable rip_variables[] = { extern struct thread_master *master; -static u_char *rip2Globals(struct variable *v, oid name[], size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *rip2Globals(struct variable *v, oid name[], size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { if (smux_header_generic(v, name, length, exact, var_len, write_method) == MATCH_FAILED) @@ -336,9 +336,9 @@ static struct rip_peer *rip2PeerLookup(struct variable *v, oid name[], return NULL; } -static u_char *rip2IfStatEntry(struct variable *v, oid name[], size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *rip2IfStatEntry(struct variable *v, oid name[], size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct interface *ifp; struct rip_interface *ri; @@ -365,20 +365,20 @@ static u_char *rip2IfStatEntry(struct variable *v, oid name[], size_t *length, break; case RIP2IFSTATRCVBADPACKETS: *var_len = sizeof(long); - return (u_char *)&ri->recv_badpackets; + return (uint8_t *)&ri->recv_badpackets; case RIP2IFSTATRCVBADROUTES: *var_len = sizeof(long); - return (u_char *)&ri->recv_badroutes; + return (uint8_t *)&ri->recv_badroutes; case RIP2IFSTATSENTUPDATES: *var_len = sizeof(long); - return (u_char *)&ri->sent_updates; + return (uint8_t *)&ri->sent_updates; case RIP2IFSTATSTATUS: *var_len = sizeof(long); v->type = ASN_INTEGER; - return (u_char *)&valid; + return (uint8_t *)&valid; default: return NULL; @@ -435,15 +435,15 @@ static long rip2IfConfReceive(struct rip_interface *ri) return doNotReceive; } -static u_char *rip2IfConfAddress(struct variable *v, oid name[], size_t *length, - int exact, size_t *val_len, - WriteMethod **write_method) +static uint8_t *rip2IfConfAddress(struct variable *v, oid name[], + size_t *length, int exact, size_t *val_len, + WriteMethod **write_method) { static struct in_addr addr; static long valid = SNMP_INVALID; static long domain = 0; static long config = 0; - static u_int auth = 0; + static unsigned int auth = 0; struct interface *ifp; struct rip_interface *ri; @@ -464,43 +464,43 @@ static u_char *rip2IfConfAddress(struct variable *v, oid name[], size_t *length, switch (v->magic) { case RIP2IFCONFADDRESS: *val_len = sizeof(struct in_addr); - return (u_char *)&addr; + return (uint8_t *)&addr; case RIP2IFCONFDOMAIN: *val_len = 2; - return (u_char *)&domain; + return (uint8_t *)&domain; case RIP2IFCONFAUTHTYPE: auth = ri->auth_type; *val_len = sizeof(long); v->type = ASN_INTEGER; - return (u_char *)&auth; + return (uint8_t *)&auth; case RIP2IFCONFAUTHKEY: *val_len = 0; - return (u_char *)&domain; + return (uint8_t *)&domain; case RIP2IFCONFSEND: config = rip2IfConfSend(ri); *val_len = sizeof(long); v->type = ASN_INTEGER; - return (u_char *)&config; + return (uint8_t *)&config; case RIP2IFCONFRECEIVE: config = rip2IfConfReceive(ri); *val_len = sizeof(long); v->type = ASN_INTEGER; - return (u_char *)&config; + return (uint8_t *)&config; case RIP2IFCONFDEFAULTMETRIC: *val_len = sizeof(long); v->type = ASN_INTEGER; - return (u_char *)&ifp->metric; + return (uint8_t *)&ifp->metric; case RIP2IFCONFSTATUS: *val_len = sizeof(long); v->type = ASN_INTEGER; - return (u_char *)&valid; + return (uint8_t *)&valid; case RIP2IFCONFSRCADDRESS: *val_len = sizeof(struct in_addr); - return (u_char *)&addr; + return (uint8_t *)&addr; default: return NULL; @@ -508,9 +508,9 @@ static u_char *rip2IfConfAddress(struct variable *v, oid name[], size_t *length, return NULL; } -static u_char *rip2PeerTable(struct variable *v, oid name[], size_t *length, - int exact, size_t *val_len, - WriteMethod **write_method) +static uint8_t *rip2PeerTable(struct variable *v, oid name[], size_t *length, + int exact, size_t *val_len, + WriteMethod **write_method) { static struct in_addr addr; static int domain = 0; @@ -533,11 +533,11 @@ static u_char *rip2PeerTable(struct variable *v, oid name[], size_t *length, switch (v->magic) { case RIP2PEERADDRESS: *val_len = sizeof(struct in_addr); - return (u_char *)&peer->addr; + return (uint8_t *)&peer->addr; case RIP2PEERDOMAIN: *val_len = 2; - return (u_char *)&domain; + return (uint8_t *)&domain; case RIP2PEERLASTUPDATE: #if 0 @@ -548,23 +548,23 @@ static u_char *rip2PeerTable(struct variable *v, oid name[], size_t *length, */ *val_len = sizeof (time_t); uptime = peer->uptime; /* now - snmp_agent_startup - peer->uptime */ - return (u_char *) &uptime; + return (uint8_t *) &uptime; #else - return (u_char *)NULL; + return (uint8_t *)NULL; #endif case RIP2PEERVERSION: *val_len = sizeof(int); version = peer->version; - return (u_char *)&version; + return (uint8_t *)&version; case RIP2PEERRCVBADPACKETS: *val_len = sizeof(int); - return (u_char *)&peer->recv_badpackets; + return (uint8_t *)&peer->recv_badpackets; case RIP2PEERRCVBADROUTES: *val_len = sizeof(int); - return (u_char *)&peer->recv_badroutes; + return (uint8_t *)&peer->recv_badroutes; default: return NULL; diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c index dc972981b..29b2f8817 100644 --- a/ripd/rip_zebra.c +++ b/ripd/rip_zebra.c @@ -37,7 +37,7 @@ struct zclient *zclient = NULL; /* Send ECMP routes to zebra. */ -static void rip_zebra_ipv4_send(struct route_node *rp, u_char cmd) +static void rip_zebra_ipv4_send(struct route_node *rp, uint8_t cmd) { struct list *list = (struct list *)rp->info; struct zapi_route api; diff --git a/ripd/ripd.c b/ripd/ripd.c index 86c0348b9..ecc402700 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -64,7 +64,7 @@ long rip_global_queries = 0; /* Prototypes. */ static void rip_event(enum rip_event, int); static void rip_output_process(struct connected *, struct sockaddr_in *, int, - u_char); + uint8_t); static int rip_triggered_update(struct thread *); static int rip_update_jitter(unsigned long); @@ -675,8 +675,8 @@ static void rip_packet_dump(struct rip_packet *packet, int size, struct rte *rte; const char *command_str; char pbuf[BUFSIZ], nbuf[BUFSIZ]; - u_char netmask = 0; - u_char *p; + uint8_t netmask = 0; + uint8_t *p; /* Set command string. */ if (packet->command > 0 && packet->command < RIP_COMMAND_MAX) @@ -698,7 +698,7 @@ static void rip_packet_dump(struct rip_packet *packet, int size, if (rte->family == htons(RIP_FAMILY_AUTH)) { if (rte->tag == htons(RIP_AUTH_SIMPLE_PASSWORD)) { - p = (u_char *)&rte->prefix; + p = (uint8_t *)&rte->prefix; zlog_debug( " family 0x%X type %d auth string: %s", @@ -719,11 +719,11 @@ static void rip_packet_dump(struct rip_packet *packet, int size, " Auth Data len %d", ntohs(md5->packet_len), md5->keyid, md5->auth_len); - zlog_debug( - " Sequence Number %ld", - (u_long)ntohl(md5->sequence)); + zlog_debug(" Sequence Number %ld", + (unsigned long)ntohl( + md5->sequence)); } else if (rte->tag == htons(RIP_AUTH_DATA)) { - p = (u_char *)&rte->prefix; + p = (uint8_t *)&rte->prefix; zlog_debug( " family 0x%X type %d (MD5 data)", @@ -753,7 +753,7 @@ static void rip_packet_dump(struct rip_packet *packet, int size, BUFSIZ), ntohs(rte->family), (route_tag_t)ntohs(rte->tag), - (u_long)ntohl(rte->metric)); + (unsigned long)ntohl(rte->metric)); } else { zlog_debug( " %s family %d tag %" ROUTE_TAG_PRI @@ -761,7 +761,7 @@ static void rip_packet_dump(struct rip_packet *packet, int size, inet_ntop(AF_INET, &rte->prefix, pbuf, BUFSIZ), ntohs(rte->family), (route_tag_t)ntohs(rte->tag), - (u_long)ntohl(rte->metric)); + (unsigned long)ntohl(rte->metric)); } } } @@ -771,7 +771,7 @@ static void rip_packet_dump(struct rip_packet *packet, int size, check net 0 because we accept default route. */ static int rip_destination_check(struct in_addr addr) { - u_int32_t destination; + uint32_t destination; /* Convert to host byte order. */ destination = ntohl(addr.s_addr); @@ -848,8 +848,8 @@ static int rip_auth_md5(struct rip_packet *packet, struct sockaddr_in *from, struct keychain *keychain; struct key *key; MD5_CTX ctx; - u_char digest[RIP_AUTH_MD5_SIZE]; - u_int16_t packet_len; + uint8_t digest[RIP_AUTH_MD5_SIZE]; + uint16_t packet_len; char auth_str[RIP_AUTH_MD5_SIZE]; if (IS_RIP_DEBUG_EVENT) @@ -892,7 +892,7 @@ static int rip_auth_md5(struct rip_packet *packet, struct sockaddr_in *from, } /* retrieve authentication data */ - md5data = (struct rip_md5_data *)(((u_char *)packet) + packet_len); + md5data = (struct rip_md5_data *)(((uint8_t *)packet) + packet_len); memset(auth_str, 0, RIP_AUTH_MD5_SIZE); @@ -1179,7 +1179,7 @@ static void rip_response_process(struct rip_packet *packet, int size, the received Next Hop is not directly reachable, it should be treated as 0.0.0.0. */ if (packet->version == RIPv2 && rte->nexthop.s_addr != 0) { - u_int32_t addrval; + uint32_t addrval; /* Multicast address check. */ addrval = ntohl(rte->nexthop.s_addr); @@ -1245,7 +1245,7 @@ static void rip_response_process(struct rip_packet *packet, int size, || (packet->version == RIPv2 && (rte->prefix.s_addr != 0 && rte->mask.s_addr == 0))) { - u_int32_t destination; + uint32_t destination; if (subnetted == -1) { memcpy(&ifaddr, ifc->address, @@ -1382,7 +1382,7 @@ static int rip_create_socket(void) * by connected argument. NULL to argument denotes destination should be * should be RIP multicast group */ -static int rip_send_packet(u_char *buf, int size, struct sockaddr_in *to, +static int rip_send_packet(uint8_t *buf, int size, struct sockaddr_in *to, struct connected *ifc) { int ret; @@ -1641,7 +1641,7 @@ static void rip_request_process(struct rip_packet *packet, int size, } packet->command = RIP_RESPONSE; - rip_send_packet((u_char *)packet, size, from, ifc); + rip_send_packet((uint8_t *)packet, size, from, ifc); } rip_global_queries++; } @@ -1661,7 +1661,7 @@ static int setsockopt_pktinfo(int sock) } /* Read RIP packet by recvmsg function. */ -int rip_recvmsg(int sock, u_char *buf, int size, struct sockaddr_in *from, +int rip_recvmsg(int sock, uint8_t *buf, int size, struct sockaddr_in *from, ifindex_t *ifindex) { int ret; @@ -2009,7 +2009,7 @@ static int rip_read(struct thread *t) /* Write routing table entry to the stream and return next index of the routing table entry in the stream. */ static int rip_write_rte(int num, struct stream *s, struct prefix_ipv4 *p, - u_char version, struct rip_info *rinfo) + uint8_t version, struct rip_info *rinfo) { struct in_addr mask; @@ -2037,7 +2037,7 @@ static int rip_write_rte(int num, struct stream *s, struct prefix_ipv4 *p, /* Send update to the ifp or spcified neighbor. */ void rip_output_process(struct connected *ifc, struct sockaddr_in *to, - int route_type, u_char version) + int route_type, uint8_t version) { int ret; struct stream *s; @@ -2400,7 +2400,7 @@ void rip_output_process(struct connected *ifc, struct sockaddr_in *to, } /* Send RIP packet to the interface. */ -static void rip_update_interface(struct connected *ifc, u_char version, +static void rip_update_interface(struct connected *ifc, uint8_t version, int route_type) { struct interface *ifp = ifc->ifp; @@ -2702,7 +2702,7 @@ static int rip_create(void) /* Sned RIP request to the destination. */ int rip_request_send(struct sockaddr_in *to, struct interface *ifp, - u_char version, struct connected *connected) + uint8_t version, struct connected *connected) { struct rte *rte; struct rip_packet rip_packet; @@ -2721,7 +2721,7 @@ int rip_request_send(struct sockaddr_in *to, struct interface *ifp, * interface does not support multicast. Caller loops * over each connected address for this case. */ - if (rip_send_packet((u_char *)&rip_packet, sizeof(rip_packet), + if (rip_send_packet((uint8_t *)&rip_packet, sizeof(rip_packet), to, connected) != sizeof(rip_packet)) return -1; @@ -2738,7 +2738,7 @@ int rip_request_send(struct sockaddr_in *to, struct interface *ifp, if (p->family != AF_INET) continue; - if (rip_send_packet((u_char *)&rip_packet, sizeof(rip_packet), + if (rip_send_packet((uint8_t *)&rip_packet, sizeof(rip_packet), to, connected) != sizeof(rip_packet)) return -1; @@ -3060,7 +3060,7 @@ struct route_table *rip_distance_table; struct rip_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; @@ -3081,7 +3081,7 @@ static int rip_distance_set(struct vty *vty, const char *distance_str, { int ret; struct prefix_ipv4 p; - u_char distance; + uint8_t distance; struct route_node *rn; struct rip_distance *rdistance; @@ -3166,7 +3166,7 @@ static void rip_distance_reset(void) } /* Apply RIP information to distance method. */ -u_char rip_distance_apply(struct rip_info *rinfo) +uint8_t rip_distance_apply(struct rip_info *rinfo) { struct route_node *rn; struct prefix_ipv4 p; diff --git a/ripd/ripd.h b/ripd/ripd.h index abbc3a79e..784b06460 100644 --- a/ripd/ripd.h +++ b/ripd/ripd.h @@ -139,11 +139,11 @@ struct rip { int default_metric; /* RIP default-information originate. */ - u_char default_information; + uint8_t default_information; char *default_information_route_map; /* RIP default distance. */ - u_char distance; + uint8_t distance; struct route_table *distance_table; /* RIP ECMP flag */ @@ -154,7 +154,7 @@ struct rip { char *name; struct route_map *map; int metric_config; - u_int32_t metric; + uint32_t metric; } route_map[ZEBRA_ROUTE_MAX]; QOBJ_FIELDS @@ -163,12 +163,12 @@ DECLARE_QOBJ_TYPE(rip) /* RIP routing table entry which belong to rip_packet. */ struct rte { - u_int16_t family; /* Address family of this route. */ - u_int16_t tag; /* Route Tag which included in RIP2 packet. */ + uint16_t family; /* Address family of this route. */ + uint16_t tag; /* Route Tag which included in RIP2 packet. */ struct in_addr prefix; /* Prefix of rip route. */ struct in_addr mask; /* Netmask of rip route. */ struct in_addr nexthop; /* Next hop of rip route. */ - u_int32_t metric; /* Metric value of rip route. */ + uint32_t metric; /* Metric value of rip route. */ }; /* RIP packet structure. */ @@ -199,19 +199,19 @@ struct rip_info { struct in_addr from; /* Metric of this route. */ - u_int32_t metric; + uint32_t metric; /* External metric of this route. if learnt from an externalm proto */ - u_int32_t external_metric; + uint32_t external_metric; /* Tag information of this route. */ - u_int16_t tag; + uint16_t tag; /* Flags of RIP route. */ #define RIP_RTF_FIB 1 #define RIP_RTF_CHANGED 2 - u_char flags; + uint8_t flags; /* Garbage collect timer. */ struct thread *t_timeout; @@ -219,14 +219,14 @@ struct rip_info { /* Route-map futures - this variables can be changed. */ struct in_addr nexthop_out; - u_char metric_set; - u_int32_t metric_out; - u_int16_t tag_out; + uint8_t metric_set; + uint32_t metric_out; + uint16_t tag_out; ifindex_t ifindex_out; struct route_node *rp; - u_char distance; + uint8_t distance; #ifdef NEW_RIP_TABLE struct rip_info *next; @@ -266,7 +266,7 @@ struct rip_interface { char *key_chain; /* value to use for md5->auth_len */ - u_int8_t md5_auth_len; + uint8_t md5_auth_len; /* Split horizon flag. */ split_horizon_policy_t split_horizon; @@ -310,7 +310,7 @@ struct rip_peer { time_t uptime; /* Peer RIP version. */ - u_char version; + uint8_t version; /* Statistics. */ int recv_badpackets; @@ -321,20 +321,20 @@ struct rip_peer { }; struct rip_md5_info { - u_int16_t family; - u_int16_t type; - u_int16_t packet_len; - u_char keyid; - u_char auth_len; - u_int32_t sequence; - u_int32_t reserv1; - u_int32_t reserv2; + uint16_t family; + uint16_t type; + uint16_t packet_len; + uint8_t keyid; + uint8_t auth_len; + uint32_t sequence; + uint32_t reserv1; + uint32_t reserv2; }; struct rip_md5_data { - u_int16_t family; - u_int16_t type; - u_char digest[16]; + uint16_t family; + uint16_t type; + uint8_t digest[16]; }; /* RIP accepet/announce methods. */ @@ -380,7 +380,7 @@ extern void rip_zclient_reset(void); extern void rip_offset_init(void); extern int if_check_address(struct in_addr addr); -extern int rip_request_send(struct sockaddr_in *, struct interface *, u_char, +extern int rip_request_send(struct sockaddr_in *, struct interface *, uint8_t, struct connected *); extern int rip_neighbor_lookup(struct sockaddr_in *); @@ -401,7 +401,7 @@ extern int config_write_rip_offset_list(struct vty *); extern int config_write_rip_redistribute(struct vty *, int); extern void rip_peer_init(void); -extern void rip_peer_update(struct sockaddr_in *, u_char); +extern void rip_peer_update(struct sockaddr_in *, uint8_t); extern void rip_peer_bad_route(struct sockaddr_in *); extern void rip_peer_bad_packet(struct sockaddr_in *); extern void rip_peer_display(struct vty *); @@ -409,13 +409,13 @@ extern struct rip_peer *rip_peer_lookup(struct in_addr *); extern struct rip_peer *rip_peer_lookup_next(struct in_addr *); extern int rip_offset_list_apply_in(struct prefix_ipv4 *, struct interface *, - u_int32_t *); + uint32_t *); extern int rip_offset_list_apply_out(struct prefix_ipv4 *, struct interface *, - u_int32_t *); + uint32_t *); extern void rip_offset_clean(void); extern void rip_info_free(struct rip_info *); -extern u_char rip_distance_apply(struct rip_info *); +extern uint8_t rip_distance_apply(struct rip_info *); extern void rip_redistribute_clean(void); extern struct rip_info *rip_ecmp_add(struct rip_info *); diff --git a/ripngd/ripng_offset.c b/ripngd/ripng_offset.c index 82f8a7aa6..f8d73250b 100644 --- a/ripngd/ripng_offset.c +++ b/ripngd/ripng_offset.c @@ -194,7 +194,7 @@ static int ripng_offset_list_unset(struct vty *vty, const char *alist, /* If metric is modifed return 1. */ int ripng_offset_list_apply_in(struct prefix_ipv6 *p, struct interface *ifp, - u_char *metric) + uint8_t *metric) { struct ripng_offset_list *offset; struct access_list *alist; @@ -232,7 +232,7 @@ int ripng_offset_list_apply_in(struct prefix_ipv6 *p, struct interface *ifp, /* If metric is modifed return 1. */ int ripng_offset_list_apply_out(struct prefix_ipv6 *p, struct interface *ifp, - u_char *metric) + uint8_t *metric) { struct ripng_offset_list *offset; struct access_list *alist; diff --git a/ripngd/ripng_peer.c b/ripngd/ripng_peer.c index cd46d9740..2f7589848 100644 --- a/ripngd/ripng_peer.c +++ b/ripngd/ripng_peer.c @@ -113,7 +113,7 @@ static struct ripng_peer *ripng_peer_get(struct in6_addr *addr) return peer; } -void ripng_peer_update(struct sockaddr_in6 *from, u_char version) +void ripng_peer_update(struct sockaddr_in6 *from, uint8_t version) { struct ripng_peer *peer; peer = ripng_peer_get(&from->sin6_addr); diff --git a/ripngd/ripng_route.h b/ripngd/ripng_route.h index 3db1279b5..dc7d422d1 100644 --- a/ripngd/ripng_route.h +++ b/ripngd/ripng_route.h @@ -30,16 +30,16 @@ struct ripng_aggregate { unsigned int suppress; /* Metric of this route. */ - u_char metric; + uint8_t metric; /* Tag field of RIPng packet.*/ - u_int16_t tag; + uint16_t tag; /* Route-map futures - this variables can be changed. */ struct in6_addr nexthop_out; - u_char metric_set; - u_char metric_out; - u_int16_t tag_out; + uint8_t metric_set; + uint8_t metric_out; + uint16_t tag_out; }; extern void ripng_aggregate_increment(struct route_node *rp, diff --git a/ripngd/ripng_routemap.c b/ripngd/ripng_routemap.c index e518585c7..e9a38d137 100644 --- a/ripngd/ripng_routemap.c +++ b/ripngd/ripng_routemap.c @@ -33,7 +33,7 @@ struct rip_metric_modifier { enum { metric_increment, metric_decrement, metric_absolute } type; bool used; - u_int8_t metric; + uint8_t metric; }; /* `match metric METRIC' */ @@ -42,7 +42,7 @@ static route_map_result_t route_match_metric(void *rule, struct prefix *prefix, route_map_object_t type, void *object) { - u_int32_t *metric; + uint32_t *metric; struct ripng_info *rinfo; if (type == RMAP_RIPNG) { @@ -60,9 +60,9 @@ static route_map_result_t route_match_metric(void *rule, struct prefix *prefix, /* Route map `match metric' match statement. `arg' is METRIC value */ static void *route_match_metric_compile(const char *arg) { - u_int32_t *metric; + uint32_t *metric; - metric = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(u_int32_t)); + metric = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(uint32_t)); *metric = atoi(arg); if (*metric > 0) diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c index 6c9d911a6..6830e0e92 100644 --- a/ripngd/ripng_zebra.c +++ b/ripngd/ripng_zebra.c @@ -37,7 +37,7 @@ struct zclient *zclient = NULL; /* Send ECMP routes to zebra. */ -static void ripng_zebra_ipv6_send(struct route_node *rp, u_char cmd) +static void ripng_zebra_ipv6_send(struct route_node *rp, uint8_t cmd) { struct list *list = (struct list *)rp->info; struct zapi_route api; diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 673f0637c..840157516 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -214,7 +214,7 @@ int ripng_send_packet(caddr_t buf, int bufsize, struct sockaddr_in6 *to, } /* Receive UDP RIPng packet from socket. */ -static int ripng_recv_packet(int sock, u_char *buf, int bufsize, +static int ripng_recv_packet(int sock, uint8_t *buf, int bufsize, struct sockaddr_in6 *from, ifindex_t *ifindex, int *hoplimit) { @@ -1506,7 +1506,7 @@ int ripng_triggered_update(struct thread *t) /* Write routing table entry to the stream and return next index of the routing table entry in the stream. */ int ripng_write_rte(int num, struct stream *s, struct prefix_ipv6 *p, - struct in6_addr *nexthop, u_int16_t tag, u_char metric) + struct in6_addr *nexthop, uint16_t tag, uint8_t metric) { /* RIPng packet header. */ if (num == 0) { @@ -1517,9 +1517,9 @@ int ripng_write_rte(int num, struct stream *s, struct prefix_ipv6 *p, /* Write routing table entry. */ if (!nexthop) - stream_write(s, (u_char *)&p->prefix, sizeof(struct in6_addr)); + stream_write(s, (uint8_t *)&p->prefix, sizeof(struct in6_addr)); else - stream_write(s, (u_char *)nexthop, sizeof(struct in6_addr)); + stream_write(s, (uint8_t *)nexthop, sizeof(struct in6_addr)); stream_putw(s, tag); if (p) stream_putc(s, p->prefixlen); diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h index 25a5b46c0..534905d89 100644 --- a/ripngd/ripngd.h +++ b/ripngd/ripngd.h @@ -95,8 +95,8 @@ struct ripng { int sock; /* RIPng Parameters.*/ - u_char command; - u_char version; + uint8_t command; + uint8_t version; unsigned long update_time; unsigned long timeout_time; unsigned long garbage_time; @@ -137,35 +137,35 @@ struct ripng { char *name; struct route_map *map; int metric_config; - u_int32_t metric; + uint32_t metric; } route_map[ZEBRA_ROUTE_MAX]; }; /* Routing table entry. */ struct rte { struct in6_addr addr; /* RIPng destination prefix */ - u_int16_t tag; /* RIPng tag */ - u_char prefixlen; /* Length of the RIPng prefix */ - u_char metric; /* Metric of the RIPng route */ + uint16_t tag; /* RIPng tag */ + uint8_t prefixlen; /* Length of the RIPng prefix */ + uint8_t metric; /* Metric of the RIPng route */ /* The nexthop is stored by the structure * ripng_nexthop within ripngd.c */ }; /* RIPNG send packet. */ struct ripng_packet { - u_char command; - u_char version; - u_int16_t zero; + uint8_t command; + uint8_t version; + uint16_t zero; struct rte rte[1]; }; /* Each route's information. */ struct ripng_info { /* This route's type. Static, ripng or aggregate. */ - u_char type; + uint8_t type; /* Sub type for static route. */ - u_char sub_type; + uint8_t sub_type; /* RIPng specific information */ struct in6_addr nexthop; @@ -175,10 +175,10 @@ struct ripng_info { ifindex_t ifindex; /* Metric of this route. */ - u_char metric; + uint8_t metric; /* Tag field of RIPng packet.*/ - u_int16_t tag; + uint16_t tag; /* For aggregation. */ unsigned int suppress; @@ -186,7 +186,7 @@ struct ripng_info { /* Flags of RIPng route. */ #define RIPNG_RTF_FIB 1 #define RIPNG_RTF_CHANGED 2 - u_char flags; + uint8_t flags; /* Garbage collect timer. */ struct thread *t_timeout; @@ -194,9 +194,9 @@ struct ripng_info { /* Route-map features - this variables can be changed. */ struct in6_addr nexthop_out; - u_char metric_set; - u_char metric_out; - u_int16_t tag_out; + uint8_t metric_set; + uint8_t metric_out; + uint16_t tag_out; struct route_node *rp; }; @@ -207,10 +207,10 @@ struct ripng_info { struct ripng_tag { /* Tag value. */ - u_int16_t tag; + uint16_t tag; /* Port. */ - u_int16_t port; + uint16_t port; /* Multicast group. */ struct in6_addr maddr; @@ -222,10 +222,10 @@ struct ripng_tag int distance; /* Split horizon. */ - u_char split_horizon; + uint8_t split_horizon; /* Poison reverse. */ - u_char poison_reverse; + uint8_t poison_reverse; }; #endif /* 0 */ #endif /* not yet */ @@ -271,10 +271,10 @@ struct ripng_interface { #endif /* notyet */ /* Default information originate. */ - u_char default_originate; + uint8_t default_originate; /* Default information only. */ - u_char default_only; + uint8_t default_only; /* Wake up thread. */ struct thread *t_wakeup; @@ -295,7 +295,7 @@ struct ripng_peer { time_t uptime; /* Peer RIP version. */ - u_char version; + uint8_t version; /* Statistics. */ int recv_badpackets; @@ -351,7 +351,7 @@ extern void ripng_offset_init(void); extern int config_write_ripng_offset_list(struct vty *); extern void ripng_peer_init(void); -extern void ripng_peer_update(struct sockaddr_in6 *, u_char); +extern void ripng_peer_update(struct sockaddr_in6 *, uint8_t); extern void ripng_peer_bad_route(struct sockaddr_in6 *); extern void ripng_peer_bad_packet(struct sockaddr_in6 *); extern void ripng_peer_display(struct vty *); @@ -359,9 +359,9 @@ extern struct ripng_peer *ripng_peer_lookup(struct in6_addr *); extern struct ripng_peer *ripng_peer_lookup_next(struct in6_addr *); extern int ripng_offset_list_apply_in(struct prefix_ipv6 *, struct interface *, - u_char *); + uint8_t *); extern int ripng_offset_list_apply_out(struct prefix_ipv6 *, struct interface *, - u_char *); + uint8_t *); extern void ripng_offset_clean(void); extern struct ripng_info *ripng_info_new(void); @@ -385,8 +385,8 @@ extern int ripng_redistribute_check(int); extern void ripng_redistribute_write(struct vty *, int); extern int ripng_write_rte(int num, struct stream *s, struct prefix_ipv6 *p, - struct in6_addr *nexthop, u_int16_t tag, - u_char metric); + struct in6_addr *nexthop, uint16_t tag, + uint8_t metric); extern int ripng_send_packet(caddr_t buf, int bufsize, struct sockaddr_in6 *to, struct interface *ifp); diff --git a/tests/bgpd/test_aspath.c b/tests/bgpd/test_aspath.c index 9e5cb7fe5..247591580 100644 --- a/tests/bgpd/test_aspath.c +++ b/tests/bgpd/test_aspath.c @@ -67,7 +67,7 @@ struct test_spec { static struct test_segment { const char *name; const char *desc; - const u_char asdata[1024]; + const uint8_t asdata[1024]; int len; struct test_spec sp; } test_segments[] = { @@ -917,7 +917,7 @@ struct compare_tests { }; /* make an aspath from a data stream */ -static struct aspath *make_aspath(const u_char *data, size_t len, int use32bit) +static struct aspath *make_aspath(const uint8_t *data, size_t len, int use32bit) { struct stream *s = NULL; struct aspath *as; @@ -934,7 +934,7 @@ static struct aspath *make_aspath(const u_char *data, size_t len, int use32bit) return as; } -static void printbytes(const u_char *bytes, int len) +static void printbytes(const uint8_t *bytes, int len) { int i = 0; while (i < len) { @@ -952,7 +952,7 @@ static int validate(struct aspath *as, const struct test_spec *sp) { size_t bytes, bytes4; int fails = 0; - const u_char *out; + const uint8_t *out; static struct stream *s; struct aspath *asinout, *asconfeddel, *asstr, *as4; diff --git a/tests/bgpd/test_capability.c b/tests/bgpd/test_capability.c index 69f5afb99..c75a699a1 100644 --- a/tests/bgpd/test_capability.c +++ b/tests/bgpd/test_capability.c @@ -54,7 +54,7 @@ static int tty = 0; static struct test_segment { const char *name; const char *desc; - const u_char data[1024]; + const uint8_t data[1024]; int len; #define SHOULD_PARSE 0 #define SHOULD_ERR -1 diff --git a/tests/bgpd/test_ecommunity.c b/tests/bgpd/test_ecommunity.c index 3de8a9fc7..dc6d8268b 100644 --- a/tests/bgpd/test_ecommunity.c +++ b/tests/bgpd/test_ecommunity.c @@ -45,7 +45,7 @@ struct test_spec { static struct test_segment { const char *name; const char *desc; - const u_int8_t data[1024]; + const uint8_t data[1024]; int len; struct test_spec sp; } test_segments[] = {{/* 0 */ @@ -121,7 +121,7 @@ static void parse_test(struct test_segment *t) printf("%s: %s\n", t->name, t->desc); - ecom = ecommunity_parse((u_int8_t *)t->data, t->len); + ecom = ecommunity_parse((uint8_t *)t->data, t->len); printf("ecom: %s\nvalidating...:\n", ecommunity_str(ecom)); diff --git a/tests/bgpd/test_mp_attr.c b/tests/bgpd/test_mp_attr.c index 8acb280ed..fff165247 100644 --- a/tests/bgpd/test_mp_attr.c +++ b/tests/bgpd/test_mp_attr.c @@ -58,7 +58,7 @@ static int tty = 0; static struct test_segment { const char *name; const char *desc; - const u_char data[1024]; + const uint8_t data[1024]; int len; #define SHOULD_PARSE 0 #define SHOULD_ERR -1 diff --git a/tests/lib/test_checksum.c b/tests/lib/test_checksum.c index c265e164e..3972f7676 100644 --- a/tests/lib/test_checksum.c +++ b/tests/lib/test_checksum.c @@ -48,8 +48,8 @@ typedef uint16_t testoff_t; /* The final reduction phase. * This one should be the original ospfd version */ -static u_int16_t reduce_ospfd(struct csum_vals *vals, testsz_t len, - testoff_t off) +static uint16_t reduce_ospfd(struct csum_vals *vals, testsz_t len, + testoff_t off) { #define x vals->x #define y vals->y @@ -73,8 +73,8 @@ static u_int16_t reduce_ospfd(struct csum_vals *vals, testsz_t len, } /* slightly different concatenation */ -static u_int16_t reduce_ospfd1(struct csum_vals *vals, testsz_t len, - testoff_t off) +static uint16_t reduce_ospfd1(struct csum_vals *vals, testsz_t len, + testoff_t off) { #define x vals->x #define y vals->y @@ -97,14 +97,14 @@ static u_int16_t reduce_ospfd1(struct csum_vals *vals, testsz_t len, } /* original isisd version */ -static u_int16_t reduce_isisd(struct csum_vals *vals, testsz_t len, - testoff_t off) +static uint16_t reduce_isisd(struct csum_vals *vals, testsz_t len, + testoff_t off) { #define x vals->x #define y vals->y #define c0 vals->a.c0 #define c1 vals->a.c1 - u_int32_t mul; + uint32_t mul; mul = (len - off) * (c0); x = mul - c0 - c1; @@ -132,14 +132,14 @@ static u_int16_t reduce_isisd(struct csum_vals *vals, testsz_t len, } /* Is the -1 in y wrong perhaps? */ -static u_int16_t reduce_isisd_yfix(struct csum_vals *vals, testsz_t len, - testoff_t off) +static uint16_t reduce_isisd_yfix(struct csum_vals *vals, testsz_t len, + testoff_t off) { #define x vals->x #define y vals->y #define c0 vals->a.c0 #define c1 vals->a.c1 - u_int32_t mul; + uint32_t mul; mul = (len - off) * (c0); x = mul - c0 - c1; @@ -167,14 +167,14 @@ static u_int16_t reduce_isisd_yfix(struct csum_vals *vals, testsz_t len, } /* Move the mods yp */ -static u_int16_t reduce_isisd_mod(struct csum_vals *vals, testsz_t len, - testoff_t off) +static uint16_t reduce_isisd_mod(struct csum_vals *vals, testsz_t len, + testoff_t off) { #define x vals->x #define y vals->y #define c0 vals->a.c0 #define c1 vals->a.c1 - u_int32_t mul; + uint32_t mul; mul = (len - off) * (c0); x = mul - c1 - c0; @@ -202,14 +202,14 @@ static u_int16_t reduce_isisd_mod(struct csum_vals *vals, testsz_t len, } /* Move the mods up + fix y */ -static u_int16_t reduce_isisd_mody(struct csum_vals *vals, testsz_t len, - testoff_t off) +static uint16_t reduce_isisd_mody(struct csum_vals *vals, testsz_t len, + testoff_t off) { #define x vals->x #define y vals->y #define c0 vals->a.c0 #define c1 vals->a.c1 - u_int32_t mul; + uint32_t mul; mul = (len - off) * (c0); x = mul - c0 - c1; @@ -238,7 +238,7 @@ static u_int16_t reduce_isisd_mody(struct csum_vals *vals, testsz_t len, struct reductions_t { const char *name; - u_int16_t (*f)(struct csum_vals *, testsz_t, testoff_t); + uint16_t (*f)(struct csum_vals *, testsz_t, testoff_t); } reducts[] = { {.name = "ospfd", .f = reduce_ospfd}, {.name = "ospfd-1", .f = reduce_ospfd1}, @@ -250,14 +250,14 @@ struct reductions_t { }; /* The original ospfd checksum */ -static u_int16_t ospfd_checksum(u_char *buffer, testsz_t len, testoff_t off) +static uint16_t ospfd_checksum(uint8_t *buffer, testsz_t len, testoff_t off) { - u_char *sp, *ep, *p, *q; + uint8_t *sp, *ep, *p, *q; int c0 = 0, c1 = 0; int x, y; - u_int16_t checksum, *csum; + uint16_t checksum, *csum; - csum = (u_int16_t *)(buffer + off); + csum = (uint16_t *)(buffer + off); *(csum) = 0; sp = buffer; @@ -301,21 +301,21 @@ static u_int16_t ospfd_checksum(u_char *buffer, testsz_t len, testoff_t off) } /* the original, broken isisd checksum */ -static u_int16_t iso_csum_create(u_char *buffer, testsz_t len, testoff_t off) +static uint16_t iso_csum_create(uint8_t *buffer, testsz_t len, testoff_t off) { - u_int8_t *p; + uint8_t *p; int x; int y; - u_int32_t mul; - u_int32_t c0; - u_int32_t c1; - u_int16_t checksum, *csum; + uint32_t mul; + uint32_t c0; + uint32_t c1; + uint16_t checksum, *csum; int i, init_len, partial_len; checksum = 0; - csum = (u_int16_t *)(buffer + off); + csum = (uint16_t *)(buffer + off); *(csum) = checksum; p = buffer; @@ -369,11 +369,11 @@ static u_int16_t iso_csum_create(u_char *buffer, testsz_t len, testoff_t off) return checksum; } -static int verify(u_char *buffer, testsz_t len) +static int verify(uint8_t *buffer, testsz_t len) { - u_int8_t *p; - u_int32_t c0; - u_int32_t c1; + uint8_t *p; + uint32_t c0; + uint32_t c1; int i, partial_len; p = buffer; @@ -403,9 +403,9 @@ static int verify(u_char *buffer, testsz_t len) static int /* return checksum in low-order 16 bits */ in_cksum_optimized(void *parg, int nbytes) { - u_short *ptr = parg; + unsigned short *ptr = parg; register long sum; /* assumes long == 32 bits */ - register u_short answer; /* assumes u_short == 16 bits */ + register unsigned short answer; /* assumes unsigned short == 16 bits */ register int count; /* * Our algorithm is simple, using a 32-bit accumulator (sum), @@ -419,7 +419,7 @@ static int /* return checksum in low-order 16 bits */ sum += *++ptr; if (nbytes & 1) /* Odd */ - sum += *(u_char *)(++ptr); /* one byte only */ + sum += *(uint8_t *)(++ptr); /* one byte only */ /* * Add back carry outs from top 16 bits to low 16 bits. @@ -436,7 +436,7 @@ static int /* return checksum in low-order 16 bits */ in_cksum_rfc(void *parg, int count) /* from RFC 1071 */ { - u_short *addr = parg; + unsigned short *addr = parg; /* Compute Internet Checksum for "count" bytes * beginning at location "addr". */ @@ -449,7 +449,7 @@ static int /* return checksum in low-order 16 bits */ } /* Add left-over byte, if any */ if (count > 0) { - sum += *(u_char *)addr; + sum += *(uint8_t *)addr; } /* Fold 32-bit sum to 16 bits */ @@ -463,14 +463,14 @@ int main(int argc, char **argv) { /* 60017 65629 702179 */ #define MAXDATALEN 60017 -#define BUFSIZE MAXDATALEN + sizeof(u_int16_t) - u_char buffer[BUFSIZE]; +#define BUFSIZE MAXDATALEN + sizeof(uint16_t) + uint8_t buffer[BUFSIZE]; int exercise = 0; #define EXERCISESTEP 257 srandom(time(NULL)); while (1) { - u_int16_t ospfd, isisd, lib, in_csum, in_csum_res, in_csum_rfc; + uint16_t ospfd, isisd, lib, in_csum, in_csum_res, in_csum_rfc; int i, j; exercise += EXERCISESTEP; @@ -492,17 +492,17 @@ int main(int argc, char **argv) "in_csum_rfc %x, len:%d\n", in_csum, in_csum_res, in_csum_rfc, exercise); - ospfd = ospfd_checksum(buffer, exercise + sizeof(u_int16_t), + ospfd = ospfd_checksum(buffer, exercise + sizeof(uint16_t), exercise); - if (verify(buffer, exercise + sizeof(u_int16_t))) + if (verify(buffer, exercise + sizeof(uint16_t))) printf("verify: ospfd failed\n"); - isisd = iso_csum_create(buffer, exercise + sizeof(u_int16_t), + isisd = iso_csum_create(buffer, exercise + sizeof(uint16_t), exercise); - if (verify(buffer, exercise + sizeof(u_int16_t))) + if (verify(buffer, exercise + sizeof(uint16_t))) printf("verify: isisd failed\n"); - lib = fletcher_checksum(buffer, exercise + sizeof(u_int16_t), + lib = fletcher_checksum(buffer, exercise + sizeof(uint16_t), exercise); - if (verify(buffer, exercise + sizeof(u_int16_t))) + if (verify(buffer, exercise + sizeof(uint16_t))) printf("verify: lib failed\n"); if (ospfd != lib) { @@ -522,7 +522,7 @@ int main(int argc, char **argv) for (i = 0; reducts[i].name != NULL; i++) { ospfd = reducts[i].f( &ospfd_vals, - exercise + sizeof(u_int16_t), + exercise + sizeof(uint16_t), exercise); printf("%20s: x: %02x, y %02x, checksum 0x%04x\n", reducts[i].name, @@ -531,7 +531,7 @@ int main(int argc, char **argv) } } - printf("\n u_char testdata [] = {\n "); + printf("\n uint8_t testdata [] = {\n "); for (i = 0; i < exercise; i++) { printf("0x%02x,%s", buffer[i], (i + 1) % 8 ? " " : "\n "); diff --git a/tests/test_lblmgr.c b/tests/test_lblmgr.c index b08f63b70..c751c0b12 100644 --- a/tests/test_lblmgr.c +++ b/tests/test_lblmgr.c @@ -29,7 +29,7 @@ #define CHUNK_SIZE 32 struct zclient *zclient; -u_short instance = 1; +unsigned short instance = 1; const char *sequence = "GGRGGGRRG"; diff --git a/tools/checkpatch.pl b/tools/checkpatch.pl index a85d811c9..e66be1875 100755 --- a/tools/checkpatch.pl +++ b/tools/checkpatch.pl @@ -6357,6 +6357,19 @@ sub process { "unknown module license " . $extracted_string . "\n" . $herecurr); } } + +# check for usage of nonstandard fixed-width integral types + if ($line =~ /u_int8_t/ || + $line =~ /u_int32_t/ || + $line =~ /u_int16_t/ || + $line =~ /u_int64_t/ || + $line =~ /[^a-z_]u_char[^a-z_]/ || + $line =~ /[^a-z_]u_short[^a-z_]/ || + $line =~ /[^a-z_]u_int[^a-z_]/ || + $line =~ /[^a-z_]u_long[^a-z_]/) { + ERROR("NONSTANDARD_INTEGRAL_TYPES", + "Please, no nonstandard integer types in new code.\n" . $herecurr) + } } # If we have no input at all, then there is nothing to report on diff --git a/tools/convert-fixedwidth.sh b/tools/convert-fixedwidth.sh new file mode 100755 index 000000000..bb6011edd --- /dev/null +++ b/tools/convert-fixedwidth.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# This script converts nonstandard fixed-width integer types found in FRR to +# C99 standard types. +USAGE="./$(basename "$0")" +USAGE+=$' <src-path> -- convert nonstandard fixed-width integer types found in FRR to C99 standard types\n' +USAGE+=$'<src-path> - a directory containing C source, or a C source file\n' +if [ $# -eq 0 ]; then + printf "%s" "$USAGE" + exit 1 +fi + +FRRTREE=$1 + +if [[ -d $FRRTREE ]]; then + SOURCES=$(find $FRRTREE -type f -name '*.[ch]') +elif [[ -f $FRRTREE ]]; then + SOURCES="$FRRTREE" + SOURCES+=$'\n' +else + printf "%s" "$USAGE" + exit 1 +fi + +printf "%s" "$SOURCES" | while read line ; do + printf "Processing $line " + sed -i -e 's/u_int\([0-9]\{1,3\}\)_t/uint\1_t/g' $line + printf "." + sed -i -e 's/\([^a-z_]\)u_char\([^a-z_]\|$\)/\1uint8_t\2/g' $line + printf "." + sed -i -e 's/\([^a-z_]\)u_short\([^a-z_]\|$\)/\1unsigned short\2/g' $line + printf "." + sed -i -e 's/\([^a-z_]\)u_int\([^a-z_]\|$\)/\1unsigned int\2/g' $line + printf "." + sed -i -e 's/\([^a-z_]\)u_long\([^a-z_]\|$\)/\1unsigned long\2/g' $line + printf "." + sed -i -e 's/^u_char /uint8_t /g' $line + printf "." + sed -i -e 's/^u_short /unsigned short /g' $line + printf "." + sed -i -e 's/^u_int /unsigned int /g' $line + printf "." + sed -i -e 's/^u_long /unsigned long /g' $line + printf ".\n" +done diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 1308e1218..96a5ea9e3 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -298,7 +298,7 @@ void vtysh_pager_init(void) static int vtysh_execute_func(const char *line, int pager) { int ret, cmd_stat; - u_int i; + unsigned int i; vector vline; const struct cmd_element *cmd; FILE *fp = NULL; @@ -683,7 +683,7 @@ int vtysh_mark_file(const char *filename) fprintf(stdout, "%s", vty->buf); break; case CMD_SUCCESS_DAEMON: { - u_int i; + unsigned int i; int cmd_stat = CMD_SUCCESS; fprintf(outputfile, "%s", vty->buf); @@ -760,7 +760,7 @@ int vtysh_config_from_file(struct vty *vty, FILE *fp) that */ break; case CMD_SUCCESS_DAEMON: { - u_int i; + unsigned int i; int cmd_stat = CMD_SUCCESS; for (i = 0; i < array_size(vtysh_client); i++) { @@ -2259,7 +2259,7 @@ DEFUN (vtysh_write_terminal, "For the isis daemon\n" "For the pim daemon\n") { - u_int i; + unsigned int i; char line[] = "do write terminal\n"; FILE *fp = outputfile; @@ -2353,7 +2353,7 @@ static void backup_config_file(const char *fbackup) int vtysh_write_config_integrated(void) { - u_int i; + unsigned int i; char line[] = "do write terminal\n"; FILE *fp; int fd; @@ -2461,7 +2461,7 @@ DEFUN (vtysh_write_memory, { int ret = CMD_SUCCESS; char line[] = "do write memory\n"; - u_int i; + unsigned int i; fprintf(outputfile, "Note: this version of vtysh never writes vtysh.conf\n"); @@ -2562,7 +2562,7 @@ DEFUN (vtysh_show_daemons, SHOW_STR "Show list of running daemons\n") { - u_int i; + unsigned int i; for (i = 0; i < array_size(vtysh_client); i++) if (vtysh_client[i].fd >= 0) @@ -2975,7 +2975,7 @@ static int vtysh_connect_all_instances(struct vtysh_client *head_client) int vtysh_connect_all(const char *daemon_name) { - u_int i; + unsigned int i; int rc = 0; int matches = 0; diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c index e3431fac5..348053c72 100644 --- a/vtysh/vtysh_config.c +++ b/vtysh/vtysh_config.c @@ -44,7 +44,7 @@ struct config { struct config *config; /* Index of this config. */ - u_int32_t index; + uint32_t index; }; struct list *config_top; diff --git a/vtysh/vtysh_user.c b/vtysh/vtysh_user.c index 88af18d82..e575b7154 100644 --- a/vtysh/vtysh_user.c +++ b/vtysh/vtysh_user.c @@ -100,7 +100,7 @@ static int vtysh_pam(const char *user) struct vtysh_user { char *name; - u_char nopassword; + uint8_t nopassword; }; struct list *userlist; diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c index 264882e21..ca388d807 100644 --- a/watchfrr/watchfrr.c +++ b/watchfrr/watchfrr.c @@ -138,7 +138,7 @@ struct daemon { daemon_state_t state; int fd; struct timeval echo_sent; - u_int connect_tries; + unsigned int connect_tries; struct thread *t_wakeup; struct thread *t_read; struct thread *t_write; @@ -552,7 +552,7 @@ static int handle_read(struct thread *t_read) snprintf(why, sizeof(why), "read returned bad echo response of %d bytes " "(expecting %u): %.*s", - (int)rc, (u_int)sizeof(resp), (int)rc, buf); + (int)rc, (unsigned int)sizeof(resp), (int)rc, buf); daemon_down(dmn, why); return 0; } @@ -888,7 +888,7 @@ static int wakeup_send_echo(struct thread *t_wakeup) char why[100 + sizeof(echocmd)]; snprintf(why, sizeof(why), "write '%s' returned %d instead of %u", echocmd, - (int)rc, (u_int)sizeof(echocmd)); + (int)rc, (unsigned int)sizeof(echocmd)); daemon_down(dmn, why); } else { gettimeofday(&dmn->echo_sent, NULL); @@ -1174,7 +1174,7 @@ int main(int argc, char **argv) if (!(dmn = (struct daemon *)calloc(1, sizeof(*dmn)))) { fprintf(stderr, "calloc(1,%u) failed: %s\n", - (u_int)sizeof(*dmn), + (unsigned int)sizeof(*dmn), safe_strerror(errno)); return 1; } diff --git a/zebra/client_main.c b/zebra/client_main.c index 9b82e4826..4035e53f7 100644 --- a/zebra/client_main.c +++ b/zebra/client_main.c @@ -39,7 +39,7 @@ int sock; /* IPv4 route add and delete test. */ void zebra_test_ipv4(int command, int type, char *prefix, char *gateway, - u_char distance) + uint8_t distance) { struct zapi_ipv4 api; struct prefix_ipv4 p; @@ -119,7 +119,7 @@ void zebra_sim(FILE *fp) { char buf[BUFSIZ]; char distance_str[BUFSIZ]; - u_char distance; + uint8_t distance; while (fgets(buf, sizeof buf, fp)) { int i; diff --git a/zebra/connected.c b/zebra/connected.c index 94b56c897..2198ddf5e 100644 --- a/zebra/connected.c +++ b/zebra/connected.c @@ -273,7 +273,7 @@ void connected_up(struct interface *ifp, struct connected *ifc) /* Add connected IPv4 route to the interface. */ void connected_add_ipv4(struct interface *ifp, int flags, struct in_addr *addr, - u_char prefixlen, struct in_addr *broad, + uint8_t prefixlen, struct in_addr *broad, const char *label) { struct prefix_ipv4 *p; @@ -469,7 +469,7 @@ static void connected_delete_helper(struct connected *ifc, struct prefix *p) /* Delete connected IPv4 route to the interface. */ void connected_delete_ipv4(struct interface *ifp, int flags, - struct in_addr *addr, u_char prefixlen, + struct in_addr *addr, uint8_t prefixlen, struct in_addr *broad) { struct prefix p, d; @@ -495,7 +495,7 @@ void connected_delete_ipv4(struct interface *ifp, int flags, /* Add connected IPv6 route to the interface. */ void connected_add_ipv6(struct interface *ifp, int flags, struct in6_addr *addr, - u_char prefixlen, const char *label) + uint8_t prefixlen, const char *label) { struct prefix_ipv6 *p; struct connected *ifc; @@ -536,7 +536,7 @@ void connected_add_ipv6(struct interface *ifp, int flags, struct in6_addr *addr, } void connected_delete_ipv6(struct interface *ifp, struct in6_addr *address, - u_char prefixlen) + uint8_t prefixlen) { struct prefix p; struct connected *ifc; diff --git a/zebra/connected.h b/zebra/connected.h index d10a09298..9b69a3f24 100644 --- a/zebra/connected.h +++ b/zebra/connected.h @@ -29,11 +29,11 @@ extern struct connected *connected_check_ptp(struct interface *ifp, union prefixconstptr d); extern void connected_add_ipv4(struct interface *ifp, int flags, - struct in_addr *addr, u_char prefixlen, + struct in_addr *addr, uint8_t prefixlen, struct in_addr *broad, const char *label); extern void connected_delete_ipv4(struct interface *ifp, int flags, - struct in_addr *addr, u_char prefixlen, + struct in_addr *addr, uint8_t prefixlen, struct in_addr *broad); extern void connected_delete_ipv4_unnumbered(struct connected *ifc); @@ -42,10 +42,10 @@ extern void connected_up(struct interface *ifp, struct connected *ifc); extern void connected_down(struct interface *ifp, struct connected *ifc); extern void connected_add_ipv6(struct interface *ifp, int flags, - struct in6_addr *address, u_char prefixlen, + struct in6_addr *address, uint8_t prefixlen, const char *label); extern void connected_delete_ipv6(struct interface *ifp, - struct in6_addr *address, u_char prefixlen); + struct in6_addr *address, uint8_t prefixlen); extern int connected_is_unnumbered(struct interface *); diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c index 09fc08501..b506315eb 100644 --- a/zebra/if_ioctl.c +++ b/zebra/if_ioctl.c @@ -242,7 +242,7 @@ static int if_getaddrs(void) #if defined(KAME) if (IN6_IS_ADDR_LINKLOCAL(&addr->sin6_addr)) { addr->sin6_scope_id = - ntohs(*(u_int16_t *)&addr->sin6_addr + ntohs(*(uint16_t *)&addr->sin6_addr .s6_addr[2]); addr->sin6_addr.s6_addr[2] = addr->sin6_addr.s6_addr[3] = 0; diff --git a/zebra/if_ioctl_solaris.c b/zebra/if_ioctl_solaris.c index 94738664b..e9182304d 100644 --- a/zebra/if_ioctl_solaris.c +++ b/zebra/if_ioctl_solaris.c @@ -252,7 +252,7 @@ static int if_get_addr(struct interface *ifp, struct sockaddr *addr, struct lifreq lifreq; struct sockaddr_storage mask, dest; char *dest_pnt = NULL; - u_char prefixlen = 0; + uint8_t prefixlen = 0; afi_t af; int flags = 0; diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index a37d74416..c8a6bedec 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -271,7 +271,7 @@ static void netlink_vrf_change(struct nlmsghdr *h, struct rtattr *tb, struct rtattr *attr[IFLA_VRF_MAX + 1]; struct vrf *vrf; struct zebra_vrf *zvrf; - u_int32_t nl_table_id; + uint32_t nl_table_id; ifi = NLMSG_DATA(h); @@ -296,7 +296,7 @@ static void netlink_vrf_change(struct nlmsghdr *h, struct rtattr *tb, return; } - nl_table_id = *(u_int32_t *)RTA_DATA(attr[IFLA_VRF_TABLE]); + nl_table_id = *(uint32_t *)RTA_DATA(attr[IFLA_VRF_TABLE]); if (h->nlmsg_type == RTM_NEWLINK) { if (IS_ZEBRA_DEBUG_KERNEL) @@ -409,7 +409,7 @@ static int netlink_extract_bridge_info(struct rtattr *link_data, parse_rtattr_nested(attr, IFLA_BR_MAX, link_data); if (attr[IFLA_BR_VLAN_FILTERING]) bridge_info->vlan_aware = - *(u_char *)RTA_DATA(attr[IFLA_BR_VLAN_FILTERING]); + *(uint8_t *)RTA_DATA(attr[IFLA_BR_VLAN_FILTERING]); return 0; } @@ -503,8 +503,8 @@ static int netlink_bridge_interface(struct nlmsghdr *h, int len, ns_id_t ns_id, struct interface *ifp; struct rtattr *aftb[IFLA_BRIDGE_MAX + 1]; struct { - u_int16_t flags; - u_int16_t vid; + uint16_t flags; + uint16_t vid; } * vinfo; vlanid_t access_vlan; @@ -631,7 +631,7 @@ static int netlink_interface(struct sockaddr_nl *snl, struct nlmsghdr *h, if (slave_kind && (strcmp(slave_kind, "vrf") == 0) && !vrf_is_backend_netns()) { zif_slave_type = ZEBRA_IF_SLAVE_VRF; - vrf_id = *(u_int32_t *)RTA_DATA(tb[IFLA_MASTER]); + vrf_id = *(uint32_t *)RTA_DATA(tb[IFLA_MASTER]); } else if (slave_kind && (strcmp(slave_kind, "bridge") == 0)) { zif_slave_type = ZEBRA_IF_SLAVE_BRIDGE; bridge_ifindex = @@ -683,7 +683,7 @@ static int netlink_interface(struct sockaddr_nl *snl, struct nlmsghdr *h, /* Request for specific interface or address information from the kernel */ static int netlink_request_intf_addr(struct zebra_ns *zns, int family, int type, - u_int32_t filter_mask) + uint32_t filter_mask) { struct { struct nlmsghdr n; @@ -876,7 +876,7 @@ int netlink_interface_addr(struct sockaddr_nl *snl, struct nlmsghdr *h, struct interface *ifp; void *addr; void *broad; - u_char flags = 0; + uint8_t flags = 0; char *label = NULL; struct zebra_ns *zns; @@ -1109,8 +1109,7 @@ int netlink_link_change(struct sockaddr_nl *snl, struct nlmsghdr *h, if (slave_kind && (strcmp(slave_kind, "vrf") == 0) && !vrf_is_backend_netns()) { zif_slave_type = ZEBRA_IF_SLAVE_VRF; - vrf_id = - *(u_int32_t *)RTA_DATA(tb[IFLA_MASTER]); + vrf_id = *(uint32_t *)RTA_DATA(tb[IFLA_MASTER]); } else if (slave_kind && (strcmp(slave_kind, "bridge") == 0)) { zif_slave_type = ZEBRA_IF_SLAVE_BRIDGE; diff --git a/zebra/interface.c b/zebra/interface.c index 7795d34d0..a011efd28 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -181,7 +181,7 @@ static int if_zebra_delete_hook(struct interface *ifp) } /* Build the table key */ -static void if_build_key(u_int32_t ifindex, struct prefix *p) +static void if_build_key(uint32_t ifindex, struct prefix *p) { p->family = AF_INET; p->prefixlen = IPV4_MAX_BITLEN; @@ -221,7 +221,7 @@ void if_unlink_per_ns(struct interface *ifp) /* Look up an interface by identifier within a NS */ struct interface *if_lookup_by_index_per_ns(struct zebra_ns *ns, - u_int32_t ifindex) + uint32_t ifindex) { struct prefix p; struct route_node *rn; @@ -787,7 +787,7 @@ void if_handle_vrf_change(struct interface *ifp, vrf_id_t vrf_id) rib_update(ifp->vrf_id, RIB_UPDATE_IF_CHANGE); } -static void ipv6_ll_address_to_mac(struct in6_addr *address, u_char *mac) +static void ipv6_ll_address_to_mac(struct in6_addr *address, uint8_t *mac) { mac[0] = address->s6_addr[8] ^ 0x02; mac[1] = address->s6_addr[9]; @@ -808,7 +808,7 @@ void if_nbr_ipv6ll_to_ipv4ll_neigh_update(struct interface *ifp, inet_pton(AF_INET, buf, &ipv4_ll); - ipv6_ll_address_to_mac(address, (u_char *)mac); + ipv6_ll_address_to_mac(address, (uint8_t *)mac); ns_id = zvrf->zns->ns_id; /* @@ -1857,7 +1857,7 @@ DEFUN (link_params_metric, int idx_number = 1; VTY_DECLVAR_CONTEXT(interface, ifp); struct if_link_params *iflp = if_link_params_get(ifp); - u_int32_t metric; + uint32_t metric; metric = strtoul(argv[idx_number]->arg, NULL, 10); @@ -2045,7 +2045,7 @@ DEFUN (link_params_inter_as, VTY_DECLVAR_CONTEXT(interface, ifp); struct if_link_params *iflp = if_link_params_get(ifp); struct in_addr addr; - u_int32_t as; + uint32_t as; if (!inet_aton(argv[idx_ipv4]->arg, &addr)) { vty_out(vty, "Please specify Router-Addr by A.B.C.D\n"); @@ -2104,7 +2104,7 @@ DEFUN (link_params_delay, "Maximum delay in micro-second as decimal (0...16777215)\n") { /* Get and Check new delay values */ - u_int32_t delay = 0, low = 0, high = 0; + uint32_t delay = 0, low = 0, high = 0; delay = strtoul(argv[1]->arg, NULL, 10); if (argc == 6) { low = strtoul(argv[3]->arg, NULL, 10); @@ -2113,7 +2113,7 @@ DEFUN (link_params_delay, VTY_DECLVAR_CONTEXT(interface, ifp); struct if_link_params *iflp = if_link_params_get(ifp); - u_int8_t update = 0; + uint8_t update = 0; if (argc == 2) { /* Check new delay value against old Min and Max delays if set @@ -2199,7 +2199,7 @@ DEFUN (link_params_delay_var, int idx_number = 1; VTY_DECLVAR_CONTEXT(interface, ifp); struct if_link_params *iflp = if_link_params_get(ifp); - u_int32_t value; + uint32_t value; value = strtoul(argv[idx_number]->arg, NULL, 10); diff --git a/zebra/interface.h b/zebra/interface.h index 9f109fc05..7a776f5e3 100644 --- a/zebra/interface.h +++ b/zebra/interface.h @@ -93,7 +93,7 @@ struct rtadvconf { milliseconds (1 hour). Default: 0 */ - u_int32_t AdvReachableTime; + uint32_t AdvReachableTime; #define RTADV_MAX_REACHABLE_TIME 3600000 /* The value to be placed in the Retrans Timer field in the Router @@ -167,10 +167,10 @@ struct rtadvconf { int DefaultPreference; #define RTADV_PREF_MEDIUM 0x0 /* Per RFC4191. */ - u_char inFastRexmit; /* True if we're rexmits faster than usual */ + uint8_t inFastRexmit; /* True if we're rexmits faster than usual */ /* Track if RA was configured by BGP or by the Operator or both */ - u_char ra_configured; /* Was RA configured? */ + uint8_t ra_configured; /* Was RA configured? */ #define BGP_RA_CONFIGURED (1<<0) /* BGP configured RA? */ #define VTY_RA_CONFIGURED (1<<1) /* Operator configured RA? */ #define VTY_RA_INTERVAL_CONFIGURED (1<<2) /* Operator configured RA interval */ @@ -206,13 +206,13 @@ struct irdp_interface; /* `zebra' daemon local interface structure. */ struct zebra_if { /* Shutdown configuration. */ - u_char shutdown; + uint8_t shutdown; /* Multicast configuration. */ - u_char multicast; + uint8_t multicast; /* Router advertise configuration. */ - u_char rtadv_enable; + uint8_t rtadv_enable; /* Installed addresses chains tree. */ struct route_table *ipv4_subnets; @@ -248,11 +248,11 @@ struct zebra_if { * down (but primary still plumbed) and primary having gone * ~IFF_UP, and all addresses gone. */ - u_char primary_state; + uint8_t primary_state; #endif /* SUNOS_5 */ /* ptm enable configuration */ - u_char ptm_enable; + uint8_t ptm_enable; /* Zebra interface and "slave" interface type */ zebra_iftype_t zif_type; @@ -314,8 +314,7 @@ static inline void zebra_if_set_ziftype(struct interface *ifp, extern void zebra_if_init(void); -extern struct interface *if_lookup_by_index_per_ns(struct zebra_ns *, - u_int32_t); +extern struct interface *if_lookup_by_index_per_ns(struct zebra_ns *, uint32_t); extern struct interface *if_lookup_by_name_per_ns(struct zebra_ns *, const char *); extern struct interface *if_link_per_ns(struct zebra_ns *, struct interface *); diff --git a/zebra/ioctl.c b/zebra/ioctl.c index a95d5d4e1..a577b008d 100644 --- a/zebra/ioctl.c +++ b/zebra/ioctl.c @@ -48,7 +48,7 @@ void ifreq_set_name(struct ifreq *ifreq, struct interface *ifp) } /* call ioctl system call */ -int if_ioctl(u_long request, caddr_t buffer) +int if_ioctl(unsigned long request, caddr_t buffer) { int sock; int ret; @@ -80,7 +80,7 @@ int if_ioctl(u_long request, caddr_t buffer) } /* call ioctl system call */ -int vrf_if_ioctl(u_long request, caddr_t buffer, vrf_id_t vrf_id) +int vrf_if_ioctl(unsigned long request, caddr_t buffer, vrf_id_t vrf_id) { int sock; int ret; @@ -113,7 +113,7 @@ int vrf_if_ioctl(u_long request, caddr_t buffer, vrf_id_t vrf_id) } #ifndef HAVE_NETLINK -static int if_ioctl_ipv6(u_long request, caddr_t buffer) +static int if_ioctl_ipv6(unsigned long request, caddr_t buffer) { int sock; int ret; @@ -493,7 +493,7 @@ int if_unset_flags(struct interface *ifp, uint64_t flags) /* linux/include/net/ipv6.h */ struct in6_ifreq { struct in6_addr ifr6_addr; - u_int32_t ifr6_prefixlen; + uint32_t ifr6_prefixlen; int ifr6_ifindex; }; #endif /* _LINUX_IN6_H */ diff --git a/zebra/ioctl.h b/zebra/ioctl.h index 1a6e14ed4..2a8ea7790 100644 --- a/zebra/ioctl.h +++ b/zebra/ioctl.h @@ -24,8 +24,8 @@ /* Prototypes. */ extern void ifreq_set_name(struct ifreq *, struct interface *); -extern int if_ioctl(u_long, caddr_t); -extern int vrf_if_ioctl(u_long request, caddr_t buffer, vrf_id_t vrf_id); +extern int if_ioctl(unsigned long, caddr_t); +extern int vrf_if_ioctl(unsigned long request, caddr_t buffer, vrf_id_t vrf_id); extern int if_set_flags(struct interface *, uint64_t); extern int if_unset_flags(struct interface *, uint64_t); @@ -41,7 +41,7 @@ extern int if_prefix_add_ipv6(struct interface *, struct connected *); extern int if_prefix_delete_ipv6(struct interface *, struct connected *); #ifdef SOLARIS_IPV6 -extern int if_ioctl_ipv6(u_long, caddr_t); +extern int if_ioctl_ipv6(unsigned long, caddr_t); extern struct connected *if_lookup_linklocal(struct interface *); #define AF_IOCTL(af, request, buffer) \ diff --git a/zebra/ioctl_solaris.c b/zebra/ioctl_solaris.c index f429c4244..eb68451f7 100644 --- a/zebra/ioctl_solaris.c +++ b/zebra/ioctl_solaris.c @@ -45,13 +45,13 @@ void lifreq_set_name(struct lifreq *lifreq, const char *ifname) strncpy(lifreq->lifr_name, ifname, IFNAMSIZ); } -int vrf_if_ioctl(u_long request, caddr_t buffer, vrf_id_t vrf_id) +int vrf_if_ioctl(unsigned long request, caddr_t buffer, vrf_id_t vrf_id) { return if_ioctl(request, buffer); } /* call ioctl system call */ -int if_ioctl(u_long request, caddr_t buffer) +int if_ioctl(unsigned long request, caddr_t buffer) { int sock; int ret; @@ -86,7 +86,7 @@ int if_ioctl(u_long request, caddr_t buffer) } -int if_ioctl_ipv6(u_long request, caddr_t buffer) +int if_ioctl_ipv6(unsigned long request, caddr_t buffer) { int sock; int ret; @@ -155,7 +155,7 @@ void if_get_mtu(struct interface *ifp) { struct lifreq lifreq; int ret; - u_char changed = 0; + uint8_t changed = 0; if (ifp->flags & IFF_IPV4) { lifreq_set_name(&lifreq, ifp->name); diff --git a/zebra/irdp.h b/zebra/irdp.h index 8aa9f3e4b..4800e75be 100644 --- a/zebra/irdp.h +++ b/zebra/irdp.h @@ -117,7 +117,7 @@ struct irdp_interface { unsigned long MinAdvertInterval; unsigned long Preference; - u_int32_t flags; + uint32_t flags; #define IF_ACTIVE (1<<0) /* ICMP Active */ #define IF_BROADCAST (1<<1) /* 255.255.255.255 */ @@ -130,7 +130,7 @@ struct irdp_interface { struct interface *ifp; struct thread *t_advertise; unsigned long irdp_sent; - u_int16_t Lifetime; + uint16_t Lifetime; struct list *AdvPrefList; }; @@ -147,8 +147,8 @@ extern int irdp_send_thread(struct thread *t_advert); extern void irdp_advert_off(struct interface *ifp); extern void process_solicit(struct interface *ifp); extern int irdp_read_raw(struct thread *r); -extern void send_packet(struct interface *ifp, struct stream *s, u_int32_t dst, - struct prefix *p, u_int32_t ttl); +extern void send_packet(struct interface *ifp, struct stream *s, uint32_t dst, + struct prefix *p, uint32_t ttl); #endif /* _IRDP_H */ diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c index 2c10ce86a..ca7840479 100644 --- a/zebra/irdp_interface.c +++ b/zebra/irdp_interface.c @@ -97,7 +97,7 @@ static int irdp_if_delete(struct interface *ifp) return 0; } -static const char *inet_2a(u_int32_t a, char *b) +static const char *inet_2a(uint32_t a, char *b) { sprintf(b, "%u.%u.%u.%u", (a)&0xFF, (a >> 8) & 0xFF, (a >> 16) & 0xFF, (a >> 24) & 0xFF); @@ -118,7 +118,7 @@ static struct prefix *irdp_get_prefix(struct interface *ifp) } /* Join to the add/leave multicast group. */ -static int if_group(struct interface *ifp, int sock, u_int32_t group, +static int if_group(struct interface *ifp, int sock, uint32_t group, int add_leave) { struct ip_mreq m; @@ -216,7 +216,7 @@ static void irdp_if_start(struct interface *ifp, int multicast, struct irdp_interface *irdp = zi->irdp; struct listnode *node; struct connected *ifc; - u_int32_t timer, seed; + uint32_t timer, seed; assert(irdp); diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c index 39e04480c..c2411d083 100644 --- a/zebra/irdp_main.c +++ b/zebra/irdp_main.c @@ -146,7 +146,7 @@ static int make_advertisement_packet(struct interface *ifp, struct prefix *p, struct irdp_interface *irdp = zi->irdp; int size; int pref; - u_int16_t checksum; + uint16_t checksum; pref = get_pref(irdp, p); @@ -177,8 +177,8 @@ static void irdp_send(struct interface *ifp, struct prefix *p, struct stream *s) struct zebra_if *zi = ifp->info; struct irdp_interface *irdp = zi->irdp; char buf[PREFIX_STRLEN]; - u_int32_t dst; - u_int32_t ttl = 1; + uint32_t dst; + uint32_t ttl = 1; if (!irdp) return; @@ -210,7 +210,7 @@ static void irdp_advertisement(struct interface *ifp, struct prefix *p) int irdp_send_thread(struct thread *t_advert) { - u_int32_t timer, tmp; + uint32_t timer, tmp; struct interface *ifp = THREAD_ARG(t_advert); struct zebra_if *zi = ifp->info; struct irdp_interface *irdp = zi->irdp; @@ -288,7 +288,7 @@ void process_solicit(struct interface *ifp) { struct zebra_if *zi = ifp->info; struct irdp_interface *irdp = zi->irdp; - u_int32_t timer; + uint32_t timer; if (!irdp) return; diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c index 11bc9b044..b0dde96cc 100644 --- a/zebra/irdp_packet.c +++ b/zebra/irdp_packet.c @@ -175,7 +175,7 @@ static void parse_irdp_packet(char *p, int len, struct interface *ifp) } } -static int irdp_recvmsg(int sock, u_char *buf, int size, int *ifindex) +static int irdp_recvmsg(int sock, uint8_t *buf, int size, int *ifindex) { struct msghdr msg; struct iovec iov; @@ -226,7 +226,7 @@ int irdp_read_raw(struct thread *r) thread_add_read(zebrad.master, irdp_read_raw, NULL, irdp_sock, &t_irdp_raw); - ret = irdp_recvmsg(irdp_sock, (u_char *)buf, IRDP_RX_BUF, &ifindex); + ret = irdp_recvmsg(irdp_sock, (uint8_t *)buf, IRDP_RX_BUF, &ifindex); if (ret < 0) zlog_warn("IRDP: RX Error length = %d", ret); @@ -263,8 +263,8 @@ int irdp_read_raw(struct thread *r) return ret; } -void send_packet(struct interface *ifp, struct stream *s, u_int32_t dst, - struct prefix *p, u_int32_t ttl) +void send_packet(struct interface *ifp, struct stream *s, uint32_t dst, + struct prefix *p, uint32_t ttl) { static struct sockaddr_in sockdst = {AF_INET}; struct ip *ip; @@ -275,8 +275,8 @@ void send_packet(struct interface *ifp, struct stream *s, u_int32_t dst, char msgbuf[256]; char buf[256]; struct in_pktinfo *pktinfo; - u_long src; - u_char on; + unsigned long src; + uint8_t on; if (!(ifp->flags & IFF_UP)) return; diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index 52b269209..db4f19460 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -58,12 +58,13 @@ #ifndef NLMSG_TAIL #define NLMSG_TAIL(nmsg) \ - ((struct rtattr *)(((u_char *)(nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len))) + ((struct rtattr *)(((uint8_t *)(nmsg)) \ + + NLMSG_ALIGN((nmsg)->nlmsg_len))) #endif #ifndef RTA_TAIL #define RTA_TAIL(rta) \ - ((struct rtattr *)(((u_char *)(rta)) + RTA_ALIGN((rta)->rta_len))) + ((struct rtattr *)(((uint8_t *)(rta)) + RTA_ALIGN((rta)->rta_len))) #endif #ifndef RTNL_FAMILY_IP6MR @@ -123,7 +124,7 @@ static const struct message rttype_str[] = {{RTN_UNICAST, "unicast"}, {0}}; extern struct thread_master *master; -extern u_int32_t nl_rcvbufsize; +extern uint32_t nl_rcvbufsize; extern struct zebra_privs_t zserv_privs; @@ -137,7 +138,7 @@ int netlink_talk_filter(struct sockaddr_nl *snl, struct nlmsghdr *h, static int netlink_recvbuf(struct nlsock *nl, uint32_t newsize) { - u_int32_t oldsize; + uint32_t oldsize; socklen_t newlen = sizeof(newsize); socklen_t oldlen = sizeof(oldsize); int ret; @@ -380,14 +381,14 @@ int rta_addattr_l(struct rtattr *rta, unsigned int maxlen, int type, void *data, return 0; } -int addattr16(struct nlmsghdr *n, unsigned int maxlen, int type, u_int16_t data) +int addattr16(struct nlmsghdr *n, unsigned int maxlen, int type, uint16_t data) { - return addattr_l(n, maxlen, type, &data, sizeof(u_int16_t)); + return addattr_l(n, maxlen, type, &data, sizeof(uint16_t)); } int addattr32(struct nlmsghdr *n, unsigned int maxlen, int type, int data) { - return addattr_l(n, maxlen, type, &data, sizeof(u_int32_t)); + return addattr_l(n, maxlen, type, &data, sizeof(uint32_t)); } struct rtattr *addattr_nest(struct nlmsghdr *n, int maxlen, int type) @@ -400,7 +401,7 @@ struct rtattr *addattr_nest(struct nlmsghdr *n, int maxlen, int type) int addattr_nest_end(struct nlmsghdr *n, struct rtattr *nest) { - nest->rta_len = (u_char *)NLMSG_TAIL(n) - (u_char *)nest; + nest->rta_len = (uint8_t *)NLMSG_TAIL(n) - (uint8_t *)nest; return n->nlmsg_len; } @@ -414,7 +415,7 @@ struct rtattr *rta_nest(struct rtattr *rta, int maxlen, int type) int rta_nest_end(struct rtattr *rta, struct rtattr *nest) { - nest->rta_len = (u_char *)RTA_TAIL(rta) - (u_char *)nest; + nest->rta_len = (uint8_t *)RTA_TAIL(rta) - (uint8_t *)nest; return rta->rta_len; } @@ -423,17 +424,17 @@ const char *nl_msg_type_to_str(uint16_t msg_type) return lookup_msg(nlmsg_str, msg_type, ""); } -const char *nl_rtproto_to_str(u_char rtproto) +const char *nl_rtproto_to_str(uint8_t rtproto) { return lookup_msg(rtproto_str, rtproto, ""); } -const char *nl_family_to_str(u_char family) +const char *nl_family_to_str(uint8_t family) { return lookup_msg(family_str, family, ""); } -const char *nl_rttype_to_str(u_char rttype) +const char *nl_rttype_to_str(uint8_t rttype) { return lookup_msg(rttype_str, rttype, ""); } diff --git a/zebra/kernel_netlink.h b/zebra/kernel_netlink.h index e5a079af5..8441eeac7 100644 --- a/zebra/kernel_netlink.h +++ b/zebra/kernel_netlink.h @@ -32,7 +32,7 @@ extern int addattr_l(struct nlmsghdr *n, unsigned int maxlen, int type, extern int rta_addattr_l(struct rtattr *rta, unsigned int maxlen, int type, void *data, unsigned int alen); extern int addattr16(struct nlmsghdr *n, unsigned int maxlen, int type, - u_int16_t data); + uint16_t data); extern int addattr32(struct nlmsghdr *n, unsigned int maxlen, int type, int data); extern struct rtattr *addattr_nest(struct nlmsghdr *n, int maxlen, int type); @@ -40,9 +40,9 @@ extern int addattr_nest_end(struct nlmsghdr *n, struct rtattr *nest); extern struct rtattr *rta_nest(struct rtattr *rta, int maxlen, int type); extern int rta_nest_end(struct rtattr *rta, struct rtattr *nest); extern const char *nl_msg_type_to_str(uint16_t msg_type); -extern const char *nl_rtproto_to_str(u_char rtproto); -extern const char *nl_family_to_str(u_char family); -extern const char *nl_rttype_to_str(u_char rttype); +extern const char *nl_rtproto_to_str(uint8_t rtproto); +extern const char *nl_family_to_str(uint8_t family); +extern const char *nl_rttype_to_str(uint8_t rttype); extern int netlink_parse_info(int (*filter)(struct sockaddr_nl *, struct nlmsghdr *, ns_id_t, int), diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index eba4270ef..4ac3bed4b 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -168,7 +168,7 @@ static inline void rta_copy(union sockunion *dest, caddr_t src) #define RTA_NAME_GET(DEST, RTA, RTMADDRS, PNT, LEN) \ if ((RTMADDRS) & (RTA)) { \ - u_char *pdest = (u_char *)(DEST); \ + uint8_t *pdest = (uint8_t *)(DEST); \ int len = SAROUNDUP((PNT)); \ struct sockaddr_dl *sdl = (struct sockaddr_dl *)(PNT); \ if (IS_ZEBRA_DEBUG_KERNEL) \ @@ -864,7 +864,7 @@ static int rtm_read_mesg(struct rt_msghdr *rtm, union sockunion *dest, void rtm_read(struct rt_msghdr *rtm) { int flags; - u_char zebra_flags; + uint8_t zebra_flags; union sockunion dest, mask, gate; char ifname[INTERFACE_NAMSIZ + 1]; short ifnlen = 0; diff --git a/zebra/label_manager.c b/zebra/label_manager.c index b58f0c9ff..ad881b819 100644 --- a/zebra/label_manager.c +++ b/zebra/label_manager.c @@ -64,11 +64,11 @@ static int relay_response_back(struct zserv *zserv) { int ret = 0; struct stream *src, *dst; - u_int16_t size = 0; - u_char marker; - u_char version; + uint16_t size = 0; + uint8_t marker; + uint8_t version; vrf_id_t vrf_id; - u_int16_t resp_cmd; + uint16_t resp_cmd; src = zclient->ibuf; dst = obuf; @@ -269,8 +269,9 @@ void label_manager_init(char *lm_zserv_path) * @para size Size of the label chunk * @return Pointer to the assigned label chunk */ -struct label_manager_chunk *assign_label_chunk(u_char proto, u_short instance, - u_char keep, uint32_t size) +struct label_manager_chunk *assign_label_chunk(uint8_t proto, + unsigned short instance, + uint8_t keep, uint32_t size) { struct label_manager_chunk *lmc; struct listnode *node; @@ -321,7 +322,7 @@ struct label_manager_chunk *assign_label_chunk(u_char proto, u_short instance, * @param end Last label of the chunk * @return 0 on success, -1 otherwise */ -int release_label_chunk(u_char proto, u_short instance, uint32_t start, +int release_label_chunk(uint8_t proto, unsigned short instance, uint32_t start, uint32_t end) { struct listnode *node; @@ -362,7 +363,7 @@ int release_label_chunk(u_char proto, u_short instance, uint32_t start, * @param instance Instance, to identify the owner * @return Number of chunks released */ -int release_daemon_chunks(u_char proto, u_short instance) +int release_daemon_chunks(uint8_t proto, unsigned short instance) { struct listnode *node; struct label_manager_chunk *lmc; diff --git a/zebra/label_manager.h b/zebra/label_manager.h index 875698362..a26e195b7 100644 --- a/zebra/label_manager.h +++ b/zebra/label_manager.h @@ -44,9 +44,9 @@ * the same proto and instance values) */ struct label_manager_chunk { - u_char proto; - u_short instance; - u_char keep; + uint8_t proto; + unsigned short instance; + uint8_t keep; uint32_t start; /* First label of the chunk */ uint32_t end; /* Last label of the chunk */ }; @@ -64,11 +64,12 @@ bool lm_is_external; int zread_relay_label_manager_request(int cmd, struct zserv *zserv, vrf_id_t vrf_id); void label_manager_init(char *lm_zserv_path); -struct label_manager_chunk *assign_label_chunk(u_char proto, u_short instance, - u_char keep, uint32_t size); -int release_label_chunk(u_char proto, u_short instance, uint32_t start, +struct label_manager_chunk *assign_label_chunk(uint8_t proto, + unsigned short instance, + uint8_t keep, uint32_t size); +int release_label_chunk(uint8_t proto, unsigned short instance, uint32_t start, uint32_t end); -int release_daemon_chunks(u_char proto, u_short instance); +int release_daemon_chunks(uint8_t proto, unsigned short instance); void label_manager_close(void); #endif /* _LABEL_MANAGER_H */ diff --git a/zebra/main.c b/zebra/main.c index b0a19c5aa..c8d7f83fb 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -75,7 +75,7 @@ int keep_kernel_mode = 0; #ifdef HAVE_NETLINK /* Receive buffer size for netlink socket */ -u_int32_t nl_rcvbufsize = 4194304; +uint32_t nl_rcvbufsize = 4194304; #endif /* HAVE_NETLINK */ /* Command line options. */ diff --git a/zebra/redistribute.c b/zebra/redistribute.c index 89c17b069..15e7d4437 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -48,9 +48,9 @@ /* array holding redistribute info about table redistribution */ /* bit AFI is set if that AFI is redistributing routes from this table */ static int zebra_import_table_used[AFI_MAX][ZEBRA_KERNEL_TABLE_MAX]; -static u_int32_t zebra_import_table_distance[AFI_MAX][ZEBRA_KERNEL_TABLE_MAX]; +static uint32_t zebra_import_table_distance[AFI_MAX][ZEBRA_KERNEL_TABLE_MAX]; -int is_zebra_import_table_enabled(afi_t afi, u_int32_t table_id) +int is_zebra_import_table_enabled(afi_t afi, uint32_t table_id) { /* * Make sure that what we are called with actualy makes sense @@ -98,8 +98,9 @@ static void zebra_redistribute_default(struct zserv *client, vrf_id_t vrf_id) } /* Redistribute routes. */ -static void zebra_redistribute(struct zserv *client, int type, u_short instance, - vrf_id_t vrf_id, int afi) +static void zebra_redistribute(struct zserv *client, int type, + unsigned short instance, vrf_id_t vrf_id, + int afi) { struct route_entry *newre; struct route_table *table; @@ -249,7 +250,7 @@ void zebra_redistribute_add(ZAPI_HANDLER_ARGS) { afi_t afi = 0; int type = 0; - u_short instance; + unsigned short instance; STREAM_GETC(msg, afi); STREAM_GETC(msg, type); @@ -301,7 +302,7 @@ void zebra_redistribute_delete(ZAPI_HANDLER_ARGS) { afi_t afi = 0; int type = 0; - u_short instance; + unsigned short instance; STREAM_GETC(msg, afi); STREAM_GETC(msg, type); @@ -582,7 +583,7 @@ int zebra_del_import_table_entry(struct route_node *rn, struct route_entry *re) } /* Assuming no one calls this with the main routing table */ -int zebra_import_table(afi_t afi, u_int32_t table_id, u_int32_t distance, +int zebra_import_table(afi_t afi, uint32_t table_id, uint32_t distance, const char *rmap_name, int add) { struct route_table *table; diff --git a/zebra/redistribute.h b/zebra/redistribute.h index e551f820c..c78480d9a 100644 --- a/zebra/redistribute.h +++ b/zebra/redistribute.h @@ -55,7 +55,7 @@ extern void zebra_interface_vrf_update_del(struct interface *, extern void zebra_interface_vrf_update_add(struct interface *, vrf_id_t old_vrf_id); -extern int zebra_import_table(afi_t afi, u_int32_t table_id, u_int32_t distance, +extern int zebra_import_table(afi_t afi, uint32_t table_id, uint32_t distance, const char *rmap_name, int add); extern int zebra_add_import_table_entry(struct route_node *rn, @@ -63,7 +63,7 @@ extern int zebra_add_import_table_entry(struct route_node *rn, const char *rmap_name); extern int zebra_del_import_table_entry(struct route_node *rn, struct route_entry *re); -extern int is_zebra_import_table_enabled(afi_t, u_int32_t table_id); +extern int is_zebra_import_table_enabled(afi_t, uint32_t table_id); extern int zebra_import_table_config(struct vty *); diff --git a/zebra/rib.h b/zebra/rib.h index 0562d544e..d68bf787c 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -56,7 +56,7 @@ struct route_entry { int type; /* Source protocol instance */ - u_short instance; + unsigned short instance; /* VRF identifier. */ vrf_id_t vrf_id; @@ -65,11 +65,11 @@ struct route_entry { uint32_t table; /* Metric */ - u_int32_t metric; + uint32_t metric; /* MTU */ - u_int32_t mtu; - u_int32_t nexthop_mtu; + uint32_t mtu; + uint32_t nexthop_mtu; /* Distance. */ uint8_t distance; @@ -78,10 +78,10 @@ struct route_entry { * This flag's definition is in lib/zebra.h ZEBRA_FLAG_* and is exposed * to clients via Zserv */ - u_int32_t flags; + uint32_t flags; /* RIB internal status */ - u_char status; + uint8_t status; #define ROUTE_ENTRY_REMOVED 0x1 /* to simplify NHT logic when NHs change, instead of doing a NH by NH cmp */ #define ROUTE_ENTRY_NEXTHOPS_CHANGED 0x2 @@ -89,8 +89,8 @@ struct route_entry { #define ROUTE_ENTRY_LABELS_CHANGED 0x8 /* Nexthop information. */ - u_char nexthop_num; - u_char nexthop_active_num; + uint8_t nexthop_num; + uint8_t nexthop_active_num; }; /* meta-queue structure: @@ -103,7 +103,7 @@ struct route_entry { #define MQ_SIZE 5 struct meta_queue { struct list *subq[MQ_SIZE]; - u_int32_t size; /* sum of lengths of all subqueues */ + uint32_t size; /* sum of lengths of all subqueues */ }; /* @@ -127,7 +127,7 @@ typedef struct rib_dest_t_ { /* * Flags, see below. */ - u_int32_t flags; + uint32_t flags; /* * Linkage to put dest on the FPM processing queue. @@ -287,8 +287,8 @@ extern int rib_lookup_ipv4_route(struct prefix_ipv4 *p, union sockunion *qgate, #define ZEBRA_RIB_FOUND_CONNECTED 2 #define ZEBRA_RIB_NOTFOUND 3 -extern int is_zebra_valid_kernel_table(u_int32_t table_id); -extern int is_zebra_main_routing_table(u_int32_t table_id); +extern int is_zebra_valid_kernel_table(uint32_t table_id); +extern int is_zebra_main_routing_table(uint32_t table_id); extern int zebra_check_addr(struct prefix *p); extern void rib_addnode(struct route_node *rn, struct route_entry *re, @@ -302,18 +302,18 @@ extern void rib_uninstall_kernel(struct route_node *rn, struct route_entry *re); * All rib_add function will not just add prefix into RIB, but * also implicitly withdraw equal prefix of same type. */ extern int rib_add(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, - u_short instance, int flags, struct prefix *p, + unsigned short instance, int flags, struct prefix *p, struct prefix_ipv6 *src_p, const struct nexthop *nh, - u_int32_t table_id, u_int32_t metric, u_int32_t mtu, + uint32_t table_id, uint32_t metric, uint32_t mtu, uint8_t distance, route_tag_t tag); extern int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p, struct prefix_ipv6 *src_p, struct route_entry *re); extern void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, - u_short instance, int flags, struct prefix *p, + unsigned short instance, int flags, struct prefix *p, struct prefix_ipv6 *src_p, const struct nexthop *nh, - u_int32_t table_id, u_int32_t metric, bool fromkernel, + uint32_t table_id, uint32_t metric, bool fromkernel, struct ethaddr *rmac); extern struct route_entry *rib_match(afi_t afi, safi_t safi, vrf_id_t vrf_id, @@ -331,8 +331,9 @@ extern void rib_sweep_route(void); extern void rib_sweep_table(struct route_table *table); extern void rib_close_table(struct route_table *table); extern void rib_init(void); -extern unsigned long rib_score_proto(u_char proto, u_short instance); -extern unsigned long rib_score_proto_table(u_char proto, u_short instance, +extern unsigned long rib_score_proto(uint8_t proto, unsigned short instance); +extern unsigned long rib_score_proto_table(uint8_t proto, + unsigned short instance, struct route_table *table); extern void rib_queue_add(struct route_node *rn); extern void meta_queue_free(struct meta_queue *mq); @@ -395,7 +396,7 @@ static inline struct prefix *rib_dest_prefix(rib_dest_t *dest) * * Returns the address family that the destination is for. */ -static inline u_char rib_dest_af(rib_dest_t *dest) +static inline uint8_t rib_dest_af(rib_dest_t *dest) { return dest->rnode->p.family; } diff --git a/zebra/rt.h b/zebra/rt.h index 399f6e845..fd298fd23 100644 --- a/zebra/rt.h +++ b/zebra/rt.h @@ -107,7 +107,7 @@ extern int kernel_del_vtep(vni_t vni, struct interface *ifp, struct in_addr *vtep_ip); extern int kernel_add_mac(struct interface *ifp, vlanid_t vid, struct ethaddr *mac, struct in_addr vtep_ip, - u_char sticky); + uint8_t sticky); extern int kernel_del_mac(struct interface *ifp, vlanid_t vid, struct ethaddr *mac, struct in_addr vtep_ip, int local); diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 2b758c58d..521b4011d 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -72,8 +72,8 @@ static vlanid_t filter_vlan = 0; struct gw_family_t { - u_int16_t filler; - u_int16_t family; + uint16_t filler; + uint16_t family; union g_addr gate; }; @@ -194,7 +194,7 @@ static inline int proto2zebra(int proto, int family) /* Pending: create an efficient table_id (in a tree/hash) based lookup) */ -static vrf_id_t vrf_lookup_by_table(u_int32_t table_id, ns_id_t ns_id) +static vrf_id_t vrf_lookup_by_table(uint32_t table_id, ns_id_t ns_id) { struct vrf *vrf; struct zebra_vrf *zvrf; @@ -226,7 +226,7 @@ static int netlink_route_change_read_unicast(struct sockaddr_nl *snl, int len; struct rtmsg *rtm; struct rtattr *tb[RTA_MAX + 1]; - u_char flags = 0; + uint8_t flags = 0; struct prefix p; struct prefix_ipv6 src_p = {}; vrf_id_t vrf_id; @@ -237,7 +237,7 @@ static int netlink_route_change_read_unicast(struct sockaddr_nl *snl, int index = 0; int table; int metric = 0; - u_int32_t mtu = 0; + uint32_t mtu = 0; uint8_t distance = 0; route_tag_t tag = 0; @@ -344,7 +344,7 @@ static int netlink_route_change_read_unicast(struct sockaddr_nl *snl, RTA_PAYLOAD(tb[RTA_METRICS])); if (mxrta[RTAX_MTU]) - mtu = *(u_int32_t *)RTA_DATA(mxrta[RTAX_MTU]); + mtu = *(uint32_t *)RTA_DATA(mxrta[RTAX_MTU]); } if (rtm->rtm_family == AF_INET) { @@ -772,8 +772,8 @@ int netlink_route_read(struct zebra_ns *zns) return 0; } -static void _netlink_route_nl_add_gateway_info(u_char route_family, - u_char gw_family, +static void _netlink_route_nl_add_gateway_info(uint8_t route_family, + uint8_t gw_family, struct nlmsghdr *nlmsg, size_t req_size, int bytelen, struct nexthop *nexthop) @@ -798,8 +798,8 @@ static void _netlink_route_nl_add_gateway_info(u_char route_family, } } -static void _netlink_route_rta_add_gateway_info(u_char route_family, - u_char gw_family, +static void _netlink_route_rta_add_gateway_info(uint8_t route_family, + uint8_t gw_family, struct rtattr *rta, struct rtnexthop *rtnh, size_t req_size, int bytelen, @@ -896,10 +896,10 @@ static void _netlink_route_build_singlepath(const char *routedesc, int bytelen, num_labels * sizeof(mpls_lse_t)); else { struct rtattr *nest; - u_int16_t encap = LWTUNNEL_ENCAP_MPLS; + uint16_t encap = LWTUNNEL_ENCAP_MPLS; addattr_l(nlmsg, req_size, RTA_ENCAP_TYPE, &encap, - sizeof(u_int16_t)); + sizeof(uint16_t)); nest = addattr_nest(nlmsg, req_size, RTA_ENCAP); addattr_l(nlmsg, req_size, MPLS_IPTUNNEL_DST, &out_lse, num_labels * sizeof(mpls_lse_t)); @@ -1108,11 +1108,11 @@ static void _netlink_route_build_multipath(const char *routedesc, int bytelen, RTA_LENGTH(num_labels * sizeof(mpls_lse_t)); } else { struct rtattr *nest; - u_int16_t encap = LWTUNNEL_ENCAP_MPLS; + uint16_t encap = LWTUNNEL_ENCAP_MPLS; int len = rta->rta_len; rta_addattr_l(rta, NL_PKT_BUF_SIZE, RTA_ENCAP_TYPE, - &encap, sizeof(u_int16_t)); + &encap, sizeof(uint16_t)); nest = rta_nest(rta, NL_PKT_BUF_SIZE, RTA_ENCAP); rta_addattr_l(rta, NL_PKT_BUF_SIZE, MPLS_IPTUNNEL_DST, &out_lse, @@ -1224,7 +1224,7 @@ static inline void _netlink_mpls_build_singlepath(const char *routedesc, size_t req_size, int cmd) { int bytelen; - u_char family; + uint8_t family; family = NHLFE_FAMILY(nhlfe); bytelen = (family == AF_INET ? 4 : 16); @@ -1239,7 +1239,7 @@ _netlink_mpls_build_multipath(const char *routedesc, zebra_nhlfe_t *nhlfe, struct rtmsg *rtmsg, union g_addr **src) { int bytelen; - u_char family; + uint8_t family; family = NHLFE_FAMILY(nhlfe); bytelen = (family == AF_INET ? 4 : 16); @@ -1272,7 +1272,7 @@ static void _netlink_route_debug(int cmd, struct prefix *p, } } -static void _netlink_mpls_debug(int cmd, u_int32_t label, const char *routedesc) +static void _netlink_mpls_debug(int cmd, uint32_t label, const char *routedesc) { if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug("netlink_mpls_multipath() (%s): %s %u/20", routedesc, @@ -1385,7 +1385,7 @@ static int netlink_route_multipath(int cmd, struct prefix *p, if (re->mtu || re->nexthop_mtu) { char buf[NL_PKT_BUF_SIZE]; struct rtattr *rta = (void *)buf; - u_int32_t mtu = re->mtu; + uint32_t mtu = re->mtu; if (!mtu || (re->nexthop_mtu && re->nexthop_mtu < mtu)) mtu = re->nexthop_mtu; rta->rta_type = RTA_METRICS; @@ -1724,7 +1724,7 @@ static int netlink_vxlan_flood_list_update(struct interface *ifp, struct ndmsg ndm; char buf[256]; } req; - u_char dst_mac[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; + uint8_t dst_mac[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id); zns = zvrf->zns; @@ -1797,7 +1797,7 @@ static int netlink_macfdb_change(struct sockaddr_nl *snl, struct nlmsghdr *h, char buf[ETHER_ADDR_STRLEN]; char vid_buf[20]; char dst_buf[30]; - u_char sticky = 0; + uint8_t sticky = 0; ndm = NLMSG_DATA(h); @@ -1854,7 +1854,7 @@ static int netlink_macfdb_change(struct sockaddr_nl *snl, struct nlmsghdr *h, if ((NDA_VLAN <= NDA_MAX) && tb[NDA_VLAN]) { vid_present = 1; - vid = *(u_int16_t *)RTA_DATA(tb[NDA_VLAN]); + vid = *(uint16_t *)RTA_DATA(tb[NDA_VLAN]); sprintf(vid_buf, " VLAN %u", vid); } @@ -2017,7 +2017,7 @@ int netlink_macfdb_read_for_bridge(struct zebra_ns *zns, struct interface *ifp, static int netlink_macfdb_update(struct interface *ifp, vlanid_t vid, struct ethaddr *mac, struct in_addr vtep_ip, - int local, int cmd, u_char sticky) + int local, int cmd, uint8_t sticky) { struct zebra_ns *zns; struct { @@ -2107,7 +2107,7 @@ static int netlink_ipneigh_change(struct sockaddr_nl *snl, struct nlmsghdr *h, char buf[ETHER_ADDR_STRLEN]; char buf2[INET6_ADDRSTRLEN]; int mac_present = 0; - u_char ext_learned; + uint8_t ext_learned; ndm = NLMSG_DATA(h); @@ -2329,7 +2329,7 @@ int netlink_neigh_change(struct sockaddr_nl *snl, struct nlmsghdr *h, } static int netlink_neigh_update2(struct interface *ifp, struct ipaddr *ip, - struct ethaddr *mac, u_int32_t flags, int cmd) + struct ethaddr *mac, uint32_t flags, int cmd) { struct { struct nlmsghdr n; @@ -2377,7 +2377,7 @@ static int netlink_neigh_update2(struct interface *ifp, struct ipaddr *ip, } int kernel_add_mac(struct interface *ifp, vlanid_t vid, struct ethaddr *mac, - struct in_addr vtep_ip, u_char sticky) + struct in_addr vtep_ip, uint8_t sticky) { return netlink_macfdb_update(ifp, vid, mac, vtep_ip, 0, RTM_NEWNEIGH, sticky); diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c index 433faf789..f9cd1cbab 100644 --- a/zebra/rt_socket.c +++ b/zebra/rt_socket.c @@ -444,7 +444,7 @@ int kernel_del_vtep(vni_t vni, struct interface *ifp, struct in_addr *vtep_ip) } int kernel_add_mac(struct interface *ifp, vlanid_t vid, struct ethaddr *mac, - struct in_addr vtep_ip, u_char sticky) + struct in_addr vtep_ip, uint8_t sticky) { return 0; } diff --git a/zebra/rtadv.c b/zebra/rtadv.c index d0b821bfd..c695b6566 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -95,7 +95,7 @@ static int rtadv_increment_received(struct zebra_ns *zns, ifindex_t *ifindex) return ret; } -static int rtadv_recv_packet(struct zebra_ns *zns, int sock, u_char *buf, +static int rtadv_recv_packet(struct zebra_ns *zns, int sock, uint8_t *buf, int buflen, struct sockaddr_in6 *from, ifindex_t *ifindex, int *hoplimit) { @@ -164,10 +164,10 @@ static void rtadv_send_packet(int sock, struct interface *ifp) int len = 0; struct zebra_if *zif; struct rtadv_prefix *rprefix; - u_char all_nodes_addr[] = {0xff, 0x02, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1}; + uint8_t all_nodes_addr[] = {0xff, 0x02, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1}; struct listnode *node; - u_int16_t pkt_RouterLifetime; + uint16_t pkt_RouterLifetime; /* * Allocate control message bufffer. This is dynamic because @@ -315,7 +315,7 @@ static void rtadv_send_packet(int sock, struct interface *ifp) #ifdef DEBUG { - u_char buf[INET6_ADDRSTRLEN]; + uint8_t buf[INET6_ADDRSTRLEN]; zlog_debug("DEBUG %s", inet_ntop(AF_INET6, &pinfo->nd_opt_pi_prefix, @@ -452,7 +452,7 @@ static void rtadv_process_solicit(struct interface *ifp) rtadv_send_packet(zns->rtadv.sock, ifp); } -static void rtadv_process_advert(u_char *msg, unsigned int len, +static void rtadv_process_advert(uint8_t *msg, unsigned int len, struct interface *ifp, struct sockaddr_in6 *addr) { @@ -526,7 +526,7 @@ static void rtadv_process_advert(u_char *msg, unsigned int len, } -static void rtadv_process_packet(u_char *buf, unsigned int len, +static void rtadv_process_packet(uint8_t *buf, unsigned int len, ifindex_t ifindex, int hoplimit, struct sockaddr_in6 *from, struct zebra_ns *zns) @@ -596,7 +596,7 @@ static int rtadv_read(struct thread *thread) { int sock; int len; - u_char buf[RTADV_MSG_SIZE]; + uint8_t buf[RTADV_MSG_SIZE]; struct sockaddr_in6 from; ifindex_t ifindex = 0; int hoplimit = -1; diff --git a/zebra/rtadv.h b/zebra/rtadv.h index 8fd67c8a6..03db13fd6 100644 --- a/zebra/rtadv.h +++ b/zebra/rtadv.h @@ -34,7 +34,7 @@ struct rtadv_prefix { struct prefix_ipv6 prefix; /* The value to be placed in the Valid Lifetime in the Prefix */ - u_int32_t AdvValidLifetime; + uint32_t AdvValidLifetime; #define RTADV_VALID_LIFETIME 2592000 /* The value to be placed in the on-link flag */ @@ -42,7 +42,7 @@ struct rtadv_prefix { /* The value to be placed in the Preferred Lifetime in the Prefix Information option, in seconds.*/ - u_int32_t AdvPreferredLifetime; + uint32_t AdvPreferredLifetime; #define RTADV_PREFERRED_LIFETIME 604800 /* The value to be placed in the Autonomous Flag. */ @@ -83,11 +83,11 @@ struct nd_opt_adv_interval { /* Advertisement interval option */ #ifndef HAVE_STRUCT_ND_OPT_HOMEAGENT_INFO struct nd_opt_homeagent_info { /* Home Agent info */ - u_int8_t nd_opt_hai_type; - u_int8_t nd_opt_hai_len; - u_int16_t nd_opt_hai_reserved; - u_int16_t nd_opt_hai_preference; - u_int16_t nd_opt_hai_lifetime; + uint8_t nd_opt_hai_type; + uint8_t nd_opt_hai_len; + uint16_t nd_opt_hai_reserved; + uint16_t nd_opt_hai_preference; + uint16_t nd_opt_hai_lifetime; } __attribute__((__packed__)); #endif diff --git a/zebra/rtread_getmsg.c b/zebra/rtread_getmsg.c index 38321bc41..b3aeaf2f7 100644 --- a/zebra/rtread_getmsg.c +++ b/zebra/rtread_getmsg.c @@ -77,7 +77,7 @@ static void handle_route_entry(mib2_ipRouteEntry_t *routeEntry) struct prefix prefix; struct in_addr tmpaddr; struct nexthop nh; - u_char zebra_flags = 0; + uint8_t zebra_flags = 0; if (routeEntry->ipRouteInfo.re_ire_type & IRE_CACHETABLE) return; diff --git a/zebra/zebra_fpm_dt.c b/zebra/zebra_fpm_dt.c index 48db246bc..e87fa0ad7 100644 --- a/zebra/zebra_fpm_dt.c +++ b/zebra/zebra_fpm_dt.c @@ -176,7 +176,7 @@ static void zfpm_dt_log_fpm_message(Fpm__Message *msg) Fpm__AddRoute *add_route; Fpm__Nexthop *nexthop; struct prefix prefix; - u_char family, nh_family; + uint8_t family, nh_family; uint if_index; char *if_name; size_t i; diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c index 97a0e142f..c27884ec4 100644 --- a/zebra/zebra_fpm_netlink.c +++ b/zebra/zebra_fpm_netlink.c @@ -45,7 +45,7 @@ * * Returns string representation of an address of the given AF. */ -static inline const char *addr_to_a(u_char af, void *addr) +static inline const char *addr_to_a(uint8_t af, void *addr) { if (!addr) return "<No address>"; @@ -83,7 +83,7 @@ static const char *prefix_addr_to_a(struct prefix *prefix) * * The size of an address in a given address family. */ -static size_t af_addr_size(u_char af) +static size_t af_addr_size(uint8_t af) { switch (af) { @@ -125,10 +125,10 @@ typedef struct netlink_nh_info_t_ { */ typedef struct netlink_route_info_t_ { uint16_t nlmsg_type; - u_char rtm_type; + uint8_t rtm_type; uint32_t rtm_table; - u_char rtm_protocol; - u_char af; + uint8_t rtm_protocol; + uint8_t af; struct prefix *prefix; uint32_t *metric; unsigned int num_nhs; @@ -199,7 +199,7 @@ static int netlink_route_info_add_nh(netlink_route_info_t *ri, /* * netlink_proto_from_route_type */ -static u_char netlink_proto_from_route_type(int type) +static uint8_t netlink_proto_from_route_type(int type) { switch (type) { case ZEBRA_ROUTE_KERNEL: diff --git a/zebra/zebra_l2.h b/zebra/zebra_l2.h index 0d0c5aaf2..db6cb0e53 100644 --- a/zebra/zebra_l2.h +++ b/zebra/zebra_l2.h @@ -37,7 +37,7 @@ struct zebra_l2info_brslave { /* zebra L2 interface information - bridge interface */ struct zebra_l2info_bridge { - u_char vlan_aware; /* VLAN-aware bridge? */ + uint8_t vlan_aware; /* VLAN-aware bridge? */ }; /* zebra L2 interface information - VLAN interface */ diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index 8375d45d2..3cc1848ee 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -60,8 +60,8 @@ extern struct zebra_t zebrad; /* static function declarations */ static void fec_evaluate(struct zebra_vrf *zvrf); -static u_int32_t fec_derive_label_from_index(struct zebra_vrf *vrf, - zebra_fec_t *fec); +static uint32_t fec_derive_label_from_index(struct zebra_vrf *vrf, + zebra_fec_t *fec); static int lsp_install(struct zebra_vrf *zvrf, mpls_label_t label, struct route_node *rn, struct route_entry *re); static int lsp_uninstall(struct zebra_vrf *zvrf, mpls_label_t label); @@ -72,8 +72,8 @@ static void fec_update_clients(zebra_fec_t *fec); static void fec_print(zebra_fec_t *fec, struct vty *vty); static zebra_fec_t *fec_find(struct route_table *table, struct prefix *p); static zebra_fec_t *fec_add(struct route_table *table, struct prefix *p, - mpls_label_t label, u_int32_t flags, - u_int32_t label_index); + mpls_label_t label, uint32_t flags, + uint32_t label_index); static int fec_del(zebra_fec_t *fec); static unsigned int label_hash(void *p); @@ -330,7 +330,7 @@ static void fec_evaluate(struct zebra_vrf *zvrf) { struct route_node *rn; zebra_fec_t *fec; - u_int32_t old_label, new_label; + uint32_t old_label, new_label; int af; char buf[BUFSIZ]; @@ -382,10 +382,10 @@ static void fec_evaluate(struct zebra_vrf *zvrf) * its label index. The index is "acceptable" if it falls within the * globally configured label block (SRGB). */ -static u_int32_t fec_derive_label_from_index(struct zebra_vrf *zvrf, - zebra_fec_t *fec) +static uint32_t fec_derive_label_from_index(struct zebra_vrf *zvrf, + zebra_fec_t *fec) { - u_int32_t label; + uint32_t label; if (fec->label_index != MPLS_INVALID_LABEL_INDEX && zvrf->mpls_srgb.start_label @@ -532,8 +532,8 @@ static zebra_fec_t *fec_find(struct route_table *table, struct prefix *p) * or when a binding is configured. */ static zebra_fec_t *fec_add(struct route_table *table, struct prefix *p, - mpls_label_t label, u_int32_t flags, - u_int32_t label_index) + mpls_label_t label, uint32_t flags, + uint32_t label_index) { struct route_node *rn; zebra_fec_t *fec; @@ -1734,7 +1734,7 @@ void kernel_lsp_pass_fail(zebra_lsp_t *lsp, enum southbound_results res) * -2 if a label was inside the reserved range (0-15) * -3 if the number of labels given exceeds MPLS_MAX_LABELS */ -int mpls_str2label(const char *label_str, u_int8_t *num_labels, +int mpls_str2label(const char *label_str, uint8_t *num_labels, mpls_label_t *labels) { char *ostr; // copy of label string (start) @@ -1779,7 +1779,7 @@ int mpls_str2label(const char *label_str, u_int8_t *num_labels, /* * Label to string conversion, labels in string separated by '/'. */ -char *mpls_label2str(u_int8_t num_labels, mpls_label_t *labels, char *buf, +char *mpls_label2str(uint8_t num_labels, mpls_label_t *labels, char *buf, int len, int pretty) { char label_buf[BUFSIZ]; @@ -1860,14 +1860,14 @@ int zebra_mpls_lsp_uninstall(struct zebra_vrf *zvrf, struct route_node *rn, * is acceptable. */ int zebra_mpls_fec_register(struct zebra_vrf *zvrf, struct prefix *p, - u_int32_t label_index, struct zserv *client) + uint32_t label_index, struct zserv *client) { struct route_table *table; zebra_fec_t *fec; char buf[BUFSIZ]; int new_client; int label_change = 0; - u_int32_t old_label; + uint32_t old_label; table = zvrf->fec_table[family2afi(PREFIX_FAMILY(p))]; if (!table) @@ -2272,7 +2272,7 @@ static bool mpls_ftn_update_nexthop(int add, struct nexthop *nexthop, */ int mpls_ftn_update(int add, struct zebra_vrf *zvrf, enum lsp_types_t type, struct prefix *prefix, enum nexthop_types_t gtype, - union g_addr *gate, ifindex_t ifindex, u_int8_t distance, + union g_addr *gate, ifindex_t ifindex, uint8_t distance, mpls_label_t out_label) { struct route_table *table; @@ -2742,7 +2742,7 @@ void zebra_mpls_lsp_schedule(struct zebra_vrf *zvrf) * (VTY command handler). */ void zebra_mpls_print_lsp(struct vty *vty, struct zebra_vrf *zvrf, - mpls_label_t label, u_char use_json) + mpls_label_t label, uint8_t use_json) { struct hash *lsp_table; zebra_lsp_t *lsp; @@ -2773,7 +2773,7 @@ void zebra_mpls_print_lsp(struct vty *vty, struct zebra_vrf *zvrf, * Display MPLS label forwarding table (VTY command handler). */ void zebra_mpls_print_lsp_table(struct vty *vty, struct zebra_vrf *zvrf, - u_char use_json) + uint8_t use_json) { char buf[BUFSIZ]; json_object *json = NULL; @@ -2893,8 +2893,8 @@ int zebra_mpls_write_lsp_config(struct vty *vty, struct zebra_vrf *zvrf) /* * Add/update global label block. */ -int zebra_mpls_label_block_add(struct zebra_vrf *zvrf, u_int32_t start_label, - u_int32_t end_label) +int zebra_mpls_label_block_add(struct zebra_vrf *zvrf, uint32_t start_label, + uint32_t end_label) { zvrf->mpls_srgb.start_label = start_label; zvrf->mpls_srgb.end_label = end_label; diff --git a/zebra/zebra_mpls.h b/zebra/zebra_mpls.h index fd14b29ca..2637327a7 100644 --- a/zebra/zebra_mpls.h +++ b/zebra/zebra_mpls.h @@ -91,7 +91,7 @@ struct zebra_nhlfe_t_ { zebra_lsp_t *lsp; /* Runtime info - flags, pointers etc. */ - u_int32_t flags; + uint32_t flags; #define NHLFE_FLAG_CHANGED (1 << 0) #define NHLFE_FLAG_SELECTED (1 << 1) #define NHLFE_FLAG_MULTIPATH (1 << 2) @@ -100,7 +100,7 @@ struct zebra_nhlfe_t_ { zebra_nhlfe_t *next; zebra_nhlfe_t *prev; - u_char distance; + uint8_t distance; }; /* @@ -131,17 +131,17 @@ struct zebra_lsp_t_ { /* List of NHLFE, pointer to best and num equal-cost. */ zebra_nhlfe_t *nhlfe_list; zebra_nhlfe_t *best_nhlfe; - u_int32_t num_ecmp; + uint32_t num_ecmp; /* Flags */ - u_int32_t flags; + uint32_t flags; #define LSP_FLAG_SCHEDULED (1 << 0) #define LSP_FLAG_INSTALLED (1 << 1) #define LSP_FLAG_CHANGED (1 << 2) /* Address-family of NHLFE - saved here for delete. All NHLFEs */ /* have to be of the same AF */ - u_char addr_family; + uint8_t addr_family; }; /* @@ -155,10 +155,10 @@ struct zebra_fec_t_ { mpls_label_t label; /* Label index (into global label block), if valid */ - u_int32_t label_index; + uint32_t label_index; /* Flags. */ - u_int32_t flags; + uint32_t flags; #define FEC_FLAG_CONFIGURED (1 << 0) /* Clients interested in this FEC. */ @@ -170,20 +170,20 @@ struct zebra_fec_t_ { /* * String to label conversion, labels separated by '/'. */ -int mpls_str2label(const char *label_str, u_int8_t *num_labels, +int mpls_str2label(const char *label_str, uint8_t *num_labels, mpls_label_t *labels); /* * Label to string conversion, labels in string separated by '/'. */ -char *mpls_label2str(u_int8_t num_labels, mpls_label_t *labels, char *buf, +char *mpls_label2str(uint8_t num_labels, mpls_label_t *labels, char *buf, int len, int pretty); /* * Add/update global label block. */ -int zebra_mpls_label_block_add(struct zebra_vrf *zvrf, u_int32_t start_label, - u_int32_t end_label); +int zebra_mpls_label_block_add(struct zebra_vrf *zvrf, uint32_t start_label, + uint32_t end_label); /* * Delete global label block. @@ -216,7 +216,7 @@ int zebra_mpls_lsp_uninstall(struct zebra_vrf *zvrf, struct route_node *rn, * is acceptable. */ int zebra_mpls_fec_register(struct zebra_vrf *zvrf, struct prefix *p, - u_int32_t label_index, struct zserv *client); + uint32_t label_index, struct zserv *client); /* * Deregistration from a client for the label binding for a FEC. The FEC @@ -284,7 +284,7 @@ void zebra_mpls_print_fec(struct vty *vty, struct zebra_vrf *zvrf, */ int mpls_ftn_update(int add, struct zebra_vrf *zvrf, enum lsp_types_t type, struct prefix *prefix, enum nexthop_types_t gtype, - union g_addr *gate, ifindex_t ifindex, u_int8_t distance, + union g_addr *gate, ifindex_t ifindex, uint8_t distance, mpls_label_t out_label); /* @@ -371,13 +371,13 @@ void zebra_mpls_lsp_schedule(struct zebra_vrf *zvrf); * (VTY command handler). */ void zebra_mpls_print_lsp(struct vty *vty, struct zebra_vrf *zvrf, - mpls_label_t label, u_char use_json); + mpls_label_t label, uint8_t use_json); /* * Display MPLS label forwarding table (VTY command handler). */ void zebra_mpls_print_lsp_table(struct vty *vty, struct zebra_vrf *zvrf, - u_char use_json); + uint8_t use_json); /* * Display MPLS LSP configuration of all static LSPs (VTY command handler). @@ -419,7 +419,7 @@ void zebra_mpls_vty_init(void); /* * Distance (priority) definition for LSP NHLFE. */ -static inline u_char lsp_distance(enum lsp_types_t type) +static inline uint8_t lsp_distance(enum lsp_types_t type) { switch (type) { case ZEBRA_LSP_STATIC: diff --git a/zebra/zebra_mpls_openbsd.c b/zebra/zebra_mpls_openbsd.c index 2c7fe577e..2d75353c7 100644 --- a/zebra/zebra_mpls_openbsd.c +++ b/zebra/zebra_mpls_openbsd.c @@ -35,7 +35,7 @@ extern struct zebra_privs_t zserv_privs; struct { - u_int32_t rtseq; + uint32_t rtseq; int fd; int ioctl_fd; } kr_state; diff --git a/zebra/zebra_mpls_vty.c b/zebra/zebra_mpls_vty.c index 0d922830c..01bc66e5c 100644 --- a/zebra/zebra_mpls_vty.c +++ b/zebra/zebra_mpls_vty.c @@ -198,7 +198,7 @@ static int zebra_mpls_bind(struct vty *vty, int add_cmd, const char *prefix, { struct zebra_vrf *zvrf; struct prefix p; - u_int32_t label; + uint32_t label; int ret; zvrf = vrf_info_lookup(VRF_DEFAULT); @@ -340,7 +340,7 @@ DEFUN (show_mpls_table, JSON_STR) { struct zebra_vrf *zvrf; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); zvrf = vrf_info_lookup(VRF_DEFAULT); zebra_mpls_print_lsp_table(vty, zvrf, uj); @@ -356,9 +356,9 @@ DEFUN (show_mpls_table_lsp, "LSP to display information about\n" JSON_STR) { - u_int32_t label; + uint32_t label; struct zebra_vrf *zvrf; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); zvrf = vrf_info_lookup(VRF_DEFAULT); label = atoi(argv[3]->arg); @@ -384,8 +384,8 @@ static int zebra_mpls_global_block(struct vty *vty, int add_cmd, const char *end_label_str) { int ret; - u_int32_t start_label; - u_int32_t end_label; + uint32_t start_label; + uint32_t end_label; struct zebra_vrf *zvrf; zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); diff --git a/zebra/zebra_netns_id.c b/zebra/zebra_netns_id.c index 57f311aac..317b02f60 100644 --- a/zebra/zebra_netns_id.c +++ b/zebra/zebra_netns_id.c @@ -143,7 +143,7 @@ static ns_id_t extract_nsid(struct nlmsghdr *nlh, char *buf) attr += NETLINK_ALIGN(attr->nla_len)) { curr_length += attr->nla_len; if ((attr->nla_type & NLA_TYPE_MASK) == NETNSA_NSID) { - u_int32_t *ptr = (u_int32_t *)(attr); + uint32_t *ptr = (uint32_t *)(attr); ns_id = ptr[1]; break; diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c index d841bdeec..66b1131e3 100644 --- a/zebra/zebra_ns.c +++ b/zebra/zebra_ns.c @@ -167,7 +167,7 @@ struct route_table *zebra_ns_find_table(struct zebra_ns *zns, uint32_t tableid, return NULL; } -unsigned long zebra_ns_score_proto(u_char proto, u_short instance) +unsigned long zebra_ns_score_proto(uint8_t proto, unsigned short instance) { struct zebra_ns *zns; struct zebra_ns_table *znst; diff --git a/zebra/zebra_ns.h b/zebra/zebra_ns.h index 6655e5c01..66b73148d 100644 --- a/zebra/zebra_ns.h +++ b/zebra/zebra_ns.h @@ -91,6 +91,6 @@ extern struct route_table *zebra_ns_get_table(struct zebra_ns *zns, uint32_t tableid, afi_t afi); int zebra_ns_config_write(struct vty *vty, struct ns *ns); -unsigned long zebra_ns_score_proto(u_char proto, u_short instance); +unsigned long zebra_ns_score_proto(uint8_t proto, unsigned short instance); void zebra_ns_sweep_route(void); #endif diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c index 67c7220b6..2fe6797ee 100644 --- a/zebra/zebra_ptm.c +++ b/zebra/zebra_ptm.c @@ -666,13 +666,13 @@ void zebra_ptm_bfd_dst_register(ZAPI_HANDLER_ARGS) struct stream *s; struct prefix src_p; struct prefix dst_p; - u_char multi_hop; - u_char multi_hop_cnt; - u_char detect_mul; + uint8_t multi_hop; + uint8_t multi_hop_cnt; + uint8_t detect_mul; unsigned int min_rx_timer; unsigned int min_tx_timer; char if_name[INTERFACE_NAMSIZ]; - u_char len; + uint8_t len; void *out_ctxt; char buf[INET6_ADDRSTRLEN]; char tmp_buf[64]; @@ -827,9 +827,9 @@ void zebra_ptm_bfd_dst_deregister(ZAPI_HANDLER_ARGS) struct stream *s; struct prefix src_p; struct prefix dst_p; - u_char multi_hop; + uint8_t multi_hop; char if_name[INTERFACE_NAMSIZ]; - u_char len; + uint8_t len; char buf[INET6_ADDRSTRLEN]; char tmp_buf[64]; int data_len = ZEBRA_PTM_SEND_MAX_SOCKBUF; diff --git a/zebra/zebra_ptm.h b/zebra/zebra_ptm.h index 0b41410be..937c2584f 100644 --- a/zebra/zebra_ptm.h +++ b/zebra/zebra_ptm.h @@ -46,7 +46,7 @@ struct zebra_ptm_cb { int ptm_enable; int pid; - u_int8_t client_flags[ZEBRA_ROUTE_MAX]; + uint8_t client_flags[ZEBRA_ROUTE_MAX]; }; #define ZEBRA_PTM_STATUS_DOWN 0 diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 69cd6697d..effe672a9 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -137,7 +137,7 @@ uint8_t route_distance(int type) return distance; } -int is_zebra_valid_kernel_table(u_int32_t table_id) +int is_zebra_valid_kernel_table(uint32_t table_id) { #ifdef linux if ((table_id == RT_TABLE_UNSPEC) || (table_id == RT_TABLE_LOCAL) @@ -148,7 +148,7 @@ int is_zebra_valid_kernel_table(u_int32_t table_id) return 1; } -int is_zebra_main_routing_table(u_int32_t table_id) +int is_zebra_main_routing_table(uint32_t table_id) { if ((table_id == RT_TABLE_MAIN) || (table_id == zebrad.rtm_table_default)) @@ -159,7 +159,7 @@ int is_zebra_main_routing_table(u_int32_t table_id) int zebra_check_addr(struct prefix *p) { if (p->family == AF_INET) { - u_int32_t addr; + uint32_t addr; addr = p->u.prefix4.s_addr; addr = ntohl(addr); @@ -1736,7 +1736,7 @@ static void rib_process(struct route_node *rn) * picked from it and processed by rib_process(). Don't process more, * than one RN record; operate only in the specified sub-queue. */ -static unsigned int process_subq(struct list *subq, u_char qindex) +static unsigned int process_subq(struct list *subq, uint8_t qindex) { struct listnode *lnode = listhead(subq); struct route_node *rnode; @@ -1839,31 +1839,31 @@ static wq_item_status meta_queue_process(struct work_queue *dummy, void *data) /* * Map from rib types to queue type (priority) in meta queue */ -static const u_char meta_queue_map[ZEBRA_ROUTE_MAX] = { - [ZEBRA_ROUTE_SYSTEM] = 4, - [ZEBRA_ROUTE_KERNEL] = 0, - [ZEBRA_ROUTE_CONNECT] = 0, - [ZEBRA_ROUTE_STATIC] = 1, - [ZEBRA_ROUTE_RIP] = 2, - [ZEBRA_ROUTE_RIPNG] = 2, - [ZEBRA_ROUTE_OSPF] = 2, - [ZEBRA_ROUTE_OSPF6] = 2, - [ZEBRA_ROUTE_ISIS] = 2, - [ZEBRA_ROUTE_BGP] = 3, - [ZEBRA_ROUTE_PIM] = 4, // Shouldn't happen but for safety - [ZEBRA_ROUTE_EIGRP] = 2, - [ZEBRA_ROUTE_NHRP] = 2, - [ZEBRA_ROUTE_HSLS] = 4, - [ZEBRA_ROUTE_OLSR] = 4, - [ZEBRA_ROUTE_TABLE] = 1, - [ZEBRA_ROUTE_LDP] = 4, - [ZEBRA_ROUTE_VNC] = 3, - [ZEBRA_ROUTE_VNC_DIRECT] = 3, - [ZEBRA_ROUTE_VNC_DIRECT_RH] = 3, - [ZEBRA_ROUTE_BGP_DIRECT] = 3, - [ZEBRA_ROUTE_BGP_DIRECT_EXT] = 3, - [ZEBRA_ROUTE_BABEL] = 2, - [ZEBRA_ROUTE_ALL] = 4, // Shouldn't happen but for safety +static const uint8_t meta_queue_map[ZEBRA_ROUTE_MAX] = { + [ZEBRA_ROUTE_SYSTEM] = 4, + [ZEBRA_ROUTE_KERNEL] = 0, + [ZEBRA_ROUTE_CONNECT] = 0, + [ZEBRA_ROUTE_STATIC] = 1, + [ZEBRA_ROUTE_RIP] = 2, + [ZEBRA_ROUTE_RIPNG] = 2, + [ZEBRA_ROUTE_OSPF] = 2, + [ZEBRA_ROUTE_OSPF6] = 2, + [ZEBRA_ROUTE_ISIS] = 2, + [ZEBRA_ROUTE_BGP] = 3, + [ZEBRA_ROUTE_PIM] = 4, // Shouldn't happen but for safety + [ZEBRA_ROUTE_EIGRP] = 2, + [ZEBRA_ROUTE_NHRP] = 2, + [ZEBRA_ROUTE_HSLS] = 4, + [ZEBRA_ROUTE_OLSR] = 4, + [ZEBRA_ROUTE_TABLE] = 1, + [ZEBRA_ROUTE_LDP] = 4, + [ZEBRA_ROUTE_VNC] = 3, + [ZEBRA_ROUTE_VNC_DIRECT] = 3, + [ZEBRA_ROUTE_VNC_DIRECT_RH] = 3, + [ZEBRA_ROUTE_BGP_DIRECT] = 3, + [ZEBRA_ROUTE_BGP_DIRECT_EXT] = 3, + [ZEBRA_ROUTE_BABEL] = 2, + [ZEBRA_ROUTE_ALL] = 4, // Shouldn't happen but for safety }; /* Look into the RN and queue it into one or more priority queues, @@ -1874,7 +1874,7 @@ static void rib_meta_queue_add(struct meta_queue *mq, struct route_node *rn) struct route_entry *re; RNODE_FOREACH_RE (rn, re) { - u_char qindex = meta_queue_map[re->type]; + uint8_t qindex = meta_queue_map[re->type]; struct zebra_vrf *zvrf; /* Invariant: at this point we always have rn->info set. */ @@ -2392,9 +2392,9 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p, } void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, - u_short instance, int flags, struct prefix *p, + unsigned short instance, int flags, struct prefix *p, struct prefix_ipv6 *src_p, const struct nexthop *nh, - u_int32_t table_id, u_int32_t metric, bool fromkernel, + uint32_t table_id, uint32_t metric, bool fromkernel, struct ethaddr *rmac) { struct route_table *table; @@ -2582,10 +2582,11 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, } -int rib_add(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, u_short instance, - int flags, struct prefix *p, struct prefix_ipv6 *src_p, - const struct nexthop *nh, u_int32_t table_id, u_int32_t metric, - u_int32_t mtu, uint8_t distance, route_tag_t tag) +int rib_add(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, + unsigned short instance, int flags, struct prefix *p, + struct prefix_ipv6 *src_p, const struct nexthop *nh, + uint32_t table_id, uint32_t metric, uint32_t mtu, uint8_t distance, + route_tag_t tag) { struct route_entry *re; struct nexthop *nexthop; @@ -2769,7 +2770,7 @@ void rib_sweep_route(void) } /* Remove specific by protocol routes from 'table'. */ -unsigned long rib_score_proto_table(u_char proto, u_short instance, +unsigned long rib_score_proto_table(uint8_t proto, unsigned short instance, struct route_table *table) { struct route_node *rn; @@ -2792,7 +2793,7 @@ unsigned long rib_score_proto_table(u_char proto, u_short instance, } /* Remove specific by protocol routes. */ -unsigned long rib_score_proto(u_char proto, u_short instance) +unsigned long rib_score_proto(uint8_t proto, unsigned short instance) { struct vrf *vrf; struct zebra_vrf *zvrf; diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index 48f9f4f36..65df4e15a 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -985,7 +985,7 @@ static int send_client(struct rnh *rnh, struct zserv *client, rnh_type_t type, struct stream *s; struct route_entry *re; unsigned long nump; - u_char num; + uint8_t num; struct nexthop *nh; struct route_node *rn; int cmd = (type == RNH_IMPORT_CHECK_TYPE) ? ZEBRA_IMPORT_CHECK_UPDATE diff --git a/zebra/zebra_rnh.h b/zebra/zebra_rnh.h index 7af1dbeaf..f783696c0 100644 --- a/zebra/zebra_rnh.h +++ b/zebra/zebra_rnh.h @@ -27,7 +27,7 @@ /* Nexthop structure. */ struct rnh { - u_char flags; + uint8_t flags; #define ZEBRA_NHT_CONNECTED 0x1 #define ZEBRA_NHT_DELETED 0x2 diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index 64c38635f..013e841a5 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -38,7 +38,7 @@ #include "zebra/zebra_rnh.h" #include "zebra/zebra_routemap.h" -static u_int32_t zebra_rmap_update_timer = ZEBRA_RMAP_DEFAULT_UPDATE_TIMER; +static uint32_t zebra_rmap_update_timer = ZEBRA_RMAP_DEFAULT_UPDATE_TIMER; static struct thread *zebra_t_rmap_update = NULL; char *proto_rm[AFI_MAX][ZEBRA_ROUTE_MAX + 1]; /* "any" == ZEBRA_ROUTE_MAX */ /* NH Tracking route map */ @@ -48,12 +48,12 @@ char *zebra_import_table_routemap[AFI_MAX][ZEBRA_KERNEL_TABLE_MAX]; struct nh_rmap_obj { struct nexthop *nexthop; vrf_id_t vrf_id; - u_int32_t source_protocol; + uint32_t source_protocol; int metric; route_tag_t tag; }; -static void zebra_route_map_set_delay_timer(u_int32_t value); +static void zebra_route_map_set_delay_timer(uint32_t value); /* Add zebra route map rule */ @@ -424,7 +424,7 @@ DEFUN (zebra_route_map_timer, "0 means event-driven updates are disabled\n") { int idx_number = 3; - u_int32_t rmap_delay_timer; + uint32_t rmap_delay_timer; rmap_delay_timer = strtoul(argv[idx_number]->arg, NULL, 10); zebra_route_map_set_delay_timer(rmap_delay_timer); @@ -1041,7 +1041,7 @@ static route_map_result_t route_match_address_prefix_len(void *rule, struct prefix *prefix, route_map_object_t type, void *object) { - u_int32_t *prefixlen = (u_int32_t *)rule; + uint32_t *prefixlen = (uint32_t *)rule; if (type == RMAP_ZEBRA) { return ((prefix->prefixlen == *prefixlen) ? RMAP_MATCH @@ -1052,7 +1052,7 @@ route_match_address_prefix_len(void *rule, struct prefix *prefix, static void *route_match_address_prefix_len_compile(const char *arg) { - u_int32_t *prefix_len; + uint32_t *prefix_len; char *endptr = NULL; unsigned long tmpval; @@ -1065,7 +1065,7 @@ static void *route_match_address_prefix_len_compile(const char *arg) if (*endptr != '\0' || errno || tmpval > UINT32_MAX) return NULL; - prefix_len = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(u_int32_t)); + prefix_len = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(uint32_t)); if (!prefix_len) return prefix_len; @@ -1095,7 +1095,7 @@ static route_map_result_t route_match_ip_nexthop_prefix_len(void *rule, struct prefix *prefix, route_map_object_t type, void *object) { - u_int32_t *prefixlen = (u_int32_t *)rule; + uint32_t *prefixlen = (uint32_t *)rule; struct nh_rmap_obj *nh_data; struct prefix_ipv4 p; @@ -1136,7 +1136,7 @@ static route_map_result_t route_match_source_protocol(void *rule, route_map_object_t type, void *object) { - u_int32_t *rib_type = (u_int32_t *)rule; + uint32_t *rib_type = (uint32_t *)rule; struct nh_rmap_obj *nh_data; if (type == RMAP_ZEBRA) { @@ -1152,11 +1152,11 @@ static route_map_result_t route_match_source_protocol(void *rule, static void *route_match_source_protocol_compile(const char *arg) { - u_int32_t *rib_type; + uint32_t *rib_type; int i; i = proto_name2num(arg); - rib_type = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(u_int32_t)); + rib_type = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(uint32_t)); *rib_type = i; @@ -1232,7 +1232,7 @@ static int zebra_route_map_update_timer(struct thread *thread) return (0); } -static void zebra_route_map_set_delay_timer(u_int32_t value) +static void zebra_route_map_set_delay_timer(uint32_t value) { zebra_rmap_update_timer = value; if (!value && zebra_t_rmap_update) { diff --git a/zebra/zebra_snmp.c b/zebra/zebra_snmp.c index 3ab208d30..74eab765c 100644 --- a/zebra/zebra_snmp.c +++ b/zebra/zebra_snmp.c @@ -89,14 +89,14 @@ static oid ipfw_oid[] = {IPFWMIB}; /* Hook functions. */ -static u_char *ipFwNumber(struct variable *, oid[], size_t *, int, size_t *, +static uint8_t *ipFwNumber(struct variable *, oid[], size_t *, int, size_t *, + WriteMethod **); +static uint8_t *ipFwTable(struct variable *, oid[], size_t *, int, size_t *, WriteMethod **); -static u_char *ipFwTable(struct variable *, oid[], size_t *, int, size_t *, - WriteMethod **); -static u_char *ipCidrNumber(struct variable *, oid[], size_t *, int, size_t *, +static uint8_t *ipCidrNumber(struct variable *, oid[], size_t *, int, size_t *, + WriteMethod **); +static uint8_t *ipCidrTable(struct variable *, oid[], size_t *, int, size_t *, WriteMethod **); -static u_char *ipCidrTable(struct variable *, oid[], size_t *, int, size_t *, - WriteMethod **); static struct variable zebra_variables[] = { {0, GAUGE32, RONLY, ipFwNumber, 1, {1}}, @@ -134,9 +134,9 @@ static struct variable zebra_variables[] = { {IPCIDRROUTESTATUS, ROWSTATUS, RONLY, ipCidrTable, 3, {4, 1, 16}}}; -static u_char *ipFwNumber(struct variable *v, oid objid[], size_t *objid_len, - int exact, size_t *val_len, - WriteMethod **write_method) +static uint8_t *ipFwNumber(struct variable *v, oid objid[], size_t *objid_len, + int exact, size_t *val_len, + WriteMethod **write_method) { static int result; struct route_table *table; @@ -159,12 +159,12 @@ static u_char *ipFwNumber(struct variable *v, oid objid[], size_t *objid_len, result++; } - return (u_char *)&result; + return (uint8_t *)&result; } -static u_char *ipCidrNumber(struct variable *v, oid objid[], size_t *objid_len, - int exact, size_t *val_len, - WriteMethod **write_method) +static uint8_t *ipCidrNumber(struct variable *v, oid objid[], size_t *objid_len, + int exact, size_t *val_len, + WriteMethod **write_method) { static int result; struct route_table *table; @@ -187,10 +187,10 @@ static u_char *ipCidrNumber(struct variable *v, oid objid[], size_t *objid_len, result++; } - return (u_char *)&result; + return (uint8_t *)&result; } -static int in_addr_cmp(u_char *p1, u_char *p2) +static int in_addr_cmp(uint8_t *p1, uint8_t *p2) { int i; @@ -205,7 +205,7 @@ static int in_addr_cmp(u_char *p1, u_char *p2) return 0; } -static int in_addr_add(u_char *p, int num) +static int in_addr_add(uint8_t *p, int num) { int i, ip0; @@ -285,8 +285,8 @@ static void check_replace(struct route_node *np2, struct route_entry *re2, return; } - if (in_addr_cmp((u_char *)&(*re)->ng.nexthop->gate.ipv4, - (u_char *)&re2->ng.nexthop->gate.ipv4) + if (in_addr_cmp((uint8_t *)&(*re)->ng.nexthop->gate.ipv4, + (uint8_t *)&re2->ng.nexthop->gate.ipv4) <= 0) return; @@ -307,16 +307,16 @@ static void get_fwtable_route_node(struct variable *v, oid objid[], int proto; int policy; struct in_addr nexthop; - u_char *pnt; + uint8_t *pnt; int i; /* Init index variables */ - pnt = (u_char *)&dest; + pnt = (uint8_t *)&dest; for (i = 0; i < 4; i++) *pnt++ = 0; - pnt = (u_char *)&nexthop; + pnt = (uint8_t *)&nexthop; for (i = 0; i < 4; i++) *pnt++ = 0; @@ -358,7 +358,7 @@ static void get_fwtable_route_node(struct variable *v, oid objid[], /* Apply GETNEXT on not exact search */ if (!exact && (*objid_len >= (unsigned)v->namelen + 10)) { - if (!in_addr_add((u_char *)&nexthop, 1)) + if (!in_addr_add((uint8_t *)&nexthop, 1)) return; } @@ -368,12 +368,13 @@ static void get_fwtable_route_node(struct variable *v, oid objid[], if (policy) /* Not supported (yet?) */ return; for (*np = route_top(table); *np; *np = route_next(*np)) { - if (!in_addr_cmp(&(*np)->p.u.prefix, (u_char *)&dest)) { + if (!in_addr_cmp(&(*np)->p.u.prefix, + (uint8_t *)&dest)) { RNODE_FOREACH_RE (*np, *re) { - if (!in_addr_cmp( - (u_char *)&(*re) - ->ng.nexthop->gate.ipv4, - (u_char *)&nexthop)) + if (!in_addr_cmp((uint8_t *)&(*re) + ->ng.nexthop + ->gate.ipv4, + (uint8_t *)&nexthop)) if (proto == proto_trans((*re)->type)) return; @@ -388,12 +389,12 @@ static void get_fwtable_route_node(struct variable *v, oid objid[], for (np2 = route_top(table); np2; np2 = route_next(np2)) { /* Check destination first */ - if (in_addr_cmp(&np2->p.u.prefix, (u_char *)&dest) > 0) + if (in_addr_cmp(&np2->p.u.prefix, (uint8_t *)&dest) > 0) RNODE_FOREACH_RE (np2, re2) { check_replace(np2, re2, np, re); } - if (in_addr_cmp(&np2->p.u.prefix, (u_char *)&dest) + if (in_addr_cmp(&np2->p.u.prefix, (uint8_t *)&dest) == 0) { /* have to look at each re individually */ RNODE_FOREACH_RE (np2, re2) { int proto2, policy2; @@ -405,9 +406,9 @@ static void get_fwtable_route_node(struct variable *v, oid objid[], || ((policy == policy2) && (proto < proto2)) || ((policy == policy2) && (proto == proto2) && (in_addr_cmp( - (u_char *)&re2->ng.nexthop - ->gate.ipv4, - (u_char *)&nexthop) + (uint8_t *)&re2->ng.nexthop + ->gate.ipv4, + (uint8_t *)&nexthop) >= 0))) check_replace(np2, re2, np, re); } @@ -421,7 +422,7 @@ static void get_fwtable_route_node(struct variable *v, oid objid[], proto = proto_trans((*re)->type); *objid_len = v->namelen + 10; - pnt = (u_char *)&(*np)->p.u.prefix; + pnt = (uint8_t *)&(*np)->p.u.prefix; for (i = 0; i < 4; i++) objid[v->namelen + i] = *pnt++; @@ -433,7 +434,7 @@ static void get_fwtable_route_node(struct variable *v, oid objid[], nexthop = (*re)->ng.nexthop; if (nexthop) { - pnt = (u_char *)&nexthop->gate.ipv4; + pnt = (uint8_t *)&nexthop->gate.ipv4; for (i = 0; i < 4; i++) objid[i + v->namelen + 6] = *pnt++; } @@ -442,8 +443,9 @@ static void get_fwtable_route_node(struct variable *v, oid objid[], return; } -static u_char *ipFwTable(struct variable *v, oid objid[], size_t *objid_len, - int exact, size_t *val_len, WriteMethod **write_method) +static uint8_t *ipFwTable(struct variable *v, oid objid[], size_t *objid_len, + int exact, size_t *val_len, + WriteMethod **write_method) { struct route_node *np; struct route_entry *re; @@ -472,20 +474,20 @@ static u_char *ipFwTable(struct variable *v, oid objid[], size_t *objid_len, case IPFORWARDMASK: masklen2ip(np->p.prefixlen, &netmask); *val_len = 4; - return (u_char *)&netmask; + return (uint8_t *)&netmask; break; case IPFORWARDPOLICY: result = 0; *val_len = sizeof(int); - return (u_char *)&result; + return (uint8_t *)&result; break; case IPFORWARDNEXTHOP: *val_len = 4; - return (u_char *)&nexthop->gate.ipv4; + return (uint8_t *)&nexthop->gate.ipv4; break; case IPFORWARDIFINDEX: *val_len = sizeof(int); - return (u_char *)&nexthop->ifindex; + return (uint8_t *)&nexthop->ifindex; break; case IPFORWARDTYPE: if (nexthop->type == NEXTHOP_TYPE_IFINDEX) @@ -493,53 +495,53 @@ static u_char *ipFwTable(struct variable *v, oid objid[], size_t *objid_len, else result = 4; *val_len = sizeof(int); - return (u_char *)&result; + return (uint8_t *)&result; break; case IPFORWARDPROTO: result = proto_trans(re->type); *val_len = sizeof(int); - return (u_char *)&result; + return (uint8_t *)&result; break; case IPFORWARDAGE: result = 0; *val_len = sizeof(int); - return (u_char *)&result; + return (uint8_t *)&result; break; case IPFORWARDINFO: resarr[0] = 0; resarr[1] = 0; *val_len = 2 * sizeof(int); - return (u_char *)resarr; + return (uint8_t *)resarr; break; case IPFORWARDNEXTHOPAS: result = -1; *val_len = sizeof(int); - return (u_char *)&result; + return (uint8_t *)&result; break; case IPFORWARDMETRIC1: result = 0; *val_len = sizeof(int); - return (u_char *)&result; + return (uint8_t *)&result; break; case IPFORWARDMETRIC2: result = 0; *val_len = sizeof(int); - return (u_char *)&result; + return (uint8_t *)&result; break; case IPFORWARDMETRIC3: result = 0; *val_len = sizeof(int); - return (u_char *)&result; + return (uint8_t *)&result; break; case IPFORWARDMETRIC4: result = 0; *val_len = sizeof(int); - return (u_char *)&result; + return (uint8_t *)&result; break; case IPFORWARDMETRIC5: result = 0; *val_len = sizeof(int); - return (u_char *)&result; + return (uint8_t *)&result; break; default: return NULL; @@ -548,9 +550,9 @@ static u_char *ipFwTable(struct variable *v, oid objid[], size_t *objid_len, return NULL; } -static u_char *ipCidrTable(struct variable *v, oid objid[], size_t *objid_len, - int exact, size_t *val_len, - WriteMethod **write_method) +static uint8_t *ipCidrTable(struct variable *v, oid objid[], size_t *objid_len, + int exact, size_t *val_len, + WriteMethod **write_method) { if (smux_header_table(v, objid, objid_len, exact, val_len, write_method) == MATCH_FAILED) diff --git a/zebra/zebra_static.c b/zebra/zebra_static.c index f3921790a..82b3ee974 100644 --- a/zebra/zebra_static.c +++ b/zebra/zebra_static.c @@ -376,10 +376,10 @@ void static_uninstall_route(afi_t afi, safi_t safi, struct prefix *p, route_unlock_node(rn); } -int static_add_route(afi_t afi, safi_t safi, u_char type, struct prefix *p, +int static_add_route(afi_t afi, safi_t safi, uint8_t type, struct prefix *p, struct prefix_ipv6 *src_p, union g_addr *gate, const char *ifname, enum static_blackhole_type bh_type, - route_tag_t tag, u_char distance, struct zebra_vrf *zvrf, + route_tag_t tag, uint8_t distance, struct zebra_vrf *zvrf, struct zebra_vrf *nh_zvrf, struct static_nh_label *snh_label) { @@ -507,9 +507,9 @@ int static_add_route(afi_t afi, safi_t safi, u_char type, struct prefix *p, return 1; } -int static_delete_route(afi_t afi, safi_t safi, u_char type, struct prefix *p, +int static_delete_route(afi_t afi, safi_t safi, uint8_t type, struct prefix *p, struct prefix_ipv6 *src_p, union g_addr *gate, - const char *ifname, route_tag_t tag, u_char distance, + const char *ifname, route_tag_t tag, uint8_t distance, struct zebra_vrf *zvrf, struct static_nh_label *snh_label) { diff --git a/zebra/zebra_static.h b/zebra/zebra_static.h index 234e3e403..a12e465e7 100644 --- a/zebra/zebra_static.h +++ b/zebra/zebra_static.h @@ -26,8 +26,8 @@ /* Static route label information */ struct static_nh_label { - u_int8_t num_labels; - u_int8_t reserved[3]; + uint8_t num_labels; + uint8_t reserved[3]; mpls_label_t label[MPLS_MAX_LABELS]; }; @@ -57,7 +57,7 @@ struct static_route { vrf_id_t nh_vrf_id; /* Administrative distance. */ - u_char distance; + uint8_t distance; /* Tag */ route_tag_t tag; @@ -85,18 +85,18 @@ extern void static_uninstall_route(afi_t afi, safi_t safi, struct prefix *p, struct prefix_ipv6 *src_p, struct static_route *si); -extern int static_add_route(afi_t, safi_t safi, u_char type, struct prefix *p, +extern int static_add_route(afi_t, safi_t safi, uint8_t type, struct prefix *p, struct prefix_ipv6 *src_p, union g_addr *gate, const char *ifname, enum static_blackhole_type bh_type, route_tag_t tag, - u_char distance, struct zebra_vrf *zvrf, + uint8_t distance, struct zebra_vrf *zvrf, struct zebra_vrf *nh_zvrf, struct static_nh_label *snh_label); -extern int static_delete_route(afi_t, safi_t safi, u_char type, +extern int static_delete_route(afi_t, safi_t safi, uint8_t type, struct prefix *p, struct prefix_ipv6 *src_p, union g_addr *gate, const char *ifname, - route_tag_t tag, u_char distance, + route_tag_t tag, uint8_t distance, struct zebra_vrf *zvrf, struct static_nh_label *snh_label); diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c index f7877f71b..dfb02f15a 100644 --- a/zebra/zebra_vrf.c +++ b/zebra/zebra_vrf.c @@ -372,7 +372,7 @@ int zebra_vrf_has_config(struct zebra_vrf *zvrf) */ struct route_table *zebra_vrf_table_with_table_id(afi_t afi, safi_t safi, vrf_id_t vrf_id, - u_int32_t table_id) + uint32_t table_id) { struct route_table *table = NULL; @@ -526,7 +526,7 @@ struct route_table *zebra_vrf_static_table(afi_t afi, safi_t safi, return zvrf->stable[afi][safi]; } -struct route_table *zebra_vrf_other_route_table(afi_t afi, u_int32_t table_id, +struct route_table *zebra_vrf_other_route_table(afi_t afi, uint32_t table_id, vrf_id_t vrf_id) { struct zebra_vrf *zvrf; diff --git a/zebra/zebra_vrf.h b/zebra/zebra_vrf.h index 4c12d7dee..5c5d2f522 100644 --- a/zebra/zebra_vrf.h +++ b/zebra/zebra_vrf.h @@ -28,8 +28,8 @@ /* MPLS (Segment Routing) global block */ typedef struct mpls_srgb_t_ { - u_int32_t start_label; - u_int32_t end_label; + uint32_t start_label; + uint32_t end_label; } mpls_srgb_t; /* Routing table instance. */ @@ -41,14 +41,14 @@ struct zebra_vrf { char *desc; /* FIB identifier. */ - u_char fib_id; + uint8_t fib_id; /* Flags. */ - u_int16_t flags; + uint16_t flags; #define ZEBRA_VRF_RIB_SCHEDULED (1 << 0) #define ZEBRA_VRF_RETAIN (2 << 0) - u_int32_t table_id; + uint32_t table_id; /* Routing table. */ struct route_table *table[AFI_MAX][SAFI_MAX]; @@ -96,7 +96,7 @@ struct zebra_vrf { struct zebra_static_pw_head static_pseudowires; /* MPLS processing flags */ - u_int16_t mpls_flags; + uint16_t mpls_flags; #define MPLS_FLAG_SCHEDULE_LSPS (1 << 0) /* @@ -152,7 +152,7 @@ static inline bool zvrf_is_active(struct zebra_vrf *zvrf) struct route_table *zebra_vrf_table_with_table_id(afi_t afi, safi_t safi, vrf_id_t vrf_id, - u_int32_t table_id); + uint32_t table_id); extern void zebra_vrf_update_all(struct zserv *client); extern struct zebra_vrf *zebra_vrf_lookup_by_id(vrf_id_t vrf_id); @@ -162,7 +162,7 @@ extern struct route_table *zebra_vrf_table(afi_t, safi_t, vrf_id_t); extern struct route_table *zebra_vrf_static_table(afi_t, safi_t, struct zebra_vrf *zvrf); extern struct route_table * -zebra_vrf_other_route_table(afi_t afi, u_int32_t table_id, vrf_id_t vrf_id); +zebra_vrf_other_route_table(afi_t afi, uint32_t table_id, vrf_id_t vrf_id); extern int zebra_vrf_has_config(struct zebra_vrf *zvrf); extern void zebra_vrf_init(void); diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 328517610..ea35c782f 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -55,11 +55,11 @@ extern int allow_delete; static int do_show_ip_route(struct vty *vty, const char *vrf_name, afi_t afi, - safi_t safi, bool use_fib, u_char use_json, + safi_t safi, bool use_fib, uint8_t use_json, route_tag_t tag, const struct prefix *longer_prefix_p, bool supernets_only, int type, - u_short ospf_instance_id); + unsigned short ospf_instance_id); static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn, int mcast); static void vty_show_ip_route_summary(struct vty *vty, @@ -273,7 +273,7 @@ static int zebra_static_route_leak( const char *distance_str, const char *label_str) { int ret; - u_char distance; + uint8_t distance; struct prefix p, src; struct prefix_ipv6 *src_p = NULL; union g_addr gate; @@ -281,7 +281,7 @@ static int zebra_static_route_leak( struct in_addr mask; enum static_blackhole_type bh_type = 0; route_tag_t tag = 0; - u_char type; + uint8_t type; struct static_nh_label snh_label; ret = str2prefix(dest_str, &p); @@ -1528,7 +1528,8 @@ static void do_show_route_helper(struct vty *vty, struct zebra_vrf *zvrf, bool use_fib, route_tag_t tag, const struct prefix *longer_prefix_p, bool supernets_only, int type, - u_short ospf_instance_id, u_char use_json) + unsigned short ospf_instance_id, + uint8_t use_json) { struct route_node *rn; struct route_entry *re; @@ -1617,11 +1618,11 @@ static void do_show_route_helper(struct vty *vty, struct zebra_vrf *zvrf, } static int do_show_ip_route(struct vty *vty, const char *vrf_name, afi_t afi, - safi_t safi, bool use_fib, u_char use_json, + safi_t safi, bool use_fib, uint8_t use_json, route_tag_t tag, const struct prefix *longer_prefix_p, bool supernets_only, int type, - u_short ospf_instance_id) + unsigned short ospf_instance_id) { struct route_table *table; struct zebra_vrf *zvrf = NULL; @@ -2060,10 +2061,10 @@ static void vty_show_ip_route_summary(struct vty *vty, struct route_entry *re; #define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX #define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1) - u_int32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1]; - u_int32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1]; - u_int32_t i; - u_int32_t is_ibgp; + uint32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1]; + uint32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1]; + uint32_t i; + uint32_t is_ibgp; memset(&rib_cnt, 0, sizeof(rib_cnt)); memset(&fib_cnt, 0, sizeof(fib_cnt)); @@ -2129,9 +2130,9 @@ static void vty_show_ip_route_summary_prefix(struct vty *vty, struct nexthop *nexthop; #define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX #define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1) - u_int32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1]; - u_int32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1]; - u_int32_t i; + uint32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1]; + uint32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1]; + uint32_t i; int cnt; memset(&rib_cnt, 0, sizeof(rib_cnt)); @@ -2824,7 +2825,7 @@ DEFUN (show_vrf_vni, struct zebra_vrf *zvrf; json_object *json = NULL; json_object *json_vrfs = NULL; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); if (uj) { json = json_object_new_object(); @@ -2860,7 +2861,7 @@ DEFUN (show_evpn_global, "EVPN\n" JSON_STR) { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); zebra_vxlan_print_evpn(vty, uj); return CMD_SUCCESS; @@ -2875,7 +2876,7 @@ DEFUN (show_evpn_vni, JSON_STR) { struct zebra_vrf *zvrf; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); zvrf = vrf_info_lookup(VRF_DEFAULT); zebra_vxlan_print_vnis(vty, zvrf, uj); @@ -2893,7 +2894,7 @@ DEFUN (show_evpn_vni_vni, { struct zebra_vrf *zvrf; vni_t vni; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); vni = strtoul(argv[3]->arg, NULL, 10); zvrf = vrf_info_lookup(VRF_DEFAULT); @@ -2915,7 +2916,7 @@ DEFUN (show_evpn_rmac_vni_mac, { vni_t l3vni = 0; struct ethaddr mac; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); l3vni = strtoul(argv[4]->arg, NULL, 10); if (!prefix_str2mac(argv[6]->arg, &mac)) { @@ -2937,7 +2938,7 @@ DEFUN (show_evpn_rmac_vni, JSON_STR) { vni_t l3vni = 0; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); l3vni = strtoul(argv[4]->arg, NULL, 10); zebra_vxlan_print_rmacs_l3vni(vty, l3vni, uj); @@ -2955,7 +2956,7 @@ DEFUN (show_evpn_rmac_vni_all, "All VNIs\n" JSON_STR) { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); zebra_vxlan_print_rmacs_all_l3vni(vty, uj); @@ -2976,7 +2977,7 @@ DEFUN (show_evpn_nh_vni_ip, { vni_t l3vni; struct ipaddr ip; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); l3vni = strtoul(argv[4]->arg, NULL, 10); if (str2ipaddr(argv[6]->arg, &ip) != 0) { @@ -3000,7 +3001,7 @@ DEFUN (show_evpn_nh_vni, JSON_STR) { vni_t l3vni; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); l3vni = strtoul(argv[4]->arg, NULL, 10); zebra_vxlan_print_nh_l3vni(vty, l3vni, uj); @@ -3018,7 +3019,7 @@ DEFUN (show_evpn_nh_vni_all, "All VNIs\n" JSON_STR) { - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); zebra_vxlan_print_nh_all_l3vni(vty, uj); @@ -3037,7 +3038,7 @@ DEFUN (show_evpn_mac_vni, { struct zebra_vrf *zvrf; vni_t vni; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); vni = strtoul(argv[4]->arg, NULL, 10); zvrf = vrf_info_lookup(VRF_DEFAULT); @@ -3056,7 +3057,7 @@ DEFUN (show_evpn_mac_vni_all, JSON_STR) { struct zebra_vrf *zvrf; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); zvrf = vrf_info_lookup(VRF_DEFAULT); zebra_vxlan_print_macs_all_vni(vty, zvrf, uj); @@ -3077,7 +3078,7 @@ DEFUN (show_evpn_mac_vni_all_vtep, { struct zebra_vrf *zvrf; struct in_addr vtep_ip; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); if (!inet_aton(argv[6]->arg, &vtep_ip)) { if (!uj) @@ -3131,7 +3132,7 @@ DEFUN (show_evpn_mac_vni_vtep, struct zebra_vrf *zvrf; vni_t vni; struct in_addr vtep_ip; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); vni = strtoul(argv[4]->arg, NULL, 10); if (!inet_aton(argv[6]->arg, &vtep_ip)) { @@ -3157,7 +3158,7 @@ DEFUN (show_evpn_neigh_vni, { struct zebra_vrf *zvrf; vni_t vni; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); vni = strtoul(argv[4]->arg, NULL, 10); zvrf = vrf_info_lookup(VRF_DEFAULT); @@ -3176,7 +3177,7 @@ DEFUN (show_evpn_neigh_vni_all, JSON_STR) { struct zebra_vrf *zvrf; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); zvrf = vrf_info_lookup(VRF_DEFAULT); zebra_vxlan_print_neigh_all_vni(vty, zvrf, uj); @@ -3198,7 +3199,7 @@ DEFUN (show_evpn_neigh_vni_neigh, struct zebra_vrf *zvrf; vni_t vni; struct ipaddr ip; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); vni = strtoul(argv[4]->arg, NULL, 10); if (str2ipaddr(argv[6]->arg, &ip) != 0) { @@ -3226,7 +3227,7 @@ DEFUN (show_evpn_neigh_vni_vtep, struct zebra_vrf *zvrf; vni_t vni; struct in_addr vtep_ip; - u_char uj = use_json(argc, argv); + uint8_t uj = use_json(argc, argv); vni = strtoul(argv[4]->arg, NULL, 10); if (!inet_aton(argv[6]->arg, &vtep_ip)) { @@ -3261,7 +3262,7 @@ DEFUN (ip_zebra_import_table_distance, "route-map for filtering\n" "route-map name\n") { - u_int32_t table_id = 0; + uint32_t table_id = 0; table_id = strtoul(argv[2]->arg, NULL, 10); int distance = ZEBRA_TABLE_DISTANCE_DEFAULT; @@ -3364,7 +3365,7 @@ DEFUN (no_ip_zebra_import_table, "route-map for filtering\n" "route-map name\n") { - u_int32_t table_id = 0; + uint32_t table_id = 0; table_id = strtoul(argv[3]->arg, NULL, 10); if (!is_zebra_valid_kernel_table(table_id)) { diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 256fa9e4b..7784403ff 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -75,8 +75,8 @@ static void zvni_print(zebra_vni_t *zvni, void **ctxt); static void zvni_print_hash(struct hash_backet *backet, void *ctxt[]); static int zvni_macip_send_msg_to_client(vni_t vni, struct ethaddr *macaddr, - struct ipaddr *ip, u_char flags, - u_int16_t cmd); + struct ipaddr *ip, uint8_t flags, + uint16_t cmd); static unsigned int neigh_hash_keymake(void *p); static int neigh_cmp(const void *p1, const void *p2); static void *zvni_neigh_alloc(void *p); @@ -87,12 +87,14 @@ static int zvni_neigh_del_hash_entry(struct hash_backet *backet, void *arg); static void zvni_neigh_del_from_vtep(zebra_vni_t *zvni, int uninstall, struct in_addr *r_vtep_ip); static void zvni_neigh_del_all(zebra_vni_t *zvni, int uninstall, int upd_client, - u_int32_t flags); + uint32_t flags); static zebra_neigh_t *zvni_neigh_lookup(zebra_vni_t *zvni, struct ipaddr *ip); static int zvni_neigh_send_add_to_client(vni_t vni, struct ipaddr *ip, - struct ethaddr *macaddr, u_char flags); + struct ethaddr *macaddr, + uint8_t flags); static int zvni_neigh_send_del_to_client(vni_t vni, struct ipaddr *ip, - struct ethaddr *macaddr, u_char flags); + struct ethaddr *macaddr, + uint8_t flags); static int zvni_neigh_install(zebra_vni_t *zvni, zebra_neigh_t *n); static int zvni_neigh_uninstall(zebra_vni_t *zvni, zebra_neigh_t *n); static zebra_vni_t *zvni_from_svi(struct interface *ifp, @@ -141,12 +143,12 @@ static int zvni_mac_del_hash_entry(struct hash_backet *backet, void *arg); static void zvni_mac_del_from_vtep(zebra_vni_t *zvni, int uninstall, struct in_addr *r_vtep_ip); static void zvni_mac_del_all(zebra_vni_t *zvni, int uninstall, int upd_client, - u_int32_t flags); + uint32_t flags); static zebra_mac_t *zvni_mac_lookup(zebra_vni_t *zvni, struct ethaddr *macaddr); static int zvni_mac_send_add_to_client(vni_t vni, struct ethaddr *macaddr, - u_char flags); + uint8_t flags); static int zvni_mac_send_del_to_client(vni_t vni, struct ethaddr *macaddr, - u_char flags); + uint8_t flags); static zebra_vni_t *zvni_map_vlan(struct interface *ifp, struct interface *br_if, vlanid_t vid); static int zvni_mac_install(zebra_vni_t *zvni, zebra_mac_t *mac); @@ -186,10 +188,10 @@ static void zvni_deref_ip2mac(zebra_vni_t *zvni, zebra_mac_t *mac, * Return number of valid MACs in a VNI's MAC hash table - all * remote MACs and non-internal (auto) local MACs count. */ -static u_int32_t num_valid_macs(zebra_vni_t *zvni) +static uint32_t num_valid_macs(zebra_vni_t *zvni) { unsigned int i; - u_int32_t num_macs = 0; + uint32_t num_macs = 0; struct hash *hash; struct hash_backet *hb; zebra_mac_t *mac; @@ -378,7 +380,7 @@ static void zvni_print_neigh_hash_all_vni(struct hash_backet *backet, struct vty *vty; json_object *json = NULL, *json_vni = NULL; zebra_vni_t *zvni; - u_int32_t num_neigh; + uint32_t num_neigh; struct neigh_walk_ctx wctx; char vni_str[VNI_STR_LEN]; @@ -673,7 +675,7 @@ static void zvni_print_mac_hash_all_vni(struct hash_backet *backet, void *ctxt) json_object *json = NULL, *json_vni = NULL; json_object *json_mac = NULL; zebra_vni_t *zvni; - u_int32_t num_macs; + uint32_t num_macs; struct mac_walk_ctx *wctx = ctxt; char vni_str[VNI_STR_LEN]; @@ -810,7 +812,7 @@ static void zl3vni_print_rmac_hash_all_vni(struct hash_backet *backet, json_object *json = NULL; json_object *json_vni = NULL; zebra_l3vni_t *zl3vni = NULL; - u_int32_t num_rmacs; + uint32_t num_rmacs; struct rmac_walk_ctx wctx; char vni_str[VNI_STR_LEN]; @@ -953,8 +955,8 @@ static void zvni_print(zebra_vni_t *zvni, void **ctxt) { struct vty *vty; zebra_vtep_t *zvtep; - u_int32_t num_macs; - u_int32_t num_neigh; + uint32_t num_macs; + uint32_t num_neigh; json_object *json = NULL; json_object *json_vtep_list = NULL; json_object *json_ip_str = NULL; @@ -1081,9 +1083,9 @@ static void zvni_print_hash(struct hash_backet *backet, void *ctxt[]) struct vty *vty; zebra_vni_t *zvni; zebra_vtep_t *zvtep; - u_int32_t num_vteps = 0; - u_int32_t num_macs = 0; - u_int32_t num_neigh = 0; + uint32_t num_vteps = 0; + uint32_t num_macs = 0; + uint32_t num_neigh = 0; json_object *json = NULL; json_object *json_vni = NULL; json_object *json_ip_str = NULL; @@ -1143,8 +1145,8 @@ static void zvni_print_hash(struct hash_backet *backet, void *ctxt[]) * Inform BGP about local MACIP. */ static int zvni_macip_send_msg_to_client(vni_t vni, struct ethaddr *macaddr, - struct ipaddr *ip, u_char flags, - u_int16_t cmd) + struct ipaddr *ip, uint8_t flags, + uint16_t cmd) { char buf[ETHER_ADDR_STRLEN]; char buf2[INET6_ADDRSTRLEN]; @@ -1343,7 +1345,7 @@ static void zvni_neigh_del_from_vtep(zebra_vni_t *zvni, int uninstall, * Delete all neighbor entries for this VNI. */ static void zvni_neigh_del_all(zebra_vni_t *zvni, int uninstall, int upd_client, - u_int32_t flags) + uint32_t flags) { struct neigh_walk_ctx wctx; @@ -1512,9 +1514,9 @@ static void zvni_process_neigh_on_remote_mac_del(zebra_vni_t *zvni, */ static int zvni_neigh_send_add_to_client(vni_t vni, struct ipaddr *ip, struct ethaddr *macaddr, - u_char neigh_flags) + uint8_t neigh_flags) { - u_char flags = 0; + uint8_t flags = 0; if (CHECK_FLAG(neigh_flags, ZEBRA_NEIGH_DEF_GW)) SET_FLAG(flags, ZEBRA_MACIP_TYPE_GW); @@ -1527,7 +1529,7 @@ static int zvni_neigh_send_add_to_client(vni_t vni, struct ipaddr *ip, * Inform BGP about local neighbor deletion. */ static int zvni_neigh_send_del_to_client(vni_t vni, struct ipaddr *ip, - struct ethaddr *macaddr, u_char flags) + struct ethaddr *macaddr, uint8_t flags) { return zvni_macip_send_msg_to_client(vni, macaddr, ip, flags, ZEBRA_MACIP_DEL); @@ -2062,7 +2064,7 @@ static void zvni_mac_del_from_vtep(zebra_vni_t *zvni, int uninstall, * Delete all MAC entries for this VNI. */ static void zvni_mac_del_all(zebra_vni_t *zvni, int uninstall, int upd_client, - u_int32_t flags) + uint32_t flags) { struct mac_walk_ctx wctx; @@ -2099,9 +2101,9 @@ static zebra_mac_t *zvni_mac_lookup(zebra_vni_t *zvni, struct ethaddr *mac) * Inform BGP about local MAC addition. */ static int zvni_mac_send_add_to_client(vni_t vni, struct ethaddr *macaddr, - u_char mac_flags) + uint8_t mac_flags) { - u_char flags = 0; + uint8_t flags = 0; if (CHECK_FLAG(mac_flags, ZEBRA_MAC_STICKY)) SET_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY); @@ -2116,9 +2118,9 @@ static int zvni_mac_send_add_to_client(vni_t vni, struct ethaddr *macaddr, * Inform BGP about local MAC deletion. */ static int zvni_mac_send_del_to_client(vni_t vni, struct ethaddr *macaddr, - u_char mac_flags) + uint8_t mac_flags) { - u_char flags = 0; + uint8_t flags = 0; if (CHECK_FLAG(mac_flags, ZEBRA_MAC_STICKY)) SET_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY); @@ -2142,7 +2144,7 @@ static zebra_vni_t *zvni_map_vlan(struct interface *ifp, struct zebra_if *zif; struct zebra_l2info_bridge *br; struct zebra_l2info_vxlan *vxl = NULL; - u_char bridge_vlan_aware; + uint8_t bridge_vlan_aware; zebra_vni_t *zvni; int found = 0; @@ -2195,7 +2197,7 @@ static zebra_vni_t *zvni_from_svi(struct interface *ifp, struct zebra_if *zif; struct zebra_l2info_bridge *br; struct zebra_l2info_vxlan *vxl = NULL; - u_char bridge_vlan_aware; + uint8_t bridge_vlan_aware; vlanid_t vid = 0; zebra_vni_t *zvni; int found = 0; @@ -2269,7 +2271,7 @@ static struct interface *zvni_map_to_svi(vlanid_t vid, struct interface *br_if) struct zebra_if *zif; struct zebra_l2info_bridge *br; struct zebra_l2info_vlan *vl; - u_char bridge_vlan_aware; + uint8_t bridge_vlan_aware; int found = 0; /* Defensive check, caller expected to invoke only with valid bridge. */ @@ -2316,7 +2318,7 @@ static int zvni_mac_install(zebra_vni_t *zvni, zebra_mac_t *mac) { struct zebra_if *zif; struct zebra_l2info_vxlan *vxl; - u_char sticky; + uint8_t sticky; if (!(mac->flags & ZEBRA_MAC_REMOTE)) return 0; @@ -3241,7 +3243,7 @@ static int zl3vni_remote_nh_del(zebra_l3vni_t *zl3vni, struct ipaddr *vtep_ip, * readd stale entries. */ static int zl3vni_local_nh_add_update(zebra_l3vni_t *zl3vni, struct ipaddr *ip, - u_int16_t state) + uint16_t state) { #ifdef GNU_LINUX zebra_neigh_t *n = NULL; @@ -3466,7 +3468,7 @@ static zebra_l3vni_t *zl3vni_from_svi(struct interface *ifp, { int found = 0; vlanid_t vid = 0; - u_char bridge_vlan_aware = 0; + uint8_t bridge_vlan_aware = 0; zebra_l3vni_t *zl3vni = NULL; struct zebra_ns *zns = NULL; struct route_node *rn = NULL; @@ -3811,7 +3813,7 @@ void zebra_vxlan_evpn_vrf_route_del(vrf_id_t vrf_id, struct ethaddr *rmac, void zebra_vxlan_print_specific_rmac_l3vni(struct vty *vty, vni_t l3vni, struct ethaddr *rmac, - u_char use_json) + uint8_t use_json) { zebra_l3vni_t *zl3vni = NULL; zebra_mac_t *zrmac = NULL; @@ -3856,10 +3858,10 @@ void zebra_vxlan_print_specific_rmac_l3vni(struct vty *vty, vni_t l3vni, } void zebra_vxlan_print_rmacs_l3vni(struct vty *vty, vni_t l3vni, - u_char use_json) + uint8_t use_json) { zebra_l3vni_t *zl3vni; - u_int32_t num_rmacs; + uint32_t num_rmacs; struct rmac_walk_ctx wctx; json_object *json = NULL; @@ -3900,7 +3902,7 @@ void zebra_vxlan_print_rmacs_l3vni(struct vty *vty, vni_t l3vni, } } -void zebra_vxlan_print_rmacs_all_l3vni(struct vty *vty, u_char use_json) +void zebra_vxlan_print_rmacs_all_l3vni(struct vty *vty, uint8_t use_json) { struct zebra_ns *zns = NULL; json_object *json = NULL; @@ -3937,7 +3939,7 @@ void zebra_vxlan_print_rmacs_all_l3vni(struct vty *vty, u_char use_json) } void zebra_vxlan_print_specific_nh_l3vni(struct vty *vty, vni_t l3vni, - struct ipaddr *ip, u_char use_json) + struct ipaddr *ip, uint8_t use_json) { zebra_l3vni_t *zl3vni = NULL; zebra_neigh_t *n = NULL; @@ -3981,9 +3983,9 @@ void zebra_vxlan_print_specific_nh_l3vni(struct vty *vty, vni_t l3vni, } } -void zebra_vxlan_print_nh_l3vni(struct vty *vty, vni_t l3vni, u_char use_json) +void zebra_vxlan_print_nh_l3vni(struct vty *vty, vni_t l3vni, uint8_t use_json) { - u_int32_t num_nh; + uint32_t num_nh; struct nh_walk_ctx wctx; json_object *json = NULL; zebra_l3vni_t *zl3vni = NULL; @@ -4025,7 +4027,7 @@ void zebra_vxlan_print_nh_l3vni(struct vty *vty, vni_t l3vni, u_char use_json) } } -void zebra_vxlan_print_nh_all_l3vni(struct vty *vty, u_char use_json) +void zebra_vxlan_print_nh_all_l3vni(struct vty *vty, uint8_t use_json) { struct zebra_ns *zns = NULL; json_object *json = NULL; @@ -4062,7 +4064,7 @@ void zebra_vxlan_print_nh_all_l3vni(struct vty *vty, u_char use_json) /* * Display L3 VNI information (VTY command handler). */ -void zebra_vxlan_print_l3vni(struct vty *vty, vni_t vni, u_char use_json) +void zebra_vxlan_print_l3vni(struct vty *vty, vni_t vni, uint8_t use_json) { void *args[2]; json_object *json = NULL; @@ -4135,10 +4137,10 @@ void zebra_vxlan_print_vrf_vni(struct vty *vty, struct zebra_vrf *zvrf, * Display Neighbors for a VNI (VTY command handler). */ void zebra_vxlan_print_neigh_vni(struct vty *vty, struct zebra_vrf *zvrf, - vni_t vni, u_char use_json) + vni_t vni, uint8_t use_json) { zebra_vni_t *zvni; - u_int32_t num_neigh; + uint32_t num_neigh; struct neigh_walk_ctx wctx; json_object *json = NULL; @@ -4191,7 +4193,7 @@ void zebra_vxlan_print_neigh_vni(struct vty *vty, struct zebra_vrf *zvrf, * Display neighbors across all VNIs (VTY command handler). */ void zebra_vxlan_print_neigh_all_vni(struct vty *vty, struct zebra_vrf *zvrf, - u_char use_json) + uint8_t use_json) { json_object *json = NULL; void *args[2]; @@ -4220,7 +4222,7 @@ void zebra_vxlan_print_neigh_all_vni(struct vty *vty, struct zebra_vrf *zvrf, */ void zebra_vxlan_print_specific_neigh_vni(struct vty *vty, struct zebra_vrf *zvrf, vni_t vni, - struct ipaddr *ip, u_char use_json) + struct ipaddr *ip, uint8_t use_json) { zebra_vni_t *zvni; zebra_neigh_t *n; @@ -4262,10 +4264,10 @@ void zebra_vxlan_print_specific_neigh_vni(struct vty *vty, */ void zebra_vxlan_print_neigh_vni_vtep(struct vty *vty, struct zebra_vrf *zvrf, vni_t vni, struct in_addr vtep_ip, - u_char use_json) + uint8_t use_json) { zebra_vni_t *zvni; - u_int32_t num_neigh; + uint32_t num_neigh; struct neigh_walk_ctx wctx; json_object *json = NULL; @@ -4302,10 +4304,10 @@ void zebra_vxlan_print_neigh_vni_vtep(struct vty *vty, struct zebra_vrf *zvrf, * Display MACs for a VNI (VTY command handler). */ void zebra_vxlan_print_macs_vni(struct vty *vty, struct zebra_vrf *zvrf, - vni_t vni, u_char use_json) + vni_t vni, uint8_t use_json) { zebra_vni_t *zvni; - u_int32_t num_macs; + uint32_t num_macs; struct mac_walk_ctx wctx; json_object *json = NULL; json_object *json_mac = NULL; @@ -4357,7 +4359,7 @@ void zebra_vxlan_print_macs_vni(struct vty *vty, struct zebra_vrf *zvrf, * Display MACs for all VNIs (VTY command handler). */ void zebra_vxlan_print_macs_all_vni(struct vty *vty, struct zebra_vrf *zvrf, - u_char use_json) + uint8_t use_json) { struct mac_walk_ctx wctx; json_object *json = NULL; @@ -4388,7 +4390,7 @@ void zebra_vxlan_print_macs_all_vni(struct vty *vty, struct zebra_vrf *zvrf, void zebra_vxlan_print_macs_all_vni_vtep(struct vty *vty, struct zebra_vrf *zvrf, struct in_addr vtep_ip, - u_char use_json) + uint8_t use_json) { struct mac_walk_ctx wctx; json_object *json = NULL; @@ -4444,10 +4446,10 @@ void zebra_vxlan_print_specific_mac_vni(struct vty *vty, struct zebra_vrf *zvrf, */ void zebra_vxlan_print_macs_vni_vtep(struct vty *vty, struct zebra_vrf *zvrf, vni_t vni, struct in_addr vtep_ip, - u_char use_json) + uint8_t use_json) { zebra_vni_t *zvni; - u_int32_t num_macs; + uint32_t num_macs; struct mac_walk_ctx wctx; json_object *json = NULL; json_object *json_mac = NULL; @@ -4494,7 +4496,7 @@ void zebra_vxlan_print_macs_vni_vtep(struct vty *vty, struct zebra_vrf *zvrf, * Display VNI information (VTY command handler). */ void zebra_vxlan_print_vni(struct vty *vty, struct zebra_vrf *zvrf, vni_t vni, - u_char use_json) + uint8_t use_json) { json_object *json = NULL; void *args[2]; @@ -4533,7 +4535,7 @@ void zebra_vxlan_print_vni(struct vty *vty, struct zebra_vrf *zvrf, vni_t vni, } /* Display all global details for EVPN */ -void zebra_vxlan_print_evpn(struct vty *vty, u_char uj) +void zebra_vxlan_print_evpn(struct vty *vty, uint8_t uj) { int num_l2vnis = 0; int num_l3vnis = 0; @@ -4582,7 +4584,7 @@ void zebra_vxlan_print_evpn(struct vty *vty, u_char uj) * Display VNI hash table (VTY command handler). */ void zebra_vxlan_print_vnis(struct vty *vty, struct zebra_vrf *zvrf, - u_char use_json) + uint8_t use_json) { json_object *json = NULL; struct zebra_ns *zns = NULL; @@ -4712,8 +4714,8 @@ int zebra_vxlan_local_neigh_del(struct interface *ifp, int zebra_vxlan_local_neigh_add_update(struct interface *ifp, struct interface *link_if, struct ipaddr *ip, - struct ethaddr *macaddr, u_int16_t state, - u_char ext_learned) + struct ethaddr *macaddr, uint16_t state, + uint8_t ext_learned) { char buf[ETHER_ADDR_STRLEN]; char buf2[INET6_ADDRSTRLEN]; @@ -4762,7 +4764,7 @@ int zebra_vxlan_local_neigh_add_update(struct interface *ifp, } memset(&zmac->fwd_info, 0, sizeof(zmac->fwd_info)); - memset(&zmac->flags, 0, sizeof(u_int32_t)); + memset(&zmac->flags, 0, sizeof(uint32_t)); SET_FLAG(zmac->flags, ZEBRA_MAC_AUTO); } @@ -4868,7 +4870,7 @@ void zebra_vxlan_remote_macip_del(ZAPI_HANDLER_ARGS) zebra_vni_t *zvni; zebra_mac_t *mac; zebra_neigh_t *n; - u_short l = 0, ipa_len; + unsigned short l = 0, ipa_len; char buf[ETHER_ADDR_STRLEN]; char buf1[INET6_ADDRSTRLEN]; struct interface *ifp = NULL; @@ -5021,12 +5023,12 @@ void zebra_vxlan_remote_macip_add(ZAPI_HANDLER_ARGS) zebra_vtep_t *zvtep; zebra_mac_t *mac, *old_mac; zebra_neigh_t *n; - u_short l = 0, ipa_len; + unsigned short l = 0, ipa_len; int update_mac = 0, update_neigh = 0; char buf[ETHER_ADDR_STRLEN]; char buf1[INET6_ADDRSTRLEN]; - u_char sticky = 0; - u_char flags = 0; + uint8_t sticky = 0; + uint8_t flags = 0; struct interface *ifp = NULL; struct zebra_if *zif = NULL; @@ -5414,13 +5416,13 @@ int zebra_vxlan_local_mac_del(struct interface *ifp, struct interface *br_if, int zebra_vxlan_local_mac_add_update(struct interface *ifp, struct interface *br_if, struct ethaddr *macaddr, vlanid_t vid, - u_char sticky) + uint8_t sticky) { zebra_vni_t *zvni; zebra_mac_t *mac; char buf[ETHER_ADDR_STRLEN]; int add = 1; - u_char mac_sticky; + uint8_t mac_sticky; /* We are interested in MACs only on ports or (port, VLAN) that * map to a VNI. @@ -5539,7 +5541,7 @@ int zebra_vxlan_local_mac_add_update(struct interface *ifp, void zebra_vxlan_remote_vtep_del(ZAPI_HANDLER_ARGS) { struct stream *s; - u_short l = 0; + unsigned short l = 0; vni_t vni; struct in_addr vtep_ip; zebra_vni_t *zvni; @@ -5624,7 +5626,7 @@ stream_failure: void zebra_vxlan_remote_vtep_add(ZAPI_HANDLER_ARGS) { struct stream *s; - u_short l = 0; + unsigned short l = 0; vni_t vni; struct in_addr vtep_ip; zebra_vni_t *zvni; @@ -6114,7 +6116,7 @@ int zebra_vxlan_if_del(struct interface *ifp) /* * Handle VxLAN interface update - change to tunnel IP, master or VLAN. */ -int zebra_vxlan_if_update(struct interface *ifp, u_int16_t chgflags) +int zebra_vxlan_if_update(struct interface *ifp, uint16_t chgflags) { vni_t vni; struct zebra_if *zif = NULL; diff --git a/zebra/zebra_vxlan.h b/zebra/zebra_vxlan.h index 6f25ad1e2..16b01e6ac 100644 --- a/zebra/zebra_vxlan.h +++ b/zebra/zebra_vxlan.h @@ -68,52 +68,53 @@ extern int zebra_vxlan_vrf_enable(struct zebra_vrf *zvrf); extern int zebra_vxlan_vrf_disable(struct zebra_vrf *zvrf); extern int zebra_vxlan_vrf_delete(struct zebra_vrf *zvrf); extern void zebra_vxlan_print_specific_nh_l3vni(struct vty *vty, vni_t l3vni, - struct ipaddr *ip, u_char uj); -extern void zebra_vxlan_print_evpn(struct vty *vty, u_char uj); + struct ipaddr *ip, uint8_t uj); +extern void zebra_vxlan_print_evpn(struct vty *vty, uint8_t uj); extern void zebra_vxlan_print_specific_rmac_l3vni(struct vty *vty, vni_t l3vni, struct ethaddr *rmac, - u_char use_json); + uint8_t use_json); extern void zebra_vxlan_print_macs_vni(struct vty *vty, struct zebra_vrf *zvrf, - vni_t vni, u_char use_json); + vni_t vni, uint8_t use_json); extern void zebra_vxlan_print_macs_all_vni(struct vty *vty, struct zebra_vrf *zvrf, - u_char use_json); + uint8_t use_json); extern void zebra_vxlan_print_macs_all_vni_vtep(struct vty *vty, struct zebra_vrf *zvrf, struct in_addr vtep_ip, - u_char use_json); + uint8_t use_json); extern void zebra_vxlan_print_specific_mac_vni(struct vty *vty, struct zebra_vrf *zvrf, vni_t vni, struct ethaddr *mac); extern void zebra_vxlan_print_macs_vni_vtep(struct vty *vty, struct zebra_vrf *zvrf, vni_t vni, struct in_addr vtep_ip, - u_char use_json); + uint8_t use_json); extern void zebra_vxlan_print_neigh_vni(struct vty *vty, struct zebra_vrf *zvrf, - vni_t vni, u_char use_json); + vni_t vni, uint8_t use_json); extern void zebra_vxlan_print_neigh_all_vni(struct vty *vty, struct zebra_vrf *zvrf, - u_char use_json); + uint8_t use_json); extern void zebra_vxlan_print_specific_neigh_vni(struct vty *vty, struct zebra_vrf *zvrf, vni_t vni, struct ipaddr *ip, - u_char use_json); + uint8_t use_json); extern void zebra_vxlan_print_neigh_vni_vtep(struct vty *vty, struct zebra_vrf *zvrf, vni_t vni, struct in_addr vtep_ip, - u_char use_json); + uint8_t use_json); extern void zebra_vxlan_print_vni(struct vty *vty, struct zebra_vrf *zvrf, - vni_t vni, u_char use_json); + vni_t vni, uint8_t use_json); extern void zebra_vxlan_print_vnis(struct vty *vty, struct zebra_vrf *zvrf, - u_char use_json); + uint8_t use_json); extern void zebra_vxlan_print_rmacs_l3vni(struct vty *vty, vni_t vni, - u_char use_json); -extern void zebra_vxlan_print_rmacs_all_l3vni(struct vty *vty, u_char use_json); + uint8_t use_json); +extern void zebra_vxlan_print_rmacs_all_l3vni(struct vty *vty, + uint8_t use_json); extern void zebra_vxlan_print_nh_l3vni(struct vty *vty, vni_t vni, - u_char use_json); -extern void zebra_vxlan_print_nh_all_l3vni(struct vty *vty, u_char use_json); + uint8_t use_json); +extern void zebra_vxlan_print_nh_all_l3vni(struct vty *vty, uint8_t use_json); extern void zebra_vxlan_print_l3vni(struct vty *vty, vni_t vni, - u_char use_json); + uint8_t use_json); extern void zebra_vxlan_print_vrf_vni(struct vty *vty, struct zebra_vrf *zvrf, json_object *json_vrfs); extern int zebra_vxlan_add_del_gw_macip(struct interface *ifp, struct prefix *p, @@ -123,14 +124,14 @@ extern int zebra_vxlan_svi_down(struct interface *ifp, struct interface *link_if); extern int zebra_vxlan_local_neigh_add_update( struct interface *ifp, struct interface *link_if, struct ipaddr *ip, - struct ethaddr *macaddr, u_int16_t state, u_char ext_learned); + struct ethaddr *macaddr, uint16_t state, uint8_t ext_learned); extern int zebra_vxlan_local_neigh_del(struct interface *ifp, struct interface *link_if, struct ipaddr *ip); extern int zebra_vxlan_local_mac_add_update(struct interface *ifp, struct interface *br_if, struct ethaddr *mac, vlanid_t vid, - u_char sticky); + uint8_t sticky); extern int zebra_vxlan_local_mac_del(struct interface *ifp, struct interface *br_if, struct ethaddr *mac, vlanid_t vid); @@ -144,7 +145,7 @@ extern int zebra_vxlan_check_del_local_mac(struct interface *ifp, extern int zebra_vxlan_if_up(struct interface *ifp); extern int zebra_vxlan_if_down(struct interface *ifp); extern int zebra_vxlan_if_add(struct interface *ifp); -extern int zebra_vxlan_if_update(struct interface *ifp, u_int16_t chgflags); +extern int zebra_vxlan_if_update(struct interface *ifp, uint16_t chgflags); extern int zebra_vxlan_if_del(struct interface *ifp); extern int zebra_vxlan_process_vrf_vni_cmd(struct zebra_vrf *zvrf, vni_t vni, char *err, int err_str_sz, diff --git a/zebra/zebra_vxlan_null.c b/zebra/zebra_vxlan_null.c index 1bac2cafb..afc59774c 100644 --- a/zebra/zebra_vxlan_null.c +++ b/zebra/zebra_vxlan_null.c @@ -83,23 +83,23 @@ void zebra_vxlan_print_vnis(struct vty *vty, struct zebra_vrf *zvrf) { } -void zebra_vxlan_print_evpn(struct vty *vty, u_char uj) +void zebra_vxlan_print_evpn(struct vty *vty, uint8_t uj) { } -void zebra_vxlan_print_rmacs_l3vni(struct vty *, vni_t, u_char) +void zebra_vxlan_print_rmacs_l3vni(struct vty *, vni_t, uint8_t) { } -void zebra_vxlan_print_rmacs_all_l3vni(struct vty *, u_char) +void zebra_vxlan_print_rmacs_all_l3vni(struct vty *, uint8_t) { } -void zebra_vxlan_print_nh_l3vni(struct vty *, vni_t, u_char) +void zebra_vxlan_print_nh_l3vni(struct vty *, vni_t, uint8_t) { } -void zebra_vxlan_print_nh_all_l3vni(struct vty *, u_char) +void zebra_vxlan_print_nh_all_l3vni(struct vty *, uint8_t) { } @@ -117,14 +117,14 @@ int zebra_vxlan_svi_down(struct interface *ifp, struct interface *link_if) return 0; } -int zebra_vxlan_remote_macip_add(struct zserv *client, int sock, u_short length, - struct zebra_vrf *zvrf) +int zebra_vxlan_remote_macip_add(struct zserv *client, int sock, + unsigned short length, struct zebra_vrf *zvrf) { return 0; } -int zebra_vxlan_remote_macip_del(struct zserv *client, int sock, u_short length, - struct zebra_vrf *zvrf) +int zebra_vxlan_remote_macip_del(struct zserv *client, int sock, + unsigned short length, struct zebra_vrf *zvrf) { return 0; } @@ -132,7 +132,7 @@ int zebra_vxlan_remote_macip_del(struct zserv *client, int sock, u_short length, int zebra_vxlan_local_mac_add_update(struct interface *ifp, struct interface *br_if, struct ethaddr *mac, vlanid_t vid, - u_char sticky) + uint8_t sticky) { return 0; } @@ -172,7 +172,7 @@ int zebra_vxlan_if_add(struct interface *ifp) return 0; } -int zebra_vxlan_if_update(struct interface *ifp, u_int16_t chgflags) +int zebra_vxlan_if_update(struct interface *ifp, uint16_t chgflags) { return 0; } @@ -182,20 +182,20 @@ int zebra_vxlan_if_del(struct interface *ifp) return 0; } -int zebra_vxlan_remote_vtep_add(struct zserv *client, int sock, u_short length, - struct zebra_vrf *zvrf) +int zebra_vxlan_remote_vtep_add(struct zserv *client, int sock, + unsigned short length, struct zebra_vrf *zvrf) { return 0; } -int zebra_vxlan_remote_vtep_del(struct zserv *client, int sock, u_short length, - struct zebra_vrf *zvrf) +int zebra_vxlan_remote_vtep_del(struct zserv *client, int sock, + unsigned short length, struct zebra_vrf *zvrf) { return 0; } int zebra_vxlan_advertise_all_vni(struct zserv *client, int sock, - u_short length, struct zebra_vrf *zvrf) + unsigned short length, struct zebra_vrf *zvrf) { return 0; } diff --git a/zebra/zebra_vxlan_private.h b/zebra/zebra_vxlan_private.h index 6174c6a56..b4a8b5d48 100644 --- a/zebra/zebra_vxlan_private.h +++ b/zebra/zebra_vxlan_private.h @@ -68,10 +68,10 @@ struct zebra_vni_t_ { vni_t vni; /* Flag for advertising gw macip */ - u_int8_t advertise_gw_macip; + uint8_t advertise_gw_macip; /* Flag for advertising gw macip */ - u_int8_t advertise_subnet; + uint8_t advertise_subnet; /* Corresponding VxLAN interface. */ struct interface *vxlan_if; @@ -231,7 +231,7 @@ struct zebra_mac_t_ { /* MAC address. */ struct ethaddr macaddr; - u_int32_t flags; + uint32_t flags; #define ZEBRA_MAC_LOCAL 0x01 #define ZEBRA_MAC_REMOTE 0x02 #define ZEBRA_MAC_AUTO 0x04 /* Auto created for neighbor. */ @@ -265,7 +265,7 @@ struct mac_walk_ctx { int uninstall; /* uninstall from kernel? */ int upd_client; /* uninstall from client? */ - u_int32_t flags; + uint32_t flags; #define DEL_LOCAL_MAC 0x1 #define DEL_REMOTE_MAC 0x2 #define DEL_ALL_MAC (DEL_LOCAL_MAC | DEL_REMOTE_MAC) @@ -275,7 +275,7 @@ struct mac_walk_ctx { struct in_addr r_vtep_ip; /* To walk MACs from specific VTEP */ struct vty *vty; /* Used by VTY handlers */ - u_int32_t count; /* Used by VTY handlers */ + uint32_t count; /* Used by VTY handlers */ struct json_object *json; /* Used for JSON Output */ }; @@ -315,7 +315,7 @@ struct zebra_neigh_t_ { /* Underlying interface. */ ifindex_t ifindex; - u_int32_t flags; + uint32_t flags; #define ZEBRA_NEIGH_LOCAL 0x01 #define ZEBRA_NEIGH_REMOTE 0x02 #define ZEBRA_NEIGH_REMOTE_NH 0x04 /* neigh entry for remote vtep */ @@ -339,7 +339,7 @@ struct neigh_walk_ctx { int uninstall; /* uninstall from kernel? */ int upd_client; /* uninstall from client? */ - u_int32_t flags; + uint32_t flags; #define DEL_LOCAL_NEIGH 0x1 #define DEL_REMOTE_NEIGH 0x2 #define DEL_ALL_NEIGH (DEL_LOCAL_NEIGH | DEL_REMOTE_NEIGH) @@ -349,8 +349,8 @@ struct neigh_walk_ctx { struct in_addr r_vtep_ip; /* To walk neighbors from specific VTEP */ struct vty *vty; /* Used by VTY handlers */ - u_int32_t count; /* Used by VTY handlers */ - u_char addr_width; /* Used by VTY handlers */ + uint32_t count; /* Used by VTY handlers */ + uint8_t addr_width; /* Used by VTY handlers */ struct json_object *json; /* Used for JSON Output */ }; diff --git a/zebra/zserv.c b/zebra/zserv.c index f11c0dd2f..538487a9c 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -631,7 +631,7 @@ static int zsend_ipv4_nexthop_lookup_mrib(struct zserv *client, { struct stream *s; unsigned long nump; - u_char num; + uint8_t num; struct nexthop *nexthop; /* Get output stream. */ @@ -828,7 +828,8 @@ static int zsend_assign_label_chunk_response(struct zserv *client, /* Send response to a label manager connect request to client */ static int zsend_label_manager_connect_response(struct zserv *client, - vrf_id_t vrf_id, u_short result) + vrf_id_t vrf_id, + unsigned short result) { int ret; struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); @@ -862,8 +863,8 @@ static void zread_rnh_register(ZAPI_HANDLER_ARGS) struct rnh *rnh; struct stream *s; struct prefix p; - u_short l = 0; - u_char flags = 0; + unsigned short l = 0; + uint8_t flags = 0; uint16_t type = cmd2type[hdr->command]; if (IS_ZEBRA_DEBUG_NHT) @@ -939,7 +940,7 @@ static void zread_rnh_unregister(ZAPI_HANDLER_ARGS) struct rnh *rnh; struct stream *s; struct prefix p; - u_short l = 0; + unsigned short l = 0; uint16_t type = cmd2type[hdr->command]; if (IS_ZEBRA_DEBUG_NHT) @@ -1000,7 +1001,7 @@ stream_failure: static void zread_fec_register(ZAPI_HANDLER_ARGS) { struct stream *s; - u_short l = 0; + unsigned short l = 0; struct prefix p; uint16_t flags; uint32_t label_index = MPLS_INVALID_LABEL_INDEX; @@ -1059,7 +1060,7 @@ stream_failure: static void zread_fec_unregister(ZAPI_HANDLER_ARGS) { struct stream *s; - u_short l = 0; + unsigned short l = 0; struct prefix p; uint16_t flags; @@ -1432,10 +1433,10 @@ static void zread_ipv4_add(ZAPI_HANDLER_ARGS) int i; struct route_entry *re; struct prefix p; - u_char message; + uint8_t message; struct in_addr nhop_addr; - u_char nexthop_num; - u_char nexthop_type; + uint8_t nexthop_num; + uint8_t nexthop_type; struct stream *s; ifindex_t ifindex; safi_t safi; @@ -1585,7 +1586,7 @@ static void zread_ipv4_delete(ZAPI_HANDLER_ARGS) struct stream *s; struct zapi_ipv4 api; struct prefix p; - u_int32_t table_id; + uint32_t table_id; s = msg; @@ -1638,9 +1639,9 @@ static void zread_ipv4_route_ipv6_nexthop_add(ZAPI_HANDLER_ARGS) struct stream *s; struct in6_addr nhop_addr; struct route_entry *re; - u_char message; - u_char nexthop_num; - u_char nexthop_type; + uint8_t message; + uint8_t nexthop_num; + uint8_t nexthop_type; struct prefix p; safi_t safi; static struct in6_addr nexthops[MULTIPATH_NUM]; @@ -1810,9 +1811,9 @@ static void zread_ipv6_add(ZAPI_HANDLER_ARGS) struct in6_addr nhop_addr; ifindex_t ifindex; struct route_entry *re; - u_char message; - u_char nexthop_num; - u_char nexthop_type; + uint8_t message; + uint8_t nexthop_num; + uint8_t nexthop_type; struct prefix p; struct prefix_ipv6 src_p, *src_pp; safi_t safi; @@ -2060,9 +2061,9 @@ static void zread_router_id_delete(ZAPI_HANDLER_ARGS) static void zread_hello(ZAPI_HANDLER_ARGS) { /* type of protocol (lib/zebra.h) */ - u_char proto; - u_short instance; - u_char notify; + uint8_t proto; + unsigned short instance; + uint8_t notify; STREAM_GETC(msg, proto); STREAM_GETW(msg, instance); @@ -2110,7 +2111,7 @@ static void zread_mpls_labels(ZAPI_HANDLER_ARGS) union g_addr gate; ifindex_t ifindex; mpls_label_t in_label, out_label; - u_int8_t distance; + uint8_t distance; /* Get input stream. */ s = msg; @@ -2190,8 +2191,8 @@ static void zread_label_manager_connect(struct zserv *client, { struct stream *s; /* type of protocol (lib/zebra.h) */ - u_char proto; - u_short instance; + uint8_t proto; + unsigned short instance; /* Get input stream. */ s = msg; @@ -2232,7 +2233,7 @@ static void zread_get_label_chunk(struct zserv *client, struct stream *msg, vrf_id_t vrf_id) { struct stream *s; - u_char keep; + uint8_t keep; uint32_t size; struct label_manager_chunk *lmc; @@ -3319,7 +3320,7 @@ static void zebra_show_client_brief(struct vty *vty, struct zserv *client) client->v6_route_del_cnt); } -struct zserv *zebra_find_client(u_char proto, u_short instance) +struct zserv *zebra_find_client(uint8_t proto, unsigned short instance) { struct listnode *node, *nnode; struct zserv *client; diff --git a/zebra/zserv.h b/zebra/zserv.h index 62707510c..947e11e35 100644 --- a/zebra/zserv.h +++ b/zebra/zserv.h @@ -83,44 +83,44 @@ struct zserv { bool notify_owner; /* client's protocol */ - u_char proto; - u_short instance; - u_char is_synchronous; + uint8_t proto; + unsigned short instance; + uint8_t is_synchronous; /* Statistics */ - u_int32_t redist_v4_add_cnt; - u_int32_t redist_v4_del_cnt; - u_int32_t redist_v6_add_cnt; - u_int32_t redist_v6_del_cnt; - u_int32_t v4_route_add_cnt; - u_int32_t v4_route_upd8_cnt; - u_int32_t v4_route_del_cnt; - u_int32_t v6_route_add_cnt; - u_int32_t v6_route_del_cnt; - u_int32_t v6_route_upd8_cnt; - u_int32_t connected_rt_add_cnt; - u_int32_t connected_rt_del_cnt; - u_int32_t ifup_cnt; - u_int32_t ifdown_cnt; - u_int32_t ifadd_cnt; - u_int32_t ifdel_cnt; - u_int32_t if_bfd_cnt; - u_int32_t bfd_peer_add_cnt; - u_int32_t bfd_peer_upd8_cnt; - u_int32_t bfd_peer_del_cnt; - u_int32_t bfd_peer_replay_cnt; - u_int32_t vrfadd_cnt; - u_int32_t vrfdel_cnt; - u_int32_t if_vrfchg_cnt; - u_int32_t bfd_client_reg_cnt; - u_int32_t vniadd_cnt; - u_int32_t vnidel_cnt; - u_int32_t l3vniadd_cnt; - u_int32_t l3vnidel_cnt; - u_int32_t macipadd_cnt; - u_int32_t macipdel_cnt; - u_int32_t prefixadd_cnt; - u_int32_t prefixdel_cnt; + uint32_t redist_v4_add_cnt; + uint32_t redist_v4_del_cnt; + uint32_t redist_v6_add_cnt; + uint32_t redist_v6_del_cnt; + uint32_t v4_route_add_cnt; + uint32_t v4_route_upd8_cnt; + uint32_t v4_route_del_cnt; + uint32_t v6_route_add_cnt; + uint32_t v6_route_del_cnt; + uint32_t v6_route_upd8_cnt; + uint32_t connected_rt_add_cnt; + uint32_t connected_rt_del_cnt; + uint32_t ifup_cnt; + uint32_t ifdown_cnt; + uint32_t ifadd_cnt; + uint32_t ifdel_cnt; + uint32_t if_bfd_cnt; + uint32_t bfd_peer_add_cnt; + uint32_t bfd_peer_upd8_cnt; + uint32_t bfd_peer_del_cnt; + uint32_t bfd_peer_replay_cnt; + uint32_t vrfadd_cnt; + uint32_t vrfdel_cnt; + uint32_t if_vrfchg_cnt; + uint32_t bfd_client_reg_cnt; + uint32_t vniadd_cnt; + uint32_t vnidel_cnt; + uint32_t l3vniadd_cnt; + uint32_t l3vnidel_cnt; + uint32_t macipadd_cnt; + uint32_t macipdel_cnt; + uint32_t prefixadd_cnt; + uint32_t prefixdel_cnt; time_t connect_time; time_t last_read_time; @@ -144,7 +144,7 @@ struct zebra_t { struct list *client_list; /* default table */ - u_int32_t rtm_table_default; + uint32_t rtm_table_default; /* rib work queue */ #define ZEBRA_RIB_PROCESS_HOLD_TIME 10 @@ -155,7 +155,7 @@ struct zebra_t { struct work_queue *lsp_process_q; #define ZEBRA_ZAPI_PACKETS_TO_PROCESS 10 - u_int32_t packets_to_process; + uint32_t packets_to_process; }; extern struct zebra_t zebrad; extern unsigned int multipath_num; @@ -195,7 +195,7 @@ extern void zserv_nexthop_num_warn(const char *, const struct prefix *, const unsigned int); extern int zebra_server_send_message(struct zserv *client, struct stream *msg); -extern struct zserv *zebra_find_client(u_char proto, u_short instance); +extern struct zserv *zebra_find_client(uint8_t proto, unsigned short instance); #if defined(HANDLE_ZAPI_FUZZING) extern void zserv_read_file(char *input); |