Merge pull request #1854 from qlyoung/integer-standards-compliance

*: use C99 standard fixed-width integer types
This commit is contained in:
Lou Berger 2018-03-28 10:30:54 -04:00 committed by GitHub
commit 615e608d76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
364 changed files with 4758 additions and 4624 deletions

View File

@ -210,7 +210,7 @@ if_eui64(int ifindex, unsigned char *eui)
return -1; 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; char *tmp = (void*) ifp->hw_addr;
if (len == 8) { if (len == 8) {

View File

@ -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, 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 bgp_adj_out *adj;
struct peer_af *paf; 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, 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; 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, 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;
struct bgp_adj_in *adj_next; struct bgp_adj_in *adj_next;

View File

@ -29,7 +29,7 @@ struct update_subgroup;
struct bgp_advertise_fifo { struct bgp_advertise_fifo {
struct bgp_advertise *next; struct bgp_advertise *next;
struct bgp_advertise *prev; struct bgp_advertise *prev;
u_int32_t count; uint32_t count;
}; };
/* BGP advertise attribute. */ /* BGP advertise attribute. */
@ -80,7 +80,7 @@ struct bgp_adj_out {
/* Prefix information. */ /* Prefix information. */
struct bgp_node *rn; struct bgp_node *rn;
u_int32_t addpath_tx_id; uint32_t addpath_tx_id;
/* Advertised attribute. */ /* Advertised attribute. */
struct attr *attr; struct attr *attr;
@ -102,7 +102,7 @@ struct bgp_adj_in {
struct attr *attr; struct attr *attr;
/* Addpath identifier */ /* Addpath identifier */
u_int32_t addpath_rx_id; uint32_t addpath_rx_id;
}; };
/* BGP advertisement list. */ /* BGP advertisement list. */
@ -168,10 +168,10 @@ struct bgp_synchronize {
: (F)->next) : (F)->next)
/* Prototypes. */ /* 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 *, extern void bgp_adj_in_set(struct bgp_node *, struct peer *, struct attr *,
u_int32_t); uint32_t);
extern int bgp_adj_in_unset(struct bgp_node *, struct peer *, u_int32_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_adj_in_remove(struct bgp_node *, struct bgp_adj_in *);
extern void bgp_sync_init(struct peer *); extern void bgp_sync_init(struct peer *);

View File

@ -80,8 +80,8 @@
* NOT the internal representation! * NOT the internal representation!
*/ */
struct assegment_header { struct assegment_header {
u_char type; uint8_t type;
u_char length; uint8_t length;
}; };
/* Hash for aspath. This is the top level structure of AS path. */ /* 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 * the caller should immediately assign data to the segment, as the segment
* otherwise is not generally valid * 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; struct assegment *new;
@ -345,7 +345,7 @@ void aspath_unintern(struct aspath **aspath)
/* Return the start or end delimiters for a particular Segment type */ /* Return the start or end delimiters for a particular Segment type */
#define AS_SEG_START 0 #define AS_SEG_START 0
#define AS_SEG_END 1 #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; int i;
struct { 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; size_t lenp;
assert(length <= AS_SEGMENT_MAX); 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 * We have no way to manage the storage, so we use a static stream
* wrapper around aspath_put. * 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 #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. */ /* Add specified AS to the leftmost of aspath. */
static struct aspath *aspath_add_asns(struct aspath *aspath, as_t asno, 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; struct assegment *assegment = aspath->segments;
unsigned i; unsigned i;
@ -1872,7 +1872,7 @@ enum as_token {
/* Return next token and point for string parse. */ /* Return next token and point for string parse. */
static const char *aspath_gettoken(const char *buf, enum as_token *token, static const char *aspath_gettoken(const char *buf, enum as_token *token,
u_long *asno) unsigned long *asno)
{ {
const char *p = buf; 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) struct aspath *aspath_str2aspath(const char *str)
{ {
enum as_token token = as_token_unknown; enum as_token token = as_token_unknown;
u_short as_type; unsigned short as_type;
u_long asno = 0; unsigned long asno = 0;
struct aspath *aspath; struct aspath *aspath;
int needtype; int needtype;

View File

@ -51,8 +51,8 @@
struct assegment { struct assegment {
struct assegment *next; struct assegment *next;
as_t *as; as_t *as;
u_short length; unsigned short length;
u_char type; uint8_t type;
}; };
/* AS path may be include some AsSegments. */ /* 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 *); extern unsigned int aspath_has_as4(struct aspath *);
/* For SNMP BGP4PATHATTRASPATHSEGMENT, might be useful for debug */ /* 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 */ #endif /* _QUAGGA_BGP_ASPATH_H */

View File

@ -693,7 +693,7 @@ struct attr *bgp_attr_intern(struct attr *attr)
} }
/* Make network statement's attribute. */ /* 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)); 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 */ /* 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 aspath *aspath,
struct community *community, int as_set, struct community *community, int as_set,
u_char atomic_aggregate) uint8_t atomic_aggregate)
{ {
struct attr attr; struct attr attr;
struct attr *new; 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); attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP);
if (community) { if (community) {
u_int32_t gshut = COMMUNITY_GSHUT; uint32_t gshut = COMMUNITY_GSHUT;
/* If we are not shutting down ourselves and we are /* If we are not shutting down ourselves and we are
* aggregating a route that contains the GSHUT community we * 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. * introduced by the sending neighbour.
*/ */
static bgp_attr_parse_ret_t 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) bgp_size_t length)
{ {
struct peer *const peer = args->peer; 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 /* startp and length must be special-cased, as whether or not to
* send the attribute data with the NOTIFY depends on the error, * send the attribute data with the NOTIFY depends on the error,
* the caller therefore signals this with the seperate length argument * 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 */ /* Only relax error handling for eBGP peers */
if (peer->sort != BGP_PEER_EBGP) { 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. */ non-transitive" attribute. */
static void static void
bgp_attr_flags_diagnose(struct bgp_attr_parser_args *args, 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; uint8_t seen = 0, i;
u_char real_flags = args->flags; uint8_t real_flags = args->flags;
const u_int8_t attr_code = args->type; const uint8_t attr_code = args->type;
desired_flags &= ~BGP_ATTR_FLAG_EXTLEN; desired_flags &= ~BGP_ATTR_FLAG_EXTLEN;
real_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, /* Required flags for attributes. EXTLEN will be masked off when testing,
* as will PARTIAL for optional+transitive attributes. * as will PARTIAL for optional+transitive attributes.
*/ */
const u_int8_t attr_flags_values[] = { const uint8_t attr_flags_values[] = {
[BGP_ATTR_ORIGIN] = BGP_ATTR_FLAG_TRANS, [BGP_ATTR_ORIGIN] = BGP_ATTR_FLAG_TRANS,
[BGP_ATTR_AS_PATH] = BGP_ATTR_FLAG_TRANS, [BGP_ATTR_AS_PATH] = BGP_ATTR_FLAG_TRANS,
[BGP_ATTR_NEXT_HOP] = BGP_ATTR_FLAG_TRANS, [BGP_ATTR_NEXT_HOP] = BGP_ATTR_FLAG_TRANS,
[BGP_ATTR_MULTI_EXIT_DISC] = BGP_ATTR_FLAG_OPTIONAL, [BGP_ATTR_MULTI_EXIT_DISC] = BGP_ATTR_FLAG_OPTIONAL,
[BGP_ATTR_LOCAL_PREF] = BGP_ATTR_FLAG_TRANS, [BGP_ATTR_LOCAL_PREF] = BGP_ATTR_FLAG_TRANS,
[BGP_ATTR_ATOMIC_AGGREGATE] = BGP_ATTR_FLAG_TRANS, [BGP_ATTR_ATOMIC_AGGREGATE] = BGP_ATTR_FLAG_TRANS,
[BGP_ATTR_AGGREGATOR] = [BGP_ATTR_AGGREGATOR] = BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL,
BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, [BGP_ATTR_COMMUNITIES] = 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_ORIGINATOR_ID] = BGP_ATTR_FLAG_OPTIONAL,
[BGP_ATTR_CLUSTER_LIST] = BGP_ATTR_FLAG_OPTIONAL, [BGP_ATTR_CLUSTER_LIST] = BGP_ATTR_FLAG_OPTIONAL,
[BGP_ATTR_MP_REACH_NLRI] = BGP_ATTR_FLAG_OPTIONAL, [BGP_ATTR_MP_REACH_NLRI] = BGP_ATTR_FLAG_OPTIONAL,
[BGP_ATTR_MP_UNREACH_NLRI] = BGP_ATTR_FLAG_OPTIONAL, [BGP_ATTR_MP_UNREACH_NLRI] = BGP_ATTR_FLAG_OPTIONAL,
[BGP_ATTR_EXT_COMMUNITIES] = [BGP_ATTR_EXT_COMMUNITIES] =
BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
[BGP_ATTR_AS4_PATH] = [BGP_ATTR_AS4_PATH] = BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
[BGP_ATTR_AS4_AGGREGATOR] = [BGP_ATTR_AS4_AGGREGATOR] =
BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
[BGP_ATTR_PMSI_TUNNEL] = [BGP_ATTR_PMSI_TUNNEL] = BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
[BGP_ATTR_LARGE_COMMUNITIES] = [BGP_ATTR_LARGE_COMMUNITIES] =
BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
[BGP_ATTR_PREFIX_SID] = [BGP_ATTR_PREFIX_SID] = BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
}; };
static const size_t attr_flags_values_max = array_size(attr_flags_values) - 1; 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) static int bgp_attr_flag_invalid(struct bgp_attr_parser_args *args)
{ {
u_int8_t mask = BGP_ATTR_FLAG_EXTLEN; uint8_t mask = BGP_ATTR_FLAG_EXTLEN;
const u_int8_t flags = args->flags; const uint8_t flags = args->flags;
const u_int8_t attr_code = args->type; const uint8_t attr_code = args->type;
/* there may be attributes we don't know about */ /* there may be attributes we don't know about */
if (attr_code > attr_flags_values_max) if (attr_code > attr_flags_values_max)
@ -1531,7 +1526,7 @@ bgp_attr_community(struct bgp_attr_parser_args *args)
} }
attr->community = 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 */ /* XXX: fix community_parse to use stream API and remove this */
stream_forward_getp(peer->curr, length); 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))) if ((val = stream_getc(s)))
zlog_warn( zlog_warn(
"%s sent non-zero value, %u, for defunct SNPA-length field", "%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; afi_t afi;
iana_safi_t pkt_safi; iana_safi_t pkt_safi;
safi_t safi; safi_t safi;
u_int16_t withdraw_len; uint16_t withdraw_len;
struct peer *const peer = args->peer; struct peer *const peer = args->peer;
struct attr *const attr = args->attr; struct attr *const attr = args->attr;
const bgp_size_t length = args->length; const bgp_size_t length = args->length;
@ -1827,7 +1822,7 @@ bgp_attr_large_community(struct bgp_attr_parser_args *args)
} }
attr->lcommunity = 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 */ /* XXX: fix ecommunity_parse to use stream API */
stream_forward_getp(peer->curr, length); 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 peer *const peer = args->peer;
struct attr *const attr = args->attr; struct attr *const attr = args->attr;
const bgp_size_t length = args->length; const bgp_size_t length = args->length;
u_char sticky = 0; uint8_t sticky = 0;
if (length == 0) { if (length == 0) {
attr->ecommunity = NULL; attr->ecommunity = NULL;
@ -1856,7 +1851,7 @@ bgp_attr_ext_communities(struct bgp_attr_parser_args *args)
} }
attr->ecommunity = 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 */ /* XXX: fix ecommunity_parse to use stream API */
stream_forward_getp(peer->curr, length); 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 */ static int bgp_attr_encap(uint8_t type, struct peer *peer, /* IN */
bgp_size_t length, /* IN: attr's length field */ bgp_size_t length, /* IN: attr's length field */
struct attr *attr, /* IN: caller already allocated */ struct attr *attr, /* IN: caller already allocated */
u_char flag, /* IN: attr's flags field */ uint8_t flag, /* IN: attr's flags field */
u_char *startp) uint8_t *startp)
{ {
bgp_size_t total; bgp_size_t total;
uint16_t tunneltype = 0; uint16_t tunneltype = 0;
@ -2017,10 +2012,10 @@ bgp_attr_prefix_sid(struct bgp_attr_parser_args *args,
struct attr *const attr = args->attr; struct attr *const attr = args->attr;
int type; int type;
int length; int length;
u_int32_t label_index; uint32_t label_index;
struct in6_addr ipv6_sid; struct in6_addr ipv6_sid;
u_int32_t srgb_base; uint32_t srgb_base;
u_int32_t srgb_range; uint32_t srgb_range;
int srgb_count; int srgb_count;
attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID); 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 peer *const peer = args->peer;
struct attr *const attr = args->attr; struct attr *const attr = args->attr;
const bgp_size_t length = args->length; 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 /* Verify that the receiver is expecting "ingress replication" as we
* can only support that. * 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 transit *transit;
struct peer *const peer = args->peer; struct peer *const peer = args->peer;
struct attr *const attr = args->attr; struct attr *const attr = args->attr;
u_char *const startp = args->startp; uint8_t *const startp = args->startp;
const u_char type = args->type; const uint8_t type = args->type;
const u_char flag = args->flags; const uint8_t flag = args->flags;
const bgp_size_t length = args->length; const bgp_size_t length = args->length;
if (bgp_debug_update(peer, NULL, NULL, 1)) 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. */ /* Well-known attribute check. */
static int bgp_attr_check(struct peer *peer, struct attr *attr) 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 /* BGP Graceful-Restart End-of-RIB for IPv4 unicast is signaled as an
* empty UPDATE. */ * 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) struct bgp_nlri *mp_withdraw)
{ {
int ret; int ret;
u_char flag = 0; uint8_t flag = 0;
u_char type = 0; uint8_t type = 0;
bgp_size_t length; bgp_size_t length;
u_char *startp, *endp; uint8_t *startp, *endp;
u_char *attr_endp; uint8_t *attr_endp;
u_char seen[BGP_ATTR_BITMAP_SIZE]; uint8_t seen[BGP_ATTR_BITMAP_SIZE];
/* we need the as4_path only until we have synthesized the as_path with /* we need the as4_path only until we have synthesized the as_path with
* it */ * it */
/* same goes for as4_aggregator */ /* 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, void bgp_packet_mpattr_prefix(struct stream *s, afi_t afi, safi_t safi,
struct prefix *p, struct prefix_rd *prd, struct prefix *p, struct prefix_rd *prd,
mpls_label_t *label, u_int32_t num_labels, mpls_label_t *label, uint32_t num_labels,
int addpath_encode, u_int32_t addpath_tx_id, int addpath_encode, uint32_t addpath_tx_id,
struct attr *attr) struct attr *attr)
{ {
if (safi == SAFI_MPLS_VPN) { 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 bpacket_attr_vec_arr *vecarr,
struct prefix *p, afi_t afi, safi_t safi, struct prefix *p, afi_t afi, safi_t safi,
struct peer *from, struct prefix_rd *prd, struct peer *from, struct prefix_rd *prd,
mpls_label_t *label, u_int32_t num_labels, mpls_label_t *label, uint32_t num_labels,
int addpath_encode, u_int32_t addpath_tx_id) int addpath_encode, uint32_t addpath_tx_id)
{ {
size_t cp; size_t cp;
size_t aspath_sizep; size_t aspath_sizep;
@ -3072,7 +3067,7 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer,
*/ */
send_as4_aggregator = 1; send_as4_aggregator = 1;
} else } 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); 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, stream_put(s, attr->ecommunity->val,
attr->ecommunity->size * 8); attr->ecommunity->size * 8);
} else { } else {
u_int8_t *pnt; uint8_t *pnt;
int tbit; int tbit;
int ecom_tr_size = 0; int ecom_tr_size = 0;
int i; int i;
@ -3233,7 +3228,7 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer,
/* Label index attribute. */ /* Label index attribute. */
if (safi == SAFI_LABELED_UNICAST) { if (safi == SAFI_LABELED_UNICAST) {
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID)) { if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID)) {
u_int32_t label_index; uint32_t label_index;
label_index = attr->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, void bgp_packet_mpunreach_prefix(struct stream *s, struct prefix *p, afi_t afi,
safi_t safi, struct prefix_rd *prd, safi_t safi, struct prefix_rd *prd,
mpls_label_t *label, u_int32_t num_labels, mpls_label_t *label, uint32_t num_labels,
int addpath_encode, u_int32_t addpath_tx_id, int addpath_encode, uint32_t addpath_tx_id,
struct attr *attr) struct attr *attr)
{ {
u_char wlabel[3] = {0x80, 0x00, 0x00}; uint8_t wlabel[3] = {0x80, 0x00, 0x00};
if (safi == SAFI_LABELED_UNICAST) { if (safi == SAFI_LABELED_UNICAST) {
label = (mpls_label_t *)wlabel; label = (mpls_label_t *)wlabel;
@ -3404,7 +3399,7 @@ void bgp_dump_routes_attr(struct stream *s, struct attr *attr,
size_t aspath_lenp; size_t aspath_lenp;
struct aspath *aspath; struct aspath *aspath;
int addpath_encode = 0; int addpath_encode = 0;
u_int32_t addpath_tx_id = 0; uint32_t addpath_tx_id = 0;
/* Remember current pointer. */ /* Remember current pointer. */
cp = stream_get_endp(s); cp = stream_get_endp(s);

View File

@ -126,19 +126,19 @@ struct attr {
/* Apart from in6_addr, the remaining static attributes */ /* Apart from in6_addr, the remaining static attributes */
struct in_addr nexthop; struct in_addr nexthop;
u_int32_t med; uint32_t med;
u_int32_t local_pref; uint32_t local_pref;
ifindex_t nh_ifindex; ifindex_t nh_ifindex;
/* Path origin attribute */ /* Path origin attribute */
u_char origin; uint8_t origin;
/* PMSI tunnel type (RFC 6514). */ /* PMSI tunnel type (RFC 6514). */
enum pta_type pmsi_tnl_type; enum pta_type pmsi_tnl_type;
/* has the route-map changed any attribute? /* has the route-map changed any attribute?
Used on the peer outbound side. */ Used on the peer outbound side. */
u_int32_t rmap_change_flags; uint32_t rmap_change_flags;
/* Multi-Protocol Nexthop, AFI IPv6 */ /* Multi-Protocol Nexthop, AFI IPv6 */
struct in6_addr mp_nexthop_global; struct in6_addr mp_nexthop_global;
@ -165,28 +165,28 @@ struct attr {
struct in_addr originator_id; struct in_addr originator_id;
/* Local weight, not actually an attribute */ /* Local weight, not actually an attribute */
u_int32_t weight; uint32_t weight;
/* Aggregator ASN */ /* Aggregator ASN */
as_t aggregator_as; as_t aggregator_as;
/* MP Nexthop length */ /* MP Nexthop length */
u_char mp_nexthop_len; uint8_t mp_nexthop_len;
/* MP Nexthop preference */ /* MP Nexthop preference */
u_char mp_nexthop_prefer_global; uint8_t mp_nexthop_prefer_global;
/* Static MAC for EVPN */ /* Static MAC for EVPN */
u_char sticky; uint8_t sticky;
/* Flag for default gateway extended community in EVPN */ /* Flag for default gateway extended community in EVPN */
u_char default_gw; uint8_t default_gw;
/* route tag */ /* route tag */
route_tag_t tag; route_tag_t tag;
/* Label index */ /* Label index */
u_int32_t label_index; uint32_t label_index;
/* MPLS label */ /* MPLS label */
mpls_label_t label; mpls_label_t label;
@ -201,7 +201,7 @@ struct attr {
struct overlay_index evpn_overlay; struct overlay_index evpn_overlay;
/* EVPN MAC Mobility sequence number, if any. */ /* EVPN MAC Mobility sequence number, if any. */
u_int32_t mm_seqnum; uint32_t mm_seqnum;
/* EVPN local router-mac */ /* EVPN local router-mac */
struct ethaddr rmac; struct ethaddr rmac;
@ -227,7 +227,7 @@ struct cluster_list {
struct transit { struct transit {
unsigned long refcnt; unsigned long refcnt;
int length; int length;
u_char *val; uint8_t *val;
}; };
/* "(void) 0" will generate a compiler error. this is a safety check to /* "(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_sub(struct attr *);
extern void bgp_attr_unintern(struct attr **); extern void bgp_attr_unintern(struct attr **);
extern void bgp_attr_flush(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_default_set(struct attr *attr, uint8_t);
extern struct attr *bgp_attr_aggregate_intern(struct bgp *, u_char, extern struct attr *bgp_attr_aggregate_intern(struct bgp *, uint8_t,
struct aspath *, struct aspath *,
struct community *, int as_set, struct community *, int as_set,
u_char); uint8_t);
extern bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *, extern bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *,
struct stream *, struct attr *, struct stream *, struct attr *,
struct bpacket_attr_vec_arr *vecarr, struct bpacket_attr_vec_arr *vecarr,
struct prefix *, afi_t, safi_t, struct prefix *, afi_t, safi_t,
struct peer *, struct prefix_rd *, struct peer *, struct prefix_rd *,
mpls_label_t *, u_int32_t, int, mpls_label_t *, uint32_t, int, uint32_t);
u_int32_t);
extern void bgp_dump_routes_attr(struct stream *, struct attr *, extern void bgp_dump_routes_attr(struct stream *, struct attr *,
struct prefix *); struct prefix *);
extern int attrhash_cmp(const void *, const void *); 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 length; /* attribute data length; */
bgp_size_t total; /* total length, inc header */ bgp_size_t total; /* total length, inc header */
struct attr *attr; struct attr *attr;
u_int8_t type; uint8_t type;
u_int8_t flags; uint8_t flags;
u_char *startp; uint8_t *startp;
}; };
extern int bgp_mp_reach_parse(struct bgp_attr_parser_args *args, extern int bgp_mp_reach_parse(struct bgp_attr_parser_args *args,
struct bgp_nlri *); struct bgp_nlri *);
@ -324,9 +323,9 @@ extern size_t bgp_packet_mpattr_start(struct stream *s, struct peer *peer,
struct attr *attr); struct attr *attr);
extern void bgp_packet_mpattr_prefix(struct stream *s, afi_t afi, safi_t safi, extern void bgp_packet_mpattr_prefix(struct stream *s, afi_t afi, safi_t safi,
struct prefix *p, struct prefix_rd *prd, struct prefix *p, struct prefix_rd *prd,
mpls_label_t *label, u_int32_t num_labels, mpls_label_t *label, uint32_t num_labels,
int addpath_encode, int addpath_encode, uint32_t addpath_tx_id,
u_int32_t addpath_tx_id, struct attr *); struct attr *);
extern size_t bgp_packet_mpattr_prefix_size(afi_t afi, safi_t safi, extern size_t bgp_packet_mpattr_prefix_size(afi_t afi, safi_t safi,
struct prefix *p); struct prefix *p);
extern void bgp_packet_mpattr_end(struct stream *s, size_t sizep); 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, extern void bgp_packet_mpunreach_prefix(struct stream *s, struct prefix *p,
afi_t afi, safi_t safi, afi_t afi, safi_t safi,
struct prefix_rd *prd, mpls_label_t *, struct prefix_rd *prd, mpls_label_t *,
u_int32_t, int, u_int32_t, uint32_t, int, uint32_t, struct attr *);
struct attr *);
extern void bgp_packet_mpunreach_end(struct stream *s, size_t attrlen_pnt); 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, static inline int bgp_rmap_nhop_changed(uint32_t out_rmap_flags,
u_int32_t in_rmap_flags) uint32_t in_rmap_flags)
{ {
return ((CHECK_FLAG(out_rmap_flags, BATTR_RMAP_NEXTHOP_PEER_ADDRESS) return ((CHECK_FLAG(out_rmap_flags, BATTR_RMAP_NEXTHOP_PEER_ADDRESS)
|| CHECK_FLAG(out_rmap_flags, BATTR_RMAP_NEXTHOP_UNCHANGED) || 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); : 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; return (attr) ? attr->mm_seqnum : 0;
} }

View File

@ -78,7 +78,7 @@ int str2esi(const char *str, struct eth_segment_id *id)
char *esi2str(struct eth_segment_id *id) char *esi2str(struct eth_segment_id *id)
{ {
char *ptr; char *ptr;
u_char *val; uint8_t *val;
if (!id) if (!id)
return NULL; 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 */ /* If there is a router mac extended community, set RMAC in attr */
for (i = 0; i < ecom->size; i++) { for (i = 0; i < ecom->size; i++) {
u_char *pnt = NULL; uint8_t *pnt = NULL;
u_char type = 0; uint8_t type = 0;
u_char sub_type = 0; uint8_t sub_type = 0;
pnt = (ecom->val + (i * ECOMMUNITY_SIZE)); pnt = (ecom->val + (i * ECOMMUNITY_SIZE));
type = *pnt++; 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 /* If there is a default gw extendd community return true otherwise
* return 0 */ * return 0 */
for (i = 0; i < ecom->size; i++) { for (i = 0; i < ecom->size; i++) {
u_char *pnt; uint8_t *pnt;
u_char type, sub_type; uint8_t type, sub_type;
pnt = (ecom->val + (i * ECOMMUNITY_SIZE)); pnt = (ecom->val + (i * ECOMMUNITY_SIZE));
type = *pnt++; 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 * Fetch and return the sequence number from MAC Mobility extended
* community, if present, else 0. * 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; struct ecommunity *ecom;
int i; int i;
u_char flags = 0; uint8_t flags = 0;
ecom = attr->ecommunity; ecom = attr->ecommunity;
if (!ecom || !ecom->size) if (!ecom || !ecom->size)
@ -184,9 +184,9 @@ u_int32_t bgp_attr_mac_mobility_seqnum(struct attr *attr, u_char *sticky)
* one. * one.
*/ */
for (i = 0; i < ecom->size; i++) { for (i = 0; i < ecom->size; i++) {
u_char *pnt; uint8_t *pnt;
u_char type, sub_type; uint8_t type, sub_type;
u_int32_t seq_num; uint32_t seq_num;
pnt = (ecom->val + (i * ECOMMUNITY_SIZE)); pnt = (ecom->val + (i * ECOMMUNITY_SIZE));
type = *pnt++; 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); SET_IPADDR_V4(&p_evpn_p->ip);
memcpy(&p_evpn_p->ip.ipaddr_v4, &src->u.prefix4, memcpy(&p_evpn_p->ip.ipaddr_v4, &src->u.prefix4,
sizeof(struct in_addr)); 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 { } else {
SET_IPADDR_V6(&p_evpn_p->ip); SET_IPADDR_V6(&p_evpn_p->ip);
memcpy(&p_evpn_p->ip.ipaddr_v6, &src->u.prefix6, memcpy(&p_evpn_p->ip.ipaddr_v6, &src->u.prefix6,
sizeof(struct in6_addr)); 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 } else
return -1; return -1;

View File

@ -34,11 +34,11 @@
#define MAX_ET 0xffffffff #define MAX_ET 0xffffffff
u_long eth_tag_id; unsigned long eth_tag_id;
struct attr; struct attr;
struct eth_segment_id { struct eth_segment_id {
u_char val[ESI_LEN]; uint8_t val[ESI_LEN];
}; };
union gw_addr { 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, extern int bgp_build_evpn_prefix(int type, uint32_t eth_tag,
struct prefix *dst); struct prefix *dst);
extern void bgp_attr_rmac(struct attr *attr, struct ethaddr *rmac); extern void bgp_attr_rmac(struct attr *attr, struct ethaddr *rmac);
extern u_int32_t bgp_attr_mac_mobility_seqnum(struct attr *attr, extern uint32_t bgp_attr_mac_mobility_seqnum(struct attr *attr,
u_char *sticky); uint8_t *sticky);
extern uint8_t bgp_attr_default_gw(struct attr *attr); extern uint8_t bgp_attr_default_gw(struct attr *attr);
#endif /* _QUAGGA_BGP_ATTR_EVPN_H */ #endif /* _QUAGGA_BGP_ATTR_EVPN_H */

View File

@ -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. * 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, static int bgp_bfd_peer_param_set(struct peer *peer, uint32_t min_rx,
u_int32_t min_tx, u_int8_t detect_mult, uint32_t min_tx, uint8_t detect_mult,
int defaults) int defaults)
{ {
struct peer_group *group; 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. * 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) json_object *json_neigh)
{ {
bfd_show_info(vty, (struct bfd_info *)peer->bfd_info, 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_2 = 4;
int idx_number_3 = 5; int idx_number_3 = 5;
struct peer *peer; struct peer *peer;
u_int32_t rx_val; uint32_t rx_val;
u_int32_t tx_val; uint32_t tx_val;
u_int8_t dm_val; uint8_t dm_val;
int ret; int ret;
peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg); peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg);

View File

@ -35,7 +35,7 @@ extern void bgp_bfd_peer_config_write(struct vty *vty, struct peer *peer,
char *addr); char *addr);
extern void bgp_bfd_show_info(struct vty *vty, struct peer *peer, 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); extern int bgp_bfd_is_peer_multihop(struct peer *peer);

View File

@ -68,12 +68,12 @@ enum MRT_MSG_TYPES {
MSG_TABLE_DUMP /* routing table dump */ 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; unsigned int flag;
u_int type; unsigned int type;
u_int16_t length; uint16_t length;
u_int16_t lim; uint16_t lim;
lim = s->getp + len; lim = s->getp + len;
@ -94,7 +94,7 @@ static int attr_parse(struct stream *s, u_int16_t len)
switch (type) { switch (type) {
case BGP_ATTR_ORIGIN: { case BGP_ATTR_ORIGIN: {
u_char origin; uint8_t origin;
origin = stream_getc(s); origin = stream_getc(s);
printf("ORIGIN: %d\n", origin); printf("ORIGIN: %d\n", origin);
} break; } break;
@ -134,7 +134,7 @@ int main(int argc, char **argv)
int family; int family;
struct in_addr sip; struct in_addr sip;
struct in_addr dip; struct in_addr dip;
u_int16_t viewno, seq_num; uint16_t viewno, seq_num;
struct prefix_ipv4 p; struct prefix_ipv4 p;
s = stream_new(10000); s = stream_new(10000);
@ -230,10 +230,10 @@ int main(int argc, char **argv)
/* printf ("now read %d\n", len); */ /* printf ("now read %d\n", len); */
if (type == MSG_TABLE_DUMP) { if (type == MSG_TABLE_DUMP) {
u_char status; uint8_t status;
time_t originated; time_t originated;
struct in_addr peer; struct in_addr peer;
u_int16_t attrlen; uint16_t attrlen;
viewno = stream_getw(s); viewno = stream_getw(s);
seq_num = stream_getw(s); seq_num = stream_getw(s);

View File

@ -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) static char *community_str_get(struct community *com, int i)
{ {
int len; int len;
u_int32_t comval; uint32_t comval;
u_int16_t as; uint16_t as;
u_int16_t val; uint16_t val;
char *str; char *str;
char *pnt; char *pnt;
memcpy(&comval, com_nthval(com, i), sizeof(u_int32_t)); memcpy(&comval, com_nthval(com, i), sizeof(uint32_t));
comval = ntohl(comval); comval = ntohl(comval);
switch (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) static char *lcommunity_str_get(struct lcommunity *lcom, int i)
{ {
struct lcommunity_val lcomval; struct lcommunity_val lcomval;
u_int32_t globaladmin; uint32_t globaladmin;
u_int32_t localdata1; uint32_t localdata1;
u_int32_t localdata2; uint32_t localdata2;
char *str; char *str;
u_char *ptr; uint8_t *ptr;
char *pnt; char *pnt;
ptr = lcom->val + (i * LCOMMUNITY_SIZE); 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 */ /* Allocate memory. 48 bytes taken off bgp_lcommunity.c */
str = pnt = XMALLOC(MTYPE_LCOMMUNITY_STR, 48); 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, &globaladmin);
ptr = ptr_get_be32(ptr, &localdata1); ptr = ptr_get_be32(ptr, &localdata1);
ptr = ptr_get_be32(ptr, &localdata2); ptr = ptr_get_be32(ptr, &localdata2);
@ -549,7 +549,7 @@ static struct community *
community_regexp_delete (struct community *com, regex_t * reg) community_regexp_delete (struct community *com, regex_t * reg)
{ {
int i; int i;
u_int32_t comval; uint32_t comval;
/* Maximum is "65535:65535" + '\0'. */ /* Maximum is "65535:65535" + '\0'. */
char c[12]; char c[12];
const char *str; const char *str;
@ -560,7 +560,7 @@ community_regexp_delete (struct community *com, regex_t * reg)
i = 0; i = 0;
while (i < com->size) 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); comval = ntohl (comval);
switch (comval) switch (comval)
@ -694,8 +694,8 @@ struct community *community_list_match_delete(struct community *com,
struct community_list *list) struct community_list *list)
{ {
struct community_entry *entry; struct community_entry *entry;
u_int32_t val; uint32_t val;
u_int32_t com_index_to_delete[com->size]; uint32_t com_index_to_delete[com->size];
int delete_index = 0; int delete_index = 0;
int i; int i;
@ -895,8 +895,8 @@ struct lcommunity *lcommunity_list_match_delete(struct lcommunity *lcom,
struct community_list *list) struct community_list *list)
{ {
struct community_entry *entry; struct community_entry *entry;
u_int32_t com_index_to_delete[lcom->size]; uint32_t com_index_to_delete[lcom->size];
u_char *ptr; uint8_t *ptr;
int delete_index = 0; int delete_index = 0;
int i; int i;

View File

@ -68,13 +68,13 @@ struct community_entry {
struct community_entry *prev; struct community_entry *prev;
/* Permit or deny. */ /* Permit or deny. */
u_char direct; uint8_t direct;
/* Standard or expanded. */ /* Standard or expanded. */
u_char style; uint8_t style;
/* Any match. */ /* Any match. */
u_char any; uint8_t any;
/* Community structure. */ /* Community structure. */
union { union {

View File

@ -55,7 +55,7 @@ void community_free(struct community *com)
} }
/* Add one community value to the community. */ /* 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++; com->size++;
if (com->val) 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)); com->val = XMALLOC(MTYPE_COMMUNITY_VAL, com_length(com));
val = htonl(val); val = htonl(val);
memcpy(com_lastval(com), &val, sizeof(u_int32_t)); memcpy(com_lastval(com), &val, sizeof(uint32_t));
} }
/* Delete one community. */ /* 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 i = 0;
int c = 0; int c = 0;
@ -78,7 +78,7 @@ void community_del_val(struct community *com, u_int32_t *val)
return; return;
while (i < com->size) { 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; c = com->size - i - 1;
if (c > 0) if (c > 0)
@ -117,11 +117,11 @@ struct community *community_delete(struct community *com1,
/* Callback function from qsort(). */ /* Callback function from qsort(). */
static int community_compare(const void *a1, const void *a2) static int community_compare(const void *a1, const void *a2)
{ {
u_int32_t v1; uint32_t v1;
u_int32_t v2; uint32_t v2;
memcpy(&v1, a1, sizeof(u_int32_t)); memcpy(&v1, a1, sizeof(uint32_t));
memcpy(&v2, a2, sizeof(u_int32_t)); memcpy(&v2, a2, sizeof(uint32_t));
v1 = ntohl(v1); v1 = ntohl(v1);
v2 = ntohl(v2); v2 = ntohl(v2);
@ -132,28 +132,28 @@ static int community_compare(const void *a1, const void *a2)
return 0; return 0;
} }
int community_include(struct community *com, u_int32_t val) int community_include(struct community *com, uint32_t val)
{ {
int i; int i;
val = htonl(val); val = htonl(val);
for (i = 0; i < com->size; i++) 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 1;
return 0; 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; uint8_t *p;
u_int32_t val; uint32_t val;
p = (u_char *)com->val; p = (uint8_t *)com->val;
p += (i * 4); p += (i * 4);
memcpy(&val, p, sizeof(u_int32_t)); memcpy(&val, p, sizeof(uint32_t));
return ntohl(val); return ntohl(val);
} }
@ -163,7 +163,7 @@ struct community *community_uniq_sort(struct community *com)
{ {
int i; int i;
struct community *new; struct community *new;
u_int32_t val; uint32_t val;
if (!com) if (!com)
return NULL; return NULL;
@ -178,7 +178,7 @@ struct community *community_uniq_sort(struct community *com)
community_add_val(new, val); 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; return new;
} }
@ -201,9 +201,9 @@ static void set_community_string(struct community *com, bool make_json)
char *pnt; char *pnt;
int len; int len;
int first; int first;
u_int32_t comval; uint32_t comval;
u_int16_t as; uint16_t as;
u_int16_t val; uint16_t val;
json_object *json_community_list = NULL; json_object *json_community_list = NULL;
json_object *json_string = NULL; json_object *json_string = NULL;
@ -234,7 +234,7 @@ static void set_community_string(struct community *com, bool make_json)
len = 0; len = 0;
for (i = 0; i < com->size; i++) { 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); comval = ntohl(comval);
switch (comval) { switch (comval) {
@ -265,7 +265,7 @@ static void set_community_string(struct community *com, bool make_json)
/* Fill in string. */ /* Fill in string. */
for (i = 0; i < com->size; i++) { 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); comval = ntohl(comval);
if (first) if (first)
@ -391,7 +391,7 @@ void community_unintern(struct community **com)
} }
/* Create new community attribute. */ /* 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 tmp;
struct community *new; struct community *new;
@ -441,7 +441,7 @@ char *community_str(struct community *com, bool make_json)
hash package.*/ hash package.*/
unsigned int community_hash_make(struct community *com) 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); 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 */ /* Every community on com2 needs to be on com1 for this to match */
while (i < com1->size && j < com2->size) { while (i < com1->size && j < com2->size) {
if (memcmp(com1->val + i, com2->val + j, sizeof(u_int32_t)) if (memcmp(com1->val + i, com2->val + j, sizeof(uint32_t)) == 0)
== 0)
j++; j++;
i++; i++;
} }
@ -518,7 +517,7 @@ enum community_token {
/* Get next community token from string. */ /* Get next community token from string. */
static const char * 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; 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)) { if (isdigit((int)*p)) {
int separator = 0; int separator = 0;
int digit = 0; int digit = 0;
u_int32_t community_low = 0; uint32_t community_low = 0;
u_int32_t community_high = 0; uint32_t community_high = 0;
while (isdigit((int)*p) || *p == ':') { while (isdigit((int)*p) || *p == ':') {
if (*p == ':') { if (*p == ':') {
@ -624,7 +623,7 @@ struct community *community_str2com(const char *str)
{ {
struct community *com = NULL; struct community *com = NULL;
struct community *com_sort = NULL; struct community *com_sort = NULL;
u_int32_t val = 0; uint32_t val = 0;
enum community_token token = community_token_unknown; enum community_token token = community_token_unknown;
do { do {

View File

@ -32,7 +32,7 @@ struct community {
int size; int size;
/* Communities value. */ /* Communities value. */
u_int32_t *val; uint32_t *val;
/* Communities as a json object */ /* Communities as a json object */
json_object *json; json_object *json;
@ -60,7 +60,7 @@ extern void community_init(void);
extern void community_finish(void); extern void community_finish(void);
extern void community_free(struct community *); extern void community_free(struct community *);
extern struct community *community_uniq_sort(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 struct community *community_intern(struct community *);
extern void community_unintern(struct community **); extern void community_unintern(struct community **);
extern char *community_str(struct community *, bool make_json); 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 *, extern struct community *community_delete(struct community *,
struct community *); struct community *);
extern struct community *community_dup(struct community *); extern struct community *community_dup(struct community *);
extern int community_include(struct community *, u_int32_t); extern int community_include(struct community *, uint32_t);
extern void community_del_val(struct community *, u_int32_t *); extern void community_del_val(struct community *, uint32_t *);
extern unsigned long community_count(void); extern unsigned long community_count(void);
extern struct hash *community_hash(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 */ #endif /* _QUAGGA_BGP_COMMUNITY_H */

View File

@ -523,7 +523,7 @@ void bgp_config_write_damp(struct vty *vty)
} }
static const char *bgp_get_reuse_time(unsigned int penalty, char *buf, 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) json_object *json)
{ {
time_t reuse_time = 0; 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, 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) json_object *json)
{ {
struct bgp_damp_info *bdi; struct bgp_damp_info *bdi;

View File

@ -53,7 +53,7 @@ struct bgp_damp_info {
int index; int index;
/* Last time message type. */ /* Last time message type. */
u_char lastrecord; uint8_t lastrecord;
#define BGP_RECORD_UPDATE 1U #define BGP_RECORD_UPDATE 1U
#define BGP_RECORD_WITHDRAW 2U #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 *, extern void bgp_damp_info_vty(struct vty *, struct bgp_info *,
json_object *json_path); json_object *json_path);
extern const char *bgp_damp_reuse_time_vty(struct vty *, struct bgp_info *, 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 *); json_object *);
extern int bgp_show_dampening_parameters(struct vty *vty, afi_t, safi_t); extern int bgp_show_dampening_parameters(struct vty *vty, afi_t, safi_t);

View File

@ -469,13 +469,13 @@ const char *bgp_notify_subcode_str(char code, char subcode)
} }
/* extract notify admin reason if correctly present */ /* 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) size_t datalen)
{ {
if (!data || datalen < 1) if (!data || datalen < 1)
return NULL; return NULL;
u_char len = data[0]; uint8_t len = data[0];
if (len > 128 || len > datalen - 1) if (len > 128 || len > datalen - 1)
return NULL; return NULL;
@ -2159,8 +2159,8 @@ int bgp_debug_zebra(struct prefix *p)
const char *bgp_debug_rdpfxpath2str(afi_t afi, safi_t safi, const char *bgp_debug_rdpfxpath2str(afi_t afi, safi_t safi,
struct prefix_rd *prd, struct prefix_rd *prd,
union prefixconstptr pu, union prefixconstptr pu,
mpls_label_t *label, u_int32_t num_labels, mpls_label_t *label, uint32_t num_labels,
int addpath_valid, u_int32_t addpath_id, int addpath_valid, uint32_t addpath_id,
char *str, int size) char *str, int size)
{ {
char rd_buf[RD_ADDRSTRLEN]; 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); bgp_evpn_label2str(label, num_labels, tag_buf2, 20);
sprintf(tag_buf, " label %s", tag_buf2); sprintf(tag_buf, " label %s", tag_buf2);
} else { } else {
u_int32_t label_value; uint32_t label_value;
label_value = decode_label(label); label_value = decode_label(label);
sprintf(tag_buf, " label %u", label_value); sprintf(tag_buf, " label %u", label_value);

View File

@ -161,9 +161,9 @@ extern int bgp_debug_zebra(struct prefix *p);
extern int bgp_debug_count(void); extern int bgp_debug_count(void);
extern const char *bgp_debug_rdpfxpath2str(afi_t, safi_t, struct prefix_rd *, extern const char *bgp_debug_rdpfxpath2str(afi_t, safi_t, struct prefix_rd *,
union prefixconstptr, mpls_label_t *, union prefixconstptr, mpls_label_t *,
u_int32_t, int, u_int32_t, char *, uint32_t, int, uint32_t, char *,
int); 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); size_t datalen);
#endif /* _QUAGGA_BGP_DEBUG_H */ #endif /* _QUAGGA_BGP_DEBUG_H */

View File

@ -277,7 +277,7 @@ static void bgp_dump_routes_index_table(struct bgp *bgp)
if (sockunion_family(&peer->su) == AF_INET) { if (sockunion_family(&peer->su) == AF_INET) {
stream_put_in_addr(obuf, &peer->su.sin.sin_addr); stream_put_in_addr(obuf, &peer->su.sin.sin_addr);
} else if (sockunion_family(&peer->su) == AF_INET6) { } 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); 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) { if (afi == AFI_IP) {
/* We'll dump only the useful bits (those not 0), but have to /* We'll dump only the useful bits (those not 0), but have to
* align on 8 bits */ * 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); (rn->p.prefixlen + 7) / 8);
} else if (afi == AFI_IP6) { } else if (afi == AFI_IP6) {
/* We'll dump only the useful bits (those not 0), but have to /* We'll dump only the useful bits (those not 0), but have to
* align on 8 bits */ * 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); (rn->p.prefixlen + 7) / 8);
} }

View File

@ -68,7 +68,7 @@ static void ecommunity_hash_free(struct ecommunity *ecom)
else return 0. */ else return 0. */
int ecommunity_add_val(struct ecommunity *ecom, struct ecommunity_val *eval) int ecommunity_add_val(struct ecommunity *ecom, struct ecommunity_val *eval)
{ {
u_int8_t *p; uint8_t *p;
int ret; int ret;
int c; int c;
@ -126,7 +126,7 @@ struct ecommunity *ecommunity_uniq_sort(struct ecommunity *ecom)
} }
/* Parse Extended Communites Attribute in BGP packet. */ /* 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 tmp;
struct ecommunity *new; struct ecommunity *new;
@ -283,8 +283,8 @@ enum ecommunity_token {
* Encode BGP extended community from passed values. Supports types * Encode BGP extended community from passed values. Supports types
* defined in RFC 4360 and well-known sub-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, static int ecommunity_encode(uint8_t type, uint8_t sub_type, int trans, as_t as,
struct in_addr ip, u_int32_t val, struct in_addr ip, uint32_t val,
struct ecommunity_val *eval) struct ecommunity_val *eval)
{ {
assert(eval); assert(eval);
@ -338,8 +338,8 @@ static const char *ecommunity_gettoken(const char *str,
char *endptr; char *endptr;
struct in_addr ip; struct in_addr ip;
as_t as = 0; as_t as = 0;
u_int32_t val = 0; uint32_t val = 0;
u_char ecomm_type; uint8_t ecomm_type;
char buf[INET_ADDRSTRLEN + 1]; char buf[INET_ADDRSTRLEN + 1];
/* Skip white space. */ /* Skip white space. */
@ -547,7 +547,7 @@ struct ecommunity *ecommunity_str2com(const char *str, int type,
return ecom; 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 sub_type, int format)
{ {
int len = 0; 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) char *ecommunity_ecom2str(struct ecommunity *ecom, int format, int filter)
{ {
int i; int i;
u_int8_t *pnt; uint8_t *pnt;
int type = 0; int type = 0;
int sub_type = 0; int sub_type = 0;
#define ECOMMUNITY_STR_DEFAULT_LEN 27 #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]); (uint8_t)rmac.octet[5]);
} else if (*pnt } else if (*pnt
== ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY) { == ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY) {
u_int32_t seqnum; uint32_t seqnum;
u_char flags = *++pnt; uint8_t flags = *++pnt;
memcpy(&seqnum, pnt + 2, 4); memcpy(&seqnum, pnt + 2, 4);
seqnum = ntohl(seqnum); seqnum = ntohl(seqnum);
@ -774,7 +774,7 @@ int ecommunity_match(const struct ecommunity *ecom1,
extern struct ecommunity_val *ecommunity_lookup(const struct ecommunity *ecom, extern struct ecommunity_val *ecommunity_lookup(const struct ecommunity *ecom,
uint8_t type, uint8_t subtype) uint8_t type, uint8_t subtype)
{ {
u_int8_t *p; uint8_t *p;
int c; int c;
/* If the value already exists in the structure return 0. */ /* 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, extern int ecommunity_strip(struct ecommunity *ecom, uint8_t type,
uint8_t subtype) uint8_t subtype)
{ {
u_int8_t *p; uint8_t *p;
int c, found = 0; int c, found = 0;
/* When this is fist value, just add it. */ /* When this is fist value, just add it. */
if (ecom == NULL || ecom->val == NULL) { if (ecom == NULL || ecom->val == NULL) {

View File

@ -64,7 +64,7 @@ struct ecommunity {
int size; int size;
/* Extended Communities value. */ /* Extended Communities value. */
u_int8_t *val; uint8_t *val;
/* Human readable format string. */ /* Human readable format string. */
char *str; char *str;
@ -90,7 +90,7 @@ struct ecommunity_val {
/* /*
* Encode BGP Route Target AS:nn. * 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) struct ecommunity_val *eval)
{ {
eval->val[0] = ECOMMUNITY_ENCODE_AS; 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. * 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) struct ecommunity_val *eval)
{ {
eval->val[0] = ECOMMUNITY_ENCODE_IP; 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. * 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) struct ecommunity_val *eval)
{ {
eval->val[0] = ECOMMUNITY_ENCODE_AS4; 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_init(void);
extern void ecommunity_finish(void); extern void ecommunity_finish(void);
extern void ecommunity_free(struct ecommunity **); 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_dup(struct ecommunity *);
extern struct ecommunity *ecommunity_merge(struct ecommunity *, extern struct ecommunity *ecommunity_merge(struct ecommunity *,
struct ecommunity *); struct ecommunity *);

View File

@ -82,7 +82,7 @@ struct bgp_tea_subtlv_color {
/* per draft-rosen-idr-tunnel-encaps */ /* per draft-rosen-idr-tunnel-encaps */
struct bgp_tea_subtlv_remote_endpoint { struct bgp_tea_subtlv_remote_endpoint {
u_char family; /* IPv4 or IPv6 */ uint8_t family; /* IPv4 or IPv6 */
union { union {
struct in_addr v4; struct in_addr v4;
struct in6_addr v6; struct in6_addr v6;

View File

@ -335,7 +335,7 @@ static int evpn_route_target_cmp(struct ecommunity *ecom1,
static inline void mask_ecom_global_admin(struct ecommunity_val *dst, static inline void mask_ecom_global_admin(struct ecommunity_val *dst,
struct ecommunity_val *src) struct ecommunity_val *src)
{ {
u_char type; uint8_t type;
type = src->val[0]; type = src->val[0];
dst->val[0] = 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, static int bgp_zebra_send_remote_macip(struct bgp *bgp, struct bgpevpn *vpn,
struct prefix_evpn *p, struct prefix_evpn *p,
struct in_addr remote_vtep_ip, int add, struct in_addr remote_vtep_ip, int add,
u_char flags) uint8_t flags)
{ {
struct stream *s; struct stream *s;
int ipa_len; 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)); memset(&ecom_encap, 0, sizeof(ecom_encap));
encode_encap_extcomm(tnl_type, &eval); encode_encap_extcomm(tnl_type, &eval);
ecom_encap.size = 1; ecom_encap.size = 1;
ecom_encap.val = (u_int8_t *)eval.val; ecom_encap.val = (uint8_t *)eval.val;
/* Add Encap */ /* Add Encap */
attr->ecommunity = ecommunity_dup(&ecom_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; bgp_encap_types tnl_type;
struct listnode *node, *nnode; struct listnode *node, *nnode;
struct ecommunity *ecom; struct ecommunity *ecom;
u_int32_t seqnum; uint32_t seqnum;
struct list *vrf_export_rtl = NULL; struct list *vrf_export_rtl = NULL;
/* Encap */ /* Encap */
@ -661,7 +661,7 @@ static void build_evpn_route_extcomm(struct bgpevpn *vpn, struct attr *attr,
memset(&ecom_encap, 0, sizeof(ecom_encap)); memset(&ecom_encap, 0, sizeof(ecom_encap));
encode_encap_extcomm(tnl_type, &eval); encode_encap_extcomm(tnl_type, &eval);
ecom_encap.size = 1; ecom_encap.size = 1;
ecom_encap.val = (u_int8_t *)eval.val; ecom_encap.val = (uint8_t *)eval.val;
/* Add Encap */ /* Add Encap */
attr->ecommunity = ecommunity_dup(&ecom_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)); memset(&ecom_sticky, 0, sizeof(ecom_sticky));
encode_mac_mobility_extcomm(1, seqnum, &eval_sticky); encode_mac_mobility_extcomm(1, seqnum, &eval_sticky);
ecom_sticky.size = 1; ecom_sticky.size = 1;
ecom_sticky.val = (u_int8_t *)eval_sticky.val; ecom_sticky.val = (uint8_t *)eval_sticky.val;
attr->ecommunity = attr->ecommunity =
ecommunity_merge(attr->ecommunity, &ecom_sticky); 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. * 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 ecom_tmp;
struct ecommunity_val eval; struct ecommunity_val eval;
u_int8_t *ecom_val_ptr; uint8_t *ecom_val_ptr;
int i; int i;
u_int8_t *pnt; uint8_t *pnt;
int type = 0; int type = 0;
int sub_type = 0; int sub_type = 0;
@ -745,8 +745,7 @@ static void add_mac_mobility_to_attr(u_int32_t seq_num, struct attr *attr)
if (type == ECOMMUNITY_ENCODE_EVPN if (type == ECOMMUNITY_ENCODE_EVPN
&& sub_type && sub_type
== ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY) { == ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY) {
ecom_val_ptr = ecom_val_ptr = (uint8_t *)(attr->ecommunity->val
(u_int8_t *)(attr->ecommunity->val
+ (i * 8)); + (i * 8));
break; break;
} }
@ -761,7 +760,7 @@ static void add_mac_mobility_to_attr(u_int32_t seq_num, struct attr *attr)
else { else {
memset(&ecom_tmp, 0, sizeof(ecom_tmp)); memset(&ecom_tmp, 0, sizeof(ecom_tmp));
ecom_tmp.size = 1; ecom_tmp.size = 1;
ecom_tmp.val = (u_int8_t *)eval.val; ecom_tmp.val = (uint8_t *)eval.val;
attr->ecommunity = attr->ecommunity =
ecommunity_merge(attr->ecommunity, &ecom_tmp); 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. */ /* Install EVPN route into zebra. */
static int evpn_zebra_install(struct bgp *bgp, struct bgpevpn *vpn, static int evpn_zebra_install(struct bgp *bgp, struct bgpevpn *vpn,
struct prefix_evpn *p, struct prefix_evpn *p,
struct in_addr remote_vtep_ip, u_char flags) struct in_addr remote_vtep_ip, uint8_t flags)
{ {
int ret; int ret;
@ -848,7 +847,7 @@ static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn,
afi_t afi = AFI_L2VPN; afi_t afi = AFI_L2VPN;
safi_t safi = SAFI_EVPN; safi_t safi = SAFI_EVPN;
int ret = 0; int ret = 0;
u_char flags = 0; uint8_t flags = 0;
/* Compute the best path. */ /* Compute the best path. */
bgp_best_selection(bgp, rn, &bgp->maxpaths[afi][safi], &old_and_new, 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, static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
afi_t afi, safi_t safi, struct bgp_node *rn, afi_t afi, safi_t safi, struct bgp_node *rn,
struct attr *attr, int add, int vni_table, 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 *tmp_ri;
struct bgp_info *local_ri, *remote_ri; struct bgp_info *local_ri, *remote_ri;
struct attr *attr_new; struct attr *attr_new;
mpls_label_t label[BGP_MAX_LABELS]; mpls_label_t label[BGP_MAX_LABELS];
u_int32_t num_labels = 1; uint32_t num_labels = 1;
int route_change = 1; int route_change = 1;
u_char sticky = 0; uint8_t sticky = 0;
struct prefix_evpn *evp; struct prefix_evpn *evp;
*ri = NULL; *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 * This will ensure that local routes are preferred for g/w macs
*/ */
if (remote_ri && !CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_GW)) { 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. */ /* Add MM extended community to route. */
cur_seqnum = mac_mobility_seqnum(remote_ri->attr); 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. * and schedule for processing.
*/ */
static int update_evpn_route(struct bgp *bgp, struct bgpevpn *vpn, 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 bgp_node *rn;
struct attr attr; 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. * matches, we're done.
*/ */
for (i = 0; i < ecom->size; i++) { for (i = 0; i < ecom->size; i++) {
u_char *pnt; uint8_t *pnt;
u_char type, sub_type; uint8_t type, sub_type;
struct ecommunity_val *eval; struct ecommunity_val *eval;
struct ecommunity_val eval_tmp; struct ecommunity_val eval_tmp;
struct vrf_irt_node *irt; 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. * matches, we're done.
*/ */
for (i = 0; i < ecom->size; i++) { for (i = 0; i < ecom->size; i++) {
u_char *pnt; uint8_t *pnt;
u_char type, sub_type; uint8_t type, sub_type;
struct ecommunity_val *eval; struct ecommunity_val *eval;
struct ecommunity_val eval_tmp; struct ecommunity_val eval_tmp;
struct irt_node *irt; 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. * the route into matching VNIs/VRFs.
*/ */
for (i = 0; i < ecom->size; i++) { for (i = 0; i < ecom->size; i++) {
u_char *pnt; uint8_t *pnt;
u_char type, sub_type; uint8_t type, sub_type;
struct ecommunity_val *eval; struct ecommunity_val *eval;
struct ecommunity_val eval_tmp; struct ecommunity_val eval_tmp;
struct irt_node *irt; /* import rt for l2vni */ 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). * Process received EVPN type-2 route (advertise or withdraw).
*/ */
static int process_type2_route(struct peer *peer, afi_t afi, safi_t safi, static int process_type2_route(struct peer *peer, afi_t afi, safi_t safi,
struct attr *attr, u_char *pfx, int psize, struct attr *attr, uint8_t *pfx, int psize,
u_int32_t addpath_id) uint32_t addpath_id)
{ {
struct prefix_rd prd; struct prefix_rd prd;
struct prefix_evpn p; struct prefix_evpn p;
u_char ipaddr_len; uint8_t ipaddr_len;
u_char macaddr_len; uint8_t macaddr_len;
mpls_label_t label[BGP_MAX_LABELS]; /* holds the VNI(s) as in packet */ 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; int ret;
/* Type-2 route should be either 33, 37 or 49 bytes or an /* 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). * Process received EVPN type-3 route (advertise or withdraw).
*/ */
static int process_type3_route(struct peer *peer, afi_t afi, safi_t safi, static int process_type3_route(struct peer *peer, afi_t afi, safi_t safi,
struct attr *attr, u_char *pfx, int psize, struct attr *attr, uint8_t *pfx, int psize,
u_int32_t addpath_id) uint32_t addpath_id)
{ {
struct prefix_rd prd; struct prefix_rd prd;
struct prefix_evpn p; struct prefix_evpn p;
u_char ipaddr_len; uint8_t ipaddr_len;
int ret; int ret;
/* Type-3 route should be either 17 or 29 bytes: RD (8), Eth Tag (4), /* 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). * Process received EVPN type-5 route (advertise or withdraw).
*/ */
static int process_type5_route(struct peer *peer, afi_t afi, safi_t safi, static int process_type5_route(struct peer *peer, afi_t afi, safi_t safi,
struct attr *attr, u_char *pfx, int psize, struct attr *attr, uint8_t *pfx, int psize,
u_int32_t addpath_id, int withdraw) uint32_t addpath_id, int withdraw)
{ {
struct prefix_rd prd; struct prefix_rd prd;
struct prefix_evpn p; struct prefix_evpn p;
struct bgp_route_evpn evpn; struct bgp_route_evpn evpn;
u_char ippfx_len; uint8_t ippfx_len;
u_int32_t eth_tag; uint32_t eth_tag;
mpls_label_t label; /* holds the VNI as in the packet */ mpls_label_t label; /* holds the VNI as in the packet */
int ret; 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, static void evpn_mpattr_encode_type5(struct stream *s, struct prefix *p,
struct prefix_rd *prd, mpls_label_t *label, 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; int len;
char temp[16]; 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 * 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) int len)
{ {
vni_t vni1, vni2; vni_t vni1, vni2;
@ -3596,7 +3595,7 @@ void bgp_evpn_route2json(struct prefix_evpn *p, json_object *json)
buf1, buf1,
sizeof(buf1))); sizeof(buf1)));
} else { } else {
u_char family; uint8_t family;
family = IS_EVPN_PREFIX_IPADDR_V4(p) ? AF_INET family = IS_EVPN_PREFIX_IPADDR_V4(p) ? AF_INET
: AF_INET6; : AF_INET6;
@ -3647,7 +3646,7 @@ char *bgp_evpn_route2str(struct prefix_evpn *p, char *buf, int len)
prefix_mac2str(&p->prefix.mac, buf1, prefix_mac2str(&p->prefix.mac, buf1,
sizeof(buf1))); sizeof(buf1)));
else { else {
u_char family; uint8_t family;
family = IS_EVPN_PREFIX_IPADDR_V4(p) ? AF_INET family = IS_EVPN_PREFIX_IPADDR_V4(p) ? AF_INET
: AF_INET6; : 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, void bgp_evpn_encode_prefix(struct stream *s, struct prefix *p,
struct prefix_rd *prd, mpls_label_t *label, struct prefix_rd *prd, mpls_label_t *label,
u_int32_t num_labels, struct attr *attr, uint32_t num_labels, struct attr *attr,
int addpath_encode, u_int32_t addpath_tx_id) int addpath_encode, uint32_t addpath_tx_id)
{ {
struct prefix_evpn *evp = (struct prefix_evpn *)p; struct prefix_evpn *evp = (struct prefix_evpn *)p;
int len, ipa_len = 0; 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, int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr,
struct bgp_nlri *packet, int withdraw) struct bgp_nlri *packet, int withdraw)
{ {
u_char *pnt; uint8_t *pnt;
u_char *lim; uint8_t *lim;
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
u_int32_t addpath_id; uint32_t addpath_id;
int addpath_encoded; int addpath_encoded;
int psize = 0; int psize = 0;
u_char rtype; uint8_t rtype;
u_char rlen; uint8_t rlen;
struct prefix p; struct prefix p;
/* Start processing the NLRI - there may be multiple in the MP_REACH */ /* 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. * Handle add of a local MACIP.
*/ */
int bgp_evpn_local_macip_add(struct bgp *bgp, vni_t vni, struct ethaddr *mac, 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 bgpevpn *vpn;
struct prefix_evpn p; struct prefix_evpn p;

View File

@ -36,7 +36,7 @@ static inline int is_evpn_enabled(void)
static inline void vni2label(vni_t vni, mpls_label_t *label) 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[0] = (vni >> 16) & 0xFF;
tag[1] = (vni >> 8) & 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) 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_t vni;
vni = ((u_int32_t)*tag++ << 16); vni = ((uint32_t)*tag++ << 16);
vni |= (u_int32_t)*tag++ << 8; vni |= (uint32_t)*tag++ << 8;
vni |= (u_int32_t)(*tag & 0xFF); vni |= (uint32_t)(*tag & 0xFF);
return vni; return vni;
} }
@ -86,14 +86,14 @@ extern void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf, afi_t afi,
safi_t safi); safi_t safi);
extern void bgp_evpn_vrf_delete(struct bgp *bgp_vrf); extern void bgp_evpn_vrf_delete(struct bgp *bgp_vrf);
extern void bgp_evpn_handle_router_id_update(struct bgp *bgp, int withdraw); 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); char *buf, int len);
extern char *bgp_evpn_route2str(struct prefix_evpn *p, 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_route2json(struct prefix_evpn *p, json_object *json);
extern void bgp_evpn_encode_prefix(struct stream *s, struct prefix *p, extern void bgp_evpn_encode_prefix(struct stream *s, struct prefix *p,
struct prefix_rd *prd, mpls_label_t *label, struct prefix_rd *prd, mpls_label_t *label,
u_int32_t num_labels, struct attr *attr, uint32_t num_labels, struct attr *attr,
int addpath_encode, u_int32_t addpath_tx_id); int addpath_encode, uint32_t addpath_tx_id);
extern int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr, extern int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr,
struct bgp_nlri *packet, int withdraw); struct bgp_nlri *packet, int withdraw);
extern int bgp_evpn_import_route(struct bgp *bgp, afi_t afi, safi_t safi, 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); struct ethaddr *mac, struct ipaddr *ip);
extern int bgp_evpn_local_macip_add(struct bgp *bgp, vni_t vni, extern int bgp_evpn_local_macip_add(struct bgp *bgp, vni_t vni,
struct ethaddr *mac, struct ipaddr *ip, 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, extern int bgp_evpn_local_l3vni_add(vni_t vni, vrf_id_t vrf_id,
struct ethaddr *rmac, struct ethaddr *rmac,
struct in_addr originator_ip, int filter); struct in_addr originator_ip, int filter);

View File

@ -55,7 +55,7 @@ typedef enum {
struct bgpevpn { struct bgpevpn {
vni_t vni; vni_t vni;
vrf_id_t tenant_vrf_id; 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_CFGD 0x1 /* VNI is user configured */
#define VNI_FLAG_LIVE 0x2 /* VNI is "live" */ #define VNI_FLAG_LIVE 0x2 /* VNI is "live" */
#define VNI_FLAG_RD_CFGD 0x4 /* RD is user configured. */ #define VNI_FLAG_RD_CFGD 0x4 /* RD is user configured. */
@ -69,15 +69,15 @@ struct bgpevpn {
/* Flag to indicate if we are /* Flag to indicate if we are
* advertising the g/w mac ip for * advertising the g/w mac ip for
* this VNI*/ * this VNI*/
u_int8_t advertise_gw_macip; uint8_t advertise_gw_macip;
/* Flag to indicate if we are /* Flag to indicate if we are
* advertising subnet for this VNI */ * advertising subnet for this VNI */
u_int8_t advertise_subnet; uint8_t advertise_subnet;
/* Id for deriving the RD /* Id for deriving the RD
* automatically for this VNI */ * automatically for this VNI */
u_int16_t rd_id; uint16_t rd_id;
/* RD for this VNI. */ /* RD for this VNI. */
struct prefix_rd prd; struct prefix_rd prd;
@ -254,7 +254,7 @@ static inline void encode_default_gw_extcomm(struct ecommunity_val *eval)
eval->val[1] = ECOMMUNITY_EVPN_SUBTYPE_DEF_GW; 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) struct ecommunity_val *eval)
{ {
memset(eval, 0, sizeof(*eval)); memset(eval, 0, sizeof(*eval));

View File

@ -56,8 +56,8 @@ struct vni_walk_ctx {
static void display_vrf_import_rt(struct vty *vty, struct vrf_irt_node *irt, static void display_vrf_import_rt(struct vty *vty, struct vrf_irt_node *irt,
json_object *json) json_object *json)
{ {
u_char *pnt; uint8_t *pnt;
u_char type, sub_type; uint8_t type, sub_type;
struct ecommunity_as eas; struct ecommunity_as eas;
struct ecommunity_ip eip; struct ecommunity_ip eip;
struct listnode *node, *nnode; 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(); json_vrfs = json_object_new_array();
} }
pnt = (u_char *)&irt->rt.val; pnt = (uint8_t *)&irt->rt.val;
type = *pnt++; type = *pnt++;
sub_type = *pnt++; sub_type = *pnt++;
if (sub_type != ECOMMUNITY_ROUTE_TARGET) 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, static void display_import_rt(struct vty *vty, struct irt_node *irt,
json_object *json) json_object *json)
{ {
u_char *pnt; uint8_t *pnt;
u_char type, sub_type; uint8_t type, sub_type;
struct ecommunity_as eas; struct ecommunity_as eas;
struct ecommunity_ip eip; struct ecommunity_ip eip;
struct listnode *node, *nnode; 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 */ /* TODO: This needs to go into a function */
pnt = (u_char *)&irt->rt.val; pnt = (uint8_t *)&irt->rt.val;
type = *pnt++; type = *pnt++;
sub_type = *pnt++; sub_type = *pnt++;
if (sub_type != ECOMMUNITY_ROUTE_TARGET) 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, struct bgp_node *rd_rn,
json_object *json) json_object *json)
{ {
u_int16_t type; uint16_t type;
struct rd_as rd_as; struct rd_as rd_as;
struct rd_ip rd_ip; struct rd_ip rd_ip;
u_char *pnt; uint8_t *pnt;
char rd_str[RD_ADDRSTRLEN]; char rd_str[RD_ADDRSTRLEN];
pnt = rd_rn->p.u.val; 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_node *rn;
struct bgp_info *ri; struct bgp_info *ri;
int header = 1; int header = 1;
u_int32_t prefix_cnt, path_cnt; uint32_t prefix_cnt, path_cnt;
prefix_cnt = path_cnt = 0; 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, static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
enum bgp_show_type type, void *output_arg, 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; afi_t afi = AFI_L2VPN;
struct bgp *bgp; struct bgp *bgp;
@ -930,10 +930,10 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
header = 0; header = 0;
} }
if (rd_header) { if (rd_header) {
u_int16_t type; uint16_t type;
struct rd_as rd_as; struct rd_as rd_as;
struct rd_ip rd_ip; struct rd_ip rd_ip;
u_char *pnt; uint8_t *pnt;
pnt = rn->p.u.val; pnt = rn->p.u.val;
@ -1103,7 +1103,7 @@ DEFUN(show_ip_bgp_l2vpn_evpn_all_neighbor_routes,
union sockunion su; union sockunion su;
struct peer *peer; struct peer *peer;
int ret; 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); 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; union sockunion su;
struct peer *peer; struct peer *peer;
struct prefix_rd prd; 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, "ASN:NN_OR_IP-ADDRESS:NN", &idx_ext_community);
argv_find(argv, argc, "A.B.C.D", &idx_ipv4); 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; int ret;
struct peer *peer; struct peer *peer;
union sockunion su; 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); 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 peer *peer;
struct prefix_rd prd; struct prefix_rd prd;
union sockunion su; 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, "ASN:NN_OR_IP-ADDRESS:NN", &idx_ext_community);
argv_find(argv, argc, "A.B.C.D", &idx_ipv4); 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, static void evpn_show_routes_vni_all(struct vty *vty, struct bgp *bgp,
struct in_addr vtep_ip, json_object *json) struct in_addr vtep_ip, json_object *json)
{ {
u_int32_t num_vnis; uint32_t num_vnis;
struct vni_walk_ctx wctx; struct vni_walk_ctx wctx;
num_vnis = hashcount(bgp->vnihash); 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 prefix_evpn p;
struct bgp_node *rn; struct bgp_node *rn;
struct bgp_info *ri; struct bgp_info *ri;
u_int32_t path_cnt = 0; uint32_t path_cnt = 0;
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
json_object *json_paths = NULL; 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 prefix_evpn p;
struct bgp_node *rn; struct bgp_node *rn;
struct bgp_info *ri; struct bgp_info *ri;
u_int32_t path_cnt = 0; uint32_t path_cnt = 0;
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
json_object *json_paths = NULL; 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; struct bgp_info *ri;
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
u_int32_t path_cnt = 0; uint32_t path_cnt = 0;
json_object *json_paths = NULL; json_object *json_paths = NULL;
char prefix_str[BUFSIZ]; char prefix_str[BUFSIZ];
@ -2065,7 +2065,7 @@ static void evpn_show_route_rd(struct vty *vty, struct bgp *bgp,
int rd_header = 1; int rd_header = 1;
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
u_int32_t prefix_cnt, path_cnt; uint32_t prefix_cnt, path_cnt;
char rd_str[RD_ADDRSTRLEN]; char rd_str[RD_ADDRSTRLEN];
json_object *json_rd = NULL; json_object *json_rd = NULL;
int add_rd_to_json = 0; 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; int rd_header;
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
u_int32_t prefix_cnt, path_cnt; uint32_t prefix_cnt, path_cnt;
afi = AFI_L2VPN; afi = AFI_L2VPN;
safi = SAFI_EVPN; 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, static void evpn_show_vni(struct vty *vty, struct bgp *bgp, vni_t vni,
json_object *json) json_object *json)
{ {
u_char found = 0; uint8_t found = 0;
struct bgpevpn *vpn; struct bgpevpn *vpn;
vpn = bgp_evpn_lookup_vni(bgp, vni); vpn = bgp_evpn_lookup_vni(bgp, vni);
@ -2906,10 +2906,10 @@ DEFUN(show_bgp_l2vpn_evpn_vni,
struct bgp *bgp_def; struct bgp *bgp_def;
vni_t vni; vni_t vni;
int idx = 0; int idx = 0;
u_char uj = 0; uint8_t uj = 0;
json_object *json = NULL; json_object *json = NULL;
u_int32_t num_l2vnis = 0; uint32_t num_l2vnis = 0;
u_int32_t num_l3vnis = 0; uint32_t num_l3vnis = 0;
uint32_t num_vnis = 0; uint32_t num_vnis = 0;
struct listnode *node = NULL; struct listnode *node = NULL;
struct bgp *bgp_temp = NULL; struct bgp *bgp_temp = NULL;
@ -2992,7 +2992,7 @@ DEFUN(show_bgp_l2vpn_evpn_summary,
JSON_STR) JSON_STR)
{ {
int idx_vrf = 0; int idx_vrf = 0;
u_char uj = use_json(argc, argv); uint8_t uj = use_json(argc, argv);
char *vrf = NULL; char *vrf = NULL;
if (argv_find(argv, argc, "vrf", &idx_vrf)) if (argv_find(argv, argc, "vrf", &idx_vrf))
@ -3020,7 +3020,7 @@ DEFUN(show_bgp_l2vpn_evpn_route,
struct bgp *bgp; struct bgp *bgp;
int type_idx = 0; int type_idx = 0;
int type = 0; int type = 0;
u_char uj = 0; uint8_t uj = 0;
json_object *json = NULL; json_object *json = NULL;
uj = use_json(argc, argv); uj = use_json(argc, argv);
@ -3472,7 +3472,7 @@ DEFUN(show_bgp_l2vpn_evpn_vrf_import_rt,
"Show vrf import route target\n" "Show vrf import route target\n"
JSON_STR) JSON_STR)
{ {
u_char uj = 0; uint8_t uj = 0;
struct bgp *bgp_def = NULL; struct bgp *bgp_def = NULL;
json_object *json = NULL; json_object *json = NULL;
@ -3509,7 +3509,7 @@ DEFUN(show_bgp_l2vpn_evpn_import_rt,
JSON_STR) JSON_STR)
{ {
struct bgp *bgp; struct bgp *bgp;
u_char uj = 0; uint8_t uj = 0;
json_object *json = NULL; json_object *json = NULL;
bgp = bgp_get_default(); bgp = bgp_get_default();
@ -3902,7 +3902,7 @@ DEFUN (show_bgp_vrf_l3vni_info,
json_object *json_vnis = NULL; json_object *json_vnis = NULL;
json_object *json_export_rts = NULL; json_object *json_export_rts = NULL;
json_object *json_import_rts = NULL; json_object *json_import_rts = NULL;
u_char uj = use_json(argc, argv); uint8_t uj = use_json(argc, argv);
if (uj) { if (uj) {
json = json_object_new_object(); json = json_object_new_object();

View File

@ -166,7 +166,7 @@ static struct peer *peer_xfer_conn(struct peer *from_peer)
zlog_err( zlog_err(
"[%s] Dropping pending packet on connection transfer:", "[%s] Dropping pending packet on connection transfer:",
peer->host); peer->host);
u_int16_t type = stream_getc_from(peer->curr, uint16_t type = stream_getc_from(peer->curr,
BGP_MARKER_SIZE + 2); BGP_MARKER_SIZE + 2);
bgp_dump_packet(peer, type, peer->curr); bgp_dump_packet(peer, type, peer->curr);
stream_free(peer->curr); stream_free(peer->curr);
@ -763,8 +763,8 @@ int bgp_maxmed_onstartup_active(struct bgp *bgp)
void bgp_maxmed_update(struct bgp *bgp) void bgp_maxmed_update(struct bgp *bgp)
{ {
u_char maxmed_active; uint8_t maxmed_active;
u_int32_t maxmed_value; uint32_t maxmed_value;
if (bgp->v_maxmed_admin) { if (bgp->v_maxmed_admin) {
maxmed_active = 1; maxmed_active = 1;
@ -1199,7 +1199,8 @@ static int bgp_stop_with_error(struct peer *peer)
/* something went wrong, send notify and tear down */ /* 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 */ /* Send notify to remote peer */
bgp_notify_send(peer, code, sub_code); bgp_notify_send(peer, code, sub_code);

View File

@ -281,7 +281,7 @@ static int bgp_process_reads(struct thread *thread)
*/ */
static uint16_t bgp_write(struct peer *peer) static uint16_t bgp_write(struct peer *peer)
{ {
u_char type; uint8_t type;
struct stream *s; struct stream *s;
int num; int num;
int update_last_write = 0; int update_last_write = 0;

View File

@ -48,7 +48,7 @@ int bgp_parse_fec_update(void)
struct bgp *bgp; struct bgp *bgp;
struct bgp_table *table; struct bgp_table *table;
struct prefix p; struct prefix p;
u_int32_t label; uint32_t label;
afi_t afi; afi_t afi;
safi_t safi; 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 stream *s;
struct prefix *p; struct prefix *p;
int command; int command;
u_int16_t flags = 0; uint16_t flags = 0;
size_t flags_pos = 0; size_t flags_pos = 0;
/* Check socket. */ /* 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); 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) mpls_label_t *label)
{ {
u_char *data = pnt; uint8_t *data = pnt;
u_char *lim = pnt + plen; uint8_t *lim = pnt + plen;
u_char llen = 0; uint8_t llen = 0;
u_char label_depth = 0; uint8_t label_depth = 0;
for (; data < lim; data += BGP_LABEL_BYTES) { for (; data < lim; data += BGP_LABEL_BYTES) {
memcpy(label, 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, int bgp_nlri_parse_label(struct peer *peer, struct attr *attr,
struct bgp_nlri *packet) struct bgp_nlri *packet)
{ {
u_char *pnt; uint8_t *pnt;
u_char *lim; uint8_t *lim;
struct prefix p; struct prefix p;
int psize = 0; int psize = 0;
int prefixlen; int prefixlen;
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
int addpath_encoded; int addpath_encoded;
u_int32_t addpath_id; uint32_t addpath_id;
mpls_label_t label = MPLS_INVALID_LABEL; mpls_label_t label = MPLS_INVALID_LABEL;
u_char llen; uint8_t llen;
pnt = packet->nlri; pnt = packet->nlri;
lim = pnt + packet->length; lim = pnt + packet->length;

View File

@ -51,7 +51,7 @@ static inline int bgp_labeled_safi(safi_t safi)
static inline int bgp_is_withdraw_label(mpls_label_t *label) 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() /* The check on pkt[2] for 0x00 or 0x02 is in case bgp_set_valid_label()
* was called on the withdraw 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) 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) if (!t)
return 0; return 0;
return (t[2] & 0x02); 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) 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) if (t)
t[2] |= 0x02; t[2] |= 0x02;
} }
static inline void bgp_unset_valid_label(mpls_label_t *label) 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) if (t)
t[2] &= ~0x02; t[2] &= ~0x02;
} }
@ -95,17 +95,17 @@ static inline void bgp_unregister_for_label(struct bgp_node *rn)
} }
/* Label stream to value */ /* 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) return ((((unsigned int)t[0]) << 12) | (((unsigned int)t[1]) << 4)
| ((unsigned int)((t[2] & 0xF0) >> 4))); | ((unsigned int)((t[2] & 0xF0) >> 4)));
} }
/* Encode label values */ /* 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[0] = ((l & 0x000FF000) >> 12);
t[1] = ((l & 0x00000FF0) >> 4); t[1] = ((l & 0x00000FF0) >> 4);
t[2] = ((l & 0x0000000F) << 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 */ /* 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); return (t[2] & 0x01);
}; };

View File

@ -66,7 +66,7 @@ static void lcommunity_hash_free(struct lcommunity *lcom)
static int lcommunity_add_val(struct lcommunity *lcom, static int lcommunity_add_val(struct lcommunity *lcom,
struct lcommunity_val *lval) struct lcommunity_val *lval)
{ {
u_int8_t *p; uint8_t *p;
int ret; int ret;
int c; int c;
@ -124,7 +124,7 @@ struct lcommunity *lcommunity_uniq_sort(struct lcommunity *lcom)
} }
/* Parse Large Communites Attribute in BGP packet. */ /* 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 tmp;
struct lcommunity *new; struct lcommunity *new;
@ -291,9 +291,9 @@ static const char *lcommunity_gettoken(const char *str,
if (isdigit((int)*p)) { if (isdigit((int)*p)) {
int separator = 0; int separator = 0;
int digit = 0; int digit = 0;
u_int32_t globaladmin = 0; uint32_t globaladmin = 0;
u_int32_t localdata1 = 0; uint32_t localdata1 = 0;
u_int32_t localdata2 = 0; uint32_t localdata2 = 0;
while (isdigit((int)*p) || *p == ':') { while (isdigit((int)*p) || *p == ':') {
if (*p == ':') { if (*p == ':') {
@ -375,10 +375,10 @@ struct lcommunity *lcommunity_str2com(const char *str)
return lcom; return lcom;
} }
int lcommunity_include(struct lcommunity *lcom, u_char *ptr) int lcommunity_include(struct lcommunity *lcom, uint8_t *ptr)
{ {
int i; int i;
u_char *lcom_ptr; uint8_t *lcom_ptr;
for (i = 0; i < lcom->size; i++) { for (i = 0; i < lcom->size; i++) {
lcom_ptr = lcom->val + (i * LCOMMUNITY_SIZE); 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) char *lcommunity_lcom2str(struct lcommunity *lcom, int format)
{ {
int i; int i;
u_int8_t *pnt; uint8_t *pnt;
#define LCOMMUNITY_STR_DEFAULT_LEN 40 #define LCOMMUNITY_STR_DEFAULT_LEN 40
int str_size; int str_size;
int str_pnt; int str_pnt;
char *str_buf; char *str_buf;
int len = 0; int len = 0;
int first = 1; int first = 1;
u_int32_t globaladmin, localdata1, localdata2; uint32_t globaladmin, localdata1, localdata2;
if (lcom->size == 0) { if (lcom->size == 0) {
str_buf = XMALLOC(MTYPE_LCOMMUNITY_STR, 1); str_buf = XMALLOC(MTYPE_LCOMMUNITY_STR, 1);
@ -472,7 +472,7 @@ int lcommunity_match(const struct lcommunity *lcom1,
} }
/* Delete one lcommunity. */ /* 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 i = 0;
int c = 0; int c = 0;

View File

@ -38,7 +38,7 @@ struct lcommunity {
int size; int size;
/* Large Communities value. */ /* Large Communities value. */
u_int8_t *val; uint8_t *val;
/* Human readable format string. */ /* Human readable format string. */
char *str; char *str;
@ -54,7 +54,7 @@ struct lcommunity_val {
extern void lcommunity_init(void); extern void lcommunity_init(void);
extern void lcommunity_finish(void); extern void lcommunity_finish(void);
extern void lcommunity_free(struct lcommunity **); 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_dup(struct lcommunity *);
extern struct lcommunity *lcommunity_merge(struct lcommunity *, extern struct lcommunity *lcommunity_merge(struct lcommunity *,
struct lcommunity *); struct lcommunity *);
@ -69,6 +69,6 @@ extern char *lcommunity_lcom2str(struct lcommunity *, int);
extern int lcommunity_match(const struct lcommunity *, extern int lcommunity_match(const struct lcommunity *,
const struct lcommunity *); const struct lcommunity *);
extern char *lcommunity_str(struct lcommunity *); extern char *lcommunity_str(struct lcommunity *);
extern int lcommunity_include(struct lcommunity *lcom, u_char *ptr); extern int lcommunity_include(struct lcommunity *lcom, uint8_t *ptr);
extern void lcommunity_del_val(struct lcommunity *lcom, u_char *ptr); extern void lcommunity_del_val(struct lcommunity *lcom, uint8_t *ptr);
#endif /* _QUAGGA_BGP_LCOMMUNITY_H */ #endif /* _QUAGGA_BGP_LCOMMUNITY_H */

View File

@ -46,7 +46,7 @@
* Record maximum-paths configuration for BGP instance * Record maximum-paths configuration for BGP instance
*/ */
int bgp_maximum_paths_set(struct bgp *bgp, afi_t afi, safi_t safi, int peertype, 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)) if (!bgp || (afi >= AFI_MAX) || (safi >= SAFI_MAX))
return -1; 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 * 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) if (!binfo->mpath)
return 0; 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 * 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; struct bgp_info_mpath *mpath;
if (!count && !binfo->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_info *old_best, struct list *mp_list,
struct bgp_maxpaths_cfg *mpath_cfg) 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 listnode *mp_node, *mp_next_node;
struct bgp_info *cur_mpath, *new_mpath, *next_mpath, *prev_mpath; struct bgp_info *cur_mpath, *new_mpath, *next_mpath, *prev_mpath;
int mpath_changed, debug; int mpath_changed, debug;
@ -677,7 +677,7 @@ void bgp_info_mpath_aggregate_update(struct bgp_info *new_best,
struct aspath *aspath; struct aspath *aspath;
struct aspath *asmerge; struct aspath *asmerge;
struct attr *new_attr, *old_attr; struct attr *new_attr, *old_attr;
u_char origin; uint8_t origin;
struct community *community, *commerge; struct community *community, *commerge;
struct ecommunity *ecomm, *ecommerge; struct ecommunity *ecomm, *ecommerge;
struct lcommunity *lcomm, *lcommerge; struct lcommunity *lcomm, *lcommerge;

View File

@ -36,15 +36,15 @@ struct bgp_info_mpath {
struct bgp_info *mp_info; struct bgp_info *mp_info;
/* When attached to best path, the number of selected multipaths */ /* 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 */ /* Aggregated attribute for advertising multipath route */
struct attr *mp_attr; struct attr *mp_attr;
}; };
/* Functions to support maximum-paths configuration */ /* Functions to support maximum-paths configuration */
extern int bgp_maximum_paths_set(struct bgp *, afi_t, safi_t, int, u_int16_t, extern int bgp_maximum_paths_set(struct bgp *, afi_t, safi_t, int, uint16_t,
u_int16_t); uint16_t);
extern int bgp_maximum_paths_unset(struct bgp *, afi_t, safi_t, int); extern int bgp_maximum_paths_unset(struct bgp *, afi_t, safi_t, int);
/* Functions used by bgp_best_selection to record current /* 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 *); extern struct bgp_info *bgp_info_mpath_next(struct bgp_info *);
/* Accessors for multipath information */ /* 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 *); extern struct attr *bgp_info_mpath_attr(struct bgp_info *);
#endif /* _QUAGGA_BGP_MPATH_H */ #endif /* _QUAGGA_BGP_MPATH_H */

View File

@ -70,20 +70,20 @@ extern int argv_find_and_parse_vpnvx(struct cmd_token **argv, int argc,
return ret; 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; uint32_t l;
u_char *pnt = (u_char *)label_pnt; uint8_t *pnt = (uint8_t *)label_pnt;
l = ((u_int32_t)*pnt++ << 12); l = ((uint32_t)*pnt++ << 12);
l |= (u_int32_t)*pnt++ << 4; l |= (uint32_t)*pnt++ << 4;
l |= (u_int32_t)((*pnt & 0xf0) >> 4); l |= (uint32_t)((*pnt & 0xf0) >> 4);
return l; return l;
} }
void encode_label(mpls_label_t label, mpls_label_t *label_pnt) 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) if (pnt == NULL)
return; return;
*pnt++ = (label >> 12) & 0xff; *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, int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr,
struct bgp_nlri *packet) struct bgp_nlri *packet)
{ {
u_char *pnt; uint8_t *pnt;
u_char *lim; uint8_t *lim;
struct prefix p; struct prefix p;
int psize = 0; int psize = 0;
int prefixlen; int prefixlen;
u_int16_t type; uint16_t type;
struct rd_as rd_as; struct rd_as rd_as;
struct rd_ip rd_ip; struct rd_ip rd_ip;
struct prefix_rd prd; struct prefix_rd prd;
@ -107,7 +107,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr,
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
int addpath_encoded; int addpath_encoded;
u_int32_t addpath_id; uint32_t addpath_id;
/* Make prefix_rd */ /* Make prefix_rd */
prd.family = AF_UNSPEC; prd.family = AF_UNSPEC;
@ -340,8 +340,8 @@ static int ecom_intersect(struct ecommunity *e1, struct ecommunity *e2)
static struct bgp_info * static struct bgp_info *
leak_update(struct bgp *bgp, /* destination bgp instance */ leak_update(struct bgp *bgp, /* destination bgp instance */
struct bgp_node *bn, struct attr *new_attr, /* already interned */ struct bgp_node *bn, struct attr *new_attr, /* already interned */
afi_t afi, safi_t safi, struct bgp_info *source_bi, u_char type, afi_t afi, safi_t safi, struct bgp_info *source_bi, uint8_t type,
u_char sub_type, mpls_label_t *label, int num_labels, void *parent, uint8_t sub_type, mpls_label_t *label, int num_labels, void *parent,
struct bgp *bgp_orig, struct prefix *nexthop_orig, int debug) struct bgp *bgp_orig, struct prefix *nexthop_orig, int debug)
{ {
struct prefix *p = &bn->p; 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, 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, enum bgp_show_type type, void *output_arg, int tags,
u_char use_json) uint8_t use_json)
{ {
struct bgp *bgp; struct bgp *bgp;
struct bgp_table *table; struct bgp_table *table;
@ -1485,7 +1485,7 @@ DEFUN (show_ip_bgp_vpn_all_neighbor_routes,
union sockunion su; union sockunion su;
struct peer *peer; struct peer *peer;
int ret; int ret;
u_char uj = use_json(argc, argv); uint8_t uj = use_json(argc, argv);
afi_t afi; afi_t afi;
int idx = 0; int idx = 0;
@ -1549,7 +1549,7 @@ DEFUN (show_ip_bgp_vpn_rd_neighbor_routes,
union sockunion su; union sockunion su;
struct peer *peer; struct peer *peer;
struct prefix_rd prd; struct prefix_rd prd;
u_char uj = use_json(argc, argv); uint8_t uj = use_json(argc, argv);
afi_t afi; afi_t afi;
int idx = 0; int idx = 0;
@ -1627,7 +1627,7 @@ DEFUN (show_ip_bgp_vpn_all_neighbor_advertised_routes,
int ret; int ret;
struct peer *peer; struct peer *peer;
union sockunion su; union sockunion su;
u_char uj = use_json(argc, argv); uint8_t uj = use_json(argc, argv);
afi_t afi; afi_t afi;
int idx = 0; int idx = 0;
@ -1689,7 +1689,7 @@ DEFUN (show_ip_bgp_vpn_rd_neighbor_advertised_routes,
struct peer *peer; struct peer *peer;
struct prefix_rd prd; struct prefix_rd prd;
union sockunion su; union sockunion su;
u_char uj = use_json(argc, argv); uint8_t uj = use_json(argc, argv);
afi_t afi; afi_t afi;
int idx = 0; int idx = 0;

View File

@ -43,14 +43,14 @@
extern void bgp_mplsvpn_init(void); extern void bgp_mplsvpn_init(void);
extern int bgp_nlri_parse_vpn(struct peer *, struct attr *, struct bgp_nlri *); 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 void encode_label(mpls_label_t, mpls_label_t *);
extern int argv_find_and_parse_vpnvx(struct cmd_token **argv, int argc, extern int argv_find_and_parse_vpnvx(struct cmd_token **argv, int argc,
int *index, afi_t *afi); int *index, afi_t *afi);
extern int bgp_show_mpls_vpn(struct vty *vty, afi_t afi, struct prefix_rd *prd, extern int bgp_show_mpls_vpn(struct vty *vty, afi_t afi, struct prefix_rd *prd,
enum bgp_show_type type, void *output_arg, 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, extern void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, struct bgp *bgp_vrf,
struct bgp_info *info_vrf); struct bgp_info *info_vrf);

View File

@ -38,13 +38,13 @@
/* BGP nexthop cache value structure. */ /* BGP nexthop cache value structure. */
struct bgp_nexthop_cache { struct bgp_nexthop_cache {
/* IGP route's metric. */ /* IGP route's metric. */
u_int32_t metric; uint32_t metric;
/* Nexthop number and nexthop linked list.*/ /* Nexthop number and nexthop linked list.*/
u_char nexthop_num; uint8_t nexthop_num;
struct nexthop *nexthop; struct nexthop *nexthop;
time_t last_update; time_t last_update;
u_int16_t flags; uint16_t flags;
#define BGP_NEXTHOP_VALID (1 << 0) #define BGP_NEXTHOP_VALID (1 << 0)
#define BGP_NEXTHOP_REGISTERED (1 << 1) #define BGP_NEXTHOP_REGISTERED (1 << 1)
@ -53,7 +53,7 @@ struct bgp_nexthop_cache {
#define BGP_STATIC_ROUTE (1 << 4) #define BGP_STATIC_ROUTE (1 << 4)
#define BGP_STATIC_ROUTE_EXACT_MATCH (1 << 5) #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_CHANGED (1 << 0)
#define BGP_NEXTHOP_METRIC_CHANGED (1 << 1) #define BGP_NEXTHOP_METRIC_CHANGED (1 << 1)

View File

@ -51,8 +51,8 @@
Next, if we send capability to the peer we want to set my capabilty Next, if we send capability to the peer we want to set my capabilty
inforation at each peer. */ inforation at each peer. */
void bgp_capability_vty_out(struct vty *vty, struct peer *peer, u_char use_json, void bgp_capability_vty_out(struct vty *vty, struct peer *peer,
json_object *json_neigh) uint8_t use_json, json_object *json_neigh)
{ {
char *pnt; char *pnt;
char *end; 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, static void bgp_capability_orf_not_support(struct peer *peer, iana_afi_t afi,
iana_safi_t safi, u_char type, iana_safi_t safi, uint8_t type,
u_char mode) uint8_t mode)
{ {
if (bgp_debug_neighbor_events(peer)) if (bgp_debug_neighbor_events(peer))
zlog_debug( zlog_debug(
@ -295,15 +295,15 @@ static int bgp_capability_orf_entry(struct peer *peer,
{ {
struct stream *s = BGP_INPUT(peer); struct stream *s = BGP_INPUT(peer);
struct capability_mp_data mpc; struct capability_mp_data mpc;
u_char num; uint8_t num;
iana_afi_t pkt_afi; iana_afi_t pkt_afi;
afi_t afi; afi_t afi;
iana_safi_t pkt_safi; iana_safi_t pkt_safi;
safi_t safi; safi_t safi;
u_char type; uint8_t type;
u_char mode; uint8_t mode;
u_int16_t sm_cap = 0; /* capability send-mode receive */ uint16_t sm_cap = 0; /* capability send-mode receive */
u_int16_t rm_cap = 0; /* capability receive-mode receive */ uint16_t rm_cap = 0; /* capability receive-mode receive */
int i; int i;
/* ORF Entry header */ /* ORF Entry header */
@ -433,7 +433,7 @@ static int bgp_capability_restart(struct peer *peer,
struct capability_header *caphdr) struct capability_header *caphdr)
{ {
struct stream *s = BGP_INPUT(peer); 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; size_t end = stream_get_getp(s) + caphdr->length;
/* Verify length is a multiple of 4 */ /* Verify length is a multiple of 4 */
@ -468,7 +468,7 @@ static int bgp_capability_restart(struct peer *peer,
safi_t safi; safi_t safi;
iana_afi_t pkt_afi = stream_getw(s); iana_afi_t pkt_afi = stream_getw(s);
iana_safi_t pkt_safi = stream_getc(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. */ /* Convert AFI, SAFI to internal values, check. */
if (bgp_map_afi_safi_iana2int(pkt_afi, pkt_safi, &afi, &safi)) { 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; safi_t safi;
iana_afi_t pkt_afi = stream_getw(s); iana_afi_t pkt_afi = stream_getw(s);
iana_safi_t pkt_safi = stream_getc(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)) if (bgp_debug_neighbor_events(peer))
zlog_debug( zlog_debug(
@ -659,7 +659,7 @@ static int bgp_capability_hostname(struct peer *peer,
struct stream *s = BGP_INPUT(peer); struct stream *s = BGP_INPUT(peer);
char str[BGP_MAX_HOSTNAME + 1]; char str[BGP_MAX_HOSTNAME + 1];
size_t end = stream_get_getp(s) + hdr->length; size_t end = stream_get_getp(s) + hdr->length;
u_char len; uint8_t len;
SET_FLAG(peer->cap, PEER_CAP_HOSTNAME_RCV); SET_FLAG(peer->cap, PEER_CAP_HOSTNAME_RCV);
@ -788,7 +788,7 @@ static const size_t cap_modsizes[] = {
* capabilities were encountered. * capabilities were encountered.
*/ */
static int bgp_capability_parse(struct peer *peer, size_t length, 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; int ret;
struct stream *s = BGP_INPUT(peer); 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) { while (stream_get_getp(s) < end) {
size_t start; size_t start;
u_char *sp = stream_pnt(s); uint8_t *sp = stream_pnt(s);
struct capability_header caphdr; struct capability_header caphdr;
ret = 0; 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. /* peek into option, stores ASN to *as4 if the AS4 capability was found.
* Returns 0 if no as4 found, as4cap value otherwise. * 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); struct stream *s = BGP_INPUT(peer);
size_t orig_getp = stream_get_getp(s); 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. * correctly formatted options.
*/ */
while (stream_get_getp(s) < end) { while (stream_get_getp(s) < end) {
u_char opt_type; uint8_t opt_type;
u_char opt_length; uint8_t opt_length;
/* Check the length. */ /* Check the length. */
if (stream_get_getp(s) + 2 > end) if (stream_get_getp(s) + 2 > end)
@ -1064,11 +1064,11 @@ end:
* *
* @param[out] mp_capability @see bgp_capability_parse() for semantics. * @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; int ret = 0;
u_char *error; uint8_t *error;
u_char error_data[BGP_MAX_PACKET_SIZE]; uint8_t error_data[BGP_MAX_PACKET_SIZE];
struct stream *s = BGP_INPUT(peer); struct stream *s = BGP_INPUT(peer);
size_t end = stream_get_getp(s) + length; 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); peer->host, length);
while (stream_get_getp(s) < end) { while (stream_get_getp(s) < end) {
u_char opt_type; uint8_t opt_type;
u_char opt_length; uint8_t opt_length;
/* Must have at least an OPEN option header */ /* Must have at least an OPEN option header */
if (STREAM_READABLE(s) < 2) { 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, 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; uint8_t cap_len;
u_char orf_len; uint8_t orf_len;
unsigned long capp; unsigned long capp;
unsigned long orfp; unsigned long orfp;
unsigned long numberp; 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. */ /* Fill in capability open option to the packet. */
void bgp_open_capability(struct stream *s, struct peer *peer) void bgp_open_capability(struct stream *s, struct peer *peer)
{ {
u_char len; uint8_t len;
unsigned long cp, capp, rcapp; unsigned long cp, capp, rcapp;
iana_afi_t pkt_afi; iana_afi_t pkt_afi;
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
iana_safi_t pkt_safi; iana_safi_t pkt_safi;
as_t local_as; as_t local_as;
u_int32_t restart_time; uint32_t restart_time;
u_char afi_safi_count = 0; uint8_t afi_safi_count = 0;
int adv_addpath_tx = 0; int adv_addpath_tx = 0;
/* Remember current pointer for Opt Parm Len. */ /* Remember current pointer for Opt Parm Len. */

View File

@ -23,14 +23,14 @@
/* Standard header for capability TLV */ /* Standard header for capability TLV */
struct capability_header { struct capability_header {
u_char code; uint8_t code;
u_char length; uint8_t length;
}; };
/* Generic MP capability data */ /* Generic MP capability data */
struct capability_mp_data { struct capability_mp_data {
uint16_t afi; /* iana_afi_t */ uint16_t afi; /* iana_afi_t */
u_char reserved; uint8_t reserved;
uint8_t safi; /* iana_safi_t */ uint8_t safi; /* iana_safi_t */
}; };
@ -41,11 +41,11 @@ struct capability_as4 {
struct graceful_restart_af { struct graceful_restart_af {
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
u_char flag; uint8_t flag;
}; };
struct capability_gr { struct capability_gr {
u_int16_t restart_flag_time; uint16_t restart_flag_time;
struct graceful_restart_af gr[]; struct graceful_restart_af gr[];
}; };
@ -93,10 +93,10 @@ struct capability_gr {
#define RESTART_R_BIT 0x8000 #define RESTART_R_BIT 0x8000
#define RESTART_F_BIT 0x80 #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_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 *); 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 */ #endif /* _QUAGGA_BGP_OPEN_H */

View File

@ -67,7 +67,7 @@
* @param type the packet type * @param type the packet type
* @return the size of the stream * @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; int i;
@ -497,7 +497,7 @@ void bgp_keepalive_send(struct peer *peer)
void bgp_open_send(struct peer *peer) void bgp_open_send(struct peer *peer)
{ {
struct stream *s; struct stream *s;
u_int16_t send_holdtime; uint16_t send_holdtime;
as_t local_as; as_t local_as;
if (PEER_OR_GROUP_TIMER_SET(peer)) if (PEER_OR_GROUP_TIMER_SET(peer))
@ -518,8 +518,7 @@ void bgp_open_send(struct peer *peer)
/* Set open packet values. */ /* Set open packet values. */
stream_putc(s, BGP_VERSION_4); /* BGP version */ stream_putc(s, BGP_VERSION_4); /* BGP version */
stream_putw(s, stream_putw(s, (local_as <= BGP_AS_MAX) ? (uint16_t)local_as
(local_as <= BGP_AS_MAX) ? (u_int16_t)local_as
: BGP_AS_TRANS); : BGP_AS_TRANS);
stream_putw(s, send_holdtime); /* Hold Time */ stream_putw(s, send_holdtime); /* Hold Time */
stream_put_in_addr(s, &peer->local_id); /* BGP Identifier */ 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) static int bgp_write_notify(struct peer *peer)
{ {
int ret, val; int ret, val;
u_char type; uint8_t type;
struct stream *s; struct stream *s;
/* There should be at least one packet. */ /* There should be at least one packet. */
@ -643,8 +642,8 @@ static int bgp_write_notify(struct peer *peer)
* @param data Data portion * @param data Data portion
* @param datalen length of data portion * @param datalen length of data portion
*/ */
void bgp_notify_send_with_data(struct peer *peer, u_char code, u_char sub_code, void bgp_notify_send_with_data(struct peer *peer, uint8_t code,
u_char *data, size_t datalen) uint8_t sub_code, uint8_t *data, size_t datalen)
{ {
struct stream *s; struct stream *s;
int length; 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 code BGP error code
* @param sub_code BGP error subcode * @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); 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 * @param remove Whether to remove ORF for specified AFI/SAFI
*/ */
void bgp_route_refresh_send(struct peer *peer, afi_t afi, safi_t 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 stream *s;
struct bgp_filter *filter; 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 (orf_type == ORF_TYPE_PREFIX || orf_type == ORF_TYPE_PREFIX_OLD)
if (remove || filter->plist[FILTER_IN].plist) { if (remove || filter->plist[FILTER_IN].plist) {
u_int16_t orf_len; uint16_t orf_len;
unsigned long orfp; unsigned long orfp;
orf_refresh = 1; 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) static int bgp_open_receive(struct peer *peer, bgp_size_t size)
{ {
int ret; int ret;
u_char version; uint8_t version;
u_char optlen; uint8_t optlen;
u_int16_t holdtime; uint16_t holdtime;
u_int16_t send_holdtime; uint16_t send_holdtime;
as_t remote_as; as_t remote_as;
as_t as4 = 0; as_t as4 = 0;
struct in_addr remote_id; struct in_addr remote_id;
int mp_capability; int mp_capability;
u_int8_t notify_data_remote_as[2]; uint8_t notify_data_remote_as[2];
u_int8_t notify_data_remote_as4[4]; uint8_t notify_data_remote_as4[4];
u_int8_t notify_data_remote_id[4]; uint8_t notify_data_remote_id[4];
u_int16_t *holdtime_ptr; uint16_t *holdtime_ptr;
/* Parse open packet. */ /* Parse open packet. */
version = stream_getc(peer->curr); version = stream_getc(peer->curr);
memcpy(notify_data_remote_as, stream_pnt(peer->curr), 2); memcpy(notify_data_remote_as, stream_pnt(peer->curr), 2);
remote_as = stream_getw(peer->curr); 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); holdtime = stream_getw(peer->curr);
memcpy(notify_data_remote_id, stream_pnt(peer->curr), 4); memcpy(notify_data_remote_id, stream_pnt(peer->curr), 4);
remote_id.s_addr = stream_get_ipv4(peer->curr); 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. */ /* Peer BGP version check. */
if (version != BGP_VERSION_4) { 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 */ /* XXX this reply may not be correct if version < 4 XXX */
if (bgp_debug_neighbor_events(peer)) if (bgp_debug_neighbor_events(peer))
zlog_debug( 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 */ /* Data must be in network byte order here */
bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR, bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_UNSUP_VERSION, BGP_NOTIFY_OPEN_UNSUP_VERSION,
(u_int8_t *)&maxver, 2); (uint8_t *)&maxver, 2);
return BGP_Stop; return BGP_Stop;
} }
@ -1225,7 +1225,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
if (holdtime < 3 && holdtime != 0) { if (holdtime < 3 && holdtime != 0) {
bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR, bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_UNACEP_HOLDTIME, BGP_NOTIFY_OPEN_UNACEP_HOLDTIME,
(u_char *)holdtime_ptr, 2); (uint8_t *)holdtime_ptr, 2);
return BGP_Stop; 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) static int bgp_update_receive(struct peer *peer, bgp_size_t size)
{ {
int ret, nlri_ret; int ret, nlri_ret;
u_char *end; uint8_t *end;
struct stream *s; struct stream *s;
struct attr attr; struct attr attr;
bgp_size_t attribute_len; 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)); stream_getc(peer->curr));
strcpy(bgp_notify.data, c); 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"); 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) { if (size != BGP_MSG_ROUTE_REFRESH_MIN_SIZE - BGP_HEADER_SIZE) {
u_char *end; uint8_t *end;
u_char when_to_refresh; uint8_t when_to_refresh;
u_char orf_type; uint8_t orf_type;
u_int16_t orf_len; uint16_t orf_len;
if (size - (BGP_MSG_ROUTE_REFRESH_MIN_SIZE - BGP_HEADER_SIZE) if (size - (BGP_MSG_ROUTE_REFRESH_MIN_SIZE - BGP_HEADER_SIZE)
< 5) { < 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_pnt = stream_pnt(s);
uint8_t *p_end = stream_pnt(s) + orf_len; uint8_t *p_end = stream_pnt(s) + orf_len;
struct orf_prefix orfp; struct orf_prefix orfp;
u_char common = 0; uint8_t common = 0;
u_int32_t seq; uint32_t seq;
int psize; int psize;
char name[BUFSIZ]; char name[BUFSIZ];
int ret = CMD_SUCCESS; int ret = CMD_SUCCESS;
@ -1839,12 +1839,12 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
name); name);
break; break;
} }
ok = ((u_int32_t)(p_end - p_pnt) ok = ((uint32_t)(p_end - p_pnt)
>= sizeof(u_int32_t)); >= sizeof(uint32_t));
if (ok) { if (ok) {
memcpy(&seq, p_pnt, memcpy(&seq, p_pnt,
sizeof(u_int32_t)); sizeof(uint32_t));
p_pnt += sizeof(u_int32_t); p_pnt += sizeof(uint32_t);
orfp.seq = ntohl(seq); orfp.seq = ntohl(seq);
} else } else
p_pnt = p_end; 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 * @param size size of the packet
* @return as in summary * @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) bgp_size_t length)
{ {
u_char *end; uint8_t *end;
struct capability_mp_data mpc; struct capability_mp_data mpc;
struct capability_header *hdr; struct capability_header *hdr;
u_char action; uint8_t action;
iana_afi_t pkt_afi; iana_afi_t pkt_afi;
afi_t afi; afi_t afi;
iana_safi_t pkt_safi; 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) int bgp_capability_receive(struct peer *peer, bgp_size_t size)
{ {
u_char *pnt; uint8_t *pnt;
/* Fetch pointer. */ /* Fetch pointer. */
pnt = stream_pnt(peer->curr); pnt = stream_pnt(peer->curr);
@ -2171,7 +2171,7 @@ int bgp_process_packet(struct thread *thread)
unsigned int processed = 0; unsigned int processed = 0;
while (processed < rpkt_quanta_old) { while (processed < rpkt_quanta_old) {
u_char type = 0; uint8_t type = 0;
bgp_size_t size; bgp_size_t size;
char notify_data_length[2]; char notify_data_length[2];

View File

@ -39,11 +39,11 @@
/* Packet send and receive function prototypes. */ /* Packet send and receive function prototypes. */
extern void bgp_keepalive_send(struct peer *); extern void bgp_keepalive_send(struct peer *);
extern void bgp_open_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(struct peer *, uint8_t, uint8_t);
extern void bgp_notify_send_with_data(struct peer *, u_int8_t, u_int8_t, extern void bgp_notify_send_with_data(struct peer *, uint8_t, uint8_t,
u_int8_t *, size_t); uint8_t *, size_t);
extern void bgp_route_refresh_send(struct peer *, afi_t, safi_t, u_char, u_char, extern void bgp_route_refresh_send(struct peer *, afi_t, safi_t, uint8_t,
int); uint8_t, int);
extern void bgp_capability_send(struct peer *, afi_t, safi_t, int, 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, extern void bgp_default_update_send(struct peer *, struct attr *, afi_t, safi_t,
struct peer *); 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_update_implicit_eors(struct peer *);
extern void bgp_check_update_delay(struct bgp *); 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_packet_set_size(struct stream *s);
extern int bgp_generate_updgrp_packets(struct thread *); extern int bgp_generate_updgrp_packets(struct thread *);

View File

@ -36,57 +36,57 @@
#include "bgpd/rfapi/rfapi_backend.h" #include "bgpd/rfapi/rfapi_backend.h"
#endif #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 #if ENABLE_BGP_VNC
/* /*
* VNC L2 stores LHI in lower byte, so omit it * VNC L2 stores LHI in lower byte, so omit it
*/ */
if (v != RD_TYPE_VNC_ETH) if (v != RD_TYPE_VNC_ETH)
v |= (u_int16_t)*pnt; v |= (uint16_t)*pnt;
#else /* duplicate code for clarity */ #else /* duplicate code for clarity */
v |= (u_int16_t)*pnt; v |= (uint16_t)*pnt;
#endif #endif
return v; 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 */ /* 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 = (uint16_t)*pnt++ << 8;
rd_as->as |= (u_int16_t)*pnt++; rd_as->as |= (uint16_t)*pnt++;
ptr_get_be32(pnt, &rd_as->val); ptr_get_be32(pnt, &rd_as->val);
} }
/* type == RD_TYPE_AS4 */ /* 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); pnt = ptr_get_be32(pnt, &rd_as->as);
rd_as->val = ((u_int16_t)*pnt++ << 8); rd_as->val = ((uint16_t)*pnt++ << 8);
rd_as->val |= (u_int16_t)*pnt; rd_as->val |= (uint16_t)*pnt;
} }
/* type == RD_TYPE_IP */ /* 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); memcpy(&rd_ip->ip, pnt, 4);
pnt += 4; pnt += 4;
rd_ip->val = ((u_int16_t)*pnt++ << 8); rd_ip->val = ((uint16_t)*pnt++ << 8);
rd_ip->val |= (u_int16_t)*pnt; rd_ip->val |= (uint16_t)*pnt;
} }
#if ENABLE_BGP_VNC #if ENABLE_BGP_VNC
/* type == RD_TYPE_VNC_ETH */ /* 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->type = RD_TYPE_VNC_ETH;
rd_vnc_eth->local_nve_id = pnt[1]; 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) char *prefix_rd2str(struct prefix_rd *prd, char *buf, size_t size)
{ {
u_char *pnt; uint8_t *pnt;
u_int16_t type; uint16_t type;
struct rd_as rd_as; struct rd_as rd_as;
struct rd_ip rd_ip; struct rd_ip rd_ip;

View File

@ -35,33 +35,33 @@
#define RD_ADDRSTRLEN 28 #define RD_ADDRSTRLEN 28
struct rd_as { struct rd_as {
u_int16_t type; uint16_t type;
as_t as; as_t as;
u_int32_t val; uint32_t val;
}; };
struct rd_ip { struct rd_ip {
u_int16_t type; uint16_t type;
struct in_addr ip; struct in_addr ip;
u_int16_t val; uint16_t val;
}; };
#if ENABLE_BGP_VNC #if ENABLE_BGP_VNC
struct rd_vnc_eth { struct rd_vnc_eth {
u_int16_t type; uint16_t type;
uint8_t local_nve_id; uint8_t local_nve_id;
struct ethaddr macaddr; struct ethaddr macaddr;
}; };
#endif #endif
extern u_int16_t decode_rd_type(u_char *pnt); extern uint16_t decode_rd_type(uint8_t *pnt);
extern void encode_rd_type(u_int16_t, u_char *); 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_as(uint8_t *pnt, struct rd_as *rd_as);
extern void decode_rd_as4(u_char *pnt, struct rd_as *rd_as); extern void decode_rd_as4(uint8_t *pnt, struct rd_as *rd_as);
extern void decode_rd_ip(u_char *pnt, struct rd_ip *rd_ip); extern void decode_rd_ip(uint8_t *pnt, struct rd_ip *rd_ip);
#if ENABLE_BGP_VNC #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 #endif
extern int str2prefix_rd(const char *, struct prefix_rd *); extern int str2prefix_rd(const char *, struct prefix_rd *);

View File

@ -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. /* Set/unset bgp_info flags, adjusting any other state as needed.
* This is here primarily to keep prefix-count in check. * 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); 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, 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); 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 /* Get MED value. If MED value is missing and "bgp bestpath
missing-as-worst" is specified, treat it as the worst value. */ 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)) if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC))
return attr->med; return attr->med;
@ -397,12 +397,12 @@ static int bgp_info_cmp(struct bgp *bgp, struct bgp_info *new,
struct attr *newattr, *existattr; struct attr *newattr, *existattr;
bgp_peer_sort_t new_sort; bgp_peer_sort_t new_sort;
bgp_peer_sort_t exist_sort; bgp_peer_sort_t exist_sort;
u_int32_t new_pref; uint32_t new_pref;
u_int32_t exist_pref; uint32_t exist_pref;
u_int32_t new_med; uint32_t new_med;
u_int32_t exist_med; uint32_t exist_med;
u_int32_t new_weight; uint32_t new_weight;
u_int32_t exist_weight; uint32_t exist_weight;
uint32_t newm, existm; uint32_t newm, existm;
struct in_addr new_id; struct in_addr new_id;
struct in_addr exist_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; int ret = 0;
char new_buf[PATH_ADDPATH_STR_BUFFER]; char new_buf[PATH_ADDPATH_STR_BUFFER];
char exist_buf[PATH_ADDPATH_STR_BUFFER]; char exist_buf[PATH_ADDPATH_STR_BUFFER];
u_int32_t new_mm_seq; uint32_t new_mm_seq;
u_int32_t exist_mm_seq; uint32_t exist_mm_seq;
*paths_eq = 0; *paths_eq = 0;
@ -1181,7 +1181,7 @@ static int bgp_output_modifier(struct peer *peer, struct prefix *p,
struct bgp_info info; struct bgp_info info;
route_map_result_t ret; route_map_result_t ret;
struct route_map *rmap = NULL; 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 * 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) if (family == AF_INET)
attr->nexthop.s_addr = 0; 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, int subgroup_process_announce_selected(struct update_subgroup *subgrp,
struct bgp_info *selected, struct bgp_info *selected,
struct bgp_node *rn, struct bgp_node *rn,
u_int32_t addpath_tx_id) uint32_t addpath_tx_id)
{ {
struct prefix *p; struct prefix *p;
struct peer *onlypeer; 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_afi = afi_int2iana(afi);
pkt_safi = safi_int2iana(safi); pkt_safi = safi_int2iana(safi);
{ {
u_int8_t ndata[7]; uint8_t ndata[7];
ndata[0] = (pkt_afi >> 8); ndata[0] = (pkt_afi >> 8);
ndata[1] = pkt_afi; 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); 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 peer *peer, struct attr *attr,
struct bgp_node *rn) 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; 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, struct attr *attr, afi_t afi, safi_t safi, int type,
int sub_type, struct prefix_rd *prd, mpls_label_t *label, 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) struct bgp_route_evpn *evpn)
{ {
int ret; int ret;
@ -3424,10 +3424,10 @@ filtered:
return 0; 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, struct attr *attr, afi_t afi, safi_t safi, int type,
int sub_type, struct prefix_rd *prd, mpls_label_t *label, 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; struct bgp *bgp;
char pfx_buf[BGP_PRD_PATH_STRLEN]; 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; continue;
struct bgp_info *ri = rn->info; struct bgp_info *ri = rn->info;
u_int32_t num_labels = 0; uint32_t num_labels = 0;
mpls_label_t *label_pnt = NULL; mpls_label_t *label_pnt = NULL;
if (ri && ri->extra) 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, int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr,
struct bgp_nlri *packet) struct bgp_nlri *packet)
{ {
u_char *pnt; uint8_t *pnt;
u_char *lim; uint8_t *lim;
struct prefix p; struct prefix p;
int psize; int psize;
int ret; int ret;
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
int addpath_encoded; int addpath_encoded;
u_int32_t addpath_id; uint32_t addpath_id;
pnt = packet->nlri; pnt = packet->nlri;
lim = pnt + packet->length; lim = pnt + packet->length;
@ -4548,7 +4548,7 @@ static void bgp_static_update_safi(struct bgp *bgp, struct prefix *p,
#if ENABLE_BGP_VNC #if ENABLE_BGP_VNC
mpls_label_t label = 0; mpls_label_t label = 0;
#endif #endif
u_int32_t num_labels = 0; uint32_t num_labels = 0;
union gw_addr add; union gw_addr add;
assert(bgp_static); 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. */ route should be installed as valid. */
static int bgp_static_set(struct vty *vty, const char *negate, static int bgp_static_set(struct vty *vty, const char *negate,
const char *ip_str, afi_t afi, safi_t safi, 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); VTY_DECLVAR_CONTEXT(bgp, bgp);
int ret; int ret;
struct prefix p; struct prefix p;
struct bgp_static *bgp_static; struct bgp_static *bgp_static;
struct bgp_node *rn; struct bgp_node *rn;
u_char need_update = 0; uint8_t need_update = 0;
/* Convert IP prefix string to struct prefix. */ /* Convert IP prefix string to struct prefix. */
ret = str2prefix(ip_str, &p); ret = str2prefix(ip_str, &p);
@ -5329,10 +5329,10 @@ DEFPY(ipv6_bgp_network,
*/ */
struct bgp_aggregate { struct bgp_aggregate {
/* Summary-only flag. */ /* Summary-only flag. */
u_char summary_only; uint8_t summary_only;
/* AS set generation. */ /* AS set generation. */
u_char as_set; uint8_t as_set;
/* Route-map for aggregated route. */ /* Route-map for aggregated route. */
struct route_map *map; 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_table *table;
struct bgp_node *top; struct bgp_node *top;
struct bgp_node *rn; struct bgp_node *rn;
u_char origin; uint8_t origin;
struct aspath *aspath = NULL; struct aspath *aspath = NULL;
struct aspath *asmerge = NULL; struct aspath *asmerge = NULL;
struct community *community = NULL; struct community *community = NULL;
struct community *commerge = NULL; struct community *commerge = NULL;
#if defined(AGGREGATE_NEXTHOP_CHECK) #if defined(AGGREGATE_NEXTHOP_CHECK)
struct in_addr nexthop; struct in_addr nexthop;
u_int32_t med = 0; uint32_t med = 0;
#endif #endif
struct bgp_info *ri; struct bgp_info *ri;
struct bgp_info *new; struct bgp_info *new;
int first = 1; int first = 1;
unsigned long match = 0; unsigned long match = 0;
u_char atomic_aggregate = 0; uint8_t atomic_aggregate = 0;
/* Record adding route's nexthop and med. */ /* Record adding route's nexthop and med. */
if (rinew) { 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 *new;
struct bgp_info *ri; struct bgp_info *ri;
unsigned long match; unsigned long match;
u_char origin = BGP_ORIGIN_IGP; uint8_t origin = BGP_ORIGIN_IGP;
struct aspath *aspath = NULL; struct aspath *aspath = NULL;
struct aspath *asmerge = NULL; struct aspath *asmerge = NULL;
struct community *community = NULL; struct community *community = NULL;
struct community *commerge = NULL; struct community *commerge = NULL;
u_char atomic_aggregate = 0; uint8_t atomic_aggregate = 0;
table = bgp->rib[afi][safi]; 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, 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); VTY_DECLVAR_CONTEXT(bgp, bgp);
int ret; int ret;
@ -6039,7 +6039,8 @@ DEFUN (no_ipv6_aggregate_address,
void bgp_redistribute_add(struct bgp *bgp, struct prefix *p, void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
const union g_addr *nexthop, ifindex_t ifindex, const union g_addr *nexthop, ifindex_t ifindex,
enum nexthop_types_t nhtype, uint32_t metric, 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 *new;
struct bgp_info *bi; struct bgp_info *bi;
@ -6196,8 +6197,8 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
aspath_unintern(&attr.aspath); aspath_unintern(&attr.aspath);
} }
void bgp_redistribute_delete(struct bgp *bgp, struct prefix *p, u_char type, void bgp_redistribute_delete(struct bgp *bgp, struct prefix *p, uint8_t type,
u_short instance) unsigned short instance)
{ {
afi_t afi; afi_t afi;
struct bgp_node *rn; 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. */ /* Withdraw specified route type's route. */
void bgp_redistribute_withdraw(struct bgp *bgp, afi_t afi, int type, void bgp_redistribute_withdraw(struct bgp *bgp, afi_t afi, int type,
u_short instance) unsigned short instance)
{ {
struct bgp_node *rn; struct bgp_node *rn;
struct bgp_info *ri; struct bgp_info *ri;
@ -6266,7 +6267,7 @@ static void route_vty_out_route(struct prefix *p, struct vty *vty,
json_object *json) json_object *json)
{ {
int len = 0; int len = 0;
u_int32_t destination; uint32_t destination;
char buf[BUFSIZ]; char buf[BUFSIZ];
if (p->family == AF_INET) { 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 */ /* called from terminal list command */
void route_vty_out_tmp(struct vty *vty, struct prefix *p, struct attr *attr, 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_status = NULL;
json_object *json_net = NULL; json_object *json_net = NULL;
@ -7019,7 +7020,7 @@ void route_vty_out_overlay(struct vty *vty, struct prefix *p,
/* dampening route */ /* dampening route */
static void damp_route_vty_out(struct vty *vty, struct prefix *p, static void damp_route_vty_out(struct vty *vty, struct prefix *p,
struct bgp_info *binfo, int display, safi_t safi, 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 attr *attr;
int len; int len;
@ -7082,7 +7083,7 @@ static void damp_route_vty_out(struct vty *vty, struct prefix *p,
/* flap route */ /* flap route */
static void flap_route_vty_out(struct vty *vty, struct prefix *p, static void flap_route_vty_out(struct vty *vty, struct prefix *p,
struct bgp_info *binfo, int display, safi_t safi, 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 attr *attr;
struct bgp_damp_info *bdi; 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, static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
struct bgp_table *table, enum bgp_show_type type, 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, int is_last, unsigned long *output_cum,
unsigned long *total_cum, unsigned long *total_cum,
unsigned long *json_header_depth) unsigned long *json_header_depth)
@ -8180,7 +8181,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
continue; continue;
} }
if (type == bgp_show_type_cidr_only) { if (type == bgp_show_type_cidr_only) {
u_int32_t destination; uint32_t destination;
destination = ntohl(rn->p.u.prefix4.s_addr); destination = ntohl(rn->p.u.prefix4.s_addr);
if (IN_CLASSC(destination) 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, int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, safi_t safi,
struct bgp_table *table, struct prefix_rd *prd_match, struct bgp_table *table, struct prefix_rd *prd_match,
enum bgp_show_type type, void *output_arg, enum bgp_show_type type, void *output_arg,
u_char use_json) uint8_t use_json)
{ {
struct bgp_node *rn, *next; struct bgp_node *rn, *next;
unsigned long output_cum = 0; 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; return CMD_SUCCESS;
} }
static int bgp_show(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, 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; struct bgp_table *table;
unsigned long json_header_depth = 0; 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, 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 listnode *node, *nnode;
struct bgp *bgp; 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, struct bgp_table *rib, const char *ip_str,
afi_t afi, safi_t safi, afi_t afi, safi_t safi,
struct prefix_rd *prd, int prefix_check, 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 ret;
int header; 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, 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, afi_t afi, safi_t safi, struct prefix_rd *prd,
int prefix_check, enum bgp_path_type pathtype, int prefix_check, enum bgp_path_type pathtype,
u_char use_json) uint8_t use_json)
{ {
if (!bgp) { if (!bgp) {
bgp = bgp_get_default(); 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, static int bgp_show_lcommunity(struct vty *vty, struct bgp *bgp, int argc,
struct cmd_token **argv, afi_t afi, safi_t safi, struct cmd_token **argv, afi_t afi, safi_t safi,
u_char uj) uint8_t uj)
{ {
struct lcommunity *lcom; struct lcommunity *lcom;
struct buffer *b; 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, static int bgp_show_lcommunity_list(struct vty *vty, struct bgp *bgp,
const char *lcom, afi_t afi, safi_t safi, const char *lcom, afi_t afi, safi_t safi,
u_char uj) uint8_t uj)
{ {
struct community_list *list; struct community_list *list;
@ -9126,7 +9128,7 @@ DEFUN (show_ip_bgp_route,
char *prefix = NULL; char *prefix = NULL;
struct bgp *bgp = NULL; struct bgp *bgp = NULL;
enum bgp_path_type path_type; enum bgp_path_type path_type;
u_char uj = use_json(argc, argv); uint8_t uj = use_json(argc, argv);
int idx = 0; 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, 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; int ret;
struct peer *peer; 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, 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}; struct peer_pcounts pcounts = {.peer = peer};
unsigned int i; unsigned int i;
@ -9908,7 +9910,7 @@ DEFUN (show_ip_bgp_vpn_neighbor_prefix_counts,
{ {
int idx_peer = 6; int idx_peer = 6;
struct peer *peer; 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); peer = peer_lookup_in_view(vty, NULL, argv[idx_peer]->arg, uj);
if (!peer) 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, static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi,
safi_t safi, int in, const char *rmap_name, 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_table *table;
struct bgp_adj_in *ain; 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, static int peer_adj_routes(struct vty *vty, struct peer *peer, afi_t afi,
safi_t safi, int in, const char *rmap_name, safi_t safi, int in, const char *rmap_name,
u_char use_json) uint8_t use_json)
{ {
json_object *json = NULL; json_object *json = NULL;
@ -10347,7 +10349,7 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter,
argv_find(argv, argc, "neighbors", &idx); argv_find(argv, argc, "neighbors", &idx);
peerstr = argv[++idx]->arg; peerstr = argv[++idx]->arg;
u_char uj = use_json(argc, argv); uint8_t uj = use_json(argc, argv);
ret = str2sockunion(peerstr, &su); ret = str2sockunion(peerstr, &su);
if (ret < 0) { 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, static int bgp_show_neighbor_route(struct vty *vty, struct peer *peer,
afi_t afi, safi_t safi, 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 */ /* labeled-unicast routes live in the unicast table */
if (safi == SAFI_LABELED_UNICAST) if (safi == SAFI_LABELED_UNICAST)
@ -10476,7 +10478,7 @@ struct bgp_table *bgp_distance_table[AFI_MAX][SAFI_MAX];
struct bgp_distance { struct bgp_distance {
/* Distance value for the IP source prefix. */ /* Distance value for the IP source prefix. */
u_char distance; uint8_t distance;
/* Name of the access-list to be matched. */ /* Name of the access-list to be matched. */
char *access_list; char *access_list;
@ -10532,7 +10534,7 @@ static int bgp_distance_set(struct vty *vty, const char *distance_str,
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
struct prefix p; struct prefix p;
u_char distance; uint8_t distance;
struct bgp_node *rn; struct bgp_node *rn;
struct bgp_distance *bdistance; struct bgp_distance *bdistance;
@ -10619,7 +10621,7 @@ static int bgp_distance_unset(struct vty *vty, const char *distance_str,
} }
/* Apply BGP information to distance method. */ /* Apply BGP information to distance method. */
u_char bgp_distance_apply(struct prefix *p, struct bgp_info *rinfo, afi_t afi, uint8_t bgp_distance_apply(struct prefix *p, struct bgp_info *rinfo, afi_t afi,
safi_t safi, struct bgp *bgp) safi_t safi, struct bgp *bgp)
{ {
struct bgp_node *rn; struct bgp_node *rn;
@ -11197,7 +11199,7 @@ void bgp_config_write_network(struct vty *vty, struct bgp *bgp, afi_t afi,
/* "network" configuration display. */ /* "network" configuration display. */
if (bgp_option_check(BGP_OPT_CONFIG_CISCO) && afi == AFI_IP) { if (bgp_option_check(BGP_OPT_CONFIG_CISCO) && afi == AFI_IP) {
u_int32_t destination; uint32_t destination;
struct in_addr netmask; struct in_addr netmask;
destination = ntohl(p->u.prefix4.s_addr); destination = ntohl(p->u.prefix4.s_addr);

View File

@ -76,11 +76,11 @@ struct bgp_info_extra {
int suppress; int suppress;
/* Nexthop reachability check. */ /* Nexthop reachability check. */
u_int32_t igpmetric; uint32_t igpmetric;
/* MPLS label(s) - VNI(s) for EVPN-VxLAN */ /* MPLS label(s) - VNI(s) for EVPN-VxLAN */
mpls_label_t label[BGP_MAX_LABELS]; mpls_label_t label[BGP_MAX_LABELS];
u_int32_t num_labels; uint32_t num_labels;
#if ENABLE_BGP_VNC #if ENABLE_BGP_VNC
union { union {
@ -97,7 +97,7 @@ struct bgp_info_extra {
void *hme; /* encap monitor, if this is a VPN route */ void *hme; /* encap monitor, if this is a VPN route */
struct prefix_rd struct prefix_rd
rd; /* import: route's route-distinguisher */ 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 */ unset */
union { union {
struct in_addr addr4; struct in_addr addr4;
@ -174,7 +174,7 @@ struct bgp_info {
int lock; int lock;
/* BGP information status. */ /* BGP information status. */
u_int16_t flags; uint16_t flags;
#define BGP_INFO_IGP_CHANGED (1 << 0) #define BGP_INFO_IGP_CHANGED (1 << 0)
#define BGP_INFO_DAMPED (1 << 1) #define BGP_INFO_DAMPED (1 << 1)
#define BGP_INFO_HISTORY (1 << 2) #define BGP_INFO_HISTORY (1 << 2)
@ -191,11 +191,11 @@ struct bgp_info {
#define BGP_INFO_RIB_ATTR_CHG (1 << 13) #define BGP_INFO_RIB_ATTR_CHG (1 << 13)
/* BGP route type. This can be static, RIP, OSPF, BGP etc. */ /* 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 /* When above type is BGP. This sub type specify BGP sub type
information. */ information. */
u_char sub_type; uint8_t sub_type;
#define BGP_ROUTE_NORMAL 0 #define BGP_ROUTE_NORMAL 0
#define BGP_ROUTE_STATIC 1 #define BGP_ROUTE_STATIC 1
#define BGP_ROUTE_AGGREGATE 2 #define BGP_ROUTE_AGGREGATE 2
@ -205,11 +205,11 @@ struct bgp_info {
#endif #endif
#define BGP_ROUTE_IMPORTED 5 /* from another bgp instance/safi */ #define BGP_ROUTE_IMPORTED 5 /* from another bgp instance/safi */
u_short instance; unsigned short instance;
/* Addpath identifiers */ /* Addpath identifiers */
u_int32_t addpath_rx_id; uint32_t addpath_rx_id;
u_int32_t addpath_tx_id; uint32_t addpath_tx_id;
}; };
/* Structure used in BGP path selection */ /* Structure used in BGP path selection */
@ -224,20 +224,20 @@ struct bgp_static {
int backdoor; int backdoor;
/* Label index configuration; applies to LU prefixes. */ /* Label index configuration; applies to LU prefixes. */
u_int32_t label_index; uint32_t label_index;
#define BGP_INVALID_LABEL_INDEX 0xFFFFFFFF #define BGP_INVALID_LABEL_INDEX 0xFFFFFFFF
/* Import check status. */ /* Import check status. */
u_char valid; uint8_t valid;
/* IGP metric. */ /* IGP metric. */
u_int32_t igpmetric; uint32_t igpmetric;
/* IGP nexthop. */ /* IGP nexthop. */
struct in_addr igpnexthop; struct in_addr igpnexthop;
/* Atomic set reference count (ie cause of pathlimit) */ /* Atomic set reference count (ie cause of pathlimit) */
u_int32_t atomic; uint32_t atomic;
/* BGP redistribute route-map. */ /* BGP redistribute route-map. */
struct { 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_reap(struct bgp_node *rn, struct bgp_info *ri);
extern void bgp_info_delete(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 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_set_flag(struct bgp_node *, struct bgp_info *, uint32_t);
extern void bgp_info_unset_flag(struct bgp_node *, struct bgp_info *, extern void bgp_info_unset_flag(struct bgp_node *, struct bgp_info *, uint32_t);
u_int32_t);
extern void bgp_info_path_with_addpath_rx_str(struct bgp_info *ri, char *buf); 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 *); 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, extern void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
const union g_addr *nexthop, ifindex_t ifindex, const union g_addr *nexthop, ifindex_t ifindex,
enum nexthop_types_t nhtype, uint32_t metric, enum nexthop_types_t nhtype, uint32_t metric,
u_char type, u_short instance, uint8_t type, unsigned short instance,
route_tag_t tag); route_tag_t tag);
extern void bgp_redistribute_delete(struct bgp *, struct prefix *, u_char, extern void bgp_redistribute_delete(struct bgp *, struct prefix *, uint8_t,
u_short); unsigned short);
extern void bgp_redistribute_withdraw(struct bgp *, afi_t, int, u_short); extern void bgp_redistribute_withdraw(struct bgp *, afi_t, int, unsigned short);
extern void bgp_static_add(struct bgp *); extern void bgp_static_add(struct bgp *);
extern void bgp_static_delete(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 *); const char *, const char *, const char *);
/* this is primarily for MPLS-VPN */ /* 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 *, afi_t, safi_t, int, int, struct prefix_rd *,
mpls_label_t *, u_int32_t, int, struct bgp_route_evpn *); mpls_label_t *, uint32_t, int, struct bgp_route_evpn *);
extern int bgp_withdraw(struct peer *, struct prefix *, u_int32_t, extern int bgp_withdraw(struct peer *, struct prefix *, uint32_t, struct attr *,
struct attr *, afi_t, safi_t, int, int, afi_t, safi_t, int, int, struct prefix_rd *,
struct prefix_rd *, mpls_label_t *, u_int32_t, mpls_label_t *, uint32_t, struct bgp_route_evpn *);
struct bgp_route_evpn *);
/* for bgp_nexthop and bgp_damp */ /* for bgp_nexthop and bgp_damp */
extern void bgp_process(struct bgp *, struct bgp_node *, afi_t, safi_t); 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 *, extern void bgp_aggregate_decrement(struct bgp *, struct prefix *,
struct bgp_info *, afi_t, safi_t); struct bgp_info *, afi_t, safi_t);
extern u_char bgp_distance_apply(struct prefix *, struct bgp_info *, afi_t, extern uint8_t bgp_distance_apply(struct prefix *, struct bgp_info *, afi_t,
safi_t, struct bgp *); safi_t, struct bgp *);
extern afi_t bgp_node_afi(struct vty *); extern afi_t bgp_node_afi(struct vty *);
extern safi_t bgp_node_safi(struct vty *); extern safi_t bgp_node_safi(struct vty *);
extern struct bgp_info *info_make(int type, int sub_type, u_short instance, extern struct bgp_info *info_make(int type, int sub_type,
struct peer *peer, struct attr *attr, unsigned short instance, struct peer *peer,
struct bgp_node *rn); struct attr *attr, struct bgp_node *rn);
extern void route_vty_out(struct vty *, struct prefix *, struct bgp_info *, int, extern void route_vty_out(struct vty *, struct prefix *, struct bgp_info *, int,
safi_t, json_object *); safi_t, json_object *);
extern void route_vty_out_tag(struct vty *, struct prefix *, struct bgp_info *, extern void route_vty_out_tag(struct vty *, struct prefix *, struct bgp_info *,
int, safi_t, json_object *); int, safi_t, json_object *);
extern void route_vty_out_tmp(struct vty *, struct prefix *, struct attr *, 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, extern void route_vty_out_overlay(struct vty *vty, struct prefix *p,
struct bgp_info *binfo, int display, struct bgp_info *binfo, int display,
json_object *json); 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, extern int subgroup_process_announce_selected(struct update_subgroup *subgrp,
struct bgp_info *selected, struct bgp_info *selected,
struct bgp_node *rn, 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, extern int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
struct update_subgroup *subgrp, 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, extern int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, safi_t safi,
struct bgp_table *table, struct prefix_rd *prd, struct bgp_table *table, struct prefix_rd *prd,
enum bgp_show_type type, void *output_arg, enum bgp_show_type type, void *output_arg,
u_char use_json); uint8_t use_json);
#endif /* _QUAGGA_BGP_ROUTE_H */ #endif /* _QUAGGA_BGP_ROUTE_H */

View File

@ -122,12 +122,12 @@ o Local extensions
#define RMAP_VALUE_SUB 2 #define RMAP_VALUE_SUB 2
struct rmap_value { struct rmap_value {
u_int8_t action; uint8_t action;
u_int8_t variable; uint8_t variable;
u_int32_t value; 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) if (rv->variable == 0 && value == rv->value)
return RMAP_MATCH; return RMAP_MATCH;
@ -135,10 +135,10 @@ static int route_value_match(struct rmap_value *rv, u_int32_t value)
return RMAP_NOMATCH; return RMAP_NOMATCH;
} }
static u_int32_t route_value_adjust(struct rmap_value *rv, u_int32_t current, static uint32_t route_value_adjust(struct rmap_value *rv, uint32_t current,
struct peer *peer) struct peer *peer)
{ {
u_int32_t value; uint32_t value;
switch (rv->variable) { switch (rv->variable) {
case 1: 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) 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; unsigned long larg = 0;
char *endptr = NULL; char *endptr = NULL;
struct rmap_value *rv; 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, route_map_object_t type,
void *object) void *object)
{ {
u_char route_type = 0; uint8_t route_type = 0;
if (type == RMAP_BGP) { if (type == RMAP_BGP) {
route_type = *((u_char *)rule); route_type = *((uint8_t *)rule);
if (route_type == prefix->u.prefix_evpn.route_type) if (route_type == prefix->u.prefix_evpn.route_type)
return RMAP_MATCH; 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. */ /* Route map `route-type' match statement. */
static void *route_match_evpn_route_type_compile(const char *arg) 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) if (strncmp(arg, "ma", 2) == 0)
*route_type = BGP_EVPN_MAC_IP_ROUTE; *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, route_map_object_t type,
void *object) void *object)
{ {
u_int32_t *local_pref; uint32_t *local_pref;
struct bgp_info *bgp_info; struct bgp_info *bgp_info;
if (type == RMAP_BGP) { if (type == RMAP_BGP) {
@ -790,7 +790,7 @@ static route_map_result_t route_match_local_pref(void *rule,
`arg' is local-pref value */ `arg' is local-pref value */
static void *route_match_local_pref_compile(const char *arg) static void *route_match_local_pref_compile(const char *arg)
{ {
u_int32_t *local_pref; uint32_t *local_pref;
char *endptr = NULL; char *endptr = NULL;
unsigned long tmpval; unsigned long tmpval;
@ -803,7 +803,7 @@ static void *route_match_local_pref_compile(const char *arg)
if (*endptr != '\0' || errno || tmpval > UINT32_MAX) if (*endptr != '\0' || errno || tmpval > UINT32_MAX)
return NULL; 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) if (!local_pref)
return 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, route_map_object_t type,
void *object) void *object)
{ {
u_char *origin; uint8_t *origin;
struct bgp_info *bgp_info; struct bgp_info *bgp_info;
if (type == RMAP_BGP) { 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) 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) if (strcmp(arg, "igp") == 0)
*origin = 0; *origin = 0;
@ -1362,7 +1362,7 @@ static route_map_result_t route_set_local_pref(void *rule,
{ {
struct rmap_value *rv; struct rmap_value *rv;
struct bgp_info *bgp_info; struct bgp_info *bgp_info;
u_int32_t locpref = 0; uint32_t locpref = 0;
if (type == RMAP_BGP) { if (type == RMAP_BGP) {
/* Fetch routemap's rule information. */ /* 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 rmap_value *rv;
struct bgp_info *bgp_info; struct bgp_info *bgp_info;
u_int32_t med = 0; uint32_t med = 0;
if (type == RMAP_BGP) { if (type == RMAP_BGP) {
/* Fetch routemap's rule information. */ /* 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, route_map_object_t type,
void *object) void *object)
{ {
u_char *origin; uint8_t *origin;
struct bgp_info *bgp_info; struct bgp_info *bgp_info;
if (type == RMAP_BGP) { 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. */ /* Compile function for origin set. */
static void *route_set_origin_compile(const char *arg) 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) if (strcmp(arg, "igp") == 0)
*origin = 0; *origin = 0;
@ -2205,7 +2205,7 @@ static route_map_result_t route_set_label_index(void *rule,
{ {
struct rmap_value *rv; struct rmap_value *rv;
struct bgp_info *bgp_info; struct bgp_info *bgp_info;
u_int32_t label_index; uint32_t label_index;
if (type == RMAP_BGP) { if (type == RMAP_BGP) {
/* Fetch routemap's rule information. */ /* Fetch routemap's rule information. */

View File

@ -179,7 +179,7 @@ static void *route_match_compile(const char *arg)
{ {
int *rpki_status; 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) if (strcmp(arg, "valid") == 0)
*rpki_status = RPKI_VALID; *rpki_status = RPKI_VALID;

View File

@ -125,19 +125,19 @@ static oid bgp_trap_oid[] = {BGP4MIB, 0};
static struct in_addr bgp_empty_addr = {.s_addr = 0}; static struct in_addr bgp_empty_addr = {.s_addr = 0};
/* Hook functions. */ /* Hook functions. */
static u_char *bgpVersion(struct variable *, oid[], size_t *, int, size_t *, static uint8_t *bgpVersion(struct variable *, oid[], size_t *, int, size_t *,
WriteMethod **); WriteMethod **);
static u_char *bgpLocalAs(struct variable *, oid[], size_t *, int, size_t *, static uint8_t *bgpLocalAs(struct variable *, oid[], size_t *, int, size_t *,
WriteMethod **); WriteMethod **);
static u_char *bgpPeerTable(struct variable *, oid[], size_t *, int, size_t *, static uint8_t *bgpPeerTable(struct variable *, oid[], size_t *, int, size_t *,
WriteMethod **); WriteMethod **);
static u_char *bgpRcvdPathAttrTable(struct variable *, oid[], size_t *, int, static uint8_t *bgpRcvdPathAttrTable(struct variable *, oid[], size_t *, int,
size_t *, WriteMethod **); size_t *, WriteMethod **);
static u_char *bgpIdentifier(struct variable *, oid[], size_t *, int, size_t *, static uint8_t *bgpIdentifier(struct variable *, oid[], size_t *, int, size_t *,
WriteMethod **); WriteMethod **);
static u_char *bgp4PathAttrTable(struct variable *, oid[], size_t *, int, static uint8_t *bgp4PathAttrTable(struct variable *, oid[], size_t *, int,
size_t *, WriteMethod **); size_t *, WriteMethod **);
/* static u_char *bgpTraps (); */ /* static uint8_t *bgpTraps (); */
static struct variable bgp_variables[] = { static struct variable bgp_variables[] = {
/* BGP version. */ /* BGP version. */
@ -315,11 +315,11 @@ static struct variable bgp_variables[] = {
}; };
static u_char *bgpVersion(struct variable *v, oid name[], size_t *length, static uint8_t *bgpVersion(struct variable *v, oid name[], size_t *length,
int exact, size_t *var_len, int exact, size_t *var_len,
WriteMethod **write_method) WriteMethod **write_method)
{ {
static u_char version; static uint8_t version;
if (smux_header_generic(v, name, length, exact, var_len, write_method) if (smux_header_generic(v, name, length, exact, var_len, write_method)
== MATCH_FAILED) == MATCH_FAILED)
@ -330,10 +330,10 @@ static u_char *bgpVersion(struct variable *v, oid name[], size_t *length,
/* Return octet string length 1. */ /* Return octet string length 1. */
*var_len = 1; *var_len = 1;
return (u_char *)&version; return (uint8_t *)&version;
} }
static u_char *bgpLocalAs(struct variable *v, oid name[], size_t *length, static uint8_t *bgpLocalAs(struct variable *v, oid name[], size_t *length,
int exact, size_t *var_len, int exact, size_t *var_len,
WriteMethod **write_method) WriteMethod **write_method)
{ {
@ -443,9 +443,9 @@ static struct peer *bgpPeerTable_lookup(struct variable *v, oid name[],
} }
/* BGP write methods. */ /* BGP write methods. */
static int write_bgpPeerTable(int action, u_char *var_val, u_char var_val_type, static int write_bgpPeerTable(int action, uint8_t *var_val,
size_t var_val_len, u_char *statP, oid *name, uint8_t var_val_type, size_t var_val_len,
size_t length) uint8_t *statP, oid *name, size_t length)
{ {
struct in_addr addr; struct in_addr addr;
struct peer *peer; struct peer *peer;
@ -506,7 +506,7 @@ static int write_bgpPeerTable(int action, u_char *var_val, u_char var_val_type,
return SNMP_ERR_NOERROR; return SNMP_ERR_NOERROR;
} }
static u_char *bgpPeerTable(struct variable *v, oid name[], size_t *length, static uint8_t *bgpPeerTable(struct variable *v, oid name[], size_t *length,
int exact, size_t *var_len, int exact, size_t *var_len,
WriteMethod **write_method) WriteMethod **write_method)
{ {
@ -588,11 +588,11 @@ static u_char *bgpPeerTable(struct variable *v, oid name[], size_t *length,
return SNMP_INTEGER(PEER_TOTAL_TX(peer)); return SNMP_INTEGER(PEER_TOTAL_TX(peer));
break; break;
case BGPPEERLASTERROR: { case BGPPEERLASTERROR: {
static u_char lasterror[2]; static uint8_t lasterror[2];
lasterror[0] = peer->notify.code; lasterror[0] = peer->notify.code;
lasterror[1] = peer->notify.subcode; lasterror[1] = peer->notify.subcode;
*var_len = 2; *var_len = 2;
return (u_char *)&lasterror; return (uint8_t *)&lasterror;
} break; } break;
case BGPPEERFSMESTABLISHEDTRANSITIONS: case BGPPEERFSMESTABLISHEDTRANSITIONS:
return SNMP_INTEGER(peer->established); return SNMP_INTEGER(peer->established);
@ -644,7 +644,7 @@ static u_char *bgpPeerTable(struct variable *v, oid name[], size_t *length,
return NULL; return NULL;
} }
static u_char *bgpIdentifier(struct variable *v, oid name[], size_t *length, static uint8_t *bgpIdentifier(struct variable *v, oid name[], size_t *length,
int exact, size_t *var_len, int exact, size_t *var_len,
WriteMethod **write_method) WriteMethod **write_method)
{ {
@ -661,7 +661,7 @@ static u_char *bgpIdentifier(struct variable *v, oid name[], size_t *length,
return SNMP_IPADDRESS(bgp->router_id); return SNMP_IPADDRESS(bgp->router_id);
} }
static u_char *bgpRcvdPathAttrTable(struct variable *v, oid name[], static uint8_t *bgpRcvdPathAttrTable(struct variable *v, oid name[],
size_t *length, int exact, size_t *var_len, size_t *length, int exact, size_t *var_len,
WriteMethod **write_method) WriteMethod **write_method)
{ {
@ -805,8 +805,8 @@ static struct bgp_info *bgp4PathAttrLookup(struct variable *v, oid name[],
return NULL; return NULL;
} }
static u_char *bgp4PathAttrTable(struct variable *v, oid name[], size_t *length, static uint8_t *bgp4PathAttrTable(struct variable *v, oid name[],
int exact, size_t *var_len, size_t *length, int exact, size_t *var_len,
WriteMethod **write_method) WriteMethod **write_method)
{ {
struct bgp *bgp; struct bgp *bgp;

View File

@ -58,7 +58,7 @@ struct bgp_node {
mpls_label_t local_label; mpls_label_t local_label;
uint64_t version; uint64_t version;
u_char flags; uint8_t flags;
#define BGP_NODE_PROCESS_SCHEDULED (1 << 0) #define BGP_NODE_PROCESS_SCHEDULED (1 << 0)
#define BGP_NODE_USER_CLEAR (1 << 1) #define BGP_NODE_USER_CLEAR (1 << 1)
#define BGP_NODE_LABEL_CHANGED (1 << 2) #define BGP_NODE_LABEL_CHANGED (1 << 2)

View File

@ -77,7 +77,7 @@
typedef enum { BGP_ATTR_VEC_NH = 0, BGP_ATTR_VEC_MAX } bpacket_attr_vec_type; typedef enum { BGP_ATTR_VEC_NH = 0, BGP_ATTR_VEC_MAX } bpacket_attr_vec_type;
typedef struct { typedef struct {
u_int32_t flags; uint32_t flags;
unsigned long offset; unsigned long offset;
} bpacket_attr_vec; } bpacket_attr_vec;
@ -139,19 +139,19 @@ struct update_group {
uint64_t id; uint64_t id;
time_t uptime; time_t uptime;
u_int32_t join_events; uint32_t join_events;
u_int32_t prune_events; uint32_t prune_events;
u_int32_t merge_events; uint32_t merge_events;
u_int32_t updgrp_switch_events; uint32_t updgrp_switch_events;
u_int32_t peer_refreshes_combined; uint32_t peer_refreshes_combined;
u_int32_t adj_count; uint32_t adj_count;
u_int32_t split_events; uint32_t split_events;
u_int32_t merge_checks_triggered; uint32_t merge_checks_triggered;
u_int32_t subgrps_created; uint32_t subgrps_created;
u_int32_t subgrps_deleted; 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 hash *hash;
struct thread *t_coalesce; struct thread *t_coalesce;
u_int32_t v_coalesce; uint32_t v_coalesce;
struct thread *t_merge_check; struct thread *t_merge_check;
@ -236,25 +236,25 @@ struct update_subgroup {
uint64_t subgroup_id; uint64_t subgroup_id;
} split_from; } split_from;
u_int32_t join_events; uint32_t join_events;
u_int32_t prune_events; uint32_t prune_events;
/* /*
* This is bumped up when another subgroup merges into this one. * This is bumped up when another subgroup merges into this one.
*/ */
u_int32_t merge_events; uint32_t merge_events;
u_int32_t updgrp_switch_events; uint32_t updgrp_switch_events;
u_int32_t peer_refreshes_combined; uint32_t peer_refreshes_combined;
u_int32_t adj_count; uint32_t adj_count;
u_int32_t split_events; uint32_t split_events;
u_int32_t merge_checks_triggered; uint32_t merge_checks_triggered;
uint64_t id; uint64_t id;
u_int16_t sflags; uint16_t sflags;
/* Subgroup flags, see below */ /* Subgroup flags, see below */
u_int16_t flags; uint16_t flags;
}; };
/* /*
@ -302,7 +302,7 @@ struct updwalk_context {
int policy_route_update; int policy_route_update;
updgrp_walkcb cb; updgrp_walkcb cb;
void *context; void *context;
u_int8_t flags; uint8_t flags;
#define UPDWALK_FLAGS_ADVQUEUE (1 << 0) #define UPDWALK_FLAGS_ADVQUEUE (1 << 0)
#define UPDWALK_FLAGS_ADVERTISED (1 << 1) #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 void peer_af_announce_route(struct peer_af *paf, int combine);
extern struct bgp_adj_out *bgp_adj_out_alloc(struct update_subgroup *subgrp, extern struct bgp_adj_out *bgp_adj_out_alloc(struct update_subgroup *subgrp,
struct bgp_node *rn, 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, extern void bgp_adj_out_remove_subgroup(struct bgp_node *rn,
struct bgp_adj_out *adj, struct bgp_adj_out *adj,
struct update_subgroup *subgrp); 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); struct attr *attr, struct bgp_info *binfo);
extern void bgp_adj_out_unset_subgroup(struct bgp_node *rn, extern void bgp_adj_out_unset_subgroup(struct bgp_node *rn,
struct update_subgroup *subgrp, 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, void subgroup_announce_table(struct update_subgroup *subgrp,
struct bgp_table *table); struct bgp_table *table);
extern void subgroup_trigger_write(struct update_subgroup *subgrp); extern void subgroup_trigger_write(struct update_subgroup *subgrp);

View File

@ -57,7 +57,7 @@
static inline struct bgp_adj_out *adj_lookup(struct bgp_node *rn, static inline struct bgp_adj_out *adj_lookup(struct bgp_node *rn,
struct update_subgroup *subgrp, struct update_subgroup *subgrp,
u_int32_t addpath_tx_id) uint32_t addpath_tx_id)
{ {
struct bgp_adj_out *adj; struct bgp_adj_out *adj;
struct peer *peer; 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, 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_table *table;
struct bgp_adj_out *adj; 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, 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; struct updwalk_context ctx;
memset(&ctx, 0, sizeof(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_adj_out *bgp_adj_out_alloc(struct update_subgroup *subgrp,
struct bgp_node *rn, struct bgp_node *rn,
u_int32_t addpath_tx_id) uint32_t addpath_tx_id)
{ {
struct bgp_adj_out *adj; 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, void bgp_adj_out_unset_subgroup(struct bgp_node *rn,
struct update_subgroup *subgrp, char withdraw, struct update_subgroup *subgrp, char withdraw,
u_int32_t addpath_tx_id) uint32_t addpath_tx_id)
{ {
struct bgp_adj_out *adj; struct bgp_adj_out *adj;
struct bgp_advertise *adv; struct bgp_advertise *adv;

View File

@ -396,7 +396,7 @@ struct stream *bpacket_reformat_for_peer(struct bpacket *pkt,
vec = &pkt->arr.entries[BGP_ATTR_VEC_NH]; vec = &pkt->arr.entries[BGP_ATTR_VEC_NH];
if (CHECK_FLAG(vec->flags, BPKT_ATTRVEC_FLAGS_UPDATED)) { 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! */ afi_t nhafi = AFI_MAX; /* NH AFI is based on nhlen! */
int route_map_sets_nh; int route_map_sets_nh;
nhlen = stream_getc_from(s, vec->offset); 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 num_pfx = 0;
int addpath_encode = 0; int addpath_encode = 0;
int addpath_overhead = 0; int addpath_overhead = 0;
u_int32_t addpath_tx_id = 0; uint32_t addpath_tx_id = 0;
struct prefix_rd *prd = NULL; struct prefix_rd *prd = NULL;
mpls_label_t label = MPLS_INVALID_LABEL, *label_pnt = NULL; mpls_label_t label = MPLS_INVALID_LABEL, *label_pnt = NULL;
u_int32_t num_labels = 0; uint32_t num_labels = 0;
if (!subgrp) if (!subgrp)
return NULL; return NULL;
@ -937,7 +937,7 @@ struct bpacket *subgroup_withdraw_packet(struct update_subgroup *subgrp)
size_t mp_start = 0; size_t mp_start = 0;
size_t attrlen_pos = 0; size_t attrlen_pos = 0;
size_t mplen_pos = 0; size_t mplen_pos = 0;
u_char first_time = 1; uint8_t first_time = 1;
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
int space_remaining = 0; int space_remaining = 0;
@ -945,7 +945,7 @@ struct bpacket *subgroup_withdraw_packet(struct update_subgroup *subgrp)
int num_pfx = 0; int num_pfx = 0;
int addpath_encode = 0; int addpath_encode = 0;
int addpath_overhead = 0; int addpath_overhead = 0;
u_int32_t addpath_tx_id = 0; uint32_t addpath_tx_id = 0;
struct prefix_rd *prd = NULL; struct prefix_rd *prd = NULL;

View File

@ -32,7 +32,7 @@
int show_adj_route_vpn(struct vty *vty, struct peer *peer, int show_adj_route_vpn(struct vty *vty, struct peer *peer,
struct prefix_rd *prd, afi_t afi, safi_t safi, struct prefix_rd *prd, afi_t afi, safi_t safi,
u_char use_json) uint8_t use_json)
{ {
struct bgp *bgp; struct bgp *bgp;
struct bgp_table *table; struct bgp_table *table;
@ -124,14 +124,14 @@ int show_adj_route_vpn(struct vty *vty, struct peer *peer,
} }
if (rd_header) { if (rd_header) {
u_int16_t type; uint16_t type;
struct rd_as rd_as; struct rd_as rd_as;
struct rd_ip rd_ip = {0}; struct rd_ip rd_ip = {0};
#if ENABLE_BGP_VNC #if ENABLE_BGP_VNC
struct rd_vnc_eth rd_vnc_eth = { struct rd_vnc_eth rd_vnc_eth = {
0}; 0};
#endif #endif
u_char *pnt; uint8_t *pnt;
pnt = rn->p.u.val; pnt = rn->p.u.val;

View File

@ -25,6 +25,6 @@
extern int show_adj_route_vpn(struct vty *vty, struct peer *peer, extern int show_adj_route_vpn(struct vty *vty, struct peer *peer,
struct prefix_rd *prd, afi_t afi, safi_t safi, struct prefix_rd *prd, afi_t afi, safi_t safi,
u_char use_json); uint8_t use_json);
#endif /* _QUAGGA_BGP_VPN_H */ #endif /* _QUAGGA_BGP_VPN_H */

View File

@ -1111,11 +1111,11 @@ DEFUN (no_bgp_confederation_peers,
* @set: 1 for setting values, 0 for removing the max-paths config. * @set: 1 for setting values, 0 for removing the max-paths config.
*/ */
static int bgp_maxpaths_config_vty(struct vty *vty, int peer_type, 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) int set)
{ {
VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT(bgp, bgp);
u_int16_t maxpaths = 0; uint16_t maxpaths = 0;
int ret; int ret;
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
@ -1257,8 +1257,8 @@ static int bgp_update_delay_config_vty(struct vty *vty, const char *delay,
const char *wait) const char *wait)
{ {
VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT(bgp, bgp);
u_int16_t update_delay; uint16_t update_delay;
u_int16_t establish_wait; uint16_t establish_wait;
update_delay = strtoul(delay, NULL, 10); update_delay = strtoul(delay, NULL, 10);
@ -1779,7 +1779,7 @@ DEFUN (bgp_graceful_restart_stalepath_time,
{ {
VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT(bgp, bgp);
int idx_number = 3; int idx_number = 3;
u_int32_t stalepath; uint32_t stalepath;
stalepath = strtoul(argv[idx_number]->arg, NULL, 10); stalepath = strtoul(argv[idx_number]->arg, NULL, 10);
bgp->stalepath_time = stalepath; bgp->stalepath_time = stalepath;
@ -1796,7 +1796,7 @@ DEFUN (bgp_graceful_restart_restart_time,
{ {
VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT(bgp, bgp);
int idx_number = 3; int idx_number = 3;
u_int32_t restart; uint32_t restart;
restart = strtoul(argv[idx_number]->arg, NULL, 10); restart = strtoul(argv[idx_number]->arg, NULL, 10);
bgp->restart_time = restart; bgp->restart_time = restart;
@ -2292,7 +2292,7 @@ DEFUN (bgp_default_local_preference,
{ {
VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT(bgp, bgp);
int idx_number = 3; int idx_number = 3;
u_int32_t local_pref; uint32_t local_pref;
local_pref = strtoul(argv[idx_number]->arg, NULL, 10); 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); VTY_DECLVAR_CONTEXT(bgp, bgp);
int idx_number = 3; int idx_number = 3;
u_int32_t max_size; uint32_t max_size;
max_size = strtoul(argv[idx_number]->arg, NULL, 10); 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") "Peer-group name\n")
static int peer_flag_modify_vty(struct vty *vty, const char *ip_str, 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; int ret;
struct peer *peer; 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); return bgp_vty_return(vty, ret);
} }
static int peer_flag_set_vty(struct vty *vty, const char *ip_str, static int peer_flag_set_vty(struct vty *vty, const char *ip_str, uint16_t flag)
u_int16_t flag)
{ {
return peer_flag_modify_vty(vty, ip_str, flag, 1); return peer_flag_modify_vty(vty, ip_str, flag, 1);
} }
static int peer_flag_unset_vty(struct vty *vty, const char *ip_str, 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); 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, 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 set)
{ {
int ret; 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, 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); 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, 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); 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_peer = 1;
int idx_send_recv = 5; int idx_send_recv = 5;
u_int16_t flag = 0; uint16_t flag = 0;
if (strmatch(argv[idx_send_recv]->text, "send")) if (strmatch(argv[idx_send_recv]->text, "send"))
flag = PEER_FLAG_ORF_PREFIX_SM; flag = PEER_FLAG_ORF_PREFIX_SM;
@ -3697,7 +3696,7 @@ DEFUN (no_neighbor_capability_orf_prefix,
{ {
int idx_peer = 2; int idx_peer = 2;
int idx_send_recv = 6; int idx_send_recv = 6;
u_int16_t flag = 0; uint16_t flag = 0;
if (strmatch(argv[idx_send_recv]->text, "send")) if (strmatch(argv[idx_send_recv]->text, "send"))
flag = PEER_FLAG_ORF_PREFIX_SM; flag = PEER_FLAG_ORF_PREFIX_SM;
@ -4072,7 +4071,7 @@ DEFUN (neighbor_send_community_type,
"Send Large Community attributes\n") "Send Large Community attributes\n")
{ {
int idx = 0; int idx = 0;
u_int32_t flag = 0; uint32_t flag = 0;
char *peer = argv[1]->arg; char *peer = argv[1]->arg;
@ -4338,7 +4337,7 @@ DEFUN (neighbor_attr_unchanged,
int idx = 0; int idx = 0;
char *peer_str = argv[1]->arg; char *peer_str = argv[1]->arg;
struct peer *peer; struct peer *peer;
u_int16_t flags = 0; uint16_t flags = 0;
afi_t afi = bgp_node_afi(vty); afi_t afi = bgp_node_afi(vty);
safi_t safi = bgp_node_safi(vty); safi_t safi = bgp_node_safi(vty);
@ -4408,7 +4407,7 @@ DEFUN (no_neighbor_attr_unchanged,
{ {
int idx = 0; int idx = 0;
char *peer = argv[2]->arg; char *peer = argv[2]->arg;
u_int16_t flags = 0; uint16_t flags = 0;
if (argv_find(argv, argc, "as-path", &idx)) if (argv_find(argv, argc, "as-path", &idx))
SET_FLAG(flags, PEER_FLAG_AS_PATH_UNCHANGED); 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) const char *port_str)
{ {
struct peer *peer; struct peer *peer;
u_int16_t port; uint16_t port;
struct servent *sp; struct servent *sp;
peer = peer_lookup_vty(vty, ip_str); 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; int ret;
struct peer *peer; struct peer *peer;
u_int32_t keepalive; uint32_t keepalive;
u_int32_t holdtime; uint32_t holdtime;
peer = peer_and_group_lookup_vty(vty, ip_str); peer = peer_and_group_lookup_vty(vty, ip_str);
if (!peer) if (!peer)
@ -4990,7 +4989,7 @@ static int peer_timers_connect_set_vty(struct vty *vty, const char *ip_str,
{ {
int ret; int ret;
struct peer *peer; struct peer *peer;
u_int32_t connect; uint32_t connect;
peer = peer_and_group_lookup_vty(vty, ip_str); peer = peer_and_group_lookup_vty(vty, ip_str);
if (!peer) if (!peer)
@ -5052,7 +5051,7 @@ static int peer_advertise_interval_vty(struct vty *vty, const char *ip_str,
{ {
int ret; int ret;
struct peer *peer; struct peer *peer;
u_int32_t routeadv = 0; uint32_t routeadv = 0;
peer = peer_and_group_lookup_vty(vty, ip_str); peer = peer_and_group_lookup_vty(vty, ip_str);
if (!peer) 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") "0 disables the timer, no route updates happen when route-maps change\n")
{ {
int idx_number = 3; int idx_number = 3;
u_int32_t rmap_delay_timer; uint32_t rmap_delay_timer;
if (argv[idx_number]->arg) { if (argv[idx_number]->arg) {
rmap_delay_timer = strtoul(argv[idx_number]->arg, NULL, 10); 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; int ret;
struct peer *peer; struct peer *peer;
u_int32_t max; uint32_t max;
u_char threshold; uint8_t threshold;
u_int16_t restart; uint16_t restart;
peer = peer_and_group_lookup_vty(vty, ip_str); peer = peer_and_group_lookup_vty(vty, ip_str);
if (!peer) if (!peer)
@ -7026,7 +7025,7 @@ DEFUN (show_bgp_vrfs,
struct list *inst = bm->bgp; struct list *inst = bm->bgp;
struct listnode *node; struct listnode *node;
struct bgp *bgp; struct bgp *bgp;
u_char uj = use_json(argc, argv); uint8_t uj = use_json(argc, argv);
json_object *json = NULL; json_object *json = NULL;
json_object *json_vrfs = NULL; json_object *json_vrfs = NULL;
int count = 0; 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. */ /* Show BGP peer's summary information. */
static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi, 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 peer *peer;
struct listnode *node, *nnode; 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, 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) json_object *json)
{ {
int is_first = 1; 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, 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 listnode *node, *nnode;
struct bgp *bgp; 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, 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; 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, static void bgp_show_peer_afi_orf_cap(struct vty *vty, struct peer *p,
afi_t afi, safi_t safi, afi_t afi, safi_t safi,
u_int16_t adv_smcap, u_int16_t adv_rmcap, uint16_t adv_smcap, uint16_t adv_rmcap,
u_int16_t rcv_smcap, u_int16_t rcv_rmcap, uint16_t rcv_smcap, uint16_t rcv_rmcap,
u_char use_json, json_object *json_pref) uint8_t use_json, json_object *json_pref)
{ {
/* Send-Mode */ /* Send-Mode */
if (CHECK_FLAG(p->af_cap[afi][safi], adv_smcap) 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, 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) json_object *json_neigh)
{ {
struct bgp_filter *filter; 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) json_object *json)
{ {
struct bgp *bgp; 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; const char *code_str;
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
u_int16_t i; uint16_t i;
u_char *msg; uint8_t *msg;
json_object *json_neigh = NULL; json_object *json_neigh = NULL;
time_t epoch_tbuf; 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( msg_str = bgp_notify_admin_message(
msgbuf, sizeof(msgbuf), msgbuf, sizeof(msgbuf),
(u_char *)p->notify.data, (uint8_t *)p->notify.data,
p->notify.length); p->notify.length);
if (msg_str) if (msg_str)
json_object_string_add( 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( msg_str = bgp_notify_admin_message(
msgbuf, sizeof(msgbuf), msgbuf, sizeof(msgbuf),
(u_char *)p->notify.data, (uint8_t *)p->notify.data,
p->notify.length); p->notify.length);
if (msg_str) if (msg_str)
vty_out(vty, 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, static int bgp_show_neighbor(struct vty *vty, struct bgp *bgp,
enum show_type type, union sockunion *su, 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) json_object *json)
{ {
struct listnode *node, *nnode; 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, static void bgp_show_all_instances_neighbors_vty(struct vty *vty,
enum show_type type, enum show_type type,
const char *ip_str, const char *ip_str,
u_char use_json) uint8_t use_json)
{ {
struct listnode *node, *nnode; struct listnode *node, *nnode;
struct bgp *bgp; 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, static int bgp_show_neighbor_vty(struct vty *vty, const char *name,
enum show_type type, const char *ip_str, enum show_type type, const char *ip_str,
u_char use_json) uint8_t use_json)
{ {
int ret; int ret;
struct bgp *bgp; struct bgp *bgp;
@ -10572,7 +10571,7 @@ DEFUN (show_ip_bgp_neighbors,
char *sh_arg = NULL; char *sh_arg = NULL;
enum show_type sh_type; enum show_type sh_type;
u_char uj = use_json(argc, argv); uint8_t uj = use_json(argc, argv);
int idx = 0; int idx = 0;
@ -11084,7 +11083,7 @@ DEFUN (bgp_redistribute_ipv4_metric,
int idx_protocol = 1; int idx_protocol = 1;
int idx_number = 3; int idx_number = 3;
int type; int type;
u_int32_t metric; uint32_t metric;
struct bgp_redist *red; struct bgp_redist *red;
type = proto_redistnum(AFI_IP, argv[idx_protocol]->text); 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_word = 3;
int idx_number = 5; int idx_number = 5;
int type; int type;
u_int32_t metric; uint32_t metric;
struct bgp_redist *red; struct bgp_redist *red;
type = proto_redistnum(AFI_IP, argv[idx_protocol]->text); 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_number = 3;
int idx_word = 5; int idx_word = 5;
int type; int type;
u_int32_t metric; uint32_t metric;
struct bgp_redist *red; struct bgp_redist *red;
type = proto_redistnum(AFI_IP, argv[idx_protocol]->text); type = proto_redistnum(AFI_IP, argv[idx_protocol]->text);
@ -11201,8 +11200,8 @@ DEFUN (bgp_redistribute_ipv4_ospf,
VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT(bgp, bgp);
int idx_ospf_table = 1; int idx_ospf_table = 1;
int idx_number = 2; int idx_number = 2;
u_short instance; unsigned short instance;
u_short protocol; unsigned short protocol;
instance = strtoul(argv[idx_number]->arg, NULL, 10); instance = strtoul(argv[idx_number]->arg, NULL, 10);
@ -11237,7 +11236,7 @@ DEFUN (bgp_redistribute_ipv4_ospf_rmap,
int idx_number = 2; int idx_number = 2;
int idx_word = 4; int idx_word = 4;
struct bgp_redist *red; struct bgp_redist *red;
u_short instance; unsigned short instance;
int protocol; int protocol;
if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0) 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_ospf_table = 1;
int idx_number = 2; int idx_number = 2;
int idx_number_2 = 4; int idx_number_2 = 4;
u_int32_t metric; uint32_t metric;
struct bgp_redist *red; struct bgp_redist *red;
u_short instance; unsigned short instance;
int protocol; int protocol;
if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0) 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_number = 2;
int idx_word = 4; int idx_word = 4;
int idx_number_2 = 6; int idx_number_2 = 6;
u_int32_t metric; uint32_t metric;
struct bgp_redist *red; struct bgp_redist *red;
u_short instance; unsigned short instance;
int protocol; int protocol;
if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0) 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;
int idx_number_2 = 4; int idx_number_2 = 4;
int idx_word = 6; int idx_word = 6;
u_int32_t metric; uint32_t metric;
struct bgp_redist *red; struct bgp_redist *red;
u_short instance; unsigned short instance;
int protocol; int protocol;
if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0) 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); VTY_DECLVAR_CONTEXT(bgp, bgp);
int idx_ospf_table = 2; int idx_ospf_table = 2;
int idx_number = 3; int idx_number = 3;
u_short instance; unsigned short instance;
int protocol; int protocol;
if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0) 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_protocol = 1;
int idx_number = 3; int idx_number = 3;
int type; int type;
u_int32_t metric; uint32_t metric;
struct bgp_redist *red; struct bgp_redist *red;
type = proto_redistnum(AFI_IP6, argv[idx_protocol]->text); 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_word = 3;
int idx_number = 5; int idx_number = 5;
int type; int type;
u_int32_t metric; uint32_t metric;
struct bgp_redist *red; struct bgp_redist *red;
type = proto_redistnum(AFI_IP6, argv[idx_protocol]->text); 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_number = 3;
int idx_word = 5; int idx_word = 5;
int type; int type;
u_int32_t metric; uint32_t metric;
struct bgp_redist *red; struct bgp_redist *red;
type = proto_redistnum(AFI_IP6, argv[idx_protocol]->text); type = proto_redistnum(AFI_IP6, argv[idx_protocol]->text);

View File

@ -70,7 +70,7 @@ extern int bgp_vty_find_and_parse_afi_safi_bgp(struct vty *vty,
int argc, int *idx, afi_t *afi, int argc, int *idx, afi_t *afi,
safi_t *safi, struct bgp **bgp); safi_t *safi, struct bgp **bgp);
extern int bgp_show_summary_vty(struct vty *vty, const char *name, afi_t afi, 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, extern void bgp_vpn_policy_config_write_afi(struct vty *vty, struct bgp *bgp,
afi_t afi); afi_t afi);
#endif /* _QUAGGA_BGP_VTY_H */ #endif /* _QUAGGA_BGP_VTY_H */

View File

@ -979,10 +979,10 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p,
int nh_family; int nh_family;
unsigned int valid_nh_count = 0; unsigned int valid_nh_count = 0;
int has_valid_label = 0; int has_valid_label = 0;
u_char distance; uint8_t distance;
struct peer *peer; struct peer *peer;
struct bgp_info *mpinfo; struct bgp_info *mpinfo;
u_int32_t metric; uint32_t metric;
struct attr local_attr; struct attr local_attr;
struct bgp_info local_info; struct bgp_info local_info;
struct bgp_info *mpinfo_cp = &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); zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
} }
struct bgp_redist *bgp_redist_lookup(struct bgp *bgp, afi_t afi, u_char type, struct bgp_redist *bgp_redist_lookup(struct bgp *bgp, afi_t afi, uint8_t type,
u_short instance) unsigned short instance)
{ {
struct list *red_list; struct list *red_list;
struct listnode *node; struct listnode *node;
@ -1385,8 +1385,8 @@ struct bgp_redist *bgp_redist_lookup(struct bgp *bgp, afi_t afi, u_char type,
return NULL; return NULL;
} }
struct bgp_redist *bgp_redist_add(struct bgp *bgp, afi_t afi, u_char type, struct bgp_redist *bgp_redist_add(struct bgp *bgp, afi_t afi, uint8_t type,
u_short instance) unsigned short instance)
{ {
struct list *red_list; struct list *red_list;
struct bgp_redist *red; 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; return red;
} }
static void bgp_redist_del(struct bgp *bgp, afi_t afi, u_char type, static void bgp_redist_del(struct bgp *bgp, afi_t afi, uint8_t type,
u_short instance) unsigned short instance)
{ {
struct bgp_redist *red; 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. */ /* 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. */ /* 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, 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 /* Don't try to send if we're not connected to Zebra or Zebra doesn't
* know of this instance. * know of this instance.
@ -1509,7 +1510,7 @@ int bgp_redistribute_rmap_set(struct bgp_redist *red, const char *name)
/* Redistribute with metric specification. */ /* Redistribute with metric specification. */
int bgp_redistribute_metric_set(struct bgp *bgp, struct bgp_redist *red, 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_node *rn;
struct bgp_info *ri; struct bgp_info *ri;
@ -1547,7 +1548,7 @@ int bgp_redistribute_metric_set(struct bgp *bgp, struct bgp_redist *red,
/* Unset redistribution. */ /* Unset redistribution. */
int bgp_redistribute_unreg(struct bgp *bgp, afi_t afi, int type, int bgp_redistribute_unreg(struct bgp *bgp, afi_t afi, int type,
u_short instance) unsigned short instance)
{ {
struct bgp_redist *red; struct bgp_redist *red;
@ -1586,7 +1587,7 @@ int bgp_redistribute_unreg(struct bgp *bgp, afi_t afi, int type,
/* Unset redistribution. */ /* Unset redistribution. */
int bgp_redistribute_unset(struct bgp *bgp, afi_t afi, int type, int bgp_redistribute_unset(struct bgp *bgp, afi_t afi, int type,
u_short instance) unsigned short instance)
{ {
struct bgp_redist *red; struct bgp_redist *red;
@ -1893,7 +1894,7 @@ static int bgp_zebra_process_local_macip(int command, struct zclient *zclient,
int ipa_len; int ipa_len;
char buf[ETHER_ADDR_STRLEN]; char buf[ETHER_ADDR_STRLEN];
char buf1[INET6_ADDRSTRLEN]; char buf1[INET6_ADDRSTRLEN];
u_char flags; uint8_t flags;
memset(&ip, 0, sizeof(ip)); memset(&ip, 0, sizeof(ip));
s = zclient->ibuf; s = zclient->ibuf;

View File

@ -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_register(struct bgp *);
extern void bgp_zebra_instance_deregister(struct bgp *); extern void bgp_zebra_instance_deregister(struct bgp *);
extern struct bgp_redist *bgp_redist_lookup(struct bgp *, afi_t, u_char, extern struct bgp_redist *bgp_redist_lookup(struct bgp *, afi_t, uint8_t,
u_short); unsigned short);
extern struct bgp_redist *bgp_redist_add(struct bgp *, afi_t, u_char, u_short); extern struct bgp_redist *bgp_redist_add(struct bgp *, afi_t, uint8_t,
extern int bgp_redistribute_set(struct bgp *, afi_t, int, u_short); unsigned short);
extern int bgp_redistribute_resend(struct bgp *, afi_t, int, u_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_rmap_set(struct bgp_redist *, const char *);
extern int bgp_redistribute_metric_set(struct bgp *, struct bgp_redist *, afi_t, extern int bgp_redistribute_metric_set(struct bgp *, struct bgp_redist *, afi_t,
int, u_int32_t); int, uint32_t);
extern int bgp_redistribute_unset(struct bgp *, afi_t, int, u_short); extern int bgp_redistribute_unset(struct bgp *, afi_t, int, unsigned short);
extern int bgp_redistribute_unreg(struct bgp *, afi_t, int, u_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(struct in_addr *, vrf_id_t);
extern struct interface *if_lookup_by_ipv4_exact(struct in_addr *, vrf_id_t); extern struct interface *if_lookup_by_ipv4_exact(struct in_addr *, vrf_id_t);

View File

@ -376,7 +376,7 @@ time_t bgp_clock(void)
} }
/* BGP timer configuration. */ /* 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 = bgp->default_keepalive =
(keepalive < holdtime / 3 ? keepalive : holdtime / 3); (keepalive < holdtime / 3 ? keepalive : holdtime / 3);
@ -589,7 +589,7 @@ int bgp_confederation_peers_remove(struct bgp *bgp, as_t as)
} }
/* Local preference configuration. */ /* 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) if (!bgp)
return -1; return -1;
@ -610,8 +610,7 @@ int bgp_default_local_preference_unset(struct bgp *bgp)
} }
/* Local preference configuration. */ /* Local preference configuration. */
int bgp_default_subgroup_pkt_queue_max_set(struct bgp *bgp, int bgp_default_subgroup_pkt_queue_max_set(struct bgp *bgp, uint32_t queue_size)
u_int32_t queue_size)
{ {
if (!bgp) if (!bgp)
return -1; 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)); == CHECK_FLAG(peer2->flags, PEER_FLAG_CONFIG_NODE));
} }
int peer_af_flag_check(struct peer *peer, afi_t afi, safi_t safi, int peer_af_flag_check(struct peer *peer, afi_t afi, safi_t safi, uint32_t flag)
u_int32_t flag)
{ {
return CHECK_FLAG(peer->af_flags[afi][safi], flag); return CHECK_FLAG(peer->af_flags[afi][safi], flag);
} }
/* Return true if flag is set for the peer but not the peer-group */ /* 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, 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; 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 connected *ifc;
struct prefix p; struct prefix p;
u_int32_t addr; uint32_t addr;
struct listnode *node; struct listnode *node;
/* If our IPv4 address on the interface is /30 or /31, we can derive the /* 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 { struct peer_flag_action {
/* Peer's flag. */ /* Peer's flag. */
u_int32_t flag; uint32_t flag;
/* This flag can be set for peer-group member. */ /* 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. */ /* Action when the flag is changed. */
enum peer_change_type type; enum peer_change_type type;
/* Peer down cause */ /* Peer down cause */
u_char peer_down; uint8_t peer_down;
}; };
static const struct peer_flag_action peer_flag_action_list[] = { 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. */ /* Proper action set. */
static int peer_flag_action_set(const struct peer_flag_action *action_list, static int peer_flag_action_set(const struct peer_flag_action *action_list,
int size, struct peer_flag_action *action, int size, struct peer_flag_action *action,
u_int32_t flag) uint32_t flag)
{ {
int i; int i;
int found = 0; int found = 0;
@ -3817,7 +3815,7 @@ static int peer_flag_action_set(const struct peer_flag_action *action_list,
return found; 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 (flag == PEER_FLAG_SHUTDOWN) {
if (CHECK_FLAG(peer->flags, flag)) { 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; msglen = 128;
if (msglen) { if (msglen) {
u_char msgbuf[129]; uint8_t msgbuf[129];
msgbuf[0] = msglen; msgbuf[0] = msglen;
memcpy(msgbuf + 1, msg, 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. */ /* 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 found;
int size; int size;
@ -3955,18 +3953,18 @@ static int peer_flag_modify(struct peer *peer, u_int32_t flag, int set)
return 0; 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); 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); return peer_flag_modify(peer, flag, 0);
} }
static int peer_af_flag_modify(struct peer *peer, afi_t afi, safi_t safi, 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 found;
int size; int size;
@ -4122,13 +4120,12 @@ static int peer_af_flag_modify(struct peer *peer, afi_t afi, safi_t safi,
return 0; 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); return peer_af_flag_modify(peer, afi, safi, flag, 1);
} }
int peer_af_flag_unset(struct peer *peer, afi_t afi, safi_t safi, int peer_af_flag_unset(struct peer *peer, afi_t afi, safi_t safi, uint32_t flag)
u_int32_t flag)
{ {
return peer_af_flag_modify(peer, afi, safi, flag, 0); 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; 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; peer->port = port;
return 0; return 0;
@ -4599,7 +4596,7 @@ static void peer_on_policy_change(struct peer *peer, afi_t afi, safi_t safi,
/* neighbor weight. */ /* 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 peer_group *group;
struct listnode *node, *nnode; struct listnode *node, *nnode;
@ -4679,7 +4676,7 @@ int peer_weight_unset(struct peer *peer, afi_t afi, safi_t safi)
return 0; 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 peer_group *group;
struct listnode *node, *nnode; struct listnode *node, *nnode;
@ -4760,7 +4757,7 @@ int peer_timers_unset(struct peer *peer)
return 0; 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 peer_group *group;
struct listnode *node, *nnode; struct listnode *node, *nnode;
@ -4813,7 +4810,7 @@ int peer_timers_connect_unset(struct peer *peer)
return 0; 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 peer_group *group;
struct listnode *node, *nnode; 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, int peer_maximum_prefix_set(struct peer *peer, afi_t afi, safi_t safi,
u_int32_t max, u_char threshold, int warning, uint32_t max, uint8_t threshold, int warning,
u_int16_t restart) uint16_t restart)
{ {
struct peer_group *group; struct peer_group *group;
struct listnode *node, *nnode; 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], || CHECK_FLAG(peer->af_cap[afi][safi],
PEER_CAP_ORF_PREFIX_RM_OLD_RCV))) { PEER_CAP_ORF_PREFIX_RM_OLD_RCV))) {
struct bgp_filter *filter = &peer->filter[afi][safi]; struct bgp_filter *filter = &peer->filter[afi][safi];
u_char prefix_type; uint8_t prefix_type;
if (CHECK_FLAG(peer->af_cap[afi][safi], if (CHECK_FLAG(peer->af_cap[afi][safi],
PEER_CAP_ORF_PREFIX_RM_RCV)) 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.*/ /* 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) json_object *json)
{ {
time_t uptime1, epoch_tbuf; 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 (len < BGP_UPTIME_LEN) {
if (!use_json) { if (!use_json) {
zlog_warn("peer_uptime (): buffer shortage %lu", zlog_warn("peer_uptime (): buffer shortage %lu",
(u_long)len); (unsigned long)len);
/* XXX: should return status instead of buf... */ /* XXX: should return status instead of buf... */
snprintf(buf, len, "<error> "); snprintf(buf, len, "<error> ");
} }

View File

@ -60,9 +60,9 @@ enum { AS_UNSPECIFIED = 0,
}; };
/* Typedef BGP specific types. */ /* Typedef BGP specific types. */
typedef u_int32_t as_t; typedef uint32_t as_t;
typedef u_int16_t as16_t; /* we may still encounter 16 Bit asnums */ typedef uint16_t as16_t; /* we may still encounter 16 Bit asnums */
typedef u_int16_t bgp_size_t; typedef uint16_t bgp_size_t;
#define max(a, b) \ #define max(a, b) \
({ \ ({ \
@ -112,7 +112,7 @@ struct bgp_master {
struct list *listen_sockets; struct list *listen_sockets;
/* BGP port number. */ /* BGP port number. */
u_int16_t port; uint16_t port;
/* Listener address */ /* Listener address */
char *address; char *address;
@ -121,7 +121,7 @@ struct bgp_master {
time_t start_time; time_t start_time;
/* Various BGP global configuration. */ /* Various BGP global configuration. */
u_char options; uint8_t options;
#define BGP_OPT_NO_FIB (1 << 0) #define BGP_OPT_NO_FIB (1 << 0)
#define BGP_OPT_MULTIPLE_INSTANCE (1 << 1) #define BGP_OPT_MULTIPLE_INSTANCE (1 << 1)
#define BGP_OPT_CONFIG_CISCO (1 << 2) #define BGP_OPT_CONFIG_CISCO (1 << 2)
@ -132,7 +132,7 @@ struct bgp_master {
/* timer to dampen route map changes */ /* timer to dampen route map changes */
struct thread *t_rmap_update; /* Handle route map updates */ 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 */ #define RMAP_DEFAULT_UPDATE_TIMER 5 /* disabled by default */
/* Id space for automatic RD derivation for an EVI/VRF */ /* Id space for automatic RD derivation for an EVI/VRF */
@ -149,11 +149,11 @@ struct bgp_rmap {
}; };
struct bgp_redist { struct bgp_redist {
u_short instance; unsigned short instance;
/* BGP redistribute metric configuration. */ /* BGP redistribute metric configuration. */
u_char redist_metric_flag; uint8_t redist_metric_flag;
u_int32_t redist_metric; uint32_t redist_metric;
/* BGP redistribute route-map. */ /* BGP redistribute route-map. */
struct bgp_rmap rmap; struct bgp_rmap rmap;
@ -216,23 +216,23 @@ struct bgp {
* Global statistics for update groups. * Global statistics for update groups.
*/ */
struct { struct {
u_int32_t join_events; uint32_t join_events;
u_int32_t prune_events; uint32_t prune_events;
u_int32_t merge_events; uint32_t merge_events;
u_int32_t split_events; uint32_t split_events;
u_int32_t updgrp_switch_events; uint32_t updgrp_switch_events;
u_int32_t peer_refreshes_combined; uint32_t peer_refreshes_combined;
u_int32_t adj_count; uint32_t adj_count;
u_int32_t merge_checks_triggered; uint32_t merge_checks_triggered;
u_int32_t updgrps_created; uint32_t updgrps_created;
u_int32_t updgrps_deleted; uint32_t updgrps_deleted;
u_int32_t subgrps_created; uint32_t subgrps_created;
u_int32_t subgrps_deleted; uint32_t subgrps_deleted;
} update_group_stats; } update_group_stats;
/* BGP configuration. */ /* BGP configuration. */
u_int16_t config; uint16_t config;
#define BGP_CONFIG_CLUSTER_ID (1 << 0) #define BGP_CONFIG_CLUSTER_ID (1 << 0)
#define BGP_CONFIG_CONFEDERATION (1 << 1) #define BGP_CONFIG_CONFEDERATION (1 << 1)
@ -252,45 +252,45 @@ struct bgp {
struct thread struct thread
*t_startup; /* start-up timer on only once at the beginning */ *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 */ #define BGP_MAXMED_ONSTARTUP_UNCONFIGURED 0 /* 0 means off, its the default */
u_int32_t maxmed_onstartup_value; /* Max-med value when active on uint32_t maxmed_onstartup_value; /* Max-med value when active on
start-up */ start-up */
struct thread struct thread
*t_maxmed_onstartup; /* non-null when max-med onstartup is on */ *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 */ #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 */ #define BGP_MAXMED_VALUE_DEFAULT 4294967294 /* Maximum by default */
u_char maxmed_active; /* 1/0 if max-med is active or not */ uint8_t maxmed_active; /* 1/0 if max-med is active or not */
u_int32_t maxmed_value; /* Max-med value when its active */ uint32_t maxmed_value; /* Max-med value when its active */
/* BGP update delay on startup */ /* BGP update delay on startup */
struct thread *t_update_delay; struct thread *t_update_delay;
struct thread *t_establish_wait; struct thread *t_establish_wait;
u_char update_delay_over; uint8_t update_delay_over;
u_char main_zebra_update_hold; uint8_t main_zebra_update_hold;
u_char main_peers_update_hold; uint8_t main_peers_update_hold;
u_int16_t v_update_delay; uint16_t v_update_delay;
u_int16_t v_establish_wait; uint16_t v_establish_wait;
char update_delay_begin_time[64]; char update_delay_begin_time[64];
char update_delay_end_time[64]; char update_delay_end_time[64];
char update_delay_zebra_resume_time[64]; char update_delay_zebra_resume_time[64];
char update_delay_peers_resume_time[64]; char update_delay_peers_resume_time[64];
u_int32_t established; uint32_t established;
u_int32_t restarted_peers; uint32_t restarted_peers;
u_int32_t implicit_eors; uint32_t implicit_eors;
u_int32_t explicit_eors; uint32_t explicit_eors;
#define BGP_UPDATE_DELAY_DEF 0 #define BGP_UPDATE_DELAY_DEF 0
#define BGP_UPDATE_DELAY_MIN 0 #define BGP_UPDATE_DELAY_MIN 0
#define BGP_UPDATE_DELAY_MAX 3600 #define BGP_UPDATE_DELAY_MAX 3600
/* BGP flags. */ /* BGP flags. */
u_int32_t flags; uint32_t flags;
#define BGP_FLAG_ALWAYS_COMPARE_MED (1 << 0) #define BGP_FLAG_ALWAYS_COMPARE_MED (1 << 0)
#define BGP_FLAG_DETERMINISTIC_MED (1 << 1) #define BGP_FLAG_DETERMINISTIC_MED (1 << 1)
#define BGP_FLAG_MED_MISSING_AS_WORST (1 << 2) #define BGP_FLAG_MED_MISSING_AS_WORST (1 << 2)
@ -315,7 +315,7 @@ struct bgp {
#define BGP_FLAG_GRACEFUL_SHUTDOWN (1 << 21) #define BGP_FLAG_GRACEFUL_SHUTDOWN (1 << 21)
/* BGP Per AF flags */ /* 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_DAMPENING (1 << 0)
#define BGP_CONFIG_VRF_TO_MPLSVPN_EXPORT (1 << 1) #define BGP_CONFIG_VRF_TO_MPLSVPN_EXPORT (1 << 1)
#define BGP_CONFIG_MPLSVPN_TO_VRF_IMPORT (1 << 2) #define BGP_CONFIG_MPLSVPN_TO_VRF_IMPORT (1 << 2)
@ -357,36 +357,36 @@ struct bgp {
struct list *redist[AFI_MAX][ZEBRA_ROUTE_MAX]; struct list *redist[AFI_MAX][ZEBRA_ROUTE_MAX];
/* Allocate MPLS labels */ /* 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 */ /* timer to re-evaluate neighbor default-originate route-maps */
struct thread *t_rmap_def_originate_eval; struct thread *t_rmap_def_originate_eval;
#define RMAP_DEFAULT_ORIGINATE_EVAL_TIMER 5 #define RMAP_DEFAULT_ORIGINATE_EVAL_TIMER 5
/* BGP distance configuration. */ /* BGP distance configuration. */
u_char distance_ebgp[AFI_MAX][SAFI_MAX]; uint8_t distance_ebgp[AFI_MAX][SAFI_MAX];
u_char distance_ibgp[AFI_MAX][SAFI_MAX]; uint8_t distance_ibgp[AFI_MAX][SAFI_MAX];
u_char distance_local[AFI_MAX][SAFI_MAX]; uint8_t distance_local[AFI_MAX][SAFI_MAX];
/* BGP default local-preference. */ /* BGP default local-preference. */
u_int32_t default_local_pref; uint32_t default_local_pref;
/* BGP default subgroup pkt queue max */ /* BGP default subgroup pkt queue max */
u_int32_t default_subgroup_pkt_queue_max; uint32_t default_subgroup_pkt_queue_max;
/* BGP default timer. */ /* BGP default timer. */
u_int32_t default_holdtime; uint32_t default_holdtime;
u_int32_t default_keepalive; uint32_t default_keepalive;
/* BGP graceful restart */ /* BGP graceful restart */
u_int32_t restart_time; uint32_t restart_time;
u_int32_t stalepath_time; uint32_t stalepath_time;
/* Maximum-paths configuration */ /* Maximum-paths configuration */
struct bgp_maxpaths_cfg { struct bgp_maxpaths_cfg {
u_int16_t maxpaths_ebgp; uint16_t maxpaths_ebgp;
u_int16_t maxpaths_ibgp; uint16_t maxpaths_ibgp;
u_int16_t ibgp_flags; uint16_t ibgp_flags;
#define BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN (1 << 0) #define BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN (1 << 0)
} maxpaths[AFI_MAX][SAFI_MAX]; } maxpaths[AFI_MAX][SAFI_MAX];
@ -401,7 +401,7 @@ struct bgp {
/* Auto-shutdown new peers */ /* Auto-shutdown new peers */
bool autoshutdown; bool autoshutdown;
u_int32_t addpath_tx_id; uint32_t addpath_tx_id;
int addpath_tx_used[AFI_MAX][SAFI_MAX]; int addpath_tx_used[AFI_MAX][SAFI_MAX];
#if ENABLE_BGP_VNC #if ENABLE_BGP_VNC
@ -510,11 +510,11 @@ struct peer_group {
/* BGP Notify message format. */ /* BGP Notify message format. */
struct bgp_notify { struct bgp_notify {
u_char code; uint8_t code;
u_char subcode; uint8_t subcode;
char *data; char *data;
bgp_size_t length; bgp_size_t length;
u_char *raw_data; uint8_t *raw_data;
}; };
/* Next hop self address. */ /* Next hop self address. */
@ -536,7 +536,7 @@ struct bgp_nexthop {
#define BGP_RD_SIZE 8 #define BGP_RD_SIZE 8
struct bgp_rd { struct bgp_rd {
u_char val[BGP_RD_SIZE]; uint8_t val[BGP_RD_SIZE];
}; };
#define RMAP_IN 0 #define RMAP_IN 0
@ -720,13 +720,13 @@ struct peer {
struct bgp_nexthop nexthop; /* Nexthop */ struct bgp_nexthop nexthop; /* Nexthop */
/* Peer address family configuration. */ /* Peer address family configuration. */
u_char afc[AFI_MAX][SAFI_MAX]; uint8_t afc[AFI_MAX][SAFI_MAX];
u_char afc_nego[AFI_MAX][SAFI_MAX]; uint8_t afc_nego[AFI_MAX][SAFI_MAX];
u_char afc_adv[AFI_MAX][SAFI_MAX]; uint8_t afc_adv[AFI_MAX][SAFI_MAX];
u_char afc_recv[AFI_MAX][SAFI_MAX]; uint8_t afc_recv[AFI_MAX][SAFI_MAX];
/* Capability flags (reset in bgp_stop) */ /* 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_ADV (1 << 0) /* refresh advertised */
#define PEER_CAP_REFRESH_OLD_RCV (1 << 1) /* refresh old received */ #define PEER_CAP_REFRESH_OLD_RCV (1 << 1) /* refresh old received */
#define PEER_CAP_REFRESH_NEW_RCV (1 << 2) /* refresh rfc 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 */ #define PEER_CAP_HOSTNAME_RCV (1 << 16) /* hostname received */
/* Capability flags (reset in bgp_stop) */ /* 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_SM_ADV (1 << 0) /* send-mode advertised */
#define PEER_CAP_ORF_PREFIX_RM_ADV (1 << 1) /* receive-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 */ #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 */ #define PEER_CAP_ENHE_AF_NEGO (1 << 14) /* Extended nexthop afi/safi negotiated */
/* Global configuration flags. */ /* Global configuration flags. */
u_int32_t flags; uint32_t flags;
#define PEER_FLAG_PASSIVE (1 << 0) /* passive mode */ #define PEER_FLAG_PASSIVE (1 << 0) /* passive mode */
#define PEER_FLAG_SHUTDOWN (1 << 1) /* shutdown */ #define PEER_FLAG_SHUTDOWN (1 << 1) /* shutdown */
#define PEER_FLAG_DONT_CAPABILITY (1 << 2) /* dont-capability */ #define PEER_FLAG_DONT_CAPABILITY (1 << 2) /* dont-capability */
@ -786,10 +786,10 @@ struct peer {
char *tx_shutdown_message; char *tx_shutdown_message;
/* NSF mode (graceful restart) */ /* NSF mode (graceful restart) */
u_char nsf[AFI_MAX][SAFI_MAX]; uint8_t nsf[AFI_MAX][SAFI_MAX];
/* Per AF configuration flags. */ /* 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_COMMUNITY (1 << 0) /* send-community */
#define PEER_FLAG_SEND_EXT_COMMUNITY (1 << 1) /* send-community ext. */ #define PEER_FLAG_SEND_EXT_COMMUNITY (1 << 1) /* send-community ext. */
#define PEER_FLAG_NEXTHOP_SELF (1 << 2) /* next-hop-self */ #define PEER_FLAG_NEXTHOP_SELF (1 << 2) /* next-hop-self */
@ -828,7 +828,7 @@ struct peer {
} default_rmap[AFI_MAX][SAFI_MAX]; } default_rmap[AFI_MAX][SAFI_MAX];
/* Peer status flags. */ /* Peer status flags. */
u_int16_t sflags; uint16_t sflags;
#define PEER_STATUS_ACCEPT_PEER (1 << 0) /* accept peer */ #define PEER_STATUS_ACCEPT_PEER (1 << 0) /* accept peer */
#define PEER_STATUS_PREFIX_OVERFLOW (1 << 1) /* prefix-overflow */ #define PEER_STATUS_PREFIX_OVERFLOW (1 << 1) /* prefix-overflow */
#define PEER_STATUS_CAPABILITY_OPEN (1 << 2) /* capability open send */ #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 */ #define PEER_STATUS_NSF_WAIT (1 << 6) /* wait comeback peer */
/* Peer status af flags (reset in bgp_stop) */ /* 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_PREFIX_SEND (1 << 0) /* prefix-list send peer */
#define PEER_STATUS_ORF_WAIT_REFRESH (1 << 1) /* wait refresh received peer */ #define PEER_STATUS_ORF_WAIT_REFRESH (1 << 1) /* wait refresh received peer */
#define PEER_STATUS_PREFIX_THRESHOLD (1 << 2) /* exceed prefix-threshold */ #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 */ #define PEER_STATUS_EOR_RECEIVED (1 << 5) /* end-of-rib received from peer */
/* Default attribute value for the 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_TIMER (1 << 0) /* keepalive & holdtime */
#define PEER_CONFIG_CONNECT (1 << 1) /* connect */ #define PEER_CONFIG_CONNECT (1 << 1) /* connect */
#define PEER_CONFIG_ROUTEADV (1 << 2) /* route advertise */ #define PEER_CONFIG_ROUTEADV (1 << 2) /* route advertise */
@ -934,11 +934,11 @@ struct peer {
_Atomic uint32_t dynamic_cap_out; /* Dynamic Capability output count. */ _Atomic uint32_t dynamic_cap_out; /* Dynamic Capability output count. */
/* BGP state count */ /* BGP state count */
u_int32_t established; /* Established */ uint32_t established; /* Established */
u_int32_t dropped; /* Dropped */ uint32_t dropped; /* Dropped */
/* Update delay related fields */ /* 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 */ for EOR */
/* Syncronization list and time. */ /* Syncronization list and time. */
@ -972,8 +972,8 @@ struct peer {
/* Max prefix count. */ /* Max prefix count. */
unsigned long pmax[AFI_MAX][SAFI_MAX]; unsigned long pmax[AFI_MAX][SAFI_MAX];
u_char pmax_threshold[AFI_MAX][SAFI_MAX]; uint8_t pmax_threshold[AFI_MAX][SAFI_MAX];
u_int16_t pmax_restart[AFI_MAX][SAFI_MAX]; uint16_t pmax_restart[AFI_MAX][SAFI_MAX];
#define MAXIMUM_PREFIX_THRESHOLD_DEFAULT 75 #define MAXIMUM_PREFIX_THRESHOLD_DEFAULT 75
/* allowas-in. */ /* allowas-in. */
@ -1011,10 +1011,10 @@ struct peer {
#define PEER_DOWN_IF_DOWN 25 /* Interface down */ #define PEER_DOWN_IF_DOWN 25 /* Interface down */
#define PEER_DOWN_NBR_ADDR_DEL 26 /* Peer address lost */ #define PEER_DOWN_NBR_ADDR_DEL 26 /* Peer address lost */
unsigned long last_reset_cause_size; 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.*/ /* 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_IN (1 << 0) /* neighbor route-map in */
#define PEER_RMAP_TYPE_OUT (1 << 1) /* neighbor route-map out */ #define PEER_RMAP_TYPE_OUT (1 << 1) /* neighbor route-map out */
#define PEER_RMAP_TYPE_NETWORK (1 << 2) /* network route-map */ #define PEER_RMAP_TYPE_NETWORK (1 << 2) /* network route-map */
@ -1053,7 +1053,7 @@ struct bgp_nlri {
uint8_t safi; /* iana_safi_t */ uint8_t safi; /* iana_safi_t */
/* Pointer to NLRI byte stream. */ /* Pointer to NLRI byte stream. */
u_char *nlri; uint8_t *nlri;
/* Length of whole NLRI. */ /* Length of whole NLRI. */
bgp_size_t length; bgp_size_t length;
@ -1354,7 +1354,7 @@ extern struct peer *peer_create(union sockunion *, const char *, struct bgp *,
struct peer_group *); struct peer_group *);
extern struct peer *peer_create_accept(struct bgp *); extern struct peer *peer_create_accept(struct bgp *);
extern void peer_xfer_config(struct peer *dst, struct peer *src); 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 *); 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_add(struct bgp *, as_t);
extern int bgp_confederation_peers_remove(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, extern int bgp_timers_set(struct bgp *, uint32_t keepalive, uint32_t holdtime);
u_int32_t holdtime);
extern int bgp_timers_unset(struct bgp *); 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_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_default_subgroup_pkt_queue_max_unset(struct bgp *bgp);
extern int bgp_listen_limit_set(struct bgp *, int); 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 *); struct peer_group *, as_t *);
extern int peer_group_unbind(struct bgp *, struct peer *, struct peer_group *); 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_set(struct peer *, uint32_t);
extern int peer_flag_unset(struct peer *, u_int32_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_set(struct peer *, afi_t, safi_t, uint32_t);
extern int peer_af_flag_unset(struct peer *, afi_t, safi_t, u_int32_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, u_int32_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_set(struct peer *, int);
extern int peer_ebgp_multihop_unset(struct peer *); 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 *); const char *);
extern int peer_default_originate_unset(struct peer *, afi_t, safi_t); 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_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_weight_unset(struct peer *, afi_t, safi_t);
extern int peer_timers_set(struct peer *, u_int32_t keepalive, extern int peer_timers_set(struct peer *, uint32_t keepalive,
u_int32_t holdtime); uint32_t holdtime);
extern int peer_timers_unset(struct peer *); 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_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 int peer_advertise_interval_unset(struct peer *);
extern void peer_interface_set(struct peer *, const char *); 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_unsuppress_map_unset(struct peer *, afi_t, safi_t);
extern int peer_maximum_prefix_set(struct peer *, afi_t, safi_t, u_int32_t, extern int peer_maximum_prefix_set(struct peer *, afi_t, safi_t, uint32_t,
u_char, int, u_int16_t); uint8_t, int, uint16_t);
extern int peer_maximum_prefix_unset(struct peer *, afi_t, safi_t); extern int peer_maximum_prefix_unset(struct peer *, afi_t, safi_t);
extern int peer_clear(struct peer *, struct listnode **); extern int peer_clear(struct peer *, struct listnode **);

View File

@ -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, extern void rfapiProcessUpdate(struct peer *peer, void *rfd, struct prefix *p,
struct prefix_rd *prd, struct attr *attr, struct prefix_rd *prd, struct attr *attr,
afi_t afi, safi_t safi, u_char type, afi_t afi, safi_t safi, uint8_t type,
u_char sub_type, uint32_t *label); uint8_t sub_type, uint32_t *label);
extern void rfapiProcessWithdraw(struct peer *peer, void *rfd, struct prefix *p, extern void rfapiProcessWithdraw(struct peer *peer, void *rfd, struct prefix *p,
struct prefix_rd *prd, struct attr *attr, 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); extern void rfapiProcessPeerDown(struct peer *peer);

View File

@ -503,7 +503,7 @@ int rfapiGetUnAddrOfVpnBi(struct bgp_info *bi, struct prefix *p)
*/ */
static struct bgp_info *rfapiBgpInfoCreate(struct attr *attr, struct peer *peer, static struct bgp_info *rfapiBgpInfoCreate(struct attr *attr, struct peer *peer,
void *rfd, struct prefix_rd *prd, void *rfd, struct prefix_rd *prd,
u_char type, u_char sub_type, uint8_t type, uint8_t sub_type,
uint32_t *label) uint32_t *label)
{ {
struct bgp_info *new; 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 peer *, void *, struct prefix *,
struct prefix *, afi_t, struct prefix *, afi_t,
struct prefix_rd *, struct attr *, 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, static void rfapiExpireEncapNow(struct rfapi_import_table *it,
@ -2932,8 +2932,8 @@ static void rfapiBgpInfoFilteredImportEncap(
struct prefix *aux_prefix, /* Unused for encap routes */ struct prefix *aux_prefix, /* Unused for encap routes */
afi_t afi, struct prefix_rd *prd, afi_t afi, struct prefix_rd *prd,
struct attr *attr, /* part of bgp_info */ struct attr *attr, /* part of bgp_info */
u_char type, /* part of bgp_info */ uint8_t type, /* part of bgp_info */
u_char sub_type, /* part of bgp_info */ uint8_t sub_type, /* part of bgp_info */
uint32_t *label) /* part of bgp_info */ uint32_t *label) /* part of bgp_info */
{ {
struct route_table *rt = NULL; struct route_table *rt = NULL;
@ -3391,8 +3391,8 @@ void rfapiBgpInfoFilteredImportVPN(
struct prefix *aux_prefix, /* AFI_L2VPN: optional IP */ struct prefix *aux_prefix, /* AFI_L2VPN: optional IP */
afi_t afi, struct prefix_rd *prd, afi_t afi, struct prefix_rd *prd,
struct attr *attr, /* part of bgp_info */ struct attr *attr, /* part of bgp_info */
u_char type, /* part of bgp_info */ uint8_t type, /* part of bgp_info */
u_char sub_type, /* part of bgp_info */ uint8_t sub_type, /* part of bgp_info */
uint32_t *label) /* part of bgp_info */ uint32_t *label) /* part of bgp_info */
{ {
struct route_table *rt = NULL; struct route_table *rt = NULL;
@ -3869,8 +3869,8 @@ static void rfapiBgpInfoFilteredImportBadSafi(
struct prefix *aux_prefix, /* AFI_L2VPN: optional IP */ struct prefix *aux_prefix, /* AFI_L2VPN: optional IP */
afi_t afi, struct prefix_rd *prd, afi_t afi, struct prefix_rd *prd,
struct attr *attr, /* part of bgp_info */ struct attr *attr, /* part of bgp_info */
u_char type, /* part of bgp_info */ uint8_t type, /* part of bgp_info */
u_char sub_type, /* part of bgp_info */ uint8_t sub_type, /* part of bgp_info */
uint32_t *label) /* part of bgp_info */ uint32_t *label) /* part of bgp_info */
{ {
vnc_zlog_debug_verbose("%s: Error, bad safi", __func__); vnc_zlog_debug_verbose("%s: Error, bad safi", __func__);
@ -3896,8 +3896,8 @@ rfapiBgpInfoFilteredImportFunction(safi_t safi)
void rfapiProcessUpdate(struct peer *peer, void rfapiProcessUpdate(struct peer *peer,
void *rfd, /* set when looped from RFP/RFAPI */ void *rfd, /* set when looped from RFP/RFAPI */
struct prefix *p, struct prefix_rd *prd, struct prefix *p, struct prefix_rd *prd,
struct attr *attr, afi_t afi, safi_t safi, u_char type, struct attr *attr, afi_t afi, safi_t safi, uint8_t type,
u_char sub_type, uint32_t *label) uint8_t sub_type, uint32_t *label)
{ {
struct bgp *bgp; struct bgp *bgp;
struct rfapi *h; struct rfapi *h;
@ -3981,7 +3981,7 @@ void rfapiProcessUpdate(struct peer *peer,
void rfapiProcessWithdraw(struct peer *peer, void *rfd, struct prefix *p, void rfapiProcessWithdraw(struct peer *peer, void *rfd, struct prefix *p,
struct prefix_rd *prd, struct attr *attr, afi_t afi, 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 bgp *bgp;
struct rfapi *h; struct rfapi *h;
@ -4232,7 +4232,7 @@ static void rfapiBgpTableFilteredImport(struct bgp *bgp,
struct bgp_info *bi; struct bgp_info *bi;
for (bi = rn2->info; bi; bi = bi->next) { for (bi = rn2->info; bi; bi = bi->next) {
u_int32_t label = 0; uint32_t label = 0;
if (CHECK_FLAG(bi->flags, if (CHECK_FLAG(bi->flags,
BGP_INFO_REMOVED)) BGP_INFO_REMOVED))

View File

@ -148,8 +148,8 @@ extern void rfapiBgpInfoFilteredImportVPN(
struct prefix *aux_prefix, /* AFI_ETHER: optional IP */ struct prefix *aux_prefix, /* AFI_ETHER: optional IP */
afi_t afi, struct prefix_rd *prd, afi_t afi, struct prefix_rd *prd,
struct attr *attr, /* part of bgp_info */ struct attr *attr, /* part of bgp_info */
u_char type, /* part of bgp_info */ uint8_t type, /* part of bgp_info */
u_char sub_type, /* part of bgp_info */ uint8_t sub_type, /* part of bgp_info */
uint32_t *label); /* part of bgp_info */ uint32_t *label); /* part of bgp_info */
extern struct rfapi_next_hop_entry *rfapiEthRouteNode2NextHopList( extern struct rfapi_next_hop_entry *rfapiEthRouteNode2NextHopList(

View File

@ -1068,7 +1068,7 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
inet_ntop(pfx_vn.family, &pfx_vn.u.prefix, buf_ntop, inet_ntop(pfx_vn.family, &pfx_vn.u.prefix, buf_ntop,
BUFSIZ)); BUFSIZ));
if (bi->extra) { 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); snprintf(buf_vn, BUFSIZ, "Label: %d", l);
} else /* should never happen */ } 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) { 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)) { if (!MPLS_LABEL_IS_NULL(l)) {
fp(out, " Label: %d", l); fp(out, " Label: %d", l);
if (nlines == 1) if (nlines == 1)
@ -1631,7 +1631,7 @@ void rfapiPrintDescriptor(struct vty *vty, struct rfapi_descriptor *rfd)
} }
for (afi = AFI_IP; afi < AFI_MAX; ++afi) { for (afi = AFI_IP; afi < AFI_MAX; ++afi) {
u_char family; uint8_t family;
family = afi2family(afi); family = afi2family(afi);
if (!family) if (!family)

View File

@ -39,8 +39,8 @@ struct vnc_export_info {
struct vnc_export_info *next; struct vnc_export_info *next;
struct route_node *node; struct route_node *node;
struct peer *peer; struct peer *peer;
u_char type; uint8_t type;
u_char subtype; uint8_t subtype;
uint32_t lifetime; uint32_t lifetime;
struct thread *timer; struct thread *timer;
}; };

View File

@ -124,14 +124,14 @@ struct prefix_bag {
struct bgp_info *ubi; /* unicast route */ struct bgp_info *ubi; /* unicast route */
}; };
static const u_char maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0, static const uint8_t maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0,
0xf8, 0xfc, 0xfe, 0xff}; 0xf8, 0xfc, 0xfe, 0xff};
int vnc_prefix_cmp(void *pfx1, void *pfx2) int vnc_prefix_cmp(void *pfx1, void *pfx2)
{ {
int offset; int offset;
int shift; int shift;
u_char mask; uint8_t mask;
struct prefix *p1 = pfx1; struct prefix *p1 = pfx1;
struct prefix *p2 = pfx2; struct prefix *p2 = pfx2;
@ -154,8 +154,8 @@ int vnc_prefix_cmp(void *pfx1, void *pfx2)
} }
/* Set both prefix's head pointer. */ /* Set both prefix's head pointer. */
const u_char *pp1 = (const u_char *)&p1->u.prefix; const uint8_t *pp1 = (const uint8_t *)&p1->u.prefix;
const u_char *pp2 = (const u_char *)&p2->u.prefix; const uint8_t *pp2 = (const uint8_t *)&p2->u.prefix;
while (offset--) { while (offset--) {
if (*pp1 < *pp2) if (*pp1 < *pp2)
@ -1762,7 +1762,7 @@ static void vnc_import_bgp_exterior_add_route_it(
bi_interior = bi_interior->next) { bi_interior = bi_interior->next) {
struct prefix_rd *prd; struct prefix_rd *prd;
struct attr new_attr; struct attr new_attr;
u_int32_t label = 0; uint32_t label = 0;
if (!is_usable_interior_route(bi_interior)) if (!is_usable_interior_route(bi_interior))
continue; continue;
@ -1941,7 +1941,7 @@ void vnc_import_bgp_exterior_del_route(
for (bi_interior = rn->info; bi_interior; for (bi_interior = rn->info; bi_interior;
bi_interior = bi_interior->next) { bi_interior = bi_interior->next) {
struct prefix_rd *prd; struct prefix_rd *prd;
u_int32_t label = 0; uint32_t label = 0;
if (!is_usable_interior_route(bi_interior)) if (!is_usable_interior_route(bi_interior))
continue; continue;
@ -2102,7 +2102,7 @@ void vnc_import_bgp_exterior_add_route_interior(
struct prefix_rd *prd; struct prefix_rd *prd;
struct attr new_attr; struct attr new_attr;
u_int32_t label = 0; uint32_t label = 0;
++count; /* debugging */ ++count; /* debugging */
@ -2194,7 +2194,7 @@ void vnc_import_bgp_exterior_add_route_interior(
struct bgp_info *bi; struct bgp_info *bi;
struct prefix_rd *prd; struct prefix_rd *prd;
struct attr new_attr; struct attr new_attr;
u_int32_t label = 0; uint32_t label = 0;
/* do pull-down */ /* do pull-down */
@ -2336,7 +2336,7 @@ void vnc_import_bgp_exterior_add_route_interior(
struct prefix_rd *prd; struct prefix_rd *prd;
struct attr new_attr; struct attr new_attr;
u_int32_t label = 0; uint32_t label = 0;
/* do pull-down */ /* do pull-down */
@ -2476,7 +2476,7 @@ void vnc_import_bgp_exterior_del_route_interior(
&cursor)) { &cursor)) {
struct prefix_rd *prd; struct prefix_rd *prd;
u_int32_t label = 0; uint32_t label = 0;
if (bi_interior->extra) { if (bi_interior->extra) {
prd = &bi_interior->extra->vnc.import.rd; prd = &bi_interior->extra->vnc.import.rd;
@ -2549,7 +2549,7 @@ void vnc_import_bgp_exterior_del_route_interior(
struct prefix_rd *prd; struct prefix_rd *prd;
struct attr new_attr; struct attr new_attr;
u_int32_t label = 0; uint32_t label = 0;
if (bi->type == ZEBRA_ROUTE_BGP_DIRECT_EXT) if (bi->type == ZEBRA_ROUTE_BGP_DIRECT_EXT)
continue; continue;

View File

@ -58,7 +58,7 @@ static struct zclient *zclient_vnc = NULL;
/* /*
* Routes coming from zebra get added to VNC here * 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) uint8_t type)
{ {
struct bgp *bgp = bgp_get_default(); 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 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, unsigned int *nh_count_ret,
void **nh_ary_ret, /* returned address array */ void **nh_ary_ret, /* returned address array */
void **nhp_ary_ret) /* returned pointer array */ void **nhp_ary_ret) /* returned pointer array */

View File

@ -650,7 +650,7 @@ struct cmd\_token
struct cmd_token struct cmd_token
{ {
enum cmd_token_type type; // token type 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? bool allowrepeat; // matcher allowed to match token repetitively?
char *text; // token text char *text; // token text

View File

@ -264,7 +264,7 @@ Zebra data structure
RNH table:: RNH table::
O . O
/ \ / \
O O O O
/ \ / \
@ -272,7 +272,7 @@ RNH table::
struct rnh struct rnh
{ {
u_char flags; uint8_t flags;
struct route_entry *state; struct route_entry *state;
struct list *client_list; struct list *client_list;
struct route_node *node; struct route_node *node;

View File

@ -496,6 +496,35 @@ For GNU coding style, use ``indent`` with the following invocation:
indent -nut -nfc1 file_for_submission.c 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 Exceptions
^^^^^^^^^^ ^^^^^^^^^^

View File

@ -117,11 +117,11 @@ void eigrp_ip_header_dump(struct ip *iph)
zlog_debug("ip_hl %u", iph->ip_hl); zlog_debug("ip_hl %u", iph->ip_hl);
zlog_debug("ip_tos %u", iph->ip_tos); zlog_debug("ip_tos %u", iph->ip_tos);
zlog_debug("ip_len %u", iph->ip_len); zlog_debug("ip_len %u", iph->ip_len);
zlog_debug("ip_id %u", (u_int32_t)iph->ip_id); zlog_debug("ip_id %u", (uint32_t)iph->ip_id);
zlog_debug("ip_off %u", (u_int32_t)iph->ip_off); zlog_debug("ip_off %u", (uint32_t)iph->ip_off);
zlog_debug("ip_ttl %u", iph->ip_ttl); zlog_debug("ip_ttl %u", iph->ip_ttl);
zlog_debug("ip_p %u", iph->ip_p); 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_src %s", inet_ntoa(iph->ip_src));
zlog_debug("ip_dst %s", inet_ntoa(iph->ip_dst)); 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) const char *eigrp_topology_ip_string(struct eigrp_prefix_entry *tn)
{ {
static char buf[EIGRP_IF_STRING_MAXLEN] = ""; static char buf[EIGRP_IF_STRING_MAXLEN] = "";
u_int32_t ifaddr; uint32_t ifaddr;
ifaddr = ntohl(tn->destination->u.prefix4.s_addr); ifaddr = ntohl(tn->destination->u.prefix4.s_addr);
snprintf(buf, EIGRP_IF_STRING_MAXLEN, "%u.%u.%u.%u", 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) const char *eigrp_if_ip_string(struct eigrp_interface *ei)
{ {
static char buf[EIGRP_IF_STRING_MAXLEN] = ""; static char buf[EIGRP_IF_STRING_MAXLEN] = "";
u_int32_t ifaddr; uint32_t ifaddr;
if (!ei) if (!ei)
return "inactive"; 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) const char *eigrp_neigh_ip_string(struct eigrp_neighbor *nbr)
{ {
static char buf[EIGRP_IF_STRING_MAXLEN] = ""; static char buf[EIGRP_IF_STRING_MAXLEN] = "";
u_int32_t ifaddr; uint32_t ifaddr;
ifaddr = ntohl(nbr->src.s_addr); ifaddr = ntohl(nbr->src.s_addr);
snprintf(buf, EIGRP_IF_STRING_MAXLEN, "%u.%u.%u.%u", snprintf(buf, EIGRP_IF_STRING_MAXLEN, "%u.%u.%u.%u",

View File

@ -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) if (packet_type == EIGRP_OPC_UPDATE)
return "Update"; return "Update";
@ -264,7 +264,7 @@ eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg)
// struct eigrp *eigrp = msg->eigrp; // struct eigrp *eigrp = msg->eigrp;
struct eigrp_prefix_entry *prefix = msg->prefix; struct eigrp_prefix_entry *prefix = msg->prefix;
struct eigrp_nexthop_entry *entry = msg->entry; struct eigrp_nexthop_entry *entry = msg->entry;
u_char actual_state = prefix->state; uint8_t actual_state = prefix->state;
enum metric_change change; enum metric_change change;
if (entry == NULL) { if (entry == NULL) {

View File

@ -108,7 +108,7 @@ int eigrp_hello_timer(struct thread *thread)
* @param[in] nbr neighbor the ACK should be sent to * @param[in] nbr neighbor the ACK should be sent to
* @param[in] param pointer packet TLV is stored 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 * @par
* Encode Parameter TLV, used to convey metric weights and the hold time. * 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; return nbr;
} }
static u_char static uint8_t
eigrp_hello_authentication_decode(struct stream *s, eigrp_hello_authentication_decode(struct stream *s,
struct eigrp_tlv_hdr_type *tlv_header, struct eigrp_tlv_hdr_type *tlv_header,
struct eigrp_neighbor *nbr) 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 * @param[in] nbr_addr pointer to neighbor address for Peer
* Termination TLV * Termination TLV
* *
* @return u_int16_t number of bytes added to packet stream * @return uint16_t number of bytes added to packet stream
* *
* @par * @par
* Function used to encode Peer Termination TLV to Hello packet. * Function used to encode Peer Termination TLV to Hello packet.
*/ */
static u_int16_t eigrp_peer_termination_encode(struct stream *s, static uint16_t eigrp_peer_termination_encode(struct stream *s,
struct in_addr *nbr_addr) 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 */ /* fill in type and length */
stream_putw(s, EIGRP_TLV_PEER_TERMINATION); 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)); inet_ntoa(nbr->src));
} }
u_int32_t FRR_MAJOR; uint32_t FRR_MAJOR;
u_int32_t FRR_MINOR; uint32_t FRR_MINOR;
void eigrp_sw_version_initialize(void) 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 * @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 * @par
* Store the software version in the specified location. * Store the software version in the specified location.
* This consists of two bytes of OS version, and two bytes of EIGRP * This consists of two bytes of OS version, and two bytes of EIGRP
* revision number. * 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 // setup the tlv fields
stream_putw(s, EIGRP_TLV_SW_VERSION); 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. * If doing mutli-topology, then store the supported TID list.
* This is currently a place holder function * 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; 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 * @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 * @par
* Part of conditional receive process * 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 *eigrp;
struct eigrp_interface *ei; struct eigrp_interface *ei;
struct listnode *node, *node2, *nnode2; 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_RO(eigrp->eiflist, node, ei)) {
for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr)) { for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr)) {
if (nbr->multicast_queue->count > 0) { if (nbr->multicast_queue->count > 0) {
length += (u_int16_t)stream_put_ipv4( length += (uint16_t)stream_put_ipv4(
s, nbr->src.s_addr); s, nbr->src.s_addr);
found = 1; 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 * @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 * @par
* Part of conditional receive process * 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; struct eigrp *eigrp;
eigrp = eigrp_lookup(); 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] ei pointer to interface hello packet came in on
* @param[in,out] s packet stream TLV is stored to * @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 * @par
* Encode Parameter TLV, used to convey metric weights and the hold time. * 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 * Note the addition of K6 for the new extended metrics, and does not apply to
* older TLV packet formats. * older TLV packet formats.
*/ */
static u_int16_t eigrp_hello_parameter_encode(struct eigrp_interface *ei, static uint16_t eigrp_hello_parameter_encode(struct eigrp_interface *ei,
struct stream *s, u_char flags) 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 // add in the parameters TLV
stream_putw(s, EIGRP_TLV_PARAMETER); 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, static struct eigrp_packet *eigrp_hello_encode(struct eigrp_interface *ei,
in_addr_t addr, u_int32_t ack, in_addr_t addr, uint32_t ack,
u_char flags, uint8_t flags,
struct in_addr *nbr_addr) struct in_addr *nbr_addr)
{ {
struct eigrp_packet *ep; struct eigrp_packet *ep;
u_int16_t length = EIGRP_HEADER_LEN; uint16_t length = EIGRP_HEADER_LEN;
// allocate a new packet to be sent // allocate a new packet to be sent
ep = eigrp_packet_new(ei->ifp->mtu, NULL); 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 * sending. If no packets are currently queues, the packet will be
* sent immadiatly * 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 in_addr *nbr_addr)
{ {
struct eigrp_packet *ep = NULL; struct eigrp_packet *ep = NULL;

View File

@ -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)) if (if_is_pointopoint(ifp))
return EIGRP_IFTYPE_POINTOPOINT; return EIGRP_IFTYPE_POINTOPOINT;
@ -413,32 +413,32 @@ struct eigrp_interface *eigrp_if_lookup_by_name(struct eigrp *eigrp,
return NULL; 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; uint64_t temp_bandwidth = (256ull * 10000000) / bandwidth;
temp_bandwidth = temp_bandwidth < EIGRP_MAX_METRIC ? temp_bandwidth temp_bandwidth = temp_bandwidth < EIGRP_MAX_METRIC ? temp_bandwidth
: EIGRP_MAX_METRIC; : 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); uint64_t temp_scaled = scaled * (256ull * 10000000);
temp_scaled = temp_scaled =
temp_scaled < EIGRP_MAX_METRIC ? temp_scaled : EIGRP_MAX_METRIC; 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; 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; return scaled / 256;
} }

View File

@ -44,7 +44,7 @@ extern struct eigrp_interface *eigrp_if_new(struct eigrp *, struct interface *,
extern int eigrp_if_up(struct eigrp_interface *); extern int eigrp_if_up(struct eigrp_interface *);
extern void eigrp_if_stream_set(struct eigrp_interface *); extern void eigrp_if_stream_set(struct eigrp_interface *);
extern void eigrp_if_set_multicast(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 void eigrp_if_free(struct eigrp_interface *, int);
extern int eigrp_if_down(struct eigrp_interface *); extern int eigrp_if_down(struct eigrp_interface *);
extern void eigrp_if_stream_unset(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. */ /* Simulate down/up on the interface. */
extern void eigrp_if_reset(struct interface *); extern void eigrp_if_reset(struct interface *);
extern u_int32_t eigrp_bandwidth_to_scaled(u_int32_t); extern uint32_t eigrp_bandwidth_to_scaled(uint32_t);
extern u_int32_t eigrp_scaled_to_bandwidth(u_int32_t); extern uint32_t eigrp_scaled_to_bandwidth(uint32_t);
extern u_int32_t eigrp_delay_to_scaled(u_int32_t); extern uint32_t eigrp_delay_to_scaled(uint32_t);
extern u_int32_t eigrp_scaled_to_delay(u_int32_t); extern uint32_t eigrp_scaled_to_delay(uint32_t);
#endif /* ZEBRA_EIGRP_INTERFACE_H_ */ #endif /* ZEBRA_EIGRP_INTERFACE_H_ */

View File

@ -206,12 +206,12 @@ int holddown_timer_expired(struct thread *thread)
return 0; 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); 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; nbr->state = state;
@ -302,7 +302,7 @@ int eigrp_nbr_count_get(void)
struct listnode *node, *node2, *nnode2; struct listnode *node, *node2, *nnode2;
struct eigrp_neighbor *nbr; struct eigrp_neighbor *nbr;
struct eigrp *eigrp = eigrp_lookup(); struct eigrp *eigrp = eigrp_lookup();
u_int32_t counter; uint32_t counter;
if (eigrp == NULL) { if (eigrp == NULL) {
zlog_debug("EIGRP Routing Process not enabled"); zlog_debug("EIGRP Routing Process not enabled");

View File

@ -43,8 +43,8 @@ extern int holddown_timer_expired(struct thread *);
extern int eigrp_neighborship_check(struct eigrp_neighbor *, extern int eigrp_neighborship_check(struct eigrp_neighbor *,
struct TLV_Parameter_Type *); struct TLV_Parameter_Type *);
extern void eigrp_nbr_state_update(struct eigrp_neighbor *); extern void eigrp_nbr_state_update(struct eigrp_neighbor *);
extern void eigrp_nbr_state_set(struct eigrp_neighbor *, u_char state); extern void eigrp_nbr_state_set(struct eigrp_neighbor *, uint8_t state);
extern u_char eigrp_nbr_state_get(struct eigrp_neighbor *); extern uint8_t eigrp_nbr_state_get(struct eigrp_neighbor *);
extern int eigrp_nbr_count_get(void); extern int eigrp_nbr_count_get(void);
extern const char *eigrp_nbr_state_str(struct eigrp_neighbor *); extern const char *eigrp_nbr_state_str(struct eigrp_neighbor *);
extern struct eigrp_neighbor *eigrp_nbr_lookup_by_addr(struct eigrp_interface *, extern struct eigrp_neighbor *eigrp_nbr_lookup_by_addr(struct eigrp_interface *,

View File

@ -150,7 +150,7 @@ void eigrp_adjust_sndbuflen(struct eigrp *eigrp, unsigned int buflen)
int eigrp_if_ipmulticast(struct eigrp *top, struct prefix *p, int eigrp_if_ipmulticast(struct eigrp *top, struct prefix *p,
unsigned int ifindex) unsigned int ifindex)
{ {
u_char val; uint8_t val;
int ret, len; int ret, len;
val = 0; val = 0;
@ -368,7 +368,7 @@ int eigrp_network_unset(struct eigrp *eigrp, struct prefix *p)
return 1; return 1;
} }
u_int32_t eigrp_calculate_metrics(struct eigrp *eigrp, uint32_t eigrp_calculate_metrics(struct eigrp *eigrp,
struct eigrp_metrics metric) struct eigrp_metrics metric)
{ {
uint64_t temp_metric; uint64_t temp_metric;
@ -396,12 +396,12 @@ u_int32_t eigrp_calculate_metrics(struct eigrp *eigrp,
+ eigrp->k_values[3]); + eigrp->k_values[3]);
if (temp_metric <= EIGRP_MAX_METRIC) if (temp_metric <= EIGRP_MAX_METRIC)
return (u_int32_t)temp_metric; return (uint32_t)temp_metric;
else else
return EIGRP_MAX_METRIC; return EIGRP_MAX_METRIC;
} }
u_int32_t eigrp_calculate_total_metrics(struct eigrp *eigrp, uint32_t eigrp_calculate_total_metrics(struct eigrp *eigrp,
struct eigrp_nexthop_entry *entry) struct eigrp_nexthop_entry *entry)
{ {
struct eigrp_interface *ei = entry->ei; 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); + (uint64_t)eigrp_delay_to_scaled(ei->params.delay);
entry->total_metric.delay = temp_delay > EIGRP_MAX_METRIC entry->total_metric.delay = temp_delay > EIGRP_MAX_METRIC
? 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 entry->total_metric.bandwidth = entry->total_metric.bandwidth > bw
? bw ? bw
: entry->total_metric.bandwidth; : entry->total_metric.bandwidth;
@ -422,7 +422,7 @@ u_int32_t eigrp_calculate_total_metrics(struct eigrp *eigrp,
return eigrp_calculate_metrics(eigrp, entry->total_metric); return eigrp_calculate_metrics(eigrp, entry->total_metric);
} }
u_char eigrp_metrics_is_same(struct eigrp_metrics metric1, uint8_t eigrp_metrics_is_same(struct eigrp_metrics metric1,
struct eigrp_metrics metric2) struct eigrp_metrics metric2)
{ {
if ((metric1.bandwidth == metric2.bandwidth) if ((metric1.bandwidth == metric2.bandwidth)

View File

@ -43,10 +43,11 @@ extern int eigrp_if_drop_allspfrouters(struct eigrp *top, struct prefix *p,
unsigned int ifindex); unsigned int ifindex);
extern void eigrp_adjust_sndbuflen(struct eigrp *, unsigned int); extern void eigrp_adjust_sndbuflen(struct eigrp *, unsigned int);
extern u_int32_t eigrp_calculate_metrics(struct eigrp *, struct eigrp_metrics); extern uint32_t eigrp_calculate_metrics(struct eigrp *, struct eigrp_metrics);
extern u_int32_t eigrp_calculate_total_metrics(struct eigrp *, extern uint32_t eigrp_calculate_total_metrics(struct eigrp *,
struct eigrp_nexthop_entry *); struct eigrp_nexthop_entry *);
extern u_char eigrp_metrics_is_same(struct eigrp_metrics, struct eigrp_metrics); extern uint8_t eigrp_metrics_is_same(struct eigrp_metrics,
struct eigrp_metrics);
extern void eigrp_external_routes_refresh(struct eigrp *, int); extern void eigrp_external_routes_refresh(struct eigrp *, int);
#endif /* EIGRP_NETWORK_H_ */ #endif /* EIGRP_NETWORK_H_ */

View File

@ -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, int eigrp_make_md5_digest(struct eigrp_interface *ei, struct stream *s,
u_char flags) uint8_t flags)
{ {
struct key *key = NULL; struct key *key = NULL;
struct keychain *keychain; struct keychain *keychain;
unsigned char digest[EIGRP_AUTH_TYPE_MD5_LEN]; unsigned char digest[EIGRP_AUTH_TYPE_MD5_LEN];
MD5_CTX ctx; MD5_CTX ctx;
u_char *ibuf; uint8_t *ibuf;
size_t backup_get, backup_end; size_t backup_get, backup_end;
struct TLV_MD5_Authentication_Type *auth_TLV; 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, int eigrp_check_md5_digest(struct stream *s,
struct TLV_MD5_Authentication_Type *authTLV, struct TLV_MD5_Authentication_Type *authTLV,
struct eigrp_neighbor *nbr, u_char flags) struct eigrp_neighbor *nbr, uint8_t flags)
{ {
MD5_CTX ctx; MD5_CTX ctx;
unsigned char digest[EIGRP_AUTH_TYPE_MD5_LEN]; unsigned char digest[EIGRP_AUTH_TYPE_MD5_LEN];
unsigned char orig[EIGRP_AUTH_TYPE_MD5_LEN]; unsigned char orig[EIGRP_AUTH_TYPE_MD5_LEN];
struct key *key = NULL; struct key *key = NULL;
struct keychain *keychain; struct keychain *keychain;
u_char *ibuf; uint8_t *ibuf;
size_t backup_end; size_t backup_end;
struct TLV_MD5_Authentication_Type *auth_TLV; struct TLV_MD5_Authentication_Type *auth_TLV;
struct eigrp_header *eigrph; 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, int eigrp_make_sha256_digest(struct eigrp_interface *ei, struct stream *s,
u_char flags) uint8_t flags)
{ {
struct key *key = NULL; struct key *key = NULL;
struct keychain *keychain; 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, int eigrp_check_sha256_digest(struct stream *s,
struct TLV_SHA256_Authentication_Type *authTLV, struct TLV_SHA256_Authentication_Type *authTLV,
struct eigrp_neighbor *nbr, u_char flags) struct eigrp_neighbor *nbr, uint8_t flags)
{ {
return 1; return 1;
} }
@ -319,13 +319,13 @@ int eigrp_write(struct thread *thread)
struct ip iph; struct ip iph;
struct msghdr msg; struct msghdr msg;
struct iovec iov[2]; struct iovec iov[2];
u_int32_t seqno, ack; uint32_t seqno, ack;
int ret; int ret;
int flags = 0; int flags = 0;
struct listnode *node; struct listnode *node;
#ifdef WANT_EIGRP_WRITE_FRAGMENT #ifdef WANT_EIGRP_WRITE_FRAGMENT
static u_int16_t ipid = 0; static uint16_t ipid = 0;
#endif /* WANT_EIGRP_WRITE_FRAGMENT */ #endif /* WANT_EIGRP_WRITE_FRAGMENT */
#define EIGRP_WRITE_IPHL_SHIFT 2 #define EIGRP_WRITE_IPHL_SHIFT 2
@ -479,8 +479,8 @@ int eigrp_read(struct thread *thread)
struct interface *ifp; struct interface *ifp;
struct eigrp_neighbor *nbr; struct eigrp_neighbor *nbr;
u_int16_t opcode = 0; uint16_t opcode = 0;
u_int16_t length = 0; uint16_t length = 0;
/* first of all get interface pointer. */ /* first of all get interface pointer. */
eigrp = THREAD_ARG(thread); eigrp = THREAD_ARG(thread);
@ -706,7 +706,7 @@ static struct stream *eigrp_recv_packet(int fd, struct interface **ifp,
{ {
int ret; int ret;
struct ip *iph; struct ip *iph;
u_int16_t ip_len; uint16_t ip_len;
unsigned int ifindex = 0; unsigned int ifindex = 0;
struct iovec iov; struct iovec iov;
/* Header and data both require alignment. */ /* Header and data both require alignment. */
@ -729,7 +729,7 @@ static struct stream *eigrp_recv_packet(int fd, struct interface **ifp,
zlog_warn( zlog_warn(
"eigrp_recv_packet: discarding runt packet of length %d " "eigrp_recv_packet: discarding runt packet of length %d "
"(ip header size is %u)", "(ip header size is %u)",
ret, (u_int)sizeof(iph)); ret, (unsigned int)sizeof(iph));
return NULL; return NULL;
} }
@ -864,7 +864,7 @@ void eigrp_send_packet_reliably(struct eigrp_neighbor *nbr)
/* Calculate EIGRP checksum */ /* Calculate EIGRP checksum */
void eigrp_packet_checksum(struct eigrp_interface *ei, struct stream *s, void eigrp_packet_checksum(struct eigrp_interface *ei, struct stream *s,
u_int16_t length) uint16_t length)
{ {
struct eigrp_header *eigrph; struct eigrp_header *eigrph;
@ -876,16 +876,15 @@ void eigrp_packet_checksum(struct eigrp_interface *ei, struct stream *s,
/* Make EIGRP header. */ /* Make EIGRP header. */
void eigrp_packet_header_init(int type, struct eigrp *eigrp, struct stream *s, void eigrp_packet_header_init(int type, struct eigrp *eigrp, struct stream *s,
u_int32_t flags, u_int32_t sequence, uint32_t flags, uint32_t sequence, uint32_t ack)
u_int32_t ack)
{ {
struct eigrp_header *eigrph; struct eigrp_header *eigrph;
stream_reset(s); stream_reset(s);
eigrph = (struct eigrp_header *)STREAM_DATA(s); eigrph = (struct eigrp_header *)STREAM_DATA(s);
eigrph->version = (u_char)EIGRP_HEADER_VERSION; eigrph->version = (uint8_t)EIGRP_HEADER_VERSION;
eigrph->opcode = (u_char)type; eigrph->opcode = (uint8_t)type;
eigrph->checksum = 0; eigrph->checksum = 0;
eigrph->vrid = htons(eigrp->vrid); eigrph->vrid = htons(eigrp->vrid);
@ -1159,10 +1158,10 @@ struct TLV_IPv4_Internal_type *eigrp_read_ipv4_tlv(struct stream *s)
return tlv; return tlv;
} }
u_int16_t eigrp_add_internalTLV_to_stream(struct stream *s, uint16_t eigrp_add_internalTLV_to_stream(struct stream *s,
struct eigrp_prefix_entry *pe) struct eigrp_prefix_entry *pe)
{ {
u_int16_t length; uint16_t length;
stream_putw(s, EIGRP_TLV_IPv4_INT); stream_putw(s, EIGRP_TLV_IPv4_INT);
switch (pe->destination->prefixlen) { switch (pe->destination->prefixlen) {
@ -1245,7 +1244,7 @@ u_int16_t eigrp_add_internalTLV_to_stream(struct stream *s,
return length; return length;
} }
u_int16_t eigrp_add_authTLV_MD5_to_stream(struct stream *s, uint16_t eigrp_add_authTLV_MD5_to_stream(struct stream *s,
struct eigrp_interface *ei) struct eigrp_interface *ei)
{ {
struct key *key; struct key *key;
@ -1285,7 +1284,7 @@ u_int16_t eigrp_add_authTLV_MD5_to_stream(struct stream *s,
return 0; return 0;
} }
u_int16_t eigrp_add_authTLV_SHA256_to_stream(struct stream *s, uint16_t eigrp_add_authTLV_SHA256_to_stream(struct stream *s,
struct eigrp_interface *ei) struct eigrp_interface *ei)
{ {
struct key *key; struct key *key;

View File

@ -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_free(struct eigrp_packet *);
extern void eigrp_packet_delete(struct eigrp_interface *); extern void eigrp_packet_delete(struct eigrp_interface *);
extern void eigrp_packet_header_init(int, struct eigrp *, struct stream *, 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 *, 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_fifo *eigrp_fifo_new(void);
extern struct eigrp_packet *eigrp_fifo_next(struct eigrp_fifo *); extern struct eigrp_packet *eigrp_fifo_next(struct eigrp_fifo *);
@ -56,11 +56,11 @@ extern void eigrp_fifo_reset(struct eigrp_fifo *);
extern void eigrp_send_packet_reliably(struct eigrp_neighbor *); extern void eigrp_send_packet_reliably(struct eigrp_neighbor *);
extern struct TLV_IPv4_Internal_type *eigrp_read_ipv4_tlv(struct stream *); extern struct TLV_IPv4_Internal_type *eigrp_read_ipv4_tlv(struct stream *);
extern u_int16_t eigrp_add_internalTLV_to_stream(struct stream *, extern uint16_t eigrp_add_internalTLV_to_stream(struct stream *,
struct eigrp_prefix_entry *); struct eigrp_prefix_entry *);
extern u_int16_t eigrp_add_authTLV_MD5_to_stream(struct stream *, extern uint16_t eigrp_add_authTLV_MD5_to_stream(struct stream *,
struct eigrp_interface *); struct eigrp_interface *);
extern u_int16_t eigrp_add_authTLV_SHA256_to_stream(struct stream *, extern uint16_t eigrp_add_authTLV_SHA256_to_stream(struct stream *,
struct eigrp_interface *); struct eigrp_interface *);
extern int eigrp_unack_packet_retrans(struct thread *); extern int eigrp_unack_packet_retrans(struct thread *);
@ -71,7 +71,7 @@ extern int eigrp_unack_multicast_packet_retrans(struct thread *);
* eigrp_hello.c * eigrp_hello.c
*/ */
extern void eigrp_sw_version_initialize(void); 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 *); struct in_addr *);
extern void eigrp_hello_send_ack(struct eigrp_neighbor *); extern void eigrp_hello_send_ack(struct eigrp_neighbor *);
extern void eigrp_hello_receive(struct eigrp *, struct ip *, 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 *, extern void eigrp_query_receive(struct eigrp *, struct ip *,
struct eigrp_header *, struct stream *, struct eigrp_header *, struct stream *,
struct eigrp_interface *, int); 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 * 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 void eigrp_authTLV_SHA256_free(struct TLV_SHA256_Authentication_Type *);
extern int eigrp_make_md5_digest(struct eigrp_interface *, struct stream *, extern int eigrp_make_md5_digest(struct eigrp_interface *, struct stream *,
u_char); uint8_t);
extern int eigrp_check_md5_digest(struct stream *, extern int eigrp_check_md5_digest(struct stream *,
struct TLV_MD5_Authentication_Type *, 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 *, extern int eigrp_make_sha256_digest(struct eigrp_interface *, struct stream *,
u_char); uint8_t);
extern int eigrp_check_sha256_digest(struct stream *, extern int eigrp_check_sha256_digest(struct stream *,
struct TLV_SHA256_Authentication_Type *, 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 *); extern void eigrp_IPv4_InternalTLV_free(struct TLV_IPv4_Internal_type *);

View File

@ -54,12 +54,12 @@
#include "eigrpd/eigrp_fsm.h" #include "eigrpd/eigrp_fsm.h"
#include "eigrpd/eigrp_memory.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 eigrp_interface *iface;
struct listnode *node, *node2, *nnode2; struct listnode *node, *node2, *nnode2;
struct eigrp_prefix_entry *pe; struct eigrp_prefix_entry *pe;
u_int32_t counter; uint32_t counter;
if (eigrp == NULL) { if (eigrp == NULL) {
zlog_debug("EIGRP Routing Process not enabled"); 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 TLV_IPv4_Internal_type *tlv;
struct prefix dest_addr; struct prefix dest_addr;
u_int16_t type; uint16_t type;
u_int16_t length; uint16_t length;
/* increment statistics. */ /* increment statistics. */
ei->query_in++; ei->query_in++;
@ -111,7 +111,7 @@ void eigrp_query_receive(struct eigrp *eigrp, struct ip *iph,
type = stream_getw(s); type = stream_getw(s);
switch (type) { switch (type) {
case EIGRP_TLV_IPv4_INT: 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); 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) void eigrp_send_query(struct eigrp_interface *ei)
{ {
struct eigrp_packet *ep = NULL; 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 listnode *node, *nnode, *node2, *nnode2;
struct eigrp_neighbor *nbr; struct eigrp_neighbor *nbr;
struct eigrp_prefix_entry *pe; struct eigrp_prefix_entry *pe;

View File

@ -63,7 +63,7 @@
void eigrp_send_reply(struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe) void eigrp_send_reply(struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe)
{ {
struct eigrp_packet *ep; 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_interface *ei = nbr->ei;
struct eigrp *eigrp = ei->eigrp; struct eigrp *eigrp = ei->eigrp;
struct eigrp_prefix_entry *pe2; struct eigrp_prefix_entry *pe2;
@ -132,7 +132,7 @@ void eigrp_reply_receive(struct eigrp *eigrp, struct ip *iph,
struct eigrp_neighbor *nbr; struct eigrp_neighbor *nbr;
struct TLV_IPv4_Internal_type *tlv; struct TLV_IPv4_Internal_type *tlv;
u_int16_t type; uint16_t type;
/* increment statistics. */ /* increment statistics. */
ei->reply_in++; ei->reply_in++;
@ -153,7 +153,7 @@ void eigrp_reply_receive(struct eigrp *eigrp, struct ip *iph,
struct prefix dest_addr; 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); tlv = eigrp_read_ipv4_tlv(s);

View File

@ -255,8 +255,8 @@ static route_map_result_t route_match_metric(void *rule, struct prefix *prefix,
route_map_object_t type, route_map_object_t type,
void *object) void *object)
{ {
// u_int32_t *metric; // uint32_t *metric;
// u_int32_t check; // uint32_t check;
// struct rip_info *rinfo; // struct rip_info *rinfo;
// struct eigrp_nexthop_entry *te; // struct eigrp_nexthop_entry *te;
// struct eigrp_prefix_entry *pe; // 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 */ /* Route map `match metric' match statement. `arg' is METRIC value */
static void *route_match_metric_compile(const char *arg) 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); // *metric = atoi (arg);
// //
// if(*metric > 0) // 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, static route_map_result_t route_match_tag(void *rule, struct prefix *prefix,
route_map_object_t type, void *object) route_map_object_t type, void *object)
{ {
// u_short *tag; // unsigned short *tag;
// struct rip_info *rinfo; // struct rip_info *rinfo;
// //
// if (type == RMAP_EIGRP) // 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 */ /* Route map `match tag' match statement. `arg' is TAG value */
static void *route_match_tag_compile(const char *arg) 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); // *tag = atoi (arg);
// //
// return tag; // 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, static route_map_result_t route_set_tag(void *rule, struct prefix *prefix,
route_map_object_t type, void *object) route_map_object_t type, void *object)
{ {
// u_short *tag; // unsigned short *tag;
// struct rip_info *rinfo; // struct rip_info *rinfo;
// //
// if(type == RMAP_RIP) // 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 /* Route map `tag' compile function. Given string is converted
to u_short. */ to unsigned short. */
static void *route_set_tag_compile(const char *arg) 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); // *tag = atoi (arg);
// //
// return tag; // return tag;

View File

@ -62,7 +62,7 @@ void eigrp_siaquery_receive(struct eigrp *eigrp, struct ip *iph,
struct eigrp_neighbor *nbr; struct eigrp_neighbor *nbr;
struct TLV_IPv4_Internal_type *tlv; struct TLV_IPv4_Internal_type *tlv;
u_int16_t type; uint16_t type;
/* increment statistics. */ /* increment statistics. */
ei->siaQuery_in++; ei->siaQuery_in++;
@ -80,7 +80,7 @@ void eigrp_siaquery_receive(struct eigrp *eigrp, struct ip *iph,
if (type == EIGRP_TLV_IPv4_INT) { if (type == EIGRP_TLV_IPv4_INT) {
struct prefix dest_addr; 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); 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_prefix_entry *pe)
{ {
struct eigrp_packet *ep; 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); ep = eigrp_packet_new(nbr->ei->ifp->mtu, nbr);

View File

@ -61,7 +61,7 @@ void eigrp_siareply_receive(struct eigrp *eigrp, struct ip *iph,
struct eigrp_neighbor *nbr; struct eigrp_neighbor *nbr;
struct TLV_IPv4_Internal_type *tlv; struct TLV_IPv4_Internal_type *tlv;
u_int16_t type; uint16_t type;
/* increment statistics. */ /* increment statistics. */
ei->siaReply_in++; ei->siaReply_in++;
@ -79,7 +79,7 @@ void eigrp_siareply_receive(struct eigrp *eigrp, struct ip *iph,
if (type == EIGRP_TLV_IPv4_INT) { if (type == EIGRP_TLV_IPv4_INT) {
struct prefix dest_addr; 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); 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_prefix_entry *pe)
{ {
struct eigrp_packet *ep; 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); ep = eigrp_packet_new(nbr->ei->ifp->mtu, nbr);

View File

@ -167,15 +167,15 @@ oid eigrp_oid[] = {EIGRPMIB};
#define UINTEGER ASN_UNSIGNED #define UINTEGER ASN_UNSIGNED
/* Hook functions. */ /* Hook functions. */
static u_char *eigrpVpnEntry(struct variable *, oid *, size_t *, int, size_t *, static uint8_t *eigrpVpnEntry(struct variable *, oid *, size_t *, int, size_t *,
WriteMethod **); WriteMethod **);
static u_char *eigrpTraffStatsEntry(struct variable *, oid *, size_t *, int, static uint8_t *eigrpTraffStatsEntry(struct variable *, oid *, size_t *, int,
size_t *, WriteMethod **); size_t *, WriteMethod **);
static u_char *eigrpTopologyEntry(struct variable *, oid *, size_t *, int, static uint8_t *eigrpTopologyEntry(struct variable *, oid *, size_t *, int,
size_t *, WriteMethod **); size_t *, WriteMethod **);
static u_char *eigrpPeerEntry(struct variable *, oid *, size_t *, int, size_t *, static uint8_t *eigrpPeerEntry(struct variable *, oid *, size_t *, int,
WriteMethod **); size_t *, WriteMethod **);
static u_char *eigrpInterfaceEntry(struct variable *, oid *, size_t *, int, static uint8_t *eigrpInterfaceEntry(struct variable *, oid *, size_t *, int,
size_t *, WriteMethod **); size_t *, WriteMethod **);
@ -599,7 +599,7 @@ static struct eigrp_neighbor *eigrpNbrLookup(struct variable *v, oid *name,
} }
static u_char *eigrpVpnEntry(struct variable *v, oid *name, size_t *length, static uint8_t *eigrpVpnEntry(struct variable *v, oid *name, size_t *length,
int exact, size_t *var_len, int exact, size_t *var_len,
WriteMethod **write_method) WriteMethod **write_method)
{ {
@ -657,7 +657,7 @@ static uint32_t eigrp_neighbor_count(struct eigrp *eigrp)
} }
static u_char *eigrpTraffStatsEntry(struct variable *v, oid *name, static uint8_t *eigrpTraffStatsEntry(struct variable *v, oid *name,
size_t *length, int exact, size_t *var_len, size_t *length, int exact, size_t *var_len,
WriteMethod **write_method) WriteMethod **write_method)
{ {
@ -913,8 +913,8 @@ static u_char *eigrpTraffStatsEntry(struct variable *v, oid *name,
return NULL; return NULL;
} }
static u_char *eigrpTopologyEntry(struct variable *v, oid *name, size_t *length, static uint8_t *eigrpTopologyEntry(struct variable *v, oid *name,
int exact, size_t *var_len, size_t *length, int exact, size_t *var_len,
WriteMethod **write_method) WriteMethod **write_method)
{ {
struct eigrp *eigrp; struct eigrp *eigrp;
@ -1061,7 +1061,7 @@ static u_char *eigrpTopologyEntry(struct variable *v, oid *name, size_t *length,
return NULL; return NULL;
} }
static u_char *eigrpPeerEntry(struct variable *v, oid *name, size_t *length, static uint8_t *eigrpPeerEntry(struct variable *v, oid *name, size_t *length,
int exact, size_t *var_len, int exact, size_t *var_len,
WriteMethod **write_method) WriteMethod **write_method)
{ {
@ -1194,7 +1194,7 @@ static u_char *eigrpPeerEntry(struct variable *v, oid *name, size_t *length,
return NULL; return NULL;
} }
static u_char *eigrpInterfaceEntry(struct variable *v, oid *name, static uint8_t *eigrpInterfaceEntry(struct variable *v, oid *name,
size_t *length, int exact, size_t *var_len, size_t *length, int exact, size_t *var_len,
WriteMethod **write_method) WriteMethod **write_method)
{ {
@ -1383,13 +1383,13 @@ static u_char *eigrpInterfaceEntry(struct variable *v, oid *name,
on this interface. */ on this interface. */
keylist = keychain_list_get(); keylist = keychain_list_get();
for (ALL_LIST_ELEMENTS(keylist, node, nnode, keychain)) { for (ALL_LIST_ELEMENTS(keylist, node, nnode, keychain)) {
return (u_char *)keychain->name; return (uint8_t *)keychain->name;
} }
if (eigrp && keychain) { if (eigrp && keychain) {
*var_len = str_len(keychain->name); *var_len = str_len(keychain->name);
return (u_char *)keychain->name; return (uint8_t *)keychain->name;
} else } else
return (u_char *)"TEST"; return (uint8_t *)"TEST";
break; break;
default: default:
return NULL; return NULL;

View File

@ -52,43 +52,43 @@ struct eigrp_master {
time_t start_time; time_t start_time;
/* Various EIGRP global configuration. */ /* Various EIGRP global configuration. */
u_char options; uint8_t options;
#define EIGRP_MASTER_SHUTDOWN (1 << 0) /* deferred-shutdown */ #define EIGRP_MASTER_SHUTDOWN (1 << 0) /* deferred-shutdown */
}; };
struct eigrp_metrics { struct eigrp_metrics {
u_int32_t delay; uint32_t delay;
u_int32_t bandwidth; uint32_t bandwidth;
unsigned char mtu[3]; unsigned char mtu[3];
u_char hop_count; uint8_t hop_count;
u_char reliability; uint8_t reliability;
u_char load; uint8_t load;
u_char tag; uint8_t tag;
u_char flags; uint8_t flags;
}; };
struct eigrp { struct eigrp {
u_int16_t AS; /* Autonomous system number */ uint16_t AS; /* Autonomous system number */
u_int16_t vrid; /* Virtual Router ID */ uint16_t vrid; /* Virtual Router ID */
u_char k_values[6]; /*Array for K values configuration*/ uint8_t k_values[6]; /*Array for K values configuration*/
u_char variance; /*Metric variance multiplier*/ uint8_t variance; /*Metric variance multiplier*/
u_char max_paths; /*Maximum allowed paths for 1 prefix*/ uint8_t max_paths; /*Maximum allowed paths for 1 prefix*/
/*Name of this EIGRP instance*/ /*Name of this EIGRP instance*/
char *name; char *name;
/* EIGRP Router ID. */ /* EIGRP Router ID. */
u_int32_t router_id; /* Configured automatically. */ uint32_t router_id; /* Configured automatically. */
u_int32_t router_id_static; /* Configured manually. */ uint32_t router_id_static; /* Configured manually. */
struct list *eiflist; /* eigrp interfaces */ 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 fd;
unsigned int maxsndbuflen; unsigned int maxsndbuflen;
u_int32_t sequence_number; /*Global EIGRP sequence number*/ uint32_t sequence_number; /*Global EIGRP sequence number*/
struct stream *ibuf; struct stream *ibuf;
struct list *oi_write_q; struct list *oi_write_q;
@ -128,7 +128,7 @@ struct eigrp {
char *name; char *name;
struct route_map *map; struct route_map *map;
int metric_config; int metric_config;
u_int32_t metric; uint32_t metric;
} route_map[ZEBRA_ROUTE_MAX]; } route_map[ZEBRA_ROUTE_MAX];
QOBJ_FIELDS QOBJ_FIELDS
@ -136,14 +136,14 @@ struct eigrp {
DECLARE_QOBJ_TYPE(eigrp) DECLARE_QOBJ_TYPE(eigrp)
struct eigrp_if_params { struct eigrp_if_params {
u_char passive_interface; uint8_t passive_interface;
u_int32_t v_hello; uint32_t v_hello;
u_int16_t v_wait; uint16_t v_wait;
u_char type; /* type of interface */ uint8_t type; /* type of interface */
u_int32_t bandwidth; uint32_t bandwidth;
u_int32_t delay; uint32_t delay;
u_char reliability; uint8_t reliability;
u_char load; uint8_t load;
char *auth_keychain; /* Associated keychain with interface*/ char *auth_keychain; /* Associated keychain with interface*/
int auth_type; /* EIGRP authentication type */ int auth_type; /* EIGRP authentication type */
@ -172,10 +172,10 @@ struct eigrp_interface {
/* To which multicast groups do we currently belong? */ /* To which multicast groups do we currently belong? */
u_char multicast_memberships; uint8_t multicast_memberships;
/* EIGRP Network Type. */ /* EIGRP Network Type. */
u_char type; uint8_t type;
struct prefix *address; /* Interface prefix */ struct prefix *address; /* Interface prefix */
struct connected *connected; /* Pointer to connected */ struct connected *connected; /* Pointer to connected */
@ -190,22 +190,22 @@ struct eigrp_interface {
int on_write_q; int on_write_q;
/* Statistics fields. */ /* Statistics fields. */
u_int32_t hello_in; /* Hello message input count. */ uint32_t hello_in; /* Hello message input count. */
u_int32_t update_in; /* Update message input count. */ uint32_t update_in; /* Update message input count. */
u_int32_t query_in; /* Querry message input count. */ uint32_t query_in; /* Querry message input count. */
u_int32_t reply_in; /* Reply message input count. */ uint32_t reply_in; /* Reply message input count. */
u_int32_t hello_out; /* Hello message output count. */ uint32_t hello_out; /* Hello message output count. */
u_int32_t update_out; /* Update message output count. */ uint32_t update_out; /* Update message output count. */
u_int32_t query_out; /* Query message output count. */ uint32_t query_out; /* Query message output count. */
u_int32_t reply_out; /* Reply message output count. */ uint32_t reply_out; /* Reply message output count. */
u_int32_t siaQuery_in; uint32_t siaQuery_in;
u_int32_t siaQuery_out; uint32_t siaQuery_out;
u_int32_t siaReply_in; uint32_t siaReply_in;
u_int32_t siaReply_out; uint32_t siaReply_out;
u_int32_t ack_out; uint32_t ack_out;
u_int32_t ack_in; uint32_t ack_in;
u_int32_t crypt_seqnum; /* Cryptographic Sequence Number */ uint32_t crypt_seqnum; /* Cryptographic Sequence Number */
/* Access-list. */ /* Access-list. */
struct access_list *list[EIGRP_FILTER_MAX]; struct access_list *list[EIGRP_FILTER_MAX];
@ -231,30 +231,32 @@ struct eigrp_neighbor {
struct eigrp_interface *ei; struct eigrp_interface *ei;
/* EIGRP neighbor Information */ /* EIGRP neighbor Information */
u_char state; /* neigbor status. */ uint8_t state; /* neigbor status. */
u_int32_t recv_sequence_number; /* Last received sequence Number. */ uint32_t recv_sequence_number; /* Last received sequence Number. */
u_int32_t init_sequence_number; uint32_t init_sequence_number;
/*If packet is unacknowledged, we try to send it again 16 times*/ /*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. */ struct in_addr src; /* Neighbor Src address. */
u_char os_rel_major; // system version - just for show uint8_t os_rel_major; // system version - just for show
u_char os_rel_minor; // system version - just for show uint8_t os_rel_minor; // system version - just for show
u_char tlv_rel_major; // eigrp version - tells us what TLV format to use uint8_t tlv_rel_major; // eigrp version - tells us what TLV format to
u_char tlv_rel_minor; // eigrp version - tells us what TLV format to use // use
uint8_t tlv_rel_minor; // eigrp version - tells us what TLV format to
// use
u_char K1; uint8_t K1;
u_char K2; uint8_t K2;
u_char K3; uint8_t K3;
u_char K4; uint8_t K4;
u_char K5; uint8_t K5;
u_char K6; uint8_t K6;
/* Timer values. */ /* Timer values. */
u_int16_t v_holddown; uint16_t v_holddown;
/* Threads. */ /* Threads. */
struct thread *t_holddown; struct thread *t_holddown;
@ -264,7 +266,7 @@ struct eigrp_neighbor {
struct eigrp_fifo *retrans_queue; struct eigrp_fifo *retrans_queue;
struct eigrp_fifo *multicast_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 */ /* prefixes not received from neighbor during Graceful restart */
struct list *nbr_gr_prefixes; struct list *nbr_gr_prefixes;
@ -291,12 +293,12 @@ struct eigrp_packet {
struct thread *t_retrans_timer; struct thread *t_retrans_timer;
/*Packet retransmission counter*/ /*Packet retransmission counter*/
u_char retrans_counter; uint8_t retrans_counter;
u_int32_t sequence_number; uint32_t sequence_number;
/* EIGRP packet length. */ /* EIGRP packet length. */
u_int16_t length; uint16_t length;
struct eigrp_neighbor *nbr; struct eigrp_neighbor *nbr;
}; };
@ -309,14 +311,14 @@ struct eigrp_fifo {
}; };
struct eigrp_header { struct eigrp_header {
u_char version; uint8_t version;
u_char opcode; uint8_t opcode;
u_int16_t checksum; uint16_t checksum;
u_int32_t flags; uint32_t flags;
u_int32_t sequence; uint32_t sequence;
u_int32_t ack; uint32_t ack;
u_int16_t vrid; uint16_t vrid;
u_int16_t ASNumber; uint16_t ASNumber;
char *tlv[0]; char *tlv[0];
} __attribute__((packed)); } __attribute__((packed));
@ -332,109 +334,109 @@ struct eigrp_header {
* +-----+------------------+ * +-----+------------------+
*/ */
struct eigrp_tlv_hdr_type { struct eigrp_tlv_hdr_type {
u_int16_t type; uint16_t type;
u_int16_t length; uint16_t length;
uint8_t value[0]; uint8_t value[0];
} __attribute__((packed)); } __attribute__((packed));
struct TLV_Parameter_Type { struct TLV_Parameter_Type {
u_int16_t type; uint16_t type;
u_int16_t length; uint16_t length;
u_char K1; uint8_t K1;
u_char K2; uint8_t K2;
u_char K3; uint8_t K3;
u_char K4; uint8_t K4;
u_char K5; uint8_t K5;
u_char K6; uint8_t K6;
u_int16_t hold_time; uint16_t hold_time;
} __attribute__((packed)); } __attribute__((packed));
struct TLV_MD5_Authentication_Type { struct TLV_MD5_Authentication_Type {
u_int16_t type; uint16_t type;
u_int16_t length; uint16_t length;
u_int16_t auth_type; uint16_t auth_type;
u_int16_t auth_length; uint16_t auth_length;
u_int32_t key_id; uint32_t key_id;
u_int32_t key_sequence; uint32_t key_sequence;
u_char Nullpad[8]; uint8_t Nullpad[8];
u_char digest[EIGRP_AUTH_TYPE_MD5_LEN]; uint8_t digest[EIGRP_AUTH_TYPE_MD5_LEN];
} __attribute__((packed)); } __attribute__((packed));
struct TLV_SHA256_Authentication_Type { struct TLV_SHA256_Authentication_Type {
u_int16_t type; uint16_t type;
u_int16_t length; uint16_t length;
u_int16_t auth_type; uint16_t auth_type;
u_int16_t auth_length; uint16_t auth_length;
u_int32_t key_id; uint32_t key_id;
u_int32_t key_sequence; uint32_t key_sequence;
u_char Nullpad[8]; uint8_t Nullpad[8];
u_char digest[EIGRP_AUTH_TYPE_SHA256_LEN]; uint8_t digest[EIGRP_AUTH_TYPE_SHA256_LEN];
} __attribute__((packed)); } __attribute__((packed));
struct TLV_Sequence_Type { struct TLV_Sequence_Type {
u_int16_t type; uint16_t type;
u_int16_t length; uint16_t length;
u_char addr_length; uint8_t addr_length;
struct in_addr *addresses; struct in_addr *addresses;
} __attribute__((packed)); } __attribute__((packed));
struct TLV_Next_Multicast_Sequence { struct TLV_Next_Multicast_Sequence {
u_int16_t type; uint16_t type;
u_int16_t length; uint16_t length;
u_int32_t multicast_sequence; uint32_t multicast_sequence;
} __attribute__((packed)); } __attribute__((packed));
struct TLV_Software_Type { struct TLV_Software_Type {
u_int16_t type; uint16_t type;
u_int16_t length; uint16_t length;
u_char vender_major; uint8_t vender_major;
u_char vender_minor; uint8_t vender_minor;
u_char eigrp_major; uint8_t eigrp_major;
u_char eigrp_minor; uint8_t eigrp_minor;
} __attribute__((packed)); } __attribute__((packed));
struct TLV_IPv4_Internal_type { struct TLV_IPv4_Internal_type {
u_int16_t type; uint16_t type;
u_int16_t length; uint16_t length;
struct in_addr forward; struct in_addr forward;
/*Metrics*/ /*Metrics*/
struct eigrp_metrics metric; struct eigrp_metrics metric;
u_char prefix_length; uint8_t prefix_length;
unsigned char destination_part[4]; unsigned char destination_part[4];
struct in_addr destination; struct in_addr destination;
} __attribute__((packed)); } __attribute__((packed));
struct TLV_IPv4_External_type { struct TLV_IPv4_External_type {
u_int16_t type; uint16_t type;
u_int16_t length; uint16_t length;
struct in_addr next_hop; struct in_addr next_hop;
struct in_addr originating_router; struct in_addr originating_router;
u_int32_t originating_as; uint32_t originating_as;
u_int32_t administrative_tag; uint32_t administrative_tag;
u_int32_t external_metric; uint32_t external_metric;
u_int16_t reserved; uint16_t reserved;
u_char external_protocol; uint8_t external_protocol;
u_char external_flags; uint8_t external_flags;
/*Metrics*/ /*Metrics*/
struct eigrp_metrics metric; struct eigrp_metrics metric;
u_char prefix_length; uint8_t prefix_length;
unsigned char destination_part[4]; unsigned char destination_part[4];
struct in_addr destination; struct in_addr destination;
} __attribute__((packed)); } __attribute__((packed));
/* EIGRP Peer Termination TLV - used for hard restart */ /* EIGRP Peer Termination TLV - used for hard restart */
struct TLV_Peer_Termination_type { struct TLV_Peer_Termination_type {
u_int16_t type; uint16_t type;
u_int16_t length; uint16_t length;
u_char unknown; uint8_t unknown;
u_int32_t neighbor_ip; uint32_t neighbor_ip;
} __attribute__((packed)); } __attribute__((packed));
/* Who executed Graceful restart */ /* Who executed Graceful restart */
@ -445,15 +447,15 @@ enum GR_type { EIGRP_GR_MANUAL, EIGRP_GR_FILTER };
/* EIGRP Topology table node structure */ /* EIGRP Topology table node structure */
struct eigrp_prefix_entry { struct eigrp_prefix_entry {
struct list *entries, *rij; struct list *entries, *rij;
u_int32_t fdistance; // FD uint32_t fdistance; // FD
u_int32_t rdistance; // RD uint32_t rdistance; // RD
u_int32_t distance; // D uint32_t distance; // D
struct eigrp_metrics reported_metric; // RD for sending struct eigrp_metrics reported_metric; // RD for sending
u_char nt; // network type uint8_t nt; // network type
u_char state; // route fsm state uint8_t state; // route fsm state
u_char af; // address family uint8_t af; // address family
u_char req_action; // required action uint8_t req_action; // required action
struct prefix *destination; struct prefix *destination;
@ -468,15 +470,15 @@ struct eigrp_prefix_entry {
/* EIGRP Topology table record structure */ /* EIGRP Topology table record structure */
struct eigrp_nexthop_entry { struct eigrp_nexthop_entry {
struct eigrp_prefix_entry *prefix; struct eigrp_prefix_entry *prefix;
u_int32_t reported_distance; // distance reported by neighbor uint32_t reported_distance; // distance reported by neighbor
u_int32_t distance; // sum of reported distance and link cost to uint32_t distance; // sum of reported distance and link cost to
// advertised neighbor // advertised neighbor
struct eigrp_metrics reported_metric; struct eigrp_metrics reported_metric;
struct eigrp_metrics total_metric; struct eigrp_metrics total_metric;
struct eigrp_neighbor *adv_router; // ip address of advertising neighbor 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 struct eigrp_interface *ei; // pointer for case of connected entry
}; };
@ -491,7 +493,7 @@ typedef enum {
/* EIGRP Finite State Machine */ /* EIGRP Finite State Machine */
struct eigrp_fsm_action_message { 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 *eigrp; // which thread sent mesg
struct eigrp_neighbor *adv_router; // advertising neighbor struct eigrp_neighbor *adv_router; // advertising neighbor
struct eigrp_nexthop_entry *entry; struct eigrp_nexthop_entry *entry;

View File

@ -362,7 +362,7 @@ eigrp_topology_update_distance(struct eigrp_fsm_action_message *msg)
struct eigrp_prefix_entry *prefix = msg->prefix; struct eigrp_prefix_entry *prefix = msg->prefix;
struct eigrp_nexthop_entry *entry = msg->entry; struct eigrp_nexthop_entry *entry = msg->entry;
enum metric_change change = METRIC_SAME; enum metric_change change = METRIC_SAME;
u_int32_t new_reported_distance; uint32_t new_reported_distance;
assert(entry); assert(entry);

View File

@ -176,13 +176,13 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph,
struct TLV_IPv4_Internal_type *tlv; struct TLV_IPv4_Internal_type *tlv;
struct eigrp_prefix_entry *pe; struct eigrp_prefix_entry *pe;
struct eigrp_nexthop_entry *ne; struct eigrp_nexthop_entry *ne;
u_int32_t flags; uint32_t flags;
u_int16_t type; uint16_t type;
u_int16_t length; uint16_t length;
u_char same; uint8_t same;
struct prefix dest_addr; struct prefix dest_addr;
u_char graceful_restart; uint8_t graceful_restart;
u_char graceful_restart_final; uint8_t graceful_restart_final;
struct list *nbr_prefixes = NULL; struct list *nbr_prefixes = NULL;
/* increment statistics. */ /* increment statistics. */
@ -297,7 +297,7 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph,
type = stream_getw(s); type = stream_getw(s);
switch (type) { switch (type) {
case EIGRP_TLV_IPv4_INT: 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); 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) void eigrp_update_send_init(struct eigrp_neighbor *nbr)
{ {
struct eigrp_packet *ep; 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); 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, static void eigrp_update_place_on_nbr_queue(struct eigrp_neighbor *nbr,
struct eigrp_packet *ep, 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) if ((nbr->ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
&& (nbr->ei->params.auth_keychain != NULL)) { && (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) void eigrp_update_send_EOT(struct eigrp_neighbor *nbr)
{ {
struct eigrp_packet *ep; struct eigrp_packet *ep;
u_int16_t length = EIGRP_HEADER_LEN; uint16_t length = EIGRP_HEADER_LEN;
struct eigrp_nexthop_entry *te; struct eigrp_nexthop_entry *te;
struct eigrp_prefix_entry *pe; struct eigrp_prefix_entry *pe;
struct listnode *node2, *nnode2; struct listnode *node2, *nnode2;
struct eigrp_interface *ei = nbr->ei; struct eigrp_interface *ei = nbr->ei;
struct eigrp *eigrp = ei->eigrp; struct eigrp *eigrp = ei->eigrp;
struct prefix *dest_addr; struct prefix *dest_addr;
u_int32_t seq_no = eigrp->sequence_number; uint32_t seq_no = eigrp->sequence_number;
u_int16_t mtu = ei->ifp->mtu; uint16_t mtu = ei->ifp->mtu;
struct route_node *rn; struct route_node *rn;
ep = eigrp_packet_new(mtu, nbr); ep = eigrp_packet_new(mtu, nbr);
@ -600,15 +600,15 @@ void eigrp_update_send(struct eigrp_interface *ei)
struct eigrp_packet *ep; struct eigrp_packet *ep;
struct listnode *node, *nnode; struct listnode *node, *nnode;
struct eigrp_prefix_entry *pe; struct eigrp_prefix_entry *pe;
u_char has_tlv; uint8_t has_tlv;
struct eigrp *eigrp = ei->eigrp; struct eigrp *eigrp = ei->eigrp;
struct prefix *dest_addr; struct prefix *dest_addr;
u_int32_t seq_no = eigrp->sequence_number; uint32_t seq_no = eigrp->sequence_number;
if (ei->nbrs->count == 0) if (ei->nbrs->count == 0)
return; return;
u_int16_t length = EIGRP_HEADER_LEN; uint16_t length = EIGRP_HEADER_LEN;
ep = eigrp_packet_new(ei->ifp->mtu, NULL); ep = eigrp_packet_new(ei->ifp->mtu, NULL);
@ -634,7 +634,7 @@ void eigrp_update_send(struct eigrp_interface *ei)
continue; continue;
if ((length + EIGRP_TLV_MAX_IPV4_BYTE) 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) if ((ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
&& (ei->params.auth_keychain != NULL)) { && (ei->params.auth_keychain != NULL)) {
eigrp_make_md5_digest(ei, ep->s, 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) static void eigrp_update_send_GR_part(struct eigrp_neighbor *nbr)
{ {
struct eigrp_packet *ep; struct eigrp_packet *ep;
u_int16_t length = EIGRP_HEADER_LEN; uint16_t length = EIGRP_HEADER_LEN;
struct eigrp_prefix_entry *pe; struct eigrp_prefix_entry *pe;
struct prefix *dest_addr; struct prefix *dest_addr;
struct eigrp_interface *ei = nbr->ei; struct eigrp_interface *ei = nbr->ei;
struct eigrp *eigrp = ei->eigrp; struct eigrp *eigrp = ei->eigrp;
struct list *prefixes; struct list *prefixes;
u_int32_t flags; uint32_t flags;
unsigned int send_prefixes; unsigned int send_prefixes;
struct route_node *rn; struct route_node *rn;

View File

@ -608,7 +608,7 @@ DEFUN (eigrp_if_delay,
VTY_DECLVAR_CONTEXT(interface, ifp); VTY_DECLVAR_CONTEXT(interface, ifp);
struct eigrp_interface *ei = ifp->info; struct eigrp_interface *ei = ifp->info;
struct eigrp *eigrp; struct eigrp *eigrp;
u_int32_t delay; uint32_t delay;
eigrp = eigrp_lookup(); eigrp = eigrp_lookup();
if (eigrp == NULL) { if (eigrp == NULL) {
@ -666,7 +666,7 @@ DEFUN (eigrp_if_bandwidth,
{ {
VTY_DECLVAR_CONTEXT(interface, ifp); VTY_DECLVAR_CONTEXT(interface, ifp);
struct eigrp_interface *ei = ifp->info; struct eigrp_interface *ei = ifp->info;
u_int32_t bandwidth; uint32_t bandwidth;
struct eigrp *eigrp; struct eigrp *eigrp;
eigrp = eigrp_lookup(); eigrp = eigrp_lookup();
@ -727,7 +727,7 @@ DEFUN (eigrp_if_ip_hellointerval,
{ {
VTY_DECLVAR_CONTEXT(interface, ifp); VTY_DECLVAR_CONTEXT(interface, ifp);
struct eigrp_interface *ei = ifp->info; struct eigrp_interface *ei = ifp->info;
u_int32_t hello; uint32_t hello;
struct eigrp *eigrp; struct eigrp *eigrp;
eigrp = eigrp_lookup(); eigrp = eigrp_lookup();
@ -790,7 +790,7 @@ DEFUN (eigrp_if_ip_holdinterval,
{ {
VTY_DECLVAR_CONTEXT(interface, ifp); VTY_DECLVAR_CONTEXT(interface, ifp);
struct eigrp_interface *ei = ifp->info; struct eigrp_interface *ei = ifp->info;
u_int32_t hold; uint32_t hold;
struct eigrp *eigrp; struct eigrp *eigrp;
eigrp = eigrp_lookup(); eigrp = eigrp_lookup();
@ -821,7 +821,7 @@ DEFUN (eigrp_ip_summary_address,
"Summary <network>/<length>, e.g. 192.168.0.0/16\n") "Summary <network>/<length>, e.g. 192.168.0.0/16\n")
{ {
// VTY_DECLVAR_CONTEXT(interface, ifp); // VTY_DECLVAR_CONTEXT(interface, ifp);
// u_int32_t AS; // uint32_t AS;
struct eigrp *eigrp; struct eigrp *eigrp;
eigrp = eigrp_lookup(); eigrp = eigrp_lookup();
@ -848,7 +848,7 @@ DEFUN (no_eigrp_ip_summary_address,
"Summary <network>/<length>, e.g. 192.168.0.0/16\n") "Summary <network>/<length>, e.g. 192.168.0.0/16\n")
{ {
// VTY_DECLVAR_CONTEXT(interface, ifp); // VTY_DECLVAR_CONTEXT(interface, ifp);
// u_int32_t AS; // uint32_t AS;
struct eigrp *eigrp; struct eigrp *eigrp;
eigrp = eigrp_lookup(); eigrp = eigrp_lookup();
@ -1120,7 +1120,7 @@ DEFUN (eigrp_variance,
"Metric variance multiplier\n") "Metric variance multiplier\n")
{ {
struct eigrp *eigrp; struct eigrp *eigrp;
u_char variance; uint8_t variance;
eigrp = eigrp_lookup(); eigrp = eigrp_lookup();
if (eigrp == NULL) { if (eigrp == NULL) {
@ -1164,7 +1164,7 @@ DEFUN (eigrp_maximum_paths,
"Number of paths\n") "Number of paths\n")
{ {
struct eigrp *eigrp; struct eigrp *eigrp;
u_char max; uint8_t max;
eigrp = eigrp_lookup(); eigrp = eigrp_lookup();
if (eigrp == NULL) { if (eigrp == NULL) {

View File

@ -96,7 +96,7 @@ void eigrp_router_id_update(struct eigrp *eigrp)
{ {
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
struct interface *ifp; struct interface *ifp;
u_int32_t router_id, router_id_old; uint32_t router_id, router_id_old;
router_id_old = eigrp->router_id; router_id_old = eigrp->router_id;

View File

@ -51,7 +51,7 @@
extern struct isis *isis; 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; struct isis_adjacency *adj;
@ -61,7 +61,7 @@ static struct isis_adjacency *adj_alloc(const u_char *id)
return adj; 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) int level, struct isis_circuit *circuit)
{ {
struct isis_adjacency *adj; struct isis_adjacency *adj;
@ -96,7 +96,7 @@ struct isis_adjacency *isis_new_adj(const u_char *id, const u_char *snpa,
return adj; 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 isis_adjacency *adj;
struct listnode *node; struct listnode *node;
@ -108,7 +108,7 @@ struct isis_adjacency *isis_adj_lookup(const u_char *sysid, struct list *adjdb)
return NULL; 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 list *adjdb)
{ {
struct listnode *node; struct listnode *node;

View File

@ -69,9 +69,9 @@ struct isis_dis_record {
}; };
struct isis_adjacency { struct isis_adjacency {
u_char snpa[ETH_ALEN]; /* NeighbourSNPAAddress */ uint8_t snpa[ETH_ALEN]; /* NeighbourSNPAAddress */
u_char sysid[ISIS_SYS_ID_LEN]; /* neighbourSystemIdentifier */ uint8_t sysid[ISIS_SYS_ID_LEN]; /* neighbourSystemIdentifier */
u_char lanid[ISIS_SYS_ID_LEN + 1]; /* LAN id on bcast circuits */ uint8_t lanid[ISIS_SYS_ID_LEN + 1]; /* LAN id on bcast circuits */
int dischanges[ISIS_LEVELS]; /* how many DIS changes ? */ int dischanges[ISIS_LEVELS]; /* how many DIS changes ? */
/* an array of N levels for M records */ /* an array of N levels for M records */
struct isis_dis_record dis_record[DIS_RECORDS * ISIS_LEVELS]; struct isis_dis_record dis_record[DIS_RECORDS * ISIS_LEVELS];
@ -86,13 +86,13 @@ struct isis_adjacency {
struct in6_addr *ipv6_addresses; struct in6_addr *ipv6_addresses;
unsigned int ipv6_address_count; unsigned int ipv6_address_count;
struct in6_addr router_address6; 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 circuit_t; /* from hello PDU hdr */
int level; /* level (1 or 2) */ int level; /* level (1 or 2) */
enum isis_system_type sys_type; /* neighbourSystemType */ enum isis_system_type sys_type; /* neighbourSystemType */
u_int16_t hold_time; /* entryRemainingTime */ uint16_t hold_time; /* entryRemainingTime */
u_int32_t last_upd; uint32_t last_upd;
u_int32_t last_flap; /* last time the adj flapped */ uint32_t last_flap; /* last time the adj flapped */
enum isis_threeway_state threeway_state; enum isis_threeway_state threeway_state;
uint32_t ext_circuit_id; uint32_t ext_circuit_id;
int flaps; /* number of adjacency flaps */ int flaps; /* number of adjacency flaps */
@ -104,10 +104,11 @@ struct isis_adjacency {
struct isis_threeway_adj; struct isis_threeway_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 isis_adjacency *isis_adj_lookup_snpa(const u_char *ssnpa,
struct list *adjdb); struct list *adjdb);
struct isis_adjacency *isis_new_adj(const u_char *id, const u_char *snpa, struct isis_adjacency *isis_adj_lookup_snpa(const uint8_t *ssnpa,
struct list *adjdb);
struct isis_adjacency *isis_new_adj(const uint8_t *id, const uint8_t *snpa,
int level, struct isis_circuit *circuit); int level, struct isis_circuit *circuit);
void isis_delete_adj(void *adj); void isis_delete_adj(void *adj);
void isis_adj_process_threeway(struct isis_adjacency *adj, void isis_adj_process_threeway(struct isis_adjacency *adj,

View File

@ -54,20 +54,20 @@ struct bpf_insn llcfilter[] = {
3), /* check second byte */ 3), /* check second byte */
BPF_STMT(BPF_LD + BPF_B + BPF_ABS, ETHER_HDR_LEN + 2), 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_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)}; BPF_STMT(BPF_RET + BPF_K, 0)};
u_int readblen = 0; unsigned int readblen = 0;
u_char *readbuff = NULL; uint8_t *readbuff = NULL;
/* /*
* Table 9 - Architectural constants for use with ISO 8802 subnetworks * Table 9 - Architectural constants for use with ISO 8802 subnetworks
* ISO 10589 - 8.4.8 * ISO 10589 - 8.4.8
*/ */
u_char ALL_L1_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x14}; uint8_t ALL_L1_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x14};
u_char ALL_L2_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x15}; uint8_t ALL_L2_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x15};
u_char ALL_ISS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x05}; uint8_t ALL_ISS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x05};
u_char ALL_ESS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x04}; uint8_t ALL_ESS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x04};
static char sock_buff[8192]; static char sock_buff[8192];
@ -76,9 +76,9 @@ static int open_bpf_dev(struct isis_circuit *circuit)
int i = 0, fd; int i = 0, fd;
char bpfdev[128]; char bpfdev[128];
struct ifreq ifr; struct ifreq ifr;
u_int blen, immediate; unsigned int blen, immediate;
#ifdef BIOCSSEESENT #ifdef BIOCSSEESENT
u_int seesent; unsigned int seesent;
#endif #endif
struct timeval timeout; struct timeval timeout;
struct bpf_program bpf_prog; struct bpf_program bpf_prog;
@ -214,10 +214,10 @@ end:
return retval; 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; int bytesread = 0, bytestoread, offset, one = 1, err = ISIS_OK;
u_char *buff_ptr; uint8_t *buff_ptr;
struct bpf_hdr *bpf_hdr; struct bpf_hdr *bpf_hdr;
assert(circuit->fd > 0); assert(circuit->fd > 0);

View File

@ -209,7 +209,7 @@ void isis_circuit_add_addr(struct isis_circuit *circuit,
struct prefix_ipv6 *ipv6; struct prefix_ipv6 *ipv6;
if (connected->address->family == AF_INET) { 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); addr = ntohl(addr);
if (IPV4_NET0(addr) || IPV4_NET127(addr) || IN_CLASSD(addr) if (IPV4_NET0(addr) || IPV4_NET127(addr) || IN_CLASSD(addr)
|| IPV4_LINKLOCAL(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, 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; int len;

View File

@ -37,26 +37,26 @@ struct isis_lsp;
struct password { struct password {
struct password *next; struct password *next;
int len; int len;
u_char *pass; uint8_t *pass;
}; };
struct metric { struct metric {
u_char metric_default; uint8_t metric_default;
u_char metric_error; uint8_t metric_error;
u_char metric_expense; uint8_t metric_expense;
u_char metric_delay; uint8_t metric_delay;
}; };
struct isis_bcast_info { 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 ? */ char run_dr_elect[2]; /* Should we run dr election ? */
struct thread *t_run_dr[2]; /* DR election thread */ struct thread *t_run_dr[2]; /* DR election thread */
struct thread *t_send_lan_hello[2]; /* send LAN IIHs in this thread */ struct thread *t_send_lan_hello[2]; /* send LAN IIHs in this thread */
struct list *adjdb[2]; /* adjacency dbs */ struct list *adjdb[2]; /* adjacency dbs */
struct list *lan_neighs[2]; /* list of lx neigh snpa */ struct list *lan_neighs[2]; /* list of lx neigh snpa */
char is_dr[2]; /* Are we level x DR ? */ char is_dr[2]; /* Are we level x DR ? */
u_char l1_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-1 DR */ uint8_t 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 l2_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-2 DR */
struct thread *t_refresh_pseudo_lsp[2]; /* refresh pseudo-node LSPs */ struct thread *t_refresh_pseudo_lsp[2]; /* refresh pseudo-node LSPs */
}; };
@ -67,7 +67,7 @@ struct isis_p2p_info {
struct isis_circuit { struct isis_circuit {
int state; 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 isis_area *area; /* back pointer to the area */
struct interface *interface; /* interface info from z */ struct interface *interface; /* interface info from z */
int fd; /* IS-IS l1/2 socket */ int fd; /* IS-IS l1/2 socket */
@ -89,7 +89,7 @@ struct isis_circuit {
* circuit * circuit
*/ */
/* there is no real point in two streams, just for programming kicker */ /* 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 */ struct stream *rcv_stream; /* Stream for receiving */
int (*tx)(struct isis_circuit *circuit, int level); int (*tx)(struct isis_circuit *circuit, int level);
struct stream *snd_stream; /* Stream for sending */ struct stream *snd_stream; /* Stream for sending */
@ -104,7 +104,7 @@ struct isis_circuit {
struct isis_bcast_info bc; struct isis_bcast_info bc;
struct isis_p2p_info p2p; struct isis_p2p_info p2p;
} u; } 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 ? */ int pad_hellos; /* add padding to Hello PDUs ? */
char ext_domain; /* externalDomain (boolean) */ char ext_domain; /* externalDomain (boolean) */
int lsp_regenerate_pending[ISIS_LEVELS]; int lsp_regenerate_pending[ISIS_LEVELS];
@ -114,12 +114,12 @@ struct isis_circuit {
struct isis_passwd passwd; /* Circuit rx/tx password */ struct isis_passwd passwd; /* Circuit rx/tx password */
int is_type; /* circuit is type == level of circuit int is_type; /* circuit is type == level of circuit
* differentiated from circuit type (media) */ * differentiated from circuit type (media) */
u_int32_t hello_interval[2]; /* l1HelloInterval in msecs */ uint32_t hello_interval[2]; /* l1HelloInterval in msecs */
u_int16_t hello_multiplier[2]; /* l1HelloMultiplier */ uint16_t hello_multiplier[2]; /* l1HelloMultiplier */
u_int16_t csnp_interval[2]; /* level-1 csnp-interval in seconds */ uint16_t csnp_interval[2]; /* level-1 csnp-interval in seconds */
u_int16_t psnp_interval[2]; /* level-1 psnp-interval in seconds */ uint16_t psnp_interval[2]; /* level-1 psnp-interval in seconds */
u_int8_t metric[2]; uint8_t metric[2];
u_int32_t te_metric[2]; uint32_t te_metric[2];
struct mpls_te_circuit struct mpls_te_circuit
*mtc; /* Support for MPLS-TE parameters - see isis_te.[c,h] */ *mtc; /* Support for MPLS-TE parameters - see isis_te.[c,h] */
int ip_router; /* Route IP ? */ int ip_router; /* Route IP ? */
@ -129,20 +129,20 @@ struct isis_circuit {
int ipv6_router; /* Route IPv6 ? */ int ipv6_router; /* Route IPv6 ? */
struct list *ipv6_link; /* our link local IPv6 addresses */ struct list *ipv6_link; /* our link local IPv6 addresses */
struct list *ipv6_non_link; /* our non-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 #define ISIS_CIRCUIT_FLAPPED_AFTER_SPF 0x01
u_char flags; uint8_t flags;
bool disable_threeway_adj; bool disable_threeway_adj;
/* /*
* Counters as in 10589--11.2.5.9 * Counters as in 10589--11.2.5.9
*/ */
u_int32_t adj_state_changes; /* changesInAdjacencyState */ uint32_t adj_state_changes; /* changesInAdjacencyState */
u_int32_t init_failures; /* intialisationFailures */ uint32_t init_failures; /* intialisationFailures */
u_int32_t ctrl_pdus_rxed; /* controlPDUsReceived */ uint32_t ctrl_pdus_rxed; /* controlPDUsReceived */
u_int32_t ctrl_pdus_txed; /* controlPDUsSent */ uint32_t ctrl_pdus_txed; /* controlPDUsSent */
u_int32_t uint32_t
desig_changes[2]; /* lanLxDesignatedIntermediateSystemChanges */ desig_changes[2]; /* lanLxDesignatedIntermediateSystemChanges */
u_int32_t rej_adjacencies; /* rejectedAdjacencies */ uint32_t rej_adjacencies; /* rejectedAdjacencies */
QOBJ_FIELDS QOBJ_FIELDS
}; };

View File

@ -28,30 +28,30 @@
* Area Address * Area Address
*/ */
struct area_addr { struct area_addr {
u_char addr_len; uint8_t addr_len;
u_char area_addr[20]; uint8_t area_addr[20];
}; };
struct isis_passwd { struct isis_passwd {
u_char len; uint8_t len;
#define ISIS_PASSWD_TYPE_UNUSED 0 #define ISIS_PASSWD_TYPE_UNUSED 0
#define ISIS_PASSWD_TYPE_CLEARTXT 1 #define ISIS_PASSWD_TYPE_CLEARTXT 1
#define ISIS_PASSWD_TYPE_HMAC_MD5 54 #define ISIS_PASSWD_TYPE_HMAC_MD5 54
#define ISIS_PASSWD_TYPE_PRIVATE 255 #define ISIS_PASSWD_TYPE_PRIVATE 255
u_char type; uint8_t type;
/* Authenticate SNPs? */ /* Authenticate SNPs? */
#define SNP_AUTH_SEND 0x01 #define SNP_AUTH_SEND 0x01
#define SNP_AUTH_RECV 0x02 #define SNP_AUTH_RECV 0x02
u_char snp_auth; uint8_t snp_auth;
u_char passwd[255]; uint8_t passwd[255];
}; };
/* /*
* Supported Protocol IDs * Supported Protocol IDs
*/ */
struct nlpids { struct nlpids {
u_char count; uint8_t count;
u_char nlpids[4]; /* FIXME: enough ? */ uint8_t nlpids[4]; /* FIXME: enough ? */
}; };
#endif #endif

Some files were not shown because too many files have changed in this diff Show More