From 4dadc291e56195886fd047690ded9686f4e013fa Mon Sep 17 00:00:00 2001 From: paul Date: Fri, 6 May 2005 21:37:42 +0000 Subject: [PATCH] 2005-05-06 Paul Jakma * (general) extern and static qualifiers added. unspecified arguments in definitions fixed, typically they should be 'void'. function casts added for callbacks. Guards added to headers which lacked them. Proper headers included rather than relying on incomplete definitions. gcc noreturn function attribute where appropriate. * ospf_opaque.c: remove the private definition of ospf_lsa's ospf_lsa_refresh_delay. * ospf_lsa.h: export ospf_lsa_refresh_delay * ospf_packet.c: (ospf_make_md5_digest) make *auth_key const, correct thing to do - removes need for the casts later. * ospf_vty.c: Use vty.h's VTY_GET_INTEGER rather than ospf_vty's home-brewed versions, shuts up several warnings. * ospf_vty.h: remove VTY_GET_UINT32. VTY_GET_IPV4_ADDRESS and VTY_GET_IPV4_PREFIX moved to lib/vty.h. * ospf_zebra.c: (ospf_distribute_list_update_timer) hacky overloading of the THREAD_ARG pointer should at least use uintptr_t. --- ospfd/ChangeLog | 23 +++++++ ospfd/ospf_abr.c | 75 +++++++++++---------- ospfd/ospf_abr.h | 55 +++++++++------- ospfd/ospf_api.h | 98 ++++++++++++++-------------- ospfd/ospf_apiserver.c | 12 ++-- ospfd/ospf_apiserver.h | 112 ++++++++++++++++---------------- ospfd/ospf_asbr.c | 2 +- ospfd/ospf_asbr.h | 28 ++++---- ospfd/ospf_ase.c | 14 ++-- ospfd/ospf_ase.h | 29 +++++---- ospfd/ospf_dump.c | 28 ++++---- ospfd/ospf_dump.h | 20 +++--- ospfd/ospf_flood.c | 6 +- ospfd/ospf_flood.h | 80 ++++++++++++----------- ospfd/ospf_ia.c | 18 +++--- ospfd/ospf_ia.h | 5 +- ospfd/ospf_interface.c | 18 +++--- ospfd/ospf_interface.h | 112 +++++++++++++++++--------------- ospfd/ospf_ism.c | 42 ++++++------ ospfd/ospf_ism.h | 16 ++--- ospfd/ospf_lsa.c | 80 +++++++++++------------ ospfd/ospf_lsa.h | 144 ++++++++++++++++++++--------------------- ospfd/ospf_lsdb.c | 2 +- ospfd/ospf_lsdb.h | 32 ++++----- ospfd/ospf_main.c | 8 +-- ospfd/ospf_neighbor.c | 2 +- ospfd/ospf_neighbor.h | 37 +++++------ ospfd/ospf_network.h | 16 +++-- ospfd/ospf_nsm.c | 36 +++++------ ospfd/ospf_nsm.h | 39 ++++++----- ospfd/ospf_opaque.c | 2 - ospfd/ospf_opaque.h | 36 +++++++---- ospfd/ospf_packet.c | 66 +++++++++---------- ospfd/ospf_packet.h | 63 +++++++++--------- ospfd/ospf_route.c | 12 ++-- ospfd/ospf_route.h | 76 +++++++++++----------- ospfd/ospf_routemap.c | 60 +++++++++-------- ospfd/ospf_snmp.h | 8 +-- ospfd/ospf_spf.c | 42 ++++++------ ospfd/ospf_spf.h | 4 +- ospfd/ospf_te.c | 2 +- ospfd/ospf_vty.c | 116 ++++++++++++++++----------------- ospfd/ospf_vty.h | 42 ++---------- ospfd/ospf_zebra.c | 32 ++++----- ospfd/ospf_zebra.h | 52 ++++++++------- ospfd/ospfd.c | 33 +++++----- ospfd/ospfd.h | 113 +++++++++++++++++--------------- 47 files changed, 995 insertions(+), 953 deletions(-) diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog index 3916e57df..d8ec676fc 100644 --- a/ospfd/ChangeLog +++ b/ospfd/ChangeLog @@ -1,3 +1,26 @@ +2005-05-06 Paul Jakma + + * (general) extern and static qualifiers added. + unspecified arguments in definitions fixed, typically they should + be 'void'. + function casts added for callbacks. + Guards added to headers which lacked them. + Proper headers included rather than relying on incomplete + definitions. + gcc noreturn function attribute where appropriate. + * ospf_opaque.c: remove the private definition of ospf_lsa's + ospf_lsa_refresh_delay. + * ospf_lsa.h: export ospf_lsa_refresh_delay + * ospf_packet.c: (ospf_make_md5_digest) make *auth_key const, + correct thing to do - removes need for the casts later. + * ospf_vty.c: Use vty.h's VTY_GET_INTEGER rather than ospf_vty's + home-brewed versions, shuts up several warnings. + * ospf_vty.h: remove VTY_GET_UINT32. VTY_GET_IPV4_ADDRESS and + VTY_GET_IPV4_PREFIX moved to lib/vty.h. + * ospf_zebra.c: (ospf_distribute_list_update_timer) hacky + overloading of the THREAD_ARG pointer should at least use + uintptr_t. + 2005-04-15 Zhipeng Gong * ospf_abr.c: (ospf_abr_announce_network_to_area) dont forget diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c index b63a803b9..f12dd348f 100644 --- a/ospfd/ospf_abr.c +++ b/ospfd/ospf_abr.c @@ -51,7 +51,7 @@ #include "ospfd/ospf_zebra.h" #include "ospfd/ospf_dump.h" -struct ospf_area_range * +static struct ospf_area_range * ospf_area_range_new (struct prefix_ipv4 *p) { struct ospf_area_range *range; @@ -64,13 +64,13 @@ ospf_area_range_new (struct prefix_ipv4 *p) return range; } -void +static void ospf_area_range_free (struct ospf_area_range *range) { XFREE (MTYPE_OSPF_AREA_RANGE, range); } -void +static void ospf_area_range_add (struct ospf_area *area, struct ospf_area_range *range) { struct route_node *rn; @@ -87,7 +87,7 @@ ospf_area_range_add (struct ospf_area *area, struct ospf_area_range *range) rn->info = range; } -void +static void ospf_area_range_delete (struct ospf_area *area, struct ospf_area_range *range) { struct route_node *rn; @@ -156,7 +156,7 @@ ospf_area_range_lookup_next (struct ospf_area *area, return NULL; } -struct ospf_area_range * +static struct ospf_area_range * ospf_area_range_match (struct ospf_area *area, struct prefix_ipv4 *p) { struct route_node *node; @@ -190,7 +190,7 @@ ospf_area_range_active (struct ospf_area_range *range) return range->specifics; } -int +static int ospf_area_actively_attached (struct ospf_area *area) { return area->act_ints; @@ -349,7 +349,7 @@ ospf_act_bb_connection (struct ospf *ospf) } /* Determine whether this router is elected translator or not for area */ -int +static int ospf_abr_nssa_am_elected (struct ospf_area *area) { struct route_node *rn; @@ -404,7 +404,7 @@ ospf_abr_nssa_am_elected (struct ospf_area *area) /* Check NSSA ABR status * assumes there are nssa areas */ -void +static void ospf_abr_nssa_check_status (struct ospf *ospf) { struct ospf_area *area; @@ -557,7 +557,7 @@ ospf_check_abr_status (struct ospf *ospf) } } -void +static void ospf_abr_update_aggregate (struct ospf_area_range *range, struct ospf_route *or) { @@ -601,7 +601,7 @@ set_metric (struct ospf_lsa *lsa, u_int32_t metric) memcpy(header->metric, mp, 3); } -int +static int ospf_abr_check_nssa_range (struct prefix_ipv4 *p, u_int32_t cost, struct ospf_area *area) { @@ -611,7 +611,7 @@ ospf_abr_check_nssa_range (struct prefix_ipv4 *p, u_int32_t cost, } /* ospf_abr_translate_nssa */ -int +static int ospf_abr_translate_nssa (struct ospf_area *area, struct ospf_lsa *lsa) { /* Incoming Type-7 or later aggregated Type-7 @@ -700,14 +700,14 @@ ospf_abr_translate_nssa (struct ospf_area *area, struct ospf_lsa *lsa) return 0; } -void +static void ospf_abr_translate_nssa_range (struct prefix_ipv4 *p, u_int32_t cost) { /* The Type-7 is created from the aggregated prefix and forwarded for lsa installation and flooding... to be added... */ } -void +static void ospf_abr_announce_network_to_area (struct prefix_ipv4 *p, u_int32_t cost, struct ospf_area *area) { @@ -770,7 +770,7 @@ ospf_abr_announce_network_to_area (struct prefix_ipv4 *p, u_int32_t cost, zlog_debug ("ospf_abr_announce_network_to_area(): Stop"); } -int +static int ospf_abr_nexthops_belong_to_area (struct ospf_route *or, struct ospf_area *area) { @@ -789,7 +789,7 @@ ospf_abr_nexthops_belong_to_area (struct ospf_route *or, return 0; } -int +static int ospf_abr_should_accept (struct prefix_ipv4 *p, struct ospf_area *area) { if (IMPORT_NAME (area)) @@ -805,7 +805,7 @@ ospf_abr_should_accept (struct prefix_ipv4 *p, struct ospf_area *area) return 1; } -int +static int ospf_abr_plist_in_check (struct ospf_area *area, struct ospf_route *or, struct prefix_ipv4 *p) { @@ -821,7 +821,7 @@ ospf_abr_plist_in_check (struct ospf_area *area, struct ospf_route *or, return 1; } -int +static int ospf_abr_plist_out_check (struct ospf_area *area, struct ospf_route *or, struct prefix_ipv4 *p) { @@ -837,7 +837,7 @@ ospf_abr_plist_out_check (struct ospf_area *area, struct ospf_route *or, return 1; } -void +static void ospf_abr_announce_network (struct ospf *ospf, struct prefix_ipv4 *p, struct ospf_route *or) { @@ -916,7 +916,7 @@ ospf_abr_announce_network (struct ospf *ospf, } } -int +static int ospf_abr_should_announce (struct ospf *ospf, struct prefix_ipv4 *p, struct ospf_route *or) { @@ -939,7 +939,7 @@ ospf_abr_should_announce (struct ospf *ospf, return 1; } -void +static void ospf_abr_process_nssa_translates (struct ospf *ospf) { /* Scan through all NSSA_LSDB records for all areas; @@ -977,7 +977,7 @@ ospf_abr_process_nssa_translates (struct ospf *ospf) } -void +static void ospf_abr_process_network_rt (struct ospf *ospf, struct route_table *rt) { @@ -1075,7 +1075,7 @@ ospf_abr_process_network_rt (struct ospf *ospf, zlog_debug ("ospf_abr_process_network_rt(): Stop"); } -void +static void ospf_abr_announce_rtr_to_area (struct prefix_ipv4 *p, u_int32_t cost, struct ospf_area *area) { @@ -1134,7 +1134,7 @@ ospf_abr_announce_rtr_to_area (struct prefix_ipv4 *p, u_int32_t cost, } -void +static void ospf_abr_announce_rtr (struct ospf *ospf, struct prefix_ipv4 *p, struct ospf_route *or) { @@ -1187,7 +1187,7 @@ ospf_abr_announce_rtr (struct ospf *ospf, zlog_debug ("ospf_abr_announce_rtr(): Stop"); } -void +static void ospf_abr_process_router_rt (struct ospf *ospf, struct route_table *rt) { struct ospf_route *or; @@ -1287,7 +1287,7 @@ ospf_abr_process_router_rt (struct ospf *ospf, struct route_table *rt) zlog_debug ("ospf_abr_process_router_rt(): Stop"); } -void +static void ospf_abr_unapprove_translates (struct ospf *ospf) /* For NSSA Translations */ { struct ospf_lsa *lsa; @@ -1313,7 +1313,7 @@ ospf_abr_unapprove_translates (struct ospf *ospf) /* For NSSA Translations */ zlog_debug ("ospf_abr_unapprove_translates(): Stop"); } -void +static void ospf_abr_unapprove_summaries (struct ospf *ospf) { struct listnode *node; @@ -1355,7 +1355,7 @@ ospf_abr_unapprove_summaries (struct ospf *ospf) zlog_debug ("ospf_abr_unapprove_summaries(): Stop"); } -void +static void ospf_abr_prepare_aggregates (struct ospf *ospf) { struct listnode *node; @@ -1380,7 +1380,7 @@ ospf_abr_prepare_aggregates (struct ospf *ospf) zlog_debug ("ospf_abr_prepare_aggregates(): Stop"); } -void +static void ospf_abr_announce_aggregates (struct ospf *ospf) { struct ospf_area *area, *ar; @@ -1461,7 +1461,7 @@ ospf_abr_announce_aggregates (struct ospf *ospf) zlog_debug ("ospf_abr_announce_aggregates(): Stop"); } -void +static void ospf_abr_send_nssa_aggregates (struct ospf *ospf) /* temporarily turned off */ { struct listnode *node; /*, n; */ @@ -1530,7 +1530,7 @@ ospf_abr_send_nssa_aggregates (struct ospf *ospf) /* temporarily turned off */ zlog_debug ("ospf_abr_send_nssa_aggregates(): Stop"); } -void +static void ospf_abr_announce_nssa_defaults (struct ospf *ospf) /* By ABR-Translator */ { struct listnode *node; @@ -1566,7 +1566,7 @@ ospf_abr_announce_nssa_defaults (struct ospf *ospf) /* By ABR-Translator */ } } -void +static void ospf_abr_announce_stub_defaults (struct ospf *ospf) { struct listnode *node; @@ -1608,7 +1608,7 @@ ospf_abr_announce_stub_defaults (struct ospf *ospf) zlog_debug ("ospf_abr_announce_stub_defaults(): Stop"); } -int +static int ospf_abr_remove_unapproved_translates_apply (struct ospf *ospf, struct ospf_lsa *lsa) { @@ -1627,7 +1627,7 @@ ospf_abr_remove_unapproved_translates_apply (struct ospf *ospf, return 0; } -void +static void ospf_abr_remove_unapproved_translates (struct ospf *ospf) { struct route_node *rn; @@ -1645,7 +1645,7 @@ ospf_abr_remove_unapproved_translates (struct ospf *ospf) zlog_debug ("ospf_abr_remove_unapproved_translates(): Stop"); } -void +static void ospf_abr_remove_unapproved_summaries (struct ospf *ospf) { struct listnode *node; @@ -1677,7 +1677,7 @@ ospf_abr_remove_unapproved_summaries (struct ospf *ospf) zlog_debug ("ospf_abr_remove_unapproved_summaries(): Stop"); } -void +static void ospf_abr_manage_discard_routes (struct ospf *ospf) { struct listnode *node, *nnode; @@ -1723,7 +1723,7 @@ ospf_abr_manage_discard_routes (struct ospf *ospf) For External Calculations, any NSSA areas use the Type-7 AREA-LSDB, any ABR-non-NSSA areas use the Type-5 GLOBAL-LSDB. */ -void +static void ospf_abr_nssa_task (struct ospf *ospf) /* called only if any_nssa */ { if (IS_DEBUG_OSPF_NSSA) @@ -1837,8 +1837,7 @@ ospf_abr_task (struct ospf *ospf) zlog_debug ("ospf_abr_task(): Stop"); } - -int +static int ospf_abr_task_timer (struct thread *thread) { struct ospf *ospf = THREAD_ARG (thread); diff --git a/ospfd/ospf_abr.h b/ospfd/ospf_abr.h index 11c0d9b1e..a85ec8461 100644 --- a/ospfd/ospf_abr.h +++ b/ospfd/ospf_abr.h @@ -56,29 +56,36 @@ struct ospf_area_range }; /* Prototypes. */ -struct ospf_area_range *ospf_area_range_lookup (struct ospf_area *, - struct prefix_ipv4 *); -struct ospf_area_range *ospf_some_area_range_match (struct prefix_ipv4 *); -struct ospf_area_range *ospf_area_range_lookup_next (struct ospf_area *, - struct in_addr *, int); -int ospf_area_range_set (struct ospf *, struct in_addr, struct prefix_ipv4 *, - int); -int ospf_area_range_cost_set (struct ospf *, struct in_addr, - struct prefix_ipv4 *, u_int32_t); -int ospf_area_range_unset (struct ospf *, struct in_addr, - struct prefix_ipv4 *); -int ospf_area_range_substitute_set (struct ospf *, struct in_addr, - struct prefix_ipv4 *, - struct prefix_ipv4 *); -int ospf_area_range_substitute_unset (struct ospf *, struct in_addr, - struct prefix_ipv4 *); -struct ospf_area_range *ospf_area_range_match_any (struct ospf *, - struct prefix_ipv4 *); -int ospf_area_range_active (struct ospf_area_range *); -int ospf_act_bb_connection (struct ospf *); - -void ospf_check_abr_status (struct ospf *); -void ospf_abr_task (struct ospf *); -void ospf_schedule_abr_task (struct ospf *); +extern struct ospf_area_range *ospf_area_range_lookup (struct ospf_area *, + struct prefix_ipv4 *); + +extern struct ospf_area_range *ospf_some_area_range_match (struct prefix_ipv4 + *); + +extern struct ospf_area_range *ospf_area_range_lookup_next (struct ospf_area + *, + struct in_addr *, + int); + +extern int ospf_area_range_set (struct ospf *, struct in_addr, + struct prefix_ipv4 *, int); +extern int ospf_area_range_cost_set (struct ospf *, struct in_addr, + struct prefix_ipv4 *, u_int32_t); +extern int ospf_area_range_unset (struct ospf *, struct in_addr, + struct prefix_ipv4 *); +extern int ospf_area_range_substitute_set (struct ospf *, struct in_addr, + struct prefix_ipv4 *, + struct prefix_ipv4 *); +extern int ospf_area_range_substitute_unset (struct ospf *, struct in_addr, + struct prefix_ipv4 *); +extern struct ospf_area_range *ospf_area_range_match_any (struct ospf *, + struct prefix_ipv4 + *); +extern int ospf_area_range_active (struct ospf_area_range *); +extern int ospf_act_bb_connection (struct ospf *); + +extern void ospf_check_abr_status (struct ospf *); +extern void ospf_abr_task (struct ospf *); +extern void ospf_schedule_abr_task (struct ospf *); #endif /* _ZEBRA_OSPF_ABR_H */ diff --git a/ospfd/ospf_api.h b/ospfd/ospf_api.h index 77e1b23f9..eb5ad0aae 100644 --- a/ospfd/ospf_api.h +++ b/ospfd/ospf_api.h @@ -65,13 +65,13 @@ struct msg }; /* Prototypes for generic messages. */ -struct msg *msg_new (u_char msgtype, void *msgbody, +extern struct msg *msg_new (u_char msgtype, void *msgbody, u_int32_t seqnum, u_int16_t msglen); -struct msg *msg_dup (struct msg *msg); -void msg_print (struct msg *msg); /* XXX debug only */ -void msg_free (struct msg *msg); +extern struct msg *msg_dup (struct msg *msg); +extern void msg_print (struct msg *msg); /* XXX debug only */ +extern void msg_free (struct msg *msg); struct msg *msg_read (int fd); -int msg_write (int fd, struct msg *msg); +extern int msg_write (int fd, struct msg *msg); /* For requests, the message sequence number is between MIN_SEQ and MAX_SEQ. For notifications, the sequence number is 0. */ @@ -79,8 +79,8 @@ int msg_write (int fd, struct msg *msg); #define MIN_SEQ 1 #define MAX_SEQ 2147483647 -void msg_set_seq (struct msg *msg, u_int32_t seqnr); -u_int32_t msg_get_seq (struct msg *msg); +extern void msg_set_seq (struct msg *msg, u_int32_t seqnr); +extern u_int32_t msg_get_seq (struct msg *msg); /* ----------------------------------------------------------- * Message fifo queues @@ -97,12 +97,12 @@ struct msg_fifo }; /* Prototype for message fifo queues. */ -struct msg_fifo *msg_fifo_new (); -void msg_fifo_push (struct msg_fifo *, struct msg *msg); -struct msg *msg_fifo_pop (struct msg_fifo *fifo); -struct msg *msg_fifo_head (struct msg_fifo *fifo); -void msg_fifo_flush (struct msg_fifo *fifo); -void msg_fifo_free (struct msg_fifo *fifo); +extern struct msg_fifo *msg_fifo_new (void); +extern void msg_fifo_push (struct msg_fifo *, struct msg *msg); +extern struct msg *msg_fifo_pop (struct msg_fifo *fifo); +extern struct msg *msg_fifo_head (struct msg_fifo *fifo); +extern void msg_fifo_flush (struct msg_fifo *fifo); +extern void msg_fifo_free (struct msg_fifo *fifo); /* ----------------------------------------------------------- * Specific message type and format definitions @@ -306,52 +306,56 @@ struct apimsg */ /* For debugging only. */ -void api_opaque_lsa_print (struct lsa_header *data); +extern void api_opaque_lsa_print (struct lsa_header *data); /* Messages sent by client */ -struct msg *new_msg_register_opaque_type (u_int32_t seqnum, u_char ltype, - u_char otype); -struct msg *new_msg_register_event (u_int32_t seqnum, - struct lsa_filter_type *filter); -struct msg *new_msg_sync_lsdb (u_int32_t seqnum, - struct lsa_filter_type *filter); -struct msg *new_msg_originate_request (u_int32_t seqnum, - struct in_addr ifaddr, - struct in_addr area_id, - struct lsa_header *data); -struct msg *new_msg_delete_request (u_int32_t seqnum, - struct in_addr area_id, - u_char lsa_type, - u_char opaque_type, u_int32_t opaque_id); +extern struct msg *new_msg_register_opaque_type (u_int32_t seqnum, + u_char ltype, u_char otype); +extern struct msg *new_msg_register_event (u_int32_t seqnum, + struct lsa_filter_type *filter); +extern struct msg *new_msg_sync_lsdb (u_int32_t seqnum, + struct lsa_filter_type *filter); +extern struct msg *new_msg_originate_request (u_int32_t seqnum, + struct in_addr ifaddr, + struct in_addr area_id, + struct lsa_header *data); +extern struct msg *new_msg_delete_request (u_int32_t seqnum, + struct in_addr area_id, + u_char lsa_type, + u_char opaque_type, + u_int32_t opaque_id); /* Messages sent by OSPF daemon */ -struct msg *new_msg_reply (u_int32_t seqnum, u_char rc); +extern struct msg *new_msg_reply (u_int32_t seqnum, u_char rc); -struct msg *new_msg_ready_notify (u_int32_t seqnr, u_char lsa_type, - u_char opaque_type, struct in_addr addr); +extern struct msg *new_msg_ready_notify (u_int32_t seqnr, u_char lsa_type, + u_char opaque_type, + struct in_addr addr); -struct msg *new_msg_new_if (u_int32_t seqnr, - struct in_addr ifaddr, struct in_addr area); +extern struct msg *new_msg_new_if (u_int32_t seqnr, + struct in_addr ifaddr, + struct in_addr area); -struct msg *new_msg_del_if (u_int32_t seqnr, struct in_addr ifaddr); +extern struct msg *new_msg_del_if (u_int32_t seqnr, struct in_addr ifaddr); -struct msg *new_msg_ism_change (u_int32_t seqnr, struct in_addr ifaddr, - struct in_addr area, u_char status); +extern struct msg *new_msg_ism_change (u_int32_t seqnr, struct in_addr ifaddr, + struct in_addr area, u_char status); -struct msg *new_msg_nsm_change (u_int32_t seqnr, struct in_addr ifaddr, - struct in_addr nbraddr, - struct in_addr router_id, u_char status); +extern struct msg *new_msg_nsm_change (u_int32_t seqnr, struct in_addr ifaddr, + struct in_addr nbraddr, + struct in_addr router_id, + u_char status); /* msgtype is MSG_LSA_UPDATE_NOTIFY or MSG_LSA_DELETE_NOTIFY */ -struct msg *new_msg_lsa_change_notify (u_char msgtype, - u_int32_t seqnum, - struct in_addr ifaddr, - struct in_addr area_id, - u_char is_self_originated, - struct lsa_header *data); +extern struct msg *new_msg_lsa_change_notify (u_char msgtype, + u_int32_t seqnum, + struct in_addr ifaddr, + struct in_addr area_id, + u_char is_self_originated, + struct lsa_header *data); /* string printing functions */ -const char *ospf_api_errname (int errcode); -const char *ospf_api_typename (int msgtype); +extern const char *ospf_api_errname (int errcode); +extern const char *ospf_api_typename (int msgtype); #endif /* _OSPF_API_H */ diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c index 59233c72c..f9df812c7 100644 --- a/ospfd/ospf_apiserver.c +++ b/ospfd/ospf_apiserver.c @@ -767,7 +767,7 @@ ospf_apiserver_accept (struct thread *thread) * ----------------------------------------------------------- */ -int +static int ospf_apiserver_send_msg (struct ospf_apiserver *apiserv, struct msg *msg) { struct msg_fifo *fifo; @@ -992,7 +992,7 @@ ospf_apiserver_unregister_opaque_type (struct ospf_apiserver *apiserv, } -int +static int apiserver_is_opaque_type_registered (struct ospf_apiserver *apiserv, u_char lsa_type, u_char opaque_type) { @@ -1268,7 +1268,7 @@ ospf_apiserver_handle_register_event (struct ospf_apiserver *apiserv, * ----------------------------------------------------------- */ -int +static int apiserver_sync_callback (struct ospf_lsa *lsa, void *p_arg, int int_arg) { struct ospf_apiserver *apiserv; @@ -1997,7 +1997,7 @@ out: } /* Flush self-originated opaque LSA */ -int +static int apiserver_flush_opaque_type_callback (struct ospf_lsa *lsa, void *p_arg, int int_arg) { @@ -2482,7 +2482,7 @@ ospf_apiserver_clients_notify_nsm_change (struct ospf_neighbor *nbr) msg_free (msg); } -void +static void apiserver_clients_lsa_change_notify (u_char msgtype, struct ospf_lsa *lsa) { struct msg *msg; @@ -2583,7 +2583,7 @@ apiserver_clients_lsa_change_notify (u_char msgtype, struct ospf_lsa *lsa) */ -int +static int apiserver_notify_clients_lsa (u_char msgtype, struct ospf_lsa *lsa) { struct msg *msg; diff --git a/ospfd/ospf_apiserver.h b/ospfd/ospf_apiserver.h index f4dc64740..9a8ae254e 100644 --- a/ospfd/ospf_apiserver.h +++ b/ospfd/ospf_apiserver.h @@ -87,19 +87,19 @@ enum event * ----------------------------------------------------------- */ -unsigned short ospf_apiserver_getport (void); -int ospf_apiserver_init (void); -void ospf_apiserver_term (void); -struct ospf_apiserver *ospf_apiserver_new (int fd_sync, int fd_async); -void ospf_apiserver_free (struct ospf_apiserver *apiserv); -void ospf_apiserver_event (enum event event, int fd, +extern unsigned short ospf_apiserver_getport (void); +extern int ospf_apiserver_init (void); +extern void ospf_apiserver_term (void); +extern struct ospf_apiserver *ospf_apiserver_new (int fd_sync, int fd_async); +extern void ospf_apiserver_free (struct ospf_apiserver *apiserv); +extern void ospf_apiserver_event (enum event event, int fd, struct ospf_apiserver *apiserv); -int ospf_apiserver_serv_sock_family (unsigned short port, int family); -int ospf_apiserver_accept (struct thread *thread); -int ospf_apiserver_read (struct thread *thread); -int ospf_apiserver_sync_write (struct thread *thread); -int ospf_apiserver_async_write (struct thread *thread); -int ospf_apiserver_send_reply (struct ospf_apiserver *apiserv, +extern int ospf_apiserver_serv_sock_family (unsigned short port, int family); +extern int ospf_apiserver_accept (struct thread *thread); +extern int ospf_apiserver_read (struct thread *thread); +extern int ospf_apiserver_sync_write (struct thread *thread); +extern int ospf_apiserver_async_write (struct thread *thread); +extern int ospf_apiserver_send_reply (struct ospf_apiserver *apiserv, u_int32_t seqnr, u_char rc); /* ----------------------------------------------------------- @@ -107,42 +107,42 @@ int ospf_apiserver_send_reply (struct ospf_apiserver *apiserv, * ----------------------------------------------------------- */ -int ospf_apiserver_lsa9_originator (void *arg); -int ospf_apiserver_lsa10_originator (void *arg); -int ospf_apiserver_lsa11_originator (void *arg); +extern int ospf_apiserver_lsa9_originator (void *arg); +extern int ospf_apiserver_lsa10_originator (void *arg); +extern int ospf_apiserver_lsa11_originator (void *arg); -void ospf_apiserver_clients_notify_all (struct msg *msg); +extern void ospf_apiserver_clients_notify_all (struct msg *msg); -void ospf_apiserver_clients_notify_ready_type9 (struct ospf_interface *oi); -void ospf_apiserver_clients_notify_ready_type10 (struct ospf_area *area); -void ospf_apiserver_clients_notify_ready_type11 (struct ospf *top); +extern void ospf_apiserver_clients_notify_ready_type9 (struct ospf_interface *oi); +extern void ospf_apiserver_clients_notify_ready_type10 (struct ospf_area *area); +extern void ospf_apiserver_clients_notify_ready_type11 (struct ospf *top); -void ospf_apiserver_clients_notify_new_if (struct ospf_interface *oi); -void ospf_apiserver_clients_notify_del_if (struct ospf_interface *oi); -void ospf_apiserver_clients_notify_ism_change (struct ospf_interface *oi); -void ospf_apiserver_clients_notify_nsm_change (struct ospf_neighbor *nbr); +extern void ospf_apiserver_clients_notify_new_if (struct ospf_interface *oi); +extern void ospf_apiserver_clients_notify_del_if (struct ospf_interface *oi); +extern void ospf_apiserver_clients_notify_ism_change (struct ospf_interface *oi); +extern void ospf_apiserver_clients_notify_nsm_change (struct ospf_neighbor *nbr); -int ospf_apiserver_is_ready_type9 (struct ospf_interface *oi); -int ospf_apiserver_is_ready_type10 (struct ospf_area *area); -int ospf_apiserver_is_ready_type11 (struct ospf *ospf); +extern int ospf_apiserver_is_ready_type9 (struct ospf_interface *oi); +extern int ospf_apiserver_is_ready_type10 (struct ospf_area *area); +extern int ospf_apiserver_is_ready_type11 (struct ospf *ospf); -void ospf_apiserver_notify_ready_type9 (struct ospf_apiserver *apiserv); -void ospf_apiserver_notify_ready_type10 (struct ospf_apiserver *apiserv); -void ospf_apiserver_notify_ready_type11 (struct ospf_apiserver *apiserv); +extern void ospf_apiserver_notify_ready_type9 (struct ospf_apiserver *apiserv); +extern void ospf_apiserver_notify_ready_type10 (struct ospf_apiserver *apiserv); +extern void ospf_apiserver_notify_ready_type11 (struct ospf_apiserver *apiserv); -int ospf_apiserver_handle_msg (struct ospf_apiserver *apiserv, +extern int ospf_apiserver_handle_msg (struct ospf_apiserver *apiserv, struct msg *msg); -int ospf_apiserver_handle_register_opaque_type (struct ospf_apiserver +extern int ospf_apiserver_handle_register_opaque_type (struct ospf_apiserver *apiserv, struct msg *msg); -int ospf_apiserver_handle_unregister_opaque_type (struct ospf_apiserver +extern int ospf_apiserver_handle_unregister_opaque_type (struct ospf_apiserver *apiserv, struct msg *msg); -int ospf_apiserver_handle_register_event (struct ospf_apiserver *apiserv, +extern int ospf_apiserver_handle_register_event (struct ospf_apiserver *apiserv, struct msg *msg); -int ospf_apiserver_handle_originate_request (struct ospf_apiserver *apiserv, +extern int ospf_apiserver_handle_originate_request (struct ospf_apiserver *apiserv, struct msg *msg); -int ospf_apiserver_handle_delete_request (struct ospf_apiserver *apiserv, +extern int ospf_apiserver_handle_delete_request (struct ospf_apiserver *apiserv, struct msg *msg); -int ospf_apiserver_handle_sync_lsdb (struct ospf_apiserver *apiserv, +extern int ospf_apiserver_handle_sync_lsdb (struct ospf_apiserver *apiserv, struct msg *msg); @@ -151,20 +151,20 @@ int ospf_apiserver_handle_sync_lsdb (struct ospf_apiserver *apiserv, * ----------------------------------------------------------- */ -int ospf_apiserver_register_opaque_type (struct ospf_apiserver *apiserver, +extern int ospf_apiserver_register_opaque_type (struct ospf_apiserver *apiserver, u_char lsa_type, u_char opaque_type); -int ospf_apiserver_unregister_opaque_type (struct ospf_apiserver *apiserver, +extern int ospf_apiserver_unregister_opaque_type (struct ospf_apiserver *apiserver, u_char lsa_type, u_char opaque_type); -struct ospf_lsa *ospf_apiserver_opaque_lsa_new (struct ospf_area *area, +extern struct ospf_lsa *ospf_apiserver_opaque_lsa_new (struct ospf_area *area, struct ospf_interface *oi, struct lsa_header *protolsa); -struct ospf_interface *ospf_apiserver_if_lookup_by_addr (struct in_addr +extern struct ospf_interface *ospf_apiserver_if_lookup_by_addr (struct in_addr address); -struct ospf_interface *ospf_apiserver_if_lookup_by_ifp (struct interface +extern struct ospf_interface *ospf_apiserver_if_lookup_by_ifp (struct interface *ifp); -int ospf_apiserver_originate1 (struct ospf_lsa *lsa); -void ospf_apiserver_flood_opaque_lsa (struct ospf_lsa *lsa); +extern int ospf_apiserver_originate1 (struct ospf_lsa *lsa); +extern void ospf_apiserver_flood_opaque_lsa (struct ospf_lsa *lsa); /* ----------------------------------------------------------- @@ -172,16 +172,16 @@ void ospf_apiserver_flood_opaque_lsa (struct ospf_lsa *lsa); * ----------------------------------------------------------- */ -int ospf_apiserver_new_if (struct interface *ifp); -int ospf_apiserver_del_if (struct interface *ifp); -void ospf_apiserver_ism_change (struct ospf_interface *oi, int old_status); -void ospf_apiserver_nsm_change (struct ospf_neighbor *nbr, int old_status); -void ospf_apiserver_config_write_router (struct vty *vty); -void ospf_apiserver_config_write_if (struct vty *vty, struct interface *ifp); -void ospf_apiserver_show_info (struct vty *vty, struct ospf_lsa *lsa); -int ospf_ospf_apiserver_lsa_originator (void *arg); -void ospf_apiserver_lsa_refresher (struct ospf_lsa *lsa); -void ospf_apiserver_flush_opaque_lsa (struct ospf_apiserver *apiserv, +extern int ospf_apiserver_new_if (struct interface *ifp); +extern int ospf_apiserver_del_if (struct interface *ifp); +extern void ospf_apiserver_ism_change (struct ospf_interface *oi, int old_status); +extern void ospf_apiserver_nsm_change (struct ospf_neighbor *nbr, int old_status); +extern void ospf_apiserver_config_write_router (struct vty *vty); +extern void ospf_apiserver_config_write_if (struct vty *vty, struct interface *ifp); +extern void ospf_apiserver_show_info (struct vty *vty, struct ospf_lsa *lsa); +extern int ospf_ospf_apiserver_lsa_originator (void *arg); +extern void ospf_apiserver_lsa_refresher (struct ospf_lsa *lsa); +extern void ospf_apiserver_flush_opaque_lsa (struct ospf_apiserver *apiserv, u_char lsa_type, u_char opaque_type); /* ----------------------------------------------------------- @@ -192,10 +192,10 @@ void ospf_apiserver_flush_opaque_lsa (struct ospf_apiserver *apiserv, /* Hooks that are invoked from ospf opaque module */ -int ospf_apiserver_lsa_update (struct ospf_lsa *lsa); -int ospf_apiserver_lsa_delete (struct ospf_lsa *lsa); +extern int ospf_apiserver_lsa_update (struct ospf_lsa *lsa); +extern int ospf_apiserver_lsa_delete (struct ospf_lsa *lsa); -void ospf_apiserver_clients_lsa_change_notify (u_char msgtype, +extern void ospf_apiserver_clients_lsa_change_notify (u_char msgtype, struct ospf_lsa *lsa); #endif /* _OSPF_APISERVER_H */ diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c index 71093d953..7d41f5be3 100644 --- a/ospfd/ospf_asbr.c +++ b/ospfd/ospf_asbr.c @@ -112,7 +112,7 @@ ospf_external_info_new (u_char type) return new; } -void +static void ospf_external_info_free (struct external_info *ei) { XFREE (MTYPE_OSPF_EXTERNAL_INFO, ei); diff --git a/ospfd/ospf_asbr.h b/ospfd/ospf_asbr.h index 349477471..fdcfbd920 100644 --- a/ospfd/ospf_asbr.h +++ b/ospfd/ospf_asbr.h @@ -54,27 +54,27 @@ struct external_info #define OSPF_ASBR_CHECK_DELAY 30 -void ospf_external_route_remove (struct ospf *, struct prefix_ipv4 *); -struct external_info *ospf_external_info_new (u_char); -void ospf_reset_route_map_set_values (struct route_map_set_values *); -int ospf_route_map_set_compare (struct route_map_set_values *, +extern void ospf_external_route_remove (struct ospf *, struct prefix_ipv4 *); +extern struct external_info *ospf_external_info_new (u_char); +extern void ospf_reset_route_map_set_values (struct route_map_set_values *); +extern int ospf_route_map_set_compare (struct route_map_set_values *, struct route_map_set_values *); -struct external_info *ospf_external_info_add (u_char, +extern struct external_info *ospf_external_info_add (u_char, struct prefix_ipv4, unsigned int, struct in_addr); -void ospf_external_info_delete (u_char, struct prefix_ipv4); -struct external_info *ospf_external_info_lookup (u_char, +extern void ospf_external_info_delete (u_char, struct prefix_ipv4); +extern struct external_info *ospf_external_info_lookup (u_char, struct prefix_ipv4 *); -struct ospf_route *ospf_external_route_lookup (struct ospf *, +extern struct ospf_route *ospf_external_route_lookup (struct ospf *, struct prefix_ipv4 *); -void ospf_asbr_status_update (struct ospf *, u_char); +extern void ospf_asbr_status_update (struct ospf *, u_char); -void ospf_redistribute_withdraw (u_char); -void ospf_asbr_check (); -void ospf_schedule_asbr_check (); -void ospf_asbr_route_install_lsa (struct ospf_lsa *); -struct ospf_lsa *ospf_external_info_find_lsa (struct ospf *, +extern void ospf_redistribute_withdraw (u_char); +extern void ospf_asbr_check (void); +extern void ospf_schedule_asbr_check (void); +extern void ospf_asbr_route_install_lsa (struct ospf_lsa *); +extern struct ospf_lsa *ospf_external_info_find_lsa (struct ospf *, struct prefix_ipv4 *p); #endif /* _ZEBRA_OSPF_ASBR_H */ diff --git a/ospfd/ospf_ase.c b/ospfd/ospf_ase.c index f9f79e3c1..09968e09b 100644 --- a/ospfd/ospf_ase.c +++ b/ospfd/ospf_ase.c @@ -132,7 +132,7 @@ ospf_find_asbr_route_through_area (struct route_table *rtrs, return NULL; } -void +static void ospf_ase_complete_direct_routes (struct ospf_route *ro, struct in_addr nexthop) { struct listnode *node; @@ -143,7 +143,7 @@ ospf_ase_complete_direct_routes (struct ospf_route *ro, struct in_addr nexthop) op->nexthop.s_addr = nexthop.s_addr; } -int +static int ospf_ase_forward_address_check (struct ospf *ospf, struct in_addr fwd_addr) { struct listnode *ifn; @@ -159,7 +159,7 @@ ospf_ase_forward_address_check (struct ospf *ospf, struct in_addr fwd_addr) } /* Calculate ASBR route. */ -struct ospf_route * +static struct ospf_route * ospf_ase_calculate_asbr_route (struct ospf *ospf, struct route_table *rt_network, struct route_table *rt_router, @@ -239,7 +239,7 @@ ospf_ase_calculate_asbr_route (struct ospf *ospf, return asbr_route; } -struct ospf_route * +static struct ospf_route * ospf_ase_calculate_new_route (struct ospf_lsa *lsa, struct ospf_route *asbr_route, u_int32_t metric) { @@ -540,7 +540,7 @@ ospf_ase_calculate_route (struct ospf *ospf, struct ospf_lsa * lsa) return 0; } -int +static int ospf_ase_route_match_same (struct route_table *rt, struct prefix *prefix, struct ospf_route *newor) { @@ -596,7 +596,7 @@ ospf_ase_route_match_same (struct route_table *rt, struct prefix *prefix, return 1; } -int +static int ospf_ase_compare_tables (struct route_table *new_external_route, struct route_table *old_external_route) { @@ -623,7 +623,7 @@ ospf_ase_compare_tables (struct route_table *new_external_route, return 0; } -int +static int ospf_ase_calculate_timer (struct thread *t) { struct ospf *ospf; diff --git a/ospfd/ospf_ase.h b/ospfd/ospf_ase.h index f403e26d3..e6a1b2fb7 100644 --- a/ospfd/ospf_ase.h +++ b/ospfd/ospf_ase.h @@ -24,19 +24,24 @@ #define _ZEBRA_OSPF_ASE_H -struct ospf_route *ospf_find_asbr_route (struct route_table *, - struct prefix_ipv4 *); -struct ospf_route *ospf_find_asbr_route_through_area(struct route_table *, - struct prefix_ipv4 *, - struct ospf_area *); +extern struct ospf_route *ospf_find_asbr_route (struct ospf *, + struct route_table *, + struct prefix_ipv4 *); +extern struct ospf_route *ospf_find_asbr_route_through_area (struct + route_table *, + struct + prefix_ipv4 *, + struct ospf_area + *); -int ospf_ase_calculate_route (struct ospf_lsa *, void *, int); -void ospf_ase_calculate_schedule (); -void ospf_ase_calculate_timer_add (); +extern int ospf_ase_calculate_route (struct ospf *, struct ospf_lsa *); +extern void ospf_ase_calculate_schedule (struct ospf *); +extern void ospf_ase_calculate_timer_add (struct ospf *); -void ospf_ase_external_lsas_finish (struct route_table *); -void ospf_ase_incremental_update (struct ospf_lsa *, struct ospf *); -void ospf_ase_register_external_lsa (struct ospf_lsa *, struct ospf *); -void ospf_ase_unregister_external_lsa (struct ospf_lsa *, struct ospf *); +extern void ospf_ase_external_lsas_finish (struct route_table *); +extern void ospf_ase_incremental_update (struct ospf *, struct ospf_lsa *); +extern void ospf_ase_register_external_lsa (struct ospf_lsa *, struct ospf *); +extern void ospf_ase_unregister_external_lsa (struct ospf_lsa *, + struct ospf *); #endif /* _ZEBRA_OSPF_ASE_H */ diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index 7d738f9e7..7b410b1e7 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -286,7 +286,7 @@ ospf_options_dump (u_char options) return buf; } -void +static void ospf_packet_hello_dump (struct stream *s, u_int16_t length) { struct ospf_hello *hello; @@ -310,7 +310,7 @@ ospf_packet_hello_dump (struct stream *s, u_int16_t length) zlog_debug (" Neighbor %s", inet_ntoa (hello->neighbors[i])); } -char * +static char * ospf_dd_flags_dump (u_char flags, char *buf, size_t size) { memset (buf, 0, size); @@ -341,7 +341,7 @@ ospf_lsa_header_dump (struct lsa_header *lsah) zlog_debug (" length %d", ntohs (lsah->length)); } -char * +static char * ospf_router_lsa_flags_dump (u_char flags, char *buf, size_t size) { memset (buf, 0, size); @@ -354,7 +354,7 @@ ospf_router_lsa_flags_dump (u_char flags, char *buf, size_t size) return buf; } -void +static void ospf_router_lsa_dump (struct stream *s, u_int16_t length) { char buf[BUFSIZ]; @@ -381,7 +381,7 @@ ospf_router_lsa_dump (struct stream *s, u_int16_t length) } } -void +static void ospf_network_lsa_dump (struct stream *s, u_int16_t length) { struct network_lsa *nl; @@ -402,7 +402,7 @@ ospf_network_lsa_dump (struct stream *s, u_int16_t length) zlog_debug (" Attached Router %s", inet_ntoa (nl->routers[i])); } -void +static void ospf_summary_lsa_dump (struct stream *s, u_int16_t length) { struct summary_lsa *sl; @@ -420,7 +420,7 @@ ospf_summary_lsa_dump (struct stream *s, u_int16_t length) GET_METRIC (sl->metric)); } -void +static void ospf_as_external_lsa_dump (struct stream *s, u_int16_t length) { struct as_external_lsa *al; @@ -442,7 +442,7 @@ ospf_as_external_lsa_dump (struct stream *s, u_int16_t length) } } -void +static void ospf_lsa_header_list_dump (struct stream *s, u_int16_t length) { struct lsa_header *lsa; @@ -460,7 +460,7 @@ ospf_lsa_header_list_dump (struct stream *s, u_int16_t length) } } -void +static void ospf_packet_db_desc_dump (struct stream *s, u_int16_t length) { struct ospf_db_desc *dd; @@ -488,7 +488,7 @@ ospf_packet_db_desc_dump (struct stream *s, u_int16_t length) stream_set_getp (s, gp); } -void +static void ospf_packet_ls_req_dump (struct stream *s, u_int16_t length) { u_int32_t sp; @@ -518,7 +518,7 @@ ospf_packet_ls_req_dump (struct stream *s, u_int16_t length) stream_set_getp (s, sp); } -void +static void ospf_packet_ls_upd_dump (struct stream *s, u_int16_t length) { u_int32_t sp; @@ -585,7 +585,7 @@ ospf_packet_ls_upd_dump (struct stream *s, u_int16_t length) stream_set_getp (s, sp); } -void +static void ospf_packet_ls_ack_dump (struct stream *s, u_int16_t length) { u_int32_t sp; @@ -617,7 +617,7 @@ ospf_ip_header_dump (struct ip *iph) zlog_debug ("ip_dst %s", inet_ntoa (iph->ip_dst)); } -void +static void ospf_header_dump (struct ospf_header *ospfh) { char buf[9]; @@ -1478,7 +1478,7 @@ struct cmd_node debug_node = 1 /* VTYSH */ }; -int +static int config_write_debug (struct vty *vty) { int write = 0; diff --git a/ospfd/ospf_dump.h b/ospfd/ospf_dump.h index 50e61e62c..81abb7545 100644 --- a/ospfd/ospf_dump.h +++ b/ospfd/ospf_dump.h @@ -125,15 +125,15 @@ extern const char *ospf_packet_type_str[]; extern char *ospf_lsa_type_str[]; /* Prototypes. */ -const char *ospf_area_name_string (struct ospf_area *); -const char *ospf_area_desc_string (struct ospf_area *); -const char *ospf_if_name_string (struct ospf_interface *); -void ospf_nbr_state_message (struct ospf_neighbor *, char *, size_t); -char *ospf_options_dump (u_char); -const char *ospf_timer_dump (struct thread *, char *, size_t); -void ospf_ip_header_dump (struct ip *); -void ospf_packet_dump (struct stream *); -void ospf_lsa_header_dump (struct lsa_header *); -void debug_init (); +extern const char *ospf_area_name_string (struct ospf_area *); +extern const char *ospf_area_desc_string (struct ospf_area *); +extern const char *ospf_if_name_string (struct ospf_interface *); +extern void ospf_nbr_state_message (struct ospf_neighbor *, char *, size_t); +extern char *ospf_options_dump (u_char); +extern const char *ospf_timer_dump (struct thread *, char *, size_t); +extern void ospf_ip_header_dump (struct ip *); +extern void ospf_packet_dump (struct stream *); +extern void ospf_lsa_header_dump (struct lsa_header *); +extern void debug_init (void); #endif /* _ZEBRA_OSPF_DUMP_H */ diff --git a/ospfd/ospf_flood.c b/ospfd/ospf_flood.c index 06e0f1c7a..a8b7e37a4 100644 --- a/ospfd/ospf_flood.c +++ b/ospfd/ospf_flood.c @@ -110,7 +110,7 @@ ospf_external_info_check (struct ospf_lsa *lsa) return NULL; } -void +static void ospf_process_self_originated_lsa (struct ospf *ospf, struct ospf_lsa *new, struct ospf_area *area) { @@ -347,7 +347,7 @@ ospf_flood (struct ospf *ospf, struct ospf_neighbor *nbr, } /* OSPF LSA flooding -- RFC2328 Section 13.3. */ -int +static int ospf_flood_through_interface (struct ospf_interface *oi, struct ospf_neighbor *inbr, struct ospf_lsa *lsa) @@ -937,7 +937,7 @@ ospf_ls_retransmit_lookup (struct ospf_neighbor *nbr, struct ospf_lsa *lsa) return ospf_lsdb_lookup (&nbr->ls_rxmt, lsa); } -void +static void ospf_ls_retransmit_delete_nbr_if (struct ospf_interface *oi, struct ospf_lsa *lsa) { diff --git a/ospfd/ospf_flood.h b/ospfd/ospf_flood.h index 1a6ab9797..5382e8fe2 100644 --- a/ospfd/ospf_flood.h +++ b/ospfd/ospf_flood.h @@ -20,46 +20,54 @@ * Boston, MA 02111-1307, USA. */ -#ifndef _ZEBRA_OSPF_FLOODING_H -#define _ZEBRA_OSPF_FLOODING_H +#ifndef _ZEBRA_OSPF_FLOOD_H +#define _ZEBRA_OSPF_FLOOD_H -int ospf_flood (struct ospf_neighbor *, struct ospf_lsa *, struct ospf_lsa *); -int ospf_flood_through (struct ospf_neighbor *, struct ospf_lsa *); -int ospf_flood_through_area (struct ospf_area *, struct ospf_neighbor *, - struct ospf_lsa *); -int ospf_flood_through_as (struct ospf_neighbor *, struct ospf_lsa *); +extern int ospf_flood (struct ospf *, struct ospf_neighbor *, + struct ospf_lsa *, struct ospf_lsa *); +extern int ospf_flood_through (struct ospf *, struct ospf_neighbor *, + struct ospf_lsa *); +extern int ospf_flood_through_area (struct ospf_area *, + struct ospf_neighbor *, + struct ospf_lsa *); +extern int ospf_flood_through_as (struct ospf *, struct ospf_neighbor *, + struct ospf_lsa *); -unsigned long ospf_ls_request_count (struct ospf_neighbor *); -int ospf_ls_request_isempty (struct ospf_neighbor *); -struct ospf_lsa *ospf_ls_request_new (struct lsa_header *); -void ospf_ls_request_free (struct ospf_lsa *); -void ospf_ls_request_add (struct ospf_neighbor *, struct ospf_lsa *); -void ospf_ls_request_delete (struct ospf_neighbor *, struct ospf_lsa *); -void ospf_ls_request_delete_all (struct ospf_neighbor *); -struct ospf_lsa *ospf_ls_request_lookup (struct ospf_neighbor *, - struct ospf_lsa *); +extern unsigned long ospf_ls_request_count (struct ospf_neighbor *); +extern int ospf_ls_request_isempty (struct ospf_neighbor *); +extern struct ospf_lsa *ospf_ls_request_new (struct lsa_header *); +extern void ospf_ls_request_free (struct ospf_lsa *); +extern void ospf_ls_request_add (struct ospf_neighbor *, struct ospf_lsa *); +extern void ospf_ls_request_delete (struct ospf_neighbor *, + struct ospf_lsa *); +extern void ospf_ls_request_delete_all (struct ospf_neighbor *); +extern struct ospf_lsa *ospf_ls_request_lookup (struct ospf_neighbor *, + struct ospf_lsa *); -unsigned long ospf_ls_retransmit_count (struct ospf_neighbor *); -unsigned long ospf_ls_retransmit_count_self (struct ospf_neighbor *, int); -int ospf_ls_retransmit_isempty (struct ospf_neighbor *); -void ospf_ls_retransmit_add (struct ospf_neighbor *, struct ospf_lsa *); -void ospf_ls_retransmit_delete (struct ospf_neighbor *, struct ospf_lsa *); -void ospf_ls_retransmit_clear (struct ospf_neighbor *); -struct ospf_lsa *ospf_ls_retransmit_lookup (struct ospf_neighbor *, +extern unsigned long ospf_ls_retransmit_count (struct ospf_neighbor *); +extern unsigned long ospf_ls_retransmit_count_self (struct ospf_neighbor *, + int); +extern int ospf_ls_retransmit_isempty (struct ospf_neighbor *); +extern void ospf_ls_retransmit_add (struct ospf_neighbor *, + struct ospf_lsa *); +extern void ospf_ls_retransmit_delete (struct ospf_neighbor *, + struct ospf_lsa *); +extern void ospf_ls_retransmit_clear (struct ospf_neighbor *); +extern struct ospf_lsa *ospf_ls_retransmit_lookup (struct ospf_neighbor *, + struct ospf_lsa *); +extern void ospf_ls_retransmit_delete_nbr_area (struct ospf_area *, + struct ospf_lsa *); +extern void ospf_ls_retransmit_delete_nbr_as (struct ospf *, + struct ospf_lsa *); +extern void ospf_ls_retransmit_add_nbr_all (struct ospf_interface *, struct ospf_lsa *); -void ospf_ls_retransmit_delete_nbr_all (struct ospf_area *, struct ospf_lsa *); -void ospf_ls_retransmit_add_nbr_all (struct ospf_interface *, - struct ospf_lsa *); -void ospf_flood_lsa_area (struct ospf_lsa *, struct ospf_area *); -void ospf_flood_lsa_as (struct ospf_lsa *); -void ospf_lsa_flush_area (struct ospf_lsa *, struct ospf_area *); -void ospf_lsa_flush_as (struct ospf_lsa *); -void ospf_flush_through_as (struct ospf_lsa *); -struct external_info *ospf_external_info_check (struct ospf_lsa *); +extern void ospf_flood_lsa_area (struct ospf_lsa *, struct ospf_area *); +extern void ospf_flood_lsa_as (struct ospf_lsa *); +extern void ospf_lsa_flush_area (struct ospf_lsa *, struct ospf_area *); +extern void ospf_lsa_flush_as (struct ospf *, struct ospf_lsa *); +extern struct external_info *ospf_external_info_check (struct ospf_lsa *); -void debug_ospf_ls_retransmit (struct ospf_neighbor *); +extern void ospf_lsdb_init (struct ospf_lsdb *); -void ospf_lsdb_init (struct ospf_lsdb *); - -#endif /* _ZEBRA_OSPF_FLOODING_H */ +#endif /* _ZEBRA_OSPF_FLOOD_H */ diff --git a/ospfd/ospf_ia.c b/ospfd/ospf_ia.c index 87613bf17..29604c614 100644 --- a/ospfd/ospf_ia.c +++ b/ospfd/ospf_ia.c @@ -48,7 +48,7 @@ #define DEBUG -struct ospf_route * +static struct ospf_route * ospf_find_abr_route (struct route_table *rtrs, struct prefix_ipv4 *abr, struct ospf_area *area) @@ -70,7 +70,7 @@ ospf_find_abr_route (struct route_table *rtrs, return NULL; } -void +static void ospf_ia_network_route (struct ospf *ospf, struct route_table *rt, struct prefix_ipv4 *p, struct ospf_route *new_or, struct ospf_route *abr_or) @@ -127,7 +127,7 @@ ospf_ia_network_route (struct ospf *ospf, struct route_table *rt, } } -void +static void ospf_ia_router_route (struct ospf *ospf, struct route_table *rtrs, struct prefix_ipv4 *p, struct ospf_route *new_or, struct ospf_route *abr_or) @@ -196,7 +196,7 @@ ospf_ia_router_route (struct ospf *ospf, struct route_table *rtrs, } -int +static int process_summary_lsa (struct ospf_area *area, struct route_table *rt, struct route_table *rtrs, struct ospf_lsa *lsa) { @@ -285,7 +285,7 @@ process_summary_lsa (struct ospf_area *area, struct route_table *rt, return 0; } -void +static void ospf_examine_summaries (struct ospf_area *area, struct route_table *lsdb_rt, struct route_table *rt, @@ -305,7 +305,7 @@ ospf_area_is_transit (struct ospf_area *area) ospf_full_virtual_nbrs(area); /* Cisco forgets to set the V-bit :( */ } -void +static void ospf_update_network_route (struct ospf *ospf, struct route_table *rt, struct route_table *rtrs, @@ -434,7 +434,7 @@ ospf_update_network_route (struct ospf *ospf, } } -void +static void ospf_update_router_route (struct ospf *ospf, struct route_table *rtrs, struct summary_lsa *lsa, @@ -533,7 +533,7 @@ ospf_update_router_route (struct ospf *ospf, } } -int +static int process_transit_summary_lsa (struct ospf_area *area, struct route_table *rt, struct route_table *rtrs, struct ospf_lsa *lsa) { @@ -591,7 +591,7 @@ process_transit_summary_lsa (struct ospf_area *area, struct route_table *rt, return 0; } -void +static void ospf_examine_transit_summaries (struct ospf_area *area, struct route_table *lsdb_rt, struct route_table *rt, diff --git a/ospfd/ospf_ia.h b/ospfd/ospf_ia.h index afb2d4d59..b65b93864 100644 --- a/ospfd/ospf_ia.h +++ b/ospfd/ospf_ia.h @@ -36,7 +36,8 @@ ospf_examine_transit_summaries ((A), ASBR_SUMMARY_LSDB ((A)), (N), (R)); \ } -void ospf_ia_routing (struct route_table *, struct route_table *); -int ospf_area_is_transit (struct ospf_area *); +extern void ospf_ia_routing (struct ospf *, struct route_table *, + struct route_table *); +extern int ospf_area_is_transit (struct ospf_area *); #endif /* _ZEBRA_OSPF_IA_H */ diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c index f8490f5ef..35351b579 100644 --- a/ospfd/ospf_interface.c +++ b/ospfd/ospf_interface.c @@ -145,7 +145,7 @@ ospf_if_reset_variables (struct ospf_interface *oi) } /* lookup oi for specified prefix/ifp */ -struct ospf_interface * +static struct ospf_interface * ospf_if_table_lookup (struct interface *ifp, struct prefix *prefix) { struct prefix p; @@ -161,7 +161,7 @@ ospf_if_table_lookup (struct interface *ifp, struct prefix *prefix) return rninfo; } -void +static void ospf_add_to_if (struct interface *ifp, struct ospf_interface *oi) { struct route_node *rn; @@ -178,7 +178,7 @@ ospf_add_to_if (struct interface *ifp, struct ospf_interface *oi) rn->info = oi; } -void +static void ospf_delete_from_if (struct interface *ifp, struct ospf_interface *oi) { struct route_node *rn; @@ -538,8 +538,8 @@ ospf_if_stream_unset (struct ospf_interface *oi) } -struct ospf_if_params * -ospf_new_if_params () +static struct ospf_if_params * +ospf_new_if_params (void) { struct ospf_if_params *oip; @@ -709,7 +709,7 @@ ospf_if_new_hook (struct interface *ifp) return rc; } -int +static int ospf_if_delete_hook (struct interface *ifp) { int rc = 0; @@ -923,7 +923,7 @@ ospf_vl_new (struct ospf *ospf, struct ospf_vl_data *vl_data) return voi; } -void +static void ospf_vl_if_delete (struct ospf_vl_data *vl_data) { struct interface *ifp = vl_data->vl_oi->ifp; @@ -948,7 +948,7 @@ ospf_vl_lookup (struct ospf_area *area, struct in_addr vl_peer) return NULL; } -void +static void ospf_vl_shutdown (struct ospf_vl_data *vl_data) { struct ospf_interface *oi; @@ -987,7 +987,7 @@ ospf_vl_delete (struct ospf *ospf, struct ospf_vl_data *vl_data) ospf_vl_data_free (vl_data); } -int +static int ospf_vl_set_params (struct ospf_vl_data *vl_data, struct vertex *v) { int changed = 0; diff --git a/ospfd/ospf_interface.h b/ospfd/ospf_interface.h index d089297fb..0e7f22ab5 100644 --- a/ospfd/ospf_interface.h +++ b/ospfd/ospf_interface.h @@ -198,65 +198,73 @@ struct ospf_interface }; /* Prototypes. */ -char *ospf_if_name (struct ospf_interface *); -struct ospf_interface *ospf_if_new (struct ospf *, struct interface *, - struct prefix *); -void ospf_if_cleanup (struct ospf_interface *); -void ospf_if_free (struct ospf_interface *); -int ospf_if_up (struct ospf_interface *); -int ospf_if_down (struct ospf_interface *); - -int ospf_if_is_up (struct ospf_interface *); -struct ospf_interface *ospf_if_exists (struct ospf_interface *); -struct ospf_interface *ospf_if_lookup_by_local_addr (struct ospf *, - struct interface *, +extern char *ospf_if_name (struct ospf_interface *); +extern struct ospf_interface *ospf_if_new (struct ospf *, struct interface *, + struct prefix *); +extern void ospf_if_cleanup (struct ospf_interface *); +extern void ospf_if_free (struct ospf_interface *); +extern int ospf_if_up (struct ospf_interface *); +extern int ospf_if_down (struct ospf_interface *); + +extern int ospf_if_is_up (struct ospf_interface *); +extern struct ospf_interface *ospf_if_exists (struct ospf_interface *); +extern struct ospf_interface *ospf_if_lookup_by_local_addr (struct ospf *, + struct interface + *, + struct in_addr); +extern struct ospf_interface *ospf_if_lookup_by_prefix (struct ospf *, + struct prefix_ipv4 *); +extern struct ospf_interface *ospf_if_addr_local (struct in_addr); +extern struct ospf_interface *ospf_if_lookup_recv_if (struct ospf *, + struct in_addr); +extern struct ospf_interface *ospf_if_is_configured (struct ospf *, + struct in_addr *); + +extern struct ospf_if_params *ospf_lookup_if_params (struct interface *, struct in_addr); -struct ospf_interface *ospf_if_lookup_by_prefix (struct ospf *, - struct prefix_ipv4 *); -struct ospf_interface *ospf_if_addr_local (struct in_addr); -struct ospf_interface *ospf_if_lookup_recv_if (struct ospf *, struct in_addr); -struct ospf_interface *ospf_if_is_configured (struct ospf *, struct in_addr *); - -struct ospf_if_params *ospf_lookup_if_params (struct interface *, - struct in_addr); -struct ospf_if_params *ospf_get_if_params (struct interface *, struct in_addr); -void ospf_del_if_params (struct ospf_if_params *); -void ospf_free_if_params (struct interface *, struct in_addr); -void ospf_if_update_params (struct interface *, struct in_addr); - -int ospf_if_new_hook (struct interface *); -void ospf_if_init (); -void ospf_if_stream_set (struct ospf_interface *); -void ospf_if_stream_unset (struct ospf_interface *); -void ospf_if_reset_variables (struct ospf_interface *); -int ospf_if_is_enable (struct ospf_interface *); -int ospf_if_get_output_cost (struct ospf_interface *); -void ospf_if_recalculate_output_cost (struct interface *); +extern struct ospf_if_params *ospf_get_if_params (struct interface *, + struct in_addr); +extern void ospf_del_if_params (struct ospf_if_params *); +extern void ospf_free_if_params (struct interface *, struct in_addr); +extern void ospf_if_update_params (struct interface *, struct in_addr); + +extern int ospf_if_new_hook (struct interface *); +extern void ospf_if_init (void); +extern void ospf_if_stream_set (struct ospf_interface *); +extern void ospf_if_stream_unset (struct ospf_interface *); +extern void ospf_if_reset_variables (struct ospf_interface *); +extern int ospf_if_is_enable (struct ospf_interface *); +extern int ospf_if_get_output_cost (struct ospf_interface *); +extern void ospf_if_recalculate_output_cost (struct interface *); /* Simulate down/up on the interface. */ extern void ospf_if_reset (struct interface *); -struct ospf_interface *ospf_vl_new (struct ospf *, struct ospf_vl_data *); -struct ospf_vl_data *ospf_vl_data_new (struct ospf_area *, struct in_addr); -struct ospf_vl_data *ospf_vl_lookup (struct ospf_area *, struct in_addr); -void ospf_vl_data_free (struct ospf_vl_data *); -void ospf_vl_add (struct ospf *, struct ospf_vl_data *); -void ospf_vl_delete (struct ospf *, struct ospf_vl_data *); -void ospf_vl_up_check (struct ospf_area *, struct in_addr, struct vertex *); -void ospf_vl_unapprove (struct ospf *); -void ospf_vl_shut_unapproved (struct ospf *); -int ospf_full_virtual_nbrs (struct ospf_area *); -int ospf_vls_in_area (struct ospf_area *); - -struct crypt_key *ospf_crypt_key_lookup (struct list *, u_char); -struct crypt_key *ospf_crypt_key_new (); -void ospf_crypt_key_add (struct list *, struct crypt_key *); -int ospf_crypt_key_delete (struct list *, u_char); - -u_char ospf_default_iftype(struct interface *ifp); +extern struct ospf_interface *ospf_vl_new (struct ospf *, + struct ospf_vl_data *); +extern struct ospf_vl_data *ospf_vl_data_new (struct ospf_area *, + struct in_addr); +extern struct ospf_vl_data *ospf_vl_lookup (struct ospf_area *, + struct in_addr); +extern void ospf_vl_data_free (struct ospf_vl_data *); +extern void ospf_vl_add (struct ospf *, struct ospf_vl_data *); +extern void ospf_vl_delete (struct ospf *, struct ospf_vl_data *); +extern void ospf_vl_up_check (struct ospf_area *, struct in_addr, + struct vertex *); +extern void ospf_vl_unapprove (struct ospf *); +extern void ospf_vl_shut_unapproved (struct ospf *); +extern int ospf_full_virtual_nbrs (struct ospf_area *); +extern int ospf_vls_in_area (struct ospf_area *); + +extern struct crypt_key *ospf_crypt_key_lookup (struct list *, u_char); +extern struct crypt_key *ospf_crypt_key_new (void); +extern void ospf_crypt_key_add (struct list *, struct crypt_key *); +extern int ospf_crypt_key_delete (struct list *, u_char); + +extern u_char ospf_default_iftype (struct interface *ifp); /* Set all multicast memberships appropriately based on the type and state of the interface. */ -extern void ospf_if_set_multicast(struct ospf_interface *); +extern void ospf_if_set_multicast (struct ospf_interface *); #endif /* _ZEBRA_OSPF_INTERFACE_H */ diff --git a/ospfd/ospf_ism.c b/ospfd/ospf_ism.c index 5d498d7dd..b04423411 100644 --- a/ospfd/ospf_ism.c +++ b/ospfd/ospf_ism.c @@ -45,7 +45,7 @@ #include "ospfd/ospf_abr.h" /* elect DR and BDR. Refer to RFC2319 section 9.4 */ -struct ospf_neighbor * +static struct ospf_neighbor * ospf_dr_election_sub (struct list *routers) { struct listnode *node; @@ -70,7 +70,7 @@ ospf_dr_election_sub (struct list *routers) return max; } -struct ospf_neighbor * +static struct ospf_neighbor * ospf_elect_dr (struct ospf_interface *oi, struct list *el_list) { struct list *dr_list; @@ -111,7 +111,7 @@ ospf_elect_dr (struct ospf_interface *oi, struct list *el_list) return dr; } -struct ospf_neighbor * +static struct ospf_neighbor * ospf_elect_bdr (struct ospf_interface *oi, struct list *el_list) { struct list *bdr_list, *no_dr_list; @@ -156,7 +156,7 @@ ospf_elect_bdr (struct ospf_interface *oi, struct list *el_list) return bdr; } -int +static int ospf_ism_state (struct ospf_interface *oi) { if (IPV4_ADDR_SAME (&DR (oi), &oi->address->u.prefix4)) @@ -167,7 +167,7 @@ ospf_ism_state (struct ospf_interface *oi) return ISM_DROther; } -void +static void ospf_dr_eligible_routers (struct route_table *nbrs, struct list *el_list) { struct route_node *rn; @@ -185,7 +185,7 @@ ospf_dr_eligible_routers (struct route_table *nbrs, struct list *el_list) } /* Generate AdjOK? NSM event. */ -void +static void ospf_dr_change (struct ospf *ospf, struct route_table *nbrs) { struct route_node *rn; @@ -202,7 +202,7 @@ ospf_dr_change (struct ospf *ospf, struct route_table *nbrs) OSPF_NSM_EVENT_SCHEDULE (nbr, NSM_AdjOK); } -int +static int ospf_dr_election (struct ospf_interface *oi) { struct in_addr old_dr, old_bdr; @@ -274,7 +274,7 @@ ospf_hello_timer (struct thread *thread) return 0; } -int +static int ospf_wait_timer (struct thread *thread) { struct ospf_interface *oi; @@ -294,7 +294,7 @@ ospf_wait_timer (struct thread *thread) /* Hook function called after ospf ISM event is occured. And vty's network command invoke this function after making interface structure. */ -void +static void ism_timer_set (struct ospf_interface *oi) { switch (oi->state) @@ -361,13 +361,7 @@ ism_timer_set (struct ospf_interface *oi) } } -int -ism_stop (struct ospf_interface *oi) -{ - return 0; -} - -int +static int ism_interface_up (struct ospf_interface *oi) { int next_state = 0; @@ -393,7 +387,7 @@ ism_interface_up (struct ospf_interface *oi) return next_state; } -int +static int ism_loop_ind (struct ospf_interface *oi) { int ret = 0; @@ -405,7 +399,7 @@ ism_loop_ind (struct ospf_interface *oi) } /* Interface down event handler. */ -int +static int ism_interface_down (struct ospf_interface *oi) { ospf_if_cleanup (oi); @@ -413,25 +407,25 @@ ism_interface_down (struct ospf_interface *oi) } -int +static int ism_backup_seen (struct ospf_interface *oi) { return ospf_dr_election (oi); } -int +static int ism_wait_timer (struct ospf_interface *oi) { return ospf_dr_election (oi); } -int +static int ism_neighbor_change (struct ospf_interface *oi) { return ospf_dr_election (oi); } -int +static int ism_ignore (struct ospf_interface *oi) { if (IS_DEBUG_OSPF (ism, ISM_EVENTS)) @@ -442,7 +436,7 @@ ism_ignore (struct ospf_interface *oi) /* Interface State Machine */ struct { - int (*func) (); + int (*func) (struct ospf_interface *); int next_state; } ISM [OSPF_ISM_STATE_MAX][OSPF_ISM_EVENT_MAX] = { @@ -548,7 +542,7 @@ const static char *ospf_ism_event_str[] = "InterfaceDown", }; -void +static void ism_change_state (struct ospf_interface *oi, int state) { int old_state; diff --git a/ospfd/ospf_ism.h b/ospfd/ospf_ism.h index b04865af6..58f80c383 100644 --- a/ospfd/ospf_ism.h +++ b/ospfd/ospf_ism.h @@ -46,17 +46,17 @@ #define ISM_InterfaceDown 7 #define OSPF_ISM_EVENT_MAX 8 -#define OSPF_ISM_WRITE_ON() \ +#define OSPF_ISM_WRITE_ON(O) \ do \ { \ if (oi->on_write_q == 0) \ { \ - listnode_add (ospf_top->oi_write_q, oi); \ + listnode_add ((O)->oi_write_q, oi); \ oi->on_write_q = 1; \ } \ - if (ospf_top->t_write == NULL) \ - ospf_top->t_write = \ - thread_add_write (master, ospf_write, ospf_top, ospf_top->fd); \ + if ((O)->t_write == NULL) \ + (O)->t_write = \ + thread_add_write (master, ospf_write, (O), (O)->fd); \ } while (0) /* Macro for OSPF ISM timer turn on. */ @@ -81,8 +81,8 @@ thread_execute (master, ospf_ism_event, (I), (E)) /* Prototypes. */ -int ospf_ism_event (struct thread *); -void ism_change_status (struct ospf_interface *, int); -int ospf_hello_timer (struct thread *thread); +extern int ospf_ism_event (struct thread *); +extern void ism_change_status (struct ospf_interface *, int); +extern int ospf_hello_timer (struct thread *thread); #endif /* _ZEBRA_OSPF_ISM_H */ diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index e02d457ee..e6c7fdc3f 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -413,7 +413,7 @@ lsa_header_set (struct stream *s, u_char options, /* router-LSA related functions. */ /* Get router-LSA flags. */ -u_char +static u_char router_lsa_flags (struct ospf_area *area) { u_char flags; @@ -484,7 +484,7 @@ ospf_nbr_lookup_ptop (struct ospf_interface *oi) } /* Set a link information. */ -void +static void link_info_set (struct stream *s, struct in_addr id, struct in_addr data, u_char type, u_char tos, u_int16_t cost) { @@ -497,7 +497,7 @@ link_info_set (struct stream *s, struct in_addr id, } /* Describe Point-to-Point link. */ -int +static int lsa_link_ptop_set (struct stream *s, struct ospf_interface *oi) { int links = 0; @@ -543,7 +543,7 @@ lsa_link_ptop_set (struct stream *s, struct ospf_interface *oi) } /* Describe Broadcast Link. */ -int +static int lsa_link_broadcast_set (struct stream *s, struct ospf_interface *oi) { struct ospf_neighbor *dr; @@ -577,7 +577,7 @@ lsa_link_broadcast_set (struct stream *s, struct ospf_interface *oi) return 1; } -int +static int lsa_link_loopback_set (struct stream *s, struct ospf_interface *oi) { struct in_addr id, mask; @@ -593,7 +593,7 @@ lsa_link_loopback_set (struct stream *s, struct ospf_interface *oi) } /* Describe Virtual Link. */ -int +static int lsa_link_virtuallink_set (struct stream *s, struct ospf_interface *oi) { struct ospf_neighbor *nbr; @@ -616,7 +616,7 @@ lsa_link_virtuallink_set (struct stream *s, struct ospf_interface *oi) 12.4.1.4.*/ /* from "edward rrr" http://marc.theaimsgroup.com/?l=zebra&m=100739222210507&w=2 */ -int +static int lsa_link_ptomp_set (struct stream *s, struct ospf_interface *oi) { int links = 0; @@ -652,7 +652,7 @@ lsa_link_ptomp_set (struct stream *s, struct ospf_interface *oi) } /* Set router-LSA link information. */ -int +static int router_lsa_link_set (struct stream *s, struct ospf_area *area) { struct listnode *node; @@ -697,7 +697,7 @@ router_lsa_link_set (struct stream *s, struct ospf_area *area) } /* Set router-LSA body. */ -void +static void ospf_router_lsa_body_set (struct stream *s, struct ospf_area *area) { unsigned long putp; @@ -723,7 +723,7 @@ ospf_router_lsa_body_set (struct stream *s, struct ospf_area *area) } /* Create new router-LSA. */ -struct ospf_lsa * +static struct ospf_lsa * ospf_router_lsa_new (struct ospf_area *area) { struct ospf *ospf = area->ospf; @@ -801,7 +801,7 @@ ospf_router_lsa_originate (struct ospf_area *area) } /* Refresh router-LSA. */ -struct ospf_lsa * +static struct ospf_lsa * ospf_router_lsa_refresh (struct ospf_lsa *lsa) { struct ospf_area *area = lsa->area; @@ -833,7 +833,7 @@ ospf_router_lsa_refresh (struct ospf_lsa *lsa) return NULL; } -int +static int ospf_router_lsa_timer (struct thread *t) { struct ospf_area *area; @@ -944,7 +944,7 @@ ospf_router_lsa_update_timer (struct thread *thread) /* network-LSA related functions. */ /* Originate Network-LSA. */ -void +static void ospf_network_lsa_body_set (struct stream *s, struct ospf_interface *oi) { struct in_addr mask; @@ -965,7 +965,7 @@ ospf_network_lsa_body_set (struct stream *s, struct ospf_interface *oi) stream_put_ipv4 (s, nbr->router_id.s_addr); } -struct ospf_lsa * +static struct ospf_lsa * ospf_network_lsa_new (struct ospf_interface *oi) { struct stream *s; @@ -1009,7 +1009,7 @@ ospf_network_lsa_new (struct ospf_interface *oi) } /* Originate network-LSA. */ -struct ospf_lsa * +static struct ospf_lsa * ospf_network_lsa_originate (struct ospf_interface *oi) { struct ospf_lsa *new; @@ -1070,7 +1070,7 @@ ospf_network_lsa_refresh (struct ospf_lsa *lsa, struct ospf_interface *oi) return 0; } -int +static int ospf_network_lsa_refresh_timer (struct thread *t) { struct ospf_interface *oi; @@ -1122,7 +1122,7 @@ ospf_network_lsa_timer_add (struct ospf_interface *oi) } -void +static void stream_put_ospf_metric (struct stream *s, u_int32_t metric_value) { u_int32_t metric; @@ -1136,7 +1136,7 @@ stream_put_ospf_metric (struct stream *s, u_int32_t metric_value) } /* summary-LSA related functions. */ -void +static void ospf_summary_lsa_body_set (struct stream *s, struct prefix *p, u_int32_t metric) { @@ -1154,7 +1154,7 @@ ospf_summary_lsa_body_set (struct stream *s, struct prefix *p, stream_put_ospf_metric (s, metric); } -struct ospf_lsa * +static struct ospf_lsa * ospf_summary_lsa_new (struct ospf_area *area, struct prefix *p, u_int32_t metric, struct in_addr id) { @@ -1263,7 +1263,7 @@ ospf_summary_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa) /* summary-ASBR-LSA related functions. */ -void +static void ospf_summary_asbr_lsa_body_set (struct stream *s, struct prefix *p, u_int32_t metric) { @@ -1281,7 +1281,7 @@ ospf_summary_asbr_lsa_body_set (struct stream *s, struct prefix *p, stream_put_ospf_metric (s, metric); } -struct ospf_lsa * +static struct ospf_lsa * ospf_summary_asbr_lsa_new (struct ospf_area *area, struct prefix *p, u_int32_t metric, struct in_addr id) { @@ -1391,7 +1391,7 @@ ospf_summary_asbr_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa) /* Get nexthop for AS-external-LSAs. Return nexthop if its interface is connected, else 0*/ -struct in_addr +static struct in_addr ospf_external_lsa_nexthop_get (struct ospf *ospf, struct in_addr nexthop) { struct in_addr fwd; @@ -1421,7 +1421,7 @@ ospf_external_lsa_nexthop_get (struct ospf *ospf, struct in_addr nexthop) /* NSSA-external-LSA related functions. */ /* Get 1st IP connection for Forward Addr */ - + struct in_addr ospf_get_ip_from_ifp (struct ospf_interface *oi) { @@ -1503,7 +1503,7 @@ metric_value (struct ospf *ospf, u_char src) } /* Set AS-external-LSA body. */ -void +static void ospf_external_lsa_body_set (struct stream *s, struct external_info *ei, struct ospf *ospf) { @@ -1543,7 +1543,7 @@ ospf_external_lsa_body_set (struct stream *s, struct external_info *ei, } /* Create new external-LSA. */ -struct ospf_lsa * +static struct ospf_lsa * ospf_external_lsa_new (struct ospf *ospf, struct external_info *ei, struct in_addr *old_id) { @@ -1608,7 +1608,7 @@ ospf_external_lsa_new (struct ospf *ospf, } /* As Type-7 */ -void +static void ospf_install_flood_nssa (struct ospf *ospf, struct ospf_lsa *lsa, struct external_info *ei) { @@ -1695,7 +1695,7 @@ ospf_install_flood_nssa (struct ospf *ospf, } } -struct ospf_lsa * +static struct ospf_lsa * ospf_lsa_translated_nssa_new (struct ospf *ospf, struct ospf_lsa *type7) { @@ -1744,7 +1744,7 @@ ospf_lsa_translated_nssa_new (struct ospf *ospf, /* compare type-5 to type-7 * -1: err, 0: same, 1: different */ -int +static int ospf_lsa_translated_nssa_compare (struct ospf_lsa *t7, struct ospf_lsa *t5) { @@ -2043,7 +2043,7 @@ ospf_external_lsa_originate_timer (struct thread *thread) return 0; } -struct external_info * +static struct external_info * ospf_default_external_info (struct ospf *ospf) { int type; @@ -2328,7 +2328,7 @@ ospf_external_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa, /* LSA installation functions. */ /* Install router-LSA to an area. */ -struct ospf_lsa * +static struct ospf_lsa * ospf_router_lsa_install (struct ospf *ospf, struct ospf_lsa *new, int rt_recalc) { @@ -2367,7 +2367,7 @@ ospf_router_lsa_install (struct ospf *ospf, (T) = thread_add_timer (master, (F), oi, (V)) /* Install network-LSA to an area. */ -struct ospf_lsa * +static struct ospf_lsa * ospf_network_lsa_install (struct ospf *ospf, struct ospf_interface *oi, struct ospf_lsa *new, @@ -2402,7 +2402,7 @@ ospf_network_lsa_install (struct ospf *ospf, } /* Install summary-LSA to an area. */ -struct ospf_lsa * +static struct ospf_lsa * ospf_summary_lsa_install (struct ospf *ospf, struct ospf_lsa *new, int rt_recalc) { @@ -2433,7 +2433,7 @@ ospf_summary_lsa_install (struct ospf *ospf, struct ospf_lsa *new, } /* Install ASBR-summary-LSA to an area. */ -struct ospf_lsa * +static struct ospf_lsa * ospf_summary_asbr_lsa_install (struct ospf *ospf, struct ospf_lsa *new, int rt_recalc) { @@ -2464,7 +2464,7 @@ ospf_summary_asbr_lsa_install (struct ospf *ospf, struct ospf_lsa *new, } /* Install AS-external-LSA. */ -struct ospf_lsa * +static struct ospf_lsa * ospf_external_lsa_install (struct ospf *ospf, struct ospf_lsa *new, int rt_recalc) { @@ -2740,7 +2740,7 @@ ospf_lsa_install (struct ospf *ospf, struct ospf_interface *oi, } -int +static int ospf_check_nbr_status (struct ospf *ospf) { struct listnode *node, *nnode; @@ -2795,7 +2795,7 @@ ospf_maxage_flood (struct ospf_lsa *lsa) } #endif /* ORIGINAL_CODING */ -int +static int ospf_maxage_lsa_remover (struct thread *thread) { struct ospf *ospf = THREAD_ARG (thread); @@ -2859,7 +2859,7 @@ ospf_maxage_lsa_remover (struct thread *thread) return 0; } -int +static int ospf_lsa_maxage_exist (struct ospf *ospf, struct ospf_lsa *new) { struct listnode *node; @@ -2905,7 +2905,7 @@ ospf_lsa_maxage (struct ospf *ospf, struct ospf_lsa *lsa) OSPF_TIMER_ON (ospf->t_maxage, ospf_maxage_lsa_remover, 2); } -int +static int ospf_lsa_maxage_walker_remover (struct ospf *ospf, struct ospf_lsa *lsa) { /* Stay away from any Local Translated Type-7 LSAs */ @@ -3467,7 +3467,7 @@ struct lsa_action struct ospf_lsa *lsa; }; -int +static int ospf_lsa_action (struct thread *t) { struct lsa_action *data; @@ -3540,7 +3540,7 @@ ospf_schedule_lsa_flush_area (struct ospf_area *area, struct ospf_lsa *lsa) /* LSA Refreshment functions. */ -void +static void ospf_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa) { struct external_info *ei; diff --git a/ospfd/ospf_lsa.h b/ospfd/ospf_lsa.h index 952ca7746..d7ead3d4c 100644 --- a/ospfd/ospf_lsa.h +++ b/ospfd/ospf_lsa.h @@ -23,6 +23,8 @@ #ifndef _ZEBRA_OSPF_LSA_H #define _ZEBRA_OSPF_LSA_H +#include "stream.h" + /* OSPF LSA Range definition. */ #define OSPF_MIN_LSA 1 /* begin range here */ #if defined (HAVE_OPAQUE_LSA) @@ -217,115 +219,113 @@ struct as_external_lsa if (!(T)) \ (T) = thread_add_timer (master, (F), 0, 2) -struct ospf_route; -struct ospf_lsdb; - /* Prototypes. */ -struct timeval tv_adjust (struct timeval); -int tv_ceil (struct timeval); -int tv_floor (struct timeval); -struct timeval int2tv (int); -struct timeval tv_add (struct timeval, struct timeval); -struct timeval tv_sub (struct timeval, struct timeval); -int tv_cmp (struct timeval, struct timeval); - -int get_age (struct ospf_lsa *); -u_int16_t ospf_lsa_checksum (struct lsa_header *); - -struct stream; -const char *dump_lsa_key (struct ospf_lsa *); -u_int32_t lsa_seqnum_increment (struct ospf_lsa *); -void lsa_header_set (struct stream *, u_char, u_char, struct in_addr, +/* XXX: Eek, time functions, similar are in lib/thread.c */ +extern struct timeval tv_adjust (struct timeval); +extern int tv_ceil (struct timeval); +extern int tv_floor (struct timeval); +extern struct timeval int2tv (int); +extern struct timeval tv_add (struct timeval, struct timeval); +extern struct timeval tv_sub (struct timeval, struct timeval); +extern int tv_cmp (struct timeval, struct timeval); + +extern int get_age (struct ospf_lsa *); +extern u_int16_t ospf_lsa_checksum (struct lsa_header *); +extern int ospf_lsa_refresh_delay (struct ospf_lsa *); + +extern const char *dump_lsa_key (struct ospf_lsa *); +extern u_int32_t lsa_seqnum_increment (struct ospf_lsa *); +extern void lsa_header_set (struct stream *, u_char, u_char, struct in_addr, struct in_addr); -struct ospf_neighbor *ospf_nbr_lookup_ptop (struct ospf_interface *); +extern struct ospf_neighbor *ospf_nbr_lookup_ptop (struct ospf_interface *); /* Prototype for LSA primitive. */ -struct ospf_lsa *ospf_lsa_new (); -struct ospf_lsa *ospf_lsa_dup (); -void ospf_lsa_free (struct ospf_lsa *); -struct ospf_lsa *ospf_lsa_lock (struct ospf_lsa *); -void ospf_lsa_unlock (struct ospf_lsa *); -void ospf_lsa_discard (struct ospf_lsa *); +extern struct ospf_lsa *ospf_lsa_new (void); +extern struct ospf_lsa *ospf_lsa_dup (struct ospf_lsa *); +extern void ospf_lsa_free (struct ospf_lsa *); +extern struct ospf_lsa *ospf_lsa_lock (struct ospf_lsa *); +extern void ospf_lsa_unlock (struct ospf_lsa *); +extern void ospf_lsa_discard (struct ospf_lsa *); -struct lsa_header *ospf_lsa_data_new (size_t); -struct lsa_header *ospf_lsa_data_dup (struct lsa_header *); -void ospf_lsa_data_free (struct lsa_header *); +extern struct lsa_header *ospf_lsa_data_new (size_t); +extern struct lsa_header *ospf_lsa_data_dup (struct lsa_header *); +extern void ospf_lsa_data_free (struct lsa_header *); /* Prototype for various LSAs */ -struct ospf_lsa *ospf_router_lsa_originate (struct ospf_area *); -int ospf_router_lsa_update_timer (struct thread *); -void ospf_router_lsa_timer_add (struct ospf_area *); +extern struct ospf_lsa *ospf_router_lsa_originate (struct ospf_area *); +extern int ospf_router_lsa_update_timer (struct thread *); +extern void ospf_router_lsa_timer_add (struct ospf_area *); -int ospf_network_lsa_refresh (struct ospf_lsa *, struct ospf_interface *); -void ospf_network_lsa_timer_add (struct ospf_interface *); +extern int ospf_network_lsa_refresh (struct ospf_lsa *, struct ospf_interface *); +extern void ospf_network_lsa_timer_add (struct ospf_interface *); -struct ospf_lsa *ospf_summary_lsa_originate (struct prefix_ipv4 *, u_int32_t, +extern struct ospf_lsa *ospf_summary_lsa_originate (struct prefix_ipv4 *, u_int32_t, struct ospf_area *); -struct ospf_lsa *ospf_summary_asbr_lsa_originate (struct prefix_ipv4 *, +extern struct ospf_lsa *ospf_summary_asbr_lsa_originate (struct prefix_ipv4 *, u_int32_t, struct ospf_area *); -struct ospf_lsa *ospf_summary_lsa_refresh (struct ospf *, struct ospf_lsa *); -struct ospf_lsa *ospf_summary_asbr_lsa_refresh (struct ospf *, struct ospf_lsa *); +extern struct ospf_lsa *ospf_summary_lsa_refresh (struct ospf *, struct ospf_lsa *); +extern struct ospf_lsa *ospf_summary_asbr_lsa_refresh (struct ospf *, struct ospf_lsa *); -struct ospf_lsa *ospf_lsa_install (struct ospf *, +extern struct ospf_lsa *ospf_lsa_install (struct ospf *, struct ospf_interface *, struct ospf_lsa *); -void ospf_nssa_lsa_flush (struct ospf *ospf, struct prefix_ipv4 *p); -void ospf_external_lsa_flush (struct ospf *, u_char, struct prefix_ipv4 *, +extern void ospf_nssa_lsa_flush (struct ospf *ospf, struct prefix_ipv4 *p); +extern void ospf_external_lsa_flush (struct ospf *, u_char, struct prefix_ipv4 *, unsigned int, struct in_addr); -struct in_addr ospf_get_ip_from_ifp (struct ospf_interface *); +extern struct in_addr ospf_get_ip_from_ifp (struct ospf_interface *); -struct ospf_lsa *ospf_external_lsa_originate (struct ospf *, struct external_info *); -int ospf_external_lsa_originate_timer (struct thread *); -struct ospf_lsa *ospf_lsa_lookup (struct ospf_area *, u_int32_t, +extern struct ospf_lsa *ospf_external_lsa_originate (struct ospf *, struct external_info *); +extern int ospf_external_lsa_originate_timer (struct thread *); +extern struct ospf_lsa *ospf_lsa_lookup (struct ospf_area *, u_int32_t, struct in_addr, struct in_addr); -struct ospf_lsa *ospf_lsa_lookup_by_id (struct ospf_area *, +extern struct ospf_lsa *ospf_lsa_lookup_by_id (struct ospf_area *, u_int32_t, struct in_addr); -struct ospf_lsa *ospf_lsa_lookup_by_header (struct ospf_area *, +extern struct ospf_lsa *ospf_lsa_lookup_by_header (struct ospf_area *, struct lsa_header *); -int ospf_lsa_more_recent (struct ospf_lsa *, struct ospf_lsa *); -int ospf_lsa_different (struct ospf_lsa *, struct ospf_lsa *); -void ospf_flush_self_originated_lsas_now (struct ospf *); +extern int ospf_lsa_more_recent (struct ospf_lsa *, struct ospf_lsa *); +extern int ospf_lsa_different (struct ospf_lsa *, struct ospf_lsa *); +extern void ospf_flush_self_originated_lsas_now (struct ospf *); -int ospf_lsa_is_self_originated (struct ospf *, struct ospf_lsa *); +extern int ospf_lsa_is_self_originated (struct ospf *, struct ospf_lsa *); -struct ospf_lsa *ospf_lsa_lookup_by_prefix (struct ospf_lsdb *, u_char, +extern struct ospf_lsa *ospf_lsa_lookup_by_prefix (struct ospf_lsdb *, u_char, struct prefix_ipv4 *, struct in_addr); -void ospf_lsa_maxage (struct ospf *, struct ospf_lsa *); -u_int32_t get_metric (u_char *); +extern void ospf_lsa_maxage (struct ospf *, struct ospf_lsa *); +extern u_int32_t get_metric (u_char *); -int ospf_lsa_maxage_walker (struct thread *); +extern int ospf_lsa_maxage_walker (struct thread *); -void ospf_external_lsa_refresh_default (struct ospf *); +extern void ospf_external_lsa_refresh_default (struct ospf *); -void ospf_external_lsa_refresh_type (struct ospf *, u_char, int); -void ospf_external_lsa_refresh (struct ospf *, struct ospf_lsa *, +extern void ospf_external_lsa_refresh_type (struct ospf *, u_char, int); +extern void ospf_external_lsa_refresh (struct ospf *, struct ospf_lsa *, struct external_info *, int); -struct in_addr ospf_lsa_unique_id (struct ospf *, struct ospf_lsdb *, u_char, +extern struct in_addr ospf_lsa_unique_id (struct ospf *, struct ospf_lsdb *, u_char, struct prefix_ipv4 *); -void ospf_schedule_lsa_flood_area (struct ospf_area *, struct ospf_lsa *); -void ospf_schedule_lsa_flush_area (struct ospf_area *, struct ospf_lsa *); +extern void ospf_schedule_lsa_flood_area (struct ospf_area *, struct ospf_lsa *); +extern void ospf_schedule_lsa_flush_area (struct ospf_area *, struct ospf_lsa *); -void ospf_refresher_register_lsa (struct ospf *, struct ospf_lsa *); -void ospf_refresher_unregister_lsa (struct ospf *, struct ospf_lsa *); -int ospf_lsa_refresh_walker (struct thread *); +extern void ospf_refresher_register_lsa (struct ospf *, struct ospf_lsa *); +extern void ospf_refresher_unregister_lsa (struct ospf *, struct ospf_lsa *); +extern int ospf_lsa_refresh_walker (struct thread *); -void ospf_lsa_maxage_delete (struct ospf *, struct ospf_lsa *); +extern void ospf_lsa_maxage_delete (struct ospf *, struct ospf_lsa *); -void ospf_discard_from_db (struct ospf *, struct ospf_lsdb *, struct ospf_lsa*); -int is_prefix_default (struct prefix_ipv4 *); +extern void ospf_discard_from_db (struct ospf *, struct ospf_lsdb *, struct ospf_lsa*); +extern int is_prefix_default (struct prefix_ipv4 *); -int metric_type (struct ospf *, u_char); -int metric_value (struct ospf *, u_char); +extern int metric_type (struct ospf *, u_char); +extern int metric_value (struct ospf *, u_char); -struct in_addr ospf_get_nssa_ip (struct ospf_area *); -int ospf_translated_nssa_compare (struct ospf_lsa *, struct ospf_lsa *); -struct ospf_lsa *ospf_translated_nssa_refresh (struct ospf *, struct ospf_lsa *, +extern struct in_addr ospf_get_nssa_ip (struct ospf_area *); +extern int ospf_translated_nssa_compare (struct ospf_lsa *, struct ospf_lsa *); +extern struct ospf_lsa *ospf_translated_nssa_refresh (struct ospf *, struct ospf_lsa *, struct ospf_lsa *); -struct ospf_lsa *ospf_translated_nssa_originate (struct ospf *, struct ospf_lsa *); +extern struct ospf_lsa *ospf_translated_nssa_originate (struct ospf *, struct ospf_lsa *); #endif /* _ZEBRA_OSPF_LSA_H */ diff --git a/ospfd/ospf_lsdb.c b/ospfd/ospf_lsdb.c index 56ab9e2a8..c0ec4b3df 100644 --- a/ospfd/ospf_lsdb.c +++ b/ospfd/ospf_lsdb.c @@ -71,7 +71,7 @@ ospf_lsdb_cleanup (struct ospf_lsdb *lsdb) route_table_finish (lsdb->type[i].db); } -void +static void lsdb_prefix_set (struct prefix_ls *lp, struct ospf_lsa *lsa) { memset (lp, 0, sizeof (struct prefix_ls)); diff --git a/ospfd/ospf_lsdb.h b/ospfd/ospf_lsdb.h index e192308cc..4157b6856 100644 --- a/ospfd/ospf_lsdb.h +++ b/ospfd/ospf_lsdb.h @@ -62,25 +62,25 @@ struct ospf_lsdb #define AS_LSDB(O,T) ((O)->lsdb->type[(T)].db) /* OSPF LSDB related functions. */ -struct ospf_lsdb *ospf_lsdb_new (); -void ospf_lsdb_init (struct ospf_lsdb *); -void ospf_lsdb_free (struct ospf_lsdb *); -void ospf_lsdb_cleanup (struct ospf_lsdb *); -void ospf_lsdb_add (struct ospf_lsdb *, struct ospf_lsa *); -void ospf_lsdb_delete (struct ospf_lsdb *, struct ospf_lsa *); -void ospf_lsdb_delete_all (struct ospf_lsdb *); +extern struct ospf_lsdb *ospf_lsdb_new (void); +extern void ospf_lsdb_init (struct ospf_lsdb *); +extern void ospf_lsdb_free (struct ospf_lsdb *); +extern void ospf_lsdb_cleanup (struct ospf_lsdb *); +extern void ospf_lsdb_add (struct ospf_lsdb *, struct ospf_lsa *); +extern void ospf_lsdb_delete (struct ospf_lsdb *, struct ospf_lsa *); +extern void ospf_lsdb_delete_all (struct ospf_lsdb *); /* Set all stats to -1 (LSA_SPF_NOT_EXPLORED). */ -void ospf_lsdb_clean_stat (struct ospf_lsdb *lsdb); -struct ospf_lsa *ospf_lsdb_lookup (struct ospf_lsdb *, struct ospf_lsa *); -struct ospf_lsa *ospf_lsdb_lookup_by_id (struct ospf_lsdb *, u_char, +extern void ospf_lsdb_clean_stat (struct ospf_lsdb *lsdb); +extern struct ospf_lsa *ospf_lsdb_lookup (struct ospf_lsdb *, struct ospf_lsa *); +extern struct ospf_lsa *ospf_lsdb_lookup_by_id (struct ospf_lsdb *, u_char, struct in_addr, struct in_addr); -struct ospf_lsa *ospf_lsdb_lookup_by_id_next (struct ospf_lsdb *, u_char, +extern struct ospf_lsa *ospf_lsdb_lookup_by_id_next (struct ospf_lsdb *, u_char, struct in_addr, struct in_addr, int); -unsigned long ospf_lsdb_count_all (struct ospf_lsdb *); -unsigned long ospf_lsdb_count (struct ospf_lsdb *, int); -unsigned long ospf_lsdb_count_self (struct ospf_lsdb *, int); -unsigned int ospf_lsdb_checksum (struct ospf_lsdb *, int); -unsigned long ospf_lsdb_isempty (struct ospf_lsdb *); +extern unsigned long ospf_lsdb_count_all (struct ospf_lsdb *); +extern unsigned long ospf_lsdb_count (struct ospf_lsdb *, int); +extern unsigned long ospf_lsdb_count_self (struct ospf_lsdb *, int); +extern unsigned int ospf_lsdb_checksum (struct ospf_lsdb *, int); +extern unsigned long ospf_lsdb_isempty (struct ospf_lsdb *); #endif /* _ZEBRA_OSPF_LSDB_H */ diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c index 7955162d0..b0ad3ab70 100644 --- a/ospfd/ospf_main.c +++ b/ospfd/ospf_main.c @@ -105,7 +105,7 @@ extern int ospf_apiserver_enable; #endif /* SUPPORT_OSPF_API */ /* Help information display. */ -static void +static void __attribute__ ((noreturn)) usage (char *progname, int status) { if (status != 0) @@ -131,14 +131,14 @@ Report bugs to %s\n", progname, ZEBRA_BUG_ADDRESS); } /* SIGHUP handler. */ -void +static void sighup (void) { zlog (NULL, LOG_INFO, "SIGHUP received"); } /* SIGINT handler. */ -void +static void __attribute__ ((noreturn)) sigint (void) { zlog_notice ("Terminating on signal"); @@ -149,7 +149,7 @@ sigint (void) } /* SIGUSR1 handler. */ -void +static void sigusr1 (void) { zlog_rotate (NULL); diff --git a/ospfd/ospf_neighbor.c b/ospfd/ospf_neighbor.c index 35906ec8a..5c1a7627a 100644 --- a/ospfd/ospf_neighbor.c +++ b/ospfd/ospf_neighbor.c @@ -338,7 +338,7 @@ ospf_nbr_lookup (struct ospf_interface *oi, struct ip *iph, return (ospf_nbr_lookup_by_addr (oi->nbrs, &iph->ip_src)); } -struct ospf_neighbor * +static struct ospf_neighbor * ospf_nbr_add (struct ospf_interface *oi, struct ospf_header *ospfh, struct prefix *p) { diff --git a/ospfd/ospf_neighbor.h b/ospfd/ospf_neighbor.h index f91ef3f95..cbfbc2d8a 100644 --- a/ospfd/ospf_neighbor.h +++ b/ospfd/ospf_neighbor.h @@ -90,25 +90,26 @@ struct ospf_neighbor #define NBR_IS_BDR(n) IPV4_ADDR_SAME (&n->address.u.prefix4, &n->bd_router) /* Prototypes. */ -struct ospf_neighbor *ospf_nbr_new (struct ospf_interface *); -void ospf_nbr_free (struct ospf_neighbor *); -void ospf_nbr_delete (struct ospf_neighbor *); -int ospf_nbr_bidirectional (struct in_addr *, struct in_addr *, int); -void ospf_nbr_add_self (struct ospf_interface *); -int ospf_nbr_count (struct ospf_interface *, int); +extern struct ospf_neighbor *ospf_nbr_new (struct ospf_interface *); +extern void ospf_nbr_free (struct ospf_neighbor *); +extern void ospf_nbr_delete (struct ospf_neighbor *); +extern int ospf_nbr_bidirectional (struct in_addr *, struct in_addr *, int); +extern void ospf_nbr_add_self (struct ospf_interface *); +extern int ospf_nbr_count (struct ospf_interface *, int); #ifdef HAVE_OPAQUE_LSA -int ospf_nbr_count_opaque_capable (struct ospf_interface *); +extern int ospf_nbr_count_opaque_capable (struct ospf_interface *); #endif /* HAVE_OPAQUE_LSA */ -struct ospf_neighbor *ospf_nbr_get (struct ospf_interface *, - struct ospf_header *, - struct ip *, - struct prefix *); -struct ospf_neighbor *ospf_nbr_lookup (struct ospf_interface *, struct ip *, - struct ospf_header *); -struct ospf_neighbor *ospf_nbr_lookup_by_addr (struct route_table *, - struct in_addr *); -struct ospf_neighbor *ospf_nbr_lookup_by_routerid (struct route_table *, - struct in_addr *); -void ospf_renegotiate_optional_capabilities (struct ospf *top); +extern struct ospf_neighbor *ospf_nbr_get (struct ospf_interface *, + struct ospf_header *, + struct ip *, struct prefix *); +extern struct ospf_neighbor *ospf_nbr_lookup (struct ospf_interface *, + struct ip *, + struct ospf_header *); +extern struct ospf_neighbor *ospf_nbr_lookup_by_addr (struct route_table *, + struct in_addr *); +extern struct ospf_neighbor *ospf_nbr_lookup_by_routerid (struct route_table + *, + struct in_addr *); +extern void ospf_renegotiate_optional_capabilities (struct ospf *top); #endif /* _ZEBRA_OSPF_NEIGHBOR_H */ diff --git a/ospfd/ospf_network.h b/ospfd/ospf_network.h index 52a25fd9d..1b43df1c7 100644 --- a/ospfd/ospf_network.h +++ b/ospfd/ospf_network.h @@ -24,11 +24,15 @@ #define _ZEBRA_OSPF_NETWORK_H /* Prototypes. */ -int ospf_if_add_allspfrouters (struct ospf *, struct prefix *, unsigned int); -int ospf_if_drop_allspfrouters (struct ospf *, struct prefix *, unsigned int); -int ospf_if_add_alldrouters (struct ospf *, struct prefix *, unsigned int); -int ospf_if_drop_alldrouters (struct ospf *, struct prefix *, unsigned int); -int ospf_if_ipmulticast (struct ospf *, struct prefix *, unsigned int); -int ospf_sock_init (void); +extern int ospf_if_add_allspfrouters (struct ospf *, struct prefix *, + unsigned int); +extern int ospf_if_drop_allspfrouters (struct ospf *, struct prefix *, + unsigned int); +extern int ospf_if_add_alldrouters (struct ospf *, struct prefix *, + unsigned int); +extern int ospf_if_drop_alldrouters (struct ospf *, struct prefix *, + unsigned int); +extern int ospf_if_ipmulticast (struct ospf *, struct prefix *, unsigned int); +extern int ospf_sock_init (void); #endif /* _ZEBRA_OSPF_NETWORK_H */ diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c index ce84624bc..b18540a41 100644 --- a/ospfd/ospf_nsm.c +++ b/ospfd/ospf_nsm.c @@ -52,7 +52,7 @@ void nsm_reset_nbr (struct ospf_neighbor *); /* OSPF NSM Timer functions. */ -int +static int ospf_inactivity_timer (struct thread *thread) { struct ospf_neighbor *nbr; @@ -69,7 +69,7 @@ ospf_inactivity_timer (struct thread *thread) return 0; } -int +static int ospf_db_desc_timer (struct thread *thread) { struct ospf_interface *oi; @@ -96,7 +96,7 @@ ospf_db_desc_timer (struct thread *thread) /* Hook function called after ospf NSM event is occured. */ -void +static void nsm_timer_set (struct ospf_neighbor *nbr) { switch (nbr->state) @@ -140,7 +140,7 @@ nsm_timer_set (struct ospf_neighbor *nbr) /* OSPF NSM functions. */ -int +static int nsm_ignore (struct ospf_neighbor *nbr) { if (IS_DEBUG_OSPF (nsm, NSM_EVENTS)) @@ -150,7 +150,7 @@ nsm_ignore (struct ospf_neighbor *nbr) return 0; } -int +static int nsm_hello_received (struct ospf_neighbor *nbr) { /* Start or Restart Inactivity Timer. */ @@ -165,7 +165,7 @@ nsm_hello_received (struct ospf_neighbor *nbr) return 0; } -int +static int nsm_start (struct ospf_neighbor *nbr) { @@ -182,7 +182,7 @@ nsm_start (struct ospf_neighbor *nbr) return 0; } -int +static int nsm_twoway_received (struct ospf_neighbor *nbr) { struct ospf_interface *oi; @@ -221,7 +221,7 @@ ospf_db_summary_isempty (struct ospf_neighbor *nbr) return ospf_lsdb_isempty (&nbr->db_sum); } -int +static int ospf_db_summary_add (struct ospf_neighbor *nbr, struct ospf_lsa *lsa) { #ifdef HAVE_OPAQUE_LSA @@ -282,7 +282,7 @@ ospf_db_summary_clear (struct ospf_neighbor *nbr) AS-external-LSAs are omitted from a virtual neighbor's Database summary list. AS-external-LSAs are omitted from the Database summary list if the area has been configured as a stub. */ -int +static int nsm_negotiation_done (struct ospf_neighbor *nbr) { struct ospf_area *area = nbr->oi->area; @@ -325,7 +325,7 @@ nsm_negotiation_done (struct ospf_neighbor *nbr) return 0; } -int +static int nsm_exchange_done (struct ospf_neighbor *nbr) { if (ospf_ls_request_isempty (nbr)) @@ -340,7 +340,7 @@ nsm_exchange_done (struct ospf_neighbor *nbr) return NSM_Loading; } -int +static int nsm_bad_ls_req (struct ospf_neighbor *nbr) { /* Clear neighbor. */ @@ -349,7 +349,7 @@ nsm_bad_ls_req (struct ospf_neighbor *nbr) return 0; } -int +static int nsm_adj_ok (struct ospf_neighbor *nbr) { struct ospf_interface *oi; @@ -382,7 +382,7 @@ nsm_adj_ok (struct ospf_neighbor *nbr) return next_state; } -int +static int nsm_seq_number_mismatch (struct ospf_neighbor *nbr) { /* Clear neighbor. */ @@ -391,7 +391,7 @@ nsm_seq_number_mismatch (struct ospf_neighbor *nbr) return 0; } -int +static int nsm_oneway_received (struct ospf_neighbor *nbr) { /* Clear neighbor. */ @@ -427,7 +427,7 @@ nsm_reset_nbr (struct ospf_neighbor *nbr) #endif /* HAVE_OPAQUE_LSA */ } -int +static int nsm_kill_nbr (struct ospf_neighbor *nbr) { /* call it here because we cannot call it from ospf_nsm_event */ @@ -459,7 +459,7 @@ nsm_kill_nbr (struct ospf_neighbor *nbr) return 0; } -int +static int nsm_inactivity_timer (struct ospf_neighbor *nbr) { /* Kill neighbor. */ @@ -468,7 +468,7 @@ nsm_inactivity_timer (struct ospf_neighbor *nbr) return 0; } -int +static int nsm_ll_down (struct ospf_neighbor *nbr) { /* Reset neighbor. */ @@ -482,7 +482,7 @@ nsm_ll_down (struct ospf_neighbor *nbr) /* Neighbor State Machine */ struct { - int (*func) (); + int (*func) (struct ospf_neighbor *); int next_state; } NSM [OSPF_NSM_STATE_MAX][OSPF_NSM_EVENT_MAX] = { diff --git a/ospfd/ospf_nsm.h b/ospfd/ospf_nsm.h index 3d2573055..fe42f7a0a 100644 --- a/ospfd/ospf_nsm.h +++ b/ospfd/ospf_nsm.h @@ -54,38 +54,37 @@ #define OSPF_NSM_EVENT_MAX 14 /* Macro for OSPF NSM timer turn on. */ -#define OSPF_NSM_TIMER_ON(T,F,V) \ - do { \ - if (!(T)) \ - (T) = thread_add_timer (master, (F), nbr, (V)); \ +#define OSPF_NSM_TIMER_ON(T,F,V) \ + do { \ + if (!(T)) \ + (T) = thread_add_timer (master, (F), nbr, (V)); \ } while (0) /* Macro for OSPF NSM timer turn off. */ -#define OSPF_NSM_TIMER_OFF(X) \ - do { \ - if (X) \ - { \ - thread_cancel (X); \ - (X) = NULL; \ - } \ +#define OSPF_NSM_TIMER_OFF(X) \ + do { \ + if (X) \ + { \ + thread_cancel (X); \ + (X) = NULL; \ + } \ } while (0) /* Macro for OSPF NSM schedule event. */ -#define OSPF_NSM_EVENT_SCHEDULE(N,E) \ +#define OSPF_NSM_EVENT_SCHEDULE(N,E) \ thread_add_event (master, ospf_nsm_event, (N), (E)) /* Macro for OSPF NSM execute event. */ -#define OSPF_NSM_EVENT_EXECUTE(N,E) \ +#define OSPF_NSM_EVENT_EXECUTE(N,E) \ thread_execute (master, ospf_nsm_event, (N), (E)) /* Prototypes. */ -int ospf_nsm_event (struct thread *); -void nsm_change_state (struct ospf_neighbor *, int); -void ospf_check_nbr_loading (struct ospf_neighbor *); -int ospf_db_summary_isempty (struct ospf_neighbor *); -int ospf_db_summary_count (struct ospf_neighbor *); -void ospf_db_summary_clear (struct ospf_neighbor *); -/* void ospf_db_summary_delete_all (struct ospf_neighbor *); */ +extern int ospf_nsm_event (struct thread *); +extern void nsm_change_state (struct ospf_neighbor *, int); +extern void ospf_check_nbr_loading (struct ospf_neighbor *); +extern int ospf_db_summary_isempty (struct ospf_neighbor *); +extern int ospf_db_summary_count (struct ospf_neighbor *); +extern void ospf_db_summary_clear (struct ospf_neighbor *); #endif /* _ZEBRA_OSPF_NSM_H */ diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c index d6b2f25bc..6cc098788 100644 --- a/ospfd/ospf_opaque.c +++ b/ospfd/ospf_opaque.c @@ -1979,8 +1979,6 @@ out: return rc; } -extern int ospf_lsa_refresh_delay (struct ospf_lsa *); /* ospf_lsa.c */ - void ospf_opaque_lsa_refresh_schedule (struct ospf_lsa *lsa0) { diff --git a/ospfd/ospf_opaque.h b/ospfd/ospf_opaque.h index 743f043ca..e33fb65bb 100644 --- a/ospfd/ospf_opaque.h +++ b/ospfd/ospf_opaque.h @@ -24,6 +24,8 @@ #ifndef _ZEBRA_OSPF_OPAQUE_H #define _ZEBRA_OSPF_OPAQUE_H +#include "vty.h" + #define IS_OPAQUE_LSA(type) \ ((type) == OSPF_OPAQUE_LINK_LSA || \ (type) == OSPF_OPAQUE_AREA_LSA || \ @@ -95,8 +97,6 @@ ((ntohs((lsahdr)->length) % sizeof (u_int32_t)) == 0)) /* Prototypes. */ -struct vty; -struct stream; extern void ospf_opaque_init (void); extern void ospf_opaque_term (void); @@ -128,28 +128,36 @@ extern void ospf_delete_opaque_functab (u_char lsa_type, u_char opaque_type); extern int ospf_opaque_new_if (struct interface *ifp); extern int ospf_opaque_del_if (struct interface *ifp); -extern void ospf_opaque_ism_change (struct ospf_interface *oi, int old_status); -extern void ospf_opaque_nsm_change (struct ospf_neighbor *nbr, int old_status); +extern void ospf_opaque_ism_change (struct ospf_interface *oi, + int old_status); +extern void ospf_opaque_nsm_change (struct ospf_neighbor *nbr, + int old_status); extern void ospf_opaque_config_write_router (struct vty *vty, struct ospf *); -extern void ospf_opaque_config_write_if (struct vty *vty, struct interface *ifp); +extern void ospf_opaque_config_write_if (struct vty *vty, + struct interface *ifp); extern void ospf_opaque_config_write_debug (struct vty *vty); extern void show_opaque_info_detail (struct vty *vty, struct ospf_lsa *lsa); extern void ospf_opaque_lsa_dump (struct stream *s, u_int16_t length); -extern void ospf_opaque_lsa_originate_schedule (struct ospf_interface *oi, int *init_delay); -extern struct ospf_lsa *ospf_opaque_lsa_install (struct ospf_lsa *new, int rt_recalc); +extern void ospf_opaque_lsa_originate_schedule (struct ospf_interface *oi, + int *init_delay); +extern struct ospf_lsa *ospf_opaque_lsa_install (struct ospf_lsa *new, + int rt_recalc); extern void ospf_opaque_lsa_refresh (struct ospf_lsa *lsa); -extern void ospf_opaque_lsa_reoriginate_schedule (void *lsa_type_dependent, u_char lsa_type, u_char opaque_type); +extern void ospf_opaque_lsa_reoriginate_schedule (void *lsa_type_dependent, + u_char lsa_type, + u_char opaque_type); extern void ospf_opaque_lsa_refresh_schedule (struct ospf_lsa *lsa); extern void ospf_opaque_lsa_flush_schedule (struct ospf_lsa *lsa); -extern void ospf_opaque_adjust_lsreq (struct ospf_neighbor *nbr, - struct list *lsas); -extern void ospf_opaque_self_originated_lsa_received (struct ospf_neighbor *nbr, - struct list *lsas); -extern void ospf_opaque_ls_ack_received (struct ospf_neighbor *nbr, - struct list *acks); +extern void ospf_opaque_adjust_lsreq (struct ospf_neighbor *nbr, + struct list *lsas); +extern void ospf_opaque_self_originated_lsa_received (struct ospf_neighbor + *nbr, + struct list *lsas); +extern void ospf_opaque_ls_ack_received (struct ospf_neighbor *nbr, + struct list *acks); extern void htonf (float *src, float *dst); extern void ntohf (float *src, float *dst); diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index 8892f0e59..e223b56d7 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -65,7 +65,7 @@ const char *ospf_packet_type_str[] = extern int in_cksum (void *ptr, int nbytes); /* OSPF authentication checking function */ -int +static int ospf_auth_type (struct ospf_interface *oi) { int auth_type; @@ -234,7 +234,7 @@ ospf_packet_dup (struct ospf_packet *op) } /* XXX inline */ -unsigned int +static inline unsigned int ospf_packet_authspace (struct ospf_interface *oi) { int auth = 0; @@ -245,7 +245,7 @@ ospf_packet_authspace (struct ospf_interface *oi) return auth; } -unsigned int +static unsigned int ospf_packet_max (struct ospf_interface *oi) { int max; @@ -258,7 +258,7 @@ ospf_packet_max (struct ospf_interface *oi) } -int +static int ospf_check_md5_digest (struct ospf_interface *oi, struct stream *s, u_int16_t length) { @@ -322,7 +322,7 @@ ospf_check_md5_digest (struct ospf_interface *oi, struct stream *s, /* This function is called from ospf_write(), it will detect the authentication scheme and if it is MD5, it will change the sequence and update the MD5 digest. */ -int +static int ospf_make_md5_digest (struct ospf_interface *oi, struct ospf_packet *op) { struct ospf_header *ospfh; @@ -331,7 +331,7 @@ ospf_make_md5_digest (struct ospf_interface *oi, struct ospf_packet *op) void *ibuf; u_int32_t t; struct crypt_key *ck; - char *auth_key; + const char *auth_key; ibuf = STREAM_DATA (op->s); ospfh = (struct ospf_header *) ibuf; @@ -347,11 +347,11 @@ ospf_make_md5_digest (struct ospf_interface *oi, struct ospf_packet *op) /* Get MD5 Authentication key from auth_key list. */ if (list_isempty (OSPF_IF_PARAM (oi, auth_crypt))) - auth_key = (char *) ""; + auth_key = ""; else { ck = listgetdata (listtail(OSPF_IF_PARAM (oi, auth_crypt))); - auth_key = (char *) ck->auth_key; + auth_key = ck->auth_key; } /* Generate a digest for the entire packet + our secret key. */ @@ -373,7 +373,7 @@ ospf_make_md5_digest (struct ospf_interface *oi, struct ospf_packet *op) } -int +static int ospf_ls_req_timer (struct thread *thread) { struct ospf_neighbor *nbr; @@ -729,7 +729,7 @@ ospf_write (struct thread *thread) } /* OSPF Hello message read -- RFC2328 Section 10.5. */ -void +static void ospf_hello (struct ip *iph, struct ospf_header *ospfh, struct stream * s, struct ospf_interface *oi, int size) { @@ -961,7 +961,7 @@ ospf_hello (struct ip *iph, struct ospf_header *ospfh, } /* Save DD flags/options/Seqnum received. */ -void +static void ospf_db_desc_save_current (struct ospf_neighbor *nbr, struct ospf_db_desc *dd) { @@ -1078,7 +1078,7 @@ ospf_db_desc_proc (struct stream *s, struct ospf_interface *oi, ospf_db_desc_save_current (nbr, dd); } -int +static int ospf_db_desc_is_dup (struct ospf_db_desc *dd, struct ospf_neighbor *nbr) { /* Is DD duplicated? */ @@ -1358,7 +1358,7 @@ ospf_db_desc (struct ip *iph, struct ospf_header *ospfh, #define OSPF_LSA_KEY_SIZE 12 /* type(4) + id(4) + ar(4) */ /* OSPF Link State Request Read -- RFC2328 Section 10.7. */ -void +static void ospf_ls_req (struct ip *iph, struct ospf_header *ospfh, struct stream *s, struct ospf_interface *oi, u_int16_t size) { @@ -1576,7 +1576,7 @@ ospf_ls_upd_list_lsa (struct ospf_neighbor *nbr, struct stream *s, } /* Cleanup Update list. */ -void +static void ospf_upd_list_clean (struct list *lsas) { struct listnode *node, *nnode; @@ -1589,7 +1589,7 @@ ospf_upd_list_clean (struct list *lsas) } /* OSPF Link State Update message read -- RFC2328 Section 13. */ -void +static void ospf_ls_upd (struct ip *iph, struct ospf_header *ospfh, struct stream *s, struct ospf_interface *oi, u_int16_t size) { @@ -1951,7 +1951,7 @@ ospf_ls_upd (struct ip *iph, struct ospf_header *ospfh, } /* OSPF Link State Acknowledgment message read -- RFC2328 Section 13.7. */ -void +static void ospf_ls_ack (struct ip *iph, struct ospf_header *ospfh, struct stream *s, struct ospf_interface *oi, u_int16_t size) { @@ -2099,7 +2099,7 @@ ospf_recv_packet (int fd, struct interface **ifp, struct stream *ibuf) return ibuf; } -struct ospf_interface * +static struct ospf_interface * ospf_associate_packet_vl (struct ospf *ospf, struct interface *ifp, struct ip *iph, struct ospf_header *ospfh) { @@ -2150,7 +2150,7 @@ ospf_associate_packet_vl (struct ospf *ospf, struct interface *ifp, return NULL; } -int +static inline int ospf_check_area_id (struct ospf_interface *oi, struct ospf_header *ospfh) { /* Check match the Area ID of the receiving interface. */ @@ -2163,7 +2163,7 @@ ospf_check_area_id (struct ospf_interface *oi, struct ospf_header *ospfh) /* Unbound socket will accept any Raw IP packets if proto is matched. To prevent it, compare src IP address and i/f address with masking i/f network mask. */ -int +static int ospf_check_network_mask (struct ospf_interface *oi, struct in_addr ip_src) { struct in_addr mask, me, him; @@ -2183,7 +2183,7 @@ ospf_check_network_mask (struct ospf_interface *oi, struct in_addr ip_src) return 0; } -int +static int ospf_check_auth (struct ospf_interface *oi, struct stream *ibuf, struct ospf_header *ospfh) { @@ -2224,7 +2224,7 @@ ospf_check_auth (struct ospf_interface *oi, struct stream *ibuf, return ret; } -int +static int ospf_check_sum (struct ospf_header *ospfh) { u_int32_t ret; @@ -2252,7 +2252,7 @@ ospf_check_sum (struct ospf_header *ospfh) } /* OSPF Header verification. */ -int +static int ospf_verify_header (struct stream *ibuf, struct ospf_interface *oi, struct ip *iph, struct ospf_header *ospfh) { @@ -2511,7 +2511,7 @@ ospf_read (struct thread *thread) } /* Make OSPF header. */ -void +static void ospf_make_header (int type, struct ospf_interface *oi, struct stream *s) { struct ospf_header *ospfh; @@ -2533,7 +2533,7 @@ ospf_make_header (int type, struct ospf_interface *oi, struct stream *s) } /* Make Authentication Data. */ -int +static int ospf_make_auth (struct ospf_interface *oi, struct ospf_header *ospfh) { struct crypt_key *ck; @@ -2573,7 +2573,7 @@ ospf_make_auth (struct ospf_interface *oi, struct ospf_header *ospfh) } /* Fill rest of OSPF header. */ -void +static void ospf_fill_header (struct ospf_interface *oi, struct stream *s, u_int16_t length) { @@ -2594,7 +2594,7 @@ ospf_fill_header (struct ospf_interface *oi, ospf_make_auth (oi, ospfh); } -int +static int ospf_make_hello (struct ospf_interface *oi, struct stream *s) { struct ospf_neighbor *nbr; @@ -2661,7 +2661,7 @@ ospf_make_hello (struct ospf_interface *oi, struct stream *s) return length; } -int +static int ospf_make_db_desc (struct ospf_interface *oi, struct ospf_neighbor *nbr, struct stream *s) { @@ -2772,7 +2772,7 @@ ospf_make_db_desc (struct ospf_interface *oi, struct ospf_neighbor *nbr, return length; } -int +static int ospf_make_ls_req_func (struct stream *s, u_int16_t *length, unsigned long delta, struct ospf_neighbor *nbr, struct ospf_lsa *lsa) @@ -2796,7 +2796,7 @@ ospf_make_ls_req_func (struct stream *s, u_int16_t *length, return 1; } -int +static int ospf_make_ls_req (struct ospf_neighbor *nbr, struct stream *s) { struct ospf_lsa *lsa; @@ -2823,7 +2823,7 @@ ospf_make_ls_req (struct ospf_neighbor *nbr, struct stream *s) return length; } -int +static int ls_age_increment (struct ospf_lsa *lsa, int delay) { int age; @@ -2833,7 +2833,7 @@ ls_age_increment (struct ospf_lsa *lsa, int delay) return (age > OSPF_LSA_MAXAGE ? OSPF_LSA_MAXAGE : age); } -int +static int ospf_make_ls_upd (struct ospf_interface *oi, struct list *update, struct stream *s) { struct ospf_lsa *lsa; @@ -2896,7 +2896,7 @@ ospf_make_ls_upd (struct ospf_interface *oi, struct list *update, struct stream return length; } -int +static int ospf_make_ls_ack (struct ospf_interface *oi, struct list *ack, struct stream *s) { struct list *rm_list; @@ -2965,7 +2965,7 @@ ospf_hello_send_sub (struct ospf_interface *oi, struct in_addr *addr) OSPF_ISM_WRITE_ON (oi->ospf); } -void +static void ospf_poll_send (struct ospf_nbr_nbma *nbr_nbma) { struct ospf_interface *oi; diff --git a/ospfd/ospf_packet.h b/ospfd/ospf_packet.h index af9e634ba..7b3d68661 100644 --- a/ospfd/ospf_packet.h +++ b/ospfd/ospf_packet.h @@ -131,36 +131,37 @@ struct ospf_db_desc #define IS_SET_DD_ALL(X) ((X) & OSPF_DD_FLAG_ALL) /* Prototypes. */ -void ospf_output_forward (struct stream *, int); -struct ospf_packet *ospf_packet_new (size_t); -void ospf_packet_free (struct ospf_packet *); -struct ospf_fifo *ospf_fifo_new (); -void ospf_fifo_push (struct ospf_fifo *, struct ospf_packet *); -struct ospf_packet *ospf_fifo_pop (struct ospf_fifo *); -struct ospf_packet *ospf_fifo_head (struct ospf_fifo *); -void ospf_fifo_flush (struct ospf_fifo *); -void ospf_fifo_free (struct ospf_fifo *); -void ospf_packet_add (struct ospf_interface *, struct ospf_packet *); -void ospf_packet_delete (struct ospf_interface *); -struct stream *ospf_stream_dup (struct stream *); -struct ospf_packet *ospf_packet_dup (struct ospf_packet *); - -int ospf_read (struct thread *); -void ospf_hello_send (struct ospf_interface *); -void ospf_db_desc_send (struct ospf_neighbor *); -void ospf_db_desc_resend (struct ospf_neighbor *); -void ospf_ls_req_send (struct ospf_neighbor *); -void ospf_ls_upd_send_lsa (struct ospf_neighbor *, struct ospf_lsa *, int); -void ospf_ls_upd_send (struct ospf_neighbor *, struct list *, int); -void ospf_ls_ack_send (struct ospf_neighbor *, struct ospf_lsa *); -void ospf_ls_ack_send_delayed (struct ospf_interface *); -void ospf_ls_retransmit (struct ospf_interface *, struct ospf_lsa *); -void ospf_ls_req_event (struct ospf_neighbor *); - -int ospf_ls_upd_timer (struct thread *); -int ospf_ls_ack_timer (struct thread *); -int ospf_poll_timer (struct thread *); -int ospf_hello_reply_timer (struct thread *); -void ospf_hello_send_sub (struct ospf_interface *, struct in_addr *); +extern void ospf_output_forward (struct stream *, int); +extern struct ospf_packet *ospf_packet_new (size_t); +extern void ospf_packet_free (struct ospf_packet *); +extern struct ospf_fifo *ospf_fifo_new (void); +extern void ospf_fifo_push (struct ospf_fifo *, struct ospf_packet *); +extern struct ospf_packet *ospf_fifo_pop (struct ospf_fifo *); +extern struct ospf_packet *ospf_fifo_head (struct ospf_fifo *); +extern void ospf_fifo_flush (struct ospf_fifo *); +extern void ospf_fifo_free (struct ospf_fifo *); +extern void ospf_packet_add (struct ospf_interface *, struct ospf_packet *); +extern void ospf_packet_delete (struct ospf_interface *); +extern struct stream *ospf_stream_dup (struct stream *); +extern struct ospf_packet *ospf_packet_dup (struct ospf_packet *); + +extern int ospf_read (struct thread *); +extern void ospf_hello_send (struct ospf_interface *); +extern void ospf_db_desc_send (struct ospf_neighbor *); +extern void ospf_db_desc_resend (struct ospf_neighbor *); +extern void ospf_ls_req_send (struct ospf_neighbor *); +extern void ospf_ls_upd_send_lsa (struct ospf_neighbor *, struct ospf_lsa *, + int); +extern void ospf_ls_upd_send (struct ospf_neighbor *, struct list *, int); +extern void ospf_ls_ack_send (struct ospf_neighbor *, struct ospf_lsa *); +extern void ospf_ls_ack_send_delayed (struct ospf_interface *); +extern void ospf_ls_retransmit (struct ospf_interface *, struct ospf_lsa *); +extern void ospf_ls_req_event (struct ospf_neighbor *); + +extern int ospf_ls_upd_timer (struct thread *); +extern int ospf_ls_ack_timer (struct thread *); +extern int ospf_poll_timer (struct thread *); +extern int ospf_hello_reply_timer (struct thread *); +extern void ospf_hello_send_sub (struct ospf_interface *, struct in_addr *); #endif /* _ZEBRA_OSPF_PACKET_H */ diff --git a/ospfd/ospf_route.c b/ospfd/ospf_route.c index ca39d9b26..00733d844 100644 --- a/ospfd/ospf_route.c +++ b/ospfd/ospf_route.c @@ -74,7 +74,7 @@ ospf_path_new () return new; } -struct ospf_path * +static struct ospf_path * ospf_path_dup (struct ospf_path *path) { struct ospf_path *new; @@ -177,7 +177,7 @@ ospf_route_match_same (struct route_table *rt, struct prefix_ipv4 *prefix, /* delete routes generated from AS-External routes if there is a inter/intra * area route */ -void +static void ospf_route_delete_same_ext(struct route_table *external_routes, struct route_table *routes) { @@ -208,7 +208,7 @@ ospf_route_delete_same_ext(struct route_table *external_routes, } /* rt: Old, cmprt: New */ -void +static void ospf_route_delete_uniq (struct route_table *rt, struct route_table *cmprt) { struct route_node *rn; @@ -270,7 +270,7 @@ ospf_route_install (struct ospf *ospf, struct route_table *rt) } } -void +static void ospf_intra_route_add (struct route_table *rt, struct vertex *v, struct ospf_area *area) { @@ -709,7 +709,7 @@ ospf_terminate () o Intra-area paths using non-backbone areas are always the most preferred. o The other paths, intra-area backbone paths and inter-area paths, are of equal preference. */ -int +static int ospf_asbr_route_cmp (struct ospf *ospf, struct ospf_route *r1, struct ospf_route *r2) { @@ -778,7 +778,7 @@ ospf_route_cmp (struct ospf *ospf, struct ospf_route *r1, return (r1->cost - r2->cost); } -int +static int ospf_path_exist (struct list *plist, struct in_addr nexthop, struct ospf_interface *oi) { diff --git a/ospfd/ospf_route.h b/ospfd/ospf_route.h index 8aee55918..351e014d1 100644 --- a/ospfd/ospf_route.h +++ b/ospfd/ospf_route.h @@ -121,43 +121,45 @@ struct ospf_route } u; }; -struct ospf_path *ospf_path_new (); -void ospf_path_free (struct ospf_path *); -struct ospf_path *ospf_path_lookup (struct list *, struct ospf_path *); -struct ospf_route *ospf_route_new (); -void ospf_route_free (struct ospf_route *); -void ospf_route_delete (struct route_table *); -void ospf_route_table_free (struct route_table *); - -void ospf_route_install (struct ospf *, struct route_table *); -void ospf_route_table_dump (struct route_table *); - -void ospf_intra_add_router (struct route_table *, struct vertex *, - struct ospf_area *); - -void ospf_intra_add_transit (struct route_table *, struct vertex *, - struct ospf_area *); - -void ospf_intra_add_stub (struct route_table *, struct router_lsa_link *, - struct vertex *, struct ospf_area *); - -int ospf_route_cmp (struct ospf *, struct ospf_route *, struct ospf_route *); -void ospf_route_copy_nexthops (struct ospf_route *, struct list *); -void ospf_route_copy_nexthops_from_vertex (struct ospf_route *, - struct vertex * ); - -void ospf_route_subst (struct route_node *, struct ospf_route *, - struct ospf_route *); -void ospf_route_add (struct route_table *, struct prefix_ipv4 *, - struct ospf_route *, struct ospf_route *); - -void ospf_route_subst_nexthops (struct ospf_route *, struct list *); -void ospf_prune_unreachable_networks (struct route_table *); -void ospf_prune_unreachable_routers (struct route_table *); -int ospf_add_discard_route (struct route_table *, struct ospf_area *, - struct prefix_ipv4 *); -void ospf_delete_discard_route (struct prefix_ipv4 *); -int ospf_route_match_same (struct route_table *, struct prefix_ipv4 *, +extern struct ospf_path *ospf_path_new (void); +extern void ospf_path_free (struct ospf_path *); +extern struct ospf_path *ospf_path_lookup (struct list *, struct ospf_path *); +extern struct ospf_route *ospf_route_new (void); +extern void ospf_route_free (struct ospf_route *); +extern void ospf_route_delete (struct route_table *); +extern void ospf_route_table_free (struct route_table *); + +extern void ospf_route_install (struct ospf *, struct route_table *); +extern void ospf_route_table_dump (struct route_table *); + +extern void ospf_intra_add_router (struct route_table *, struct vertex *, + struct ospf_area *); + +extern void ospf_intra_add_transit (struct route_table *, struct vertex *, + struct ospf_area *); + +extern void ospf_intra_add_stub (struct route_table *, + struct router_lsa_link *, struct vertex *, + struct ospf_area *); + +extern int ospf_route_cmp (struct ospf *, struct ospf_route *, struct ospf_route *); +extern void ospf_route_copy_nexthops (struct ospf_route *, struct list *); +extern void ospf_route_copy_nexthops_from_vertex (struct ospf_route *, + struct vertex *); + +extern void ospf_route_subst (struct route_node *, struct ospf_route *, + struct ospf_route *); +extern void ospf_route_add (struct route_table *, struct prefix_ipv4 *, + struct ospf_route *, struct ospf_route *); + +extern void ospf_route_subst_nexthops (struct ospf_route *, struct list *); +extern void ospf_prune_unreachable_networks (struct route_table *); +extern void ospf_prune_unreachable_routers (struct route_table *); +extern int ospf_add_discard_route (struct route_table *, struct ospf_area *, + struct prefix_ipv4 *); +extern void ospf_delete_discard_route (struct prefix_ipv4 *); +extern int ospf_route_match_same (struct route_table *, struct prefix_ipv4 *, + struct ospf_route *); #endif /* _ZEBRA_OSPF_ROUTE_H */ diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index 074a2deab..6c89b22af 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -40,7 +40,7 @@ #include "ospfd/ospf_zebra.h" /* Hook function for updating route_map assignment. */ -void +static void ospf_route_map_update (const char *name) { struct ospf *ospf; @@ -73,7 +73,7 @@ ospf_route_map_update (const char *name) } } -void +static void ospf_route_map_event (route_map_event_t event, const char *name) { struct ospf *ospf; @@ -96,7 +96,7 @@ ospf_route_map_event (route_map_event_t event, const char *name) } /* Delete rip route map rule. */ -int +static int ospf_route_match_delete (struct vty *vty, struct route_map_index *index, const char *command, const char *arg) { @@ -121,7 +121,7 @@ ospf_route_match_delete (struct vty *vty, struct route_map_index *index, return CMD_SUCCESS; } -int +static int ospf_route_match_add (struct vty *vty, struct route_map_index *index, const char *command, const char *arg) { @@ -146,7 +146,7 @@ ospf_route_match_add (struct vty *vty, struct route_map_index *index, return CMD_SUCCESS; } -int +static int ospf_route_set_add (struct vty *vty, struct route_map_index *index, const char *command, const char *arg) { @@ -172,7 +172,7 @@ ospf_route_set_add (struct vty *vty, struct route_map_index *index, } /* Delete rip route map rule. */ -int +static int ospf_route_set_delete (struct vty *vty, struct route_map_index *index, const char *command, const char *arg) { @@ -199,7 +199,7 @@ ospf_route_set_delete (struct vty *vty, struct route_map_index *index, /* `match ip netxthop ' */ /* Match function return 1 if match is success else return zero. */ -route_map_result_t +static route_map_result_t route_match_ip_nexthop (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -225,14 +225,14 @@ route_match_ip_nexthop (void *rule, struct prefix *prefix, /* Route map `ip next-hop' match statement. `arg' should be access-list name. */ -void * +static void * route_match_ip_nexthop_compile (const char *arg) { return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg); } /* Free route map's compiled `ip address' value. */ -void +static void route_match_ip_nexthop_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -249,7 +249,7 @@ struct route_map_rule_cmd route_match_ip_nexthop_cmd = /* `match ip next-hop prefix-list PREFIX_LIST' */ -route_map_result_t +static route_map_result_t route_match_ip_next_hop_prefix_list (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -273,13 +273,13 @@ route_match_ip_next_hop_prefix_list (void *rule, struct prefix *prefix, return RMAP_NOMATCH; } -void * +static void * route_match_ip_next_hop_prefix_list_compile (const char *arg) { return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg); } -void +static void route_match_ip_next_hop_prefix_list_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -296,7 +296,7 @@ struct route_map_rule_cmd route_match_ip_next_hop_prefix_list_cmd = /* `match ip address IP_ACCESS_LIST' */ /* Match function should return 1 if match is success else return zero. */ -route_map_result_t +static route_map_result_t route_match_ip_address (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -317,14 +317,14 @@ route_match_ip_address (void *rule, struct prefix *prefix, /* Route map `ip address' match statement. `arg' should be access-list name. */ -void * +static void * route_match_ip_address_compile (const char *arg) { return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg); } /* Free route map's compiled `ip address' value. */ -void +static void route_match_ip_address_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -340,7 +340,7 @@ struct route_map_rule_cmd route_match_ip_address_cmd = }; /* `match ip address prefix-list PREFIX_LIST' */ -route_map_result_t +static route_map_result_t route_match_ip_address_prefix_list (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -358,13 +358,13 @@ route_match_ip_address_prefix_list (void *rule, struct prefix *prefix, return RMAP_NOMATCH; } -void * +static void * route_match_ip_address_prefix_list_compile (const char *arg) { return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg); } -void +static void route_match_ip_address_prefix_list_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -381,7 +381,7 @@ struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd = /* `match interface IFNAME' */ /* Match function should 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) { @@ -403,14 +403,14 @@ route_match_interface (void *rule, struct prefix *prefix, /* Route map `interface' match statement. `arg' should be interface name. */ -void * +static void * route_match_interface_compile (const char *arg) { return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg); } /* Free route map's compiled `interface' value. */ -void +static void route_match_interface_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -427,7 +427,7 @@ struct route_map_rule_cmd route_match_interface_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) { @@ -447,7 +447,7 @@ route_set_metric (void *rule, struct prefix *prefix, } /* set metric compilation. */ -void * +static void * route_set_metric_compile (const char *arg) { u_int32_t *metric; @@ -463,7 +463,7 @@ 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); @@ -480,7 +480,7 @@ struct route_map_rule_cmd route_set_metric_cmd = /* `set metric-type TYPE' */ /* Set metric-type to attribute. */ -route_map_result_t +static route_map_result_t route_set_metric_type (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -500,7 +500,7 @@ route_set_metric_type (void *rule, struct prefix *prefix, } /* set metric-type compilation. */ -void * +static void * route_set_metric_type_compile (const char *arg) { u_int32_t *metric_type; @@ -520,7 +520,7 @@ route_set_metric_type_compile (const char *arg) } /* Free route map's compiled `set metric-type' value. */ -void +static void route_set_metric_type_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -760,11 +760,9 @@ DEFUN (set_metric_type, "OSPF[6] external type 2 metric\n") { if (strcmp (argv[0], "1") == 0) - return ospf_route_set_add (vty, vty->index, "metric-type", - (char *) "type-1"); + return ospf_route_set_add (vty, vty->index, "metric-type", "type-1"); if (strcmp (argv[0], "2") == 0) - return ospf_route_set_add (vty, vty->index, "metric-type", - (char *) "type-2"); + return ospf_route_set_add (vty, vty->index, "metric-type", "type-2"); return ospf_route_set_add (vty, vty->index, "metric-type", argv[0]); } diff --git a/ospfd/ospf_snmp.h b/ospfd/ospf_snmp.h index d82f87b11..8b561b033 100644 --- a/ospfd/ospf_snmp.h +++ b/ospfd/ospf_snmp.h @@ -24,10 +24,10 @@ #ifndef _ZEBRA_OSPF_SNMP_H #define _ZEBRA_OSPF_SNMP_H -void ospf_snmp_if_update (struct interface *); -void ospf_snmp_if_delete (struct interface *); +extern void ospf_snmp_if_update (struct interface *); +extern void ospf_snmp_if_delete (struct interface *); -void ospf_snmp_vl_add (struct ospf_vl_data *); -void ospf_snmp_vl_delete (struct ospf_vl_data *); +extern void ospf_snmp_vl_add (struct ospf_vl_data *); +extern void ospf_snmp_vl_delete (struct ospf_vl_data *); #endif /* _ZEBRA_OSPF_SNMP_H */ diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c index c69fc7f11..e34dd2ee8 100644 --- a/ospfd/ospf_spf.c +++ b/ospfd/ospf_spf.c @@ -70,7 +70,7 @@ update_stat (void * node , int position) } /* End of the heap related functions. */ -struct vertex_nexthop * +static struct vertex_nexthop * vertex_nexthop_new (struct vertex *parent) { struct vertex_nexthop *new; @@ -81,13 +81,13 @@ vertex_nexthop_new (struct vertex *parent) return new; } -void +static void vertex_nexthop_free (struct vertex_nexthop *nh) { XFREE (MTYPE_OSPF_NEXTHOP, nh); } -struct vertex_nexthop * +static struct vertex_nexthop * vertex_nexthop_dup (struct vertex_nexthop *nh) { struct vertex_nexthop *new; @@ -101,7 +101,7 @@ vertex_nexthop_dup (struct vertex_nexthop *nh) } -struct vertex * +static struct vertex * ospf_vertex_new (struct ospf_lsa *lsa) { struct vertex *new; @@ -122,7 +122,7 @@ ospf_vertex_new (struct ospf_lsa *lsa) return new; } -void +static void ospf_vertex_free (struct vertex *v) { struct listnode *node, *nnode; @@ -139,7 +139,7 @@ ospf_vertex_free (struct vertex *v) XFREE (MTYPE_OSPF_VERTEX, v); } -void +static void ospf_vertex_dump(const char *msg, struct vertex *v, int print_nexthops, int print_children) { @@ -189,7 +189,7 @@ ospf_vertex_dump(const char *msg, struct vertex *v, /* Add a vertex to the list of children in each of its parents. */ -void +static void ospf_vertex_add_parent (struct vertex *v) { struct vertex_nexthop *nh; @@ -203,7 +203,7 @@ ospf_vertex_add_parent (struct vertex *v) } } -void +static void ospf_spf_init (struct ospf_area *area) { struct vertex *v; @@ -219,7 +219,7 @@ ospf_spf_init (struct ospf_area *area) } /* return index of link back to V from W, or -1 if no link found */ -int +static int ospf_lsa_has_link (struct lsa_header *w, struct lsa_header *v) { unsigned int i, length; @@ -285,7 +285,7 @@ ospf_lsa_has_link (struct lsa_header *w, struct lsa_header *v) /* Add the nexthop to the list, only if it is unique. * If it's not unique, free the nexthop entry. */ -void +static void ospf_nexthop_add_unique (struct vertex_nexthop *new, struct list *nexthop) { struct vertex_nexthop *nh; @@ -317,7 +317,7 @@ ospf_nexthop_add_unique (struct vertex_nexthop *new, struct list *nexthop) } /* Merge entries in list b into list a. */ -void +static void ospf_nexthop_merge (struct list *a, struct list *b) { struct listnode *node, *nnode; @@ -334,7 +334,7 @@ ospf_nexthop_merge (struct list *a, struct list *b) * NULL, return the first link from v to w. Ignore stub and virtual links; * these link types will never be returned. */ -struct router_lsa_link * +static struct router_lsa_link * ospf_get_next_link (struct vertex *v, struct vertex *w, struct router_lsa_link *prev_link) { @@ -390,7 +390,7 @@ ospf_get_next_link (struct vertex *v, struct vertex *w, * backlinks, or even simpler, just flushing nexthop list if we find a lower * cost path to a candidate vertex in SPF, maybe. */ -void +static void ospf_spf_consider_nexthop (struct list *nexthops, struct vertex_nexthop *newhop) { @@ -427,7 +427,7 @@ ospf_spf_consider_nexthop (struct list *nexthops, /* 16.1.1. Calculate nexthop from root through V (parent) to * vertex W (destination). */ -void +static void ospf_nexthop_calculation (struct ospf_area *area, struct vertex *v, struct vertex *w) { @@ -620,7 +620,7 @@ ospf_nexthop_calculation (struct ospf_area *area, * of candidates with any vertices not already on the list. If a lower-cost * path is found to a vertex already on the candidate list, store the new cost. */ -void +static void ospf_spf_next (struct vertex *v, struct ospf_area *area, struct pqueue * candidate) { @@ -795,7 +795,7 @@ ospf_spf_next (struct vertex *v, struct ospf_area *area, } /* end loop over the links in V's LSA */ } -void +static void ospf_spf_route_free (struct route_table *table) { struct route_node *rn; @@ -815,7 +815,7 @@ ospf_spf_route_free (struct route_table *table) route_table_finish (table); } -void +static void ospf_spf_dump (struct vertex *v, int i) { struct listnode *cnode; @@ -846,7 +846,7 @@ ospf_spf_dump (struct vertex *v, int i) } /* Second stage of SPF calculation. */ -void +static void ospf_spf_process_stubs (struct ospf_area *area, struct vertex *v, struct route_table *rt) { @@ -926,7 +926,7 @@ ospf_rtrs_free (struct route_table *rtrs) route_table_finish (rtrs); } -void +static void ospf_rtrs_print (struct route_table *rtrs) { struct route_node *rn; @@ -986,7 +986,7 @@ ospf_rtrs_print (struct route_table *rtrs) } /* Calculating the shortest-path tree for an area. */ -void +static void ospf_spf_calculate (struct ospf_area *area, struct route_table *new_table, struct route_table *new_rtrs) { @@ -1095,7 +1095,7 @@ ospf_spf_calculate (struct ospf_area *area, struct route_table *new_table, } /* Timer for SPF calculation. */ -int +static int ospf_spf_calculate_timer (struct thread *thread) { struct ospf *ospf = THREAD_ARG (thread); diff --git a/ospfd/ospf_spf.h b/ospfd/ospf_spf.h index 57f9d28bf..1aa871aed 100644 --- a/ospfd/ospf_spf.h +++ b/ospfd/ospf_spf.h @@ -51,7 +51,7 @@ struct vertex_nexthop struct vertex *parent; /* parent in SPF tree */ }; -void ospf_spf_calculate_schedule (struct ospf *); -void ospf_rtrs_free (struct route_table *); +extern void ospf_spf_calculate_schedule (struct ospf *); +extern void ospf_rtrs_free (struct route_table *); /* void ospf_spf_calculate_timer_add (); */ diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index 582dc4332..10a94b8d8 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -201,7 +201,7 @@ del_mpls_te_link (void *val) } static u_int32_t -get_mpls_te_instance_value () +get_mpls_te_instance_value (void) { static u_int32_t seqno = 0; diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 55b33150c..2f0824a73 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -62,7 +62,7 @@ const static char *ospf_network_type_str[] = /* Utility functions. */ -int +static int ospf_str2area_id (const char *str, struct in_addr *area_id, int *format) { char *endptr = NULL; @@ -91,7 +91,7 @@ ospf_str2area_id (const char *str, struct in_addr *area_id, int *format) } -int +static int str2distribute_source (const char *str, int *source) { /* Sanity check. */ @@ -114,7 +114,7 @@ str2distribute_source (const char *str, int *source) return 1; } -int +static int str2metric (const char *str, int *metric) { /* Sanity check. */ @@ -131,7 +131,7 @@ str2metric (const char *str, int *metric) return 1; } -int +static int str2metric_type (const char *str, int *metric_type) { /* Sanity check. */ @@ -471,7 +471,7 @@ DEFUN (ospf_area_range, ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE); if (argc > 2) { - VTY_GET_UINT32 ("range cost", cost, argv[2]); + VTY_GET_INTEGER ("range cost", cost, argv[2]); ospf_area_range_cost_set (ospf, area_id, &p, cost); } @@ -679,7 +679,7 @@ struct ospf_vl_config_data { int dead_interval; }; -void +static void ospf_vl_config_data_init (struct ospf_vl_config_data *vl_config, struct vty *vty) { @@ -688,7 +688,7 @@ ospf_vl_config_data_init (struct ospf_vl_config_data *vl_config, vl_config->vty = vty; } -struct ospf_vl_data * +static struct ospf_vl_data * ospf_find_vl_data (struct ospf *ospf, struct ospf_vl_config_data *vl_config) { struct ospf_area *area; @@ -737,7 +737,7 @@ ospf_find_vl_data (struct ospf *ospf, struct ospf_vl_config_data *vl_config) } -int +static int ospf_vl_set_security (struct ospf_vl_data *vl_data, struct ospf_vl_config_data *vl_config) { @@ -794,9 +794,7 @@ ospf_vl_set_security (struct ospf_vl_data *vl_data, return CMD_SUCCESS; } - - -int +static int ospf_vl_set_timers (struct ospf_vl_data *vl_data, struct ospf_vl_config_data *vl_config) { @@ -833,7 +831,7 @@ ospf_vl_set_timers (struct ospf_vl_data *vl_data, /* The business end of all of the above */ -int +static int ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config) { struct ospf_vl_data *vl_data; @@ -1508,7 +1506,7 @@ DEFUN (no_ospf_area_stub_no_summary, return CMD_SUCCESS; } -int +static int ospf_area_nssa_cmd_handler (struct vty *vty, int argc, const char *argv[], int nosum) { @@ -2105,8 +2103,8 @@ DEFUN (ospf_timers_spf, struct ospf *ospf = vty->index; u_int32_t delay, hold; - VTY_GET_UINT32 ("SPF delay timer", delay, argv[0]); - VTY_GET_UINT32 ("SPF hold timer", hold, argv[1]); + VTY_GET_INTEGER ("SPF delay timer", delay, argv[0]); + VTY_GET_INTEGER ("SPF hold timer", hold, argv[1]); ospf_timers_spf_set (ospf, delay, hold); @@ -2384,7 +2382,7 @@ const char *ospf_shortcut_mode_descr_str[] = -void +static void show_ip_ospf_area (struct vty *vty, struct ospf_area *area) { /* Show Area ID. */ @@ -2723,7 +2721,7 @@ DEFUN (show_ip_ospf_interface, return CMD_SUCCESS; } -void +static void show_ip_ospf_neighbor_sub (struct vty *vty, struct ospf_interface *oi) { struct route_node *rn; @@ -2877,7 +2875,7 @@ DEFUN (show_ip_ospf_neighbor_int, return CMD_SUCCESS; } -void +static void show_ip_ospf_nbr_nbma_detail_sub (struct vty *vty, struct ospf_interface *oi, struct ospf_nbr_nbma *nbr_nbma) { @@ -2910,7 +2908,7 @@ show_ip_ospf_nbr_nbma_detail_sub (struct vty *vty, struct ospf_interface *oi, nbr_nbma->t_poll != NULL ? "on" : "off", VTY_NEWLINE); } -void +static void show_ip_ospf_neighbor_detail_sub (struct vty *vty, struct ospf_interface *oi, struct ospf_neighbor *nbr) { @@ -3139,7 +3137,7 @@ DEFUN (show_ip_ospf_neighbor_int_detail, /* Show functions */ -int +static int show_lsa_summary (struct vty *vty, struct ospf_lsa *lsa, int self) { struct router_lsa *rl; @@ -3252,7 +3250,7 @@ const char *show_lsa_flags[] = "Translated", }; -void +static void show_ip_ospf_database_header (struct vty *vty, struct ospf_lsa *lsa) { struct router_lsa *rlsa = (struct router_lsa*) lsa->data; @@ -3321,7 +3319,7 @@ const char *link_data_desc[] = }; /* Show router-LSA each Link information. */ -void +static void show_ip_ospf_database_router_links (struct vty *vty, struct router_lsa *rl) { @@ -3346,7 +3344,7 @@ show_ip_ospf_database_router_links (struct vty *vty, } /* Show router-LSA detail information. */ -int +static int show_router_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) { if (lsa != NULL) @@ -3366,7 +3364,7 @@ show_router_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) } /* Show network-LSA detail information. */ -int +static int show_network_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) { int length, i; @@ -3393,7 +3391,7 @@ show_network_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) } /* Show summary-LSA detail information. */ -int +static int show_summary_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) { if (lsa != NULL) @@ -3413,7 +3411,7 @@ show_summary_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) } /* Show summary-ASBR-LSA detail information. */ -int +static int show_summary_asbr_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) { if (lsa != NULL) @@ -3433,7 +3431,7 @@ show_summary_asbr_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) } /* Show AS-external-LSA detail information. */ -int +static int show_as_external_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) { if (lsa != NULL) @@ -3461,7 +3459,7 @@ show_as_external_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) } /* N.B. This function currently seems to be unused. */ -int +static int show_as_external_lsa_stdvty (struct ospf_lsa *lsa) { struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; @@ -3486,7 +3484,7 @@ show_as_external_lsa_stdvty (struct ospf_lsa *lsa) } /* Show AS-NSSA-LSA detail information. */ -int +static int show_as_nssa_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) { if (lsa != NULL) @@ -3513,14 +3511,14 @@ show_as_nssa_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) return 0; } -int +static int show_func_dummy (struct vty *vty, struct ospf_lsa *lsa) { return 0; } #ifdef HAVE_OPAQUE_LSA -int +static int show_opaque_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) { if (lsa != NULL) @@ -3552,7 +3550,7 @@ int (*show_function[])(struct vty *, struct ospf_lsa *) = #endif /* HAVE_OPAQUE_LSA */ }; -void +static void show_lsa_prefix_set (struct vty *vty, struct prefix_ls *lp, struct in_addr *id, struct in_addr *adv_router) { @@ -3573,7 +3571,7 @@ show_lsa_prefix_set (struct vty *vty, struct prefix_ls *lp, struct in_addr *id, } } -void +static void show_lsa_detail_proc (struct vty *vty, struct route_table *rt, struct in_addr *id, struct in_addr *adv_router) { @@ -3598,7 +3596,7 @@ show_lsa_detail_proc (struct vty *vty, struct route_table *rt, /* Show detail LSA information -- if id is NULL then show all LSAs. */ -void +static void show_lsa_detail (struct vty *vty, struct ospf *ospf, int type, struct in_addr *id, struct in_addr *adv_router) { @@ -3628,7 +3626,7 @@ show_lsa_detail (struct vty *vty, struct ospf *ospf, int type, } } -void +static void show_lsa_detail_adv_router_proc (struct vty *vty, struct route_table *rt, struct in_addr *adv_router) { @@ -3647,7 +3645,7 @@ show_lsa_detail_adv_router_proc (struct vty *vty, struct route_table *rt, } /* Show detail LSA information. */ -void +static void show_lsa_detail_adv_router (struct vty *vty, struct ospf *ospf, int type, struct in_addr *adv_router) { @@ -3679,7 +3677,7 @@ show_lsa_detail_adv_router (struct vty *vty, struct ospf *ospf, int type, } } -void +static void show_ip_ospf_database_summary (struct vty *vty, struct ospf *ospf, int self) { struct ospf_lsa *lsa; @@ -3750,7 +3748,7 @@ show_ip_ospf_database_summary (struct vty *vty, struct ospf *ospf, int self) vty_out (vty, "%s", VTY_NEWLINE); } -void +static void show_ip_ospf_database_maxage (struct vty *vty, struct ospf *ospf) { struct listnode *node; @@ -4547,7 +4545,7 @@ ALIAS (no_ip_ospf_cost, "OSPF interface commands\n" "Interface cost\n") -void +static void ospf_nbr_timer_update (struct ospf_interface *oi) { struct route_node *rn; @@ -6497,7 +6495,7 @@ DEFUN (no_ospf_distance_source_access_list, return CMD_SUCCESS; } -void +static void show_ip_ospf_route_network (struct vty *vty, struct route_table *rt) { struct route_node *rn; @@ -6550,7 +6548,7 @@ show_ip_ospf_route_network (struct vty *vty, struct route_table *rt) vty_out (vty, "%s", VTY_NEWLINE); } -void +static void show_ip_ospf_route_router (struct vty *vty, struct route_table *rtrs) { struct route_node *rn; @@ -6598,7 +6596,7 @@ show_ip_ospf_route_router (struct vty *vty, struct route_table *rtrs) vty_out (vty, "%s", VTY_NEWLINE); } -void +static void show_ip_ospf_route_external (struct vty *vty, struct route_table *rt) { struct route_node *rn; @@ -6729,7 +6727,7 @@ const char *ospf_shortcut_mode_str[] = }; -void +static void area_id2str (char *buf, int length, struct ospf_area *area) { memset (buf, 0, length); @@ -6753,7 +6751,7 @@ const char *ospf_int_type_str[] = }; /* Configuration write function for ospfd. */ -int +static int config_write_interface (struct vty *vty) { struct listnode *n1, *n2; @@ -6933,7 +6931,7 @@ config_write_interface (struct vty *vty) return write; } -int +static int config_write_network_area (struct vty *vty, struct ospf *ospf) { struct route_node *rn; @@ -6963,7 +6961,7 @@ config_write_network_area (struct vty *vty, struct ospf *ospf) return 0; } -int +static int config_write_ospf_area (struct vty *vty, struct ospf *ospf) { struct listnode *node; @@ -7065,7 +7063,7 @@ config_write_ospf_area (struct vty *vty, struct ospf *ospf) return 0; } -int +static int config_write_ospf_nbr_nbma (struct vty *vty, struct ospf *ospf) { struct ospf_nbr_nbma *nbr_nbma; @@ -7089,7 +7087,7 @@ config_write_ospf_nbr_nbma (struct vty *vty, struct ospf *ospf) return 0; } -int +static int config_write_virtual_link (struct vty *vty, struct ospf *ospf) { struct listnode *node; @@ -7155,7 +7153,7 @@ config_write_virtual_link (struct vty *vty, struct ospf *ospf) const char *distribute_str[] = { "system", "kernel", "connected", "static", "rip", "ripng", "ospf", "ospf6", "isis", "bgp"}; -int +static int config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf) { int type; @@ -7180,7 +7178,7 @@ config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf) return 0; } -int +static int config_write_ospf_default_metric (struct vty *vty, struct ospf *ospf) { if (ospf->default_metric != -1) @@ -7189,7 +7187,7 @@ config_write_ospf_default_metric (struct vty *vty, struct ospf *ospf) return 0; } -int +static int config_write_ospf_distribute (struct vty *vty, struct ospf *ospf) { int type; @@ -7229,7 +7227,7 @@ config_write_ospf_distribute (struct vty *vty, struct ospf *ospf) return 0; } -int +static int config_write_ospf_distance (struct vty *vty, struct ospf *ospf) { struct route_node *rn; @@ -7266,7 +7264,7 @@ config_write_ospf_distance (struct vty *vty, struct ospf *ospf) } /* OSPF configuration write function. */ -int +static int ospf_config_write (struct vty *vty) { struct ospf *ospf; @@ -7362,7 +7360,7 @@ ospf_config_write (struct vty *vty) } void -ospf_vty_show_init () +ospf_vty_show_init (void) { /* "show ip ospf" commands. */ install_element (VIEW_NODE, &show_ip_ospf_cmd); @@ -7421,8 +7419,8 @@ struct cmd_node interface_node = }; /* Initialization of OSPF interface. */ -void -ospf_vty_if_init () +static void +ospf_vty_if_init (void) { /* Install interface node. */ install_node (&interface_node, config_write_interface); @@ -7521,8 +7519,8 @@ struct cmd_node zebra_node = "%s(config-router)#", }; -void -ospf_vty_zebra_init () +static void +ospf_vty_zebra_init (void) { install_element (OSPF_NODE, &ospf_redistribute_source_type_metric_cmd); install_element (OSPF_NODE, &ospf_redistribute_source_metric_type_cmd); @@ -7623,7 +7621,7 @@ struct cmd_node ospf_node = /* Install OSPF related vty commands. */ void -ospf_vty_init () +ospf_vty_init (void) { /* Install ospf top node. */ install_node (&ospf_node, ospf_config_write); diff --git a/ospfd/ospf_vty.h b/ospfd/ospf_vty.h index 9f30e204f..da0ed1cc1 100644 --- a/ospfd/ospf_vty.h +++ b/ospfd/ospf_vty.h @@ -19,40 +19,10 @@ * 02111-1307, USA. */ -/* Macros. */ -#define VTY_GET_UINT32(NAME,V,STR) \ -{ \ - char *endptr = NULL; \ - (V) = strtoul ((STR), &endptr, 10); \ - if (*endptr != '\0' || ((V) == ULONG_MAX && errno == ERANGE)) \ - { \ - vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \ - return CMD_WARNING; \ - } \ -} - -#define VTY_GET_IPV4_ADDRESS(NAME,V,STR) \ -{ \ - int retv; \ - retv = inet_aton ((STR), &(V)); \ - if (!retv) \ - { \ - vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \ - return CMD_WARNING; \ - } \ -} - -#define VTY_GET_IPV4_PREFIX(NAME,V,STR) \ -{ \ - int retv; \ - retv = str2prefix_ipv4 ((STR), &(V)); \ - if (retv <= 0) \ - { \ - vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \ - return CMD_WARNING; \ - } \ -} +#ifndef _QUAGGA_OSPF_VTY_H +#define _QUAGGA_OSPF_VTY_H +/* Macros. */ #define VTY_GET_OSPF_AREA_ID(V,F,STR) \ { \ int retv; \ @@ -81,5 +51,7 @@ } /* Prototypes. */ -void ospf_vty_init (); -void ospf_vty_show_init (); +extern void ospf_vty_init (void); +extern void ospf_vty_show_init (void); + +#endif /* _QUAGGA_OSPF_VTY_H */ diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index 36e787747..9db898107 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -57,7 +57,7 @@ extern struct thread_master *master; struct in_addr router_id_zebra; /* Router-id update message from zebra. */ -int +static int ospf_router_id_update_zebra (int command, struct zclient *zclient, zebra_size_t length) { @@ -78,7 +78,7 @@ ospf_router_id_update_zebra (int command, struct zclient *zclient, } /* Inteface addition message from zebra. */ -int +static int ospf_interface_add (int command, struct zclient *zclient, zebra_size_t length) { struct interface *ifp; @@ -109,7 +109,7 @@ ospf_interface_add (int command, struct zclient *zclient, zebra_size_t length) return 0; } -int +static int ospf_interface_delete (int command, struct zclient *zclient, zebra_size_t length) { @@ -158,7 +158,7 @@ zebra_interface_if_lookup (struct stream *s) strnlen(ifname_tmp, INTERFACE_NAMSIZ)); } -int +static int ospf_interface_state_up (int command, struct zclient *zclient, zebra_size_t length) { @@ -220,7 +220,7 @@ ospf_interface_state_up (int command, struct zclient *zclient, return 0; } -int +static int ospf_interface_state_down (int command, struct zclient *zclient, zebra_size_t length) { @@ -246,7 +246,7 @@ ospf_interface_state_down (int command, struct zclient *zclient, return 0; } -int +static int ospf_interface_address_add (int command, struct zclient *zclient, zebra_size_t length) { @@ -269,7 +269,7 @@ ospf_interface_address_add (int command, struct zclient *zclient, return 0; } -int +static int ospf_interface_address_delete (int command, struct zclient *zclient, zebra_size_t length) { @@ -645,7 +645,7 @@ ospf_redistribute_default_unset (struct ospf *ospf) return CMD_SUCCESS; } -int +static int ospf_external_lsa_originate_check (struct ospf *ospf, struct external_info *ei) { @@ -770,7 +770,7 @@ ospf_routemap_unset (struct ospf *ospf, int type) } /* Zebra route add and delete treatment. */ -int +static int ospf_zebra_read_ipv4 (int command, struct zclient *zclient, zebra_size_t length) { @@ -916,17 +916,17 @@ ospf_distribute_list_out_unset (struct ospf *ospf, int type, const char *name) } /* distribute-list update timer. */ -int +static int ospf_distribute_list_update_timer (struct thread *thread) { struct route_node *rn; struct external_info *ei; struct route_table *rt; struct ospf_lsa *lsa; - int type; + intptr_t type; struct ospf *ospf; - type = (int) THREAD_ARG (thread); + type = (intptr_t)THREAD_ARG (thread); assert (type < ZEBRA_ROUTE_MAX); rt = EXTERNAL_INFO (type); @@ -977,7 +977,7 @@ ospf_distribute_list_update (struct ospf *ospf, int type) } /* If access-list is updated, apply some check. */ -void +static void ospf_filter_update (struct access_list *access) { struct ospf *ospf; @@ -1098,8 +1098,8 @@ ospf_prefix_list_update (struct prefix_list *plist) ospf_schedule_abr_task (ospf); } -struct ospf_distance * -ospf_distance_new () +static struct ospf_distance * +ospf_distance_new (void) { struct ospf_distance *new; new = XMALLOC (MTYPE_OSPF_DISTANCE, sizeof (struct ospf_distance)); @@ -1107,7 +1107,7 @@ ospf_distance_new () return new; } -void +static void ospf_distance_free (struct ospf_distance *odistance) { XFREE (MTYPE_OSPF_DISTANCE, odistance); diff --git a/ospfd/ospf_zebra.h b/ospfd/ospf_zebra.h index e8ad979e2..7fe87b7f0 100644 --- a/ospfd/ospf_zebra.h +++ b/ospfd/ospf_zebra.h @@ -40,37 +40,39 @@ struct ospf_distance }; /* Prototypes */ -void ospf_zclient_start (); +extern void ospf_zclient_start (void); -void ospf_zebra_add (struct prefix_ipv4 *, struct ospf_route *); -void ospf_zebra_delete (struct prefix_ipv4 *, struct ospf_route *); +extern void ospf_zebra_add (struct prefix_ipv4 *, struct ospf_route *); +extern void ospf_zebra_delete (struct prefix_ipv4 *, struct ospf_route *); -void ospf_zebra_add_discard (struct prefix_ipv4 *); -void ospf_zebra_delete_discard (struct prefix_ipv4 *); +extern void ospf_zebra_add_discard (struct prefix_ipv4 *); +extern void ospf_zebra_delete_discard (struct prefix_ipv4 *); -int ospf_default_originate_timer (struct thread *); +extern int ospf_default_originate_timer (struct thread *); -int ospf_redistribute_check (struct ospf *, struct external_info *, int *); -int ospf_distribute_check_connected (struct ospf *, struct external_info *); -void ospf_distribute_list_update (struct ospf *, int); +extern int ospf_redistribute_check (struct ospf *, struct external_info *, + int *); +extern int ospf_distribute_check_connected (struct ospf *, + struct external_info *); +extern void ospf_distribute_list_update (struct ospf *, int); -int ospf_is_type_redistributed (int); -void ospf_distance_reset (struct ospf *); -u_char ospf_distance_apply (struct prefix_ipv4 *, struct ospf_route *); +extern int ospf_is_type_redistributed (int); +extern void ospf_distance_reset (struct ospf *); +extern u_char ospf_distance_apply (struct prefix_ipv4 *, struct ospf_route *); -struct vty; - -int ospf_redistribute_set (struct ospf *, int, int, int); -int ospf_redistribute_unset (struct ospf *, int); -int ospf_redistribute_default_set (struct ospf *, int, int, int); -int ospf_redistribute_default_unset (struct ospf *); -int ospf_distribute_list_out_set (struct ospf *, int, const char *); -int ospf_distribute_list_out_unset (struct ospf *, int, const char *); -void ospf_routemap_set (struct ospf *, int, const char *); -void ospf_routemap_unset (struct ospf *, int); -int ospf_distance_set (struct vty *, struct ospf *, const char *, const char *, const char *); -int ospf_distance_unset (struct vty *, struct ospf *, const char *, const char *, const char *); -void ospf_zebra_init (); +extern int ospf_redistribute_set (struct ospf *, int, int, int); +extern int ospf_redistribute_unset (struct ospf *, int); +extern int ospf_redistribute_default_set (struct ospf *, int, int, int); +extern int ospf_redistribute_default_unset (struct ospf *); +extern int ospf_distribute_list_out_set (struct ospf *, int, const char *); +extern int ospf_distribute_list_out_unset (struct ospf *, int, const char *); +extern void ospf_routemap_set (struct ospf *, int, const char *); +extern void ospf_routemap_unset (struct ospf *, int); +extern int ospf_distance_set (struct vty *, struct ospf *, const char *, + const char *, const char *); +extern int ospf_distance_unset (struct vty *, struct ospf *, const char *, + const char *, const char *); +extern void ospf_zebra_init (void); #endif /* _ZEBRA_OSPF_ZEBRA_H */ diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index cbc3d13d6..30164d02e 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -136,7 +136,7 @@ ospf_router_id_update_timer (struct thread *thread) } /* For OSPF area sort by area id. */ -int +static int ospf_area_id_cmp (struct ospf_area *a1, struct ospf_area *a2) { if (ntohl (a1->area_id.s_addr) > ntohl (a2->area_id.s_addr)) @@ -147,8 +147,8 @@ ospf_area_id_cmp (struct ospf_area *a1, struct ospf_area *a2) } /* Allocate new ospf structure. */ -struct ospf * -ospf_new () +static struct ospf * +ospf_new (void) { int i; @@ -228,13 +228,13 @@ ospf_lookup () return listgetdata (listhead (om->ospf)); } -void +static void ospf_add (struct ospf *ospf) { listnode_add (om->ospf, ospf); } -void +static void ospf_delete (struct ospf *ospf) { listnode_delete (om->ospf, ospf); @@ -418,7 +418,7 @@ ospf_finish (struct ospf *ospf) /* allocate new OSPF Area object */ -struct ospf_area * +static struct ospf_area * ospf_area_new (struct ospf *ospf, struct in_addr area_id) { struct ospf_area *new; @@ -567,7 +567,7 @@ ospf_area_del_if (struct ospf_area *area, struct ospf_interface *oi) /* Config network statement related functions. */ -struct ospf_network * +static struct ospf_network * ospf_network_new (struct in_addr area_id, int format) { struct ospf_network *new; @@ -903,7 +903,7 @@ struct message ospf_area_type_msg[] = }; int ospf_area_type_msg_max = OSPF_AREA_TYPE_MAX; -void +static void ospf_area_type_set (struct ospf_area *area, int type) { struct listnode *node; @@ -990,7 +990,7 @@ ospf_area_shortcut_unset (struct ospf *ospf, struct ospf_area *area) return 1; } -int +static int ospf_area_vlink_count (struct ospf *ospf, struct ospf_area *area) { struct ospf_vl_data *vl; @@ -1124,7 +1124,8 @@ ospf_area_nssa_translator_role_set (struct ospf *ospf, struct in_addr area_id, return 1; } -int +/* XXX: unused? Leave for symmetry? */ +static int ospf_area_nssa_translator_role_unset (struct ospf *ospf, struct in_addr area_id) { @@ -1273,8 +1274,8 @@ ospf_timers_refresh_unset (struct ospf *ospf) } -struct ospf_nbr_nbma * -ospf_nbr_nbma_new () +static struct ospf_nbr_nbma * +ospf_nbr_nbma_new (void) { struct ospf_nbr_nbma *nbr_nbma; @@ -1288,13 +1289,13 @@ ospf_nbr_nbma_new () return nbr_nbma; } -void +static void ospf_nbr_nbma_free (struct ospf_nbr_nbma *nbr_nbma) { XFREE (MTYPE_OSPF_NEIGHBOR_STATIC, nbr_nbma); } -void +static void ospf_nbr_nbma_delete (struct ospf *ospf, struct ospf_nbr_nbma *nbr_nbma) { struct route_node *rn; @@ -1314,7 +1315,7 @@ ospf_nbr_nbma_delete (struct ospf *ospf, struct ospf_nbr_nbma *nbr_nbma) } } -void +static void ospf_nbr_nbma_down (struct ospf_nbr_nbma *nbr_nbma) { OSPF_TIMER_OFF (nbr_nbma->t_poll); @@ -1329,7 +1330,7 @@ ospf_nbr_nbma_down (struct ospf_nbr_nbma *nbr_nbma) listnode_delete (nbr_nbma->oi->nbr_nbma, nbr_nbma); } -void +static void ospf_nbr_nbma_add (struct ospf_nbr_nbma *nbr_nbma, struct ospf_interface *oi) { diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h index a14869566..8dae8f806 100644 --- a/ospfd/ospfd.h +++ b/ospfd/ospfd.h @@ -526,57 +526,66 @@ extern struct thread_master *master; extern int ospf_zlog; /* Prototypes. */ -struct ospf *ospf_lookup (); -struct ospf *ospf_get (); -void ospf_finish (struct ospf *); -int ospf_router_id_update_timer (struct thread *); -void ospf_router_id_update (); -int ospf_network_match_iface (struct connected *, struct prefix *); -int ospf_network_set (struct ospf *, struct prefix_ipv4 *, struct in_addr); -int ospf_network_unset (struct ospf *, struct prefix_ipv4 *, struct in_addr); -int ospf_area_stub_set (struct ospf *, struct in_addr); -int ospf_area_stub_unset (struct ospf *, struct in_addr); -int ospf_area_no_summary_set (struct ospf *, struct in_addr); -int ospf_area_no_summary_unset (struct ospf *, struct in_addr); -int ospf_area_nssa_set (struct ospf *, struct in_addr); -int ospf_area_nssa_unset (struct ospf *, struct in_addr); -int ospf_area_nssa_translator_role_set (struct ospf *, struct in_addr, int); -int ospf_area_export_list_set (struct ospf *, struct ospf_area *, const char *); -int ospf_area_export_list_unset (struct ospf *, struct ospf_area *); -int ospf_area_import_list_set (struct ospf *, struct ospf_area *, const char *); -int ospf_area_import_list_unset (struct ospf *, struct ospf_area *); -int ospf_area_shortcut_set (struct ospf *, struct ospf_area *, int); -int ospf_area_shortcut_unset (struct ospf *, struct ospf_area *); -int ospf_timers_spf_set (struct ospf *, u_int32_t, u_int32_t); -int ospf_timers_spf_unset (struct ospf *); -int ospf_timers_refresh_set (struct ospf *, int); -int ospf_timers_refresh_unset (struct ospf *); -int ospf_nbr_nbma_set (struct ospf *, struct in_addr); -int ospf_nbr_nbma_unset (struct ospf *, struct in_addr); -int ospf_nbr_nbma_priority_set (struct ospf *, struct in_addr, u_char); -int ospf_nbr_nbma_priority_unset (struct ospf *, struct in_addr); -int ospf_nbr_nbma_poll_interval_set (struct ospf *, struct in_addr, unsigned int); -int ospf_nbr_nbma_poll_interval_unset (struct ospf *, struct in_addr); -void ospf_prefix_list_update (struct prefix_list *); -void ospf_init (); -void ospf_if_update (struct ospf *); -void ospf_ls_upd_queue_empty (struct ospf_interface *); -void ospf_terminate (); -void ospf_nbr_nbma_if_update (struct ospf *, struct ospf_interface *); -struct ospf_nbr_nbma *ospf_nbr_nbma_lookup (struct ospf *, struct in_addr); -struct ospf_nbr_nbma *ospf_nbr_nbma_lookup_next (struct ospf *, - struct in_addr *, int); -int ospf_oi_count (struct interface *); - -struct ospf_area *ospf_area_get (struct ospf *, struct in_addr, int); -void ospf_area_check_free (struct ospf *, struct in_addr); -struct ospf_area *ospf_area_lookup_by_area_id (struct ospf *, struct in_addr); -void ospf_area_add_if (struct ospf_area *, struct ospf_interface *); -void ospf_area_del_if (struct ospf_area *, struct ospf_interface *); - -void ospf_route_map_init (); -void ospf_snmp_init (); - -void ospf_master_init (); +extern struct ospf *ospf_lookup (void); +extern struct ospf *ospf_get (void); +extern void ospf_finish (struct ospf *); +extern int ospf_router_id_update_timer (struct thread *); +extern void ospf_router_id_update (struct ospf *ospf); +extern int ospf_network_match_iface (struct connected *, struct prefix *); +extern int ospf_network_set (struct ospf *, struct prefix_ipv4 *, + struct in_addr); +extern int ospf_network_unset (struct ospf *, struct prefix_ipv4 *, + struct in_addr); +extern int ospf_area_stub_set (struct ospf *, struct in_addr); +extern int ospf_area_stub_unset (struct ospf *, struct in_addr); +extern int ospf_area_no_summary_set (struct ospf *, struct in_addr); +extern int ospf_area_no_summary_unset (struct ospf *, struct in_addr); +extern int ospf_area_nssa_set (struct ospf *, struct in_addr); +extern int ospf_area_nssa_unset (struct ospf *, struct in_addr); +extern int ospf_area_nssa_translator_role_set (struct ospf *, struct in_addr, + int); +extern int ospf_area_export_list_set (struct ospf *, struct ospf_area *, + const char *); +extern int ospf_area_export_list_unset (struct ospf *, struct ospf_area *); +extern int ospf_area_import_list_set (struct ospf *, struct ospf_area *, + const char *); +extern int ospf_area_import_list_unset (struct ospf *, struct ospf_area *); +extern int ospf_area_shortcut_set (struct ospf *, struct ospf_area *, int); +extern int ospf_area_shortcut_unset (struct ospf *, struct ospf_area *); +extern int ospf_timers_spf_set (struct ospf *, u_int32_t, u_int32_t); +extern int ospf_timers_spf_unset (struct ospf *); +extern int ospf_timers_refresh_set (struct ospf *, int); +extern int ospf_timers_refresh_unset (struct ospf *); +extern int ospf_nbr_nbma_set (struct ospf *, struct in_addr); +extern int ospf_nbr_nbma_unset (struct ospf *, struct in_addr); +extern int ospf_nbr_nbma_priority_set (struct ospf *, struct in_addr, u_char); +extern int ospf_nbr_nbma_priority_unset (struct ospf *, struct in_addr); +extern int ospf_nbr_nbma_poll_interval_set (struct ospf *, struct in_addr, + unsigned int); +extern int ospf_nbr_nbma_poll_interval_unset (struct ospf *, struct in_addr); +extern void ospf_prefix_list_update (struct prefix_list *); +extern void ospf_init (void); +extern void ospf_if_update (struct ospf *); +extern void ospf_ls_upd_queue_empty (struct ospf_interface *); +extern void ospf_terminate (void); +extern void ospf_nbr_nbma_if_update (struct ospf *, struct ospf_interface *); +extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup (struct ospf *, + struct in_addr); +extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup_next (struct ospf *, + struct in_addr *, + int); +extern int ospf_oi_count (struct interface *); + +extern struct ospf_area *ospf_area_get (struct ospf *, struct in_addr, int); +extern void ospf_area_check_free (struct ospf *, struct in_addr); +extern struct ospf_area *ospf_area_lookup_by_area_id (struct ospf *, + struct in_addr); +extern void ospf_area_add_if (struct ospf_area *, struct ospf_interface *); +extern void ospf_area_del_if (struct ospf_area *, struct ospf_interface *); + +extern void ospf_route_map_init (void); +extern void ospf_snmp_init (void); + +extern void ospf_master_init (void); #endif /* _ZEBRA_OSPFD_H */ -- 2.39.2