Browse Source

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

	* (global) The great bgpd extern and static'ification.
	* bgp_routemap.c: remove unused ROUTE_MATCH_ASPATH_OLD code
	  (route_set_metric_compile) fix u_int32_t to ULONG_MAX comparison
	  warnings.
	* bgp_route.h: (bgp_process, bgp_withdraw, bgp_update) export these
	  used by various files which had their own private declarations,
	  in the case of mplsvpn - incorrect.
paul 14 years ago
parent
commit
94f2b3923e

+ 10 - 0
bgpd/ChangeLog

@@ -1,3 +1,13 @@
+2005-06-28 Paul Jakma <paul.jakma@sun.com>
+
+	* (global) The great bgpd extern and static'ification.
+	* bgp_routemap.c: remove unused ROUTE_MATCH_ASPATH_OLD code
+	  (route_set_metric_compile) fix u_int32_t to ULONG_MAX comparison
+	  warnings.
+	* bgp_route.h: (bgp_process, bgp_withdraw, bgp_update) export these
+	  used by various files which had their own private declarations,
+	  in the case of mplsvpn - incorrect.
+
 2005-06-15 Paul Jakma <paul.jakma@sun.com>
 
 	* bgpd.c: (bgp_terminate) workqueue's are lazy allocated and its

+ 5 - 5
bgpd/bgp_advertise.c

@@ -84,7 +84,7 @@ bgp_advertise_new ()
     XCALLOC (MTYPE_BGP_ADVERTISE, sizeof (struct bgp_advertise));
 }
 
-void
+static void
 bgp_advertise_free (struct bgp_advertise *adv)
 {
   if (adv->binfo)
@@ -92,7 +92,7 @@ bgp_advertise_free (struct bgp_advertise *adv)
   XFREE (MTYPE_BGP_ADVERTISE, adv);
 }
 
-void
+static void
 bgp_advertise_add (struct bgp_advertise_attr *baa,
 		   struct bgp_advertise *adv)
 {
@@ -102,7 +102,7 @@ bgp_advertise_add (struct bgp_advertise_attr *baa,
   baa->adv = adv;
 }
 
-void
+static void
 bgp_advertise_delete (struct bgp_advertise_attr *baa,
 		      struct bgp_advertise *adv)
 {
@@ -127,7 +127,7 @@ bgp_advertise_intern (struct hash *hash, struct attr *attr)
   return baa;
 }
 
-void
+static void
 bgp_advertise_unintern (struct hash *hash, struct bgp_advertise_attr *baa)
 {
   if (baa->refcnt)
@@ -147,7 +147,7 @@ bgp_advertise_unintern (struct hash *hash, struct bgp_advertise_attr *baa)
 }
 
 /* BGP adjacency keeps minimal advertisement information.  */
-void
+static void
 bgp_adj_out_free (struct bgp_adj_out *adj)
 {
   peer_unlock (adj->peer); /* adj_out peer reference */

+ 10 - 10
bgpd/bgp_advertise.h

@@ -128,23 +128,23 @@ struct bgp_synchronize
 #define BGP_ADJ_OUT_DEL(N,A)   BGP_INFO_DEL(N,A,adj_out)
 
 /* Prototypes.  */
-void bgp_adj_out_set (struct bgp_node *, struct peer *, struct prefix *,
+extern void bgp_adj_out_set (struct bgp_node *, struct peer *, struct prefix *,
 		      struct attr *, afi_t, safi_t, struct bgp_info *);
-void bgp_adj_out_unset (struct bgp_node *, struct peer *, struct prefix *,
+extern void bgp_adj_out_unset (struct bgp_node *, struct peer *, struct prefix *,
 			afi_t, safi_t);
-void bgp_adj_out_remove (struct bgp_node *, struct bgp_adj_out *, 
+extern void bgp_adj_out_remove (struct bgp_node *, struct bgp_adj_out *, 
 			 struct peer *, afi_t, safi_t);
-int bgp_adj_out_lookup (struct peer *, struct prefix *, afi_t, safi_t,
+extern int bgp_adj_out_lookup (struct peer *, struct prefix *, afi_t, safi_t,
 			struct bgp_node *);
 
-void bgp_adj_in_set (struct bgp_node *, struct peer *, struct attr *);
-void bgp_adj_in_unset (struct bgp_node *, struct peer *);
-void bgp_adj_in_remove (struct bgp_node *, struct bgp_adj_in *);
+extern void bgp_adj_in_set (struct bgp_node *, struct peer *, struct attr *);
+extern void bgp_adj_in_unset (struct bgp_node *, struct peer *);
+extern void bgp_adj_in_remove (struct bgp_node *, struct bgp_adj_in *);
 
-struct bgp_advertise *
+extern struct bgp_advertise *
 bgp_advertise_clean (struct peer *, struct bgp_adj_out *, afi_t, safi_t);
 
-void bgp_sync_init (struct peer *);
-void bgp_sync_delete (struct peer *);
+extern void bgp_sync_init (struct peer *);
+extern void bgp_sync_delete (struct peer *);
 
 #endif /* _QUAGGA_BGP_ADVERTISE_H */

+ 13 - 13
bgpd/bgp_aspath.c

@@ -126,7 +126,7 @@ aspath_delimiter_char (u_char type, u_char which)
 }
 
 /* Convert aspath structure to string expression. */
-char *
+static char *
 aspath_make_str_count (struct aspath *as)
 {
   int space;
@@ -309,7 +309,7 @@ aspath_dup (struct aspath *aspath)
   return new;
 }
 
-void *
+static void *
 aspath_hash_alloc (struct aspath *arg)
 {
   struct aspath *aspath;
@@ -371,7 +371,7 @@ aspath_parse (caddr_t pnt, int length)
 
 #define ASSEGMENT_SIZE(N)  (AS_HEADER_SIZE + ((N) * AS_VALUE_SIZE))
 
-struct aspath *
+static struct aspath *
 aspath_aggregate_segment_copy (struct aspath *aspath, struct assegment *seg,
 			       int i)
 {
@@ -398,7 +398,7 @@ aspath_aggregate_segment_copy (struct aspath *aspath, struct assegment *seg,
   return aspath;
 }
 
-struct assegment *
+static struct assegment *
 aspath_aggregate_as_set_add (struct aspath *aspath, struct assegment *asset,
 			     as_t as)
 {
@@ -625,7 +625,7 @@ aspath_private_as_check (struct aspath *aspath)
 }
 
 /* Merge as1 to as2.  as2 should be uninterned aspath. */
-struct aspath *
+static struct aspath *
 aspath_merge (struct aspath *as1, struct aspath *as2)
 {
   caddr_t data;
@@ -908,7 +908,7 @@ aspath_add_confed_seq (struct aspath *aspath, as_t asno)
 }
 
 /* Add new as value to as path structure. */
-void
+static void
 aspath_as_add (struct aspath *as, as_t asno)
 {
   caddr_t pnt;
@@ -938,7 +938,7 @@ aspath_as_add (struct aspath *as, as_t asno)
 }
 
 /* Add new as segment to the as path. */
-void
+static void
 aspath_segment_add (struct aspath *as, int type)
 {
   struct assegment *assegment;
@@ -961,13 +961,13 @@ aspath_segment_add (struct aspath *as, int type)
 }
 
 struct aspath *
-aspath_empty ()
+aspath_empty (void)
 {
   return aspath_parse (NULL, 0);
 }
 
 struct aspath *
-aspath_empty_get ()
+aspath_empty_get (void)
 {
   struct aspath *aspath;
 
@@ -1003,7 +1003,7 @@ enum as_token
 };
 
 /* Return next token and point for string parse. */
-const char *
+static const char *
 aspath_gettoken (const char *buf, enum as_token *token, u_short *asno)
 {
   const char *p = buf;
@@ -1142,7 +1142,7 @@ aspath_key_make (struct aspath *aspath)
 }
 
 /* If two aspath have same value then return 1 else return 0 */
-int
+static int
 aspath_cmp (struct aspath *as1, struct aspath *as2)
 {
   if (as1->length == as2->length 
@@ -1154,7 +1154,7 @@ aspath_cmp (struct aspath *as1, struct aspath *as2)
 
 /* AS path hash initialize. */
 void
-aspath_init ()
+aspath_init (void)
 {
   ashash = hash_create_size (32767, aspath_key_make, aspath_cmp);
 }
@@ -1173,7 +1173,7 @@ aspath_print_vty (struct vty *vty, struct aspath *as)
   vty_out (vty, "%s", as->str);
 }
 
-void
+static void
 aspath_show_all_iterator (struct hash_backet *backet, struct vty *vty)
 {
   struct aspath *as;

+ 24 - 24
bgpd/bgp_aspath.h

@@ -59,29 +59,29 @@ struct aspath
 #define ASPATH_STR_DEFAULT_LEN 32
 
 /* Prototypes. */
-void aspath_init ();
-struct aspath *aspath_parse ();
-struct aspath *aspath_dup (struct aspath *);
-struct aspath *aspath_aggregate (struct aspath *, struct aspath *);
-struct aspath *aspath_prepend (struct aspath *, struct aspath *);
-struct aspath *aspath_add_seq (struct aspath *, as_t);
-struct aspath *aspath_add_confed_seq (struct aspath *, as_t);
-int aspath_cmp_left (struct aspath *, struct aspath *);
-int aspath_cmp_left_confed (struct aspath *, struct aspath *);
-struct aspath *aspath_delete_confed_seq (struct aspath *);
-struct aspath *aspath_empty ();
-struct aspath *aspath_empty_get ();
-struct aspath *aspath_str2aspath (const char *);
-void aspath_free (struct aspath *);
-struct aspath *aspath_intern (struct aspath *);
-void aspath_unintern (struct aspath *);
-const char *aspath_print (struct aspath *);
-void aspath_print_vty (struct vty *, struct aspath *);
-void aspath_print_all_vty (struct vty *);
-unsigned int aspath_key_make (struct aspath *);
-int aspath_loop_check (struct aspath *, as_t);
-int aspath_private_as_check (struct aspath *);
-int aspath_firstas_check (struct aspath *, as_t);
-unsigned long aspath_count ();
+extern void aspath_init (void);
+extern struct aspath *aspath_parse (caddr_t, int);
+extern struct aspath *aspath_dup (struct aspath *);
+extern struct aspath *aspath_aggregate (struct aspath *, struct aspath *);
+extern struct aspath *aspath_prepend (struct aspath *, struct aspath *);
+extern struct aspath *aspath_add_seq (struct aspath *, as_t);
+extern struct aspath *aspath_add_confed_seq (struct aspath *, as_t);
+extern int aspath_cmp_left (struct aspath *, struct aspath *);
+extern int aspath_cmp_left_confed (struct aspath *, struct aspath *);
+extern struct aspath *aspath_delete_confed_seq (struct aspath *);
+extern struct aspath *aspath_empty (void);
+extern struct aspath *aspath_empty_get (void);
+extern struct aspath *aspath_str2aspath (const char *);
+extern void aspath_free (struct aspath *);
+extern struct aspath *aspath_intern (struct aspath *);
+extern void aspath_unintern (struct aspath *);
+extern const char *aspath_print (struct aspath *);
+extern void aspath_print_vty (struct vty *, struct aspath *);
+extern void aspath_print_all_vty (struct vty *);
+extern unsigned int aspath_key_make (struct aspath *);
+extern int aspath_loop_check (struct aspath *, as_t);
+extern int aspath_private_as_check (struct aspath *);
+extern int aspath_firstas_check (struct aspath *, as_t);
+extern unsigned long aspath_count (void);
 
 #endif /* _QUAGGA_BGP_ASPATH_H */

+ 32 - 32
bgpd/bgp_attr.c

@@ -61,7 +61,7 @@ struct message attr_str [] =
 
 struct hash *cluster_hash;
 
-void *
+static void *
 cluster_hash_alloc (struct cluster_list *val)
 {
   struct cluster_list *cluster;
@@ -83,7 +83,7 @@ cluster_hash_alloc (struct cluster_list *val)
 }
 
 /* Cluster list related functions. */
-struct cluster_list *
+static struct cluster_list *
 cluster_parse (struct in_addr * pnt, int length)
 {
   struct cluster_list tmp;
@@ -108,7 +108,7 @@ cluster_loop_check (struct cluster_list *cluster, struct in_addr originator)
   return 0;
 }
 
-unsigned int
+static unsigned int
 cluster_hash_key_make (struct cluster_list *cluster)
 {
   unsigned int key = 0;
@@ -124,7 +124,7 @@ cluster_hash_key_make (struct cluster_list *cluster)
   return key;
 }
 
-int
+static int
 cluster_hash_cmp (struct cluster_list *cluster1, struct cluster_list *cluster2)
 {
   if (cluster1->length == cluster2->length &&
@@ -133,7 +133,7 @@ cluster_hash_cmp (struct cluster_list *cluster1, struct cluster_list *cluster2)
   return 0;
 }
 
-void
+static void
 cluster_free (struct cluster_list *cluster)
 {
   if (cluster->list)
@@ -141,7 +141,7 @@ cluster_free (struct cluster_list *cluster)
   XFREE (MTYPE_CLUSTER, cluster);
 }
 
-struct cluster_list *
+static struct cluster_list *
 cluster_dup (struct cluster_list *cluster)
 {
   struct cluster_list *new;
@@ -161,7 +161,7 @@ cluster_dup (struct cluster_list *cluster)
   return new;
 }
 
-struct cluster_list *
+static struct cluster_list *
 cluster_intern (struct cluster_list *cluster)
 {
   struct cluster_list *find;
@@ -187,8 +187,8 @@ cluster_unintern (struct cluster_list *cluster)
     }
 }
 
-void
-cluster_init ()
+static void
+cluster_init (void)
 {
   cluster_hash = hash_create (cluster_hash_key_make, cluster_hash_cmp);
 }
@@ -196,7 +196,7 @@ cluster_init ()
 /* Unknown transit attribute. */
 struct hash *transit_hash;
 
-void
+static void
 transit_free (struct transit *transit)
 {
   if (transit->val)
@@ -204,14 +204,14 @@ transit_free (struct transit *transit)
   XFREE (MTYPE_TRANSIT, transit);
 }
 
-void *
+static void *
 transit_hash_alloc (struct transit *transit)
 {
   /* Transit structure is already allocated.  */
   return transit;
 }
 
-struct transit *
+static struct transit *
 transit_intern (struct transit *transit)
 {
   struct transit *find;
@@ -239,7 +239,7 @@ transit_unintern (struct transit *transit)
     }
 }
 
-unsigned int
+static unsigned int
 transit_hash_key_make (struct transit *transit)
 {
   unsigned int key = 0;
@@ -255,7 +255,7 @@ transit_hash_key_make (struct transit *transit)
   return key;
 }
 
-int
+static int
 transit_hash_cmp (struct transit *transit1, struct transit *transit2)
 {
   if (transit1->length == transit2->length &&
@@ -264,7 +264,7 @@ transit_hash_cmp (struct transit *transit1, struct transit *transit2)
   return 0;
 }
 
-void
+static void
 transit_init ()
 {
   transit_hash = hash_create (transit_hash_key_make, transit_hash_cmp);
@@ -341,13 +341,13 @@ attrhash_cmp (struct attr *attr1, struct attr *attr2)
     return 0;
 }
 
-void
+static void
 attrhash_init ()
 {
   attrhash = hash_create (attrhash_key_make, attrhash_cmp);
 }
 
-void
+static void
 attr_show_all_iterator (struct hash_backet *backet, struct vty *vty)
 {
   struct attr *attr = backet->data;
@@ -365,7 +365,7 @@ attr_show_all (struct vty *vty)
 		vty);
 }
 
-void *
+static void *
 bgp_attr_hash_alloc (struct attr *val)
 {
   struct attr *attr;
@@ -571,7 +571,7 @@ bgp_attr_flush (struct attr *attr)
 }
 
 /* Get origin attribute of the update message. */
-int
+static int
 bgp_attr_origin (struct peer *peer, bgp_size_t length, 
 		 struct attr *attr, u_char flag, u_char *startp)
 {
@@ -639,7 +639,7 @@ bgp_attr_origin (struct peer *peer, bgp_size_t length,
 
 /* Parse AS path information.  This function is wrapper of
    aspath_parse. */
-int
+static int
 bgp_attr_aspath (struct peer *peer, bgp_size_t length, 
 		 struct attr *attr, u_char flag, u_char *startp)
 {
@@ -710,7 +710,7 @@ bgp_attr_aspath (struct peer *peer, bgp_size_t length,
 }
 
 /* Nexthop attribute. */
-int
+static int
 bgp_attr_nexthop (struct peer *peer, bgp_size_t length, 
 		  struct attr *attr, u_char flag, u_char *startp)
 {
@@ -751,7 +751,7 @@ bgp_attr_nexthop (struct peer *peer, bgp_size_t length,
 }
 
 /* MED atrribute. */
-int
+static int
 bgp_attr_med (struct peer *peer, bgp_size_t length, 
 	      struct attr *attr, u_char flag, u_char *startp)
 {
@@ -780,7 +780,7 @@ bgp_attr_med (struct peer *peer, bgp_size_t length,
 }
 
 /* Local preference attribute. */
-int
+static int
 bgp_attr_local_pref (struct peer *peer, bgp_size_t length, 
 		     struct attr *attr, u_char flag)
 {
@@ -805,7 +805,7 @@ bgp_attr_local_pref (struct peer *peer, bgp_size_t length,
 }
 
 /* Atomic aggregate. */
-int
+static int
 bgp_attr_atomic (struct peer *peer, bgp_size_t length, 
 		 struct attr *attr, u_char flag)
 {
@@ -826,7 +826,7 @@ bgp_attr_atomic (struct peer *peer, bgp_size_t length,
 }
 
 /* Aggregator attribute */
-int
+static int
 bgp_attr_aggregator (struct peer *peer, bgp_size_t length,
 		     struct attr *attr, u_char flag)
 {
@@ -849,7 +849,7 @@ bgp_attr_aggregator (struct peer *peer, bgp_size_t length,
 }
 
 /* Community attribute. */
-int
+static int
 bgp_attr_community (struct peer *peer, bgp_size_t length, 
 		    struct attr *attr, u_char flag)
 {
@@ -868,7 +868,7 @@ bgp_attr_community (struct peer *peer, bgp_size_t length,
 }
 
 /* Originator ID attribute. */
-int
+static int
 bgp_attr_originator_id (struct peer *peer, bgp_size_t length, 
 			struct attr *attr, u_char flag)
 {
@@ -890,7 +890,7 @@ bgp_attr_originator_id (struct peer *peer, bgp_size_t length,
 }
 
 /* Cluster list attribute. */
-int
+static int
 bgp_attr_cluster_list (struct peer *peer, bgp_size_t length, 
 		       struct attr *attr, u_char flag)
 {
@@ -916,7 +916,7 @@ bgp_attr_cluster_list (struct peer *peer, bgp_size_t length,
 }
 
 /* Multiprotocol reachability information parse. */
-int
+static int
 bgp_mp_reach_parse (struct peer *peer, bgp_size_t length, struct attr *attr,
 		    struct bgp_nlri *mp_update)
 {
@@ -1014,7 +1014,7 @@ bgp_mp_reach_parse (struct peer *peer, bgp_size_t length, struct attr *attr,
 }
 
 /* Multiprotocol unreachable parse */
-int
+static int
 bgp_mp_unreach_parse (struct peer *peer, int length, 
 		      struct bgp_nlri *mp_withdraw)
 {
@@ -1051,7 +1051,7 @@ bgp_mp_unreach_parse (struct peer *peer, int length,
 }
 
 /* Extended Community attribute. */
-int
+static int
 bgp_attr_ext_communities (struct peer *peer, bgp_size_t length, 
 			  struct attr *attr, u_char flag)
 {
@@ -1069,7 +1069,7 @@ bgp_attr_ext_communities (struct peer *peer, bgp_size_t length,
 }
 
 /* BGP unknown attribute treatment. */
-int
+static int
 bgp_attr_unknown (struct peer *peer, struct attr *attr, u_char flag,
 		  u_char type, bgp_size_t length, u_char *startp)
 {

+ 18 - 17
bgpd/bgp_attr.h

@@ -105,33 +105,34 @@ struct transit
 #define ATTR_FLAG_BIT(X)  (1 << ((X) - 1))
 
 /* Prototypes. */
-void bgp_attr_init ();
-int bgp_attr_parse (struct peer *, struct attr *, bgp_size_t,
+extern void bgp_attr_init (void);
+extern int bgp_attr_parse (struct peer *, struct attr *, bgp_size_t,
 		    struct bgp_nlri *, struct bgp_nlri *);
-int bgp_attr_check (struct peer *, struct attr *);
-struct attr *bgp_attr_intern (struct attr *attr);
-void bgp_attr_unintern (struct attr *);
-void bgp_attr_flush (struct attr *);
-struct attr *bgp_attr_default_set (struct attr *attr, u_char);
-struct attr *bgp_attr_default_intern (u_char);
-struct attr *bgp_attr_aggregate_intern (struct bgp *, u_char,
+extern int bgp_attr_check (struct peer *, struct attr *);
+extern struct attr *bgp_attr_intern (struct attr *attr);
+extern void bgp_attr_unintern (struct attr *);
+extern void bgp_attr_flush (struct attr *);
+extern struct attr *bgp_attr_default_set (struct attr *attr, u_char);
+extern struct attr *bgp_attr_default_intern (u_char);
+extern struct attr *bgp_attr_aggregate_intern (struct bgp *, u_char,
                                         struct aspath *, 
                                         struct community *, int as_set);
-bgp_size_t bgp_packet_attribute (struct bgp *bgp, struct peer *, 
+extern bgp_size_t bgp_packet_attribute (struct bgp *bgp, struct peer *, 
                                  struct stream *, struct attr *, 
                                  struct prefix *, afi_t, safi_t, 
                                  struct peer *, struct prefix_rd *, char *);
-bgp_size_t bgp_packet_withdraw (struct peer *peer, struct stream *s, 
+extern bgp_size_t bgp_packet_withdraw (struct peer *peer, struct stream *s, 
                                 struct prefix *p, afi_t, safi_t, 
                                 struct prefix_rd *, char *);
-void bgp_dump_routes_attr (struct stream *, struct attr *, struct prefix *);
-unsigned int attrhash_key_make (struct attr *);
-int attrhash_cmp (struct attr *, struct attr *);
-void attr_show_all (struct vty *);
+extern void bgp_dump_routes_attr (struct stream *, struct attr *,
+				  struct prefix *);
+extern unsigned int attrhash_key_make (struct attr *);
+extern int attrhash_cmp (struct attr *, struct attr *);
+extern void attr_show_all (struct vty *);
 
 /* Cluster list prototypes. */
-int cluster_loop_check (struct cluster_list *, struct in_addr);
-void cluster_unintern (struct cluster_list *);
+extern int cluster_loop_check (struct cluster_list *, struct in_addr);
+extern void cluster_unintern (struct cluster_list *);
 
 /* Transit attribute prototypes. */
 void transit_unintern (struct transit *);

+ 11 - 11
bgpd/bgp_clist.c

@@ -49,7 +49,7 @@ community_list_master_lookup (struct community_list_handler *ch, int master)
 }
 
 /* Allocate a new community list entry.  */
-struct community_entry *
+static struct community_entry *
 community_entry_new ()
 {
   struct community_entry *new;
@@ -60,7 +60,7 @@ community_entry_new ()
 }
 
 /* Free community list entry.  */
-void
+static void
 community_entry_free (struct community_entry *entry)
 {
   switch (entry->style)
@@ -90,7 +90,7 @@ community_entry_free (struct community_entry *entry)
 }
 
 /* Allocate a new community-list.  */
-struct community_list *
+static struct community_list *
 community_list_new ()
 {
   struct community_list *new;
@@ -101,7 +101,7 @@ community_list_new ()
 }
 
 /* Free community-list.  */
-void
+static void
 community_list_free (struct community_list *list)
 {
   if (list->name)
@@ -109,7 +109,7 @@ community_list_free (struct community_list *list)
   XFREE (MTYPE_COMMUNITY_LIST, list);
 }
 
-struct community_list *
+static struct community_list *
 community_list_insert (struct community_list_handler *ch,
 		       const char *name, int master)
 {
@@ -227,7 +227,7 @@ community_list_lookup (struct community_list_handler *ch,
   return NULL;
 }
 
-struct community_list *
+static struct community_list *
 community_list_get (struct community_list_handler *ch,
 		    const char *name, int master)
 {
@@ -239,7 +239,7 @@ community_list_get (struct community_list_handler *ch,
   return list;
 }
 
-void
+static void
 community_list_delete (struct community_list *list)
 {
   struct community_list_list *clist;
@@ -266,7 +266,7 @@ community_list_delete (struct community_list *list)
   community_list_free (list);
 }
 
-int
+static int
 community_list_empty_p (struct community_list *list)
 {
   return (list->head == NULL && list->tail == NULL) ? 1 : 0;
@@ -558,7 +558,7 @@ community_list_match_delete (struct community *com,
 
 /* To avoid duplicated entry in the community-list, this function
    compares specified entry to existing entry.  */
-int
+static int
 community_list_dup_check (struct community_list *list,
                           struct community_entry *new)
 {
@@ -829,7 +829,7 @@ extcommunity_list_unset (struct community_list_handler *ch,
 
 /* Initializa community-list.  Return community-list handler.  */
 struct community_list_handler *
-community_list_init ()
+community_list_init (void)
 {
   struct community_list_handler *ch;
   ch = XCALLOC (MTYPE_COMMUNITY_LIST_HANDLER,
@@ -838,7 +838,7 @@ community_list_init ()
 }
 
 /* Terminate community-list.  */
-void
+static void
 community_list_terminate (struct community_list_handler *ch)
 {
   struct community_list_master *cm;

+ 23 - 20
bgpd/bgp_clist.h

@@ -124,29 +124,32 @@ struct community_list_handler
 extern struct community_list_handler *bgp_clist;
 
 /* Prototypes.  */
-struct community_list_handler *community_list_init ();
-
-int community_list_set (struct community_list_handler *ch, const char *name, 
-                        const char *str, int direct, int style);
-int community_list_unset (struct community_list_handler *ch, const char *name,
-                          const char *str, int direct, int style);
-int extcommunity_list_set (struct community_list_handler *ch, const char *name,
-                           const char *str, int direct, int style);
-int extcommunity_list_unset (struct community_list_handler *ch, 
-                             const char *name, const char *str, 
-                             int direct, int style);
-
-struct community_list_master *
+extern struct community_list_handler *community_list_init (void);
+
+extern int community_list_set (struct community_list_handler *ch,
+			       const char *name, const char *str, int direct,
+			       int style);
+extern int community_list_unset (struct community_list_handler *ch,
+				 const char *name, const char *str,
+				 int direct, int style);
+extern int extcommunity_list_set (struct community_list_handler *ch,
+				  const char *name, const char *str,
+				  int direct, int style);
+extern int extcommunity_list_unset (struct community_list_handler *ch,
+				    const char *name, const char *str,
+				    int direct, int style);
+
+extern struct community_list_master *
 community_list_master_lookup (struct community_list_handler *, int);
 
-struct community_list *
+extern struct community_list *
 community_list_lookup (struct community_list_handler *, const char *, int);
 
-int community_list_match (struct community *, struct community_list *);
-int ecommunity_list_match (struct ecommunity *, struct community_list *);
-int community_list_exact_match (struct community *, struct community_list *);
-struct community *
-community_list_match_delete (struct community *,
-			     struct community_list *);
+extern int community_list_match (struct community *, struct community_list *);
+extern int ecommunity_list_match (struct ecommunity *, struct community_list *);
+extern int community_list_exact_match (struct community *,
+				       struct community_list *);
+extern struct community *
+community_list_match_delete (struct community *, struct community_list *);
 
 #endif /* _QUAGGA_BGP_CLIST_H */

+ 8 - 8
bgpd/bgp_community.c

@@ -29,8 +29,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 struct hash *comhash;
 
 /* Allocate a new communities value.  */
-struct community *
-community_new ()
+static struct community *
+community_new (void)
 {
   return (struct community *) XCALLOC (MTYPE_COMMUNITY,
 				       sizeof (struct community));
@@ -48,7 +48,7 @@ community_free (struct community *com)
 }
 
 /* Add one community value to the community. */
-void
+static void
 community_add_val (struct community *com, u_int32_t val)
 {
   com->size++;
@@ -112,7 +112,7 @@ community_delete (struct community *com1, struct community *com2)
 }
 
 /* Callback function from qsort(). */
-int
+static int
 community_compare (const void *a1, const void *a2)
 {
   u_int32_t v1;
@@ -144,7 +144,7 @@ community_include (struct community *com, u_int32_t val)
   return 0;
 }
 
-u_int32_t
+static u_int32_t
 community_val_get (struct community *com, int i)
 {
   u_char *p;
@@ -472,7 +472,7 @@ enum community_token
 };
 
 /* Get next community token from string. */
-const char *
+static const char *
 community_gettoken (const char *buf, enum community_token *token, 
                     u_int32_t *val)
 {
@@ -617,14 +617,14 @@ community_count ()
 
 /* Return communities hash.  */
 struct hash *
-community_hash ()
+community_hash (void)
 {
   return comhash;
 }
 
 /* Initialize comminity related hash. */
 void
-community_init ()
+community_init (void)
 {
   comhash = hash_create (community_hash_make, community_cmp);
 }

+ 18 - 18
bgpd/bgp_community.h

@@ -51,23 +51,23 @@ struct community
 #define com_nthval(X,n)  ((X)->val + (n))
 
 /* Prototypes of communities attribute functions.  */
-void community_init ();
-void community_free (struct community *);
-struct community *community_uniq_sort (struct community *);
-struct community *community_parse (u_int32_t *, u_short);
-struct community *community_intern (struct community *);
-void community_unintern (struct community *);
-char *community_str (struct community *);
-unsigned int community_hash_make (struct community *);
-struct community *community_str2com (const char *);
-int community_match (const struct community *, const struct community *);
-int community_cmp (const struct community *, const struct community *);
-struct community *community_merge (struct community *, struct community *);
-struct community *community_delete (struct community *, struct community *);
-struct community *community_dup (struct community *);
-int community_include (struct community *, u_int32_t);
-void community_del_val (struct community *, u_int32_t *);
-unsigned long community_count ();
-struct hash *community_hash ();
+extern void community_init (void);
+extern void community_free (struct community *);
+extern struct community *community_uniq_sort (struct community *);
+extern struct community *community_parse (u_int32_t *, u_short);
+extern struct community *community_intern (struct community *);
+extern void community_unintern (struct community *);
+extern char *community_str (struct community *);
+extern unsigned int community_hash_make (struct community *);
+extern struct community *community_str2com (const char *);
+extern int community_match (const struct community *, const struct community *);
+extern int community_cmp (const struct community *, const struct community *);
+extern struct community *community_merge (struct community *, struct community *);
+extern struct community *community_delete (struct community *, struct community *);
+extern struct community *community_dup (struct community *);
+extern int community_include (struct community *, u_int32_t);
+extern void community_del_val (struct community *, u_int32_t *);
+extern unsigned long community_count (void);
+extern struct hash *community_hash (void);
 
 #endif /* _QUAGGA_BGP_COMMUNITY_H */

+ 5 - 6
bgpd/bgp_damp.c

@@ -106,15 +106,14 @@ bgp_damp_decay (time_t tdiff, int penalty)
 
 /* Handler of reuse timer event.  Each route in the current reuse-list
    is evaluated.  RFC2439 Section 4.8.7.  */
-int
+static int
 bgp_reuse_timer (struct thread *t)
 {
   struct bgp_damp_info *bdi;
   struct bgp_damp_info *next;
   time_t t_now, t_diff;
   struct bgp *bgp;
-  int bgp_process (struct bgp *, struct bgp_node *, afi_t, safi_t);
-
+  
   damp->t_reuse = NULL;
   damp->t_reuse =
     thread_add_timer (master, bgp_reuse_timer, NULL, DELTA_REUSE);
@@ -371,7 +370,7 @@ bgp_damp_info_free (struct bgp_damp_info *bdi, int withdraw)
   XFREE (MTYPE_BGP_DAMP_INFO, bdi);
 }
 
-void
+static void
 bgp_damp_parameter_set (int hlife, int reuse, int sup, int maxsup)
 {
   double reuse_max_ratio;
@@ -457,7 +456,7 @@ bgp_damp_enable (struct bgp *bgp, afi_t afi, safi_t safi, time_t half,
   return 0;
 }
 
-void
+static void
 bgp_damp_config_clean (struct bgp_damp_config *damp)
 {
   /* Free decay array */
@@ -472,7 +471,7 @@ bgp_damp_config_clean (struct bgp_damp_config *damp)
 
 /* Clean all the bgp_damp_info stored in reuse_list. */
 void
-bgp_damp_info_clean ()
+bgp_damp_info_clean (void)
 {
   unsigned int i;
   struct bgp_damp_info *bdi, *next;

+ 12 - 12
bgpd/bgp_damp.h

@@ -129,19 +129,19 @@ struct bgp_damp_config
 #define REUSE_LIST_SIZE          256
 #define REUSE_ARRAY_SIZE        1024
 
-int bgp_damp_enable (struct bgp *, afi_t, safi_t, time_t, unsigned int, 
+extern int bgp_damp_enable (struct bgp *, afi_t, safi_t, time_t, unsigned int, 
                      unsigned int, time_t);
-int bgp_damp_disable (struct bgp *, afi_t, safi_t);
-int bgp_damp_withdraw (struct bgp_info *, struct bgp_node *,
+extern int bgp_damp_disable (struct bgp *, afi_t, safi_t);
+extern int bgp_damp_withdraw (struct bgp_info *, struct bgp_node *,
 		       afi_t, safi_t, int);
-int bgp_damp_update (struct bgp_info *, struct bgp_node *, afi_t, safi_t);
-int bgp_damp_scan (struct bgp_info *, afi_t, safi_t);
-void bgp_damp_info_free (struct bgp_damp_info *, int);
-void bgp_damp_info_clean ();
-char * bgp_get_reuse_time (unsigned int, char*, size_t);
-int bgp_damp_decay (time_t, int);
-int bgp_config_write_damp (struct vty *);
-void bgp_damp_info_vty (struct vty *, struct bgp_info *);
-char * bgp_damp_reuse_time_vty (struct vty *, struct bgp_info *);
+extern int bgp_damp_update (struct bgp_info *, struct bgp_node *, afi_t, safi_t);
+extern int bgp_damp_scan (struct bgp_info *, afi_t, safi_t);
+extern void bgp_damp_info_free (struct bgp_damp_info *, int);
+extern void bgp_damp_info_clean (void);
+extern char * bgp_get_reuse_time (unsigned int, char*, size_t);
+extern int bgp_damp_decay (time_t, int);
+extern int bgp_config_write_damp (struct vty *);
+extern void bgp_damp_info_vty (struct vty *, struct bgp_info *);
+extern char * bgp_damp_reuse_time_vty (struct vty *, struct bgp_info *);
 
 #endif /* _QUAGGA_BGP_DAMP_H */

+ 2 - 2
bgpd/bgp_debug.c

@@ -644,7 +644,7 @@ DEFUN (show_debugging_bgp,
   return CMD_SUCCESS;
 }
 
-int
+static int
 bgp_config_write_debug (struct vty *vty)
 {
   int write = 0;
@@ -706,7 +706,7 @@ struct cmd_node debug_node =
 };
 
 void
-bgp_debug_init ()
+bgp_debug_init (void)
 {
   install_node (&debug_node, bgp_config_write_debug);
 

+ 5 - 5
bgpd/bgp_debug.h

@@ -51,10 +51,10 @@ extern int Debug_Radix;
 #define	DETAIL	 6
 
 /* Prototypes. */
-void bgp_debug_init ();
-void bgp_packet_dump (struct stream *);
+extern void bgp_debug_init (void);
+extern void bgp_packet_dump (struct stream *);
 
-int debug (unsigned int option);
+extern int debug (unsigned int option);
 
 extern unsigned long conf_bgp_debug_fsm;
 extern unsigned long conf_bgp_debug_events;
@@ -109,8 +109,8 @@ extern unsigned long term_bgp_debug_normal;
 
 const extern char *bgp_type_str[];
 
-int bgp_dump_attr (struct peer *, struct attr *, char *, size_t);
-void bgp_notify_print (struct peer *, struct bgp_notify *, const char *);
+extern int bgp_dump_attr (struct peer *, struct attr *, char *, size_t);
+extern void bgp_notify_print (struct peer *, struct bgp_notify *, const char *);
 
 extern struct message bgp_status_msg[];
 extern int bgp_status_msg_max;

+ 15 - 15
bgpd/bgp_dump.c

@@ -87,7 +87,7 @@ struct bgp_dump bgp_dump_routes;
 struct thread *t_bgp_dump_routes;
 
 /* Some define for BGP packet dump. */
-FILE *
+static FILE *
 bgp_dump_open_file (struct bgp_dump *bgp_dump)
 {
   int ret;
@@ -131,10 +131,10 @@ bgp_dump_open_file (struct bgp_dump *bgp_dump)
   return bgp_dump->fp;
 }
 
-int
+static int
 bgp_dump_interval_add (struct bgp_dump *bgp_dump, int interval)
 {
-  int bgp_dump_interval_func (struct thread *);
+  static int bgp_dump_interval_func (struct thread *t);
   int interval2, secs_into_day;
   time_t t;
   struct tm *tm;
@@ -166,7 +166,7 @@ bgp_dump_interval_add (struct bgp_dump *bgp_dump, int interval)
 }
 
 /* Dump common header. */
-void
+static void
 bgp_dump_header (struct stream *obuf, int type, int subtype)
 {
   time_t now;
@@ -182,13 +182,13 @@ bgp_dump_header (struct stream *obuf, int type, int subtype)
   stream_putl (obuf, 0);	/* len */
 }
 
-void
+static void
 bgp_dump_set_size (struct stream *s, int type)
 {
   stream_putl_at (s, 8, stream_get_endp (s) - BGP_DUMP_HEADER_SIZE);
 }
 
-void
+static void
 bgp_dump_routes_entry (struct prefix *p, struct bgp_info *info, int afi,
 		       int type, unsigned int seq)
 {
@@ -295,7 +295,7 @@ bgp_dump_routes_entry (struct prefix *p, struct bgp_info *info, int afi,
 }
 
 /* Runs under child process. */
-void
+static void
 bgp_dump_routes_func (int afi)
 {
   struct stream *obuf;
@@ -322,7 +322,7 @@ bgp_dump_routes_func (int afi)
       bgp_dump_routes_entry (&rn->p, info, afi, MSG_TABLE_DUMP, seq++);
 }
 
-int
+static int
 bgp_dump_interval_func (struct thread *t)
 {
   struct bgp_dump *bgp_dump;
@@ -353,7 +353,7 @@ bgp_dump_interval_func (struct thread *t)
 }
 
 /* Dump common information. */
-void
+static void
 bgp_dump_common (struct stream *obuf, struct peer *peer)
 {
   char empty[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
@@ -420,7 +420,7 @@ bgp_dump_state (struct peer *peer, int status_old, int status_new)
   fflush (bgp_dump_all.fp);
 }
 
-void
+static void
 bgp_dump_packet_func (struct bgp_dump *bgp_dump, struct peer *peer,
 		      struct stream *packet)
 {
@@ -461,7 +461,7 @@ bgp_dump_packet (struct peer *peer, int type, struct stream *packet)
     bgp_dump_packet_func (&bgp_dump_updates, peer, packet);
 }
 
-unsigned int
+static unsigned int
 bgp_dump_parse_time (const char *str)
 {
   int i;
@@ -508,7 +508,7 @@ bgp_dump_parse_time (const char *str)
   return total + time;
 }
 
-int
+static int
 bgp_dump_set (struct vty *vty, struct bgp_dump *bgp_dump, int type,
 	      const char *path, const char *interval_str)
 {
@@ -553,7 +553,7 @@ bgp_dump_set (struct vty *vty, struct bgp_dump *bgp_dump, int type,
   return CMD_SUCCESS;
 }
 
-int
+static int
 bgp_dump_unset (struct vty *vty, struct bgp_dump *bgp_dump)
 {
   /* Set file name. */
@@ -725,7 +725,7 @@ config_time2str (unsigned int interval)
 }
 #endif
 
-int
+static int
 config_write_bgp_dump (struct vty *vty)
 {
   if (bgp_dump_all.filename)
@@ -763,7 +763,7 @@ config_write_bgp_dump (struct vty *vty)
 
 /* Initialize BGP packet dump functionality. */
 void
-bgp_dump_init ()
+bgp_dump_init (void)
 {
   memset (&bgp_dump_all, 0, sizeof (struct bgp_dump));
   memset (&bgp_dump_updates, 0, sizeof (struct bgp_dump));

+ 3 - 3
bgpd/bgp_dump.h

@@ -33,8 +33,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #define BGP_DUMP_HEADER_SIZE 12
 #define BGP_DUMP_MSG_HEADER  40
 
-void bgp_dump_init ();
-void bgp_dump_state (struct peer *, int, int);
-void bgp_dump_packet (struct peer *, int, struct stream *);
+extern void bgp_dump_init (void);
+extern void bgp_dump_state (struct peer *, int, int);
+extern void bgp_dump_packet (struct peer *, int, struct stream *);
 
 #endif /* _QUAGGA_BGP_DUMP_H */

+ 2 - 2
bgpd/bgp_ecommunity.c

@@ -97,7 +97,7 @@ ecommunity_add_val (struct ecommunity *ecom, struct ecommunity_val *eval)
 /* This function takes pointer to Extended Communites strucutre then
    create a new Extended Communities structure by uniq and sort each
    Exteneded Communities value.  */
-struct ecommunity *
+static struct ecommunity *
 ecommunity_uniq_sort (struct ecommunity *ecom)
 {
   int i;
@@ -271,7 +271,7 @@ enum ecommunity_token
 };
 
 /* Get next Extended Communities token from the string. */
-const char *
+static const char *
 ecommunity_gettoken (const char *str, struct ecommunity_val *eval,
 		     enum ecommunity_token *token)
 {

+ 14 - 14
bgpd/bgp_ecommunity.h

@@ -64,19 +64,19 @@ struct ecommunity_val
 
 #define ecom_length(X)    ((X)->size * ECOMMUNITY_SIZE)
 
-void ecommunity_init (void);
-void ecommunity_free (struct ecommunity *);
-struct ecommunity *ecommunity_new (void);
-struct ecommunity *ecommunity_parse (u_int8_t *, u_short);
-struct ecommunity *ecommunity_dup (struct ecommunity *);
-struct ecommunity *ecommunity_merge (struct ecommunity *, struct ecommunity *);
-struct ecommunity *ecommunity_intern (struct ecommunity *);
-int ecommunity_cmp (const struct ecommunity *, const struct ecommunity *);
-void ecommunity_unintern (struct ecommunity *);
-unsigned int ecommunity_hash_make (struct ecommunity *);
-struct ecommunity *ecommunity_str2com (const char *, int, int);
-char *ecommunity_ecom2str (struct ecommunity *, int);
-int ecommunity_match (const struct ecommunity *, const struct ecommunity *);
-char *ecommunity_str (struct ecommunity *);
+extern void ecommunity_init (void);
+extern void ecommunity_free (struct ecommunity *);
+extern struct ecommunity *ecommunity_new (void);
+extern struct ecommunity *ecommunity_parse (u_int8_t *, u_short);
+extern struct ecommunity *ecommunity_dup (struct ecommunity *);
+extern struct ecommunity *ecommunity_merge (struct ecommunity *, struct ecommunity *);
+extern struct ecommunity *ecommunity_intern (struct ecommunity *);
+extern int ecommunity_cmp (const struct ecommunity *, const struct ecommunity *);
+extern void ecommunity_unintern (struct ecommunity *);
+extern unsigned int ecommunity_hash_make (struct ecommunity *);
+extern struct ecommunity *ecommunity_str2com (const char *, int, int);
+extern char *ecommunity_ecom2str (struct ecommunity *, int);
+extern int ecommunity_match (const struct ecommunity *, const struct ecommunity *);
+extern char *ecommunity_str (struct ecommunity *);
 
 #endif /* _QUAGGA_BGP_ECOMMUNITY_H */

+ 16 - 16
bgpd/bgp_filter.c

@@ -96,7 +96,7 @@ static struct as_list_master as_list_master =
 };
 
 /* Allocate new AS filter. */
-struct as_filter *
+static struct as_filter *
 as_filter_new ()
 {
   struct as_filter *new;
@@ -107,7 +107,7 @@ as_filter_new ()
 }
 
 /* Free allocated AS filter. */
-void
+static void
 as_filter_free (struct as_filter *asfilter)
 {
   if (asfilter->reg)
@@ -118,7 +118,7 @@ as_filter_free (struct as_filter *asfilter)
 }
 
 /* Make new AS filter. */
-struct as_filter *
+static struct as_filter *
 as_filter_make (regex_t *reg, const char *reg_str, enum as_filter_type type)
 {
   struct as_filter *asfilter;
@@ -131,7 +131,7 @@ as_filter_make (regex_t *reg, const char *reg_str, enum as_filter_type type)
   return asfilter;
 }
 
-struct as_filter *
+static struct as_filter *
 as_filter_lookup (struct as_list *aslist, const char *reg_str,
 		  enum as_filter_type type)
 {
@@ -143,7 +143,7 @@ as_filter_lookup (struct as_list *aslist, const char *reg_str,
   return NULL;
 }
 
-void
+static void
 as_list_filter_add (struct as_list *aslist, struct as_filter *asfilter)
 {
   asfilter->next = NULL;
@@ -176,7 +176,7 @@ as_list_lookup (const char *name)
   return NULL;
 }
 
-struct as_list *
+static struct as_list *
 as_list_new ()
 {
   struct as_list *new;
@@ -186,7 +186,7 @@ as_list_new ()
   return new;
 }
 
-void
+static void
 as_list_free (struct as_list *aslist)
 {
   XFREE (MTYPE_AS_LIST, aslist);
@@ -194,7 +194,7 @@ as_list_free (struct as_list *aslist)
 
 /* Insert new AS list to list of as_list.  Each as_list is sorted by
    the name. */
-struct as_list *
+static struct as_list *
 as_list_insert (const char *name)
 {
   size_t i;
@@ -278,7 +278,7 @@ as_list_insert (const char *name)
   return aslist;
 }
 
-struct as_list *
+static struct as_list *
 as_list_get (const char *name)
 {
   struct as_list *aslist;
@@ -313,7 +313,7 @@ filter_type_str (enum as_filter_type type)
     }
 }
 
-void
+static void
 as_list_delete (struct as_list *aslist)
 {
   struct as_list_list *list;
@@ -352,7 +352,7 @@ as_list_empty (struct as_list *aslist)
     return 0;
 }
 
-void
+static void
 as_list_filter_delete (struct as_list *aslist, struct as_filter *asfilter)
 {
   if (asfilter->next)
@@ -418,7 +418,7 @@ as_list_delete_hook (void (*func) ())
   as_list_master.delete_hook = func;
 }
 
-int
+static int
 as_list_dup_check (struct as_list *aslist, struct as_filter *new)
 {
   struct as_filter *asfilter;
@@ -582,7 +582,7 @@ DEFUN (no_ip_as_path_all,
   return CMD_SUCCESS;
 }
 
-void
+static void
 as_list_show (struct vty *vty, struct as_list *aslist)
 {
   struct as_filter *asfilter;
@@ -596,7 +596,7 @@ as_list_show (struct vty *vty, struct as_list *aslist)
     }
 }
 
-void
+static void
 as_list_show_all (struct vty *vty)
 {
   struct as_list *aslist;
@@ -653,7 +653,7 @@ DEFUN (show_ip_as_path_access_list_all,
   return CMD_SUCCESS;
 }
 
-int
+static int
 config_write_as_list (struct vty *vty)
 {
   struct as_list *aslist;
@@ -691,7 +691,7 @@ struct cmd_node as_list_node =
 
 /* Register functions. */
 void
-bgp_filter_init ()
+bgp_filter_init (void)
 {
   install_node (&as_list_node, config_write_as_list);
 

+ 6 - 4
bgpd/bgp_filter.h

@@ -27,10 +27,12 @@ enum as_filter_type
   AS_FILTER_PERMIT
 };
 
-enum as_filter_type as_list_apply (struct as_list *, void *);
+extern void bgp_filter_init (void);
 
-struct as_list *as_list_lookup (const char *);
-void as_list_add_hook (void (*func) ());
-void as_list_delete_hook (void (*func) ());
+extern enum as_filter_type as_list_apply (struct as_list *, void *);
+
+extern struct as_list *as_list_lookup (const char *);
+extern void as_list_add_hook (void (*func) ());
+extern void as_list_delete_hook (void (*func) ());
 
 #endif /* _QUAGGA_BGP_FILTER_H */

+ 15 - 15
bgpd/bgp_fsm.c

@@ -62,7 +62,7 @@ static int bgp_keepalive_timer (struct thread *);
 static int bgp_start (struct peer *);
 
 /* BGP start timer jitter. */
-int
+static int
 bgp_start_jitter (int time)
 {
   return ((rand () % (time + 1)) - (time / 2));
@@ -278,7 +278,7 @@ bgp_keepalive_timer (struct thread *thread)
   return 0;
 }
 
-int
+static int
 bgp_routeadv_timer (struct thread *thread)
 {
   struct peer *peer;
@@ -336,7 +336,7 @@ const char *peer_down_str[] =
   "NSF peer closed the session"
 };
 
-int
+static int
 bgp_graceful_restart_timer_expire (struct thread *thread)
 {
   struct peer *peer;
@@ -366,7 +366,7 @@ bgp_graceful_restart_timer_expire (struct thread *thread)
   return 0;
 }
 
-int
+static int
 bgp_graceful_stale_timer_expire (struct thread *thread)
 {
   struct peer *peer;
@@ -580,7 +580,7 @@ bgp_stop (struct peer *peer)
 }
 
 /* BGP peer is stoped by the error. */
-int
+static int
 bgp_stop_with_error (struct peer *peer)
 {
   /* Double start timer. */
@@ -597,7 +597,7 @@ bgp_stop_with_error (struct peer *peer)
 
 /* TCP connection open.  Next we send open message to remote peer. And
    add read thread for reading open message. */
-int
+static int
 bgp_connect_success (struct peer *peer)
 {
   char buf1[BUFSIZ];
@@ -629,7 +629,7 @@ bgp_connect_success (struct peer *peer)
 }
 
 /* TCP connect fail */
-int
+static int
 bgp_connect_fail (struct peer *peer)
 {
   bgp_stop (peer);
@@ -685,7 +685,7 @@ bgp_start (struct peer *peer)
 }
 
 /* Connect retry timer is expired when the peer status is Connect. */
-int
+static int
 bgp_reconnect (struct peer *peer)
 {
   bgp_stop (peer);
@@ -693,7 +693,7 @@ bgp_reconnect (struct peer *peer)
   return 0;
 }
 
-int
+static int
 bgp_fsm_open (struct peer *peer)
 {
   /* Send keepalive and make keepalive timer */
@@ -706,7 +706,7 @@ bgp_fsm_open (struct peer *peer)
 }
 
 /* Keepalive send to peer. */
-int
+static int
 bgp_fsm_keepalive_expire (struct peer *peer)
 {
   bgp_keepalive_send (peer);
@@ -715,7 +715,7 @@ bgp_fsm_keepalive_expire (struct peer *peer)
 
 /* Hold timer expire.  This is error of BGP connection. So cut the
    peer and change to Idle status. */
-int
+static int
 bgp_fsm_holdtime_expire (struct peer *peer)
 {
   if (BGP_DEBUG (fsm, FSM))
@@ -737,7 +737,7 @@ bgp_fsm_holdtime_expire (struct peer *peer)
 
 /* Status goes to Established.  Send keepalive packet then make first
    update information. */
-int
+static int
 bgp_establish (struct peer *peer)
 {
   struct bgp_notify *notify;
@@ -849,7 +849,7 @@ bgp_establish (struct peer *peer)
 }
 
 /* Keepalive packet is received. */
-int
+static int
 bgp_fsm_keepalive (struct peer *peer)
 {
   /* peer count update */
@@ -860,7 +860,7 @@ bgp_fsm_keepalive (struct peer *peer)
 }
 
 /* Update packet is received. */
-int
+static int
 bgp_fsm_update (struct peer *peer)
 {
   BGP_TIMER_OFF (peer->t_holdtime);
@@ -868,7 +868,7 @@ bgp_fsm_update (struct peer *peer)
 }
 
 /* This is empty event. */
-int
+static int
 bgp_ignore (struct peer *peer)
 {
   if (BGP_DEBUG (fsm, FSM))

+ 7 - 12
bgpd/bgp_mplsvpn.c

@@ -32,7 +32,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "bgpd/bgp_attr.h"
 #include "bgpd/bgp_mplsvpn.h"
 
-u_int16_t
+static u_int16_t
 decode_rd_type (u_char *pnt)
 {
   u_int16_t v;
@@ -53,7 +53,7 @@ decode_label (u_char *pnt)
   return l;
 }
 
-void
+static void
 decode_rd_as (u_char *pnt, struct rd_as *rd_as)
 {
   rd_as->as = (u_int16_t) *pnt++ << 8;
@@ -65,7 +65,7 @@ decode_rd_as (u_char *pnt, struct rd_as *rd_as)
   rd_as->val |= (u_int32_t) *pnt;
 }
 
-void
+static void
 decode_rd_ip (u_char *pnt, struct rd_ip *rd_ip)
 {
   memcpy (&rd_ip->ip, pnt, 4);
@@ -75,11 +75,6 @@ decode_rd_ip (u_char *pnt, struct rd_ip *rd_ip)
   rd_ip->val |= (u_int16_t) *pnt;
 }
 
-int bgp_update (struct peer *, struct prefix *, struct attr *, 
-		afi_t, safi_t, int, int, struct prefix_rd *, u_char *);
-
-int bgp_withdraw (struct peer *, struct prefix *, struct attr *, 
-		  int, int, int, int, struct prefix_rd *, u_char *);
 int
 bgp_nlri_parse_vpnv4 (struct peer *peer, struct attr *attr, 
 		      struct bgp_nlri *packet)
@@ -162,7 +157,7 @@ bgp_nlri_parse_vpnv4 (struct peer *peer, struct attr *attr,
 
       if (attr)
 	bgp_update (peer, &p, attr, AFI_IP, SAFI_MPLS_VPN,
-		    ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, tagpnt);
+		    ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, tagpnt, 0);
       else
 	bgp_withdraw (peer, &p, attr, AFI_IP, SAFI_MPLS_VPN,
 		      ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, tagpnt);
@@ -312,7 +307,7 @@ DEFUN (no_vpnv4_network,
   return bgp_static_unset_vpnv4 (vty, argv[0], argv[1], argv[2]);
 }
 
-int
+static int
 show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd)
 {
   struct bgp *bgp;
@@ -406,7 +401,7 @@ enum bgp_show_type
   bgp_show_type_community_list_exact
 };
 
-int
+static int
 bgp_show_mpls_vpn (struct vty *vty, struct prefix_rd *prd, enum bgp_show_type type,
 		   void *output_arg, int tags)
 {
@@ -718,7 +713,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes,
 }
 
 void
-bgp_mplsvpn_init ()
+bgp_mplsvpn_init (void)
 {
   install_element (BGP_VPNV4_NODE, &vpnv4_network_cmd);
   install_element (BGP_VPNV4_NODE, &no_vpnv4_network_cmd);

+ 6 - 6
bgpd/bgp_mplsvpn.h

@@ -40,11 +40,11 @@ struct rd_ip
   u_int16_t val;
 };
 
-void bgp_mplsvpn_init ();
-int bgp_nlri_parse_vpnv4 (struct peer *, struct attr *, struct bgp_nlri *);
-u_int32_t decode_label (u_char *);
-int str2prefix_rd (const char *, struct prefix_rd *);
-int str2tag (const char *, u_char *);
-char *prefix_rd2str (struct prefix_rd *, char *, size_t);
+extern void bgp_mplsvpn_init (void);
+extern int bgp_nlri_parse_vpnv4 (struct peer *, struct attr *, struct bgp_nlri *);
+extern u_int32_t decode_label (u_char *);
+extern int str2prefix_rd (const char *, struct prefix_rd *);
+extern int str2tag (const char *, u_char *);
+extern char *prefix_rd2str (struct prefix_rd *, char *, size_t);
 
 #endif /* _QUAGGA_BGP_MPLSVPN_H */

+ 4 - 4
bgpd/bgp_network.c

@@ -121,7 +121,7 @@ bgp_accept (struct thread *thread)
 }
 
 /* BGP socket bind. */
-int
+static int
 bgp_bind (struct peer *peer)
 {
 #ifdef SO_BINDTODEVICE
@@ -151,7 +151,7 @@ bgp_bind (struct peer *peer)
   return 0;
 }
 
-int
+static int
 bgp_bind_address (int sock, struct in_addr *addr)
 {
   int ret;
@@ -177,7 +177,7 @@ bgp_bind_address (int sock, struct in_addr *addr)
   return 0;
 }
 
-struct in_addr *
+static struct in_addr *
 bgp_update_address (struct interface *ifp)
 {
   struct prefix_ipv4 *p;
@@ -195,7 +195,7 @@ bgp_update_address (struct interface *ifp)
 }
 
 /* Update source selection.  */
-void
+static void
 bgp_update_source (struct peer *peer)
 {
   struct interface *ifp;

+ 3 - 3
bgpd/bgp_network.h

@@ -21,8 +21,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #ifndef _QUAGGA_BGP_NETWORK_H
 #define _QUAGGA_BGP_NETWORK_H
 
-int bgp_socket (struct bgp *, unsigned short);
-int bgp_connect (struct peer *);
-void bgp_getsockname (struct peer *);
+extern int bgp_socket (struct bgp *, unsigned short);
+extern int bgp_connect (struct peer *);
+extern void bgp_getsockname (struct peer *);
 
 #endif /* _QUAGGA_BGP_NETWORK_H */

+ 17 - 19
bgpd/bgp_nexthop.c

@@ -66,12 +66,9 @@ static struct bgp_table *bgp_connected_table[AFI_MAX];
 
 /* BGP nexthop lookup query client. */
 static struct zclient *zlookup = NULL;
-
-/* BGP process function. */
-int bgp_process (struct bgp *, struct bgp_node *, afi_t, safi_t);
 
 /* Add nexthop to the end of the list.  */
-void
+static void
 bnc_nexthop_add (struct bgp_nexthop_cache *bnc, struct nexthop *nexthop)
 {
   struct nexthop *last;
@@ -85,7 +82,7 @@ bnc_nexthop_add (struct bgp_nexthop_cache *bnc, struct nexthop *nexthop)
   nexthop->prev = last;
 }
 
-void
+static void
 bnc_nexthop_free (struct bgp_nexthop_cache *bnc)
 {
   struct nexthop *nexthop;
@@ -98,7 +95,7 @@ bnc_nexthop_free (struct bgp_nexthop_cache *bnc)
     }
 }
 
-struct bgp_nexthop_cache *
+static struct bgp_nexthop_cache *
 bnc_new ()
 {
   struct bgp_nexthop_cache *new;
@@ -108,14 +105,14 @@ bnc_new ()
   return new;
 }
 
-void
+static void
 bnc_free (struct bgp_nexthop_cache *bnc)
 {
   bnc_nexthop_free (bnc);
   XFREE (MTYPE_BGP_NEXTHOP_CACHE, bnc);
 }
 
-int
+static int
 bgp_nexthop_same (struct nexthop *next1, struct nexthop *next2)
 {
   if (next1->type != next2->type)
@@ -152,7 +149,7 @@ bgp_nexthop_same (struct nexthop *next1, struct nexthop *next2)
   return 1;
 }
 
-int
+static int
 bgp_nexthop_cache_changed (struct bgp_nexthop_cache *bnc1,
 			   struct bgp_nexthop_cache *bnc2)
 {
@@ -221,7 +218,7 @@ bgp_nexthop_check_ebgp (afi_t afi, struct attr *attr)
 
 #ifdef HAVE_IPV6
 /* Check specified next-hop is reachable or not. */
-int
+static int
 bgp_nexthop_lookup_ipv6 (struct peer *peer, struct bgp_info *ri, int *changed,
 			 int *metricchanged)
 {
@@ -396,7 +393,7 @@ bgp_nexthop_lookup (afi_t afi, struct peer *peer, struct bgp_info *ri,
 }
 
 /* Reset and free all BGP nexthop cache. */
-void
+static void
 bgp_nexthop_cache_reset (struct bgp_table *table)
 {
   struct bgp_node *rn;
@@ -411,7 +408,7 @@ bgp_nexthop_cache_reset (struct bgp_table *table)
       }
 }
 
-void
+static void
 bgp_scan (afi_t afi, safi_t safi)
 {
   struct bgp_node *rn;
@@ -518,7 +515,7 @@ bgp_scan (afi_t afi, safi_t safi)
 }
 
 /* BGP scan thread.  This thread check nexthop reachability. */
-int
+static int
 bgp_scan_timer (struct thread *t)
 {
   bgp_scan_thread =
@@ -737,7 +734,7 @@ bgp_nexthop_self (afi_t afi, struct attr *attr)
   return 0;
 }
 
-struct bgp_nexthop_cache *
+static struct bgp_nexthop_cache *
 zlookup_read ()
 {
   struct stream *s;
@@ -833,7 +830,7 @@ zlookup_query (struct in_addr addr)
 }
 
 #ifdef HAVE_IPV6
-struct bgp_nexthop_cache *
+static struct bgp_nexthop_cache *
 zlookup_read_ipv6 ()
 {
   struct stream *s;
@@ -936,8 +933,9 @@ zlookup_query_ipv6 (struct in6_addr *addr)
 }
 #endif /* HAVE_IPV6 */
 
-int
-bgp_import_check (struct prefix *p, u_int32_t *igpmetric, struct in_addr *igpnexthop)
+static int
+bgp_import_check (struct prefix *p, u_int32_t *igpmetric,
+                  struct in_addr *igpnexthop)
 {
   struct stream *s;
   int ret;
@@ -1024,7 +1022,7 @@ bgp_import_check (struct prefix *p, u_int32_t *igpmetric, struct in_addr *igpnex
 
 /* Scan all configured BGP route then check the route exists in IGP or
    not. */
-int
+static int
 bgp_import (struct thread *t)
 {
   struct bgp *bgp;
@@ -1089,7 +1087,7 @@ bgp_import (struct thread *t)
 }
 
 /* Connect to zebra for nexthop lookup. */
-int
+static int
 zlookup_connect (struct thread *t)
 {
   struct zclient *zlookup;

+ 8 - 8
bgpd/bgp_nexthop.h

@@ -44,14 +44,14 @@ struct bgp_nexthop_cache
   struct nexthop *nexthop;
 };
 
-void bgp_scan_init ();
-int bgp_nexthop_lookup (afi_t, struct peer *peer, struct bgp_info *,
+extern void bgp_scan_init (void);
+extern int bgp_nexthop_lookup (afi_t, struct peer *peer, struct bgp_info *,
 			int *, int *);
-void bgp_connected_add (struct connected *c);
-void bgp_connected_delete (struct connected *c);
-int bgp_multiaccess_check_v4 (struct in_addr, char *);
-int bgp_config_write_scan_time (struct vty *);
-int bgp_nexthop_check_ebgp (afi_t, struct attr *);
-int bgp_nexthop_self (afi_t, struct attr *);
+extern void bgp_connected_add (struct connected *c);
+extern void bgp_connected_delete (struct connected *c);
+extern int bgp_multiaccess_check_v4 (struct in_addr, char *);
+extern int bgp_config_write_scan_time (struct vty *);
+extern int bgp_nexthop_check_ebgp (afi_t, struct attr *);
+extern int bgp_nexthop_self (afi_t, struct attr *);
 
 #endif /* _QUAGGA_BGP_NEXTHOP_H */

+ 7 - 7
bgpd/bgp_open.c

@@ -112,7 +112,7 @@ bgp_capability_vty_out (struct vty *vty, struct peer *peer)
 }
 
 /* Set negotiated capability value. */
-int
+static int
 bgp_capability_mp (struct peer *peer, struct capability *cap)
 {
   if (ntohs (cap->mpc.afi) == AFI_IP)
@@ -181,7 +181,7 @@ bgp_capability_mp (struct peer *peer, struct capability *cap)
   return 0;
 }
 
-void
+static void
 bgp_capability_orf_not_support (struct peer *peer, afi_t afi, safi_t safi,
 				u_char type, u_char mode)
 {
@@ -190,7 +190,7 @@ bgp_capability_orf_not_support (struct peer *peer, afi_t afi, safi_t safi,
 	       peer->host, afi, safi, type, mode);
 }
 
-int
+static int
 bgp_capability_orf (struct peer *peer, struct capability *cap,
 		    u_char *pnt)
 {
@@ -307,7 +307,7 @@ bgp_capability_orf (struct peer *peer, struct capability *cap,
 }
 
 /* Parse given capability. */
-int
+static int
 bgp_capability_parse (struct peer *peer, u_char *pnt, u_char length,
 		      u_char **error)
 {
@@ -504,7 +504,7 @@ bgp_capability_parse (struct peer *peer, u_char *pnt, u_char length,
   return 0;
 }
 
-int
+static int
 bgp_auth_parse (struct peer *peer, u_char *pnt, size_t length)
 {
   bgp_notify_send (peer, 
@@ -513,7 +513,7 @@ bgp_auth_parse (struct peer *peer, u_char *pnt, size_t length)
   return -1;
 }
 
-int
+static int
 strict_capability_same (struct peer *peer)
 {
   int i, j;
@@ -660,7 +660,7 @@ bgp_open_option_parse (struct peer *peer, u_char length, int *capability)
   return 0;
 }
 
-void
+static void
 bgp_open_capability_orf (struct stream *s, struct peer *peer,
                          afi_t afi, safi_t safi, u_char code)
 {

+ 3 - 3
bgpd/bgp_open.h

@@ -79,8 +79,8 @@ struct graceful_restart_af
 #define RESTART_R_BIT              0x8000
 #define RESTART_F_BIT              0x80
 
-int bgp_open_option_parse (struct peer *, u_char, int *);
-void bgp_open_capability (struct stream *, struct peer *);
-void bgp_capability_vty_out (struct vty *, struct peer *);
+extern int bgp_open_option_parse (struct peer *, u_char, int *);
+extern void bgp_open_capability (struct stream *, struct peer *);
+extern void bgp_capability_vty_out (struct vty *, struct peer *);
 
 #endif /* _QUAGGA_BGP_OPEN_H */

+ 20 - 20
bgpd/bgp_packet.c

@@ -85,7 +85,7 @@ bgp_packet_set_size (struct stream *s)
 }
 
 /* Add new packet to the peer. */
-void
+static void
 bgp_packet_add (struct peer *peer, struct stream *s)
 {
   /* Add packet to the end of list. */
@@ -93,7 +93,7 @@ bgp_packet_add (struct peer *peer, struct stream *s)
 }
 
 /* Free first packet. */
-void
+static void
 bgp_packet_delete (struct peer *peer)
 {
   stream_free (stream_fifo_pop (peer->obuf));
@@ -138,7 +138,7 @@ bgp_connect_check (struct peer *peer)
 }
 
 /* Make BGP update packet.  */
-struct stream *
+static struct stream *
 bgp_update_packet (struct peer *peer, afi_t afi, safi_t safi)
 {
   struct stream *s;
@@ -225,7 +225,7 @@ bgp_update_packet (struct peer *peer, afi_t afi, safi_t safi)
   return NULL;
 }
 
-struct stream *
+static struct stream *
 bgp_update_packet_eor (struct peer *peer, afi_t afi, safi_t safi)
 {
   struct stream *s;
@@ -270,7 +270,7 @@ bgp_update_packet_eor (struct peer *peer, afi_t afi, safi_t safi)
 }
 
 /* Make BGP withdraw packet.  */
-struct stream *
+static struct stream *
 bgp_withdraw_packet (struct peer *peer, afi_t afi, safi_t safi)
 {
   struct stream *s;
@@ -496,7 +496,7 @@ bgp_default_withdraw_send (struct peer *peer, afi_t afi, safi_t safi)
 }
 
 /* Get next packet to be written.  */
-struct stream *
+static struct stream *
 bgp_write_packet (struct peer *peer)
 {
   afi_t afi;
@@ -562,7 +562,7 @@ bgp_write_packet (struct peer *peer)
 
 /* Is there partially written packet or updates we can send right
    now.  */
-int
+static int
 bgp_write_proceed (struct peer *peer)
 {
   afi_t afi;
@@ -705,7 +705,7 @@ bgp_write (struct thread *thread)
 }
 
 /* This is only for sending NOTIFICATION message to neighbor. */
-int
+static int
 bgp_write_notify (struct peer *peer)
 {
   int ret;
@@ -927,7 +927,7 @@ bgp_notify_send (struct peer *peer, u_char code, u_char sub_code)
   bgp_notify_send_with_data (peer, code, sub_code, NULL, 0);
 }
 
-const char *
+static const char *
 afi2str (afi_t afi)
 {
   if (afi == AFI_IP)
@@ -938,7 +938,7 @@ afi2str (afi_t afi)
     return "Unknown AFI";
 }
 
-const char *
+static const char *
 safi2str (safi_t safi)
 {
   if (safi == SAFI_UNICAST)
@@ -1101,7 +1101,7 @@ bgp_capability_send (struct peer *peer, afi_t afi, safi_t safi,
 }
 
 /* RFC1771 6.8 Connection collision detection. */
-int
+static int
 bgp_collision_detect (struct peer *new, struct in_addr remote_id)
 {
   struct peer *peer;
@@ -1164,7 +1164,7 @@ bgp_collision_detect (struct peer *new, struct in_addr remote_id)
   return 0;
 }
 
-int
+static int
 bgp_open_receive (struct peer *peer, bgp_size_t size)
 {
   int ret;
@@ -1408,7 +1408,7 @@ bgp_open_receive (struct peer *peer, bgp_size_t size)
 }
 
 /* Parse BGP Update packet and make attribute object. */
-int
+static int
 bgp_update_receive (struct peer *peer, bgp_size_t size)
 {
   int ret;
@@ -1734,7 +1734,7 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
 }
 
 /* Notify message treatment function. */
-void
+static void
 bgp_notify_receive (struct peer *peer, bgp_size_t size)
 {
   struct bgp_notify bgp_notify;
@@ -1814,7 +1814,7 @@ bgp_notify_receive (struct peer *peer, bgp_size_t size)
 }
 
 /* Keepalive treatment function -- get keepalive send keepalive */
-void
+static void
 bgp_keepalive_receive (struct peer *peer, bgp_size_t size)
 {
   if (BGP_DEBUG (keepalive, KEEPALIVE))  
@@ -1824,7 +1824,7 @@ bgp_keepalive_receive (struct peer *peer, bgp_size_t size)
 }
 
 /* Route refresh message is received. */
-void
+static void
 bgp_route_refresh_receive (struct peer *peer, bgp_size_t size)
 {
   afi_t afi;
@@ -1988,7 +1988,7 @@ bgp_route_refresh_receive (struct peer *peer, bgp_size_t size)
   bgp_announce_route (peer, afi, safi);
 }
 
-int
+static int
 bgp_capability_msg_parse (struct peer *peer, u_char *pnt, bgp_size_t length)
 {
   u_char *end;
@@ -2098,7 +2098,7 @@ bgp_capability_msg_parse (struct peer *peer, u_char *pnt, bgp_size_t length)
 }
 
 /* Dynamic Capability is received. */
-void
+static void
 bgp_capability_receive (struct peer *peer, bgp_size_t size)
 {
   u_char *pnt;
@@ -2135,7 +2135,7 @@ bgp_capability_receive (struct peer *peer, bgp_size_t size)
 }
 
 /* BGP read utility function. */
-int
+static int
 bgp_read_packet (struct peer *peer)
 {
   int nbytes;
@@ -2204,7 +2204,7 @@ bgp_read_packet (struct peer *peer)
 }
 
 /* Marker check. */
-int
+static int
 bgp_marker_all_one (struct stream *s, int length)
 {
   int i;

+ 10 - 10
bgpd/bgp_packet.h

@@ -38,18 +38,18 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #define ORF_COMMON_PART_DENY       0x20 
 
 /* Packet send and receive function prototypes. */
-int bgp_read (struct thread *);
-int bgp_write (struct thread *);
+extern int bgp_read (struct thread *);
+extern int bgp_write (struct thread *);
 
-void bgp_keepalive_send (struct peer *);
-void bgp_open_send (struct peer *);
-void bgp_notify_send (struct peer *, u_int8_t, u_int8_t);
-void bgp_notify_send_with_data (struct peer *, u_int8_t, u_int8_t, 
+extern void bgp_keepalive_send (struct peer *);
+extern void bgp_open_send (struct peer *);
+extern void bgp_notify_send (struct peer *, u_int8_t, u_int8_t);
+extern void bgp_notify_send_with_data (struct peer *, u_int8_t, u_int8_t, 
                                 u_int8_t *, size_t);
-void bgp_route_refresh_send (struct peer *, afi_t, safi_t, u_char, u_char, int);
-void bgp_capability_send (struct peer *, afi_t, safi_t, int, int);
-void bgp_default_update_send (struct peer *, struct attr *,
+extern void bgp_route_refresh_send (struct peer *, afi_t, safi_t, u_char, u_char, int);
+extern void bgp_capability_send (struct peer *, afi_t, safi_t, int, int);
+extern void bgp_default_update_send (struct peer *, struct attr *,
 			      afi_t, safi_t, struct peer *);
-void bgp_default_withdraw_send (struct peer *, afi_t, safi_t);
+extern void bgp_default_withdraw_send (struct peer *, afi_t, safi_t);
 
 #endif /* _QUAGGA_BGP_PACKET_H */

+ 3 - 3
bgpd/bgp_regex.h

@@ -29,8 +29,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "regex-gnu.h"
 #endif /* HAVE_GNU_REGEX */
 
-void bgp_regex_free (regex_t *regex);
-regex_t *bgp_regcomp (const char *str);
-int bgp_regexec (regex_t *regex, struct aspath *aspath);
+extern void bgp_regex_free (regex_t *regex);
+extern regex_t *bgp_regcomp (const char *str);
+extern int bgp_regexec (regex_t *regex, struct aspath *aspath);
 
 #endif /* _QUAGGA_BGP_REGEX_H */

+ 60 - 60
bgpd/bgp_route.c

@@ -59,7 +59,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 extern char *bgp_origin_str[];
 extern char *bgp_origin_long_str[];
 
-struct bgp_node *
+static struct bgp_node *
 bgp_afi_node_get (struct bgp_table *table, afi_t afi, safi_t safi, struct prefix *p,
 		  struct prefix_rd *prd)
 {
@@ -180,7 +180,7 @@ bgp_info_delete (struct bgp_node *rn, struct bgp_info *ri)
 
 /* Get MED value.  If MED value is missing and "bgp bestpath
    missing-as-worst" is specified, treat it as the worst value. */
-u_int32_t
+static u_int32_t
 bgp_med_value (struct attr *attr, struct bgp *bgp)
 {
   if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC))
@@ -195,7 +195,7 @@ bgp_med_value (struct attr *attr, struct bgp *bgp)
 }
 
 /* Compare two bgp route entity.  br is preferable then return 1. */
-int
+static int
 bgp_info_cmp (struct bgp *bgp, struct bgp_info *new, struct bgp_info *exist)
 {
   u_int32_t new_pref;
@@ -386,7 +386,7 @@ bgp_info_cmp (struct bgp *bgp, struct bgp_info *new, struct bgp_info *exist)
   return 1;
 }
 
-enum filter_type
+static enum filter_type
 bgp_input_filter (struct peer *peer, struct prefix *p, struct attr *attr,
 		  afi_t afi, safi_t safi)
 {
@@ -409,7 +409,7 @@ bgp_input_filter (struct peer *peer, struct prefix *p, struct attr *attr,
   return FILTER_PERMIT;
 }
 
-enum filter_type
+static enum filter_type
 bgp_output_filter (struct peer *peer, struct prefix *p, struct attr *attr,
 		   afi_t afi, safi_t safi)
 {
@@ -433,7 +433,7 @@ bgp_output_filter (struct peer *peer, struct prefix *p, struct attr *attr,
 }
 
 /* If community attribute includes no_export then return 1. */
-int
+static int
 bgp_community_filter (struct peer *peer, struct attr *attr)
 {
   if (attr->community)
@@ -475,7 +475,7 @@ bgp_cluster_filter (struct peer *peer, struct attr *attr)
   return 0;
 }
 
-int
+static int
 bgp_input_modifier (struct peer *peer, struct prefix *p, struct attr *attr,
 		    afi_t afi, safi_t safi)
 {
@@ -512,7 +512,7 @@ bgp_input_modifier (struct peer *peer, struct prefix *p, struct attr *attr,
   return RMAP_PERMIT;
 }
 
-int
+static int
 bgp_export_modifier (struct peer *rsclient, struct peer *peer,
         struct prefix *p, struct attr *attr, afi_t afi, safi_t safi)
 {
@@ -546,7 +546,7 @@ bgp_export_modifier (struct peer *rsclient, struct peer *peer,
   return RMAP_PERMIT;
 }
 
-int
+static int
 bgp_import_modifier (struct peer *rsclient, struct peer *peer,
         struct prefix *p, struct attr *attr, afi_t afi, safi_t safi)
 {
@@ -583,7 +583,7 @@ bgp_import_modifier (struct peer *rsclient, struct peer *peer,
   return RMAP_PERMIT;
 }
 
-int
+static int
 bgp_announce_check (struct bgp_info *ri, struct peer *peer, struct prefix *p,
 		    struct attr *attr, afi_t afi, safi_t safi)
 {
@@ -886,7 +886,7 @@ bgp_announce_check (struct bgp_info *ri, struct peer *peer, struct prefix *p,
   return 1;
 }
 
-int
+static int
 bgp_announce_check_rsclient (struct bgp_info *ri, struct peer *rsclient,
         struct prefix *p, struct attr *attr, afi_t afi, safi_t safi)
 {
@@ -1089,7 +1089,7 @@ struct bgp_info_pair
   struct bgp_info *new;
 };
 
-void
+static void
 bgp_best_selection (struct bgp *bgp, struct bgp_node *rn, struct bgp_info_pair *result)
 {
   struct bgp_info *new_select;
@@ -1164,7 +1164,7 @@ bgp_best_selection (struct bgp *bgp, struct bgp_node *rn, struct bgp_info_pair *
     return;
 }
 
-int
+static int
 bgp_process_announce_selected (struct peer *peer, struct bgp_info *selected,
         struct bgp_node *rn, struct attr *attr, afi_t afi, safi_t safi)
     {
@@ -1419,7 +1419,7 @@ bgp_process (struct bgp *bgp, struct bgp_node *rn, afi_t afi, safi_t safi)
   return;
 }
 
-int
+static int
 bgp_maximum_prefix_restart_timer (struct thread *thread)
 {
   struct peer *peer;
@@ -1512,7 +1512,7 @@ bgp_maximum_prefix_overflow (struct peer *peer, afi_t afi,
   return 0;
 }
 
-void
+static void
 bgp_rib_remove (struct bgp_node *rn, struct bgp_info *ri, struct peer *peer,
 		afi_t afi, safi_t safi)
 {
@@ -1530,7 +1530,7 @@ bgp_rib_remove (struct bgp_node *rn, struct bgp_info *ri, struct peer *peer,
   bgp_info_delete (rn, ri);
 }
 
-void
+static void
 bgp_rib_withdraw (struct bgp_node *rn, struct bgp_info *ri, struct peer *peer,
 		  afi_t afi, safi_t safi, int force)
 {
@@ -1567,7 +1567,7 @@ bgp_rib_withdraw (struct bgp_node *rn, struct bgp_info *ri, struct peer *peer,
     bgp_info_delete (rn, ri);
 }
 
-void
+static void
 bgp_update_rsclient (struct peer *rsclient, afi_t afi, safi_t safi,
       struct attr *attr, struct peer *peer, struct prefix *p, int type,
       int sub_type, struct prefix_rd *prd, u_char *tag)
@@ -1750,7 +1750,7 @@ bgp_update_rsclient (struct peer *rsclient, afi_t afi, safi_t safi,
   return;
 }
 
-void
+static void
 bgp_withdraw_rsclient (struct peer *rsclient, afi_t afi, safi_t safi,
       struct peer *peer, struct prefix *p, int type, int sub_type,
       struct prefix_rd *prd, u_char *tag)
@@ -1782,7 +1782,7 @@ bgp_withdraw_rsclient (struct peer *rsclient, afi_t afi, safi_t safi,
       bgp_unlock_node (rn);
     }
 
-int
+static int
 bgp_update_main (struct peer *peer, struct prefix *p, struct attr *attr,
 	    afi_t afi, safi_t safi, int type, int sub_type,
 	    struct prefix_rd *prd, u_char *tag, int soft_reconfig)
@@ -2121,8 +2121,8 @@ bgp_update (struct peer *peer, struct prefix *p, struct attr *attr,
 
 int
 bgp_withdraw (struct peer *peer, struct prefix *p, struct attr *attr, 
-	     int afi, int safi, int type, int sub_type, struct prefix_rd *prd,
-	      u_char *tag)
+	     afi_t afi, safi_t safi, int type, int sub_type, 
+	     struct prefix_rd *prd, u_char *tag)
 {
   struct bgp *bgp;
   char buf[SU_ADDRSTRLEN];
@@ -2463,7 +2463,7 @@ bgp_clear_node_queue_del (struct bgp_clear_node_queue *cq)
 }
 
 static void
-bgp_clear_node_complete (struct workqueue *wq)
+bgp_clear_node_complete (struct work_queue *wq)
 {
   /* unplug the 2 processing queues */
   if (bm->process_main_queue)
@@ -2811,7 +2811,7 @@ bgp_nlri_sanity_check (struct peer *peer, int afi, u_char *pnt,
   return 0;
 }
 
-struct bgp_static *
+static struct bgp_static *
 bgp_static_new ()
 {
   struct bgp_static *new;
@@ -2820,7 +2820,7 @@ bgp_static_new ()
   return new;
 }
 
-void
+static void
 bgp_static_free (struct bgp_static *bgp_static)
 {
   if (bgp_static->rmap.name)
@@ -2828,7 +2828,7 @@ bgp_static_free (struct bgp_static *bgp_static)
   XFREE (MTYPE_BGP_STATIC, bgp_static);
 }
 
-void
+static void
 bgp_static_withdraw_rsclient (struct bgp *bgp, struct peer *rsclient,
         struct prefix *p, afi_t afi, safi_t safi)
 {
@@ -2856,7 +2856,7 @@ bgp_static_withdraw_rsclient (struct bgp *bgp, struct peer *rsclient,
   bgp_unlock_node (rn);
 }
 
-void
+static void
 bgp_static_update_rsclient (struct peer *rsclient, struct prefix *p,
         struct bgp_static *bgp_static, afi_t afi, safi_t safi)
 {
@@ -2996,7 +2996,7 @@ bgp_static_update_rsclient (struct peer *rsclient, struct prefix *p,
   aspath_unintern (attr.aspath);
 }
 
-void
+static void
 bgp_static_update_main (struct bgp *bgp, struct prefix *p,
 		   struct bgp_static *bgp_static, afi_t afi, safi_t safi)
 {
@@ -3121,7 +3121,7 @@ bgp_static_update (struct bgp *bgp, struct prefix *p,
     }
 }
 
-void
+static void
 bgp_static_update_vpnv4 (struct bgp *bgp, struct prefix *p, u_int16_t afi,
 			 u_char safi, struct prefix_rd *prd, u_char *tag)
 {
@@ -3202,7 +3202,7 @@ bgp_check_local_routes_rsclient (struct peer *rsclient, afi_t afi, safi_t safi)
       }
 }
 
-void
+static void
 bgp_static_withdraw_vpnv4 (struct bgp *bgp, struct prefix *p, u_int16_t afi,
 			   u_char safi, struct prefix_rd *prd, u_char *tag)
 {
@@ -3233,7 +3233,7 @@ bgp_static_withdraw_vpnv4 (struct bgp *bgp, struct prefix *p, u_int16_t afi,
 
 /* Configure static BGP network.  When user don't run zebra, static
    route should be installed as valid.  */
-int
+static int
 bgp_static_set (struct vty *vty, struct bgp *bgp, const char *ip_str, 
                 u_int16_t afi, u_char safi, const char *rmap, int backdoor)
 {
@@ -3325,7 +3325,7 @@ bgp_static_set (struct vty *vty, struct bgp *bgp, const char *ip_str,
 }
 
 /* Configure static BGP network. */
-int
+static int
 bgp_static_unset (struct vty *vty, struct bgp *bgp, const char *ip_str,
 		  u_int16_t afi, u_char safi)
 {
@@ -3911,7 +3911,7 @@ struct bgp_aggregate
   safi_t safi;
 };
 
-struct bgp_aggregate *
+static struct bgp_aggregate *
 bgp_aggregate_new ()
 {
   struct bgp_aggregate *new;
@@ -3920,13 +3920,13 @@ bgp_aggregate_new ()
   return new;
 }
 
-void
+static void
 bgp_aggregate_free (struct bgp_aggregate *aggregate)
 {
   XFREE (MTYPE_BGP_AGGREGATE, aggregate);
 }     
 
-void
+static void
 bgp_aggregate_route (struct bgp *bgp, struct prefix *p, struct bgp_info *rinew,
 		     afi_t afi, safi_t safi, struct bgp_info *del, 
 		     struct bgp_aggregate *aggregate)
@@ -4165,7 +4165,7 @@ bgp_aggregate_decrement (struct bgp *bgp, struct prefix *p,
   bgp_unlock_node (child);
 }
 
-void
+static void
 bgp_aggregate_add (struct bgp *bgp, struct prefix *p, afi_t afi, safi_t safi,
 		   struct bgp_aggregate *aggregate)
 {
@@ -4347,7 +4347,7 @@ bgp_aggregate_delete (struct bgp *bgp, struct prefix *p, afi_t afi,
 #define AGGREGATE_SUMMARY_ONLY 1
 #define AGGREGATE_AS_SET       1
 
-int
+static int
 bgp_aggregate_set (struct vty *vty, const char *prefix_str, 
                    afi_t afi, safi_t safi,
 		   u_char summary_only, u_char as_set)
@@ -4396,7 +4396,7 @@ bgp_aggregate_set (struct vty *vty, const char *prefix_str,
   return CMD_SUCCESS;
 }
 
-int
+static int
 bgp_aggregate_unset (struct vty *vty, const char *prefix_str, 
                      afi_t afi, safi_t safi)
 {
@@ -4958,7 +4958,7 @@ bgp_redistribute_withdraw (struct bgp *bgp, afi_t afi, int type)
 }
 
 /* Static function to display route. */
-void
+static void
 route_vty_out_route (struct prefix *p, struct vty *vty)
 {
   int len;
@@ -5364,7 +5364,7 @@ flap_route_vty_out (struct vty *vty, struct prefix *p,
   vty_out (vty, "%s", VTY_NEWLINE);
 }
 
-void
+static void
 route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p, 
 		      struct bgp_info *binfo, afi_t afi, safi_t safi)
 {
@@ -5805,7 +5805,7 @@ bgp_show (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
 }
 
 /* Header of detailed BGP route information */
-void
+static void
 route_vty_out_detail_header (struct vty *vty, struct bgp *bgp,
 			     struct bgp_node *rn,
                              struct prefix_rd *prd, afi_t afi, safi_t safi)
@@ -5888,7 +5888,7 @@ route_vty_out_detail_header (struct vty *vty, struct bgp *bgp,
 }
 
 /* Display specified route of BGP table. */
-int
+static int
 bgp_show_route_in_table (struct vty *vty, struct bgp *bgp, 
                          struct bgp_table *rib, const char *ip_str,
                          afi_t afi, safi_t safi, struct prefix_rd *prd,
@@ -5977,7 +5977,7 @@ bgp_show_route_in_table (struct vty *vty, struct bgp *bgp,
 }
 
 /* Display specified route of Main RIB */
-int
+static int
 bgp_show_route (struct vty *vty, const char *view_name, const char *ip_str,
 		afi_t afi, safi_t safi, struct prefix_rd *prd,
 		int prefix_check)
@@ -6414,7 +6414,7 @@ DEFUN (show_ipv6_mbgp_prefix,
 #endif
 
 
-int
+static int
 bgp_show_regexp (struct vty *vty, int argc, const char **argv, afi_t afi,
 		 safi_t safi, enum bgp_show_type type)
 {
@@ -6557,7 +6557,7 @@ DEFUN (show_ipv6_mbgp_regexp,
 }
 #endif /* HAVE_IPV6 */
 
-int
+static int
 bgp_show_prefix_list (struct vty *vty, const char *prefix_list_str, afi_t afi,
 		      safi_t safi, enum bgp_show_type type)
 {
@@ -6672,7 +6672,7 @@ DEFUN (show_ipv6_mbgp_prefix_list,
 }
 #endif /* HAVE_IPV6 */
 
-int
+static int
 bgp_show_filter_list (struct vty *vty, const char *filter, afi_t afi,
 		      safi_t safi, enum bgp_show_type type)
 {
@@ -6786,7 +6786,7 @@ DEFUN (show_ipv6_mbgp_filter_list,
 }
 #endif /* HAVE_IPV6 */
 
-int
+static int
 bgp_show_route_map (struct vty *vty, const char *rmap_str, afi_t afi,
 		    safi_t safi, enum bgp_show_type type)
 {
@@ -6993,7 +6993,7 @@ DEFUN (show_ipv6_mbgp_community_all,
 }
 #endif /* HAVE_IPV6 */
 
-int
+static int
 bgp_show_community (struct vty *vty, int argc, const char **argv, int exact,
                     u_int16_t afi, u_char safi)
 {
@@ -7993,7 +7993,7 @@ ALIAS (show_ipv6_mbgp_community_exact,
        "Exact match of the communities")
 #endif /* HAVE_IPV6 */
 
-int
+static int
 bgp_show_community_list (struct vty *vty, const char *com, int exact,
 			 u_int16_t afi, u_char safi)
 {
@@ -8180,7 +8180,7 @@ DEFUN (show_ipv6_mbgp_community_list_exact,
 }
 #endif /* HAVE_IPV6 */
 
-int
+static int
 bgp_show_prefix_longer (struct vty *vty, const char *prefix, afi_t afi,
 			safi_t safi, enum bgp_show_type type)
 {
@@ -8324,7 +8324,7 @@ DEFUN (show_ipv6_mbgp_prefix_longer,
 }
 #endif /* HAVE_IPV6 */
 
-struct peer *
+static struct peer *
 peer_lookup_in_view (struct vty *vty, const char *view_name, 
                      const char *ip_str)
 {
@@ -8372,7 +8372,7 @@ peer_lookup_in_view (struct vty *vty, const char *view_name,
   return peer;
 }
 
-void
+static void
 show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi,
 		int in)
 {
@@ -8461,7 +8461,7 @@ show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi,
 	     VTY_NEWLINE, output_count, VTY_NEWLINE);
 }
 
-int
+static int
 peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, int in)
 {    
   if (! peer || ! peer->afc[afi][safi])
@@ -8958,7 +8958,7 @@ ALIAS (show_bgp_view_neighbor_received_prefix_filter,
        "Display the prefixlist filter\n")
 #endif /* HAVE_IPV6 */
 
-int
+static int
 bgp_show_neighbor_route (struct vty *vty, struct peer *peer, afi_t afi,
 			 safi_t safi, enum bgp_show_type type)
 {
@@ -9680,7 +9680,7 @@ struct bgp_distance
   char *access_list;
 };
 
-struct bgp_distance *
+static struct bgp_distance *
 bgp_distance_new ()
 {
   struct bgp_distance *new;
@@ -9689,13 +9689,13 @@ bgp_distance_new ()
   return new;
 }
 
-void
+static void
 bgp_distance_free (struct bgp_distance *bdistance)
 {
   XFREE (MTYPE_BGP_DISTANCE, bdistance);
 }
 
-int
+static int
 bgp_distance_set (struct vty *vty, const char *distance_str, 
                   const char *ip_str, const char *access_list_str)
 {
@@ -9742,7 +9742,7 @@ bgp_distance_set (struct vty *vty, const char *distance_str,
   return CMD_SUCCESS;
 }
 
-int
+static int
 bgp_distance_unset (struct vty *vty, const char *distance_str, 
                     const char *ip_str, const char *access_list_str)
 {
@@ -9781,7 +9781,7 @@ bgp_distance_unset (struct vty *vty, const char *distance_str,
   return CMD_SUCCESS;
 }
 
-void
+static void
 bgp_distance_reset ()
 {
   struct bgp_node *rn;
@@ -10062,7 +10062,7 @@ DEFUN (show_ip_bgp_flap_statistics,
 }
 
 /* Display specified route of BGP table. */
-int
+static int
 bgp_clear_damp_route (struct vty *vty, const char *view_name, 
                       const char *ip_str, afi_t afi, safi_t safi, 
                       struct prefix_rd *prd, int prefix_check)
@@ -10217,7 +10217,7 @@ DEFUN (clear_ip_bgp_dampening_address_mask,
 			       SAFI_UNICAST, NULL, 0);
 }
 
-int
+static int
 bgp_config_write_network_vpnv4 (struct vty *vty, struct bgp *bgp,
 				afi_t afi, safi_t safi, int *write)
 {

+ 43 - 33
bgpd/bgp_route.h

@@ -132,59 +132,69 @@ struct bgp_static
 #define UNSUPPRESS_MAP(F)       ((F)->usmap.map)
 
 /* Prototypes. */
-void bgp_route_init ();
-void bgp_cleanup_routes (void);
-void bgp_announce_route (struct peer *, afi_t, safi_t);
-void bgp_announce_route_all (struct peer *);