From 6ac29a51075def99217a4ab1015635db3b3e83ed Mon Sep 17 00:00:00 2001 From: Paul Jakma Date: Fri, 15 Aug 2008 13:45:30 +0100 Subject: [PATCH] [trivia] finish off static'ification of ospf6d and ripngd 2008-08-15 Paul Jakma * {ospf6d,ripngd}/*: Finish job of marking functions as static, or exporting declarations for them, to quell warning noise with Quagga's GCC default high-level of warning flags. Thus allowing remaining, more useful warnings to be more easily seen. --- ospf6d/ospf6_abr.c | 10 +-- ospf6d/ospf6_abr.h | 28 ++++----- ospf6d/ospf6_area.c | 14 ++--- ospf6d/ospf6_area.h | 19 +++--- ospf6d/ospf6_asbr.c | 50 +++++++-------- ospf6d/ospf6_asbr.h | 30 ++++----- ospf6d/ospf6_flood.c | 16 ++--- ospf6d/ospf6_flood.h | 38 ++++++------ ospf6d/ospf6_interface.c | 22 +++---- ospf6d/ospf6_interface.h | 35 +++++------ ospf6d/ospf6_intra.c | 10 +-- ospf6d/ospf6_intra.h | 44 ++++++------- ospf6d/ospf6_lsa.c | 8 +-- ospf6d/ospf6_lsa.h | 82 ++++++++++++------------ ospf6d/ospf6_lsdb.h | 56 ++++++++--------- ospf6d/ospf6_main.c | 8 +-- ospf6d/ospf6_message.c | 40 ++++++------ ospf6d/ospf6_message.h | 40 ++++++------ ospf6d/ospf6_neighbor.c | 18 +++--- ospf6d/ospf6_neighbor.h | 31 +++++----- ospf6d/ospf6_network.c | 14 ++--- ospf6d/ospf6_network.h | 32 +++++----- ospf6d/ospf6_proto.h | 11 ++-- ospf6d/ospf6_route.c | 24 ++++---- ospf6d/ospf6_route.h | 93 ++++++++++++++-------------- ospf6d/ospf6_snmp.h | 2 +- ospf6d/ospf6_spf.c | 24 ++++---- ospf6d/ospf6_spf.h | 24 ++++---- ospf6d/ospf6_top.c | 36 +++++------ ospf6d/ospf6_top.h | 4 +- ospf6d/ospf6_zebra.c | 24 ++++---- ospf6d/ospf6_zebra.h | 18 +++--- ospf6d/ospf6d.c | 57 ++++++++--------- ospf6d/ospf6d.h | 6 +- ripngd/ripng_debug.c | 2 +- ripngd/ripng_debug.h | 4 +- ripngd/ripng_interface.c | 65 ++++++++++---------- ripngd/ripng_main.c | 6 +- ripngd/ripng_nexthop.h | 13 ++-- ripngd/ripng_offset.c | 24 ++++---- ripngd/ripng_peer.c | 14 ++--- ripngd/ripng_route.c | 4 +- ripngd/ripng_route.h | 17 ++--- ripngd/ripng_routemap.c | 56 ++++++++--------- ripngd/ripng_zebra.c | 16 ++--- ripngd/ripngd.c | 60 +++++++++--------- ripngd/ripngd.h | 130 +++++++++++++++++++++++---------------- 47 files changed, 690 insertions(+), 689 deletions(-) diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c index 180a2048d..8224b109f 100644 --- a/ospf6d/ospf6_abr.c +++ b/ospf6d/ospf6_abr.c @@ -472,7 +472,7 @@ ospf6_abr_originate_summary_to_area (struct ospf6_route *route, ospf6_lsa_originate_area (lsa, area); } -void +static void ospf6_abr_range_update (struct ospf6_route *range) { u_int32_t cost = 0; @@ -762,7 +762,7 @@ ospf6_abr_reimport (struct ospf6_area *oa) /* Display functions */ -int +static int ospf6_inter_area_prefix_lsa_show (struct vty *vty, struct ospf6_lsa *lsa) { struct ospf6_inter_prefix_lsa *prefix_lsa; @@ -787,7 +787,7 @@ ospf6_inter_area_prefix_lsa_show (struct vty *vty, struct ospf6_lsa *lsa) return 0; } -int +static int ospf6_inter_area_router_lsa_show (struct vty *vty, struct ospf6_lsa *lsa) { struct ospf6_inter_router_lsa *router_lsa; @@ -841,7 +841,7 @@ config_write_ospf6_debug_abr (struct vty *vty) } void -install_element_ospf6_debug_abr () +install_element_ospf6_debug_abr (void) { install_element (ENABLE_NODE, &debug_ospf6_abr_cmd); install_element (ENABLE_NODE, &no_debug_ospf6_abr_cmd); @@ -864,7 +864,7 @@ struct ospf6_lsa_handler inter_router_handler = }; void -ospf6_abr_init () +ospf6_abr_init (void) { ospf6_install_lsa_handler (&inter_prefix_handler); ospf6_install_lsa_handler (&inter_router_handler); diff --git a/ospf6d/ospf6_abr.h b/ospf6d/ospf6_abr.h index 84c6fa5eb..5d00c4748 100644 --- a/ospf6d/ospf6_abr.h +++ b/ospf6d/ospf6_abr.h @@ -52,24 +52,22 @@ struct ospf6_inter_router_lsa { (E)->metric &= htonl (0x00000000); \ (E)->metric |= htonl (0x00ffffff) & htonl (C); } -int ospf6_is_router_abr (struct ospf6 *o); +extern int ospf6_is_router_abr (struct ospf6 *o); -void ospf6_abr_enable_area (struct ospf6_area *oa); -void ospf6_abr_disable_area (struct ospf6_area *oa); +extern void ospf6_abr_enable_area (struct ospf6_area *oa); +extern void ospf6_abr_disable_area (struct ospf6_area *oa); -void ospf6_abr_originate_summary_to_area (struct ospf6_route *route, - struct ospf6_area *area); -void ospf6_abr_originate_summary (struct ospf6_route *route); -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_reimport (struct ospf6_area *oa); +extern void ospf6_abr_originate_summary_to_area (struct ospf6_route *route, + struct ospf6_area *area); +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_examin_brouter (u_int32_t router_id); +extern void ospf6_abr_reimport (struct ospf6_area *oa); -int config_write_ospf6_debug_abr (struct vty *vty); -void install_element_ospf6_debug_abr (); -int ospf6_abr_config_write (struct vty *vty); +extern int config_write_ospf6_debug_abr (struct vty *vty); +extern void install_element_ospf6_debug_abr (void); +extern int ospf6_abr_config_write (struct vty *vty); -void ospf6_abr_init (); +extern void ospf6_abr_init (void); #endif /*OSPF6_ABR_H*/ - - diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index 94283dba7..3bfc0cae5 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -54,7 +54,7 @@ ospf6_area_cmp (void *va, void *vb) } /* schedule routing table recalculation */ -void +static void ospf6_area_lsdb_hook_add (struct ospf6_lsa *lsa) { switch (ntohs (lsa->header->type)) @@ -84,7 +84,7 @@ ospf6_area_lsdb_hook_add (struct ospf6_lsa *lsa) } } -void +static void ospf6_area_lsdb_hook_remove (struct ospf6_lsa *lsa) { switch (ntohs (lsa->header->type)) @@ -114,14 +114,14 @@ ospf6_area_lsdb_hook_remove (struct ospf6_lsa *lsa) } } -void +static void ospf6_area_route_hook_add (struct ospf6_route *route) { struct ospf6_route *copy = ospf6_route_copy (route); ospf6_route_add (copy, ospf6->route_table); } -void +static void ospf6_area_route_hook_remove (struct ospf6_route *route) { struct ospf6_route *copy; @@ -230,7 +230,7 @@ ospf6_area_lookup (u_int32_t area_id, struct ospf6 *ospf6) return (struct ospf6_area *) NULL; } -struct ospf6_area * +static struct ospf6_area * ospf6_area_get (u_int32_t area_id, struct ospf6 *o) { struct ospf6_area *oa; @@ -364,7 +364,7 @@ ALIAS (area_range, OSPF6_AREA_ID_STR "Configured address range\n" "Specify IPv6 prefix\n" - ); + ) DEFUN (no_area_range, no_area_range_cmd, @@ -746,7 +746,7 @@ DEFUN (show_ipv6_ospf6_simulate_spf_tree_root, } void -ospf6_area_init () +ospf6_area_init (void) { install_element (VIEW_NODE, &show_ipv6_ospf6_spf_tree_cmd); install_element (VIEW_NODE, &show_ipv6_ospf6_area_spf_tree_cmd); diff --git a/ospf6d/ospf6_area.h b/ospf6d/ospf6_area.h index 6bf7e0b5f..c7c5ee358 100644 --- a/ospf6d/ospf6_area.h +++ b/ospf6d/ospf6_area.h @@ -112,19 +112,18 @@ struct ospf6_area #define IS_AREA_STUB(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_STUB)) /* prototypes */ -int ospf6_area_cmp (void *va, void *vb); +extern int ospf6_area_cmp (void *va, void *vb); -struct ospf6_area *ospf6_area_create (u_int32_t, struct ospf6 *); -void ospf6_area_delete (struct ospf6_area *); -struct ospf6_area *ospf6_area_lookup (u_int32_t, struct ospf6 *); +extern struct ospf6_area *ospf6_area_create (u_int32_t, struct ospf6 *); +extern void ospf6_area_delete (struct ospf6_area *); +extern struct ospf6_area *ospf6_area_lookup (u_int32_t, struct ospf6 *); -void ospf6_area_enable (struct ospf6_area *); -void ospf6_area_disable (struct ospf6_area *); +extern void ospf6_area_enable (struct ospf6_area *); +extern void ospf6_area_disable (struct ospf6_area *); -void ospf6_area_show (struct vty *, struct ospf6_area *); +extern void ospf6_area_show (struct vty *, struct ospf6_area *); -void ospf6_area_config_write (struct vty *vty); -void ospf6_area_init (); +extern void ospf6_area_config_write (struct vty *vty); +extern void ospf6_area_init (void); #endif /* OSPF_AREA_H */ - diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index c12eecae4..37b912b45 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -53,7 +53,7 @@ unsigned char conf_debug_ospf6_asbr = 0; #define ZROUTE_NAME(x) zebra_route_string(x) /* AS External LSA origination */ -void +static void ospf6_as_external_lsa_originate (struct ospf6_route *route) { char buffer[OSPF6_MAX_LSASIZE]; @@ -336,7 +336,7 @@ ospf6_asbr_lsentry_remove (struct ospf6_route *asbr_entry) /* redistribute function */ -void +static void ospf6_asbr_routemap_set (int type, const char *mapname) { if (ospf6->rmap[type].name) @@ -345,7 +345,7 @@ ospf6_asbr_routemap_set (int type, const char *mapname) ospf6->rmap[type].map = route_map_lookup_by_name (mapname); } -void +static void ospf6_asbr_routemap_unset (int type) { if (ospf6->rmap[type].name) @@ -354,7 +354,7 @@ ospf6_asbr_routemap_unset (int type) ospf6->rmap[type].map = NULL; } -void +static void ospf6_asbr_routemap_update (const char *mapname) { int type; @@ -378,13 +378,13 @@ ospf6_asbr_is_asbr (struct ospf6 *o) return o->external_table->count; } -void +static void ospf6_asbr_redistribute_set (int type) { ospf6_zebra_redistribute (type); } -void +static void ospf6_asbr_redistribute_unset (int type) { struct ospf6_route *route; @@ -731,7 +731,7 @@ ospf6_redistribute_config_write (struct vty *vty) return 0; } -void +static void ospf6_redistribute_show_config (struct vty *vty) { int type; @@ -774,7 +774,7 @@ ospf6_redistribute_show_config (struct vty *vty) /* Routemap Functions */ -route_map_result_t +static route_map_result_t ospf6_routemap_rule_match_address_prefixlist (void *rule, struct prefix *prefix, route_map_object_t type, @@ -793,13 +793,13 @@ ospf6_routemap_rule_match_address_prefixlist (void *rule, RMAP_NOMATCH : RMAP_MATCH); } -void * +static void * ospf6_routemap_rule_match_address_prefixlist_compile (const char *arg) { return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg); } -void +static void ospf6_routemap_rule_match_address_prefixlist_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -814,7 +814,7 @@ ospf6_routemap_rule_match_address_prefixlist_cmd = ospf6_routemap_rule_match_address_prefixlist_free, }; -route_map_result_t +static route_map_result_t ospf6_routemap_rule_set_metric_type (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -832,7 +832,7 @@ ospf6_routemap_rule_set_metric_type (void *rule, struct prefix *prefix, return RMAP_OKAY; } -void * +static void * ospf6_routemap_rule_set_metric_type_compile (const char *arg) { if (strcmp (arg, "type-2") && strcmp (arg, "type-1")) @@ -840,7 +840,7 @@ ospf6_routemap_rule_set_metric_type_compile (const char *arg) return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg); } -void +static void ospf6_routemap_rule_set_metric_type_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -855,7 +855,7 @@ ospf6_routemap_rule_set_metric_type_cmd = ospf6_routemap_rule_set_metric_type_free, }; -route_map_result_t +static route_map_result_t ospf6_routemap_rule_set_metric (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -869,7 +869,7 @@ ospf6_routemap_rule_set_metric (void *rule, struct prefix *prefix, return RMAP_OKAY; } -void * +static void * ospf6_routemap_rule_set_metric_compile (const char *arg) { u_int32_t metric; @@ -880,7 +880,7 @@ ospf6_routemap_rule_set_metric_compile (const char *arg) return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg); } -void +static void ospf6_routemap_rule_set_metric_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -895,7 +895,7 @@ ospf6_routemap_rule_set_metric_cmd = ospf6_routemap_rule_set_metric_free, }; -route_map_result_t +static route_map_result_t ospf6_routemap_rule_set_forwarding (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -915,7 +915,7 @@ ospf6_routemap_rule_set_forwarding (void *rule, struct prefix *prefix, return RMAP_OKAY; } -void * +static void * ospf6_routemap_rule_set_forwarding_compile (const char *arg) { struct in6_addr a; @@ -924,7 +924,7 @@ ospf6_routemap_rule_set_forwarding_compile (const char *arg) return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg); } -void +static void ospf6_routemap_rule_set_forwarding_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -939,7 +939,7 @@ ospf6_routemap_rule_set_forwarding_cmd = ospf6_routemap_rule_set_forwarding_free, }; -int +static int route_map_command_status (struct vty *vty, int ret) { if (! ret) @@ -1074,8 +1074,8 @@ DEFUN (ospf6_routemap_no_set_forwarding, return route_map_command_status (vty, ret); } -void -ospf6_routemap_init () +static void +ospf6_routemap_init (void) { route_map_init (); route_map_init_vty (); @@ -1106,7 +1106,7 @@ ospf6_routemap_init () /* Display functions */ -int +static int ospf6_as_external_lsa_show (struct vty *vty, struct ospf6_lsa *lsa) { struct ospf6_as_external_lsa *external; @@ -1154,7 +1154,7 @@ ospf6_as_external_lsa_show (struct vty *vty, struct ospf6_lsa *lsa) return 0; } -void +static void ospf6_asbr_external_route_show (struct vty *vty, struct ospf6_route *route) { struct ospf6_external_info *info = route->route_option; @@ -1206,7 +1206,7 @@ struct ospf6_lsa_handler as_external_handler = }; void -ospf6_asbr_init () +ospf6_asbr_init (void) { ospf6_routemap_init (); diff --git a/ospf6d/ospf6_asbr.h b/ospf6d/ospf6_asbr.h index f3aabc8d6..7166aa3ed 100644 --- a/ospf6d/ospf6_asbr.h +++ b/ospf6d/ospf6_asbr.h @@ -63,24 +63,24 @@ struct ospf6_as_external_lsa { (E)->bits_metric &= htonl (0xff000000); \ (E)->bits_metric |= htonl (0x00ffffff) & htonl (C); } -void ospf6_asbr_lsa_add (struct ospf6_lsa *lsa); -void ospf6_asbr_lsa_remove (struct ospf6_lsa *lsa); -void ospf6_asbr_lsentry_add (struct ospf6_route *asbr_entry); -void ospf6_asbr_lsentry_remove (struct ospf6_route *asbr_entry); +extern void ospf6_asbr_lsa_add (struct ospf6_lsa *lsa); +extern void ospf6_asbr_lsa_remove (struct ospf6_lsa *lsa); +extern void ospf6_asbr_lsentry_add (struct ospf6_route *asbr_entry); +extern void ospf6_asbr_lsentry_remove (struct ospf6_route *asbr_entry); -int ospf6_asbr_is_asbr (struct ospf6 *o); -void -ospf6_asbr_redistribute_add (int type, int ifindex, struct prefix *prefix, - u_int nexthop_num, struct in6_addr *nexthop); -void -ospf6_asbr_redistribute_remove (int type, int ifindex, struct prefix *prefix); +extern int ospf6_asbr_is_asbr (struct ospf6 *o); +extern void ospf6_asbr_redistribute_add (int type, int ifindex, + struct prefix *prefix, + u_int nexthop_num, + struct in6_addr *nexthop); +extern void ospf6_asbr_redistribute_remove (int type, int ifindex, + struct prefix *prefix); -int ospf6_redistribute_config_write (struct vty *vty); +extern int ospf6_redistribute_config_write (struct vty *vty); -void ospf6_asbr_init (); +extern void ospf6_asbr_init (void); -int config_write_ospf6_debug_asbr (struct vty *vty); -void install_element_ospf6_debug_asbr (); +extern int config_write_ospf6_debug_asbr (struct vty *vty); +extern void install_element_ospf6_debug_asbr (void); #endif /* OSPF6_ASBR_H */ - diff --git a/ospf6d/ospf6_flood.c b/ospf6d/ospf6_flood.c index 39b7c1f36..8c460293e 100644 --- a/ospf6d/ospf6_flood.c +++ b/ospf6d/ospf6_flood.c @@ -241,7 +241,7 @@ ospf6_install_lsa (struct ospf6_lsa *lsa) /* RFC2740 section 3.5.2. Sending Link State Update packets */ /* RFC2328 section 13.3 Next step in the flooding procedure */ -void +static void ospf6_flood_interface (struct ospf6_neighbor *from, struct ospf6_lsa *lsa, struct ospf6_interface *oi) { @@ -387,7 +387,7 @@ ospf6_flood_interface (struct ospf6_neighbor *from, } } -void +static void ospf6_flood_area (struct ospf6_neighbor *from, struct ospf6_lsa *lsa, struct ospf6_area *oa) { @@ -410,7 +410,7 @@ ospf6_flood_area (struct ospf6_neighbor *from, } } -void +static void ospf6_flood_process (struct ospf6_neighbor *from, struct ospf6_lsa *lsa, struct ospf6 *process) { @@ -440,7 +440,7 @@ ospf6_flood (struct ospf6_neighbor *from, struct ospf6_lsa *lsa) ospf6_flood_process (from, lsa, ospf6); } -void +static void ospf6_flood_clear_interface (struct ospf6_lsa *lsa, struct ospf6_interface *oi) { struct listnode *node, *nnode; @@ -463,7 +463,7 @@ ospf6_flood_clear_interface (struct ospf6_lsa *lsa, struct ospf6_interface *oi) } } -void +static void ospf6_flood_clear_area (struct ospf6_lsa *lsa, struct ospf6_area *oa) { struct listnode *node, *nnode; @@ -485,7 +485,7 @@ ospf6_flood_clear_area (struct ospf6_lsa *lsa, struct ospf6_area *oa) } } -void +static void ospf6_flood_clear_process (struct ospf6_lsa *lsa, struct ospf6 *process) { struct listnode *node, *nnode; @@ -676,7 +676,7 @@ ospf6_acknowledge_lsa_allother (struct ospf6_lsa *lsa, int ismore_recent, early of ospf6_receive_lsa () */ } -void +static void ospf6_acknowledge_lsa (struct ospf6_lsa *lsa, int ismore_recent, struct ospf6_neighbor *from) { @@ -1013,7 +1013,7 @@ config_write_ospf6_debug_flood (struct vty *vty) } void -install_element_ospf6_debug_flood () +install_element_ospf6_debug_flood (void) { install_element (ENABLE_NODE, &debug_ospf6_flooding_cmd); install_element (ENABLE_NODE, &no_debug_ospf6_flooding_cmd); diff --git a/ospf6d/ospf6_flood.h b/ospf6d/ospf6_flood.h index 4851c141e..3a6f300ba 100644 --- a/ospf6d/ospf6_flood.h +++ b/ospf6d/ospf6_flood.h @@ -32,34 +32,34 @@ extern unsigned char conf_debug_ospf6_flooding; (conf_debug_ospf6_flooding) /* Function Prototypes */ -struct ospf6_lsdb *ospf6_get_scoped_lsdb (struct ospf6_lsa *lsa); -struct ospf6_lsdb *ospf6_get_scoped_lsdb_self (struct ospf6_lsa *lsa); +extern struct ospf6_lsdb *ospf6_get_scoped_lsdb (struct ospf6_lsa *lsa); +extern struct ospf6_lsdb *ospf6_get_scoped_lsdb_self (struct ospf6_lsa *lsa); /* origination & purging */ -void ospf6_lsa_originate (struct ospf6_lsa *lsa); -void ospf6_lsa_originate_process (struct ospf6_lsa *lsa, - struct ospf6 *process); -void ospf6_lsa_originate_area (struct ospf6_lsa *lsa, - struct ospf6_area *oa); -void ospf6_lsa_originate_interface (struct ospf6_lsa *lsa, - struct ospf6_interface *oi); -void ospf6_lsa_purge (struct ospf6_lsa *lsa); +extern void ospf6_lsa_originate (struct ospf6_lsa *lsa); +extern void ospf6_lsa_originate_process (struct ospf6_lsa *lsa, + struct ospf6 *process); +extern void ospf6_lsa_originate_area (struct ospf6_lsa *lsa, + struct ospf6_area *oa); +extern void ospf6_lsa_originate_interface (struct ospf6_lsa *lsa, + struct ospf6_interface *oi); +extern void ospf6_lsa_purge (struct ospf6_lsa *lsa); /* access method to retrans_count */ -void ospf6_increment_retrans_count (struct ospf6_lsa *lsa); -void ospf6_decrement_retrans_count (struct ospf6_lsa *lsa); +extern void ospf6_increment_retrans_count (struct ospf6_lsa *lsa); +extern void ospf6_decrement_retrans_count (struct ospf6_lsa *lsa); /* flooding & clear flooding */ -void ospf6_flood_clear (struct ospf6_lsa *lsa); -void ospf6_flood (struct ospf6_neighbor *from, struct ospf6_lsa *lsa); +extern void ospf6_flood_clear (struct ospf6_lsa *lsa); +extern void ospf6_flood (struct ospf6_neighbor *from, struct ospf6_lsa *lsa); /* receive & install */ -void ospf6_receive_lsa (struct ospf6_neighbor *from, - struct ospf6_lsa_header *header); -void ospf6_install_lsa (struct ospf6_lsa *lsa); +extern void ospf6_receive_lsa (struct ospf6_neighbor *from, + struct ospf6_lsa_header *header); +extern void ospf6_install_lsa (struct ospf6_lsa *lsa); -int config_write_ospf6_debug_flood (struct vty *vty); -void install_element_ospf6_debug_flood (); +extern int config_write_ospf6_debug_flood (struct vty *vty); +extern void install_element_ospf6_debug_flood (void); #endif /* OSPF6_FLOOD_H */ diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 95464b63a..8d9a7f016 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -72,7 +72,7 @@ ospf6_interface_lookup_by_ifindex (int ifindex) } /* schedule routing table recalculation */ -void +static void ospf6_interface_lsdb_hook (struct ospf6_lsa *lsa) { switch (ntohs (lsa->header->type)) @@ -692,7 +692,7 @@ neighbor_change (struct thread *thread) return 0; } -int +static int loopind (struct thread *thread) { struct ospf6_interface *oi; @@ -739,7 +739,7 @@ interface_down (struct thread *thread) /* show specified interface structure */ -int +static int ospf6_interface_show (struct vty *vty, struct interface *ifp) { struct ospf6_interface *oi; @@ -897,7 +897,7 @@ ALIAS (show_ipv6_ospf6_interface, IP6_STR OSPF6_STR INTERFACE_STR - ); + ) DEFUN (show_ipv6_ospf6_interface_ifname_prefix, show_ipv6_ospf6_interface_ifname_prefix_cmd, @@ -946,7 +946,7 @@ ALIAS (show_ipv6_ospf6_interface_ifname_prefix, OSPF6_ROUTE_ADDRESS_STR OSPF6_ROUTE_PREFIX_STR "Dispaly details of the prefixes\n" - ); + ) ALIAS (show_ipv6_ospf6_interface_ifname_prefix, show_ipv6_ospf6_interface_ifname_prefix_match_cmd, @@ -960,7 +960,7 @@ ALIAS (show_ipv6_ospf6_interface_ifname_prefix, OSPF6_ROUTE_PREFIX_STR OSPF6_ROUTE_MATCH_STR "Dispaly details of the prefixes\n" - ); + ) DEFUN (show_ipv6_ospf6_interface_prefix, show_ipv6_ospf6_interface_prefix_cmd, @@ -999,7 +999,7 @@ ALIAS (show_ipv6_ospf6_interface_prefix, OSPF6_ROUTE_ADDRESS_STR OSPF6_ROUTE_PREFIX_STR "Dispaly details of the prefixes\n" - ); + ) ALIAS (show_ipv6_ospf6_interface_prefix, show_ipv6_ospf6_interface_prefix_match_cmd, @@ -1012,7 +1012,7 @@ ALIAS (show_ipv6_ospf6_interface_prefix, OSPF6_ROUTE_PREFIX_STR OSPF6_ROUTE_MATCH_STR "Dispaly details of the prefixes\n" - ); + ) /* interface variable set command */ @@ -1463,7 +1463,7 @@ DEFUN (no_ipv6_ospf6_advertise_prefix_list, return CMD_SUCCESS; } -int +static int config_write_ospf6_interface (struct vty *vty) { struct listnode *i; @@ -1519,7 +1519,7 @@ struct cmd_node interface_node = }; void -ospf6_interface_init () +ospf6_interface_init (void) { /* Install interface node. */ install_node (&interface_node, config_write_ospf6_interface); @@ -1596,7 +1596,7 @@ config_write_ospf6_debug_interface (struct vty *vty) } void -install_element_ospf6_debug_interface () +install_element_ospf6_debug_interface (void) { install_element (ENABLE_NODE, &debug_ospf6_interface_cmd); install_element (ENABLE_NODE, &no_debug_ospf6_interface_cmd); diff --git a/ospf6d/ospf6_interface.h b/ospf6d/ospf6_interface.h index fb93cedac..878c29e26 100644 --- a/ospf6d/ospf6_interface.h +++ b/ospf6d/ospf6_interface.h @@ -124,29 +124,28 @@ extern const char *ospf6_interface_state_str[]; /* Function Prototypes */ -struct ospf6_interface *ospf6_interface_lookup_by_ifindex (int); -struct ospf6_interface *ospf6_interface_create (struct interface *); -void ospf6_interface_delete (struct ospf6_interface *); +extern struct ospf6_interface *ospf6_interface_lookup_by_ifindex (int); +extern struct ospf6_interface *ospf6_interface_create (struct interface *); +extern void ospf6_interface_delete (struct ospf6_interface *); -void ospf6_interface_enable (struct ospf6_interface *); -void ospf6_interface_disable (struct ospf6_interface *); +extern void ospf6_interface_enable (struct ospf6_interface *); +extern void ospf6_interface_disable (struct ospf6_interface *); -void ospf6_interface_if_add (struct interface *); -void ospf6_interface_if_del (struct interface *); -void ospf6_interface_state_update (struct interface *); -void ospf6_interface_connected_route_update (struct interface *); +extern void ospf6_interface_if_add (struct interface *); +extern void ospf6_interface_if_del (struct interface *); +extern void ospf6_interface_state_update (struct interface *); +extern void ospf6_interface_connected_route_update (struct interface *); /* interface event */ -int interface_up (struct thread *); -int interface_down (struct thread *); -int wait_timer (struct thread *); -int backup_seen (struct thread *); -int neighbor_change (struct thread *); +extern int interface_up (struct thread *); +extern int interface_down (struct thread *); +extern int wait_timer (struct thread *); +extern int backup_seen (struct thread *); +extern int neighbor_change (struct thread *); -void ospf6_interface_init (); +extern void ospf6_interface_init (void); -int config_write_ospf6_debug_interface (struct vty *vty); -void install_element_ospf6_debug_interface (); +extern int config_write_ospf6_debug_interface (struct vty *vty); +extern void install_element_ospf6_debug_interface (void); #endif /* OSPF6_INTERFACE_H */ - diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index ffd9c725e..103e8fc2e 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -56,7 +56,7 @@ u_int32_t conf_debug_ospf6_brouter_specific_area_id; /* RFC2740 3.4.3.1 Router-LSA */ /******************************/ -int +static int ospf6_router_lsa_show (struct vty *vty, struct ospf6_lsa *lsa) { char *start, *end, *current; @@ -316,7 +316,7 @@ ospf6_router_lsa_originate (struct thread *thread) /* RFC2740 3.4.3.2 Network-LSA */ /*******************************/ -int +static int ospf6_network_lsa_show (struct vty *vty, struct ospf6_lsa *lsa) { char *start, *end, *current; @@ -462,7 +462,7 @@ ospf6_network_lsa_originate (struct thread *thread) /* RFC2740 3.4.3.6 Link-LSA */ /****************************/ -int +static int ospf6_link_lsa_show (struct vty *vty, struct ospf6_lsa *lsa) { char *start, *end, *current; @@ -615,7 +615,7 @@ ospf6_link_lsa_originate (struct thread *thread) /* RFC2740 3.4.3.7 Intra-Area-Prefix-LSA */ /*****************************************/ -int +static int ospf6_intra_prefix_lsa_show (struct vty *vty, struct ospf6_lsa *lsa) { char *start, *end, *current; @@ -1238,7 +1238,7 @@ ospf6_intra_route_calculation (struct ospf6_area *oa) zlog_debug ("Re-examin intra-routes for area %s: Done", oa->name); } -void +static void ospf6_brouter_debug_print (struct ospf6_route *brouter) { u_int32_t brouter_id; diff --git a/ospf6d/ospf6_intra.h b/ospf6d/ospf6_intra.h index 8a9474a81..31643fd89 100644 --- a/ospf6d/ospf6_intra.h +++ b/ospf6d/ospf6_intra.h @@ -187,28 +187,28 @@ struct ospf6_intra_prefix_lsa /* Function Prototypes */ -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, - struct ospf6_lsa *lsa); -char *ospf6_network_lsdesc_lookup (u_int32_t router_id, - struct ospf6_lsa *lsa); - -int ospf6_router_lsa_originate (struct thread *); -int ospf6_network_lsa_originate (struct thread *); -int ospf6_link_lsa_originate (struct thread *); -int ospf6_intra_prefix_lsa_originate_transit (struct thread *); -int ospf6_intra_prefix_lsa_originate_stub (struct thread *); -void ospf6_intra_prefix_lsa_add (struct ospf6_lsa *lsa); -void ospf6_intra_prefix_lsa_remove (struct ospf6_lsa *lsa); - -void ospf6_intra_route_calculation (struct ospf6_area *oa); -void ospf6_intra_brouter_calculation (struct ospf6_area *oa); - -void ospf6_intra_init (); - -int config_write_ospf6_debug_brouter (struct vty *vty); -void install_element_ospf6_debug_brouter (); +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, + struct ospf6_lsa *lsa); +extern char *ospf6_network_lsdesc_lookup (u_int32_t router_id, + struct ospf6_lsa *lsa); + +extern int ospf6_router_lsa_originate (struct thread *); +extern int ospf6_network_lsa_originate (struct thread *); +extern int ospf6_link_lsa_originate (struct thread *); +extern int ospf6_intra_prefix_lsa_originate_transit (struct thread *); +extern int ospf6_intra_prefix_lsa_originate_stub (struct thread *); +extern void ospf6_intra_prefix_lsa_add (struct ospf6_lsa *lsa); +extern void ospf6_intra_prefix_lsa_remove (struct ospf6_lsa *lsa); + +extern void ospf6_intra_route_calculation (struct ospf6_area *oa); +extern void ospf6_intra_brouter_calculation (struct ospf6_area *oa); + +extern void ospf6_intra_init (void); + +extern int config_write_ospf6_debug_brouter (struct vty *vty); +extern void install_element_ospf6_debug_brouter (void); #endif /* OSPF6_LSA_H */ diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index e57384b3f..87df7418a 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -45,7 +45,7 @@ vector ospf6_lsa_handler_vector; -int +static int ospf6_unknown_lsa_show (struct vty *vty, struct ospf6_lsa *lsa) { u_char *start, *end, *current; @@ -703,14 +703,14 @@ ospf6_lsa_checksum (struct ospf6_lsa_header *lsa_header) } void -ospf6_lsa_init () +ospf6_lsa_init (void) { ospf6_lsa_handler_vector = vector_init (0); ospf6_install_lsa_handler (&unknown_handler); } -char * +static char * ospf6_lsa_handler_name (struct ospf6_lsa_handler *h) { static char buf[64]; @@ -870,7 +870,7 @@ struct cmd_element no_debug_ospf6_lsa_type_cmd; struct cmd_element no_debug_ospf6_lsa_type_detail_cmd; void -install_element_ospf6_debug_lsa () +install_element_ospf6_debug_lsa (void) { u_int i; struct ospf6_lsa_handler *handler; diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h index 0e1b91174..fb0f27cda 100644 --- a/ospf6d/ospf6_lsa.h +++ b/ospf6d/ospf6_lsa.h @@ -206,47 +206,47 @@ extern struct ospf6_lsa_handler unknown_handler; /* Function Prototypes */ -const char *ospf6_lstype_name (u_int16_t type); -u_char ospf6_lstype_debug (u_int16_t type); -int ospf6_lsa_is_differ (struct ospf6_lsa *lsa1, struct ospf6_lsa *lsa2); -int ospf6_lsa_is_changed (struct ospf6_lsa *lsa1, struct ospf6_lsa *lsa2); -u_int16_t ospf6_lsa_age_current (struct ospf6_lsa *); -void ospf6_lsa_age_update_to_send (struct ospf6_lsa *, u_int32_t); -void ospf6_lsa_premature_aging (struct ospf6_lsa *); -int ospf6_lsa_compare (struct ospf6_lsa *, struct ospf6_lsa *); - -char *ospf6_lsa_printbuf (struct ospf6_lsa *lsa, char *buf, int size); -void ospf6_lsa_header_print_raw (struct ospf6_lsa_header *header); -void ospf6_lsa_header_print (struct ospf6_lsa *lsa); -void ospf6_lsa_show_summary_header (struct vty *vty); -void ospf6_lsa_show_summary (struct vty *vty, struct ospf6_lsa *lsa); -void ospf6_lsa_show_dump (struct vty *vty, struct ospf6_lsa *lsa); -void ospf6_lsa_show_internal (struct vty *vty, struct ospf6_lsa *lsa); -void ospf6_lsa_show (struct vty *vty, struct ospf6_lsa *lsa); - -struct ospf6_lsa *ospf6_lsa_create (struct ospf6_lsa_header *header); -struct ospf6_lsa *ospf6_lsa_create_headeronly (struct ospf6_lsa_header *header); -void ospf6_lsa_delete (struct ospf6_lsa *lsa); -struct ospf6_lsa *ospf6_lsa_copy (struct ospf6_lsa *); - -void ospf6_lsa_lock (struct ospf6_lsa *); -void ospf6_lsa_unlock (struct ospf6_lsa *); - -int ospf6_lsa_expire (struct thread *); -int ospf6_lsa_refresh (struct thread *); - -unsigned short ospf6_lsa_checksum (struct ospf6_lsa_header *); -int ospf6_lsa_prohibited_duration (u_int16_t type, u_int32_t id, - u_int32_t adv_router, void *scope); - -void ospf6_install_lsa_handler (struct ospf6_lsa_handler *handler); -struct ospf6_lsa_handler *ospf6_get_lsa_handler (u_int16_t type); - -void ospf6_lsa_init (); -void ospf6_lsa_cmd_init (); - -int config_write_ospf6_debug_lsa (struct vty *vty); -void install_element_ospf6_debug_lsa (); +extern const char *ospf6_lstype_name (u_int16_t type); +extern u_char ospf6_lstype_debug (u_int16_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 void ospf6_lsa_premature_aging (struct ospf6_lsa *); +extern int ospf6_lsa_compare (struct ospf6_lsa *, struct ospf6_lsa *); + +extern char *ospf6_lsa_printbuf (struct ospf6_lsa *lsa, char *buf, int size); +extern void ospf6_lsa_header_print_raw (struct ospf6_lsa_header *header); +extern void ospf6_lsa_header_print (struct ospf6_lsa *lsa); +extern void ospf6_lsa_show_summary_header (struct vty *vty); +extern void ospf6_lsa_show_summary (struct vty *vty, struct ospf6_lsa *lsa); +extern void ospf6_lsa_show_dump (struct vty *vty, struct ospf6_lsa *lsa); +extern void ospf6_lsa_show_internal (struct vty *vty, struct ospf6_lsa *lsa); +extern void ospf6_lsa_show (struct vty *vty, struct ospf6_lsa *lsa); + +extern struct ospf6_lsa *ospf6_lsa_create (struct ospf6_lsa_header *header); +extern struct ospf6_lsa *ospf6_lsa_create_headeronly (struct ospf6_lsa_header *header); +extern void ospf6_lsa_delete (struct ospf6_lsa *lsa); +extern struct ospf6_lsa *ospf6_lsa_copy (struct ospf6_lsa *); + +extern void ospf6_lsa_lock (struct ospf6_lsa *); +extern void ospf6_lsa_unlock (struct ospf6_lsa *); + +extern int ospf6_lsa_expire (struct thread *); +extern int ospf6_lsa_refresh (struct thread *); + +extern unsigned short ospf6_lsa_checksum (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 void ospf6_install_lsa_handler (struct ospf6_lsa_handler *handler); +extern struct ospf6_lsa_handler *ospf6_get_lsa_handler (u_int16_t type); + +extern void ospf6_lsa_init (void); +extern void ospf6_lsa_cmd_init (void); + +extern int config_write_ospf6_debug_lsa (struct vty *vty); +extern void install_element_ospf6_debug_lsa (void); #endif /* OSPF6_LSA_H */ diff --git a/ospf6d/ospf6_lsdb.h b/ospf6d/ospf6_lsdb.h index a9eba69d0..71297daec 100644 --- a/ospf6d/ospf6_lsdb.h +++ b/ospf6d/ospf6_lsdb.h @@ -50,51 +50,49 @@ struct ospf6_lsdb } while (0) /* Function Prototypes */ -struct ospf6_lsdb *ospf6_lsdb_create (void *data); -void ospf6_lsdb_delete (struct ospf6_lsdb *lsdb); +extern struct ospf6_lsdb *ospf6_lsdb_create (void *data); +extern void ospf6_lsdb_delete (struct ospf6_lsdb *lsdb); -struct ospf6_lsa * -ospf6_lsdb_lookup (u_int16_t type, u_int32_t id, u_int32_t adv_router, - struct ospf6_lsdb *lsdb); -struct ospf6_lsa * -ospf6_lsdb_lookup_next (u_int16_t type, u_int32_t id, - u_int32_t adv_router, struct ospf6_lsdb *lsdb); +extern struct ospf6_lsa *ospf6_lsdb_lookup (u_int16_t type, u_int32_t id, + u_int32_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, + struct ospf6_lsdb *lsdb); -void ospf6_lsdb_add (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb); -void ospf6_lsdb_remove (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb); +extern void ospf6_lsdb_add (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb); +extern void ospf6_lsdb_remove (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb); -struct ospf6_lsa *ospf6_lsdb_head (struct ospf6_lsdb *lsdb); -struct ospf6_lsa *ospf6_lsdb_next (struct ospf6_lsa *lsa); +extern struct ospf6_lsa *ospf6_lsdb_head (struct ospf6_lsdb *lsdb); +extern struct ospf6_lsa *ospf6_lsdb_next (struct ospf6_lsa *lsa); -struct ospf6_lsa *ospf6_lsdb_type_router_head (u_int16_t type, +extern struct ospf6_lsa *ospf6_lsdb_type_router_head (u_int16_t type, u_int32_t adv_router, struct ospf6_lsdb *lsdb); -struct ospf6_lsa *ospf6_lsdb_type_router_next (u_int16_t type, +extern struct ospf6_lsa *ospf6_lsdb_type_router_next (u_int16_t type, u_int32_t adv_router, struct ospf6_lsa *lsa); -struct ospf6_lsa *ospf6_lsdb_type_head (u_int16_t type, - struct ospf6_lsdb *lsdb); -struct ospf6_lsa *ospf6_lsdb_type_next (u_int16_t type, - struct ospf6_lsa *lsa); +extern struct ospf6_lsa *ospf6_lsdb_type_head (u_int16_t type, + struct ospf6_lsdb *lsdb); +extern struct ospf6_lsa *ospf6_lsdb_type_next (u_int16_t type, + struct ospf6_lsa *lsa); -void ospf6_lsdb_remove_all (struct ospf6_lsdb *lsdb); +extern void ospf6_lsdb_remove_all (struct ospf6_lsdb *lsdb); #define OSPF6_LSDB_SHOW_LEVEL_NORMAL 0 #define OSPF6_LSDB_SHOW_LEVEL_DETAIL 1 #define OSPF6_LSDB_SHOW_LEVEL_INTERNAL 2 #define OSPF6_LSDB_SHOW_LEVEL_DUMP 3 -void ospf6_lsdb_show - (struct vty *vty, int level, - u_int16_t *type, u_int32_t *id, u_int32_t *adv_router, - struct ospf6_lsdb *lsdb); +extern void ospf6_lsdb_show (struct vty *vty, int level, u_int16_t *type, + u_int32_t *id, u_int32_t *adv_router, + struct ospf6_lsdb *lsdb); -u_int32_t ospf6_new_ls_id - (u_int16_t type, u_int32_t adv_router, struct ospf6_lsdb *lsdb); -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 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); #endif /* OSPF6_LSDB_H */ - - diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c index 680f4b7fa..73d9150e8 100644 --- a/ospf6d/ospf6_main.c +++ b/ospf6d/ospf6_main.c @@ -125,14 +125,14 @@ Report bugs to zebra@zebra.org\n", progname); } /* SIGHUP handler. */ -void +static void sighup (void) { zlog_info ("SIGHUP received"); } /* SIGINT handler. */ -void +static void sigint (void) { zlog_notice ("Terminating on signal SIGINT"); @@ -140,7 +140,7 @@ sigint (void) } /* SIGTERM handler. */ -void +static void sigterm (void) { zlog_notice ("Terminating on signal SIGTERM"); @@ -148,7 +148,7 @@ sigterm (void) } /* SIGUSR1 handler. */ -void +static void sigusr1 (void) { zlog_info ("SIGUSR1 received"); diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 6ece88b8c..c257092a4 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -272,7 +272,7 @@ ospf6_header_examin (struct in6_addr *src, struct in6_addr *dst, return MSG_OK; } -void +static void ospf6_hello_recv (struct in6_addr *src, struct in6_addr *dst, struct ospf6_interface *oi, struct ospf6_header *oh) { @@ -810,7 +810,7 @@ ospf6_dbdesc_recv_slave (struct ospf6_header *oh, memcpy (&on->dbdesc_last, dbdesc, sizeof (struct ospf6_dbdesc)); } -void +static void ospf6_dbdesc_recv (struct in6_addr *src, struct in6_addr *dst, struct ospf6_interface *oi, struct ospf6_header *oh) { @@ -859,7 +859,7 @@ ospf6_dbdesc_recv (struct in6_addr *src, struct in6_addr *dst, } } -void +static void ospf6_lsreq_recv (struct in6_addr *src, struct in6_addr *dst, struct ospf6_interface *oi, struct ospf6_header *oh) { @@ -946,7 +946,7 @@ ospf6_lsreq_recv (struct in6_addr *src, struct in6_addr *dst, thread_add_event (master, ospf6_lsupdate_send_neighbor, on, 0); } -void +static void ospf6_lsupdate_recv (struct in6_addr *src, struct in6_addr *dst, struct ospf6_interface *oi, struct ospf6_header *oh) { @@ -1025,7 +1025,7 @@ ospf6_lsupdate_recv (struct in6_addr *src, struct in6_addr *dst, } } -void +static void ospf6_lsack_recv (struct in6_addr *src, struct in6_addr *dst, struct ospf6_interface *oi, struct ospf6_header *oh) { @@ -1133,14 +1133,14 @@ ospf6_lsack_recv (struct in6_addr *src, struct in6_addr *dst, } } -u_char *recvbuf = NULL; -u_char *sendbuf = NULL; -unsigned int iobuflen = 0; +static u_char *recvbuf = NULL; +static u_char *sendbuf = NULL; +static unsigned int iobuflen = 0; int ospf6_iobuf_size (unsigned int size) { - char *recvnew, *sendnew; + u_char *recvnew, *sendnew; if (size <= iobuflen) return iobuflen; @@ -1290,7 +1290,7 @@ ospf6_receive (struct thread *thread) return 0; } -void +static void ospf6_send (struct in6_addr *src, struct in6_addr *dst, struct ospf6_interface *oi, struct ospf6_header *oh) { @@ -1396,7 +1396,7 @@ ospf6_hello_send (struct thread *thread) hello->drouter = oi->drouter; hello->bdrouter = oi->bdrouter; - p = (char *)((caddr_t) hello + sizeof (struct ospf6_hello)); + p = (u_char *)((caddr_t) hello + sizeof (struct ospf6_hello)); for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on)) { @@ -1469,7 +1469,7 @@ ospf6_dbdesc_send (struct thread *thread) dbdesc->seqnum = htonl (on->dbdesc_seqnum); /* if this is not initial one, set LSA headers in dbdesc */ - p = (char *)((caddr_t) dbdesc + sizeof (struct ospf6_dbdesc)); + p = (u_char *)((caddr_t) dbdesc + sizeof (struct ospf6_dbdesc)); if (! CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT)) { for (lsa = ospf6_lsdb_head (on->dbdesc_list); lsa; @@ -1575,7 +1575,7 @@ ospf6_lsreq_send (struct thread *thread) oh = (struct ospf6_header *) sendbuf; /* set Request entries in lsreq */ - p = (char *)((caddr_t) oh + sizeof (struct ospf6_header)); + p = (u_char *)((caddr_t) oh + sizeof (struct ospf6_header)); for (lsa = ospf6_lsdb_head (on->request_list); lsa; lsa = ospf6_lsdb_next (lsa)) { @@ -1639,7 +1639,7 @@ ospf6_lsupdate_send_neighbor (struct thread *thread) lsupdate = (struct ospf6_lsupdate *) ((caddr_t) oh + sizeof (struct ospf6_header)); - p = (char *)((caddr_t) lsupdate + sizeof (struct ospf6_lsupdate)); + p = (u_char *)((caddr_t) lsupdate + sizeof (struct ospf6_lsupdate)); num = 0; /* lsupdate_list lists those LSA which doesn't need to be @@ -1734,7 +1734,7 @@ ospf6_lsupdate_send_interface (struct thread *thread) lsupdate = (struct ospf6_lsupdate *)((caddr_t) oh + sizeof (struct ospf6_header)); - p = (char *)((caddr_t) lsupdate + sizeof (struct ospf6_lsupdate)); + p = (u_char *)((caddr_t) lsupdate + sizeof (struct ospf6_lsupdate)); num = 0; for (lsa = ospf6_lsdb_head (oi->lsupdate_list); lsa; @@ -1803,7 +1803,7 @@ ospf6_lsack_send_neighbor (struct thread *thread) memset (sendbuf, 0, iobuflen); oh = (struct ospf6_header *) sendbuf; - p = (char *)((caddr_t) oh + sizeof (struct ospf6_header)); + p = (u_char *)((caddr_t) oh + sizeof (struct ospf6_header)); for (lsa = ospf6_lsdb_head (on->lsack_list); lsa; lsa = ospf6_lsdb_next (lsa)) @@ -1863,7 +1863,7 @@ ospf6_lsack_send_interface (struct thread *thread) memset (sendbuf, 0, iobuflen); oh = (struct ospf6_header *) sendbuf; - p = (char *)((caddr_t) oh + sizeof (struct ospf6_header)); + p = (u_char *)((caddr_t) oh + sizeof (struct ospf6_header)); for (lsa = ospf6_lsdb_head (oi->lsack_list); lsa; lsa = ospf6_lsdb_next (lsa)) @@ -1979,7 +1979,7 @@ ALIAS (debug_ospf6_message, "Debug All message\n" "Debug only sending message\n" "Debug only receiving message\n" - ); + ) DEFUN (no_debug_ospf6_message, @@ -2055,7 +2055,7 @@ ALIAS (no_debug_ospf6_message, "Debug All message\n" "Debug only sending message\n" "Debug only receiving message\n" - ); + ) int config_write_ospf6_debug_message (struct vty *vty) @@ -2116,7 +2116,7 @@ config_write_ospf6_debug_message (struct vty *vty) } void -install_element_ospf6_debug_message () +install_element_ospf6_debug_message (void) { install_element (ENABLE_NODE, &debug_ospf6_message_cmd); install_element (ENABLE_NODE, &no_debug_ospf6_message_cmd); diff --git a/ospf6d/ospf6_message.h b/ospf6d/ospf6_message.h index 95b07ced5..ebb6308e5 100644 --- a/ospf6d/ospf6_message.h +++ b/ospf6d/ospf6_message.h @@ -116,26 +116,26 @@ struct ospf6_lsupdate /* It is just a sequence of LSA Headers */ /* Function definition */ -void ospf6_hello_print (struct ospf6_header *); -void ospf6_dbdesc_print (struct ospf6_header *); -void ospf6_lsreq_print (struct ospf6_header *); -void ospf6_lsupdate_print (struct ospf6_header *); -void ospf6_lsack_print (struct ospf6_header *); - -int ospf6_iobuf_size (unsigned int size); -int ospf6_receive (struct thread *thread); - -int ospf6_hello_send (struct thread *thread); -int ospf6_dbdesc_send (struct thread *thread); -int ospf6_dbdesc_send_newone (struct thread *thread); -int ospf6_lsreq_send (struct thread *thread); -int ospf6_lsupdate_send_interface (struct thread *thread); -int ospf6_lsupdate_send_neighbor (struct thread *thread); -int ospf6_lsack_send_interface (struct thread *thread); -int ospf6_lsack_send_neighbor (struct thread *thread); - -int config_write_ospf6_debug_message (struct vty *); -void install_element_ospf6_debug_message (); +extern void ospf6_hello_print (struct ospf6_header *); +extern void ospf6_dbdesc_print (struct ospf6_header *); +extern void ospf6_lsreq_print (struct ospf6_header *); +extern void ospf6_lsupdate_print (struct ospf6_header *); +extern void ospf6_lsack_print (struct ospf6_header *); + +extern int ospf6_iobuf_size (unsigned int size); +extern int ospf6_receive (struct thread *thread); + +extern int ospf6_hello_send (struct thread *thread); +extern int ospf6_dbdesc_send (struct thread *thread); +extern int ospf6_dbdesc_send_newone (struct thread *thread); +extern int ospf6_lsreq_send (struct thread *thread); +extern int ospf6_lsupdate_send_interface (struct thread *thread); +extern int ospf6_lsupdate_send_neighbor (struct thread *thread); +extern int ospf6_lsack_send_interface (struct thread *thread); +extern int ospf6_lsack_send_neighbor (struct thread *thread); + +extern int config_write_ospf6_debug_message (struct vty *); +extern void install_element_ospf6_debug_message (void); #endif /* OSPF6_MESSAGE_H */ diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index 9c1cf2363..8a5d698db 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -183,7 +183,7 @@ ospf6_neighbor_state_change (u_char next_state, struct ospf6_neighbor *on) } /* RFC2328 section 10.4 */ -int +static int need_adjacency (struct ospf6_neighbor *on) { if (on->ospf6_if->state == OSPF6_INTERFACE_POINTTOPOINT || @@ -551,7 +551,7 @@ inactivity_timer (struct thread *thread) /* vty functions */ /* show neighbor structure */ -void +static void ospf6_neighbor_show (struct vty *vty, struct ospf6_neighbor *on) { char router_id[16]; @@ -612,7 +612,7 @@ ospf6_neighbor_show (struct vty *vty, struct ospf6_neighbor *on) ospf6_interface_state_str[on->ospf6_if->state], VNL); } -void +static void ospf6_neighbor_show_drchoice (struct vty *vty, struct ospf6_neighbor *on) { char router_id[16]; @@ -641,7 +641,7 @@ ospf6_neighbor_show_drchoice (struct vty *vty, struct ospf6_neighbor *on) VNL); } -void +static void ospf6_neighbor_show_detail (struct vty *vty, struct ospf6_neighbor *on) { char drouter[16], bdrouter[16]; @@ -801,7 +801,7 @@ ALIAS (show_ipv6_ospf6_neighbor, "Neighbor list\n" "Display details\n" "Display DR choices\n" - ); + ) DEFUN (show_ipv6_ospf6_neighbor_one, show_ipv6_ospf6_neighbor_one_cmd, @@ -839,7 +839,7 @@ DEFUN (show_ipv6_ospf6_neighbor_one, } void -ospf6_neighbor_init () +ospf6_neighbor_init (void) { install_element (VIEW_NODE, &show_ipv6_ospf6_neighbor_cmd); install_element (VIEW_NODE, &show_ipv6_ospf6_neighbor_detail_cmd); @@ -878,7 +878,7 @@ ALIAS (debug_ospf6_neighbor, "Debug OSPFv3 Neighbor\n" "Debug OSPFv3 Neighbor State Change\n" "Debug OSPFv3 Neighbor Event\n" - ); + ) DEFUN (no_debug_ospf6_neighbor, no_debug_ospf6_neighbor_cmd, @@ -913,7 +913,7 @@ ALIAS (no_debug_ospf6_neighbor, "Debug OSPFv3 Neighbor\n" "Debug OSPFv3 Neighbor State Change\n" "Debug OSPFv3 Neighbor Event\n" - ); + ) int config_write_ospf6_debug_neighbor (struct vty *vty) @@ -929,7 +929,7 @@ config_write_ospf6_debug_neighbor (struct vty *vty) } void -install_element_ospf6_debug_neighbor () +install_element_ospf6_debug_neighbor (void) { install_element (ENABLE_NODE, &debug_ospf6_neighbor_cmd); install_element (ENABLE_NODE, &debug_ospf6_neighbor_detail_cmd); diff --git a/ospf6d/ospf6_neighbor.h b/ospf6d/ospf6_neighbor.h index 8f94790d7..b3bd173fc 100644 --- a/ospf6d/ospf6_neighbor.h +++ b/ospf6d/ospf6_neighbor.h @@ -105,7 +105,7 @@ struct ospf6_neighbor #define OSPF6_NEIGHBOR_LOADING 7 #define OSPF6_NEIGHBOR_FULL 8 -const extern char *ospf6_neighbor_state_str[]; +extern const char *ospf6_neighbor_state_str[]; /* Function Prototypes */ @@ -119,20 +119,19 @@ struct ospf6_neighbor *ospf6_neighbor_create (u_int32_t, void ospf6_neighbor_delete (struct ospf6_neighbor *); /* Neighbor event */ -int hello_received (struct thread *); -int twoway_received (struct thread *); -int negotiation_done (struct thread *); -int exchange_done (struct thread *); -int loading_done (struct thread *); -int adj_ok (struct thread *); -int seqnumber_mismatch (struct thread *); -int bad_lsreq (struct thread *); -int oneway_received (struct thread *); -int inactivity_timer (struct thread *); - -void ospf6_neighbor_init (); -int config_write_ospf6_debug_neighbor (struct vty *vty); -void install_element_ospf6_debug_neighbor (); +extern int hello_received (struct thread *); +extern int twoway_received (struct thread *); +extern int negotiation_done (struct thread *); +extern int exchange_done (struct thread *); +extern int loading_done (struct thread *); +extern int adj_ok (struct thread *); +extern int seqnumber_mismatch (struct thread *); +extern int bad_lsreq (struct thread *); +extern int oneway_received (struct thread *); +extern int inactivity_timer (struct thread *); + +extern void ospf6_neighbor_init (void); +extern int config_write_ospf6_debug_neighbor (struct vty *vty); +extern void install_element_ospf6_debug_neighbor (void); #endif /* OSPF6_NEIGHBOR_H */ - diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c index 8c0cbf5ee..96b82af32 100644 --- a/ospf6d/ospf6_network.c +++ b/ospf6d/ospf6_network.c @@ -38,7 +38,7 @@ struct in6_addr alldrouters6; /* setsockopt ReUseAddr to on */ void -ospf6_set_reuseaddr () +ospf6_set_reuseaddr (void) { u_int on = 0; if (setsockopt (ospf6_sock, SOL_SOCKET, SO_REUSEADDR, &on, @@ -48,7 +48,7 @@ ospf6_set_reuseaddr () /* setsockopt MulticastLoop to off */ void -ospf6_reset_mcastloop () +ospf6_reset_mcastloop (void) { u_int off = 0; if (setsockopt (ospf6_sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, @@ -58,13 +58,13 @@ ospf6_reset_mcastloop () } void -ospf6_set_pktinfo () +ospf6_set_pktinfo (void) { setsockopt_ipv6_pktinfo (ospf6_sock, 1); } void -ospf6_set_checksum () +ospf6_set_checksum (void) { int offset = 12; #ifndef DISABLE_IPV6_CHECKSUM @@ -78,7 +78,7 @@ ospf6_set_checksum () /* Make ospf6d's server socket. */ int -ospf6_serv_sock () +ospf6_serv_sock (void) { if (ospf6d_privs.change (ZPRIVS_RAISE)) zlog_err ("ospf6_serv_sock: could not raise privs"); @@ -193,7 +193,7 @@ ospf6_leave_alldrouters (u_int ifindex) #endif } -int +static int iov_count (struct iovec *iov) { int i; @@ -202,7 +202,7 @@ iov_count (struct iovec *iov) return i; } -int +static int iov_totallen (struct iovec *iov) { int i; diff --git a/ospf6d/ospf6_network.h b/ospf6d/ospf6_network.h index 9a4d795e5..fd8758e8e 100644 --- a/ospf6d/ospf6_network.h +++ b/ospf6d/ospf6_network.h @@ -29,22 +29,22 @@ extern struct in6_addr allspfrouters6; extern struct in6_addr alldrouters6; /* Function Prototypes */ -void ospf6_set_reuseaddr (); -void ospf6_reset_mcastloop (); -void ospf6_set_pktinfo (); -void ospf6_set_checksum (); - -int ospf6_serv_sock (); - -void ospf6_join_allspfrouters (u_int); -void ospf6_leave_allspfrouters (u_int); -void ospf6_join_alldrouters (u_int); -void ospf6_leave_alldrouters (u_int); - -int ospf6_sendmsg (struct in6_addr *, struct in6_addr *, - unsigned int *, struct iovec *); -int ospf6_recvmsg (struct in6_addr *, struct in6_addr *, - unsigned int *, struct iovec *); +extern void ospf6_set_reuseaddr (void); +extern void ospf6_reset_mcastloop (void); +extern void ospf6_set_pktinfo (void); +extern void ospf6_set_checksum (void); + +extern int ospf6_serv_sock (void); + +extern void ospf6_join_allspfrouters (u_int); +extern void ospf6_leave_allspfrouters (u_int); +extern void ospf6_join_alldrouters (u_int); +extern void ospf6_leave_alldrouters (u_int); + +extern int ospf6_sendmsg (struct in6_addr *, struct in6_addr *, + unsigned int *, struct iovec *); +extern int ospf6_recvmsg (struct in6_addr *, struct in6_addr *, + unsigned int *, struct iovec *); #endif /* OSPF6_NETWORK_H */ diff --git a/ospf6d/ospf6_proto.h b/ospf6d/ospf6_proto.h index 9fe821dfb..a8c1b1a03 100644 --- a/ospf6d/ospf6_proto.h +++ b/ospf6d/ospf6_proto.h @@ -112,11 +112,10 @@ do { \ OSPF6_PREFIX_SPACE ((op)->prefix_length)); \ } while (0) -void ospf6_prefix_apply_mask (struct ospf6_prefix *op); -void ospf6_prefix_options_printbuf (u_int8_t prefix_options, - char *buf, int size); -void ospf6_capability_printbuf (char capability, char *buf, int size); -void ospf6_options_printbuf (u_char *options, char *buf, int size); +extern void ospf6_prefix_apply_mask (struct ospf6_prefix *op); +extern void ospf6_prefix_options_printbuf (u_int8_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); #endif /* OSPF6_PROTO_H */ - diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index 38fdd51a6..a89ed7e7c 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -174,7 +174,7 @@ const char *ospf6_path_type_substr[OSPF6_PATH_TYPE_MAX] = struct ospf6_route * -ospf6_route_create () +ospf6_route_create (void) { struct ospf6_route *route; route = XCALLOC (MTYPE_OSPF6_ROUTE, sizeof (struct ospf6_route)); @@ -928,7 +928,7 @@ ospf6_route_show_detail (struct vty *vty, struct ospf6_route *route) vty_out (vty, "%s", VNL); } -void +static void ospf6_route_show_table_summary (struct vty *vty, struct ospf6_route_table *table) { @@ -971,7 +971,7 @@ ospf6_route_show_table_summary (struct vty *vty, } } -void +static void ospf6_route_show_table_prefix (struct vty *vty, struct prefix *prefix, struct ospf6_route_table *table) @@ -993,7 +993,7 @@ ospf6_route_show_table_prefix (struct vty *vty, ospf6_route_unlock (route); } -void +static void ospf6_route_show_table_address (struct vty *vty, struct prefix *prefix, struct ospf6_route_table *table) @@ -1016,7 +1016,7 @@ ospf6_route_show_table_address (struct vty *vty, ospf6_route_unlock (route); } -void +static void ospf6_route_show_table_match (struct vty *vty, int detail, struct prefix *prefix, struct ospf6_route_table *table) @@ -1035,7 +1035,7 @@ ospf6_route_show_table_match (struct vty *vty, int detail, } } -void +static void ospf6_route_show_table_type (struct vty *vty, int detail, u_char type, struct ospf6_route_table *table) { @@ -1055,7 +1055,7 @@ ospf6_route_show_table_type (struct vty *vty, int detail, u_char type, } } -void +static void ospf6_route_show_table (struct vty *vty, int detail, struct ospf6_route_table *table) { @@ -1173,14 +1173,14 @@ ospf6_route_table_show (struct vty *vty, int argc, const char *argv[], return CMD_SUCCESS; } -void +static void ospf6_linkstate_show_header (struct vty *vty) { vty_out (vty, "%-7s %-15s %-15s %-8s %-14s %s%s", "Type", "Router-ID", "Net-ID", "Rtr-Bits", "Options", "Cost", VNL); } -void +static void ospf6_linkstate_show (struct vty *vty, struct ospf6_route *route) { u_int32_t router, id; @@ -1205,7 +1205,7 @@ ospf6_linkstate_show (struct vty *vty, struct ospf6_route *route) } -void +static void ospf6_linkstate_show_table_exact (struct vty *vty, struct prefix *prefix, struct ospf6_route_table *table) @@ -1227,7 +1227,7 @@ ospf6_linkstate_show_table_exact (struct vty *vty, ospf6_route_unlock (route); } -void +static void ospf6_linkstate_show_table (struct vty *vty, int detail, struct ospf6_route_table *table) { @@ -1393,7 +1393,7 @@ config_write_ospf6_debug_route (struct vty *vty) } void -install_element_ospf6_debug_route () +install_element_ospf6_debug_route (void) { install_element (ENABLE_NODE, &debug_ospf6_route_cmd); install_element (ENABLE_NODE, &no_debug_ospf6_route_cmd); diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h index 722fa1580..8dcc877fa 100644 --- a/ospf6d/ospf6_route.h +++ b/ospf6d/ospf6_route.h @@ -246,61 +246,60 @@ extern const char *ospf6_path_type_substr[OSPF6_PATH_TYPE_MAX]; (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[4])) /* Function prototype */ -void ospf6_linkstate_prefix (u_int32_t adv_router, u_int32_t id, - struct prefix *prefix); -void ospf6_linkstate_prefix2str (struct prefix *prefix, char *buf, int size); - -struct ospf6_route *ospf6_route_create (); -void ospf6_route_delete (struct ospf6_route *); -struct ospf6_route *ospf6_route_copy (struct ospf6_route *route); - -void ospf6_route_lock (struct ospf6_route *route); -void ospf6_route_unlock (struct ospf6_route *route); - -struct ospf6_route * -ospf6_route_lookup (struct prefix *prefix, - struct ospf6_route_table *table); -struct ospf6_route * -ospf6_route_lookup_identical (struct ospf6_route *route, - struct ospf6_route_table *table); -struct ospf6_route * -ospf6_route_lookup_bestmatch (struct prefix *prefix, - struct ospf6_route_table *table); - -struct ospf6_route * -ospf6_route_add (struct ospf6_route *route, struct ospf6_route_table *table); -void -ospf6_route_remove (struct ospf6_route *route, struct ospf6_route_table *table); - -struct ospf6_route *ospf6_route_head (struct ospf6_route_table *table); -struct ospf6_route *ospf6_route_next (struct ospf6_route *route); -struct ospf6_route *ospf6_route_best_next (struct ospf6_route *route); - -struct ospf6_route *ospf6_route_match_head (struct prefix *prefix, +extern void ospf6_linkstate_prefix (u_int32_t adv_router, u_int32_t id, + struct prefix *prefix); +extern void ospf6_linkstate_prefix2str (struct prefix *prefix, char *buf, + int size); + +extern struct ospf6_route *ospf6_route_create (void); +extern void ospf6_route_delete (struct ospf6_route *); +extern struct ospf6_route *ospf6_route_copy (struct ospf6_route *route); + +extern void ospf6_route_lock (struct ospf6_route *route); +extern void ospf6_route_unlock (struct ospf6_route *route); + +extern struct ospf6_route *ospf6_route_lookup (struct prefix *prefix, + struct ospf6_route_table *table); +extern struct ospf6_route *ospf6_route_lookup_identical (struct ospf6_route *route, + struct ospf6_route_table *table); +extern struct ospf6_route *ospf6_route_lookup_bestmatch (struct prefix *prefix, + struct ospf6_route_table *table); + +extern struct ospf6_route *ospf6_route_add (struct ospf6_route *route, + struct ospf6_route_table *table); +extern void ospf6_route_remove (struct ospf6_route *route, + struct ospf6_route_table *table); + +extern struct ospf6_route *ospf6_route_head (struct ospf6_route_table *table); +extern struct ospf6_route *ospf6_route_next (struct ospf6_route *route); +extern struct ospf6_route *ospf6_route_best_next (struct ospf6_route *route); + +extern struct ospf6_route *ospf6_route_match_head (struct prefix *prefix, struct ospf6_route_table *table); -struct ospf6_route *ospf6_route_match_next (struct prefix *prefix, +extern struct ospf6_route *ospf6_route_match_next (struct prefix *prefix, struct ospf6_route *route); -void ospf6_route_remove_all (struct ospf6_route_table *); -struct ospf6_route_table *ospf6_route_table_create (int s, int t); -void ospf6_route_table_delete (struct ospf6_route_table *); -void ospf6_route_dump (struct ospf6_route_table *table); +extern void ospf6_route_remove_all (struct ospf6_route_table *); +extern struct ospf6_route_table *ospf6_route_table_create (int s, int t); +extern void ospf6_route_table_delete (struct ospf6_route_table *); +extern void ospf6_route_dump (struct ospf6_route_table *table); -void ospf6_route_show (struct vty *vty, struct ospf6_route *route); -void ospf6_route_show_detail (struct vty *vty, struct ospf6_route *route); +extern void ospf6_route_show (struct vty *vty, struct ospf6_route *route); +extern void ospf6_route_show_detail (struct vty *vty, struct ospf6_route *route); -int ospf6_route_table_show (struct vty *, int, const char *[], - struct ospf6_route_table *); -int ospf6_linkstate_table_show (struct vty *vty, int argc, const char *argv[], - struct ospf6_route_table *table); +extern int ospf6_route_table_show (struct vty *, int, const char *[], + struct ospf6_route_table *); +extern int ospf6_linkstate_table_show (struct vty *vty, int argc, + const char *argv[], + struct ospf6_route_table *table); -void ospf6_brouter_show_header (struct vty *vty); -void ospf6_brouter_show (struct vty *vty, struct ospf6_route *route); +extern void ospf6_brouter_show_header (struct vty *vty); +extern void ospf6_brouter_show (struct vty *vty, struct ospf6_route *route); -int config_write_ospf6_debug_route (struct vty *vty); -void install_element_ospf6_debug_route (); -void ospf6_route_init (); +extern int config_write_ospf6_debug_route (struct vty *vty); +extern void install_element_ospf6_debug_route (void); +extern void ospf6_route_init (void); #endif /* OSPF6_ROUTE_H */ diff --git a/ospf6d/ospf6_snmp.h b/ospf6d/ospf6_snmp.h index 7ef784c91..5c67893c4 100644 --- a/ospf6d/ospf6_snmp.h +++ b/ospf6d/ospf6_snmp.h @@ -22,7 +22,7 @@ #ifndef OSPF6_SNMP_H #define OSPF6_SNMP_H -void ospf6_snmp_init (struct thread_master *); +extern void ospf6_snmp_init (struct thread_master *); #endif /*OSPF6_SNMP_H*/ diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index 08c1eb73b..44e11f9d5 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -43,7 +43,7 @@ unsigned char conf_debug_ospf6_spf = 0; -int +static int ospf6_vertex_cmp (void *a, void *b) { struct ospf6_vertex *va = (struct ospf6_vertex *) a; @@ -53,7 +53,7 @@ ospf6_vertex_cmp (void *a, void *b) return (va->cost - vb->cost); } -int +static int ospf6_vertex_id_cmp (void *a, void *b) { struct ospf6_vertex *va = (struct ospf6_vertex *) a; @@ -70,7 +70,7 @@ ospf6_vertex_id_cmp (void *a, void *b) return ret; } -struct ospf6_vertex * +static struct ospf6_vertex * ospf6_vertex_create (struct ospf6_lsa *lsa) { struct ospf6_vertex *v; @@ -113,14 +113,14 @@ ospf6_vertex_create (struct ospf6_lsa *lsa) return v; } -void +static void ospf6_vertex_delete (struct ospf6_vertex *v) { list_delete (v->child_list); XFREE (MTYPE_OSPF6_VERTEX, v); } -struct ospf6_lsa * +static struct ospf6_lsa * ospf6_lsdesc_lsa (caddr_t lsdesc, struct ospf6_vertex *v) { struct ospf6_lsa *lsa; @@ -166,7 +166,7 @@ ospf6_lsdesc_lsa (caddr_t lsdesc, struct ospf6_vertex *v) return lsa; } -char * +static char * ospf6_lsdesc_backlink (struct ospf6_lsa *lsa, caddr_t lsdesc, struct ospf6_vertex *v) { @@ -218,7 +218,7 @@ ospf6_lsdesc_backlink (struct ospf6_lsa *lsa, return found; } -void +static void ospf6_nexthop_calc (struct ospf6_vertex *w, struct ospf6_vertex *v, caddr_t lsdesc) { @@ -274,7 +274,7 @@ ospf6_nexthop_calc (struct ospf6_vertex *w, struct ospf6_vertex *v, zlog_debug ("No nexthop for %s found", w->name); } -int +static int ospf6_spf_install (struct ospf6_vertex *v, struct ospf6_route_table *result_table) { @@ -487,7 +487,7 @@ ospf6_spf_calculation (u_int32_t router_id, pqueue_delete (candidate_list); } -void +static void ospf6_spf_log_database (struct ospf6_area *oa) { char *p, *end, buffer[256]; @@ -512,7 +512,7 @@ ospf6_spf_log_database (struct ospf6_area *oa) zlog_debug ("%s", buffer); } -int +static int ospf6_spf_calculation_thread (struct thread *t) { struct ospf6_area *oa; @@ -689,7 +689,7 @@ config_write_ospf6_debug_spf (struct vty *vty) } void -install_element_ospf6_debug_spf () +install_element_ospf6_debug_spf (void) { install_element (ENABLE_NODE, &debug_ospf6_spf_process_cmd); install_element (ENABLE_NODE, &debug_ospf6_spf_time_cmd); @@ -706,7 +706,7 @@ install_element_ospf6_debug_spf () } void -ospf6_spf_init () +ospf6_spf_init (void) { } diff --git a/ospf6d/ospf6_spf.h b/ospf6d/ospf6_spf.h index 728eec511..c7069c258 100644 --- a/ospf6d/ospf6_spf.h +++ b/ospf6d/ospf6_spf.h @@ -77,18 +77,18 @@ struct ospf6_vertex #define VERTEX_IS_TYPE(t, v) \ ((v)->type == OSPF6_VERTEX_TYPE_ ## t ? 1 : 0) -void ospf6_spf_table_finish (struct ospf6_route_table *result_table); -void ospf6_spf_calculation (u_int32_t router_id, - struct ospf6_route_table *result_table, - struct ospf6_area *oa); -void ospf6_spf_schedule (struct ospf6_area *oa); - -void ospf6_spf_display_subtree (struct vty *vty, const char *prefix, - int rest, struct ospf6_vertex *v); - -int config_write_ospf6_debug_spf (struct vty *vty); -void install_element_ospf6_debug_spf (); -void ospf6_spf_init (); +extern void ospf6_spf_table_finish (struct ospf6_route_table *result_table); +extern void ospf6_spf_calculation (u_int32_t router_id, + struct ospf6_route_table *result_table, + struct ospf6_area *oa); +extern void ospf6_spf_schedule (struct ospf6_area *oa); + +extern void ospf6_spf_display_subtree (struct vty *vty, const char *prefix, + int rest, struct ospf6_vertex *v); + +extern int config_write_ospf6_debug_spf (struct vty *vty); +extern void install_element_ospf6_debug_spf (void); +extern void ospf6_spf_init (void); #endif /* OSPF6_SPF_H */ diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index a5efcb8d7..f59b6f95c 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -51,7 +51,7 @@ /* global ospf6d variable */ struct ospf6 *ospf6; -void +static void ospf6_top_lsdb_hook_add (struct ospf6_lsa *lsa) { switch (ntohs (lsa->header->type)) @@ -65,7 +65,7 @@ ospf6_top_lsdb_hook_add (struct ospf6_lsa *lsa) } } -void +static void ospf6_top_lsdb_hook_remove (struct ospf6_lsa *lsa) { switch (ntohs (lsa->header->type)) @@ -79,21 +79,21 @@ ospf6_top_lsdb_hook_remove (struct ospf6_lsa *lsa) } } -void +static void ospf6_top_route_hook_add (struct ospf6_route *route) { ospf6_abr_originate_summary (route); ospf6_zebra_route_update_add (route); } -void +static void ospf6_top_route_hook_remove (struct ospf6_route *route) { ospf6_abr_originate_summary (route); ospf6_zebra_route_update_remove (route); } -void +static void ospf6_top_brouter_hook_add (struct ospf6_route *route) { ospf6_abr_examin_brouter (ADV_ROUTER_IN_PREFIX (&route->prefix)); @@ -101,7 +101,7 @@ ospf6_top_brouter_hook_add (struct ospf6_route *route) ospf6_abr_originate_summary (route); } -void +static void ospf6_top_brouter_hook_remove (struct ospf6_route *route) { ospf6_abr_examin_brouter (ADV_ROUTER_IN_PREFIX (&route->prefix)); @@ -109,8 +109,8 @@ ospf6_top_brouter_hook_remove (struct ospf6_route *route) ospf6_abr_originate_summary (route); } -struct ospf6 * -ospf6_create () +static struct ospf6 * +ospf6_create (void) { struct ospf6 *o; @@ -144,7 +144,7 @@ ospf6_create () return o; } -void +static void ospf6_delete (struct ospf6 *o) { struct listnode *node, *nnode; @@ -165,7 +165,7 @@ ospf6_delete (struct ospf6 *o) XFREE (MTYPE_OSPF6_TOP, o); } -void +static void ospf6_enable (struct ospf6 *o) { struct listnode *node, *nnode; @@ -179,7 +179,7 @@ ospf6_enable (struct ospf6 *o) } } -void +static void ospf6_disable (struct ospf6 *o) { struct listnode *node, *nnode; @@ -198,7 +198,7 @@ ospf6_disable (struct ospf6 *o) } } -int +static int ospf6_maxage_remover (struct thread *thread) { struct ospf6 *o = (struct ospf6 *) THREAD_ARG (thread); @@ -427,7 +427,7 @@ DEFUN (no_ospf6_interface_area, return CMD_SUCCESS; } -void +static void ospf6_show (struct vty *vty, struct ospf6 *o) { struct listnode *n; @@ -499,7 +499,7 @@ ALIAS (show_ipv6_ospf6_route, "Specify IPv6 prefix\n" "Detailed information\n" "Summary of route table\n" - ); + ) DEFUN (show_ipv6_ospf6_route_match, show_ipv6_ospf6_route_match_cmd, @@ -562,7 +562,7 @@ ALIAS (show_ipv6_ospf6_route_match, ROUTE_STR "Specify IPv6 prefix\n" "Display routes longer than the specified route\n" - ); + ) DEFUN (show_ipv6_ospf6_route_match_detail, show_ipv6_ospf6_route_longer_detail_cmd, @@ -587,7 +587,7 @@ ALIAS (show_ipv6_ospf6_route, "Dispaly Inter-Area routes\n" "Dispaly Type-1 External routes\n" "Dispaly Type-2 External routes\n" - ); + ) DEFUN (show_ipv6_ospf6_route_type_detail, show_ipv6_ospf6_route_type_detail_cmd, @@ -618,7 +618,7 @@ DEFUN (show_ipv6_ospf6_route_type_detail, } /* OSPF configuration write function. */ -int +static int config_write_ospf6 (struct vty *vty) { char router_id[16]; @@ -660,7 +660,7 @@ struct cmd_node ospf6_node = /* Install ospf related commands. */ void -ospf6_top_init () +ospf6_top_init (void) { /* Install ospf6 top node. */ install_node (&ospf6_node, config_write_ospf6); diff --git a/ospf6d/ospf6_top.h b/ospf6d/ospf6_top.h index eae20e6ee..ba485f9ea 100644 --- a/ospf6d/ospf6_top.h +++ b/ospf6d/ospf6_top.h @@ -68,9 +68,9 @@ struct ospf6 extern struct ospf6 *ospf6; /* prototypes */ -void ospf6_top_init (); +extern void ospf6_top_init (void); -void ospf6_maxage_remove (struct ospf6 *o); +extern void ospf6_maxage_remove (struct ospf6 *o); #endif /* OSPF6_TOP_H */ diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index c974005fd..b5ffc0aa6 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -47,7 +47,7 @@ struct zclient *zclient = NULL; struct in_addr router_id_zebra; /* Router-id update message from zebra. */ -int +static int ospf6_router_id_update_zebra (int command, struct zclient *zclient, zebra_size_t length) { @@ -88,7 +88,7 @@ ospf6_zebra_no_redistribute (int type) } /* Inteface addition message from zebra. */ -int +static int ospf6_zebra_if_add (int command, struct zclient *zclient, zebra_size_t length) { struct interface *ifp; @@ -101,7 +101,7 @@ ospf6_zebra_if_add (int command, struct zclient *zclient, zebra_size_t length) return 0; } -int +static int ospf6_zebra_if_del (int command, struct zclient *zclient, zebra_size_t length) { struct interface *ifp; @@ -125,7 +125,7 @@ ospf6_zebra_if_del (int command, struct zclient *zclient, zebra_size_t length) return 0; } -int +static int ospf6_zebra_if_state_update (int command, struct zclient *zclient, zebra_size_t length) { @@ -141,7 +141,7 @@ ospf6_zebra_if_state_update (int command, struct zclient *zclient, return 0; } -int +static int ospf6_zebra_if_address_update_add (int command, struct zclient *zclient, zebra_size_t length) { @@ -164,7 +164,7 @@ ospf6_zebra_if_address_update_add (int command, struct zclient *zclient, return 0; } -int +static int ospf6_zebra_if_address_update_delete (int command, struct zclient *zclient, zebra_size_t length) { @@ -187,7 +187,7 @@ ospf6_zebra_if_address_update_delete (int command, struct zclient *zclient, return 0; } -int +static int ospf6_zebra_read_ipv6 (int command, struct zclient *zclient, zebra_size_t length) { @@ -317,7 +317,7 @@ DEFUN (no_router_zebra, } /* Zebra configuration write function. */ -int +static int config_write_ospf6_zebra (struct vty *vty) { if (! zclient->enable) @@ -553,7 +553,7 @@ DEFUN (no_redistribute_ospf6, } void -ospf6_zebra_init () +ospf6_zebra_init (void) { /* Allocate zebra structure. */ zclient = zclient_new (); @@ -623,7 +623,7 @@ ALIAS (debug_ospf6_zebra_sendrecv, DEBUG_STR OSPF6_STR "Debug connection between zebra\n" - ); + ) DEFUN (no_debug_ospf6_zebra_sendrecv, @@ -660,7 +660,7 @@ ALIAS (no_debug_ospf6_zebra_sendrecv, DEBUG_STR OSPF6_STR "Debug connection between zebra\n" - ); + ) int config_write_ospf6_debug_zebra (struct vty *vty) @@ -678,7 +678,7 @@ config_write_ospf6_debug_zebra (struct vty *vty) } void -install_element_ospf6_debug_zebra () +install_element_ospf6_debug_zebra (void) { install_element (ENABLE_NODE, &debug_ospf6_zebra_cmd); install_element (ENABLE_NODE, &no_debug_ospf6_zebra_cmd); diff --git a/ospf6d/ospf6_zebra.h b/ospf6d/ospf6_zebra.h index fb9877bf1..24a4ae639 100644 --- a/ospf6d/ospf6_zebra.h +++ b/ospf6d/ospf6_zebra.h @@ -37,17 +37,15 @@ extern unsigned char conf_debug_ospf6_zebra; extern struct zclient *zclient; -void ospf6_zebra_route_update_add (struct ospf6_route *request); -void ospf6_zebra_route_update_remove (struct ospf6_route *request); +extern void ospf6_zebra_route_update_add (struct ospf6_route *request); +extern void ospf6_zebra_route_update_remove (struct ospf6_route *request); -void ospf6_zebra_redistribute (int); -void ospf6_zebra_no_redistribute (int); -#define ospf6_zebra_is_redistribute(type) \ - (zclient->redist[type]) -void ospf6_zebra_init (); +extern void ospf6_zebra_redistribute (int); +extern void ospf6_zebra_no_redistribute (int); +#define ospf6_zebra_is_redistribute(type) (zclient->redist[type]) +extern void ospf6_zebra_init (void); -int config_write_ospf6_debug_zebra (struct vty *vty); -void install_element_ospf6_debug_zebra (); +extern int config_write_ospf6_debug_zebra (struct vty *vty); +extern void install_element_ospf6_debug_zebra (void); #endif /*OSPF6_ZEBRA_H*/ - diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index 3c84fe658..1a615ffae 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -50,11 +50,6 @@ char ospf6_daemon_version[] = OSPF6_DAEMON_VERSION; -void -ospf6_debug () -{ -} - struct route_node * route_prev (struct route_node *node) { @@ -104,7 +99,7 @@ struct cmd_node debug_node = 1 /* VTYSH */ }; -int +static int config_write_ospf6_debug (struct vty *vty) { config_write_ospf6_debug_message (vty); @@ -221,7 +216,7 @@ ALIAS (show_ipv6_ospf6_database, "Display details of LSAs\n" "Dump LSAs\n" "Display LSA's internal information\n" - ); + ) DEFUN (show_ipv6_ospf6_database_type, show_ipv6_ospf6_database_type_cmd, @@ -315,7 +310,7 @@ ALIAS (show_ipv6_ospf6_database_type, "Display details of LSAs\n" "Dump LSAs\n" "Display LSA's internal information\n" - ); + ) DEFUN (show_ipv6_ospf6_database_id, show_ipv6_ospf6_database_id_cmd, @@ -384,7 +379,7 @@ ALIAS (show_ipv6_ospf6_database_id, "Display details of LSAs\n" "Dump LSAs\n" "Display LSA's internal information\n" - ); + ) ALIAS (show_ipv6_ospf6_database_id, show_ipv6_ospf6_database_linkstate_id_cmd, @@ -395,7 +390,7 @@ ALIAS (show_ipv6_ospf6_database_id, "Display Link state database\n" "Search by Link state ID\n" "Specify Link state ID as IPv4 address notation\n" - ); + ) ALIAS (show_ipv6_ospf6_database_id, show_ipv6_ospf6_database_linkstate_id_detail_cmd, @@ -410,7 +405,7 @@ ALIAS (show_ipv6_ospf6_database_id, "Display details of LSAs\n" "Dump LSAs\n" "Display LSA's internal information\n" - ); + ) DEFUN (show_ipv6_ospf6_database_router, show_ipv6_ospf6_database_router_cmd, @@ -481,7 +476,7 @@ ALIAS (show_ipv6_ospf6_database_router, "Display details of LSAs\n" "Dump LSAs\n" "Display LSA's internal information\n" - ); + ) ALIAS (show_ipv6_ospf6_database_router, show_ipv6_ospf6_database_adv_router_cmd, @@ -492,7 +487,7 @@ ALIAS (show_ipv6_ospf6_database_router, "Display Link state database\n" "Search by Advertising Router\n" "Specify Advertising Router as IPv4 address notation\n" - ); + ) ALIAS (show_ipv6_ospf6_database_router, show_ipv6_ospf6_database_adv_router_detail_cmd, @@ -507,7 +502,7 @@ ALIAS (show_ipv6_ospf6_database_router, "Display details of LSAs\n" "Dump LSAs\n" "Display LSA's internal information\n" - ); + ) DEFUN (show_ipv6_ospf6_database_type_id, show_ipv6_ospf6_database_type_id_cmd, @@ -614,7 +609,7 @@ ALIAS (show_ipv6_ospf6_database_type_id, "Display details of LSAs\n" "Dump LSAs\n" "Display LSA's internal information\n" - ); + ) ALIAS (show_ipv6_ospf6_database_type_id, show_ipv6_ospf6_database_type_linkstate_id_cmd, @@ -636,7 +631,7 @@ ALIAS (show_ipv6_ospf6_database_type_id, "Display Intra-Area-Prefix LSAs\n" "Search by Link state ID\n" "Specify Link state ID as IPv4 address notation\n" - ); + ) ALIAS (show_ipv6_ospf6_database_type_id, show_ipv6_ospf6_database_type_linkstate_id_detail_cmd, @@ -662,7 +657,7 @@ ALIAS (show_ipv6_ospf6_database_type_id, "Display details of LSAs\n" "Dump LSAs\n" "Display LSA's internal information\n" - ); + ) DEFUN (show_ipv6_ospf6_database_type_router, show_ipv6_ospf6_database_type_router_cmd, @@ -771,7 +766,7 @@ ALIAS (show_ipv6_ospf6_database_type_router, "Display details of LSAs\n" "Dump LSAs\n" "Display LSA's internal information\n" - ); + ) ALIAS (show_ipv6_ospf6_database_type_router, show_ipv6_ospf6_database_type_adv_router_cmd, @@ -793,7 +788,7 @@ ALIAS (show_ipv6_ospf6_database_type_router, "Display Intra-Area-Prefix LSAs\n" "Search by Advertising Router\n" "Specify Advertising Router as IPv4 address notation\n" - ); + ) ALIAS (show_ipv6_ospf6_database_type_router, show_ipv6_ospf6_database_type_adv_router_detail_cmd, @@ -819,7 +814,7 @@ ALIAS (show_ipv6_ospf6_database_type_router, "Display details of LSAs\n" "Dump LSAs\n" "Display LSA's internal information\n" - ); + ) DEFUN (show_ipv6_ospf6_database_id_router, show_ipv6_ospf6_database_id_router_cmd, @@ -901,7 +896,7 @@ ALIAS (show_ipv6_ospf6_database_id_router, "Display details of LSAs\n" "Dump LSAs\n" "Display LSA's internal information\n" - ); + ) DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, show_ipv6_ospf6_database_adv_router_linkstate_id_cmd, @@ -985,7 +980,7 @@ ALIAS (show_ipv6_ospf6_database_adv_router_linkstate_id, "Display details of LSAs\n" "Dump LSAs\n" "Display LSA's internal information\n" - ); + ) DEFUN (show_ipv6_ospf6_database_type_id_router, show_ipv6_ospf6_database_type_id_router_cmd, @@ -1104,7 +1099,7 @@ ALIAS (show_ipv6_ospf6_database_type_id_router, "Specify Advertising Router as IPv4 address notation\n" "Dump LSAs\n" "Display LSA's internal information\n" - ); + ) DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd, @@ -1229,7 +1224,7 @@ ALIAS (show_ipv6_ospf6_database_type_adv_router_linkstate_id, "Specify Link state ID as IPv4 address notation\n" "Dump LSAs\n" "Display LSA's internal information\n" - ); + ) DEFUN (show_ipv6_ospf6_database_self_originated, show_ipv6_ospf6_database_self_originated_cmd, @@ -1386,7 +1381,7 @@ ALIAS (show_ipv6_ospf6_database_type_self_originated, "Display details of LSAs\n" "Dump LSAs\n" "Display LSA's internal information\n" - ); + ) DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd, @@ -1501,7 +1496,7 @@ ALIAS (show_ipv6_ospf6_database_type_self_originated_linkstate_id, "Display details of LSAs\n" "Dump LSAs\n" "Display LSA's internal information\n" - ); + ) DEFUN (show_ipv6_ospf6_database_type_id_self_originated, show_ipv6_ospf6_database_type_id_self_originated_cmd, @@ -1614,7 +1609,7 @@ ALIAS (show_ipv6_ospf6_database_type_id_self_originated, "Display details of LSAs\n" "Dump LSAs\n" "Display LSA's internal information\n" - ); + ) DEFUN (show_ipv6_ospf6_border_routers, @@ -1675,7 +1670,7 @@ ALIAS (show_ipv6_ospf6_border_routers, "Display routing table for ABR and ASBR\n" "Specify Router-ID\n" "Display Detail\n" - ); + ) DEFUN (show_ipv6_ospf6_linkstate, show_ipv6_ospf6_linkstate_cmd, @@ -1709,7 +1704,7 @@ ALIAS (show_ipv6_ospf6_linkstate, "Display linkstate routing table\n" "Display Router Entry\n" "Specify Router ID as IPv4 address notation\n" - ); + ) ALIAS (show_ipv6_ospf6_linkstate, show_ipv6_ospf6_linkstate_network_cmd, @@ -1721,7 +1716,7 @@ ALIAS (show_ipv6_ospf6_linkstate, "Display Network Entry\n" "Specify Router ID as IPv4 address notation\n" "Specify Link state ID as IPv4 address notation\n" - ); + ) DEFUN (show_ipv6_ospf6_linkstate_detail, show_ipv6_ospf6_linkstate_detail_cmd, @@ -1757,7 +1752,7 @@ DEFUN (show_ipv6_ospf6_linkstate_detail, /* Install ospf related commands. */ void -ospf6_init () +ospf6_init (void) { ospf6_top_init (); ospf6_area_init (); diff --git a/ospf6d/ospf6d.h b/ospf6d/ospf6d.h index 2d1f725b9..b6f1b7378 100644 --- a/ospf6d/ospf6d.h +++ b/ospf6d/ospf6d.h @@ -112,10 +112,10 @@ extern struct thread_master *master; /* Function Prototypes */ -struct route_node *route_prev (struct route_node *node); +extern struct route_node *route_prev (struct route_node *node); -void ospf6_debug (); -void ospf6_init (); +extern void ospf6_debug (void); +extern void ospf6_init (void); #endif /* OSPF6D_H */ diff --git a/ripngd/ripng_debug.c b/ripngd/ripng_debug.c index 7841fe214..4ed4fa36e 100644 --- a/ripngd/ripng_debug.c +++ b/ripngd/ripng_debug.c @@ -211,7 +211,7 @@ struct cmd_node debug_node = 1 /* VTYSH */ }; -int +static int config_write_debug (struct vty *vty) { int write = 0; diff --git a/ripngd/ripng_debug.h b/ripngd/ripng_debug.h index 617a07de5..f5ed6eabc 100644 --- a/ripngd/ripng_debug.h +++ b/ripngd/ripng_debug.h @@ -47,7 +47,7 @@ extern unsigned long ripng_debug_event; extern unsigned long ripng_debug_packet; extern unsigned long ripng_debug_zebra; -void ripng_debug_init (); -void ripng_debug_reset (); +extern void ripng_debug_init (void); +extern void ripng_debug_reset (void); #endif /* _ZEBRA_RIPNG_DEBUG_H */ diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index 140e3bef6..d76e3a13e 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -52,12 +52,12 @@ extern struct zebra_privs_t ripngd_privs; /* Static utility function. */ static void ripng_enable_apply (struct interface *); static void ripng_passive_interface_apply (struct interface *); -int ripng_enable_if_lookup (const char *ifname); -int ripng_enable_network_lookup2 (struct connected *connected); -void ripng_enable_apply_all (); +static int ripng_enable_if_lookup (const char *); +static int ripng_enable_network_lookup2 (struct connected *); +static void ripng_enable_apply_all (void); /* Join to the all rip routers multicast group. */ -int +static int ripng_multicast_join (struct interface *ifp) { int ret; @@ -109,7 +109,7 @@ ripng_multicast_join (struct interface *ifp) } /* Leave from the all rip routers multicast group. */ -int +static int ripng_multicast_leave (struct interface *ifp) { int ret; @@ -137,7 +137,7 @@ ripng_multicast_leave (struct interface *ifp) } /* How many link local IPv6 address could be used on the interface ? */ -int +static int ripng_if_ipv6_lladdress_check (struct interface *ifp) { struct listnode *nn; @@ -158,8 +158,8 @@ ripng_if_ipv6_lladdress_check (struct interface *ifp) } /* Check max mtu size. */ -unsigned int -ripng_check_max_mtu () +static unsigned int +ripng_check_max_mtu (void) { struct listnode *node; struct interface *ifp; @@ -173,7 +173,7 @@ ripng_check_max_mtu () return mtu; } -int +static int ripng_if_down (struct interface *ifp) { struct route_node *rp; @@ -335,7 +335,7 @@ ripng_interface_delete (int command, struct zclient *zclient, } void -ripng_interface_clean () +ripng_interface_clean (void) { struct listnode *node, *nnode; struct interface *ifp; @@ -358,7 +358,8 @@ ripng_interface_clean () } void -ripng_interface_reset () { +ripng_interface_reset (void) +{ struct listnode *node; struct interface *ifp; struct ripng_interface *ri; @@ -526,7 +527,7 @@ struct route_table *ripng_enable_network; /* Lookup RIPng enable network. */ /* Check wether the interface has at least a connected prefix that * is within the ripng_enable_network table. */ -int +static int ripng_enable_network_lookup_if (struct interface *ifp) { struct listnode *node; @@ -559,7 +560,7 @@ ripng_enable_network_lookup_if (struct interface *ifp) } /* Check wether connected is within the ripng_enable_network table. */ -int +static int ripng_enable_network_lookup2 (struct connected *connected) { struct prefix_ipv6 address; @@ -588,7 +589,7 @@ ripng_enable_network_lookup2 (struct connected *connected) } /* Add RIPng enable network. */ -int +static int ripng_enable_network_add (struct prefix *p) { struct route_node *node; @@ -610,7 +611,7 @@ ripng_enable_network_add (struct prefix *p) } /* Delete RIPng enable network. */ -int +static int ripng_enable_network_delete (struct prefix *p) { struct route_node *node; @@ -632,7 +633,7 @@ ripng_enable_network_delete (struct prefix *p) } /* Lookup function. */ -int +static int ripng_enable_if_lookup (const char *ifname) { unsigned int i; @@ -646,7 +647,7 @@ ripng_enable_if_lookup (const char *ifname) } /* Add interface to ripng_enable_if. */ -int +static int ripng_enable_if_add (const char *ifname) { int ret; @@ -663,7 +664,7 @@ ripng_enable_if_add (const char *ifname) } /* Delete interface from ripng_enable_if. */ -int +static int ripng_enable_if_delete (const char *ifname) { int index; @@ -683,7 +684,7 @@ ripng_enable_if_delete (const char *ifname) } /* Wake up interface. */ -int +static int ripng_interface_wakeup (struct thread *t) { struct interface *ifp; @@ -710,9 +711,7 @@ ripng_interface_wakeup (struct thread *t) return 0; } -int ripng_redistribute_check (int); - -void +static void ripng_connect_set (struct interface *ifp, int set) { struct listnode *node, *nnode; @@ -816,8 +815,8 @@ ripng_enable_apply (struct interface *ifp) } /* Set distribute list to all interfaces. */ -void -ripng_enable_apply_all () +static void +ripng_enable_apply_all (void) { struct interface *ifp; struct listnode *node; @@ -853,7 +852,7 @@ ripng_clean_network () vector Vripng_passive_interface; /* Utility function for looking up passive interface settings. */ -int +static int ripng_passive_interface_lookup (const char *ifname) { unsigned int i; @@ -881,7 +880,7 @@ ripng_passive_interface_apply (struct interface *ifp) ri->passive = 1; } -void +static void ripng_passive_interface_apply_all (void) { struct interface *ifp; @@ -892,7 +891,7 @@ ripng_passive_interface_apply_all (void) } /* Passive interface. */ -int +static int ripng_passive_interface_set (struct vty *vty, const char *ifname) { if (ripng_passive_interface_lookup (ifname) >= 0) @@ -905,7 +904,7 @@ ripng_passive_interface_set (struct vty *vty, const char *ifname) return CMD_SUCCESS; } -int +static int ripng_passive_interface_unset (struct vty *vty, const char *ifname) { int i; @@ -1117,8 +1116,8 @@ DEFUN (no_ripng_passive_interface, return ripng_passive_interface_unset (vty, argv[0]); } -struct ripng_interface * -ri_new () +static struct ripng_interface * +ri_new (void) { struct ripng_interface *ri; ri = XCALLOC (MTYPE_IF, sizeof (struct ripng_interface)); @@ -1133,7 +1132,7 @@ ri_new () return ri; } -int +static int ripng_if_new_hook (struct interface *ifp) { ifp->info = ri_new (); @@ -1141,7 +1140,7 @@ ripng_if_new_hook (struct interface *ifp) } /* Called when interface structure deleted. */ -int +static int ripng_if_delete_hook (struct interface *ifp) { XFREE (MTYPE_IF, ifp->info); @@ -1150,7 +1149,7 @@ ripng_if_delete_hook (struct interface *ifp) } /* Configuration write function for ripngd. */ -int +static int interface_config_write (struct vty *vty) { struct listnode *node; diff --git a/ripngd/ripng_main.c b/ripngd/ripng_main.c index a18ce9de7..487748529 100644 --- a/ripngd/ripng_main.c +++ b/ripngd/ripng_main.c @@ -129,7 +129,7 @@ Report bugs to %s\n", progname, ZEBRA_BUG_ADDRESS); } /* SIGHUP handler. */ -void +static void sighup (void) { zlog_info ("SIGHUP received"); @@ -145,7 +145,7 @@ sighup (void) } /* SIGINT handler. */ -void +static void sigint (void) { zlog_notice ("Terminating on signal"); @@ -157,7 +157,7 @@ sigint (void) } /* SIGUSR1 handler. */ -void +static void sigusr1 (void) { zlog_rotate (NULL); diff --git a/ripngd/ripng_nexthop.h b/ripngd/ripng_nexthop.h index 50a86ad02..7c0410592 100644 --- a/ripngd/ripng_nexthop.h +++ b/ripngd/ripng_nexthop.h @@ -27,12 +27,13 @@ #include "ripngd/ripng_route.h" #include "ripngd/ripngd.h" -struct list * ripng_rte_new(void); -void ripng_rte_free(struct list *ripng_rte_list); -void ripng_rte_add(struct list *ripng_rte_list, struct prefix_ipv6 *p, - struct ripng_info *rinfo, struct ripng_aggregate *aggregate); -void ripng_rte_send(struct list *ripng_rte_list, struct interface *ifp, - struct sockaddr_in6 *to); +extern struct list * ripng_rte_new(void); +extern void ripng_rte_free(struct list *ripng_rte_list); +extern void ripng_rte_add(struct list *ripng_rte_list, struct prefix_ipv6 *p, + struct ripng_info *rinfo, + struct ripng_aggregate *aggregate); +extern void ripng_rte_send(struct list *ripng_rte_list, struct interface *ifp, + struct sockaddr_in6 *to); /*** * 1 if A > B diff --git a/ripngd/ripng_offset.c b/ripngd/ripng_offset.c index 31d78ba8e..5bc2568e8 100644 --- a/ripngd/ripng_offset.c +++ b/ripngd/ripng_offset.c @@ -32,6 +32,8 @@ #include "linklist.h" #include "memory.h" +#include "ripngd/ripngd.h" + #define RIPNG_OFFSET_LIST_IN 0 #define RIPNG_OFFSET_LIST_OUT 1 #define RIPNG_OFFSET_LIST_MAX 2 @@ -50,7 +52,7 @@ struct ripng_offset_list static struct list *ripng_offset_list_master; -int +static int strcmp_safe (const char *s1, const char *s2) { if (s1 == NULL && s2 == NULL) @@ -62,7 +64,7 @@ strcmp_safe (const char *s1, const char *s2) return strcmp (s1, s2); } -struct ripng_offset_list * +static struct ripng_offset_list * ripng_offset_list_new () { struct ripng_offset_list *new; @@ -71,13 +73,13 @@ ripng_offset_list_new () return new; } -void +static void ripng_offset_list_free (struct ripng_offset_list *offset) { XFREE (MTYPE_RIPNG_OFFSET_LIST, offset); } -struct ripng_offset_list * +static struct ripng_offset_list * ripng_offset_list_lookup (const char *ifname) { struct ripng_offset_list *offset; @@ -91,7 +93,7 @@ ripng_offset_list_lookup (const char *ifname) return NULL; } -struct ripng_offset_list * +static struct ripng_offset_list * ripng_offset_list_get (const char *ifname) { struct ripng_offset_list *offset; @@ -108,7 +110,7 @@ ripng_offset_list_get (const char *ifname) return offset; } -int +static int ripng_offset_list_set (struct vty *vty, const char *alist, const char *direct_str, const char *metric_str, const char *ifname) @@ -147,7 +149,7 @@ ripng_offset_list_set (struct vty *vty, const char *alist, return CMD_SUCCESS; } -int +static int ripng_offset_list_unset (struct vty *vty, const char *alist, const char *direct_str, const char *metric_str, const char *ifname) @@ -338,13 +340,13 @@ DEFUN (no_ripng_offset_list_ifname, return ripng_offset_list_unset (vty, argv[0], argv[1], argv[2], argv[3]); } -int +static int offset_list_cmp (struct ripng_offset_list *o1, struct ripng_offset_list *o2) { return strcmp_safe (o1->ifname, o2->ifname); } -void +static void offset_list_del (struct ripng_offset_list *offset) { if (OFFSET_LIST_IN_NAME (offset)) @@ -357,7 +359,7 @@ offset_list_del (struct ripng_offset_list *offset) } void -ripng_offset_init () +ripng_offset_init (void) { ripng_offset_list_master = list_new (); ripng_offset_list_master->cmp = (int (*)(void *, void *)) offset_list_cmp; @@ -370,7 +372,7 @@ ripng_offset_init () } void -ripng_offset_clean () +ripng_offset_clean (void) { list_delete (ripng_offset_list_master); diff --git a/ripngd/ripng_peer.c b/ripngd/ripng_peer.c index 34f5ac6c3..1e58bb87f 100644 --- a/ripngd/ripng_peer.c +++ b/ripngd/ripng_peer.c @@ -39,8 +39,8 @@ /* Linked list of RIPng peer. */ struct list *peer_list; -struct ripng_peer * -ripng_peer_new () +static struct ripng_peer * +ripng_peer_new (void) { struct ripng_peer *new; @@ -49,7 +49,7 @@ ripng_peer_new () return new; } -void +static void ripng_peer_free (struct ripng_peer *peer) { XFREE (MTYPE_RIPNG_PEER, peer); @@ -86,7 +86,7 @@ ripng_peer_lookup_next (struct in6_addr *addr) /* RIPng peer is timeout. * Garbage collector. **/ -int +static int ripng_peer_timeout (struct thread *t) { struct ripng_peer *peer; @@ -99,7 +99,7 @@ ripng_peer_timeout (struct thread *t) } /* Get RIPng peer. At the same time update timeout thread. */ -struct ripng_peer * +static struct ripng_peer * ripng_peer_get (struct in6_addr *addr) { struct ripng_peer *peer; @@ -153,7 +153,7 @@ ripng_peer_bad_packet (struct sockaddr_in6 *from) } /* Display peer uptime. */ -char * +static char * ripng_peer_uptime (struct ripng_peer *peer, char *buf, size_t len) { time_t uptime; @@ -206,7 +206,7 @@ ripng_peer_display (struct vty *vty) } } -int +static int ripng_peer_list_cmp (struct ripng_peer *p1, struct ripng_peer *p2) { return addr6_cmp(&p1->addr, &p2->addr) > 0; diff --git a/ripngd/ripng_route.c b/ripngd/ripng_route.c index 9c3c4f990..d4bf0262b 100644 --- a/ripngd/ripng_route.c +++ b/ripngd/ripng_route.c @@ -31,7 +31,7 @@ #include "ripngd/ripngd.h" #include "ripngd/ripng_route.h" -struct ripng_aggregate * +static struct ripng_aggregate * ripng_aggregate_new () { struct ripng_aggregate *new; @@ -40,7 +40,7 @@ ripng_aggregate_new () return new; } -void +static void ripng_aggregate_free (struct ripng_aggregate *aggregate) { XFREE (MTYPE_RIPNG_AGGREGATE, aggregate); diff --git a/ripngd/ripng_route.h b/ripngd/ripng_route.h index db53f1488..2f5b75754 100644 --- a/ripngd/ripng_route.h +++ b/ripngd/ripng_route.h @@ -44,16 +44,11 @@ struct ripng_aggregate u_short tag_out; }; -void -ripng_aggregate_increment (struct route_node *rp, struct ripng_info *rinfo); - -void -ripng_aggregate_decrement (struct route_node *rp, struct ripng_info *rinfo); - -int -ripng_aggregate_add (struct prefix *p); - -int -ripng_aggregate_delete (struct prefix *p); +extern void ripng_aggregate_increment (struct route_node *rp, + struct ripng_info *rinfo); +extern void ripng_aggregate_decrement (struct route_node *rp, + struct ripng_info *rinfo); +extern int ripng_aggregate_add (struct prefix *p); +extern int ripng_aggregate_delete (struct prefix *p); #endif /* _ZEBRA_RIPNG_ROUTE_H */ diff --git a/ripngd/ripng_routemap.c b/ripngd/ripng_routemap.c index 1570c78b4..0f5cca350 100644 --- a/ripngd/ripng_routemap.c +++ b/ripngd/ripng_routemap.c @@ -43,7 +43,7 @@ struct rip_metric_modifier }; -int +static int ripng_route_match_add (struct vty *vty, struct route_map_index *index, const char *command, const char *arg) { @@ -65,7 +65,7 @@ ripng_route_match_add (struct vty *vty, struct route_map_index *index, return CMD_SUCCESS; } -int +static int ripng_route_match_delete (struct vty *vty, struct route_map_index *index, const char *command, const char *arg) { @@ -87,7 +87,7 @@ ripng_route_match_delete (struct vty *vty, struct route_map_index *index, return CMD_SUCCESS; } -int +static int ripng_route_set_add (struct vty *vty, struct route_map_index *index, const char *command, const char *arg) { @@ -109,7 +109,7 @@ ripng_route_set_add (struct vty *vty, struct route_map_index *index, return CMD_SUCCESS; } -int +static int ripng_route_set_delete (struct vty *vty, struct route_map_index *index, const char *command, const char *arg) { @@ -133,7 +133,7 @@ ripng_route_set_delete (struct vty *vty, struct route_map_index *index, /* `match metric METRIC' */ /* Match function return 1 if match is success else return zero. */ -route_map_result_t +static route_map_result_t route_match_metric (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -154,7 +154,7 @@ route_match_metric (void *rule, struct prefix *prefix, } /* Route map `match metric' match statement. `arg' is METRIC value */ -void * +static void * route_match_metric_compile (const char *arg) { u_int32_t *metric; @@ -170,14 +170,14 @@ route_match_metric_compile (const char *arg) } /* Free route map's compiled `match metric' value. */ -void +static void route_match_metric_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); } /* Route map commands for metric matching. */ -struct route_map_rule_cmd route_match_metric_cmd = +static struct route_map_rule_cmd route_match_metric_cmd = { "metric", route_match_metric, @@ -187,7 +187,7 @@ struct route_map_rule_cmd route_match_metric_cmd = /* `match interface IFNAME' */ /* Match function return 1 if match is success else return zero. */ -route_map_result_t +static route_map_result_t route_match_interface (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -214,19 +214,19 @@ route_match_interface (void *rule, struct prefix *prefix, } /* Route map `match interface' match statement. `arg' is IFNAME value */ -void * +static void * route_match_interface_compile (const char *arg) { return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg); } -void +static void route_match_interface_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); } -struct route_map_rule_cmd route_match_interface_cmd = +static struct route_map_rule_cmd route_match_interface_cmd = { "interface", route_match_interface, @@ -236,7 +236,7 @@ struct route_map_rule_cmd route_match_interface_cmd = /* `match tag TAG' */ /* Match function return 1 if match is success else return zero. */ -route_map_result_t +static route_map_result_t route_match_tag (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -258,7 +258,7 @@ route_match_tag (void *rule, struct prefix *prefix, } /* Route map `match tag' match statement. `arg' is TAG value */ -void * +static void * route_match_tag_compile (const char *arg) { u_short *tag; @@ -270,14 +270,14 @@ route_match_tag_compile (const char *arg) } /* Free route map's compiled `match tag' value. */ -void +static void route_match_tag_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); } /* Route map commands for tag matching. */ -struct route_map_rule_cmd route_match_tag_cmd = +static struct route_map_rule_cmd route_match_tag_cmd = { "tag", route_match_tag, @@ -288,7 +288,7 @@ struct route_map_rule_cmd route_match_tag_cmd = /* `set metric METRIC' */ /* Set metric to attribute. */ -route_map_result_t +static route_map_result_t route_set_metric (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -318,7 +318,7 @@ route_set_metric (void *rule, struct prefix *prefix, } /* set metric compilation. */ -void * +static void * route_set_metric_compile (const char *arg) { int len; @@ -371,13 +371,13 @@ route_set_metric_compile (const char *arg) } /* Free route map's compiled `set metric' value. */ -void +static void route_set_metric_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); } -struct route_map_rule_cmd route_set_metric_cmd = +static struct route_map_rule_cmd route_set_metric_cmd = { "metric", route_set_metric, @@ -388,7 +388,7 @@ struct route_map_rule_cmd route_set_metric_cmd = /* `set ipv6 next-hop local IP_ADDRESS' */ /* Set nexthop to object. ojbect must be pointer to struct attr. */ -route_map_result_t +static route_map_result_t route_set_ipv6_nexthop_local (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -410,7 +410,7 @@ route_set_ipv6_nexthop_local (void *rule, struct prefix *prefix, /* Route map `ipv6 nexthop local' compile function. Given string is converted to struct in6_addr structure. */ -void * +static void * route_set_ipv6_nexthop_local_compile (const char *arg) { int ret; @@ -430,14 +430,14 @@ route_set_ipv6_nexthop_local_compile (const char *arg) } /* Free route map's compiled `ipv6 nexthop local' value. */ -void +static void route_set_ipv6_nexthop_local_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); } /* Route map commands for ipv6 nexthop local set. */ -struct route_map_rule_cmd route_set_ipv6_nexthop_local_cmd = +static struct route_map_rule_cmd route_set_ipv6_nexthop_local_cmd = { "ipv6 next-hop local", route_set_ipv6_nexthop_local, @@ -448,7 +448,7 @@ struct route_map_rule_cmd route_set_ipv6_nexthop_local_cmd = /* `set tag TAG' */ /* Set tag to object. ojbect must be pointer to struct attr. */ -route_map_result_t +static route_map_result_t route_set_tag (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -470,7 +470,7 @@ route_set_tag (void *rule, struct prefix *prefix, /* Route map `tag' compile function. Given string is converted to u_short. */ -void * +static void * route_set_tag_compile (const char *arg) { u_short *tag; @@ -482,14 +482,14 @@ route_set_tag_compile (const char *arg) } /* Free route map's compiled `ip nexthop' value. */ -void +static void route_set_tag_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); } /* Route map commands for tag set. */ -struct route_map_rule_cmd route_set_tag_cmd = +static struct route_map_rule_cmd route_set_tag_cmd = { "tag", route_set_tag, diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c index 1f9bee0c8..62185c0af 100644 --- a/ripngd/ripng_zebra.c +++ b/ripngd/ripng_zebra.c @@ -89,7 +89,7 @@ ripng_zebra_ipv6_delete (struct prefix_ipv6 *p, struct in6_addr *nexthop, } /* Zebra route add and delete treatment. */ -int +static int ripng_zebra_read_ipv6 (int command, struct zclient *zclient, zebra_size_t length) { @@ -143,12 +143,12 @@ ripng_zebra_read_ipv6 (int command, struct zclient *zclient, } void -ripng_zclient_reset () +ripng_zclient_reset (void) { zclient_reset (zclient); } -int +static int ripng_redistribute_unset (int type) { if (! zclient->redist[type]) @@ -170,14 +170,14 @@ ripng_redistribute_check (int type) return (zclient->redist[type]); } -void +static void ripng_redistribute_metric_set (int type, int metric) { ripng->route_map[type].metric_config = 1; ripng->route_map[type].metric = metric; } -int +static int ripng_redistribute_metric_unset (int type) { ripng->route_map[type].metric_config = 0; @@ -185,7 +185,7 @@ ripng_redistribute_metric_unset (int type) return 0; } -void +static void ripng_redistribute_routemap_set (int type, const char *name) { if (ripng->route_map[type].name) @@ -195,7 +195,7 @@ ripng_redistribute_routemap_set (int type, const char *name) ripng->route_map[type].map = route_map_lookup_by_name (name); } -void +static void ripng_redistribute_routemap_unset (int type) { if (ripng->route_map[type].name) @@ -520,7 +520,7 @@ ripng_redistribute_write (struct vty *vty, int config_mode) } /* RIPng configuration write function. */ -int +static int zebra_config_write (struct vty *vty) { if (! zclient->enable) diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index a8277fe23..5e9bfc543 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -73,7 +73,7 @@ struct ripng_nexthop struct in6_addr address; }; -int +static int ripng_route_rte (struct ripng_info *rinfo) { return (rinfo->type == ZEBRA_ROUTE_RIPNG && rinfo->sub_type == RIPNG_ROUTE_RTE); @@ -97,7 +97,7 @@ ripng_info_free (struct ripng_info *rinfo) } /* Create ripng socket. */ -int +static int ripng_make_socket (void) { int ret; @@ -222,7 +222,7 @@ ripng_send_packet (caddr_t buf, int bufsize, struct sockaddr_in6 *to, } /* Receive UDP RIPng packet from socket. */ -int +static int ripng_recv_packet (int sock, u_char *buf, int bufsize, struct sockaddr_in6 *from, unsigned int *ifindex, int *hoplimit) @@ -318,7 +318,7 @@ ripng_packet_dump (struct ripng_packet *packet, int size, const char *sndrcv) } /* RIPng next hop address RTE (Route Table Entry). */ -void +static void ripng_nexthop_rte (struct rte *rte, struct sockaddr_in6 *from, struct ripng_nexthop *nexthop) @@ -377,7 +377,7 @@ ripng_nexthop_rte (struct rte *rte, } /* If ifp has same link-local address then return 1. */ -int +static int ripng_lladdr_check (struct interface *ifp, struct in6_addr *addr) { struct listnode *node; @@ -397,7 +397,7 @@ ripng_lladdr_check (struct interface *ifp, struct in6_addr *addr) } /* RIPng route garbage collect timer. */ -int +static int ripng_garbage_collect (struct thread *t) { struct ripng_info *rinfo; @@ -423,7 +423,7 @@ ripng_garbage_collect (struct thread *t) } /* Timeout RIPng routes. */ -int +static int ripng_timeout (struct thread *t) { struct ripng_info *rinfo; @@ -460,7 +460,7 @@ ripng_timeout (struct thread *t) return 0; } -void +static void ripng_timeout_update (struct ripng_info *rinfo) { if (rinfo->metric != RIPNG_METRIC_INFINITY) @@ -470,7 +470,7 @@ ripng_timeout_update (struct ripng_info *rinfo) } } -int +static int ripng_incoming_filter (struct prefix_ipv6 *p, struct ripng_interface *ri) { struct distribute *dist; @@ -541,7 +541,7 @@ ripng_incoming_filter (struct prefix_ipv6 *p, struct ripng_interface *ri) return 0; } -int +static int ripng_outgoing_filter (struct prefix_ipv6 *p, struct ripng_interface *ri) { struct distribute *dist; @@ -612,7 +612,7 @@ ripng_outgoing_filter (struct prefix_ipv6 *p, struct ripng_interface *ri) } /* Process RIPng route according to RFC2080. */ -void +static void ripng_route_process (struct rte *rte, struct sockaddr_in6 *from, struct ripng_nexthop *ripng_nexthop, struct interface *ifp) @@ -1100,7 +1100,7 @@ ripng_redistribute_withdraw (int type) } /* RIP routing information. */ -void +static void ripng_response_process (struct ripng_packet *packet, int size, struct sockaddr_in6 *from, struct interface *ifp, int hoplimit) @@ -1233,7 +1233,7 @@ ripng_response_process (struct ripng_packet *packet, int size, } /* Response to request message. */ -void +static void ripng_request_process (struct ripng_packet *packet,int size, struct sockaddr_in6 *from, struct interface *ifp) { @@ -1320,7 +1320,7 @@ ripng_request_process (struct ripng_packet *packet,int size, } /* First entry point of reading RIPng packet. */ -int +static int ripng_read (struct thread *thread) { int len; @@ -1410,8 +1410,8 @@ ripng_read (struct thread *thread) } /* Walk down the RIPng routing table then clear changed flag. */ -void -ripng_clear_changed_flag () +static void +ripng_clear_changed_flag (void) { struct route_node *rp; struct ripng_info *rinfo; @@ -1424,7 +1424,7 @@ ripng_clear_changed_flag () /* Regular update of RIPng route. Send all routing formation to RIPng enabled interface. */ -int +static int ripng_update (struct thread *t) { struct listnode *node; @@ -1484,7 +1484,7 @@ ripng_update (struct thread *t) } /* Triggered update interval timer. */ -int +static int ripng_triggered_interval (struct thread *t) { ripng->t_triggered_interval = NULL; @@ -1813,8 +1813,8 @@ ripng_output_process (struct interface *ifp, struct sockaddr_in6 *to, } /* Create new RIPng instance and set it to global variable. */ -int -ripng_create () +static int +ripng_create (void) { /* ripng should be NULL. */ assert (ripng == NULL); @@ -1880,7 +1880,7 @@ ripng_request (struct interface *ifp) } -int +static int ripng_update_jitter (int time) { return ((rand () % (time + 1)) - (time / 2)); @@ -1949,7 +1949,7 @@ ripng_vty_out_uptime (struct vty *vty, struct ripng_info *rinfo) } } -char * +static char * ripng_route_subtype_print (struct ripng_info *rinfo) { static char str[3]; @@ -2102,8 +2102,6 @@ DEFUN (show_ipv6_ripng_status, { struct listnode *node; struct interface *ifp; - int ripng_network_write (struct vty *, int); - void ripng_redistribute_write (struct vty *, int); if (! ripng) return CMD_SUCCESS; @@ -2607,7 +2605,7 @@ DEFUN (no_ripng_default_information_originate, } /* RIPng configuration write function. */ -int +static int ripng_config_write (struct vty *vty) { int ripng_network_write (struct vty *, int); @@ -2692,7 +2690,7 @@ struct cmd_node cmd_ripng_node = 1, }; -void +static void ripng_distribute_update (struct distribute *dist) { struct interface *ifp; @@ -2765,7 +2763,7 @@ ripng_distribute_update_interface (struct interface *ifp) } /* Update all interface's distribute list. */ -void +static void ripng_distribute_update_all (struct prefix_list *notused) { struct interface *ifp; @@ -2775,7 +2773,7 @@ ripng_distribute_update_all (struct prefix_list *notused) ripng_distribute_update_interface (ifp); } -void +static void ripng_distribute_update_all_wrapper (struct access_list *notused) { ripng_distribute_update_all(NULL); @@ -2878,7 +2876,7 @@ ripng_reset () ripng_zclient_reset (); } -void +static void ripng_if_rmap_update (struct if_rmap *if_rmap) { struct interface *ifp; @@ -2924,7 +2922,7 @@ ripng_if_rmap_update_interface (struct interface *ifp) ripng_if_rmap_update (if_rmap); } -void +static void ripng_routemap_update_redistribute (void) { int i; @@ -2940,7 +2938,7 @@ ripng_routemap_update_redistribute (void) } } -void +static void ripng_routemap_update (const char *unused) { struct interface *ifp; diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h index b478e9bc3..ab06d81bf 100644 --- a/ripngd/ripngd.h +++ b/ripngd/ripngd.h @@ -23,6 +23,9 @@ #ifndef _ZEBRA_RIPNG_RIPNGD_H #define _ZEBRA_RIPNG_RIPNGD_H +#include +#include + /* RIPng version and port number. */ #define RIPNG_V1 1 #define RIPNG_PORT_DEFAULT 521 @@ -340,60 +343,79 @@ extern struct ripng *ripng; extern struct thread_master *master; /* Prototypes. */ -void ripng_init (); -void ripng_reset (); -void ripng_clean (); -void ripng_clean_network (); -void ripng_interface_clean (); -void ripng_interface_reset (); -void ripng_passive_interface_clean (); -void ripng_if_init (); -void ripng_route_map_init (); -void ripng_route_map_reset (); -void ripng_terminate (); +extern void ripng_init (void); +extern void ripng_reset (void); +extern void ripng_clean (void); +extern void ripng_clean_network (void); +extern void ripng_interface_clean (void); +extern void ripng_interface_reset (void); +extern void ripng_passive_interface_clean (void); +extern void ripng_if_init (void); +extern void ripng_route_map_init (void); +extern void ripng_route_map_reset (void); +extern void ripng_terminate (void); /* zclient_init() is done by ripng_zebra.c:zebra_init() */ -void zebra_init (); -void ripng_zclient_start (); -void ripng_zclient_reset (); -void ripng_offset_init (); - -int config_write_ripng_offset_list (struct vty *); - -void ripng_peer_init (); -void ripng_peer_update (struct sockaddr_in6 *, u_char); -void ripng_peer_bad_route (struct sockaddr_in6 *); -void ripng_peer_bad_packet (struct sockaddr_in6 *); -void ripng_peer_display (struct vty *); -struct ripng_peer *ripng_peer_lookup (struct in6_addr *); -struct ripng_peer *ripng_peer_lookup_next (struct in6_addr *); - -int ripng_offset_list_apply_in (struct prefix_ipv6 *, struct interface *, u_char *); -int ripng_offset_list_apply_out (struct prefix_ipv6 *, struct interface *, u_char *); -void ripng_offset_clean (); - -struct ripng_info * ripng_info_new (); -void ripng_info_free (struct ripng_info *rinfo); -void ripng_event (enum ripng_event, int); -int ripng_request (struct interface *ifp); -void ripng_redistribute_add (int, int, struct prefix_ipv6 *, unsigned int, - struct in6_addr *); -void ripng_redistribute_delete (int, int, struct prefix_ipv6 *, unsigned int); -void ripng_redistribute_withdraw (int type); - -void ripng_distribute_update_interface (struct interface *); -void ripng_if_rmap_update_interface (struct interface *); - -void ripng_zebra_ipv6_add (struct prefix_ipv6 *p, struct in6_addr *nexthop, unsigned int ifindex, u_char metric); -void ripng_zebra_ipv6_delete (struct prefix_ipv6 *p, struct in6_addr *nexthop, unsigned int ifindex); - -void ripng_redistribute_clean (); - -int ripng_write_rte (int num, struct stream *s, struct prefix_ipv6 *p, - struct in6_addr *nexthop, u_int16_t tag, u_char metric); -int ripng_send_packet (caddr_t buf, int bufsize, struct sockaddr_in6 *to, - struct interface *ifp); - -void ripng_packet_dump (struct ripng_packet *packet, int size, const char *sndrcv); - +extern void zebra_init (void); +extern void ripng_zclient_start (void); +extern void ripng_zclient_reset (void); +extern void ripng_offset_init (void); + +extern int config_write_ripng_offset_list (struct vty *); + +extern void ripng_peer_init (void); +extern void ripng_peer_update (struct sockaddr_in6 *, u_char); +extern void ripng_peer_bad_route (struct sockaddr_in6 *); +extern void ripng_peer_bad_packet (struct sockaddr_in6 *); +extern void ripng_peer_display (struct vty *); +extern struct ripng_peer *ripng_peer_lookup (struct in6_addr *); +extern struct ripng_peer *ripng_peer_lookup_next (struct in6_addr *); + +extern int ripng_offset_list_apply_in (struct prefix_ipv6 *, + struct interface *, u_char *); +extern int ripng_offset_list_apply_out (struct prefix_ipv6 *, + struct interface *, u_char *); +extern void ripng_offset_clean (void); + +extern struct ripng_info * ripng_info_new (void); +extern void ripng_info_free (struct ripng_info *rinfo); +extern void ripng_event (enum ripng_event, int); +extern int ripng_request (struct interface *ifp); +extern void ripng_redistribute_add (int, int, struct prefix_ipv6 *, + unsigned int, struct in6_addr *); +extern void ripng_redistribute_delete (int, int, struct prefix_ipv6 *, + unsigned int); +extern void ripng_redistribute_withdraw (int type); + +extern void ripng_distribute_update_interface (struct interface *); +extern void ripng_if_rmap_update_interface (struct interface *); + +extern void ripng_zebra_ipv6_add (struct prefix_ipv6 *p, + struct in6_addr *nexthop, + unsigned int ifindex, u_char metric); +extern void ripng_zebra_ipv6_delete (struct prefix_ipv6 *p, + struct in6_addr *nexthop, + unsigned int ifindex); + +extern void ripng_redistribute_clean (void); +extern int ripng_redistribute_check (int); +extern void ripng_redistribute_write (struct vty *, int); + +extern int ripng_write_rte (int num, struct stream *s, struct prefix_ipv6 *p, + struct in6_addr *nexthop, + u_int16_t tag, u_char metric); +extern int ripng_send_packet (caddr_t buf, int bufsize, + struct sockaddr_in6 *to, struct interface *ifp); + +extern void ripng_packet_dump (struct ripng_packet *packet, int size, + const char *sndrcv); + +extern int ripng_interface_up (int command, struct zclient *, zebra_size_t); +extern int ripng_interface_down (int command, struct zclient *, zebra_size_t); +extern int ripng_interface_add (int command, struct zclient *, zebra_size_t); +extern int ripng_interface_delete (int command, struct zclient *, zebra_size_t); +extern int ripng_interface_address_add (int command, struct zclient *, zebra_size_t); +extern int ripng_interface_address_delete (int command, struct zclient *, zebra_size_t); + +extern int ripng_network_write (struct vty *, int); #endif /* _ZEBRA_RIPNG_RIPNGD_H */ -- 2.39.5