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.
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 07fa139..93074ab 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -59,7 +59,7 @@
 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 @@
 
 /* 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 @@
 }
 
 /* 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 @@
   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 @@
   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 @@
 }
 
 /* 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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 *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 @@
     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 @@
   return;
 }
 
-int
+static int
 bgp_maximum_prefix_restart_timer (struct thread *thread)
 {
   struct peer *peer;
@@ -1512,7 +1512,7 @@
   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_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_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 @@
   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_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 @@
 
 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 @@
 }
 
 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 @@
   return 0;
 }
 
-struct bgp_static *
+static struct bgp_static *
 bgp_static_new ()
 {
   struct bgp_static *new;
@@ -2820,7 +2820,7 @@
   return new;
 }
 
-void
+static void
 bgp_static_free (struct bgp_static *bgp_static)
 {
   if (bgp_static->rmap.name)
@@ -2828,7 +2828,7 @@
   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_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 @@
   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 @@
     }
 }
 
-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 @@
       }
 }
 
-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 @@
 
 /* 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 @@
 }
 
 /* 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 @@
   safi_t safi;
 };
 
-struct bgp_aggregate *
+static struct bgp_aggregate *
 bgp_aggregate_new ()
 {
   struct bgp_aggregate *new;
@@ -3920,13 +3920,13 @@
   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_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 @@
 #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 @@
   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 @@
 }
 
 /* Static function to display route. */
-void
+static void
 route_vty_out_route (struct prefix *p, struct vty *vty)
 {
   int len;
@@ -5364,7 +5364,7 @@
   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 @@
 }
 
 /* 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 @@
 }
 
 /* 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 @@
 }
 
 /* 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 @@
 #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 @@
 }
 #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 @@
 }
 #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 @@
 }
 #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 @@
 }
 #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 @@
        "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 @@
 }
 #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 @@
 }
 #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 @@
   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 @@
 	     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 @@
        "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 @@
   char *access_list;
 };
 
-struct bgp_distance *
+static struct bgp_distance *
 bgp_distance_new ()
 {
   struct bgp_distance *new;
@@ -9689,13 +9689,13 @@
   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 @@
   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 @@
   return CMD_SUCCESS;
 }
 
-void
+static void
 bgp_distance_reset ()
 {
   struct bgp_node *rn;
@@ -10062,7 +10062,7 @@
 }
 
 /* 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 @@
 			       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)
 {