diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-03-27 21:13:34 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-03-27 21:13:34 +0200 |
commit | d7c0a89a3a5697783a6dd89333ab660074790890 (patch) | |
tree | eefa73e502f919b524b8a345437260d4acc23083 /ospf6d | |
parent | tools, doc: update checkpatch for u_int_* (diff) | |
download | frr-d7c0a89a3a5697783a6dd89333ab660074790890.tar.xz frr-d7c0a89a3a5697783a6dd89333ab660074790890.zip |
*: use C99 standard fixed-width integer types
The following types are nonstandard:
- u_char
- u_short
- u_int
- u_long
- u_int8_t
- u_int16_t
- u_int32_t
Replace them with the C99 standard types:
- uint8_t
- unsigned short
- unsigned int
- unsigned long
- uint8_t
- uint16_t
- uint32_t
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'ospf6d')
32 files changed, 442 insertions, 435 deletions
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c index 7ffb80724..163f2dbff 100644 --- a/ospf6d/ospf6_abr.c +++ b/ospf6d/ospf6_abr.c @@ -152,7 +152,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, struct ospf6_inter_prefix_lsa *prefix_lsa; struct ospf6_inter_router_lsa *router_lsa; struct ospf6_route_table *summary_table = NULL; - u_int16_t type; + uint16_t type; char buf[PREFIX2STR_BUFFER]; int is_debug = 0; @@ -506,11 +506,11 @@ void ospf6_abr_range_reset_cost(struct ospf6 *ospf6) OSPF6_ABR_RANGE_CLEAR_COST(range); } -static inline u_int32_t ospf6_abr_range_compute_cost(struct ospf6_route *range, - struct ospf6 *o) +static inline uint32_t ospf6_abr_range_compute_cost(struct ospf6_route *range, + struct ospf6 *o) { struct ospf6_route *ro; - u_int32_t cost = 0; + uint32_t cost = 0; for (ro = ospf6_route_match_head(&range->prefix, o->route_table); ro; ro = ospf6_route_match_next(&range->prefix, ro)) { @@ -524,7 +524,7 @@ static inline u_int32_t ospf6_abr_range_compute_cost(struct ospf6_route *range, } static inline int -ospf6_abr_range_summary_needs_update(struct ospf6_route *range, u_int32_t cost) +ospf6_abr_range_summary_needs_update(struct ospf6_route *range, uint32_t cost) { int redo_summary = 0; @@ -560,7 +560,7 @@ ospf6_abr_range_summary_needs_update(struct ospf6_route *range, u_int32_t cost) static void ospf6_abr_range_update(struct ospf6_route *range) { - u_int32_t cost = 0; + uint32_t cost = 0; struct listnode *node, *nnode; struct ospf6_area *oa; int summary_orig = 0; @@ -686,11 +686,11 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) struct ospf6_route_table *table = NULL; struct ospf6_route *range, *route, *old = NULL; struct ospf6_route *abr_entry; - u_char type = 0; + uint8_t type = 0; char options[3] = {0, 0, 0}; - u_int8_t prefix_options = 0; - u_int32_t cost = 0; - u_char router_bits = 0; + uint8_t prefix_options = 0; + uint32_t cost = 0; + uint8_t router_bits = 0; char buf[PREFIX2STR_BUFFER]; int is_debug = 0; struct ospf6_inter_prefix_lsa *prefix_lsa = NULL; @@ -933,11 +933,11 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) } } -void ospf6_abr_examin_brouter(u_int32_t router_id) +void ospf6_abr_examin_brouter(uint32_t router_id) { struct ospf6_lsa *lsa; struct ospf6_area *oa; - u_int16_t type; + uint16_t type; if (ospf6_is_router_abr(ospf6)) oa = ospf6->backbone; @@ -964,7 +964,7 @@ void ospf6_abr_examin_brouter(u_int32_t router_id) void ospf6_abr_reimport(struct ospf6_area *oa) { struct ospf6_lsa *lsa; - u_int16_t type; + uint16_t type; type = htons(OSPF6_LSTYPE_INTER_ROUTER); for (ALL_LSDB_TYPED(oa->lsdb, type, lsa)) @@ -1025,7 +1025,7 @@ static int ospf6_inter_area_prefix_lsa_show(struct vty *vty, lsa->header); vty_out(vty, " Metric: %lu\n", - (u_long)OSPF6_ABR_SUMMARY_METRIC(prefix_lsa)); + (unsigned long)OSPF6_ABR_SUMMARY_METRIC(prefix_lsa)); ospf6_prefix_options_printbuf(prefix_lsa->prefix.prefix_options, buf, sizeof(buf)); @@ -1069,7 +1069,7 @@ static int ospf6_inter_area_router_lsa_show(struct vty *vty, ospf6_options_printbuf(router_lsa->options, buf, sizeof(buf)); vty_out(vty, " Options: %s\n", buf); vty_out(vty, " Metric: %lu\n", - (u_long)OSPF6_ABR_SUMMARY_METRIC(router_lsa)); + (unsigned long)OSPF6_ABR_SUMMARY_METRIC(router_lsa)); inet_ntop(AF_INET, &router_lsa->router_id, buf, sizeof(buf)); vty_out(vty, " Destination Router ID: %s\n", buf); diff --git a/ospf6d/ospf6_abr.h b/ospf6d/ospf6_abr.h index 61a6a7342..abc383463 100644 --- a/ospf6d/ospf6_abr.h +++ b/ospf6d/ospf6_abr.h @@ -35,17 +35,17 @@ extern unsigned char conf_debug_ospf6_abr; /* Inter-Area-Prefix-LSA */ #define OSPF6_INTER_PREFIX_LSA_MIN_SIZE 4U /* w/o IPv6 prefix */ struct ospf6_inter_prefix_lsa { - u_int32_t metric; + uint32_t metric; struct ospf6_prefix prefix; }; /* Inter-Area-Router-LSA */ #define OSPF6_INTER_ROUTER_LSA_FIX_SIZE 12U struct ospf6_inter_router_lsa { - u_char mbz; - u_char options[3]; - u_int32_t metric; - u_int32_t router_id; + uint8_t mbz; + uint8_t options[3]; + uint32_t metric; + uint32_t router_id; }; #define OSPF6_ABR_SUMMARY_METRIC(E) (ntohl ((E)->metric & htonl (0x00ffffff))) @@ -68,7 +68,7 @@ extern void ospf6_abr_originate_summary(struct ospf6_route *route); extern void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa); extern void ospf6_abr_defaults_to_stub(struct ospf6 *); -extern void ospf6_abr_examin_brouter(u_int32_t router_id); +extern void ospf6_abr_examin_brouter(uint32_t router_id); extern void ospf6_abr_reimport(struct ospf6_area *oa); extern void ospf6_abr_range_reset_cost(struct ospf6 *ospf6); extern void ospf6_abr_prefix_resummarize(struct ospf6 *ospf6); diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index 0a7280603..2cab69aac 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -199,7 +199,7 @@ static void ospf6_area_no_summary_unset(struct ospf6 *ospf6, * @param o - ospf6 instance * @param df - display format for area ID */ -struct ospf6_area *ospf6_area_create(u_int32_t area_id, struct ospf6 *o, int df) +struct ospf6_area *ospf6_area_create(uint32_t area_id, struct ospf6 *o, int df) { struct ospf6_area *oa; @@ -298,7 +298,7 @@ void ospf6_area_delete(struct ospf6_area *oa) XFREE(MTYPE_OSPF6_AREA, oa); } -struct ospf6_area *ospf6_area_lookup(u_int32_t area_id, struct ospf6 *ospf6) +struct ospf6_area *ospf6_area_lookup(uint32_t area_id, struct ospf6 *ospf6) { struct ospf6_area *oa; struct listnode *n; @@ -384,7 +384,7 @@ void ospf6_area_show(struct vty *vty, struct ospf6_area *oa) #define OSPF6_CMD_AREA_GET(str, oa) \ { \ char *ep; \ - u_int32_t area_id = htonl(strtoul(str, &ep, 10)); \ + uint32_t area_id = htonl(strtoul(str, &ep, 10)); \ if (*ep && inet_pton(AF_INET, str, &area_id) != 1) { \ vty_out(vty, "Malformed Area-ID: %s\n", str); \ return CMD_SUCCESS; \ @@ -416,7 +416,7 @@ DEFUN (area_range, struct ospf6_area *oa; struct prefix prefix; struct ospf6_route *range; - u_int32_t cost = OSPF_AREA_RANGE_COST_UNSPEC; + uint32_t cost = OSPF_AREA_RANGE_COST_UNSPEC; OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, oa); @@ -810,7 +810,7 @@ DEFUN (show_ipv6_ospf6_area_spf_tree, "Show SPF tree\n") { int idx_ipv4 = 4; - u_int32_t area_id; + uint32_t area_id; struct ospf6_area *oa; struct ospf6_vertex *root; struct ospf6_route *route; @@ -856,12 +856,12 @@ DEFUN (show_ipv6_ospf6_simulate_spf_tree_root, { int idx_ipv4 = 5; int idx_ipv4_2 = 7; - u_int32_t area_id; + uint32_t area_id; struct ospf6_area *oa; struct ospf6_vertex *root; struct ospf6_route *route; struct prefix prefix; - u_int32_t router_id; + uint32_t router_id; struct ospf6_route_table *spf_table; unsigned char tmp_debug_ospf6_spf = 0; diff --git a/ospf6d/ospf6_area.h b/ospf6d/ospf6_area.h index a44a432a0..eaf3e5c6d 100644 --- a/ospf6d/ospf6_area.h +++ b/ospf6d/ospf6_area.h @@ -28,7 +28,7 @@ struct ospf6_area { struct ospf6 *ospf6; /* Area-ID */ - u_int32_t area_id; + uint32_t area_id; #define OSPF6_AREA_FMT_DOTTEDQUAD 1 #define OSPF6_AREA_FMT_DECIMAL 2 @@ -36,10 +36,10 @@ struct ospf6_area { char name[16]; /* flag */ - u_char flag; + uint8_t flag; /* OSPF Option */ - u_char options[3]; + uint8_t options[3]; /* Summary routes to be originated (includes Configured Address Ranges) */ @@ -60,11 +60,11 @@ struct ospf6_area { struct ospf6_route_table *spf_table; struct ospf6_route_table *route_table; - u_int32_t spf_calculation; /* SPF calculation count */ + uint32_t spf_calculation; /* SPF calculation count */ struct thread *thread_router_lsa; struct thread *thread_intra_prefix_lsa; - u_int32_t router_lsa_size_limit; + uint32_t router_lsa_size_limit; /* Area announce list */ struct { @@ -117,9 +117,9 @@ struct ospf6_area { /* prototypes */ extern int ospf6_area_cmp(void *va, void *vb); -extern struct ospf6_area *ospf6_area_create(u_int32_t, struct ospf6 *, int); +extern struct ospf6_area *ospf6_area_create(uint32_t, struct ospf6 *, int); extern void ospf6_area_delete(struct ospf6_area *); -extern struct ospf6_area *ospf6_area_lookup(u_int32_t, struct ospf6 *); +extern struct ospf6_area *ospf6_area_lookup(uint32_t, struct ospf6 *); extern void ospf6_area_enable(struct ospf6_area *); extern void ospf6_area_disable(struct ospf6_area *); diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index cd930f6c0..1b46b9c68 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -813,8 +813,8 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa, void ospf6_asbr_lsentry_add(struct ospf6_route *asbr_entry) { struct ospf6_lsa *lsa; - u_int16_t type; - u_int32_t router; + uint16_t type; + uint32_t router; if (!CHECK_FLAG(asbr_entry->flag, OSPF6_ROUTE_BEST)) { char buf[16]; @@ -835,8 +835,8 @@ void ospf6_asbr_lsentry_add(struct ospf6_route *asbr_entry) void ospf6_asbr_lsentry_remove(struct ospf6_route *asbr_entry) { struct ospf6_lsa *lsa; - u_int16_t type; - u_int32_t router; + uint16_t type; + uint32_t router; type = htons(OSPF6_LSTYPE_AS_EXTERNAL); router = ospf6_linkstate_prefix_adv_router(&asbr_entry->prefix); @@ -997,7 +997,8 @@ void ospf6_asbr_send_externals_to_area(struct ospf6_area *oa) } void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, - struct prefix *prefix, u_int nexthop_num, + struct prefix *prefix, + unsigned int nexthop_num, struct in6_addr *nexthop, route_tag_t tag) { int ret; @@ -1486,7 +1487,7 @@ ospf6_routemap_rule_set_metric(void *rule, struct prefix *prefix, static void *ospf6_routemap_rule_set_metric_compile(const char *arg) { - u_int32_t metric; + uint32_t metric; char *endp; metric = strtoul(arg, &endp, 0); if (metric > OSPF_LS_INFINITY || *endp != '\0') @@ -1740,7 +1741,7 @@ static int ospf6_as_external_lsa_show(struct vty *vty, struct ospf6_lsa *lsa) vty_out(vty, " Bits: %s\n", buf); vty_out(vty, " Metric: %5lu\n", - (u_long)OSPF6_ASBR_METRIC(external)); + (unsigned long)OSPF6_ASBR_METRIC(external)); ospf6_prefix_options_printbuf(external->prefix.prefix_options, buf, sizeof(buf)); @@ -1773,7 +1774,7 @@ static void ospf6_asbr_external_route_show(struct vty *vty, { struct ospf6_external_info *info = route->route_option; char prefix[PREFIX2STR_BUFFER], id[16], forwarding[64]; - u_int32_t tmp_id; + uint32_t tmp_id; prefix2str(&route->prefix, prefix, sizeof(prefix)); tmp_id = ntohl(info->id); @@ -1788,8 +1789,9 @@ static void ospf6_asbr_external_route_show(struct vty *vty, vty_out(vty, "%c %-32s %-15s type-%d %5lu %s\n", zebra_route_char(info->type), prefix, id, route->path.metric_type, - (u_long)(route->path.metric_type == 2 ? route->path.u.cost_e2 - : route->path.cost), + (unsigned long)(route->path.metric_type == 2 + ? route->path.u.cost_e2 + : route->path.cost), forwarding); } diff --git a/ospf6d/ospf6_asbr.h b/ospf6d/ospf6_asbr.h index bd160a645..9890ef061 100644 --- a/ospf6d/ospf6_asbr.h +++ b/ospf6d/ospf6_asbr.h @@ -39,7 +39,7 @@ struct ospf6_external_info { int type; /* Originating Link State ID */ - u_int32_t id; + uint32_t id; struct in6_addr forwarding; @@ -51,7 +51,7 @@ struct ospf6_external_info { /* AS-External-LSA */ #define OSPF6_AS_EXTERNAL_LSA_MIN_SIZE 4U /* w/o IPv6 prefix */ struct ospf6_as_external_lsa { - u_int32_t bits_metric; + uint32_t bits_metric; struct ospf6_prefix prefix; /* followed by none or one forwarding address */ @@ -79,7 +79,7 @@ extern void ospf6_asbr_lsentry_remove(struct ospf6_route *asbr_entry); extern int ospf6_asbr_is_asbr(struct ospf6 *o); extern void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, struct prefix *prefix, - u_int nexthop_num, + unsigned int nexthop_num, struct in6_addr *nexthop, route_tag_t tag); extern void ospf6_asbr_redistribute_remove(int type, ifindex_t ifindex, diff --git a/ospf6d/ospf6_bfd.c b/ospf6d/ospf6_bfd.c index e28af9d06..795512136 100644 --- a/ospf6d/ospf6_bfd.c +++ b/ospf6d/ospf6_bfd.c @@ -295,8 +295,8 @@ void ospf6_bfd_write_config(struct vty *vty, struct ospf6_interface *oi) * ospf6_bfd_if_param_set - Set the configured BFD paramter values for * interface. */ -static void ospf6_bfd_if_param_set(struct ospf6_interface *oi, u_int32_t min_rx, - u_int32_t min_tx, u_int8_t detect_mult, +static void ospf6_bfd_if_param_set(struct ospf6_interface *oi, uint32_t min_rx, + uint32_t min_tx, uint8_t detect_mult, int defaults) { int command = 0; @@ -344,9 +344,9 @@ DEFUN (ipv6_ospf6_bfd_param, int idx_number_2 = 4; int idx_number_3 = 5; struct ospf6_interface *oi; - u_int32_t rx_val; - u_int32_t tx_val; - u_int8_t dm_val; + uint32_t rx_val; + uint32_t tx_val; + uint8_t dm_val; int ret; assert(ifp); diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 852429221..7c60749d7 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -101,7 +101,7 @@ static void ospf6_interface_lsdb_hook_remove(struct ospf6_lsa *lsa) ospf6_interface_lsdb_hook(lsa, ospf6_lsremove_to_spf_reason(lsa)); } -static u_char ospf6_default_iftype(struct interface *ifp) +static uint8_t ospf6_default_iftype(struct interface *ifp) { if (if_is_pointopoint(ifp)) return OSPF_IFTYPE_POINTOPOINT; @@ -111,11 +111,11 @@ static u_char ospf6_default_iftype(struct interface *ifp) return OSPF_IFTYPE_BROADCAST; } -static u_int32_t ospf6_interface_get_cost(struct ospf6_interface *oi) +static uint32_t ospf6_interface_get_cost(struct ospf6_interface *oi) { /* If all else fails, use default OSPF cost */ - u_int32_t cost; - u_int32_t bw, refbw; + uint32_t cost; + uint32_t bw, refbw; /* interface speed and bw can be 0 in some platforms, * use ospf default bw. If bw is configured then it would @@ -134,7 +134,7 @@ static u_int32_t ospf6_interface_get_cost(struct ospf6_interface *oi) if (CHECK_FLAG(oi->flag, OSPF6_INTERFACE_NOAUTOCOST)) cost = oi->cost; else { - cost = (u_int32_t)((double)refbw / (double)bw + (double)0.5); + cost = (uint32_t)((double)refbw / (double)bw + (double)0.5); if (cost < 1) cost = 1; else if (cost > UINT32_MAX) @@ -161,7 +161,7 @@ static void ospf6_interface_force_recalculate_cost(struct ospf6_interface *oi) static void ospf6_interface_recalculate_cost(struct ospf6_interface *oi) { - u_int32_t newcost; + uint32_t newcost; newcost = ospf6_interface_get_cost(oi); if (newcost == oi->cost) @@ -494,10 +494,10 @@ void ospf6_interface_connected_route_update(struct interface *ifp) OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB(oi->area); } -static void ospf6_interface_state_change(u_char next_state, +static void ospf6_interface_state_change(uint8_t next_state, struct ospf6_interface *oi) { - u_char prev_state; + uint8_t prev_state; prev_state = oi->state; oi->state = next_state; @@ -610,12 +610,12 @@ static struct ospf6_neighbor *better_drouter(struct ospf6_neighbor *a, return a; } -static u_char dr_election(struct ospf6_interface *oi) +static uint8_t dr_election(struct ospf6_interface *oi) { struct listnode *node, *nnode; struct ospf6_neighbor *on, *drouter, *bdrouter, myself; struct ospf6_neighbor *best_drouter, *best_bdrouter; - u_char next_state = 0; + uint8_t next_state = 0; drouter = bdrouter = NULL; best_drouter = best_bdrouter = NULL; @@ -1346,7 +1346,7 @@ DEFUN (auto_cost_reference_bandwidth, struct ospf6_area *oa; struct ospf6_interface *oi; struct listnode *i, *j; - u_int32_t refbw; + uint32_t refbw; refbw = strtol(argv[idx_number]->arg, NULL, 10); if (refbw < 1 || refbw > 4294967) { diff --git a/ospf6d/ospf6_interface.h b/ospf6d/ospf6_interface.h index 9b9952beb..553e89a22 100644 --- a/ospf6d/ospf6_interface.h +++ b/ospf6d/ospf6_interface.h @@ -48,50 +48,50 @@ struct ospf6_interface { /* Interface ID; use interface->ifindex */ /* ospf6 instance id */ - u_char instance_id; + uint8_t instance_id; /* I/F transmission delay */ - u_int32_t transdelay; + uint32_t transdelay; /* Network Type */ - u_char type; + uint8_t type; /* Router Priority */ - u_char priority; + uint8_t priority; /* Time Interval */ - u_int16_t hello_interval; - u_int16_t dead_interval; - u_int32_t rxmt_interval; + uint16_t hello_interval; + uint16_t dead_interval; + uint32_t rxmt_interval; - u_int32_t state_change; + uint32_t state_change; /* Cost */ - u_int32_t cost; + uint32_t cost; /* I/F MTU */ - u_int32_t ifmtu; + uint32_t ifmtu; /* Configured MTU */ - u_int32_t c_ifmtu; + uint32_t c_ifmtu; /* Interface State */ - u_char state; + uint8_t state; /* Interface socket setting trial counter, resets on success */ - u_char sso_try_cnt; + uint8_t sso_try_cnt; /* OSPF6 Interface flag */ char flag; /* MTU mismatch check */ - u_char mtu_ignore; + uint8_t mtu_ignore; /* Decision of DR Election */ - u_int32_t drouter; - u_int32_t bdrouter; - u_int32_t prev_drouter; - u_int32_t prev_bdrouter; + uint32_t drouter; + uint32_t bdrouter; + uint32_t prev_drouter; + uint32_t prev_bdrouter; /* Linklocal LSA Database: includes Link-LSA */ struct ospf6_lsdb *lsdb; @@ -119,17 +119,17 @@ struct ospf6_interface { void *bfd_info; /* Statistics Fields */ - u_int32_t hello_in; - u_int32_t hello_out; - u_int32_t db_desc_in; - u_int32_t db_desc_out; - u_int32_t ls_req_in; - u_int32_t ls_req_out; - u_int32_t ls_upd_in; - u_int32_t ls_upd_out; - u_int32_t ls_ack_in; - u_int32_t ls_ack_out; - u_int32_t discarded; + uint32_t hello_in; + uint32_t hello_out; + uint32_t db_desc_in; + uint32_t db_desc_out; + uint32_t ls_req_in; + uint32_t ls_req_out; + uint32_t ls_upd_in; + uint32_t ls_upd_out; + uint32_t ls_ack_in; + uint32_t ls_ack_out; + uint32_t discarded; QOBJ_FIELDS }; diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index 0b7755a3f..1872c6bd3 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -49,8 +49,8 @@ #include "ospf6_spf.h" unsigned char conf_debug_ospf6_brouter = 0; -u_int32_t conf_debug_ospf6_brouter_specific_router_id; -u_int32_t conf_debug_ospf6_brouter_specific_area_id; +uint32_t conf_debug_ospf6_brouter_specific_router_id; +uint32_t conf_debug_ospf6_brouter_specific_area_id; #define MAX_LSA_PAYLOAD (1024 + 256) /******************************/ @@ -189,15 +189,15 @@ int ospf6_router_lsa_originate(struct thread *thread) struct ospf6_lsa_header *lsa_header; struct ospf6_lsa *lsa; - u_int32_t link_state_id = 0; + uint32_t link_state_id = 0; struct listnode *node, *nnode; struct listnode *j; struct ospf6_interface *oi; struct ospf6_neighbor *on, *drouter = NULL; struct ospf6_router_lsa *router_lsa; struct ospf6_router_lsdesc *lsdesc; - u_int16_t type; - u_int32_t router; + uint16_t type; + uint32_t router; int count; oa = (struct ospf6_area *)THREAD_ARG(thread); @@ -461,7 +461,7 @@ int ospf6_network_lsa_originate(struct thread *thread) struct ospf6_neighbor *on; struct ospf6_link_lsa *link_lsa; struct listnode *i; - u_int16_t type; + uint16_t type; oi = (struct ospf6_interface *)THREAD_ARG(thread); oi->thread_network_lsa = NULL; @@ -1142,7 +1142,7 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread) struct ospf6_route_table *route_advertise; struct ospf6_link_lsa *link_lsa; char *start, *end, *current; - u_int16_t type; + uint16_t type; char buf[PREFIX2STR_BUFFER]; oi = (struct ospf6_interface *)THREAD_ARG(thread); @@ -1505,7 +1505,7 @@ void ospf6_intra_prefix_lsa_remove(struct ospf6_lsa *lsa) void ospf6_intra_route_calculation(struct ospf6_area *oa) { struct ospf6_route *route, *nroute; - u_int16_t type; + uint16_t type; struct ospf6_lsa *lsa; void (*hook_add)(struct ospf6_route *) = NULL; void (*hook_remove)(struct ospf6_route *) = NULL; @@ -1558,7 +1558,7 @@ void ospf6_intra_route_calculation(struct ospf6_area *oa) static void ospf6_brouter_debug_print(struct ospf6_route *brouter) { - u_int32_t brouter_id; + uint32_t brouter_id; char brouter_name[16]; char area_name[16]; char destination[64]; @@ -1614,7 +1614,7 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa) struct ospf6_route *brouter, *nbrouter, *copy; void (*hook_add)(struct ospf6_route *) = NULL; void (*hook_remove)(struct ospf6_route *) = NULL; - u_int32_t brouter_id; + uint32_t brouter_id; char brouter_name[16]; if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID(oa->area_id)) @@ -1861,7 +1861,7 @@ DEFUN (debug_ospf6_brouter_router, ) { int idx_ipv4 = 4; - u_int32_t router_id; + uint32_t router_id; inet_pton(AF_INET, argv[idx_ipv4]->arg, &router_id); OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ON(router_id); return CMD_SUCCESS; @@ -1892,7 +1892,7 @@ DEFUN (debug_ospf6_brouter_area, ) { int idx_ipv4 = 4; - u_int32_t area_id; + uint32_t area_id; inet_pton(AF_INET, argv[idx_ipv4]->arg, &area_id); OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ON(area_id); return CMD_SUCCESS; diff --git a/ospf6d/ospf6_intra.h b/ospf6d/ospf6_intra.h index 07f0f124e..2abcce8c8 100644 --- a/ospf6d/ospf6_intra.h +++ b/ospf6d/ospf6_intra.h @@ -23,8 +23,8 @@ /* Debug option */ extern unsigned char conf_debug_ospf6_brouter; -extern u_int32_t conf_debug_ospf6_brouter_specific_router_id; -extern u_int32_t conf_debug_ospf6_brouter_specific_area_id; +extern uint32_t conf_debug_ospf6_brouter_specific_router_id; +extern uint32_t conf_debug_ospf6_brouter_specific_area_id; #define OSPF6_DEBUG_BROUTER_SUMMARY 0x01 #define OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER 0x02 #define OSPF6_DEBUG_BROUTER_SPECIFIC_AREA 0x04 @@ -73,20 +73,20 @@ extern u_int32_t conf_debug_ospf6_brouter_specific_area_id; /* Router-LSA */ #define OSPF6_ROUTER_LSA_MIN_SIZE 4U struct ospf6_router_lsa { - u_char bits; - u_char options[3]; + uint8_t bits; + uint8_t options[3]; /* followed by ospf6_router_lsdesc(s) */ }; /* Link State Description in Router-LSA */ #define OSPF6_ROUTER_LSDESC_FIX_SIZE 16U struct ospf6_router_lsdesc { - u_char type; - u_char reserved; - u_int16_t metric; /* output cost */ - u_int32_t interface_id; - u_int32_t neighbor_interface_id; - u_int32_t neighbor_router_id; + uint8_t type; + uint8_t reserved; + uint16_t metric; /* output cost */ + uint32_t interface_id; + uint32_t neighbor_interface_id; + uint32_t neighbor_router_id; }; #define OSPF6_ROUTER_LSDESC_POINTTOPOINT 1 @@ -117,15 +117,15 @@ enum stub_router_mode { /* Network-LSA */ #define OSPF6_NETWORK_LSA_MIN_SIZE 4U struct ospf6_network_lsa { - u_char reserved; - u_char options[3]; + uint8_t reserved; + uint8_t options[3]; /* followed by ospf6_netowrk_lsd(s) */ }; /* Link State Description in Router-LSA */ #define OSPF6_NETWORK_LSDESC_FIX_SIZE 4U struct ospf6_network_lsdesc { - u_int32_t router_id; + uint32_t router_id; }; #define NETWORK_LSDESC_GET_NBR_ROUTERID(x) \ (((struct ospf6_network_lsdesc *)(x))->router_id) @@ -133,20 +133,20 @@ struct ospf6_network_lsdesc { /* Link-LSA */ #define OSPF6_LINK_LSA_MIN_SIZE 24U /* w/o 1st IPv6 prefix */ struct ospf6_link_lsa { - u_char priority; - u_char options[3]; + uint8_t priority; + uint8_t options[3]; struct in6_addr linklocal_addr; - u_int32_t prefix_num; + uint32_t prefix_num; /* followed by ospf6 prefix(es) */ }; /* Intra-Area-Prefix-LSA */ #define OSPF6_INTRA_PREFIX_LSA_MIN_SIZE 12U /* w/o 1st IPv6 prefix */ struct ospf6_intra_prefix_lsa { - u_int16_t prefix_num; - u_int16_t ref_type; - u_int32_t ref_id; - u_int32_t ref_adv_router; + uint16_t prefix_num; + uint16_t ref_type; + uint32_t ref_id; + uint32_t ref_adv_router; /* followed by ospf6 prefix(es) */ }; @@ -213,11 +213,11 @@ struct ospf6_intra_prefix_lsa { } while (0) /* Function Prototypes */ -extern char *ospf6_router_lsdesc_lookup(u_char type, u_int32_t interface_id, - u_int32_t neighbor_interface_id, - u_int32_t neighbor_router_id, +extern char *ospf6_router_lsdesc_lookup(uint8_t type, uint32_t interface_id, + uint32_t neighbor_interface_id, + uint32_t neighbor_router_id, struct ospf6_lsa *lsa); -extern char *ospf6_network_lsdesc_lookup(u_int32_t router_id, +extern char *ospf6_network_lsdesc_lookup(uint32_t router_id, struct ospf6_lsa *lsa); extern int ospf6_router_is_stub_router(struct ospf6_lsa *lsa); diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index e060879f4..8b720b6d8 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -47,11 +47,11 @@ vector ospf6_lsa_handler_vector; static int ospf6_unknown_lsa_show(struct vty *vty, struct ospf6_lsa *lsa) { - u_char *start, *end, *current; + uint8_t *start, *end, *current; char byte[4]; - start = (u_char *)lsa->header + sizeof(struct ospf6_lsa_header); - end = (u_char *)lsa->header + ntohs(lsa->header->length); + start = (uint8_t *)lsa->header + sizeof(struct ospf6_lsa_header); + end = (uint8_t *)lsa->header + ntohs(lsa->header->length); vty_out(vty, " Unknown contents:\n"); for (current = start; current < end; current++) { @@ -84,7 +84,7 @@ void ospf6_install_lsa_handler(const struct ospf6_lsa_handler *handler) vector_set_index(ospf6_lsa_handler_vector, index, (void *)handler); } -const struct ospf6_lsa_handler *ospf6_get_lsa_handler(u_int16_t type) +const struct ospf6_lsa_handler *ospf6_get_lsa_handler(uint16_t type) { const struct ospf6_lsa_handler *handler = NULL; unsigned int index = ntohs(type) & OSPF6_LSTYPE_FCODE_MASK; @@ -100,7 +100,7 @@ const struct ospf6_lsa_handler *ospf6_get_lsa_handler(u_int16_t type) return handler; } -const char *ospf6_lstype_name(u_int16_t type) +const char *ospf6_lstype_name(uint16_t type) { static char buf[8]; const struct ospf6_lsa_handler *handler; @@ -113,7 +113,7 @@ const char *ospf6_lstype_name(u_int16_t type) return buf; } -const char *ospf6_lstype_short_name(u_int16_t type) +const char *ospf6_lstype_short_name(uint16_t type) { static char buf[8]; const struct ospf6_lsa_handler *handler; @@ -126,7 +126,7 @@ const char *ospf6_lstype_short_name(u_int16_t type) return buf; } -u_char ospf6_lstype_debug(u_int16_t type) +uint8_t ospf6_lstype_debug(uint16_t type) { const struct ospf6_lsa_handler *handler; handler = ospf6_get_lsa_handler(type); @@ -207,11 +207,11 @@ void ospf6_lsa_age_set(struct ospf6_lsa *lsa) /* this function calculates current age from its birth, then update age field of LSA header. return value is current age */ -u_int16_t ospf6_lsa_age_current(struct ospf6_lsa *lsa) +uint16_t ospf6_lsa_age_current(struct ospf6_lsa *lsa) { struct timeval now; - u_int32_t ulage; - u_int16_t age; + uint32_t ulage; + uint16_t age; assert(lsa); assert(lsa->header); @@ -237,7 +237,7 @@ u_int16_t ospf6_lsa_age_current(struct ospf6_lsa *lsa) } /* update age field of LSA header with adding InfTransDelay */ -void ospf6_lsa_age_update_to_send(struct ospf6_lsa *lsa, u_int32_t transdelay) +void ospf6_lsa_age_update_to_send(struct ospf6_lsa *lsa, uint32_t transdelay) { unsigned short age; @@ -292,8 +292,8 @@ void ospf6_lsa_premature_aging(struct ospf6_lsa *lsa) int ospf6_lsa_compare(struct ospf6_lsa *a, struct ospf6_lsa *b) { int32_t seqnuma, seqnumb; - u_int16_t cksuma, cksumb; - u_int16_t agea, ageb; + uint16_t cksuma, cksumb; + uint16_t agea, ageb; assert(a && a->header); assert(b && b->header); @@ -355,7 +355,7 @@ void ospf6_lsa_header_print_raw(struct ospf6_lsa_header *header) zlog_debug(" [%s Id:%s Adv:%s]", ospf6_lstype_name(header->type), id, adv_router); zlog_debug(" Age: %4hu SeqNum: %#08lx Cksum: %04hx Len: %d", - ntohs(header->age), (u_long)ntohl(header->seqnum), + ntohs(header->age), (unsigned long)ntohl(header->seqnum), ntohs(header->checksum), ntohs(header->length)); } @@ -394,13 +394,13 @@ void ospf6_lsa_show_summary(struct vty *vty, struct ospf6_lsa *lsa) vty_out(vty, "%-4s %-15s%-15s%4hu %8lx %30s\n", ospf6_lstype_short_name(lsa->header->type), id, adv_router, ospf6_lsa_age_current(lsa), - (u_long)ntohl(lsa->header->seqnum), + (unsigned long)ntohl(lsa->header->seqnum), handler->lh_get_prefix_str(lsa, buf, sizeof(buf), 0)); } else if (type != OSPF6_LSTYPE_UNKNOWN) { sprintf(tmpbuf, "%-4s %-15s%-15s%4hu %8lx", ospf6_lstype_short_name(lsa->header->type), id, adv_router, ospf6_lsa_age_current(lsa), - (u_long)ntohl(lsa->header->seqnum)); + (unsigned long)ntohl(lsa->header->seqnum)); while (handler->lh_get_prefix_str(lsa, buf, sizeof(buf), cnt) != NULL) { @@ -411,17 +411,17 @@ void ospf6_lsa_show_summary(struct vty *vty, struct ospf6_lsa *lsa) vty_out(vty, "%-4s %-15s%-15s%4hu %8lx\n", ospf6_lstype_short_name(lsa->header->type), id, adv_router, ospf6_lsa_age_current(lsa), - (u_long)ntohl(lsa->header->seqnum)); + (unsigned long)ntohl(lsa->header->seqnum)); } } void ospf6_lsa_show_dump(struct vty *vty, struct ospf6_lsa *lsa) { - u_char *start, *end, *current; + uint8_t *start, *end, *current; char byte[4]; - start = (u_char *)lsa->header; - end = (u_char *)lsa->header + ntohs(lsa->header->length); + start = (uint8_t *)lsa->header; + end = (uint8_t *)lsa->header + ntohs(lsa->header->length); vty_out(vty, "\n"); vty_out(vty, "%s:\n", lsa->name); @@ -456,7 +456,7 @@ void ospf6_lsa_show_internal(struct vty *vty, struct ospf6_lsa *lsa) vty_out(vty, "Link State ID: %s\n", id); vty_out(vty, "Advertising Router: %s\n", adv_router); vty_out(vty, "LS Sequence Number: %#010lx\n", - (u_long)ntohl(lsa->header->seqnum)); + (unsigned long)ntohl(lsa->header->seqnum)); vty_out(vty, "CheckSum: %#06hx Length: %hu\n", ntohs(lsa->header->checksum), ntohs(lsa->header->length)); vty_out(vty, "Flag: %x \n", lsa->flag); @@ -490,7 +490,7 @@ void ospf6_lsa_show(struct vty *vty, struct ospf6_lsa *lsa) vty_out(vty, "Link State ID: %s\n", id); vty_out(vty, "Advertising Router: %s\n", adv_router); vty_out(vty, "LS Sequence Number: %#010lx\n", - (u_long)ntohl(lsa->header->seqnum)); + (unsigned long)ntohl(lsa->header->seqnum)); vty_out(vty, "CheckSum: %#06hx Length: %hu\n", ntohs(lsa->header->checksum), ntohs(lsa->header->length)); vty_out(vty, "Duration: %s\n", duration); @@ -512,7 +512,7 @@ struct ospf6_lsa *ospf6_lsa_create(struct ospf6_lsa_header *header) { struct ospf6_lsa *lsa = NULL; struct ospf6_lsa_header *new_header = NULL; - u_int16_t lsa_size = 0; + uint16_t lsa_size = 0; /* size of the entire LSA */ lsa_size = ntohs(header->length); /* XXX vulnerable */ @@ -743,26 +743,28 @@ void ospf6_flush_self_originated_lsas_now(void) one-based. */ unsigned short ospf6_lsa_checksum(struct ospf6_lsa_header *lsa_header) { - u_char *buffer = (u_char *)&lsa_header->type; - int type_offset = buffer - (u_char *)&lsa_header->age; /* should be 2 */ + uint8_t *buffer = (uint8_t *)&lsa_header->type; + int type_offset = + buffer - (uint8_t *)&lsa_header->age; /* should be 2 */ /* Skip the AGE field */ - u_int16_t len = ntohs(lsa_header->length) - type_offset; + uint16_t len = ntohs(lsa_header->length) - type_offset; /* Checksum offset starts from "type" field, not the beginning of the lsa_header struct. The offset is 14, rather than 16. */ - int checksum_offset = (u_char *)&lsa_header->checksum - buffer; + int checksum_offset = (uint8_t *)&lsa_header->checksum - buffer; return (unsigned short)fletcher_checksum(buffer, len, checksum_offset); } int ospf6_lsa_checksum_valid(struct ospf6_lsa_header *lsa_header) { - u_char *buffer = (u_char *)&lsa_header->type; - int type_offset = buffer - (u_char *)&lsa_header->age; /* should be 2 */ + uint8_t *buffer = (uint8_t *)&lsa_header->type; + int type_offset = + buffer - (uint8_t *)&lsa_header->age; /* should be 2 */ /* Skip the AGE field */ - u_int16_t len = ntohs(lsa_header->length) - type_offset; + uint16_t len = ntohs(lsa_header->length) - type_offset; return (fletcher_checksum(buffer, len, FLETCHER_CHECKSUM_VALIDATE) == 0); @@ -874,7 +876,7 @@ DEFUN (no_debug_ospf6_lsa_type, { int idx_lsa = 4; int idx_type = 5; - u_int i; + unsigned int i; struct ospf6_lsa_handler *handler = NULL; for (i = 0; i < vector_active(ospf6_lsa_handler_vector); i++) { @@ -915,7 +917,7 @@ void install_element_ospf6_debug_lsa(void) int config_write_ospf6_debug_lsa(struct vty *vty) { - u_int i; + unsigned int i; const struct ospf6_lsa_handler *handler; for (i = 0; i < vector_active(ospf6_lsa_handler_vector); i++) { diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h index 4bf56a8c1..e88d10ad7 100644 --- a/ospf6d/ospf6_lsa.h +++ b/ospf6d/ospf6_lsa.h @@ -78,13 +78,13 @@ /* LSA Header */ #define OSPF6_LSA_HEADER_SIZE 20U struct ospf6_lsa_header { - u_int16_t age; /* LS age */ - u_int16_t type; /* LS type */ - u_int32_t id; /* Link State ID */ - u_int32_t adv_router; /* Advertising Router */ - u_int32_t seqnum; /* LS sequence number */ - u_int16_t checksum; /* LS checksum */ - u_int16_t length; /* LSA length */ + uint16_t age; /* LS age */ + uint16_t type; /* LS type */ + uint32_t id; /* Link State ID */ + uint32_t adv_router; /* Advertising Router */ + uint32_t seqnum; /* LS sequence number */ + uint16_t checksum; /* LS checksum */ + uint16_t length; /* LSA length */ }; #define OSPF6_LSA_HEADER_END(h) ((caddr_t)(h) + sizeof(struct ospf6_lsa_header)) @@ -138,7 +138,7 @@ struct ospf6_lsa { struct ospf6_lsa_handler { const struct { - u_int16_t type; /* host byte order */ + uint16_t type; /* host byte order */ const char *name; const char *short_name; int (*show)(struct vty *, struct ospf6_lsa *); @@ -150,7 +150,7 @@ struct ospf6_lsa_handler { #define lh_short_name s.short_name #define lh_show s.show #define lh_get_prefix_str s.get_prefix_str - u_char debug; + uint8_t debug; #define lh_debug debug }; @@ -208,13 +208,13 @@ extern vector ospf6_lsa_handler_vector; /* Function Prototypes */ -extern const char *ospf6_lstype_name(u_int16_t type); -extern const char *ospf6_lstype_short_name(u_int16_t type); -extern u_char ospf6_lstype_debug(u_int16_t type); +extern const char *ospf6_lstype_name(uint16_t type); +extern const char *ospf6_lstype_short_name(uint16_t type); +extern uint8_t ospf6_lstype_debug(uint16_t type); extern int ospf6_lsa_is_differ(struct ospf6_lsa *lsa1, struct ospf6_lsa *lsa2); extern int ospf6_lsa_is_changed(struct ospf6_lsa *lsa1, struct ospf6_lsa *lsa2); -extern u_int16_t ospf6_lsa_age_current(struct ospf6_lsa *); -extern void ospf6_lsa_age_update_to_send(struct ospf6_lsa *, u_int32_t); +extern uint16_t ospf6_lsa_age_current(struct ospf6_lsa *); +extern void ospf6_lsa_age_update_to_send(struct ospf6_lsa *, uint32_t); extern void ospf6_lsa_premature_aging(struct ospf6_lsa *); extern int ospf6_lsa_compare(struct ospf6_lsa *, struct ospf6_lsa *); @@ -241,11 +241,11 @@ extern int ospf6_lsa_refresh(struct thread *); extern unsigned short ospf6_lsa_checksum(struct ospf6_lsa_header *); extern int ospf6_lsa_checksum_valid(struct ospf6_lsa_header *); -extern int ospf6_lsa_prohibited_duration(u_int16_t type, u_int32_t id, - u_int32_t adv_router, void *scope); +extern int ospf6_lsa_prohibited_duration(uint16_t type, uint32_t id, + uint32_t adv_router, void *scope); extern void ospf6_install_lsa_handler(const struct ospf6_lsa_handler *handler); -extern const struct ospf6_lsa_handler *ospf6_get_lsa_handler(u_int16_t type); +extern const struct ospf6_lsa_handler *ospf6_get_lsa_handler(uint16_t type); extern void ospf6_lsa_init(void); extern void ospf6_lsa_terminate(void); diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c index f17b558e8..5e02c0c91 100644 --- a/ospf6d/ospf6_lsdb.c +++ b/ospf6d/ospf6_lsdb.c @@ -173,8 +173,8 @@ void ospf6_lsdb_remove(struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb) ospf6_lsdb_count_assert(lsdb); } -struct ospf6_lsa *ospf6_lsdb_lookup(u_int16_t type, u_int32_t id, - u_int32_t adv_router, +struct ospf6_lsa *ospf6_lsdb_lookup(uint16_t type, uint32_t id, + uint32_t adv_router, struct ospf6_lsdb *lsdb) { struct route_node *node; @@ -196,8 +196,8 @@ struct ospf6_lsa *ospf6_lsdb_lookup(u_int16_t type, u_int32_t id, return (struct ospf6_lsa *)node->info; } -struct ospf6_lsa *ospf6_lsdb_lookup_next(u_int16_t type, u_int32_t id, - u_int32_t adv_router, +struct ospf6_lsa *ospf6_lsdb_lookup_next(uint16_t type, uint32_t id, + uint32_t adv_router, struct ospf6_lsdb *lsdb) { struct route_node *node; @@ -355,7 +355,7 @@ int ospf6_lsdb_maxage_remover(struct ospf6_lsdb *lsdb) } void ospf6_lsdb_show(struct vty *vty, enum ospf_lsdb_show_level level, - u_int16_t *type, u_int32_t *id, u_int32_t *adv_router, + uint16_t *type, uint32_t *id, uint32_t *adv_router, struct ospf6_lsdb *lsdb) { struct ospf6_lsa *lsa; @@ -403,11 +403,11 @@ void ospf6_lsdb_show(struct vty *vty, enum ospf_lsdb_show_level level, } } -u_int32_t ospf6_new_ls_id(u_int16_t type, u_int32_t adv_router, - struct ospf6_lsdb *lsdb) +uint32_t ospf6_new_ls_id(uint16_t type, uint32_t adv_router, + struct ospf6_lsdb *lsdb) { struct ospf6_lsa *lsa; - u_int32_t id = 1, tmp_id; + uint32_t id = 1, tmp_id; /* This routine is curently invoked only for Inter-Prefix LSAs for * non-summarized routes (no area/range). @@ -424,13 +424,13 @@ u_int32_t ospf6_new_ls_id(u_int16_t type, u_int32_t adv_router, id++; } - return ((u_int32_t)htonl(id)); + return ((uint32_t)htonl(id)); } /* Decide new LS sequence number to originate. note return value is network byte order */ -u_int32_t ospf6_new_ls_seqnum(u_int16_t type, u_int32_t id, - u_int32_t adv_router, struct ospf6_lsdb *lsdb) +uint32_t ospf6_new_ls_seqnum(uint16_t type, uint32_t id, uint32_t adv_router, + struct ospf6_lsdb *lsdb) { struct ospf6_lsa *lsa; signed long seqnum = 0; @@ -442,5 +442,5 @@ u_int32_t ospf6_new_ls_seqnum(u_int16_t type, u_int32_t id, else seqnum = (signed long)ntohl(lsa->header->seqnum) + 1; - return ((u_int32_t)htonl(seqnum)); + return ((uint32_t)htonl(seqnum)); } diff --git a/ospf6d/ospf6_lsdb.h b/ospf6d/ospf6_lsdb.h index 41e54b5d8..3b32e3ecf 100644 --- a/ospf6d/ospf6_lsdb.h +++ b/ospf6d/ospf6_lsdb.h @@ -28,7 +28,7 @@ struct ospf6_lsdb { void *data; /* data structure that holds this lsdb */ struct route_table *table; - u_int32_t count; + uint32_t count; void (*hook_add)(struct ospf6_lsa *); void (*hook_remove)(struct ospf6_lsa *); }; @@ -37,11 +37,11 @@ struct ospf6_lsdb { extern struct ospf6_lsdb *ospf6_lsdb_create(void *data); extern void ospf6_lsdb_delete(struct ospf6_lsdb *lsdb); -extern struct ospf6_lsa *ospf6_lsdb_lookup(u_int16_t type, u_int32_t id, - u_int32_t adv_router, +extern struct ospf6_lsa *ospf6_lsdb_lookup(uint16_t type, uint32_t id, + uint32_t adv_router, struct ospf6_lsdb *lsdb); -extern struct ospf6_lsa *ospf6_lsdb_lookup_next(u_int16_t type, u_int32_t id, - u_int32_t adv_router, +extern struct ospf6_lsa *ospf6_lsdb_lookup_next(uint16_t type, uint32_t id, + uint32_t adv_router, struct ospf6_lsdb *lsdb); extern void ospf6_lsdb_add(struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb); @@ -83,14 +83,14 @@ enum ospf_lsdb_show_level { }; extern void ospf6_lsdb_show(struct vty *vty, enum ospf_lsdb_show_level level, - u_int16_t *type, u_int32_t *id, - u_int32_t *adv_router, struct ospf6_lsdb *lsdb); + uint16_t *type, uint32_t *id, uint32_t *adv_router, + struct ospf6_lsdb *lsdb); -extern u_int32_t ospf6_new_ls_id(u_int16_t type, u_int32_t adv_router, - struct ospf6_lsdb *lsdb); -extern u_int32_t ospf6_new_ls_seqnum(u_int16_t type, u_int32_t id, - u_int32_t adv_router, - struct ospf6_lsdb *lsdb); +extern uint32_t ospf6_new_ls_id(uint16_t type, uint32_t adv_router, + struct ospf6_lsdb *lsdb); +extern uint32_t ospf6_new_ls_seqnum(uint16_t type, uint32_t id, + uint32_t adv_router, + struct ospf6_lsdb *lsdb); extern int ospf6_lsdb_maxage_remover(struct ospf6_lsdb *lsdb); #endif /* OSPF6_LSDB_H */ diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index f32cd6e7e..c608a0110 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -59,7 +59,7 @@ static const struct message ospf6_message_type_str[] = { /* Minimum (besides the standard OSPF packet header) lengths for OSPF packets of particular types, offset is the "type" field. */ -const u_int16_t ospf6_packet_minlen[OSPF6_MESSAGE_TYPE_ALL] = { +const uint16_t ospf6_packet_minlen[OSPF6_MESSAGE_TYPE_ALL] = { 0, OSPF6_HELLO_MIN_SIZE, OSPF6_DB_DESC_MIN_SIZE, @@ -69,7 +69,7 @@ const u_int16_t ospf6_packet_minlen[OSPF6_MESSAGE_TYPE_ALL] = { /* Minimum (besides the standard LSA header) lengths for LSAs of particular types, offset is the "LSA function code" portion of "LSA type" field. */ -const u_int16_t ospf6_lsa_minlen[OSPF6_LSTYPE_SIZE] = { +const uint16_t ospf6_lsa_minlen[OSPF6_LSTYPE_SIZE] = { 0, /* 0x2001 */ OSPF6_ROUTER_LSA_MIN_SIZE, /* 0x2002 */ OSPF6_NETWORK_LSA_MIN_SIZE, @@ -113,15 +113,15 @@ void ospf6_hello_print(struct ospf6_header *oh) ospf6_options_printbuf(hello->options, options, sizeof(options)); zlog_debug(" I/F-Id:%ld Priority:%d Option:%s", - (u_long)ntohl(hello->interface_id), hello->priority, + (unsigned long)ntohl(hello->interface_id), hello->priority, options); zlog_debug(" HelloInterval:%hu DeadInterval:%hu", ntohs(hello->hello_interval), ntohs(hello->dead_interval)); zlog_debug(" DR:%s BDR:%s", drouter, bdrouter); for (p = (char *)((caddr_t)hello + sizeof(struct ospf6_hello)); - p + sizeof(u_int32_t) <= OSPF6_MESSAGE_END(oh); - p += sizeof(u_int32_t)) { + p + sizeof(uint32_t) <= OSPF6_MESSAGE_END(oh); + p += sizeof(uint32_t)) { inet_ntop(AF_INET, (void *)p, neighbor, sizeof(neighbor)); zlog_debug(" Neighbor: %s", neighbor); } @@ -149,7 +149,7 @@ void ospf6_dbdesc_print(struct ospf6_header *oh) (CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_IBIT) ? "I" : "-"), (CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_MBIT) ? "M" : "-"), (CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_MSBIT) ? "m" : "s"), - (u_long)ntohl(dbdesc->seqnum)); + (unsigned long)ntohl(dbdesc->seqnum)); for (p = (char *)((caddr_t)dbdesc + sizeof(struct ospf6_dbdesc)); p + sizeof(struct ospf6_lsa_header) <= OSPF6_MESSAGE_END(oh); @@ -184,7 +184,7 @@ void ospf6_lsreq_print(struct ospf6_header *oh) void ospf6_lsupdate_print(struct ospf6_header *oh) { struct ospf6_lsupdate *lsupdate; - u_long num; + unsigned long num; char *p; ospf6_header_print(oh); @@ -278,9 +278,9 @@ static void ospf6_hello_recv(struct in6_addr *src, struct in6_addr *dst, /* TwoWay check */ for (p = (char *)((caddr_t)hello + sizeof(struct ospf6_hello)); - p + sizeof(u_int32_t) <= OSPF6_MESSAGE_END(oh); - p += sizeof(u_int32_t)) { - u_int32_t *router_id = (u_int32_t *)p; + p + sizeof(uint32_t) <= OSPF6_MESSAGE_END(oh); + p += sizeof(uint32_t)) { + uint32_t *router_id = (uint32_t *)p; if (*router_id == oi->area->ospf6->router_id) twoway++; @@ -429,7 +429,7 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh, if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) zlog_debug( "Sequence number mismatch (%#lx expected)", - (u_long)on->dbdesc_seqnum); + (unsigned long)on->dbdesc_seqnum); thread_add_event(master, seqnumber_mismatch, on, 0, NULL); return; @@ -647,7 +647,7 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh, if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) zlog_debug( "Sequence number mismatch (%#lx expected)", - (u_long)on->dbdesc_seqnum + 1); + (unsigned long)on->dbdesc_seqnum + 1); thread_add_event(master, seqnumber_mismatch, on, 0, NULL); return; @@ -873,12 +873,12 @@ static void ospf6_lsreq_recv(struct in6_addr *src, struct in6_addr *dst, static unsigned ospf6_prefixes_examin( struct ospf6_prefix *current, /* start of buffer */ unsigned length, - const u_int32_t req_num_pfxs /* always compared with the actual number + const uint32_t req_num_pfxs /* always compared with the actual number of prefixes */ - ) +) { - u_char requested_pfx_bytes; - u_int32_t real_num_pfxs = 0; + uint8_t requested_pfx_bytes; + uint32_t real_num_pfxs = 0; while (length) { if (length < OSPF6_PREFIX_MIN_SIZE) { @@ -929,15 +929,15 @@ static unsigned ospf6_prefixes_examin( LSA type in network byte order, uses in host byte order and passes to ospf6_lstype_name() in network byte order again. */ static unsigned ospf6_lsa_examin(struct ospf6_lsa_header *lsah, - const u_int16_t lsalen, - const u_char headeronly) + const uint16_t lsalen, + const uint8_t headeronly) { struct ospf6_intra_prefix_lsa *intra_prefix_lsa; struct ospf6_as_external_lsa *as_external_lsa; struct ospf6_link_lsa *link_lsa; unsigned exp_length; - u_int8_t ltindex; - u_int16_t lsatype; + uint8_t ltindex; + uint16_t lsatype; /* In case an additional minimum length constraint is defined for current @@ -1103,16 +1103,16 @@ static unsigned ospf6_lsa_examin(struct ospf6_lsa_header *lsah, of deeper-level checks. */ static unsigned ospf6_lsaseq_examin(struct ospf6_lsa_header *lsah, /* start of buffered data */ - size_t length, const u_char headeronly, + size_t length, const uint8_t headeronly, /* When declared_num_lsas is not 0, compare it to the real number of LSAs and treat the difference as an error. */ - const u_int32_t declared_num_lsas) + const uint32_t declared_num_lsas) { - u_int32_t counted_lsas = 0; + uint32_t counted_lsas = 0; while (length) { - u_int16_t lsalen; + uint16_t lsalen; if (length < OSPF6_LSA_HEADER_SIZE) { if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, RECV)) @@ -1490,13 +1490,13 @@ static void ospf6_lsack_recv(struct in6_addr *src, struct in6_addr *dst, assert(p == OSPF6_MESSAGE_END(oh)); } -static u_char *recvbuf = NULL; -static u_char *sendbuf = NULL; +static uint8_t *recvbuf = NULL; +static uint8_t *sendbuf = NULL; static unsigned int iobuflen = 0; int ospf6_iobuf_size(unsigned int size) { - u_char *recvnew, *sendnew; + uint8_t *recvnew, *sendnew; if (size <= iobuflen) return iobuflen; @@ -1728,7 +1728,7 @@ int ospf6_hello_send(struct thread *thread) struct ospf6_interface *oi; struct ospf6_header *oh; struct ospf6_hello *hello; - u_char *p; + uint8_t *p; struct listnode *node, *nnode; struct ospf6_neighbor *on; @@ -1767,13 +1767,13 @@ int ospf6_hello_send(struct thread *thread) hello->drouter = oi->drouter; hello->bdrouter = oi->bdrouter; - p = (u_char *)((caddr_t)hello + sizeof(struct ospf6_hello)); + p = (uint8_t *)((caddr_t)hello + sizeof(struct ospf6_hello)); for (ALL_LIST_ELEMENTS(oi->neighbor_list, node, nnode, on)) { if (on->state < OSPF6_NEIGHBOR_INIT) continue; - if (p - sendbuf + sizeof(u_int32_t) > ospf6_packet_max(oi)) { + if (p - sendbuf + sizeof(uint32_t) > ospf6_packet_max(oi)) { if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_HELLO, SEND)) zlog_debug( @@ -1781,8 +1781,8 @@ int ospf6_hello_send(struct thread *thread) break; } - memcpy(p, &on->router_id, sizeof(u_int32_t)); - p += sizeof(u_int32_t); + memcpy(p, &on->router_id, sizeof(uint32_t)); + p += sizeof(uint32_t); } oh->type = OSPF6_MESSAGE_TYPE_HELLO; @@ -1799,7 +1799,7 @@ int ospf6_dbdesc_send(struct thread *thread) struct ospf6_neighbor *on; struct ospf6_header *oh; struct ospf6_dbdesc *dbdesc; - u_char *p; + uint8_t *p; struct ospf6_lsa *lsa; struct in6_addr *dst; @@ -1839,7 +1839,7 @@ int ospf6_dbdesc_send(struct thread *thread) dbdesc->seqnum = htonl(on->dbdesc_seqnum); /* if this is not initial one, set LSA headers in dbdesc */ - p = (u_char *)((caddr_t)dbdesc + sizeof(struct ospf6_dbdesc)); + p = (uint8_t *)((caddr_t)dbdesc + sizeof(struct ospf6_dbdesc)); if (!CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT)) { for (ALL_LSDB(on->dbdesc_list, lsa)) { ospf6_lsa_age_update_to_send(lsa, @@ -1915,7 +1915,7 @@ int ospf6_lsreq_send(struct thread *thread) struct ospf6_neighbor *on; struct ospf6_header *oh; struct ospf6_lsreq_entry *e; - u_char *p; + uint8_t *p; struct ospf6_lsa *lsa, *last_req; on = (struct ospf6_neighbor *)THREAD_ARG(thread); @@ -1942,7 +1942,7 @@ int ospf6_lsreq_send(struct thread *thread) last_req = NULL; /* set Request entries in lsreq */ - p = (u_char *)((caddr_t)oh + sizeof(struct ospf6_header)); + p = (uint8_t *)((caddr_t)oh + sizeof(struct ospf6_header)); for (ALL_LSDB(on->request_list, lsa)) { /* MTU check */ if (p - sendbuf + sizeof(struct ospf6_lsreq_entry) @@ -2026,7 +2026,7 @@ int ospf6_lsupdate_send_neighbor(struct thread *thread) struct ospf6_neighbor *on; struct ospf6_header *oh; struct ospf6_lsupdate *lsupdate; - u_char *p; + uint8_t *p; int lsa_cnt; struct ospf6_lsa *lsa; @@ -2048,7 +2048,7 @@ int ospf6_lsupdate_send_neighbor(struct thread *thread) lsupdate = (struct ospf6_lsupdate *)((caddr_t)oh + sizeof(struct ospf6_header)); - p = (u_char *)((caddr_t)lsupdate + sizeof(struct ospf6_lsupdate)); + p = (uint8_t *)((caddr_t)lsupdate + sizeof(struct ospf6_lsupdate)); lsa_cnt = 0; /* lsupdate_list lists those LSA which doesn't need to be @@ -2071,8 +2071,9 @@ int ospf6_lsupdate_send_neighbor(struct thread *thread) + sizeof(struct ospf6_header)); - p = (u_char *)((caddr_t)lsupdate - + sizeof(struct ospf6_lsupdate)); + p = (uint8_t *)((caddr_t)lsupdate + + sizeof(struct + ospf6_lsupdate)); lsa_cnt = 0; } } @@ -2101,7 +2102,7 @@ int ospf6_lsupdate_send_neighbor(struct thread *thread) oh = (struct ospf6_header *)sendbuf; lsupdate = (struct ospf6_lsupdate *)((caddr_t)oh + sizeof(struct ospf6_header)); - p = (u_char *)((caddr_t)lsupdate + sizeof(struct ospf6_lsupdate)); + p = (uint8_t *)((caddr_t)lsupdate + sizeof(struct ospf6_lsupdate)); lsa_cnt = 0; for (ALL_LSDB(on->retrans_list, lsa)) { @@ -2130,8 +2131,9 @@ int ospf6_lsupdate_send_neighbor(struct thread *thread) *)((caddr_t)oh + sizeof(struct ospf6_header)); - p = (u_char *)((caddr_t)lsupdate - + sizeof(struct ospf6_lsupdate)); + p = (uint8_t *)((caddr_t)lsupdate + + sizeof(struct + ospf6_lsupdate)); lsa_cnt = 0; } } @@ -2173,7 +2175,7 @@ int ospf6_lsupdate_send_neighbor_now(struct ospf6_neighbor *on, { struct ospf6_header *oh; struct ospf6_lsupdate *lsupdate; - u_char *p; + uint8_t *p; int lsa_cnt = 0; memset(sendbuf, 0, iobuflen); @@ -2181,7 +2183,7 @@ int ospf6_lsupdate_send_neighbor_now(struct ospf6_neighbor *on, lsupdate = (struct ospf6_lsupdate *)((caddr_t)oh + sizeof(struct ospf6_header)); - p = (u_char *)((caddr_t)lsupdate + sizeof(struct ospf6_lsupdate)); + p = (uint8_t *)((caddr_t)lsupdate + sizeof(struct ospf6_lsupdate)); ospf6_lsa_age_update_to_send(lsa, on->ospf6_if->transdelay); memcpy(p, lsa->header, OSPF6_LSA_SIZE(lsa->header)); p += OSPF6_LSA_SIZE(lsa->header); @@ -2207,7 +2209,7 @@ int ospf6_lsupdate_send_interface(struct thread *thread) struct ospf6_interface *oi; struct ospf6_header *oh; struct ospf6_lsupdate *lsupdate; - u_char *p; + uint8_t *p; int lsa_cnt; struct ospf6_lsa *lsa; @@ -2232,7 +2234,7 @@ int ospf6_lsupdate_send_interface(struct thread *thread) lsupdate = (struct ospf6_lsupdate *)((caddr_t)oh + sizeof(struct ospf6_header)); - p = (u_char *)((caddr_t)lsupdate + sizeof(struct ospf6_lsupdate)); + p = (uint8_t *)((caddr_t)lsupdate + sizeof(struct ospf6_lsupdate)); lsa_cnt = 0; for (ALL_LSDB(oi->lsupdate_list, lsa)) { @@ -2258,8 +2260,9 @@ int ospf6_lsupdate_send_interface(struct thread *thread) + sizeof(struct ospf6_header)); - p = (u_char *)((caddr_t)lsupdate - + sizeof(struct ospf6_lsupdate)); + p = (uint8_t *)((caddr_t)lsupdate + + sizeof(struct + ospf6_lsupdate)); lsa_cnt = 0; } } @@ -2294,7 +2297,7 @@ int ospf6_lsack_send_neighbor(struct thread *thread) { struct ospf6_neighbor *on; struct ospf6_header *oh; - u_char *p; + uint8_t *p; struct ospf6_lsa *lsa; int lsa_cnt = 0; @@ -2316,7 +2319,7 @@ int ospf6_lsack_send_neighbor(struct thread *thread) memset(sendbuf, 0, iobuflen); oh = (struct ospf6_header *)sendbuf; - p = (u_char *)((caddr_t)oh + sizeof(struct ospf6_header)); + p = (uint8_t *)((caddr_t)oh + sizeof(struct ospf6_header)); for (ALL_LSDB(on->lsack_list, lsa)) { /* MTU check */ @@ -2336,8 +2339,8 @@ int ospf6_lsack_send_neighbor(struct thread *thread) memset(sendbuf, 0, iobuflen); oh = (struct ospf6_header *)sendbuf; - p = (u_char *)((caddr_t)oh - + sizeof(struct ospf6_header)); + p = (uint8_t *)((caddr_t)oh + + sizeof(struct ospf6_header)); lsa_cnt = 0; } } @@ -2372,7 +2375,7 @@ int ospf6_lsack_send_interface(struct thread *thread) { struct ospf6_interface *oi; struct ospf6_header *oh; - u_char *p; + uint8_t *p; struct ospf6_lsa *lsa; int lsa_cnt = 0; @@ -2395,7 +2398,7 @@ int ospf6_lsack_send_interface(struct thread *thread) memset(sendbuf, 0, iobuflen); oh = (struct ospf6_header *)sendbuf; - p = (u_char *)((caddr_t)oh + sizeof(struct ospf6_header)); + p = (uint8_t *)((caddr_t)oh + sizeof(struct ospf6_header)); for (ALL_LSDB(oi->lsack_list, lsa)) { /* MTU check */ diff --git a/ospf6d/ospf6_message.h b/ospf6d/ospf6_message.h index d867bd025..d24b7f894 100644 --- a/ospf6d/ospf6_message.h +++ b/ospf6d/ospf6_message.h @@ -46,14 +46,14 @@ extern unsigned char conf_debug_ospf6_message[]; /* OSPFv3 packet header */ #define OSPF6_HEADER_SIZE 16U struct ospf6_header { - u_char version; - u_char type; - u_int16_t length; - u_int32_t router_id; - u_int32_t area_id; - u_int16_t checksum; - u_char instance_id; - u_char reserved; + uint8_t version; + uint8_t type; + uint16_t length; + uint32_t router_id; + uint32_t area_id; + uint16_t checksum; + uint8_t instance_id; + uint8_t reserved; }; #define OSPF6_MESSAGE_END(H) ((caddr_t) (H) + ntohs ((H)->length)) @@ -62,24 +62,24 @@ struct ospf6_header { #define OSPF6_HELLO_MIN_SIZE 20U struct ospf6_hello { ifindex_t interface_id; - u_char priority; - u_char options[3]; - u_int16_t hello_interval; - u_int16_t dead_interval; - u_int32_t drouter; - u_int32_t bdrouter; + uint8_t priority; + uint8_t options[3]; + uint16_t hello_interval; + uint16_t dead_interval; + uint32_t drouter; + uint32_t bdrouter; /* Followed by Router-IDs */ }; /* Database Description */ #define OSPF6_DB_DESC_MIN_SIZE 12U struct ospf6_dbdesc { - u_char reserved1; - u_char options[3]; - u_int16_t ifmtu; - u_char reserved2; - u_char bits; - u_int32_t seqnum; + uint8_t reserved1; + uint8_t options[3]; + uint16_t ifmtu; + uint8_t reserved2; + uint8_t bits; + uint32_t seqnum; /* Followed by LSA Headers */ }; @@ -92,16 +92,16 @@ struct ospf6_dbdesc { /* It is just a sequence of entries below */ #define OSPF6_LSREQ_LSDESC_FIX_SIZE 12U struct ospf6_lsreq_entry { - u_int16_t reserved; /* Must Be Zero */ - u_int16_t type; /* LS type */ - u_int32_t id; /* Link State ID */ - u_int32_t adv_router; /* Advertising Router */ + uint16_t reserved; /* Must Be Zero */ + uint16_t type; /* LS type */ + uint32_t id; /* Link State ID */ + uint32_t adv_router; /* Advertising Router */ }; /* Link State Update */ #define OSPF6_LS_UPD_MIN_SIZE 4U struct ospf6_lsupdate { - u_int32_t lsa_number; + uint32_t lsa_number; /* Followed by LSAs */ }; diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index 16bf2fd8e..6455f606b 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -62,7 +62,7 @@ int ospf6_neighbor_cmp(void *va, void *vb) return (ntohl(ona->router_id) < ntohl(onb->router_id) ? -1 : 1); } -struct ospf6_neighbor *ospf6_neighbor_lookup(u_int32_t router_id, +struct ospf6_neighbor *ospf6_neighbor_lookup(uint32_t router_id, struct ospf6_interface *oi) { struct listnode *n; @@ -76,7 +76,7 @@ struct ospf6_neighbor *ospf6_neighbor_lookup(u_int32_t router_id, } /* create ospf6_neighbor */ -struct ospf6_neighbor *ospf6_neighbor_create(u_int32_t router_id, +struct ospf6_neighbor *ospf6_neighbor_create(uint32_t router_id, struct ospf6_interface *oi) { struct ospf6_neighbor *on; @@ -147,10 +147,10 @@ void ospf6_neighbor_delete(struct ospf6_neighbor *on) XFREE(MTYPE_OSPF6_NEIGHBOR, on); } -static void ospf6_neighbor_state_change(u_char next_state, +static void ospf6_neighbor_state_change(uint8_t next_state, struct ospf6_neighbor *on, int event) { - u_char prev_state; + uint8_t prev_state; prev_state = on->state; on->state = next_state; @@ -708,7 +708,7 @@ static void ospf6_neighbor_show_detail(struct vty *vty, (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MBIT) ? "More " : ""), (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MSBIT) ? "Master" : "Slave"), - (u_long)ntohl(on->dbdesc_seqnum)); + (unsigned long)ntohl(on->dbdesc_seqnum)); vty_out(vty, " Summary-List: %d LSAs\n", on->summary_list->count); for (ALL_LSDB(on->summary_list, lsa)) @@ -826,7 +826,7 @@ DEFUN (show_ipv6_ospf6_neighbor_one, struct ospf6_area *oa; struct listnode *i, *j, *k; void (*showfunc)(struct vty *, struct ospf6_neighbor *); - u_int32_t router_id; + uint32_t router_id; OSPF6_CMD_CHECK_RUNNING(); showfunc = ospf6_neighbor_show_detail; @@ -909,7 +909,7 @@ DEFUN (no_debug_ospf6, DEBUG_STR OSPF6_STR) { - u_int i; + unsigned int i; struct ospf6_lsa_handler *handler = NULL; OSPF6_DEBUG_ABR_OFF(); diff --git a/ospf6d/ospf6_neighbor.h b/ospf6d/ospf6_neighbor.h index 529f586f1..0c4926edb 100644 --- a/ospf6d/ospf6_neighbor.h +++ b/ospf6d/ospf6_neighbor.h @@ -41,25 +41,25 @@ struct ospf6_neighbor { struct ospf6_interface *ospf6_if; /* Neighbor state */ - u_char state; + uint8_t state; /* timestamp of last changing state */ - u_int32_t state_change; + uint32_t state_change; struct timeval last_changed; /* Neighbor Router ID */ - u_int32_t router_id; + uint32_t router_id; /* Neighbor Interface ID */ ifindex_t ifindex; /* Router Priority of this neighbor */ - u_char priority; + uint8_t priority; - u_int32_t drouter; - u_int32_t bdrouter; - u_int32_t prev_drouter; - u_int32_t prev_bdrouter; + uint32_t drouter; + uint32_t bdrouter; + uint32_t prev_drouter; + uint32_t prev_bdrouter; /* Options field (Capability) */ char options[3]; @@ -68,8 +68,8 @@ struct ospf6_neighbor { struct in6_addr linklocal_addr; /* For Database Exchange */ - u_char dbdesc_bits; - u_int32_t dbdesc_seqnum; + uint8_t dbdesc_bits; + uint32_t dbdesc_seqnum; /* Last received Database Description packet */ struct ospf6_dbdesc dbdesc_last; @@ -145,9 +145,9 @@ extern const char *ospf6_neighbor_state_str[]; int ospf6_neighbor_cmp(void *va, void *vb); void ospf6_neighbor_dbex_init(struct ospf6_neighbor *on); -struct ospf6_neighbor *ospf6_neighbor_lookup(u_int32_t, +struct ospf6_neighbor *ospf6_neighbor_lookup(uint32_t, struct ospf6_interface *); -struct ospf6_neighbor *ospf6_neighbor_create(u_int32_t, +struct ospf6_neighbor *ospf6_neighbor_create(uint32_t, struct ospf6_interface *); void ospf6_neighbor_delete(struct ospf6_neighbor *); diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c index 9f81bb89f..4790d8f01 100644 --- a/ospf6d/ospf6_network.c +++ b/ospf6d/ospf6_network.c @@ -38,9 +38,9 @@ struct in6_addr alldrouters6; /* setsockopt MulticastLoop to off */ static void ospf6_reset_mcastloop(void) { - u_int off = 0; + unsigned int off = 0; if (setsockopt(ospf6_sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &off, - sizeof(u_int)) + sizeof(unsigned int)) < 0) zlog_warn("Network: reset IPV6_MULTICAST_LOOP failed: %s", safe_strerror(errno)); @@ -156,7 +156,7 @@ int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst, struct cmsghdr *scmsgp; union { struct cmsghdr hdr; - u_char buf[CMSG_SPACE(sizeof(struct in6_pktinfo))]; + uint8_t buf[CMSG_SPACE(sizeof(struct in6_pktinfo))]; } cmsgbuf; struct in6_pktinfo *pktinfo; struct sockaddr_in6 dst_sin6; @@ -212,7 +212,7 @@ int ospf6_recvmsg(struct in6_addr *src, struct in6_addr *dst, int retval; struct msghdr rmsghdr; struct cmsghdr *rcmsgp; - u_char cmsgbuf[CMSG_SPACE(sizeof(struct in6_pktinfo))]; + uint8_t cmsgbuf[CMSG_SPACE(sizeof(struct in6_pktinfo))]; struct in6_pktinfo *pktinfo; struct sockaddr_in6 src_sin6; diff --git a/ospf6d/ospf6_proto.c b/ospf6d/ospf6_proto.c index d0ab67655..4b56a64b7 100644 --- a/ospf6d/ospf6_proto.c +++ b/ospf6d/ospf6_proto.c @@ -26,10 +26,10 @@ void ospf6_prefix_apply_mask(struct ospf6_prefix *op) { - u_char *pnt, mask; + uint8_t *pnt, mask; int index, offset; - pnt = (u_char *)((caddr_t)op + sizeof(struct ospf6_prefix)); + pnt = (uint8_t *)((caddr_t)op + sizeof(struct ospf6_prefix)); index = op->prefix_length / 8; offset = op->prefix_length % 8; mask = 0xff << (8 - offset); @@ -48,7 +48,7 @@ void ospf6_prefix_apply_mask(struct ospf6_prefix *op) pnt[index++] = 0; } -void ospf6_prefix_options_printbuf(u_int8_t prefix_options, char *buf, int size) +void ospf6_prefix_options_printbuf(uint8_t prefix_options, char *buf, int size) { snprintf(buf, size, "xxx"); } @@ -63,7 +63,7 @@ void ospf6_capability_printbuf(char capability, char *buf, int size) snprintf(buf, size, "----%c%c%c%c", w, v, e, b); } -void ospf6_options_printbuf(u_char *options, char *buf, int size) +void ospf6_options_printbuf(uint8_t *options, char *buf, int size) { const char *dc, *r, *n, *mc, *e, *v6; dc = (OSPF6_OPT_ISSET(options, OSPF6_OPT_DC) ? "DC" : "--"); diff --git a/ospf6d/ospf6_proto.h b/ospf6d/ospf6_proto.h index 591919085..ca2804c47 100644 --- a/ospf6d/ospf6_proto.h +++ b/ospf6d/ospf6_proto.h @@ -53,11 +53,11 @@ /* OSPF6 Prefix */ #define OSPF6_PREFIX_MIN_SIZE 4U /* .length == 0 */ struct ospf6_prefix { - u_int8_t prefix_length; - u_int8_t prefix_options; + uint8_t prefix_length; + uint8_t prefix_options; union { - u_int16_t _prefix_metric; - u_int16_t _prefix_referenced_lstype; + uint16_t _prefix_metric; + uint16_t _prefix_referenced_lstype; } u; #define prefix_metric u._prefix_metric #define prefix_refer_lstype u._prefix_referenced_lstype @@ -92,9 +92,9 @@ struct ospf6_prefix { } while (0) extern void ospf6_prefix_apply_mask(struct ospf6_prefix *op); -extern void ospf6_prefix_options_printbuf(u_int8_t prefix_options, char *buf, +extern void ospf6_prefix_options_printbuf(uint8_t prefix_options, char *buf, int size); extern void ospf6_capability_printbuf(char capability, char *buf, int size); -extern void ospf6_options_printbuf(u_char *options, char *buf, int size); +extern void ospf6_options_printbuf(uint8_t *options, char *buf, int size); #endif /* OSPF6_PROTO_H */ diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index 87f3f6edc..4d436792d 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -122,7 +122,7 @@ static char *ospf6_route_table_name(struct ospf6_route_table *table) return name; } -void ospf6_linkstate_prefix(u_int32_t adv_router, u_int32_t id, +void ospf6_linkstate_prefix(uint32_t adv_router, uint32_t id, struct prefix *prefix) { memset(prefix, 0, sizeof(struct prefix)); @@ -134,7 +134,7 @@ void ospf6_linkstate_prefix(u_int32_t adv_router, u_int32_t id, void ospf6_linkstate_prefix2str(struct prefix *prefix, char *buf, int size) { - u_int32_t adv_router, id; + uint32_t adv_router, id; char adv_router_str[16], id_str[16]; memcpy(&adv_router, &prefix->u.prefix6.s6_addr[0], 4); memcpy(&id, &prefix->u.prefix6.s6_addr[4], 4); @@ -1245,7 +1245,7 @@ static void ospf6_route_show_table_match(struct vty *vty, int detail, } static void ospf6_route_show_table_type(struct vty *vty, int detail, - u_char type, + uint8_t type, struct ospf6_route_table *table) { struct ospf6_route *route; @@ -1288,7 +1288,7 @@ int ospf6_route_table_show(struct vty *vty, int argc_start, int argc, int isprefix = 0; int i, ret; struct prefix prefix; - u_char type = 0; + uint8_t type = 0; memset(&prefix, 0, sizeof(struct prefix)); @@ -1375,7 +1375,7 @@ static void ospf6_linkstate_show_header(struct vty *vty) static void ospf6_linkstate_show(struct vty *vty, struct ospf6_route *route) { - u_int32_t router, id; + uint32_t router, id; char routername[16], idname[16], rbits[16], options[16]; router = ospf6_linkstate_prefix_adv_router(&route->prefix); @@ -1501,7 +1501,7 @@ void ospf6_brouter_show_header(struct vty *vty) void ospf6_brouter_show(struct vty *vty, struct ospf6_route *route) { - u_int32_t adv_router; + uint32_t adv_router; char adv[16], rbits[16], options[16], area[16]; adv_router = ospf6_linkstate_prefix_adv_router(&route->prefix); diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h index b759828c3..7ad1f19fc 100644 --- a/ospf6d/ospf6_route.h +++ b/ospf6d/ospf6_route.h @@ -63,9 +63,9 @@ struct ospf6_nexthop { /* Path */ struct ospf6_ls_origin { - u_int16_t type; - u_int32_t id; - u_int32_t adv_router; + uint16_t type; + uint32_t id; + uint32_t adv_router; }; struct ospf6_path { @@ -73,29 +73,29 @@ struct ospf6_path { struct ospf6_ls_origin origin; /* Router bits */ - u_char router_bits; + uint8_t router_bits; /* Optional Capabilities */ - u_char options[3]; + uint8_t options[3]; /* Prefix Options */ - u_char prefix_options; + uint8_t prefix_options; /* Associated Area */ - u_int32_t area_id; + uint32_t area_id; /* Path-type */ - u_char type; - u_char subtype; /* only used for redistribute i.e ZEBRA_ROUTE_XXX */ + uint8_t type; + uint8_t subtype; /* only used for redistribute i.e ZEBRA_ROUTE_XXX */ /* Cost */ - u_int8_t metric_type; - u_int32_t cost; + uint8_t metric_type; + uint32_t cost; union { - u_int32_t cost_e2; - u_int32_t cost_config; + uint32_t cost_e2; + uint32_t cost_config; } u; - u_int32_t tag; + uint32_t tag; /* nh list for this path */ struct list *nh_list; @@ -126,7 +126,7 @@ struct ospf6_route { unsigned int lock; /* Destination Type */ - u_char type; + uint8_t type; /* XXX: It would likely be better to use separate struct in_addr's * for the advertising router-ID and prefix IDs, instead of stuffing @@ -141,13 +141,13 @@ struct ospf6_route { struct timeval changed; /* flag */ - u_char flag; + uint8_t flag; /* route option */ void *route_option; /* link state id for advertising */ - u_int32_t linkstate_id; + uint32_t linkstate_id; /* path */ struct ospf6_path path; @@ -184,7 +184,7 @@ struct ospf6_route_table { /* patricia tree */ struct route_table *table; - u_int32_t count; + uint32_t count; bitfield_t idspace; @@ -256,7 +256,7 @@ extern const char *ospf6_path_type_substr[OSPF6_PATH_TYPE_MAX]; #define ADV_ROUTER_IN_PREFIX(x) ((x)->u.lp.id.s_addr) /* Function prototype */ -extern void ospf6_linkstate_prefix(u_int32_t adv_router, u_int32_t id, +extern void ospf6_linkstate_prefix(uint32_t adv_router, uint32_t id, struct prefix *prefix); extern void ospf6_linkstate_prefix2str(struct prefix *prefix, char *buf, int size); diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c index ed1d8bee7..376950e84 100644 --- a/ospf6d/ospf6_snmp.c +++ b/ospf6d/ospf6_snmp.c @@ -209,16 +209,16 @@ static oid ospfv3_oid[] = {OSPFv3MIB}; static oid ospfv3_trap_oid[] = {OSPFv3MIB, 0}; /* Hook functions. */ -static u_char *ospfv3GeneralGroup(struct variable *, oid *, size_t *, int, +static uint8_t *ospfv3GeneralGroup(struct variable *, oid *, size_t *, int, + size_t *, WriteMethod **); +static uint8_t *ospfv3AreaEntry(struct variable *, oid *, size_t *, int, + size_t *, WriteMethod **); +static uint8_t *ospfv3WwLsdbEntry(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **); -static u_char *ospfv3AreaEntry(struct variable *, oid *, size_t *, int, +static uint8_t *ospfv3NbrEntry(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **); -static u_char *ospfv3WwLsdbEntry(struct variable *, oid *, size_t *, int, - size_t *, WriteMethod **); -static u_char *ospfv3NbrEntry(struct variable *, oid *, size_t *, int, size_t *, +static uint8_t *ospfv3IfEntry(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **); -static u_char *ospfv3IfEntry(struct variable *, oid *, size_t *, int, size_t *, - WriteMethod **); static struct variable ospfv3_variables[] = { /* OSPF general variables */ @@ -631,12 +631,12 @@ static struct variable ospfv3_variables[] = { {1, 9, 1, 15}}, }; -static u_char *ospfv3GeneralGroup(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfv3GeneralGroup(struct variable *v, oid *name, + size_t *length, int exact, size_t *var_len, + WriteMethod **write_method) { - u_int16_t sum; - u_int32_t count; + uint16_t sum; + uint32_t count; struct ospf6_lsa *lsa = NULL; /* Check whether the instance identifier is valid */ @@ -728,15 +728,15 @@ static u_char *ospfv3GeneralGroup(struct variable *v, oid *name, size_t *length, return NULL; } -static u_char *ospfv3AreaEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfv3AreaEntry(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct ospf6_area *oa, *area = NULL; struct ospf6_lsa *lsa = NULL; - u_int32_t area_id = 0; - u_int32_t count; - u_int16_t sum; + uint32_t area_id = 0; + uint32_t count; + uint16_t sum; struct listnode *node; unsigned int len; char a[16]; @@ -758,7 +758,7 @@ static u_char *ospfv3AreaEntry(struct variable *v, oid *name, size_t *length, inet_ntop(AF_INET, &area_id, a, sizeof(a)); zlog_debug("SNMP access by area: %s, exact=%d len=%d length=%lu", a, - exact, len, (u_long)*length); + exact, len, (unsigned long)*length); for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) { if (area == NULL) { @@ -779,7 +779,7 @@ static u_char *ospfv3AreaEntry(struct variable *v, oid *name, size_t *length, inet_ntop(AF_INET, &area->area_id, a, sizeof(a)); zlog_debug("SNMP found area: %s, exact=%d len=%d length=%lu", a, exact, - len, (u_long)*length); + len, (unsigned long)*length); switch (v->magic) { case OSPFv3IMPORTASEXTERN: @@ -833,15 +833,15 @@ static int if_icmp_func(struct interface *ifp1, struct interface *ifp2) return (ifp1->ifindex - ifp2->ifindex); } -static u_char *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); struct ospf6_lsa *lsa = NULL; ifindex_t ifindex; uint32_t area_id, id, instid, adv_router; - u_int16_t type; + uint16_t type; int len; oid *offset; int offsetlen; @@ -1027,7 +1027,7 @@ static u_char *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length, break; case OSPFv3WWLSDBADVERTISEMENT: *var_len = ntohs(lsa->header->length); - return (u_char *)lsa->header; + return (uint8_t *)lsa->header; break; case OSPFv3WWLSDBTYPEKNOWN: return SNMP_INTEGER(OSPF6_LSA_IS_KNOWN(lsa->header->type) @@ -1038,9 +1038,9 @@ static u_char *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length, return NULL; } -static u_char *ospfv3IfEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfv3IfEntry(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); ifindex_t ifindex = 0; @@ -1052,7 +1052,7 @@ static u_char *ospfv3IfEntry(struct variable *v, oid *name, size_t *length, struct list *ifslist; oid *offset; int offsetlen, len; - u_int32_t sum; + uint32_t sum; if (smux_header_table(v, name, length, exact, var_len, write_method) == MATCH_FAILED) @@ -1191,9 +1191,9 @@ static u_char *ospfv3IfEntry(struct variable *v, oid *name, size_t *length, return NULL; } -static u_char *ospfv3NbrEntry(struct variable *v, oid *name, size_t *length, - int exact, size_t *var_len, - WriteMethod **write_method) +static uint8_t *ospfv3NbrEntry(struct variable *v, oid *name, size_t *length, + int exact, size_t *var_len, + WriteMethod **write_method) { struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); ifindex_t ifindex = 0; @@ -1301,7 +1301,7 @@ static u_char *ospfv3NbrEntry(struct variable *v, oid *name, size_t *length, return SNMP_INTEGER(2); /* IPv6 only */ case OSPFv3NBRADDRESS: *var_len = sizeof(struct in6_addr); - return (u_char *)&on->linklocal_addr; + return (uint8_t *)&on->linklocal_addr; case OSPFv3NBROPTIONS: return SNMP_INTEGER(on->options[2]); case OSPFv3NBRPRIORITY: diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index 8d32f3505..28c345982 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -139,10 +139,10 @@ static struct ospf6_vertex *ospf6_vertex_create(struct ospf6_lsa *lsa) v->lsa = lsa; /* capability bits + options */ - v->capability = *(u_char *)(OSPF6_LSA_HEADER_END(lsa->header)); - v->options[0] = *(u_char *)(OSPF6_LSA_HEADER_END(lsa->header) + 1); - v->options[1] = *(u_char *)(OSPF6_LSA_HEADER_END(lsa->header) + 2); - v->options[2] = *(u_char *)(OSPF6_LSA_HEADER_END(lsa->header) + 3); + v->capability = *(uint8_t *)(OSPF6_LSA_HEADER_END(lsa->header)); + v->options[0] = *(uint8_t *)(OSPF6_LSA_HEADER_END(lsa->header) + 1); + v->options[1] = *(uint8_t *)(OSPF6_LSA_HEADER_END(lsa->header) + 2); + v->options[2] = *(uint8_t *)(OSPF6_LSA_HEADER_END(lsa->header) + 3); v->nh_list = list_new(); v->nh_list->cmp = (int (*)(void *, void *))ospf6_nexthop_cmp; @@ -166,8 +166,8 @@ static struct ospf6_lsa *ospf6_lsdesc_lsa(caddr_t lsdesc, struct ospf6_vertex *v) { struct ospf6_lsa *lsa = NULL; - u_int16_t type = 0; - u_int32_t id = 0, adv_router = 0; + uint16_t type = 0; + uint32_t id = 0, adv_router = 0; if (VERTEX_IS_TYPE(NETWORK, v)) { type = htons(OSPF6_LSTYPE_ROUTER); @@ -262,8 +262,8 @@ static void ospf6_nexthop_calc(struct ospf6_vertex *w, struct ospf6_vertex *v, int i; ifindex_t ifindex; struct ospf6_interface *oi; - u_int16_t type; - u_int32_t adv_router; + uint16_t type; + uint32_t adv_router; struct ospf6_lsa *lsa; struct ospf6_link_lsa *link_lsa; char buf[64]; @@ -456,7 +456,7 @@ void ospf6_spf_reason_string(unsigned int reason, char *buf, int size) /* RFC2328 16.1. Calculating the shortest-path tree for an area */ /* RFC2740 3.8.1. Calculating the shortest path tree for an area */ -void ospf6_spf_calculation(u_int32_t router_id, +void ospf6_spf_calculation(uint32_t router_id, struct ospf6_route_table *result_table, struct ospf6_area *oa) { @@ -966,7 +966,7 @@ struct ospf6_lsa *ospf6_create_single_router_lsa(struct ospf6_area *area, uint8_t *new_header = NULL; const struct route_node *end = NULL; uint16_t lsa_length, total_lsa_length = 0, num_lsa = 0; - u_int16_t type = 0; + uint16_t type = 0; char ifbuf[16]; uint32_t interface_id; caddr_t lsd; diff --git a/ospf6d/ospf6_spf.h b/ospf6d/ospf6_spf.h index f294b8d34..da95ec80a 100644 --- a/ospf6d/ospf6_spf.h +++ b/ospf6d/ospf6_spf.h @@ -36,7 +36,7 @@ extern unsigned char conf_debug_ospf6_spf; /* Transit Vertex */ struct ospf6_vertex { /* type of this vertex */ - u_int8_t type; + uint8_t type; /* Vertex Identifier */ struct prefix vertex_id; @@ -51,16 +51,16 @@ struct ospf6_vertex { struct ospf6_lsa *lsa; /* Distance from Root (i.e. Cost) */ - u_int32_t cost; + uint32_t cost; /* Router hops to this node */ - u_char hops; + uint8_t hops; /* capability bits */ - u_char capability; + uint8_t capability; /* Optional capabilities */ - u_char options[3]; + uint8_t options[3]; /* For tree display */ struct ospf6_vertex *parent; @@ -136,7 +136,7 @@ static inline unsigned int ospf6_lsremove_to_spf_reason(struct ospf6_lsa *lsa) } extern void ospf6_spf_table_finish(struct ospf6_route_table *result_table); -extern void ospf6_spf_calculation(u_int32_t router_id, +extern void ospf6_spf_calculation(uint32_t router_id, struct ospf6_route_table *result_table, struct ospf6_area *oa); extern void ospf6_spf_schedule(struct ospf6 *ospf, unsigned int reason); diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 630b717fb..3f1b30b9e 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -365,7 +365,7 @@ DEFUN(ospf6_router_id, int idx = 0; int ret; const char *router_id_str; - u_int32_t router_id; + uint32_t router_id; struct ospf6_area *oa; struct listnode *node; @@ -663,7 +663,7 @@ DEFUN (ospf6_interface_area, struct ospf6_area *oa; struct ospf6_interface *oi; struct interface *ifp; - u_int32_t area_id; + uint32_t area_id; /* find/create ospf6 interface */ ifp = if_get_by_name(argv[idx_ifname]->arg, VRF_DEFAULT, 0); @@ -722,7 +722,7 @@ DEFUN (no_ospf6_interface_area, struct ospf6_interface *oi; struct ospf6_area *oa; struct interface *ifp; - u_int32_t area_id; + uint32_t area_id; ifp = if_lookup_by_name(argv[idx_ifname]->arg, VRF_DEFAULT); if (ifp == NULL) { diff --git a/ospf6d/ospf6_top.h b/ospf6d/ospf6_top.h index 3ffcad056..381027dcf 100644 --- a/ospf6d/ospf6_top.h +++ b/ospf6d/ospf6_top.h @@ -32,10 +32,10 @@ struct ospf6_master { /* OSPFv3 top level data structure */ struct ospf6 { /* my router id */ - u_int32_t router_id; + uint32_t router_id; /* static router id */ - u_int32_t router_id_static; + uint32_t router_id_static; struct in_addr router_id_zebra; @@ -55,7 +55,7 @@ struct ospf6 { struct ospf6_route_table *external_table; struct route_table *external_id_table; - u_int32_t external_id; + uint32_t external_id; /* redistribute route-map */ struct { @@ -63,10 +63,10 @@ struct ospf6 { struct route_map *map; } rmap[ZEBRA_ROUTE_MAX]; - u_char flag; + uint8_t flag; /* Configured flags */ - u_char config_flags; + uint8_t config_flags; #define OSPF6_LOG_ADJACENCY_CHANGES (1 << 0) #define OSPF6_LOG_ADJACENCY_DETAIL (1 << 1) @@ -91,13 +91,13 @@ struct ospf6 { struct thread *maxage_remover; struct thread *t_distribute_update; /* Distirbute update timer. */ - u_int32_t ref_bandwidth; + uint32_t ref_bandwidth; /* Distance parameters */ - u_char distance_all; - u_char distance_intra; - u_char distance_inter; - u_char distance_external; + uint8_t distance_all; + uint8_t distance_intra; + uint8_t distance_inter; + uint8_t distance_external; struct route_table *distance_table; diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index 0decc09a2..8c2e706d1 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -468,7 +468,7 @@ int ospf6_distance_set(struct vty *vty, struct ospf6 *o, { int ret; struct prefix_ipv6 p; - u_char distance; + uint8_t distance; struct route_node *rn; struct ospf6_distance *odistance; @@ -553,7 +553,7 @@ void ospf6_distance_reset(struct ospf6 *o) } } -u_char ospf6_distance_apply(struct prefix_ipv6 *p, struct ospf6_route * or) +uint8_t ospf6_distance_apply(struct prefix_ipv6 *p, struct ospf6_route * or) { struct ospf6 *o; diff --git a/ospf6d/ospf6_zebra.h b/ospf6d/ospf6_zebra.h index 8ab999336..e2f778fa7 100644 --- a/ospf6d/ospf6_zebra.h +++ b/ospf6d/ospf6_zebra.h @@ -34,7 +34,7 @@ extern unsigned char conf_debug_ospf6_zebra; /* OSPF6 distance */ struct ospf6_distance { /* Distance value for the IP source prefix */ - u_char distance; + uint8_t distance; /* Name of the access-list to be matched */ char *access_list; @@ -55,7 +55,7 @@ extern void ospf6_zebra_delete_discard(struct ospf6_route *request); struct ospf6; extern void ospf6_distance_reset(struct ospf6 *); -extern u_char ospf6_distance_apply(struct prefix_ipv6 *, struct ospf6_route *); +extern uint8_t ospf6_distance_apply(struct prefix_ipv6 *, struct ospf6_route *); extern int ospf6_distance_set(struct vty *, struct ospf6 *, const char *, const char *, const char *); diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index 58a39156d..8d6d5b4a2 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -126,9 +126,9 @@ static int parse_show_level(int idx_level, int argc, struct cmd_token **argv) return level; } -static u_int16_t parse_type_spec(int idx_lsa, int argc, struct cmd_token **argv) +static uint16_t parse_type_spec(int idx_lsa, int argc, struct cmd_token **argv) { - u_int16_t type = 0; + uint16_t type = 0; if (argc > idx_lsa) { if (strmatch(argv[idx_lsa]->text, "router")) @@ -220,7 +220,7 @@ DEFUN (show_ipv6_ospf6_database_type, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; + uint16_t type = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -282,7 +282,7 @@ DEFUN (show_ipv6_ospf6_database_id, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int32_t id = 0; + uint32_t id = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -333,7 +333,7 @@ DEFUN (show_ipv6_ospf6_database_router, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int32_t adv_router = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router); @@ -434,8 +434,8 @@ DEFUN (show_ipv6_ospf6_database_type_id, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t id = 0; + uint16_t type = 0; + uint32_t id = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -508,8 +508,8 @@ DEFUN (show_ipv6_ospf6_database_type_router, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t adv_router = 0; + uint16_t type = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -575,8 +575,8 @@ DEFUN (show_ipv6_ospf6_database_id_router, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int32_t id = 0; - u_int32_t adv_router = 0; + uint32_t id = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); inet_pton(AF_INET, argv[idx_ls_id]->arg, &id); @@ -628,8 +628,8 @@ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int32_t id = 0; - u_int32_t adv_router = 0; + uint32_t id = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router); @@ -687,9 +687,9 @@ DEFUN (show_ipv6_ospf6_database_type_id_router, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t id = 0; - u_int32_t adv_router = 0; + uint16_t type = 0; + uint32_t id = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -765,9 +765,9 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t id = 0; - u_int32_t adv_router = 0; + uint16_t type = 0; + uint32_t id = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -828,7 +828,7 @@ DEFUN (show_ipv6_ospf6_database_self_originated, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int32_t adv_router = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); level = parse_show_level(idx_level, argc, argv); @@ -884,8 +884,8 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t adv_router = 0; + uint16_t type = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -959,9 +959,9 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t adv_router = 0; - u_int32_t id = 0; + uint16_t type = 0; + uint32_t adv_router = 0; + uint32_t id = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -1034,9 +1034,9 @@ DEFUN (show_ipv6_ospf6_database_type_id_self_originated, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t adv_router = 0; - u_int32_t id = 0; + uint16_t type = 0; + uint32_t adv_router = 0; + uint32_t id = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -1090,7 +1090,7 @@ DEFUN (show_ipv6_ospf6_border_routers, "Show detailed output\n") { int idx_ipv4 = 4; - u_int32_t adv_router; + uint32_t adv_router; struct ospf6_route *ro; struct prefix prefix; |