Browse Source

2005-05-06 Paul Jakma <paul.jakma@sun.com>

        * (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.
paul 14 years ago
parent
commit
4dadc291e5

+ 23 - 0
ospfd/ChangeLog

@@ -1,3 +1,26 @@
+2005-05-06 Paul Jakma <paul.jakma@sun.com>
+
+        * (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 <zpgong@cdc.3upsystems.com>
 
 	* ospf_abr.c: (ospf_abr_announce_network_to_area) dont forget

+ 37 - 38
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);

+ 31 - 24
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 */

+ 51 - 47
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 */

+ 6 - 6
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;

+ 56 - 56
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 */

+ 1 - 1
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);

+ 14 - 14
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 */

+ 7 - 7
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;

+ 17 - 12
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 */

+ 14 - 14
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;

+ 10 - 10
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 */

+ 3 - 3
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)
 {

+ 44 - 36
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 */

+ 9 - 9
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,

+ 3 - 2
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 */

+ 9 - 9
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;

+ 60 - 52
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 */

+ 18 - 24
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;

+ 8 - 8
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 */

+ 40 - 40
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" <edward_rrr@hotmail.com>
    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;

+ 72 - 72
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 */

+ 1 - 1
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));

+ 16 - 16
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 */

+ 4 - 4
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);

+ 1 - 1
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)
 {

+ 19 - 18
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 */

+ 10 - 6
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 */

+ 18 - 18
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] =
 {

+ 19 - 20
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) \