diff options
Diffstat (limited to 'bgpd')
45 files changed, 802 insertions, 831 deletions
diff --git a/bgpd/ChangeLog b/bgpd/ChangeLog index 6bd444d5..ce4868b0 100644 --- a/bgpd/ChangeLog +++ b/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 diff --git a/bgpd/bgp_advertise.c b/bgpd/bgp_advertise.c index da06cb96..512ff05b 100644 --- a/bgpd/bgp_advertise.c +++ b/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 */ diff --git a/bgpd/bgp_advertise.h b/bgpd/bgp_advertise.h index 995245a2..4ebde907 100644 --- a/bgpd/bgp_advertise.h +++ b/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 */ diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index 0c50f6a6..d13ed186 100644 --- a/bgpd/bgp_aspath.c +++ b/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; diff --git a/bgpd/bgp_aspath.h b/bgpd/bgp_aspath.h index a140d40f..c89b5e5a 100644 --- a/bgpd/bgp_aspath.h +++ b/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 */ diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 417e6222..d566f469 100644 --- a/bgpd/bgp_attr.c +++ b/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)  { diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h index 70e27aed..ad0302d8 100644 --- a/bgpd/bgp_attr.h +++ b/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 *); diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c index b36f2341..e5b4344e 100644 --- a/bgpd/bgp_clist.c +++ b/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; diff --git a/bgpd/bgp_clist.h b/bgpd/bgp_clist.h index ad6491ee..6d7e363e 100644 --- a/bgpd/bgp_clist.h +++ b/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 */ diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c index 1a6514bc..35e644b1 100644 --- a/bgpd/bgp_community.c +++ b/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);  } diff --git a/bgpd/bgp_community.h b/bgpd/bgp_community.h index 21a94193..aed7f330 100644 --- a/bgpd/bgp_community.h +++ b/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 */ diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c index e3ccbfba..93f1995f 100644 --- a/bgpd/bgp_damp.c +++ b/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; diff --git a/bgpd/bgp_damp.h b/bgpd/bgp_damp.h index 1aa25083..37ed90bc 100644 --- a/bgpd/bgp_damp.h +++ b/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 */ diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index edcc9f09..1b398ee8 100644 --- a/bgpd/bgp_debug.c +++ b/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); diff --git a/bgpd/bgp_debug.h b/bgpd/bgp_debug.h index 6f95184b..bc8acf93 100644 --- a/bgpd/bgp_debug.h +++ b/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; diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index 0fb5ed8d..f5bb5f44 100644 --- a/bgpd/bgp_dump.c +++ b/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)); diff --git a/bgpd/bgp_dump.h b/bgpd/bgp_dump.h index 16aa1260..36447e93 100644 --- a/bgpd/bgp_dump.h +++ b/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 */ diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index 32bf68f1..bcd37ea6 100644 --- a/bgpd/bgp_ecommunity.c +++ b/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)  { diff --git a/bgpd/bgp_ecommunity.h b/bgpd/bgp_ecommunity.h index 0dbd12cf..7b2564ad 100644 --- a/bgpd/bgp_ecommunity.h +++ b/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 */ diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c index 2f43cd05..de572c0a 100644 --- a/bgpd/bgp_filter.c +++ b/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); diff --git a/bgpd/bgp_filter.h b/bgpd/bgp_filter.h index 77d74c95..d389f165 100644 --- a/bgpd/bgp_filter.h +++ b/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 */ diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index fc7654f0..220861c1 100644 --- a/bgpd/bgp_fsm.c +++ b/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)) diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 135a1187..ac90f3c5 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/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); diff --git a/bgpd/bgp_mplsvpn.h b/bgpd/bgp_mplsvpn.h index 6be37b8e..b221c3bd 100644 --- a/bgpd/bgp_mplsvpn.h +++ b/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 */ diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index fb6b64df..61661c0d 100644 --- a/bgpd/bgp_network.c +++ b/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; diff --git a/bgpd/bgp_network.h b/bgpd/bgp_network.h index 7bcd25a0..ddf050d3 100644 --- a/bgpd/bgp_network.h +++ b/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 */ diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index 20434e11..1f6fef87 100644 --- a/bgpd/bgp_nexthop.c +++ b/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; diff --git a/bgpd/bgp_nexthop.h b/bgpd/bgp_nexthop.h index 733f5180..150e86cc 100644 --- a/bgpd/bgp_nexthop.h +++ b/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 */ diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c index b1d0fc14..e44bd2a0 100644 --- a/bgpd/bgp_open.c +++ b/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)  { diff --git a/bgpd/bgp_open.h b/bgpd/bgp_open.h index aa7f8cbb..7515d3f4 100644 --- a/bgpd/bgp_open.h +++ b/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 */ diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 959cc3fd..0971c5ca 100644 --- a/bgpd/bgp_packet.c +++ b/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; diff --git a/bgpd/bgp_packet.h b/bgpd/bgp_packet.h index 6576a565..85d64072 100644 --- a/bgpd/bgp_packet.h +++ b/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 */ diff --git a/bgpd/bgp_regex.h b/bgpd/bgp_regex.h index 3e0905f3..176b65a1 100644 --- a/bgpd/bgp_regex.h +++ b/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 */ diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 07fa139d..93074abb 100644 --- a/bgpd/bgp_route.c +++ b/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)  { diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h index 03567ecc..8d63e460 100644 --- a/bgpd/bgp_route.h +++ b/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 *); -void bgp_default_originate (struct peer *, afi_t, safi_t, int); -void bgp_soft_reconfig_in (struct peer *, afi_t, safi_t); -void bgp_soft_reconfig_rsclient (struct peer *, afi_t, safi_t); -void bgp_check_local_routes_rsclient (struct peer *rsclient, afi_t afi, safi_t safi); -void bgp_clear_route (struct peer *, afi_t, safi_t); -void bgp_clear_route_all (struct peer *); -void bgp_clear_adj_in (struct peer *, afi_t, safi_t); -void bgp_clear_stale_route (struct peer *, afi_t, safi_t); +extern void bgp_route_init (void); +extern void bgp_cleanup_routes (void); +extern void bgp_announce_route (struct peer *, afi_t, safi_t); +extern void bgp_announce_route_all (struct peer *); +extern void bgp_default_originate (struct peer *, afi_t, safi_t, int); +extern void bgp_soft_reconfig_in (struct peer *, afi_t, safi_t); +extern void bgp_soft_reconfig_rsclient (struct peer *, afi_t, safi_t); +extern void bgp_check_local_routes_rsclient (struct peer *rsclient, afi_t afi, safi_t safi); +extern void bgp_clear_route (struct peer *, afi_t, safi_t); +extern void bgp_clear_route_all (struct peer *); +extern void bgp_clear_adj_in (struct peer *, afi_t, safi_t); +extern void bgp_clear_stale_route (struct peer *, afi_t, safi_t);  extern struct bgp_info *bgp_info_lock (struct bgp_info *);  extern struct bgp_info *bgp_info_unlock (struct bgp_info *);  extern void bgp_info_add (struct bgp_node *rn, struct bgp_info *ri);  extern void bgp_info_delete (struct bgp_node *rn, struct bgp_info *ri); -int bgp_nlri_sanity_check (struct peer *, int, u_char *, bgp_size_t); -int bgp_nlri_parse (struct peer *, struct attr *, struct bgp_nlri *); +extern int bgp_nlri_sanity_check (struct peer *, int, u_char *, bgp_size_t); +extern int bgp_nlri_parse (struct peer *, struct attr *, struct bgp_nlri *); -int bgp_maximum_prefix_overflow (struct peer *, afi_t, safi_t, int); +extern int bgp_maximum_prefix_overflow (struct peer *, afi_t, safi_t, int); -void bgp_redistribute_add (struct prefix *, struct in_addr *, u_int32_t, u_char); -void bgp_redistribute_delete (struct prefix *, u_char); -void bgp_redistribute_withdraw (struct bgp *, afi_t, int); +extern void bgp_redistribute_add (struct prefix *, struct in_addr *, u_int32_t, u_char); +extern void bgp_redistribute_delete (struct prefix *, u_char); +extern void bgp_redistribute_withdraw (struct bgp *, afi_t, int); -void bgp_static_delete (struct bgp *); -void bgp_static_update (struct bgp *, struct prefix *, struct bgp_static *, +extern void bgp_static_delete (struct bgp *); +extern void bgp_static_update (struct bgp *, struct prefix *, struct bgp_static *,  			afi_t, safi_t); -void bgp_static_withdraw (struct bgp *, struct prefix *, afi_t, safi_t); +extern void bgp_static_withdraw (struct bgp *, struct prefix *, afi_t, safi_t); -int bgp_static_set_vpnv4 (struct vty *vty, const char *,  +extern int bgp_static_set_vpnv4 (struct vty *vty, const char *,                             const char *, const char *); -int bgp_static_unset_vpnv4 (struct vty *, const char *,  +extern int bgp_static_unset_vpnv4 (struct vty *, const char *,                               const char *, const char *); -int bgp_config_write_network (struct vty *, struct bgp *, afi_t, safi_t, int *); -int bgp_config_write_distance (struct vty *, struct bgp *); +/* this is primarily for MPLS-VPN */ +extern int bgp_update (struct peer *, struct prefix *, struct attr *, +		       afi_t, safi_t, int, int, struct prefix_rd *,  +		       u_char *, int); +extern int bgp_withdraw (struct peer *, struct prefix *, struct attr *, +			 afi_t, safi_t, int, int, struct prefix_rd *, u_char *); -void bgp_aggregate_increment (struct bgp *, struct prefix *, struct bgp_info *, +/* for bgp_nexthop and bgp_damp */ +extern void bgp_process (struct bgp *, struct bgp_node *, afi_t, safi_t); + +extern int bgp_config_write_network (struct vty *, struct bgp *, afi_t, safi_t, int *); +extern int bgp_config_write_distance (struct vty *, struct bgp *); + +extern void bgp_aggregate_increment (struct bgp *, struct prefix *, struct bgp_info *,  			      afi_t, safi_t); -void bgp_aggregate_decrement (struct bgp *, struct prefix *, struct bgp_info *, +extern void bgp_aggregate_decrement (struct bgp *, struct prefix *, struct bgp_info *,  			      afi_t, safi_t); -u_char bgp_distance_apply (struct prefix *, struct bgp_info *, struct bgp *); +extern u_char bgp_distance_apply (struct prefix *, struct bgp_info *, struct bgp *); -afi_t bgp_node_afi (struct vty *); -safi_t bgp_node_safi (struct vty *); +extern afi_t bgp_node_afi (struct vty *); +extern safi_t bgp_node_safi (struct vty *); -void route_vty_out (struct vty *, struct prefix *, struct bgp_info *, int, safi_t); -void route_vty_out_tag (struct vty *, struct prefix *, struct bgp_info *, int, safi_t); -void route_vty_out_tmp (struct vty *, struct prefix *, struct attr *, safi_t); +extern void route_vty_out (struct vty *, struct prefix *, struct bgp_info *, int, safi_t); +extern void route_vty_out_tag (struct vty *, struct prefix *, struct bgp_info *, int, safi_t); +extern void route_vty_out_tmp (struct vty *, struct prefix *, struct attr *, safi_t);  #endif /* _QUAGGA_BGP_ROUTE_H */ diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index d8944ef7..98e5a98f 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -100,7 +100,7 @@ o Local extention  /* Compares the peer specified in the 'match peer' clause with the peer      received in bgp_info->peer. If it is the same, or if the peer structure      received is a peer_group containing it, returns RMAP_MATCH. */ -route_map_result_t +static route_map_result_t  route_match_peer (void *rule, struct prefix *prefix, route_map_object_t type,        void *object)  { @@ -159,7 +159,7 @@ route_match_peer (void *rule, struct prefix *prefix, route_map_object_t type,    return RMAP_NOMATCH;  } -void * +static void *  route_match_peer_compile (const char *arg)  {    union sockunion *su; @@ -177,7 +177,7 @@ route_match_peer_compile (const char *arg)  }  /* Free route map's compiled `ip address' value. */ -void +static void  route_match_peer_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -196,7 +196,7 @@ struct route_map_rule_cmd route_match_peer_cmd =  /* Match function should return 1 if match is success else return     zero. */ -route_map_result_t +static route_map_result_t  route_match_ip_address (void *rule, struct prefix *prefix,   			route_map_object_t type, void *object)  { @@ -217,14 +217,14 @@ route_match_ip_address (void *rule, struct prefix *prefix,  /* Route map `ip address' match statement.  `arg' should be     access-list name. */ -void * +static void *  route_match_ip_address_compile (const char *arg)  {    return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);  }  /* Free route map's compiled `ip address' value. */ -void +static void  route_match_ip_address_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -242,7 +242,7 @@ struct route_map_rule_cmd route_match_ip_address_cmd =  /* `match ip next-hop IP_ADDRESS' */  /* Match function return 1 if match is success else return zero. */ -route_map_result_t +static route_map_result_t  route_match_ip_next_hop (void *rule, struct prefix *prefix,   			 route_map_object_t type, void *object)  { @@ -269,14 +269,14 @@ route_match_ip_next_hop (void *rule, struct prefix *prefix,  /* Route map `ip next-hop' match statement. `arg' is     access-list name. */ -void * +static void *  route_match_ip_next_hop_compile (const char *arg)  {    return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);  }  /* Free route map's compiled `ip address' value. */ -void +static void  route_match_ip_next_hop_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -294,7 +294,7 @@ struct route_map_rule_cmd route_match_ip_next_hop_cmd =  /* `match ip route-source ACCESS-LIST' */  /* Match function return 1 if match is success else return zero. */ -route_map_result_t +static route_map_result_t  route_match_ip_route_source (void *rule, struct prefix *prefix,   			     route_map_object_t type, void *object)  { @@ -327,14 +327,14 @@ route_match_ip_route_source (void *rule, struct prefix *prefix,  /* Route map `ip route-source' match statement. `arg' is     access-list name. */ -void * +static void *  route_match_ip_route_source_compile (const char *arg)  {    return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);  }  /* Free route map's compiled `ip address' value. */ -void +static void  route_match_ip_route_source_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -351,7 +351,7 @@ struct route_map_rule_cmd route_match_ip_route_source_cmd =  /* `match ip address prefix-list PREFIX_LIST' */ -route_map_result_t +static route_map_result_t  route_match_ip_address_prefix_list (void *rule, struct prefix *prefix,   				    route_map_object_t type, void *object)  { @@ -369,13 +369,13 @@ route_match_ip_address_prefix_list (void *rule, struct prefix *prefix,    return RMAP_NOMATCH;  } -void * +static void *  route_match_ip_address_prefix_list_compile (const char *arg)  {    return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);  } -void +static void  route_match_ip_address_prefix_list_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -391,7 +391,7 @@ struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd =  /* `match ip next-hop prefix-list PREFIX_LIST' */ -route_map_result_t +static route_map_result_t  route_match_ip_next_hop_prefix_list (void *rule, struct prefix *prefix,                                      route_map_object_t type, void *object)  { @@ -416,13 +416,13 @@ route_match_ip_next_hop_prefix_list (void *rule, struct prefix *prefix,    return RMAP_NOMATCH;  } -void * +static void *  route_match_ip_next_hop_prefix_list_compile (const char *arg)  {    return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);  } -void +static void  route_match_ip_next_hop_prefix_list_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -438,7 +438,7 @@ struct route_map_rule_cmd route_match_ip_next_hop_prefix_list_cmd =  /* `match ip route-source prefix-list PREFIX_LIST' */ -route_map_result_t +static route_map_result_t  route_match_ip_route_source_prefix_list (void *rule, struct prefix *prefix,  					 route_map_object_t type, void *object)  { @@ -469,13 +469,13 @@ route_match_ip_route_source_prefix_list (void *rule, struct prefix *prefix,    return RMAP_NOMATCH;  } -void * +static void *  route_match_ip_route_source_prefix_list_compile (const char *arg)  {    return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);  } -void +static void  route_match_ip_route_source_prefix_list_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -492,7 +492,7 @@ struct route_map_rule_cmd route_match_ip_route_source_prefix_list_cmd =  /* `match metric METRIC' */  /* Match function return 1 if match is success else return zero. */ -route_map_result_t +static route_map_result_t  route_match_metric (void *rule, struct prefix *prefix,   		    route_map_object_t type, void *object)  { @@ -513,7 +513,7 @@ route_match_metric (void *rule, struct prefix *prefix,  }  /* Route map `match metric' match statement. `arg' is MED value */ -void * +static void *  route_match_metric_compile (const char *arg)  {    u_int32_t *med; @@ -534,7 +534,7 @@ route_match_metric_compile (const char *arg)  }  /* Free route map's compiled `match metric' value. */ -void +static void  route_match_metric_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -552,7 +552,7 @@ struct route_map_rule_cmd route_match_metric_cmd =  /* `match as-path ASPATH' */  /* Match function for as-path match.  I assume given object is */ -route_map_result_t +static route_map_result_t  route_match_aspath (void *rule, struct prefix *prefix,   		    route_map_object_t type, void *object)  { @@ -575,14 +575,14 @@ route_match_aspath (void *rule, struct prefix *prefix,  }  /* Compile function for as-path match. */ -void * +static void *  route_match_aspath_compile (const char *arg)  {    return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);  }  /* Compile function for as-path match. */ -void +static void  route_match_aspath_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -596,55 +596,6 @@ struct route_map_rule_cmd route_match_aspath_cmd =    route_match_aspath_compile,    route_match_aspath_free  }; - -#if ROUTE_MATCH_ASPATH_OLD -/* `match as-path ASPATH' */ - -/* Match function for as-path match.  I assume given object is */ -int -route_match_aspath (void *rule, struct prefix *prefix, void *object) -{ -  regex_t *regex; -  struct bgp_info *bgp_info; - -  regex = rule; -  bgp_info = object; -   -  /* Perform match. */ -  return bgp_regexec (regex, bgp_info->attr->aspath); -} - -/* Compile function for as-path match. */ -void * -route_match_aspath_compile (const char *arg) -{ -  regex_t *regex; - -  regex = bgp_regcomp (arg); -  if (! regex) -    return NULL; - -  return regex; -} - -/* Compile function for as-path match. */ -void -route_match_aspath_free (void *rule) -{ -  regex_t *regex = rule; - -  bgp_regex_free (regex); -} - -/* Route map commands for aspath matching. */ -struct route_map_rule_cmd route_match_aspath_cmd =  -{ -  "as-path", -  route_match_aspath, -  route_match_aspath_compile, -  route_match_aspath_free -}; -#endif /* ROUTE_MATCH_ASPATH_OLD */  /* `match community COMMUNIY' */  struct rmap_community @@ -654,7 +605,7 @@ struct rmap_community  };  /* Match function for community match. */ -route_map_result_t +static route_map_result_t  route_match_community (void *rule, struct prefix *prefix,   		       route_map_object_t type, void *object)  { @@ -686,7 +637,7 @@ route_match_community (void *rule, struct prefix *prefix,  }  /* Compile function for community match. */ -void * +static void *  route_match_community_compile (const char *arg)  {    struct rmap_community *rcom; @@ -712,7 +663,7 @@ route_match_community_compile (const char *arg)  }  /* Compile function for community match. */ -void +static void  route_match_community_free (void *rule)  {    struct rmap_community *rcom = rule; @@ -731,7 +682,7 @@ struct route_map_rule_cmd route_match_community_cmd =  };  /* Match function for extcommunity match. */ -route_map_result_t +static route_map_result_t  route_match_ecommunity (void *rule, struct prefix *prefix,   			route_map_object_t type, void *object)  { @@ -754,14 +705,14 @@ route_match_ecommunity (void *rule, struct prefix *prefix,  }  /* Compile function for extcommunity match. */ -void * +static void *  route_match_ecommunity_compile (const char *arg)  {    return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);  }  /* Compile function for extcommunity match. */ -void +static void  route_match_ecommunity_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -780,7 +731,7 @@ struct route_map_rule_cmd route_match_ecommunity_cmd =     and `address-family vpnv4'.  */  /* `match origin' */ -route_map_result_t +static route_map_result_t  route_match_origin (void *rule, struct prefix *prefix,   		    route_map_object_t type, void *object)  { @@ -799,7 +750,7 @@ route_match_origin (void *rule, struct prefix *prefix,    return RMAP_NOMATCH;  } -void * +static void *  route_match_origin_compile (const char *arg)  {    u_char *origin; @@ -817,7 +768,7 @@ route_match_origin_compile (const char *arg)  }  /* Free route map's compiled `ip address' value. */ -void +static void  route_match_origin_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -840,7 +791,7 @@ struct rmap_ip_nexthop_set    int peer_address;  }; -route_map_result_t +static route_map_result_t  route_set_ip_nexthop (void *rule, struct prefix *prefix,  		      route_map_object_t type, void *object)  { @@ -887,7 +838,7 @@ route_set_ip_nexthop (void *rule, struct prefix *prefix,  /* Route map `ip nexthop' compile function.  Given string is converted     to struct in_addr structure. */ -void * +static void *  route_set_ip_nexthop_compile (const char *arg)  {    struct rmap_ip_nexthop_set *rins; @@ -919,7 +870,7 @@ route_set_ip_nexthop_compile (const char *arg)  }  /* Free route map's compiled `ip nexthop' value. */ -void +static void  route_set_ip_nexthop_free (void *rule)  {    struct rmap_ip_nexthop_set *rins = rule; @@ -942,7 +893,7 @@ struct route_map_rule_cmd route_set_ip_nexthop_cmd =  /* `set local-preference LOCAL_PREF' */  /* Set local preference. */ -route_map_result_t +static route_map_result_t  route_set_local_pref (void *rule, struct prefix *prefix,  		      route_map_object_t type, void *object)  { @@ -964,7 +915,7 @@ route_set_local_pref (void *rule, struct prefix *prefix,  }  /* set local preference compilation. */ -void * +static void *  route_set_local_pref_compile (const char *arg)  {    unsigned long tmp; @@ -990,7 +941,7 @@ route_set_local_pref_compile (const char *arg)  }  /* Free route map's local preference value. */ -void +static void  route_set_local_pref_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -1008,7 +959,7 @@ struct route_map_rule_cmd route_set_local_pref_cmd =  /* `set weight WEIGHT' */  /* Set weight. */ -route_map_result_t +static route_map_result_t  route_set_weight (void *rule, struct prefix *prefix, route_map_object_t type,  		  void *object)  { @@ -1029,7 +980,7 @@ route_set_weight (void *rule, struct prefix *prefix, route_map_object_t type,  }  /* set local preference compilation. */ -void * +static void *  route_set_weight_compile (const char *arg)  {    unsigned long tmp; @@ -1056,7 +1007,7 @@ route_set_weight_compile (const char *arg)  }  /* Free route map's local preference value. */ -void +static void  route_set_weight_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -1074,7 +1025,7 @@ struct route_map_rule_cmd route_set_weight_cmd =  /* `set metric METRIC' */  /* Set metric to attribute. */ -route_map_result_t +static route_map_result_t  route_set_metric (void *rule, struct prefix *prefix,   		  route_map_object_t type, void *object)  { @@ -1121,18 +1072,20 @@ route_set_metric (void *rule, struct prefix *prefix,  }  /* set metric compilation. */ -void * +static void *  route_set_metric_compile (const char *arg)  {    u_int32_t metric; +  unsigned long larg;    char *endptr = NULL;    if (all_digit (arg))      {        /* set metric value check*/ -      metric = strtoul (arg, &endptr, 10); -      if (*endptr != '\0' || metric == ULONG_MAX) +      larg = strtoul (arg, &endptr, 10); +      if (*endptr != '\0' || larg == ULONG_MAX || larg > UINT32_MAX)          return NULL; +      metric = larg;      }    else      { @@ -1142,16 +1095,17 @@ route_set_metric_compile (const char *arg)  	   || (! all_digit (arg+1)))  	return NULL; -      metric = strtoul (arg+1, &endptr, 10); -      if (*endptr != '\0' || metric == ULONG_MAX) +      larg = strtoul (arg+1, &endptr, 10); +      if (*endptr != '\0' || larg == ULONG_MAX || larg > UINT32_MAX)  	return NULL; +      metric = larg;      }    return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);  }  /* Free route map's compiled `set metric' value. */ -void +static void  route_set_metric_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -1169,7 +1123,7 @@ struct route_map_rule_cmd route_set_metric_cmd =  /* `set as-path prepend ASPATH' */  /* For AS path prepend mechanism. */ -route_map_result_t +static route_map_result_t  route_set_aspath_prepend (void *rule, struct prefix *prefix, route_map_object_t type, void *object)  {    struct aspath *aspath; @@ -1194,7 +1148,7 @@ route_set_aspath_prepend (void *rule, struct prefix *prefix, route_map_object_t  }  /* Compile function for as-path prepend. */ -void * +static void *  route_set_aspath_prepend_compile (const char *arg)  {    struct aspath *aspath; @@ -1206,7 +1160,7 @@ route_set_aspath_prepend_compile (const char *arg)  }  /* Compile function for as-path prepend. */ -void +static void  route_set_aspath_prepend_free (void *rule)  {    struct aspath *aspath = rule; @@ -1231,7 +1185,7 @@ struct rmap_com_set  };  /* For community set mechanism. */ -route_map_result_t +static route_map_result_t  route_set_community (void *rule, struct prefix *prefix,  		     route_map_object_t type, void *object)  { @@ -1279,7 +1233,7 @@ route_set_community (void *rule, struct prefix *prefix,  }  /* Compile function for set community. */ -void * +static void *  route_set_community_compile (const char *arg)  {    struct rmap_com_set *rcs; @@ -1321,7 +1275,7 @@ route_set_community_compile (const char *arg)  }  /* Free function for set community. */ -void +static void  route_set_community_free (void *rule)  {    struct rmap_com_set *rcs = rule; @@ -1343,7 +1297,7 @@ struct route_map_rule_cmd route_set_community_cmd =  /* `set comm-list (<1-99>|<100-500>|WORD) delete' */  /* For community set mechanism. */ -route_map_result_t +static route_map_result_t  route_set_community_delete (void *rule, struct prefix *prefix,  			    route_map_object_t type, void *object)  { @@ -1386,7 +1340,7 @@ route_set_community_delete (void *rule, struct prefix *prefix,  }  /* Compile function for set community. */ -void * +static void *  route_set_community_delete_compile (const char *arg)  {    char *p; @@ -1407,7 +1361,7 @@ route_set_community_delete_compile (const char *arg)  }  /* Free function for set community. */ -void +static void  route_set_community_delete_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -1425,7 +1379,7 @@ struct route_map_rule_cmd route_set_community_delete_cmd =  /* `set extcommunity rt COMMUNITY' */  /* For community set mechanism. */ -route_map_result_t +static route_map_result_t  route_set_ecommunity_rt (void *rule, struct prefix *prefix,   			 route_map_object_t type, void *object)  { @@ -1461,7 +1415,7 @@ route_set_ecommunity_rt (void *rule, struct prefix *prefix,  }  /* Compile function for set community. */ -void * +static void *  route_set_ecommunity_rt_compile (const char *arg)  {    struct ecommunity *ecom; @@ -1473,7 +1427,7 @@ route_set_ecommunity_rt_compile (const char *arg)  }  /* Free function for set community. */ -void +static void  route_set_ecommunity_rt_free (void *rule)  {    struct ecommunity *ecom = rule; @@ -1492,7 +1446,7 @@ struct route_map_rule_cmd route_set_ecommunity_rt_cmd =  /* `set extcommunity soo COMMUNITY' */  /* For community set mechanism. */ -route_map_result_t +static route_map_result_t  route_set_ecommunity_soo (void *rule, struct prefix *prefix,   			 route_map_object_t type, void *object)  { @@ -1514,7 +1468,7 @@ route_set_ecommunity_soo (void *rule, struct prefix *prefix,  }  /* Compile function for set community. */ -void * +static void *  route_set_ecommunity_soo_compile (const char *arg)  {    struct ecommunity *ecom; @@ -1527,7 +1481,7 @@ route_set_ecommunity_soo_compile (const char *arg)  }  /* Free function for set community. */ -void +static void  route_set_ecommunity_soo_free (void *rule)  {    struct ecommunity *ecom = rule; @@ -1546,7 +1500,7 @@ struct route_map_rule_cmd route_set_ecommunity_soo_cmd =  /* `set origin ORIGIN' */  /* For origin set. */ -route_map_result_t +static route_map_result_t  route_set_origin (void *rule, struct prefix *prefix, route_map_object_t type, void *object)  {    u_char *origin; @@ -1564,7 +1518,7 @@ route_set_origin (void *rule, struct prefix *prefix, route_map_object_t type, vo  }  /* Compile function for origin set. */ -void * +static void *  route_set_origin_compile (const char *arg)  {    u_char *origin; @@ -1582,7 +1536,7 @@ route_set_origin_compile (const char *arg)  }  /* Compile function for origin set. */ -void +static void  route_set_origin_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -1600,7 +1554,7 @@ struct route_map_rule_cmd route_set_origin_cmd =  /* `set atomic-aggregate' */  /* For atomic aggregate set. */ -route_map_result_t +static route_map_result_t  route_set_atomic_aggregate (void *rule, struct prefix *prefix,  			    route_map_object_t type, void *object)  { @@ -1616,14 +1570,14 @@ route_set_atomic_aggregate (void *rule, struct prefix *prefix,  }  /* Compile function for atomic aggregate. */ -void * +static void *  route_set_atomic_aggregate_compile (const char *arg)  {    return (void *)1;  }  /* Compile function for atomic aggregate. */ -void +static void  route_set_atomic_aggregate_free (void *rule)  {    return; @@ -1645,7 +1599,7 @@ struct aggregator    struct in_addr address;  }; -route_map_result_t +static route_map_result_t  route_set_aggregator_as (void *rule, struct prefix *prefix,   			 route_map_object_t type, void *object)  { @@ -1665,7 +1619,7 @@ route_set_aggregator_as (void *rule, struct prefix *prefix,    return RMAP_OKAY;  } -void * +static void *  route_set_aggregator_as_compile (const char *arg)  {    struct aggregator *aggregator; @@ -1683,7 +1637,7 @@ route_set_aggregator_as_compile (const char *arg)    return aggregator;  } -void +static void  route_set_aggregator_as_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -1700,7 +1654,7 @@ struct route_map_rule_cmd route_set_aggregator_as_cmd =  #ifdef HAVE_IPV6  /* `match ipv6 address IP_ACCESS_LIST' */ -route_map_result_t +static route_map_result_t  route_match_ipv6_address (void *rule, struct prefix *prefix,   			  route_map_object_t type, void *object)  { @@ -1718,13 +1672,13 @@ route_match_ipv6_address (void *rule, struct prefix *prefix,    return RMAP_NOMATCH;  } -void * +static void *  route_match_ipv6_address_compile (const char *arg)  {    return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);  } -void +static void  route_match_ipv6_address_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -1741,7 +1695,7 @@ struct route_map_rule_cmd route_match_ipv6_address_cmd =  /* `match ipv6 next-hop IP_ADDRESS' */ -route_map_result_t +static route_map_result_t  route_match_ipv6_next_hop (void *rule, struct prefix *prefix,   			   route_map_object_t type, void *object)  { @@ -1766,7 +1720,7 @@ route_match_ipv6_next_hop (void *rule, struct prefix *prefix,    return RMAP_NOMATCH;  } -void * +static void *  route_match_ipv6_next_hop_compile (const char *arg)  {    struct in6_addr *address; @@ -1784,7 +1738,7 @@ route_match_ipv6_next_hop_compile (const char *arg)    return address;  } -void +static void  route_match_ipv6_next_hop_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -1800,7 +1754,7 @@ struct route_map_rule_cmd route_match_ipv6_next_hop_cmd =  /* `match ipv6 address prefix-list PREFIX_LIST' */ -route_map_result_t +static route_map_result_t  route_match_ipv6_address_prefix_list (void *rule, struct prefix *prefix,   			      route_map_object_t type, void *object)  { @@ -1818,13 +1772,13 @@ route_match_ipv6_address_prefix_list (void *rule, struct prefix *prefix,    return RMAP_NOMATCH;  } -void * +static void *  route_match_ipv6_address_prefix_list_compile (const char *arg)  {    return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);  } -void +static void  route_match_ipv6_address_prefix_list_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -1841,7 +1795,7 @@ struct route_map_rule_cmd route_match_ipv6_address_prefix_list_cmd =  /* `set ipv6 nexthop global IP_ADDRESS' */  /* Set nexthop to object.  ojbect must be pointer to struct attr. */ -route_map_result_t +static route_map_result_t  route_set_ipv6_nexthop_global (void *rule, struct prefix *prefix,   			       route_map_object_t type, void *object)  { @@ -1867,7 +1821,7 @@ route_set_ipv6_nexthop_global (void *rule, struct prefix *prefix,  /* Route map `ip next-hop' compile function.  Given string is converted     to struct in_addr structure. */ -void * +static void *  route_set_ipv6_nexthop_global_compile (const char *arg)  {    int ret; @@ -1887,7 +1841,7 @@ route_set_ipv6_nexthop_global_compile (const char *arg)  }  /* Free route map's compiled `ip next-hop' value. */ -void +static void  route_set_ipv6_nexthop_global_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -1905,7 +1859,7 @@ struct route_map_rule_cmd route_set_ipv6_nexthop_global_cmd =  /* `set ipv6 nexthop local IP_ADDRESS' */  /* Set nexthop to object.  ojbect must be pointer to struct attr. */ -route_map_result_t +static route_map_result_t  route_set_ipv6_nexthop_local (void *rule, struct prefix *prefix,   			      route_map_object_t type, void *object)  { @@ -1931,7 +1885,7 @@ route_set_ipv6_nexthop_local (void *rule, struct prefix *prefix,  /* Route map `ip nexthop' compile function.  Given string is converted     to struct in_addr structure. */ -void * +static void *  route_set_ipv6_nexthop_local_compile (const char *arg)  {    int ret; @@ -1951,7 +1905,7 @@ route_set_ipv6_nexthop_local_compile (const char *arg)  }  /* Free route map's compiled `ip nexthop' value. */ -void +static void  route_set_ipv6_nexthop_local_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -1969,7 +1923,7 @@ struct route_map_rule_cmd route_set_ipv6_nexthop_local_cmd =  /* `set vpnv4 nexthop A.B.C.D' */ -route_map_result_t +static route_map_result_t  route_set_vpnv4_nexthop (void *rule, struct prefix *prefix,   			 route_map_object_t type, void *object)  { @@ -1989,7 +1943,7 @@ route_set_vpnv4_nexthop (void *rule, struct prefix *prefix,    return RMAP_OKAY;  } -void * +static void *  route_set_vpnv4_nexthop_compile (const char *arg)  {    int ret; @@ -2008,7 +1962,7 @@ route_set_vpnv4_nexthop_compile (const char *arg)    return address;  } -void +static void  route_set_vpnv4_nexthop_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -2026,7 +1980,7 @@ struct route_map_rule_cmd route_set_vpnv4_nexthop_cmd =  /* `set originator-id' */  /* For origin set. */ -route_map_result_t +static route_map_result_t  route_set_originator_id (void *rule, struct prefix *prefix, route_map_object_t type, void *object)  {    struct in_addr *address; @@ -2045,7 +1999,7 @@ route_set_originator_id (void *rule, struct prefix *prefix, route_map_object_t t  }  /* Compile function for originator-id set. */ -void * +static void *  route_set_originator_id_compile (const char *arg)  {    int ret; @@ -2065,7 +2019,7 @@ route_set_originator_id_compile (const char *arg)  }  /* Compile function for originator_id set. */ -void +static void  route_set_originator_id_free (void *rule)  {    XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); @@ -2081,7 +2035,7 @@ struct route_map_rule_cmd route_set_originator_id_cmd =  };  /* Add bgp route map rule. */ -int +static int  bgp_route_match_add (struct vty *vty, struct route_map_index *index,  		     const char *command, const char *arg)  { @@ -2106,7 +2060,7 @@ bgp_route_match_add (struct vty *vty, struct route_map_index *index,  }  /* Delete bgp route map rule. */ -int +static int  bgp_route_match_delete (struct vty *vty, struct route_map_index *index,  			const char *command, const char *arg)  { @@ -2131,7 +2085,7 @@ bgp_route_match_delete (struct vty *vty, struct route_map_index *index,  }  /* Add bgp route map rule. */ -int +static int  bgp_route_set_add (struct vty *vty, struct route_map_index *index,  		   const char *command, const char *arg)  { @@ -2156,7 +2110,7 @@ bgp_route_set_add (struct vty *vty, struct route_map_index *index,  }  /* Delete bgp route map rule. */ -int +static int  bgp_route_set_delete (struct vty *vty, struct route_map_index *index,  		      const char *command, const char *arg)  { @@ -2181,7 +2135,7 @@ bgp_route_set_delete (struct vty *vty, struct route_map_index *index,  }  /* Hook function for updating route_map assignment. */ -void +static void  bgp_route_map_update (const char *unused)  {    int i; @@ -2803,7 +2757,7 @@ DEFUN (set_ip_nexthop_peer,    return bgp_route_set_add (vty, vty->index, "ip next-hop", "peer-address");  } -DEFUN (no_set_ip_nexthop_peer, +DEFUN_DEPRECATED (no_set_ip_nexthop_peer,         no_set_ip_nexthop_peer_cmd,         "no set ip next-hop peer-address",         NO_STR @@ -3579,7 +3533,7 @@ ALIAS (no_set_originator_id,  /* Initialization of route map. */  void -bgp_route_map_init () +bgp_route_map_init (void)  {    route_map_init ();    route_map_init_vty (); diff --git a/bgpd/bgp_snmp.h b/bgpd/bgp_snmp.h index 60daf0ff..7a0d9dd0 100644 --- a/bgpd/bgp_snmp.h +++ b/bgpd/bgp_snmp.h @@ -21,8 +21,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  #ifndef _QUAGGA_BGP_SNMP_H  #define _QUAGGA_BGP_SNMP_H -void bgp_snmp_init (); -void bgpTrapEstablished (struct peer *); -void bgpTrapBackwardTransition (struct peer *); +extern void bgp_snmp_init (void); +extern void bgpTrapEstablished (struct peer *); +extern void bgpTrapBackwardTransition (struct peer *);  #endif /* _QUAGGA_BGP_SNMP_H */ diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c index c468173d..a9199d64 100644 --- a/bgpd/bgp_table.c +++ b/bgpd/bgp_table.c @@ -50,7 +50,7 @@ bgp_table_finish (struct bgp_table *rt)    bgp_table_free (rt);  } -struct bgp_node * +static struct bgp_node *  bgp_node_create ()  {    struct bgp_node *rn; @@ -61,7 +61,7 @@ bgp_node_create ()  }  /* Allocate new route node with prefix set. */ -struct bgp_node * +static struct bgp_node *  bgp_node_set (struct bgp_table *table, struct prefix *prefix)  {    struct bgp_node *node; @@ -75,7 +75,7 @@ bgp_node_set (struct bgp_table *table, struct prefix *prefix)  }  /* Free route node. */ -void +static void  bgp_node_free (struct bgp_node *node)  {    XFREE (MTYPE_BGP_NODE, node); diff --git a/bgpd/bgp_table.h b/bgpd/bgp_table.h index 9033f98e..d7c8272b 100644 --- a/bgpd/bgp_table.h +++ b/bgpd/bgp_table.h @@ -63,21 +63,21 @@ struct bgp_node  #define BGP_NODE_PROCESS_SCHEDULED	(1 << 0)  }; -struct bgp_table *bgp_table_init (void); -void bgp_table_finish (struct bgp_table *); -void bgp_unlock_node (struct bgp_node *node); -void bgp_node_delete (struct bgp_node *node); -struct bgp_node *bgp_table_top (struct bgp_table *); -struct bgp_node *bgp_route_next (struct bgp_node *); -struct bgp_node *bgp_route_next_until (struct bgp_node *, struct bgp_node *); -struct bgp_node *bgp_node_get (struct bgp_table *, struct prefix *); -struct bgp_node *bgp_node_lookup (struct bgp_table *, struct prefix *); -struct bgp_node *bgp_lock_node (struct bgp_node *node); -struct bgp_node *bgp_node_match (struct bgp_table *, struct prefix *); -struct bgp_node *bgp_node_match_ipv4 (struct bgp_table *, +extern struct bgp_table *bgp_table_init (void); +extern void bgp_table_finish (struct bgp_table *); +extern void bgp_unlock_node (struct bgp_node *node); +extern void bgp_node_delete (struct bgp_node *node); +extern struct bgp_node *bgp_table_top (struct bgp_table *); +extern struct bgp_node *bgp_route_next (struct bgp_node *); +extern struct bgp_node *bgp_route_next_until (struct bgp_node *, struct bgp_node *); +extern struct bgp_node *bgp_node_get (struct bgp_table *, struct prefix *); +extern struct bgp_node *bgp_node_lookup (struct bgp_table *, struct prefix *); +extern struct bgp_node *bgp_lock_node (struct bgp_node *node); +extern struct bgp_node *bgp_node_match (struct bgp_table *, struct prefix *); +extern struct bgp_node *bgp_node_match_ipv4 (struct bgp_table *,  					  struct in_addr *);  #ifdef HAVE_IPV6 -struct bgp_node *bgp_node_match_ipv6 (struct bgp_table *, +extern struct bgp_node *bgp_node_match_ipv6 (struct bgp_table *,  					  struct in6_addr *);  #endif /* HAVE_IPV6 */ diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index afa5fed1..cbc81ffe 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -41,6 +41,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  #include "bgpd/bgp_route.h"  #include "bgpd/bgp_zebra.h"  #include "bgpd/bgp_table.h" +#include "bgpd/bgp_vty.h"  extern struct in_addr router_id_zebra; @@ -65,7 +66,7 @@ bgp_node_safi (struct vty *vty)    return SAFI_UNICAST;  } -int +static int  peer_address_self_check (union sockunion *su)  {    struct interface *ifp = NULL; @@ -84,7 +85,7 @@ peer_address_self_check (union sockunion *su)  }  /* Utility function for looking up peer from VTY.  */ -struct peer * +static struct peer *  peer_lookup_vty (struct vty *vty, const char *ip_str)  {    int ret; @@ -111,7 +112,7 @@ peer_lookup_vty (struct vty *vty, const char *ip_str)  }  /* Utility function for looking up peer or peer group.  */ -struct peer * +static struct peer *  peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)  {    int ret; @@ -142,7 +143,7 @@ peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)    return NULL;  } -int +static int  bgp_vty_return (struct vty *vty, int ret)  {    const char *str = NULL; @@ -1598,7 +1599,7 @@ DEFUN (no_neighbor_set_peer_group,    return bgp_vty_return (vty, ret);  } -int +static int  peer_flag_modify_vty (struct vty *vty, const char *ip_str,                         u_int16_t flag, int set)  { @@ -1617,13 +1618,13 @@ peer_flag_modify_vty (struct vty *vty, const char *ip_str,    return bgp_vty_return (vty, ret);  } -int +static int  peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)  {    return peer_flag_modify_vty (vty, ip_str, flag, 1);  } -int +static int  peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)  {    return peer_flag_modify_vty (vty, ip_str, flag, 0); @@ -1743,7 +1744,7 @@ DEFUN (no_neighbor_dont_capability_negotiate,    return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);  } -int +static int  peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,  			 safi_t safi, u_int32_t flag, int set)  { @@ -1762,14 +1763,14 @@ peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,    return bgp_vty_return (vty, ret);  } -int +static int  peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,  		      safi_t safi, u_int32_t flag)  {    return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);  } -int +static int  peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,  			safi_t safi, u_int32_t flag)  { @@ -2020,7 +2021,7 @@ DEFUN (no_neighbor_route_reflector_client,  				 PEER_FLAG_REFLECTOR_CLIENT);  } -int +static int  peer_rsclient_set_vty (struct vty *vty, const char *peer_str,                          int afi, int safi)  { @@ -2105,7 +2106,7 @@ peer_rsclient_set_vty (struct vty *vty, const char *peer_str,    return CMD_SUCCESS;  } -int +static int  peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,                            int afi, int safi)  { @@ -2565,7 +2566,7 @@ DEFUN_DEPRECATED (neighbor_transparent_nexthop,  }  /* EBGP multihop configuration. */ -int +static int  peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,                               const char *ttl_str)  { @@ -2586,7 +2587,7 @@ peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,    return CMD_SUCCESS;  } -int +static int  peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)   {    struct peer *peer; @@ -2737,7 +2738,7 @@ ALIAS (no_neighbor_description,         "Up to 80 characters describing this neighbor\n")  /* Neighbor update-source. */ -int +static int  peer_update_source_vty (struct vty *vty, const char *peer_str,                           const char *source_str)  { @@ -2788,7 +2789,7 @@ DEFUN (no_neighbor_update_source,    return peer_update_source_vty (vty, argv[0], NULL);  } -int +static int  peer_default_originate_set_vty (struct vty *vty, const char *peer_str,                                   afi_t afi, safi_t safi,                                   const char *rmap, int set) @@ -2856,7 +2857,7 @@ ALIAS (no_neighbor_default_originate,         "route-map name\n")  /* Set neighbor's BGP port.  */ -int +static int  peer_port_vty (struct vty *vty, const char *ip_str, int afi,                  const char *port_str)  { @@ -2916,7 +2917,7 @@ ALIAS (no_neighbor_port,         "TCP port number\n")  /* neighbor weight. */ -int +static int  peer_weight_set_vty (struct vty *vty, const char *ip_str,                        const char *weight_str)  { @@ -2935,7 +2936,7 @@ peer_weight_set_vty (struct vty *vty, const char *ip_str,    return CMD_SUCCESS;  } -int +static int  peer_weight_unset_vty (struct vty *vty, const char *ip_str)  {    struct peer *peer; @@ -3023,7 +3024,7 @@ DEFUN (no_neighbor_strict_capability,    return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);  } -int +static int  peer_timers_set_vty (struct vty *vty, const char *ip_str,                        const char *keep_str, const char *hold_str)  { @@ -3044,7 +3045,7 @@ peer_timers_set_vty (struct vty *vty, const char *ip_str,    return bgp_vty_return (vty, ret);  } -int +static int  peer_timers_unset_vty (struct vty *vty, const char *ip_str)  {    int ret; @@ -3082,7 +3083,7 @@ DEFUN (no_neighbor_timers,    return peer_timers_unset_vty (vty, argv[0]);  } -int +static int  peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,                                const char *time_str)  { @@ -3101,7 +3102,7 @@ peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,    return CMD_SUCCESS;  } -int +static int  peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)  {    int ret; @@ -3150,7 +3151,7 @@ ALIAS (no_neighbor_timers_connect,         "BGP connect timer\n"         "Connect timer\n") -int +static int  peer_advertise_interval_vty (struct vty *vty, const char *ip_str,                                const char *time_str, int set)    { @@ -3205,7 +3206,7 @@ ALIAS (no_neighbor_advertise_interval,         "time in seconds\n")  /* neighbor interface */ -int +static int  peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)  {    int ret; @@ -3247,7 +3248,7 @@ DEFUN (no_neighbor_interface,  }  /* Set distribute list to the peer. */ -int +static int  peer_distribute_set_vty (struct vty *vty, const char *ip_str,                            afi_t afi, safi_t safi,  			 const char *name_str, const char *direct_str) @@ -3271,7 +3272,7 @@ peer_distribute_set_vty (struct vty *vty, const char *ip_str,    return bgp_vty_return (vty, ret);  } -int +static int  peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,  			   safi_t safi, const char *direct_str)  { @@ -3328,7 +3329,7 @@ DEFUN (no_neighbor_distribute_list,  }  /* Set prefix list to the peer. */ -int +static int  peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,  			  safi_t safi, const char *name_str,                             const char *direct_str) @@ -3352,7 +3353,7 @@ peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,    return bgp_vty_return (vty, ret);  } -int +static int  peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,  			    safi_t safi, const char *direct_str)  { @@ -3404,7 +3405,7 @@ DEFUN (no_neighbor_prefix_list,  				     bgp_node_safi (vty), argv[2]);  } -int +static int  peer_aslist_set_vty (struct vty *vty, const char *ip_str,                        afi_t afi, safi_t safi,  		     const char *name_str, const char *direct_str) @@ -3428,7 +3429,7 @@ peer_aslist_set_vty (struct vty *vty, const char *ip_str,    return bgp_vty_return (vty, ret);  } -int +static int  peer_aslist_unset_vty (struct vty *vty, const char *ip_str,                          afi_t afi, safi_t safi,  		       const char *direct_str) @@ -3482,7 +3483,7 @@ DEFUN (no_neighbor_filter_list,  }  /* Set route-map to the peer. */ -int +static int  peer_route_map_set_vty (struct vty *vty, const char *ip_str,                           afi_t afi, safi_t safi,  			const char *name_str, const char *direct_str) @@ -3510,7 +3511,7 @@ peer_route_map_set_vty (struct vty *vty, const char *ip_str,    return bgp_vty_return (vty, ret);  } -int +static int  peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,  			  safi_t safi, const char *direct_str)  { @@ -3571,7 +3572,7 @@ DEFUN (no_neighbor_route_map,  }  /* Set unsuppress-map to the peer. */ -int +static int  peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,  			     safi_t safi, const char *name_str)  { @@ -3588,7 +3589,7 @@ peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,  }  /* Unset route-map from the peer. */ -int +static int  peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,  			       safi_t safi)  { @@ -3629,7 +3630,7 @@ DEFUN (no_neighbor_unsuppress_map,  					bgp_node_safi (vty));  } -int +static int  peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,  			     safi_t safi, const char *num_str,    			     const char *threshold_str, int warning, @@ -3661,7 +3662,7 @@ peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,    return bgp_vty_return (vty, ret);  } -int +static int  peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,  			       safi_t safi)  { @@ -3978,7 +3979,7 @@ enum clear_sort    clear_as  }; -void +static void  bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,  		     safi_t safi, int error)  { @@ -4000,7 +4001,7 @@ bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,  }  /* `clear ip bgp' functions. */ -int +static int  bgp_clear (struct vty *vty, struct bgp *bgp,  afi_t afi, safi_t safi,             enum clear_sort sort,enum bgp_clear_type stype, const char *arg)  { @@ -4143,7 +4144,7 @@ bgp_clear (struct vty *vty, struct bgp *bgp,  afi_t afi, safi_t safi,    return 0;  } -int +static int  bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,                 enum clear_sort sort, enum bgp_clear_type stype,                  const char *arg) @@ -6460,7 +6461,7 @@ ALIAS (clear_ip_bgp_peer_rsclient,  /* Show BGP peer's summary information. */ -int +static int  bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)  {    struct peer *peer; @@ -6543,7 +6544,7 @@ bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)    return CMD_SUCCESS;  } -int  +static int   bgp_show_summary_vty (struct vty *vty, const char *name,                         afi_t afi, safi_t safi)  { @@ -6759,7 +6760,7 @@ enum show_type    show_peer  }; -void +static void  bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,  			   afi_t afi, safi_t safi,  			   u_int16_t adv_smcap, u_int16_t adv_rmcap, @@ -6794,7 +6795,7 @@ bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,      }  } -void +static void  bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)  {    struct bgp_filter *filter; @@ -7001,7 +7002,7 @@ bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)    vty_out (vty, "%s", VTY_NEWLINE);  } -void +static void  bgp_show_peer (struct vty *vty, struct peer *p)  {    struct bgp *bgp; @@ -7354,7 +7355,7 @@ bgp_show_peer (struct vty *vty, struct peer *p)    vty_out (vty, "%s", VTY_NEWLINE);  } -int +static int  bgp_show_neighbor (struct vty *vty, struct bgp *bgp,  		   enum show_type type, union sockunion *su)  { @@ -7385,7 +7386,7 @@ bgp_show_neighbor (struct vty *vty, struct bgp *bgp,    return CMD_SUCCESS;  } -int  +static int   bgp_show_neighbor_vty (struct vty *vty, const char *name,                          enum show_type type, const char *ip_str)  { @@ -7657,7 +7658,7 @@ DEFUN (show_ip_bgp_ipv4_paths,  #include "hash.h" -void +static void  community_show_all_iterator (struct hash_backet *backet, struct vty *vty)  {    struct community *com; @@ -7698,7 +7699,7 @@ DEFUN (show_ip_bgp_attr_info,    return CMD_SUCCESS;  } -int +static int  bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,          afi_t afi, safi_t safi)  { @@ -7766,7 +7767,7 @@ bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,    return 1;  } -int +static int  bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,                              afi_t afi, safi_t safi)  { @@ -7809,7 +7810,7 @@ bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,    return CMD_SUCCESS;  } -int +static int  bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,                                  afi_t afi, safi_t safi)  { @@ -8566,10 +8567,9 @@ struct cmd_node bgp_vpnv4_node =  };  void -bgp_vty_init () +bgp_vty_init (void)  { -  int bgp_config_write (struct vty *); -  void community_list_vty (); +  static void community_list_vty (void);    /* Install bgp top node. */    install_node (&bgp_node, bgp_config_write); @@ -9549,7 +9549,7 @@ bgp_vty_init ()  /* VTY functions.  */  /* Direction value to string conversion.  */ -const char * +static const char *  community_direct_str (int direct)  {    switch (direct) @@ -9567,7 +9567,7 @@ community_direct_str (int direct)  }  /* Display error string.  */ -void +static void  community_list_perror (struct vty *vty, int ret)  {    switch (ret) @@ -9588,7 +9588,7 @@ community_list_perror (struct vty *vty, int ret)  }  /* VTY interface for community_set() function.  */ -int +static int  community_list_set_vty (struct vty *vty, int argc, const char **argv,                           int style, int reject_all_digit_name)  { @@ -9641,7 +9641,7 @@ community_list_set_vty (struct vty *vty, int argc, const char **argv,  }  /* Communiyt-list entry delete.  */ -int +static int  community_list_unset_vty (struct vty *vty, int argc, const char **argv,  			  int style)  { @@ -9865,7 +9865,7 @@ DEFUN (no_ip_community_list_name_expanded,    return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);  } -void +static void  community_list_show (struct vty *vty, struct community_list *list)  {    struct community_entry *entry; @@ -9943,7 +9943,7 @@ DEFUN (show_ip_community_list_arg,    return CMD_SUCCESS;  } -int +static int  extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,                              int style, int reject_all_digit_name)  { @@ -9991,7 +9991,7 @@ extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,    return CMD_SUCCESS;  } -int +static int  extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,  			     int style)  { @@ -10215,7 +10215,7 @@ DEFUN (no_ip_extcommunity_list_name_expanded,    return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);  } -void +static void  extcommunity_list_show (struct vty *vty, struct community_list *list)  {    struct community_entry *entry; @@ -10312,7 +10312,7 @@ community_list_config_str (struct community_entry *entry)  }  /* Display community-list and extcommunity-list configuration.  */ -int +static int  community_list_config_write (struct vty *vty)  {    struct community_list *list; @@ -10375,8 +10375,8 @@ struct cmd_node community_list_node =    1				/* Export to vtysh.  */  }; -void -community_list_vty () +static void +community_list_vty (void)  {    install_node (&community_list_node, community_list_config_write); diff --git a/bgpd/bgp_vty.h b/bgpd/bgp_vty.h index 52567289..d3b4e2b4 100644 --- a/bgpd/bgp_vty.h +++ b/bgpd/bgp_vty.h @@ -21,7 +21,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  #ifndef _QUAGGA_BGP_VTY_H  #define _QUAGGA_BGP_VTY_H -void bgp_vty_init (); -char *afi_safi_print (afi_t, safi_t); +extern void bgp_vty_init (void); +extern const char *afi_safi_print (afi_t, safi_t);  #endif /* _QUAGGA_BGP_VTY_H */ diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index b4496e21..0cb9e0e2 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -42,7 +42,7 @@ static struct zclient *zclient = NULL;  struct in_addr router_id_zebra;  /* Router-id update message from zebra. */ -int +static int  bgp_router_id_update (int command, struct zclient *zclient, zebra_size_t length)  {    struct prefix router_id; @@ -62,7 +62,7 @@ bgp_router_id_update (int command, struct zclient *zclient, zebra_size_t length)  }  /* Inteface addition message from zebra. */ -int +static int  bgp_interface_add (int command, struct zclient *zclient, zebra_size_t length)  {    struct interface *ifp; @@ -72,7 +72,7 @@ bgp_interface_add (int command, struct zclient *zclient, zebra_size_t length)    return 0;  } -int +static int  bgp_interface_delete (int command, struct zclient *zclient,  		      zebra_size_t length)  { @@ -86,7 +86,7 @@ bgp_interface_delete (int command, struct zclient *zclient,    return 0;  } -int +static int  bgp_interface_up (int command, struct zclient *zclient, zebra_size_t length)  {    struct stream *s; @@ -106,7 +106,7 @@ bgp_interface_up (int command, struct zclient *zclient, zebra_size_t length)    return 0;  } -int +static int  bgp_interface_down (int command, struct zclient *zclient, zebra_size_t length)  {    struct stream *s; @@ -153,7 +153,7 @@ bgp_interface_down (int command, struct zclient *zclient, zebra_size_t length)    return 0;  } -int +static int  bgp_interface_address_add (int command, struct zclient *zclient,  			   zebra_size_t length)  { @@ -170,7 +170,7 @@ bgp_interface_address_add (int command, struct zclient *zclient,    return 0;  } -int +static int  bgp_interface_address_delete (int command, struct zclient *zclient,  			      zebra_size_t length)  { @@ -190,7 +190,7 @@ bgp_interface_address_delete (int command, struct zclient *zclient,  }  /* Zebra route add and delete treatment. */ -int +static int  zebra_read_ipv4 (int command, struct zclient *zclient, zebra_size_t length)  {    struct stream *s; @@ -242,7 +242,7 @@ zebra_read_ipv4 (int command, struct zclient *zclient, zebra_size_t length)  #ifdef HAVE_IPV6  /* Zebra route add and delete treatment. */ -int +static int  zebra_read_ipv6 (int command, struct zclient *zclient, zebra_size_t length)  {    struct stream *s; @@ -402,7 +402,7 @@ if_lookup_by_ipv6_exact (struct in6_addr *addr)    return NULL;  } -int +static int  if_get_ipv6_global (struct interface *ifp, struct in6_addr *addr)  {    struct listnode *cnode; @@ -423,7 +423,7 @@ if_get_ipv6_global (struct interface *ifp, struct in6_addr *addr)    return 0;  } -int +static int  if_get_ipv6_local (struct interface *ifp, struct in6_addr *addr)  {    struct listnode *cnode; @@ -558,7 +558,7 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote,  }  #ifdef HAVE_IPV6 -unsigned int +static unsigned int  bgp_ifindex_by_nexthop (struct in6_addr *addr)  {    struct listnode *ifnode; @@ -914,13 +914,13 @@ bgp_redistribute_metric_unset (struct bgp *bgp, afi_t afi, int type)  }  void -bgp_zclient_reset () +bgp_zclient_reset (void)  {    zclient_reset (zclient);  }  void -bgp_zebra_init (int enable) +bgp_zebra_init (void)  {    /* Set default values. */    zclient = zclient_new (); diff --git a/bgpd/bgp_zebra.h b/bgpd/bgp_zebra.h index 84577e13..bd953864 100644 --- a/bgpd/bgp_zebra.h +++ b/bgpd/bgp_zebra.h @@ -21,24 +21,25 @@ Boston, MA 02111-1307, USA.  */  #ifndef _QUAGGA_BGP_ZEBRA_H  #define _QUAGGA_BGP_ZEBRA_H -int bgp_if_update_all (); -int bgp_config_write_redistribute (struct vty *, struct bgp *, afi_t, safi_t, +extern void bgp_zebra_init (void); +extern int bgp_if_update_all (void); +extern int bgp_config_write_redistribute (struct vty *, struct bgp *, afi_t, safi_t,  				   int *); -void bgp_zebra_announce (struct prefix *, struct bgp_info *, struct bgp *); -void bgp_zebra_withdraw (struct prefix *, struct bgp_info *); - -int bgp_redistribute_set (struct bgp *, afi_t, int); -int bgp_redistribute_rmap_set (struct bgp *, afi_t, int, const char *); -int bgp_redistribute_metric_set (struct bgp *, afi_t, int, u_int32_t); -int bgp_redistribute_unset (struct bgp *, afi_t, int); -int bgp_redistribute_routemap_unset (struct bgp *, afi_t, int); -int bgp_redistribute_metric_unset (struct bgp *, afi_t, int); - -struct interface *if_lookup_by_ipv4 (struct in_addr *); -struct interface *if_lookup_by_ipv4_exact (struct in_addr *); +extern void bgp_zebra_announce (struct prefix *, struct bgp_info *, struct bgp *); +extern void bgp_zebra_withdraw (struct prefix *, struct bgp_info *); + +extern int bgp_redistribute_set (struct bgp *, afi_t, int); +extern int bgp_redistribute_rmap_set (struct bgp *, afi_t, int, const char *); +extern int bgp_redistribute_metric_set (struct bgp *, afi_t, int, u_int32_t); +extern int bgp_redistribute_unset (struct bgp *, afi_t, int); +extern int bgp_redistribute_routemap_unset (struct bgp *, afi_t, int); +extern int bgp_redistribute_metric_unset (struct bgp *, afi_t, int); + +extern struct interface *if_lookup_by_ipv4 (struct in_addr *); +extern struct interface *if_lookup_by_ipv4_exact (struct in_addr *);  #ifdef HAVE_IPV6 -struct interface *if_lookup_by_ipv6 (struct in6_addr *); -struct interface *if_lookup_by_ipv6_exact (struct in6_addr *); +extern struct interface *if_lookup_by_ipv6 (struct in6_addr *); +extern struct interface *if_lookup_by_ipv6_exact (struct in6_addr *);  #endif /* HAVE_IPV6 */  #endif /* _QUAGGA_BGP_ZEBRA_H */ diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 9473d6f8..ea365dec 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -605,7 +605,7 @@ peer_af_flag_reset (struct peer *peer, afi_t afi, safi_t safi)  }  /* peer global config reset */ -void +static void  peer_global_config_reset (struct peer *peer)  {    peer->weight = 0; @@ -801,7 +801,7 @@ peer_new ()  }  /* Create new BGP peer.  */ -struct peer * +static struct peer *  peer_create (union sockunion *su, struct bgp *bgp, as_t local_as,  	     as_t remote_as, afi_t afi, safi_t safi)  { @@ -866,7 +866,7 @@ peer_create_accept (struct bgp *bgp)  }  /* Change peer's AS number.  */ -void +static void  peer_as_change (struct peer *peer, as_t as)  {    int type; @@ -1260,14 +1260,14 @@ peer_delete (struct peer *peer)    return 0;  } -int +static int  peer_group_cmp (struct peer_group *g1, struct peer_group *g2)  {    return strcmp (g1->name, g2->name);  }  /* If peer is configured at least one address family return 1. */ -int +static int  peer_group_active (struct peer *peer)  {    if (peer->af_group[AFI_IP][SAFI_UNICAST] @@ -1287,7 +1287,7 @@ peer_group_new ()  					sizeof (struct peer_group));  } -void +static void  peer_group_free (struct peer_group *group)  {    XFREE (MTYPE_PEER_GROUP, group); @@ -1340,7 +1340,7 @@ peer_group_get (struct bgp *bgp, const char *name)    return 0;  } -void  +static void   peer_group2peer_config_copy (struct peer_group *group, struct peer *peer,  			     afi_t afi, safi_t safi)  { @@ -1843,7 +1843,7 @@ peer_group_unbind (struct bgp *bgp, struct peer *peer,  }  /* BGP instance creation by `router bgp' commands. */ -struct bgp * +static struct bgp *  bgp_create (as_t *as, const char *name)  {    struct bgp *bgp; @@ -1889,7 +1889,7 @@ bgp_create (as_t *as, const char *name)  /* Return first entry of BGP. */  struct bgp * -bgp_get_default () +bgp_get_default (void)  {    if (bm->bgp->head)      return (listgetdata (listhead (bm->bgp))); @@ -2128,7 +2128,7 @@ enum peer_change_type    peer_change_reset_out,  }; -void +static void  peer_change_action (struct peer *peer, afi_t afi, safi_t safi,  		    enum peer_change_type type)  { @@ -2198,7 +2198,7 @@ struct peer_flag_action peer_af_flag_action_list[] =    };  /* Proper action set. */ -int +static int  peer_flag_action_set (struct peer_flag_action *action_list, int size,  		      struct peer_flag_action *action, u_int32_t flag)  { @@ -2247,7 +2247,7 @@ peer_flag_action_set (struct peer_flag_action *action_list, int size,    return found;  } -void +static void  peer_flag_modify_action (struct peer *peer, u_int32_t flag)  {    if (flag == PEER_FLAG_SHUTDOWN) @@ -2298,7 +2298,7 @@ peer_flag_modify_action (struct peer *peer, u_int32_t flag)  }  /* Change specified peer flag. */ -int +static int  peer_flag_modify (struct peer *peer, u_int32_t flag, int set)  {    int found; @@ -2392,7 +2392,7 @@ peer_flag_unset (struct peer *peer, u_int32_t flag)    return peer_flag_modify (peer, flag, 0);  } -int +static int  peer_is_group_member (struct peer *peer, afi_t afi, safi_t safi)  {    if (peer->af_group[afi][safi]) @@ -2400,7 +2400,7 @@ peer_is_group_member (struct peer *peer, afi_t afi, safi_t safi)    return 0;  } -int +static int  peer_af_flag_modify (struct peer *peer, afi_t afi, safi_t safi, u_int32_t flag,  		     int set)  { @@ -3454,7 +3454,7 @@ peer_distribute_unset (struct peer *peer, afi_t afi, safi_t safi, int direct)  }  /* Update distribute list. */ -void +static void  peer_distribute_update (struct access_list *access)  {    afi_t afi; @@ -3613,7 +3613,7 @@ peer_prefix_list_unset (struct peer *peer, afi_t afi, safi_t safi, int direct)  }  /* Update prefix-list list. */ -void +static void  peer_prefix_list_update (struct prefix_list *plist)  {    struct listnode *mnode, *mnnode; @@ -3767,7 +3767,7 @@ peer_aslist_unset (struct peer *peer,afi_t afi, safi_t safi, int direct)    return 0;  } -void +static void  peer_aslist_update ()  {    afi_t afi; @@ -4255,7 +4255,7 @@ peer_uptime (time_t uptime2, char *buf, size_t len)    return buf;  } -void +static void  bgp_config_write_filter (struct vty *vty, struct peer *peer,  			 afi_t afi, safi_t safi)  { @@ -4326,7 +4326,7 @@ bgp_config_write_filter (struct vty *vty, struct peer *peer,  }  /* BGP peer configuration display function. */ -void +static void  bgp_config_write_peer (struct vty *vty, struct bgp *bgp,  		       struct peer *peer, afi_t afi, safi_t safi)  { @@ -4675,7 +4675,7 @@ bgp_config_write_family_header (struct vty *vty, afi_t afi, safi_t safi,  }  /* Address family based peer configuration display.  */ -int +static int  bgp_config_write_family (struct vty *vty, struct bgp *bgp, afi_t afi,  			 safi_t safi)  { @@ -4902,7 +4902,7 @@ bgp_config_write (struct vty *vty)  }  void -bgp_master_init () +bgp_master_init (void)  {    memset (&bgp_master, 0, sizeof (struct bgp_master)); @@ -4915,12 +4915,8 @@ bgp_master_init ()  void -bgp_init () +bgp_init (void)  { -  void bgp_zebra_init (); -  void bgp_route_map_init (); -  void bgp_filter_init (); -    /* BGP VTY commands installation.  */    bgp_vty_init (); diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index aacbd3a4..e2e2b47f 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -784,143 +784,145 @@ extern struct bgp_master *bm;  extern struct thread_master *master;  /* Prototypes. */ -void bgp_terminate (void); -void bgp_reset (void); -void bgp_zclient_reset (); -int bgp_nexthop_set (union sockunion *, union sockunion *,  +extern void bgp_terminate (void); +extern void bgp_reset (void); +extern void bgp_zclient_reset (void); +extern int bgp_nexthop_set (union sockunion *, union sockunion *,   		     struct bgp_nexthop *, struct peer *); -struct bgp *bgp_get_default (); -struct bgp *bgp_lookup (as_t, const char *); -struct bgp *bgp_lookup_by_name (const char *); -struct peer *peer_lookup (struct bgp *, union sockunion *); -struct peer_group *peer_group_lookup (struct bgp *, const char *); -struct peer_group *peer_group_get (struct bgp *, const char *); -struct peer *peer_lookup_with_open (union sockunion *, as_t, struct in_addr *, +extern struct bgp *bgp_get_default (void); +extern struct bgp *bgp_lookup (as_t, const char *); +extern struct bgp *bgp_lookup_by_name (const char *); +extern struct peer *peer_lookup (struct bgp *, union sockunion *); +extern struct peer_group *peer_group_lookup (struct bgp *, const char *); +extern struct peer_group *peer_group_get (struct bgp *, const char *); +extern struct peer *peer_lookup_with_open (union sockunion *, as_t, struct in_addr *,  				    int *);  extern struct peer *peer_lock (struct peer *);  extern struct peer *peer_unlock (struct peer *); -int peer_sort (struct peer *peer); -int peer_active (struct peer *); -int peer_active_nego (struct peer *); -struct peer *peer_create_accept (struct bgp *); -char *peer_uptime (time_t, char *, size_t); -void bgp_config_write_family_header (struct vty *, afi_t, safi_t, int *); +extern int peer_sort (struct peer *peer); +extern int peer_active (struct peer *); +extern int peer_active_nego (struct peer *); +extern struct peer *peer_create_accept (struct bgp *); +extern char *peer_uptime (time_t, char *, size_t); +extern int bgp_config_write (struct vty *); +extern void bgp_config_write_family_header (struct vty *, afi_t, safi_t, int *); -void bgp_master_init (); +extern void bgp_master_init (void); -void bgp_init (); +extern void bgp_init (void); +extern void bgp_route_map_init (void); -int bgp_option_set (int); -int bgp_option_unset (int); -int bgp_option_check (int); +extern int bgp_option_set (int); +extern int bgp_option_unset (int); +extern int bgp_option_check (int); -int bgp_get (struct bgp **, as_t *, const char *); -int bgp_delete (struct bgp *); +extern int bgp_get (struct bgp **, as_t *, const char *); +extern int bgp_delete (struct bgp *); -int bgp_flag_set (struct bgp *, int); -int bgp_flag_unset (struct bgp *, int); -int bgp_flag_check (struct bgp *, int); +extern int bgp_flag_set (struct bgp *, int); +extern int bgp_flag_unset (struct bgp *, int); +extern int bgp_flag_check (struct bgp *, int); -int bgp_router_id_set (struct bgp *, struct in_addr *); -int bgp_router_id_unset (struct bgp *); +extern int bgp_router_id_set (struct bgp *, struct in_addr *); +extern int bgp_router_id_unset (struct bgp *); -int bgp_cluster_id_set (struct bgp *, struct in_addr *); -int bgp_cluster_id_unset (struct bgp *); +extern int bgp_cluster_id_set (struct bgp *, struct in_addr *); +extern int bgp_cluster_id_unset (struct bgp *); -int bgp_confederation_id_set (struct bgp *, as_t); -int bgp_confederation_id_unset (struct bgp *); -int bgp_confederation_peers_check (struct bgp *, as_t); +extern int bgp_confederation_id_set (struct bgp *, as_t); +extern int bgp_confederation_id_unset (struct bgp *); +extern int bgp_confederation_peers_check (struct bgp *, as_t); -int bgp_confederation_peers_add (struct bgp *, as_t); -int bgp_confederation_peers_remove (struct bgp *, as_t); +extern int bgp_confederation_peers_add (struct bgp *, as_t); +extern int bgp_confederation_peers_remove (struct bgp *, as_t); -int bgp_timers_set (struct bgp *, u_int32_t, u_int32_t); -int bgp_timers_unset (struct bgp *); +extern int bgp_timers_set (struct bgp *, u_int32_t, u_int32_t); +extern int bgp_timers_unset (struct bgp *); -int bgp_default_local_preference_set (struct bgp *, u_int32_t); -int bgp_default_local_preference_unset (struct bgp *); +extern int bgp_default_local_preference_set (struct bgp *, u_int32_t); +extern int bgp_default_local_preference_unset (struct bgp *); -int peer_rsclient_active (struct peer *); +extern int peer_rsclient_active (struct peer *); -int peer_remote_as (struct bgp *, union sockunion *, as_t *, afi_t, safi_t); -int peer_group_remote_as (struct bgp *, const char *, as_t *); -int peer_delete (struct peer *peer); -int peer_group_delete (struct peer_group *); -int peer_group_remote_as_delete (struct peer_group *); +extern int peer_remote_as (struct bgp *, union sockunion *, as_t *, afi_t, safi_t); +extern int peer_group_remote_as (struct bgp *, const char *, as_t *); +extern int peer_delete (struct peer *peer); +extern int peer_group_delete (struct peer_group *); +extern int peer_group_remote_as_delete (struct peer_group *); -int peer_activate (struct peer *, afi_t, safi_t); -int peer_deactivate (struct peer *, afi_t, safi_t); +extern int peer_activate (struct peer *, afi_t, safi_t); +extern int peer_deactivate (struct peer *, afi_t, safi_t); -int peer_group_bind (struct bgp *, union sockunion *, struct peer_group *, +extern int peer_group_bind (struct bgp *, union sockunion *, struct peer_group *,  		     afi_t, safi_t, as_t *); -int peer_group_unbind (struct bgp *, struct peer *, struct peer_group *, +extern int peer_group_unbind (struct bgp *, struct peer *, struct peer_group *,  		       afi_t, safi_t); -int peer_flag_set (struct peer *, u_int32_t); -int peer_flag_unset (struct peer *, u_int32_t); +extern int peer_flag_set (struct peer *, u_int32_t); +extern int peer_flag_unset (struct peer *, u_int32_t); -int peer_af_flag_set (struct peer *, afi_t, safi_t, u_int32_t); -int peer_af_flag_unset (struct peer *, afi_t, safi_t, u_int32_t); -int peer_af_flag_check (struct peer *, afi_t, safi_t, u_int32_t); +extern int peer_af_flag_set (struct peer *, afi_t, safi_t, u_int32_t); +extern int peer_af_flag_unset (struct peer *, afi_t, safi_t, u_int32_t); +extern int peer_af_flag_check (struct peer *, afi_t, safi_t, u_int32_t); -int peer_ebgp_multihop_set (struct peer *, int); -int peer_ebgp_multihop_unset (struct peer *); +extern int peer_ebgp_multihop_set (struct peer *, int); +extern int peer_ebgp_multihop_unset (struct peer *); -int peer_description_set (struct peer *, char *); -int peer_description_unset (struct peer *); +extern int peer_description_set (struct peer *, char *); +extern int peer_description_unset (struct peer *); -int peer_update_source_if_set (struct peer *, const char *); -int peer_update_source_addr_set (struct peer *, union sockunion *); -int peer_update_source_unset (struct peer *); +extern int peer_update_source_if_set (struct peer *, const char *); +extern int peer_update_source_addr_set (struct peer *, union sockunion *); +extern int peer_update_source_unset (struct peer *); -int peer_default_originate_set (struct peer *, afi_t, safi_t, const char *); -int peer_default_originate_unset (struct peer *, afi_t, safi_t); +extern int peer_default_originate_set (struct peer *, afi_t, safi_t, const char *); +extern int peer_default_originate_unset (struct peer *, afi_t, safi_t); -int peer_port_set (struct peer *, u_int16_t); -int peer_port_unset (struct peer *); +extern int peer_port_set (struct peer *, u_int16_t); +extern int peer_port_unset (struct peer *); -int peer_weight_set (struct peer *, u_int16_t); -int peer_weight_unset (struct peer *); +extern int peer_weight_set (struct peer *, u_int16_t); +extern int peer_weight_unset (struct peer *); -int peer_timers_set (struct peer *, u_int32_t, u_int32_t); -int peer_timers_unset (struct peer *); +extern int peer_timers_set (struct peer *, u_int32_t, u_int32_t); +extern int peer_timers_unset (struct peer *); -int peer_timers_connect_set (struct peer *, u_int32_t); -int peer_timers_connect_unset (struct peer *); +extern int peer_timers_connect_set (struct peer *, u_int32_t); +extern int peer_timers_connect_unset (struct peer *); -int peer_advertise_interval_set (struct peer *, u_int32_t); -int peer_advertise_interval_unset (struct peer *); +extern int peer_advertise_interval_set (struct peer *, u_int32_t); +extern int peer_advertise_interval_unset (struct peer *); -int peer_interface_set (struct peer *, const char *); -int peer_interface_unset (struct peer *); +extern int peer_interface_set (struct peer *, const char *); +extern int peer_interface_unset (struct peer *); -int peer_distribute_set (struct peer *, afi_t, safi_t, int, const char *); -int peer_distribute_unset (struct peer *, afi_t, safi_t, int); +extern int peer_distribute_set (struct peer *, afi_t, safi_t, int, const char *); +extern int peer_distribute_unset (struct peer *, afi_t, safi_t, int); -int peer_allowas_in_set (struct peer *, afi_t, safi_t, int); -int peer_allowas_in_unset (struct peer *, afi_t, safi_t); +extern int peer_allowas_in_set (struct peer *, afi_t, safi_t, int); +extern int peer_allowas_in_unset (struct peer *, afi_t, safi_t); -int peer_local_as_set (struct peer *, as_t, int); -int peer_local_as_unset (struct peer *); +extern int peer_local_as_set (struct peer *, as_t, int); +extern int peer_local_as_unset (struct peer *); -int peer_prefix_list_set (struct peer *, afi_t, safi_t, int, const char *); -int peer_prefix_list_unset (struct peer *, afi_t, safi_t, int); +extern int peer_prefix_list_set (struct peer *, afi_t, safi_t, int, const char *); +extern int peer_prefix_list_unset (struct peer *, afi_t, safi_t, int); -int peer_aslist_set (struct peer *, afi_t, safi_t, int, const char *); -int peer_aslist_unset (struct peer *,afi_t, safi_t, int); +extern int peer_aslist_set (struct peer *, afi_t, safi_t, int, const char *); +extern int peer_aslist_unset (struct peer *,afi_t, safi_t, int); -int peer_route_map_set (struct peer *, afi_t, safi_t, int, const char *); -int peer_route_map_unset (struct peer *, afi_t, safi_t, int); +extern int peer_route_map_set (struct peer *, afi_t, safi_t, int, const char *); +extern int peer_route_map_unset (struct peer *, afi_t, safi_t, int); -int peer_unsuppress_map_set (struct peer *, afi_t, safi_t, const char *); -int peer_unsuppress_map_unset (struct peer *, afi_t, safi_t); +extern int peer_unsuppress_map_set (struct peer *, afi_t, safi_t, const char *); +extern int peer_unsuppress_map_unset (struct peer *, afi_t, safi_t); -int peer_maximum_prefix_set (struct peer *, afi_t, safi_t, u_int32_t, u_char, int, u_int16_t); -int peer_maximum_prefix_unset (struct peer *, afi_t, safi_t); +extern int peer_maximum_prefix_set (struct peer *, afi_t, safi_t, u_int32_t, u_char, int, u_int16_t); +extern int peer_maximum_prefix_unset (struct peer *, afi_t, safi_t); -int peer_clear (struct peer *); -int peer_clear_soft (struct peer *, afi_t, safi_t, enum bgp_clear_type); +extern int peer_clear (struct peer *); +extern int peer_clear_soft (struct peer *, afi_t, safi_t, enum bgp_clear_type); -void peer_nsf_stop (struct peer *); +extern void peer_nsf_stop (struct peer *);  #endif /* _QUAGGA_BGPD_H */  | 
