2004-09-13 Jose Luis Rubio <jrubio@dit.upm.es>
           (at Technical University of Madrid as part of Euro6ix Project)

        Enhanced Route Server functionality and Route-Maps:

        * bgpd/bgpd.h: Modified 'struct peer' and 'struct bgp_filter' to
        support rs-clients. A 'struct bgp_table *rib' has been added to the
        first (to mantain a separated RIB for each rs-client) and two new
        route-maps have been added to the last (for import/export policies).
        Added the following #defines: RMAP_{IN|OUT|IMPORT|EXPORT|MAX},
        PEER_RMAP_TYPE_{IMPORT|EXPORT} and BGP_CLEAR_SOFT_RSCLIENT.

        * bgpd/bgpd.c: Modified the functions that create/delete/etc peers in
        order to consider the new fields included in 'struct peer' for
        supporting rs-clients, i.e. the import/export route-maps and the
        'struct bgp_table'.

        * bgpd/bgp_route.{ch}: Modified several functions related with
        receiving/sending announces in order to support the new Route Server
        capabilities.
        Function 'bgp_process' has been reorganized, creating an auxiliar
        function for best path selection ('bgp_best_selection').
        Modified 'bgp_show' and 'bgp_show_route' for displaying information
        about any RIB (and not only the main bgp RIB).
        Added commands for displaying information about RS-clients RIBs:
        'show bgp rsclient (A.B.C.D|X:X::X:X)', 'show bgp rsclient
        (A.B.C.D|X:X::X:X) X:X::X:X/M', etc

        * bgpd/bgp_table.{ch}: The structure 'struct bgp_table' now has two
        new fields: type (which can take the values BGP_TABLE_{MAIN|RSCLIENT})
        and 'void *owner' which points to 'struct bgp' or 'struct peer' which
        owns the table.
        When creating a new bgp_table by default 'type=BGP_TABLE_MAIN' is set.

        * bgpd/bgp_vty.c: The commands 'neighbor ... route-server-client' and
        'no neighbor ... route-server-client' now not only set/unset the flag
        PEER_FLAG_RSERVER_CLIENT, but they create/destroy the 'struct
        bgp_table' of the peer. Special actions are taken for peer_groups.
        Command 'neighbor ... route-map WORD (in|out)' now also supports two
        new kinds of route-map: 'import' and 'export'.
        Added commands 'clear bgp * rsclient', etc. These commands allow a new
        kind of soft_reconfig which affects only the RIB of the specified
        RS-client.
        Added commands 'show bgp rsclient summary', etc which display a
        summary of the rs-clients configured for the corresponding address
        family.

        * bgpd/bgp_routemap.c: A new match statement is available,
        'match peer (A.B.C.D|X:X::X:X)'. This statement can only be used in
        import/export route-maps, and it matches when the peer who announces
        (when used in an import route-map) or is going to receive (when used
        in an export route-map) the route is the same than the one specified
        in the statement.
        For peer-groups the statement matches if the specified peer is member
        of the peer-group.
        A special version of the command, 'match peer local', matches with
        routes originated by the Route Server (defined with 'network ...',
        redistributed routes and default-originate).

        * lib/routemap.{ch}: Added a new clause 'call NAME' for use in
        route-maps. It jumps into the specified route-map and when it returns
        the first route-map ends if the called RM returns DENY_MATCH, or
        continues in other case.
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h
index 273ed41..9aad723 100644
--- a/bgpd/bgp_route.h
+++ b/bgpd/bgp_route.h
@@ -109,10 +109,15 @@
 #define FILTER_LIST_OUT_NAME(F) ((F)->aslist[FILTER_OUT].name)
 #define FILTER_LIST_OUT(F)      ((F)->aslist[FILTER_OUT].aslist)
 
-#define ROUTE_MAP_IN_NAME(F)    ((F)->map[FILTER_IN].name)
-#define ROUTE_MAP_IN(F)         ((F)->map[FILTER_IN].map)
-#define ROUTE_MAP_OUT_NAME(F)   ((F)->map[FILTER_OUT].name)
-#define ROUTE_MAP_OUT(F)        ((F)->map[FILTER_OUT].map)
+#define ROUTE_MAP_IN_NAME(F)    ((F)->map[RMAP_IN].name)
+#define ROUTE_MAP_IN(F)         ((F)->map[RMAP_IN].map)
+#define ROUTE_MAP_OUT_NAME(F)   ((F)->map[RMAP_OUT].name)
+#define ROUTE_MAP_OUT(F)        ((F)->map[RMAP_OUT].map)
+
+#define ROUTE_MAP_IMPORT_NAME(F)    ((F)->map[RMAP_IMPORT].name)
+#define ROUTE_MAP_IMPORT(F)    ((F)->map[RMAP_IMPORT].map)
+#define ROUTE_MAP_EXPORT_NAME(F)    ((F)->map[RMAP_EXPORT].name)
+#define ROUTE_MAP_EXPORT(F)    ((F)->map[RMAP_EXPORT].map)
 
 #define UNSUPPRESS_MAP_NAME(F)  ((F)->usmap.name)
 #define UNSUPPRESS_MAP(F)       ((F)->usmap.map)
@@ -124,6 +129,8 @@
 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);