2002-12-13 21:15:29 +01:00
|
|
|
/* zebra connection and redistribute fucntions.
|
|
|
|
Copyright (C) 1999 Kunihiro Ishiguro
|
|
|
|
|
|
|
|
This file is part of GNU Zebra.
|
|
|
|
|
|
|
|
GNU Zebra is free software; you can redistribute it and/or modify it
|
|
|
|
under the terms of the GNU General Public License as published by the
|
|
|
|
Free Software Foundation; either version 2, or (at your option) any
|
|
|
|
later version.
|
|
|
|
|
|
|
|
GNU Zebra is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GNU Zebra; see the file COPYING. If not, write to the
|
|
|
|
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
|
|
|
|
2005-05-23 16:19:54 +02:00
|
|
|
#ifndef _QUAGGA_BGP_ZEBRA_H
|
|
|
|
#define _QUAGGA_BGP_ZEBRA_H
|
|
|
|
|
2011-07-21 05:47:07 +02:00
|
|
|
#define BGP_NEXTHOP_BUF_SIZE (8 * sizeof (struct in_addr *))
|
2015-05-20 02:24:44 +02:00
|
|
|
#define BGP_IFINDICES_BUF_SIZE (8 * sizeof (unsigned int))
|
2011-07-21 05:47:07 +02:00
|
|
|
|
|
|
|
extern struct stream *bgp_nexthop_buf;
|
2015-05-20 02:24:44 +02:00
|
|
|
extern struct stream *bgp_ifindices_buf;
|
2011-07-21 05:47:07 +02:00
|
|
|
|
2005-06-28 14:44:16 +02:00
|
|
|
extern void bgp_zebra_init (void);
|
|
|
|
extern int bgp_if_update_all (void);
|
2011-07-21 05:43:22 +02:00
|
|
|
extern int bgp_config_write_maxpaths (struct vty *, struct bgp *, afi_t,
|
|
|
|
safi_t, int *);
|
2005-06-28 14:44:16 +02:00
|
|
|
extern int bgp_config_write_redistribute (struct vty *, struct bgp *, afi_t, safi_t,
|
2002-12-13 21:15:29 +01:00
|
|
|
int *);
|
bgpd: bgpd-table-map.patch
COMMAND:
table-map <route-map-name>
DESCRIPTION:
This feature is used to apply a route-map on route updates from BGP to Zebra.
All the applicable match operations are allowed, such as match on prefix,
next-hop, communities, etc. Set operations for this attach-point are limited
to metric and next-hop only. Any operation of this feature does not affect
BGPs internal RIB.
Supported for ipv4 and ipv6 address families. It works on multi-paths as well,
however, metric setting is based on the best-path only.
IMPLEMENTATION NOTES:
The route-map application at this point is not supposed to modify any of BGP
route's attributes (anything in bgp_info for that matter). To achieve that,
creating a copy of the bgp_attr was inevitable. Implementation tries to keep
the memory footprint low, code comments do point out the rationale behind a
few choices made.
bgp_zebra_announce() was already a big routine, adding this feature would
extend it further. Patch has created a few smaller routines/macros whereever
possible to keep the size of the routine in check without compromising on the
readability of the code/flow inside this routine.
For updating a partially filtered route (with its nexthops), BGP to Zebra
replacement semantic of the next-hops serves the purpose well. However, with
this patch there could be some redundant withdraws each time BGP announces a
route thats (all the nexthops) gets denied by the route-map application.
Handling of this case could be optimized by keeping state with the prefix and
the nexthops in BGP. The patch doesn't optimizing that case, as even with the
redundant withdraws the total number of updates to zebra are still be capped
by the total number of routes in the table.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
2015-05-20 02:40:34 +02:00
|
|
|
extern void bgp_zebra_announce (struct prefix *, struct bgp_info *, struct bgp *,
|
|
|
|
afi_t, safi_t);
|
|
|
|
extern void bgp_zebra_announce_table (struct bgp *, afi_t, safi_t);
|
2011-11-26 18:58:42 +01:00
|
|
|
extern void bgp_zebra_withdraw (struct prefix *, struct bgp_info *, safi_t);
|
2005-06-28 14:44:16 +02:00
|
|
|
|
|
|
|
extern int bgp_redistribute_set (struct bgp *, afi_t, int);
|
2015-05-20 02:40:45 +02:00
|
|
|
extern int bgp_redistribute_resend (struct bgp *, afi_t, int);
|
2005-06-28 14:44:16 +02:00
|
|
|
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 struct interface *if_lookup_by_ipv4 (struct in_addr *);
|
|
|
|
extern struct interface *if_lookup_by_ipv4_exact (struct in_addr *);
|
2002-12-13 21:15:29 +01:00
|
|
|
#ifdef HAVE_IPV6
|
2005-06-28 14:44:16 +02:00
|
|
|
extern struct interface *if_lookup_by_ipv6 (struct in6_addr *);
|
|
|
|
extern struct interface *if_lookup_by_ipv6_exact (struct in6_addr *);
|
2002-12-13 21:15:29 +01:00
|
|
|
#endif /* HAVE_IPV6 */
|
2005-05-23 16:19:54 +02:00
|
|
|
|
|
|
|
#endif /* _QUAGGA_BGP_ZEBRA_H */
|