summaryrefslogtreecommitdiff
path: root/zebra/redistribute.h
AgeCommit message (Collapse)Author
2024-10-29zebra: Add ability to import alternate tables into the MRIBNathan Bahr
Expanded the cli command to include an mrib flag for importing to the main table MRIB instead of the main table URIB. Piped through specifying the safi through the import table functions rather than hardcoding to SAFI_UNICAST. Import still only import routes from the URIB subtable, only added the ability to import into the main table MRIB. Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-18zebra: Fix redistribute.h up to our standardsDonald Sharp
FRR must give variable names instead of not defining them in the .h file. This just cleans up this problem for redistribute.h Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-01-18zebra: Convert redistribute_update to use a route_nodeDonald Sharp
FRR is passing around a bunch of data that is encapsulated within the route node. Let's just pass that around instead. Signed-off-by: Donald Sharp <sharpd@nvidia.com> Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-01-18zebra: Convert redistribute_delete to use a route_nodeDonald Sharp
FRR is passing around a bunch of data that is encapsulated within the route node. Let's just pass that around instead. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2019-09-12zebra: revise redistribution delete to improve update caseMark Stapp
When selecting a new best route, zebra sends a redist update when the route is installed. There are cases where redist clients may not see that redist add - clients who are not subscribed to the new route type, e.g. In that case, attempt to send a redist delete for the old/previous route type. Revised the redist delete api to accomodate both cases; also tightened up the const-ness of a few internal redist apis. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-06-25zebra: Push VRF_DEFAULT outside of import table codeDonald Sharp
The import table code assumes that they will only work in the default vrf. This is ok, but we should push the vrf_id and zvrf to be passed in instead of just using VRF_DEFAULT. This will allow us to fix a couple of things: 1) A bug in import where we are not creating the route entry with the appropriate table so the imported entry is showing up in the wrong spot. 2) In the future allow `ip import-table X` to become vrf aware very easily. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-03-25add cplusplus guards to all zebra headersEmanuele Di Pascale
Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2018-10-25zebra: resolve style issues in dplane commitMark Stapp
Resolve (most) style issues in the initial zebra dataplane commit branch. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-08-17zebra : Zebra does not properly track which route-maps are changed (#2493)kssoman
* Check for the modified routemap in zebra_route_map_process_update_cb() * Added zebra_rib_table_rm_update() for RIB routemap processing * Added zebra_nht_rm_update() for NHT routemap processing Signed-off-by: kssoman <somanks@vmware.com>
2018-07-11zebra, libs: use const prefix ptrs in apisMark Stapp
Add 'const' to prefix args to several zebra route update, redistribution, and route owner notification apis. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-04-22zebra: clean up zapi organizationQuentin Young
zserv.c has become something of a dumping ground for everything vaguely related to ZAPI and really needs some love. This change splits out the code fo building and consuming ZAPI messages into a separate source file, leaving the actual session and client lifecycle code in zserv.c. Unfortunately since the #include situation in Zebra has not been paid much attention I was forced to fix the headers in a lot of other source files. This is a net improvement overall though. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-27*: use C99 standard fixed-width integer typesQuentin Young
The following types are nonstandard: - u_char - u_short - u_int - u_long - u_int8_t - u_int16_t - u_int32_t Replace them with the C99 standard types: - uint8_t - unsigned short - unsigned int - unsigned long - uint8_t - uint16_t - uint32_t Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-12zebra: reorganize zserv, batch i/oQuentin Young
Group send and receive functions together, change handlers to take a message instead of looking at ->ibuf and ->obuf, allow zebra to read multiple packets off the wire at a time. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-12zebra: standardize ZAPI message handler argsQuentin Young
A lot of the handler functions that are called directly from the ZAPI input processing code take different argument sets where they don't need to. These functions are called from only one place and all have the same fundamental information available to them to do their work. There is no need to specialize what information is passed to them; it is cleaner and easier to understand when they all accept the same base set of information and extract what they need inline. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-31*: Cleanup multiple is_default... codeDonald Sharp
There are 3 different implementations of is_prefix. Standardize on is_prefix_default and fix it's implementation. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-17*: reindentreindent-master-afterwhitespace / reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-06-01zebra: Refactor 'struct rib' to be 'struct route_entry'Donald Sharp
The 'struct rib' data structure is missnamed. It really is a 'struct route_entry' as part of the 'struct route_node'. We have 1 'struct route_entry' per route src. As such 1 route node can have multiple route entries if multiple protocols attempt to install the same route. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-15*: make consistent & update GPLv2 file headersDavid Lamparter
The FSF's address changed, and we had a mixture of comment styles for the GPL file header. (The style with * at the beginning won out with 580 to 141 in existing files.) Note: I've intentionally left intact other "variations" of the copyright header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-30zebra: add srcdest support to ribChristian Franke
Add srcdest support to the zebra rib and to the kernel and redistribution interfaces. Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2016-09-03Update Traffic Engineering Support for OSPFDOlivier Dugeon
NOTE: I am squashing several commits together because they do not independently compile and we need this ability to do any type of sane testing on the patches. Since this series builds together I am doing this. -DBS This new structure is the basis to get new link parameters for Traffic Engineering from Zebra/interface layer to OSPFD and ISISD for the support of Traffic Engineering * lib/if.[c,h]: link parameters struture and get/set functions * lib/command.[c,h]: creation of a new link-node * lib/zclient.[c,h]: modification to the ZBUS message to convey the link parameters structure * lib/zebra.h: New ZBUS message Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Add support for IEEE 754 format * lib/stream.[c,h]: Add stream_get{f,d} and stream_put{f,d}) demux and muxers to safely convert between big-endian IEEE-754 single and double binary format, as used in IETF RFCs, and C99. Implementation depends on host using __STDC_IEC_559__, which should be everything we care about. Should correctly error out otherwise. * lib/network.[c,h]: Add ntohf and htonf converter * lib/memtypes.c: Add new memeory type for Traffic Engineering support Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Add link parameters support to Zebra * zebra/interface.c: - Add new link-params CLI commands - Add new functions to set/get link parameters for interface * zebra/redistribute.[c,h]: Add new function to propagate link parameters to routing daemon (essentially OSPFD and ISISD) for Traffic Engineering. * zebra/redistribute_null.c: Add new function zebra_interface_parameters_update() * zebra/zserv.[c,h]: Add new functions to send link parameters Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Add support of new link-params CLI to vtysh In vtysh_config.c/vtysh_config_parse_line(), it is not possible to continue to use the ordered version for adding line i.e. config_add_line_uniq() to print Interface CLI commands as it completely break the new LINK_PARAMS_NODE. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Update Traffic Engineering support for OSPFD These patches update original code to RFC3630 (OSPF-TE) and add support of RFC5392 (Inter-AS v2) & RFC7471 (TE metric extensions) and partial support of RFC6827 (ASON - GMPLS). * ospfd/ospf_dump.[c,h]: Add new dump functions for Traffic Engineering * ospfd/ospf_opaque.[c,h]: Add new TLV code points for RFC5392 * ospfd/ospf_packet.c: Update checking of OSPF_OPTION * ospfd/ospf_vty.[c,h]: Update ospf_str2area_id * ospfd/ospf_zebra.c: Add new function ospf_interface_link_params() to get Link Parameters information from the interface to populate Traffic Engineering metrics * ospfd/ospfd.[c,h]: Update OSPF_OPTION flags (T -> MT and new DN) * ospfd/ospf_te.[c,h]: Major modifications to update the code to new link parameters structure and new RFCs Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> tmp
2016-05-12zebra: Add route-map support to ip import-tableDon Slice
Added the ability to supply a route-map to the ip import-table command, which greatly improves filtering between the kernel prefixes in a non-default table that are imported into the zebra rib. Ticket:CM-8168 Signed-off-by: Donald Slice Reviewed By: Donald Sharp
2016-04-20zebra: Fix zebra_rnh_register crashDonald Sharp
Zebra is crashing inside of zserv_rnh_register when it attempts to lookup a vrf that was just deleted: Imagine this series of events: Pre (A): ifdown -a -X eth0 (A) zebra notification from kernel that vrf is goneroo (B) zebra notifies all daemons (C) bgpd is churning because we have been removing interfaces and we have an new path and it hasn't handled the vrf goneroo event yet from zebra so it sends to zebra a new rnh with an old vrf_id. (D) zebra attempts to lookup the zvrf and crashes because of pointer dereference. zebra handles all callbacks in one function. Convert that function to check to see if we have a valid zvrf. If so make the callback Ticket: CM-10482 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com> Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2016-04-14zebra: Refactor zebra_vrfDonald Sharp
Move zebra_vrf_XXX functionality into it's own file so that we can isolate a bit the api edges Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com> Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2016-03-23zebra: Replace vrf with zebra_vrf in a few placesDonald Sharp
We were incorrectly using vrf instead of zebra_vrf in a few spots. Ticket: CM-9412 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-02-25Quagga: Implement VRF change semantics for an interfacevivek
Implement VRF change semantics for an interface to be invoked when an interface is moved from one VRF (e.g., the Default) to another. This includes the message definition as well as updating, deleting or adding the interface from clients, depending on their interest in the VRFs (old and new). Also handle replay of the addresses on the interface upon VRF change, if required. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com> Ticket: CM-9527 Reviewed By: CCR-4174 Testing Done: Manual tests of various scenarios
2016-02-01lib, zebra: The Bulk of the conversion over to NS and VRFDonald Sharp
Convert the rest of zebra over to use a Namespae and VRF. Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-11-03*: add VRF ID in the API message headerFeng Lu
The API messages are used by zebra to exchange the interfaces, addresses, routes and router-id information with its clients. To distinguish which VRF the information belongs to, a new field "VRF ID" is added in the message header. And hence the message version is increased to 3. * The new field "VRF ID" in the message header: Length (2 bytes) Marker (1 byte) Version (1 byte) VRF ID (2 bytes, newly added) Command (2 bytes) - Client side: - zclient_create_header() adds the VRF ID in the message header. - zclient_read() extracts and validates the VRF ID from the header, and passes the VRF ID to the callback functions registered to the API messages. - All relative functions are appended with a new parameter "vrf_id", including all the callback functions. - "vrf_id" is also added to "struct zapi_ipv4" and "struct zapi_ipv6". Clients need to correctly set the VRF ID when using the API functions zapi_ipv4_route() and zapi_ipv6_route(). - Till now all messages sent from a client have the default VRF ID "0" in the header. - The HELLO message is special, which is used as the heart-beat of a client, and has no relation with VRF. The VRF ID in the HELLO message header will always be 0 and ignored by zebra. - Zebra side: - zserv_create_header() adds the VRF ID in the message header. - zebra_client_read() extracts and validates the VRF ID from the header, and passes the VRF ID to the functions which process the received messages. - All relative functions are appended with a new parameter "vrf_id". * Suppress the messages in a VRF which a client does not care: Some clients may not care about the information in the VRF X, and zebra should not send the messages in the VRF X to those clients. Extra flags are used to indicate which VRF is registered by a client, and a new message ZEBRA_VRF_UNREGISTER is introduced to let a client can unregister a VRF when it does not need any information in that VRF. A client sends any message other than ZEBRA_VRF_UNREGISTER in a VRF will automatically register to that VRF. - lib/vrf: A new utility "VRF bit-map" is provided to manage the flags for VRFs, one bit per VRF ID. - Use vrf_bitmap_init()/vrf_bitmap_free() to initialize/free a bit-map; - Use vrf_bitmap_set()/vrf_bitmap_unset() to set/unset a flag in the given bit-map, corresponding to the given VRF ID; - Use vrf_bitmap_check() to test whether the flag, in the given bit-map and for the given VRF ID, is set. - Client side: - In "struct zclient", the following flags are changed from "u_char" to "vrf_bitmap_t": redist[ZEBRA_ROUTE_MAX] default_information These flags are extended for each VRF, and controlled by the clients themselves (or with the help of zclient_redistribute() and zclient_redistribute_default()). - Zebra side: - In "struct zserv", the following flags are changed from "u_char" to "vrf_bitmap_t": redist[ZEBRA_ROUTE_MAX] redist_default ifinfo ridinfo These flags are extended for each VRF, as the VRF registration flags. They are maintained on receiving a ZEBRA_XXX_ADD or ZEBRA_XXX_DELETE message. When sending an interface/address/route/router-id message in a VRF to a client, if the corresponding VRF registration flag is not set, this message will not be dropped by zebra. - A new function zread_vrf_unregister() is introduced to process the new command ZEBRA_VRF_UNREGISTER. All the VRF registration flags are cleared for the requested VRF. Those clients, who support only the default VRF, will never receive a message in a non-default VRF, thanks to the filter in zebra. * New callback for the event of successful connection to zebra: - zclient_start() is splitted, keeping only the code of connecting to zebra. - Now zclient_init()=>zclient_connect()=>zclient_start() operations are purely dealing with the connection to zbera. - Once zebra is successfully connected, at the end of zclient_start(), a new callback is used to inform the client about connection. - Till now, in the callback of connect-to-zebra event, all clients send messages to zebra to request the router-id/interface/routes information in the default VRF. Of corse in future the client can do anything it wants in this callback. For example, it may send requests for both default VRF and some non-default VRFs. Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com> Conflicts: lib/zclient.h lib/zebra.h zebra/zserv.c zebra/zserv.h Conflicts: bgpd/bgp_nexthop.c bgpd/bgp_nht.c bgpd/bgp_zebra.c isisd/isis_zebra.c lib/zclient.c lib/zclient.h lib/zebra.h nhrpd/nhrp_interface.c nhrpd/nhrp_route.c nhrpd/nhrpd.h ospf6d/ospf6_zebra.c ospf6d/ospf6_zebra.h ospfd/ospf_vty.c ospfd/ospf_zebra.c pimd/pim_zebra.c pimd/pim_zlookup.c ripd/rip_zebra.c ripngd/ripng_zebra.c zebra/redistribute.c zebra/rt_netlink.c zebra/zebra_rnh.c zebra/zebra_rnh.h zebra/zserv.c zebra/zserv.h
2015-10-20Zebra: Redistribute replace handling corner casesvivek
Ticket: CM-7309 Reviewed By: CCR-3448 Testing Done: passing route_ospf_route_thrash, the new redist test When zebra was modified to have redistributed routes follow a replace logic instead of the del-add, one case was missed. When a route is replaced with a change only to the source protocol (say from static to bgp), its possible that the new source protocol is not selected for redistribution by a client. Since we did not delete the route initially, if the add is not allowed for the new source protocol for a client, we need to send a delete of that redistributed route. This is what the patch fixes. Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2015-09-15Zebra: Add IPv6 protocol filtering support & Setting Src of IPv6 routesDinesh G Dutt
Ticket: Reviewed By: CCR-3335 Testing Done: bgpsmoke, ENHE tests etc. Add support for filtering routes from upper layer protocols to zebra via route-maps for IPv6. The same functionality already existed for IPv4. In addition, add support for setting source of routes via IPv6 protocol map. Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Vivek Venkataraman <vivek@cumulusnetworks.com> Reviewed-by: Vipin Kumar <vipin@cumulusnetworks.com>
2015-06-12This patch changes BGP from only listening mode for BFD status updates to ↵Donald Sharp
interactive mode of dynamically registering/deregistering BFD enabled peers with PTM/BFD through zebra. Peer is registered with BFD when it goes into established state and de-registers when it goes out of establish state. This patch also adds BFD multihop support for BGP. Whether a peer is multi-hop or single hop is determined internally. All IGP peers are considered as multi-hop peers. EBGP peers are considered as single hop unless configured as multi-hop. BGP BFD command enhancement to configure BFD parameters (detect multiplier, min rx and min tx). router bgp <as-number> neighbor <name/ip-address> bfd <detect mult> <min rx> <min tx> Signed-off-by: Radhika Mahankali <radhika@cumulusnetworks.com> Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com> Reviewed-by: Vipin Kumar <vipin@cumulusnetworks.com> Reviewed-by: Kanna Rajagopal <kanna@cumulusnetworks.com>
2015-05-19zebra-redistribute-table.patchDonald Sharp
Zebra: Redistribute routes from non-main kernel table to main. This can be the basis for many interesting features such as variations of redistribute ARP, using zebra as the RIB in the presence of multiple routing protocol stacks etc. The code only supports IPv4 for now, but the infrastructure is in place for IPv6. Usage: There is a new route type introduced by this model: TABLE. Routes imported from alternate kernel tables will have their protocol type set to TABLE. Routes from alternate kernel tables MUST be first imported into the main table via "ip import-table <table id>". They can then be redistributed via a routing protocol via the "redistribute table" command. Each imported table can an optional administrative distance specified. In Zebra, a route with a lower distance is chosen over routes with a higher distance. So, distance is how the user can choose to prioritize routes from a particular table over routes from other tables or routes learnt another way in zebra. Route maps for imported tables are specified via "ip protocol" command in zebra. Route maps for redistributed routes within a routing protocol are subject to the route map options supported by the protocol. The "match source-protocol" option in route maps can match against "table" to filter routes learnt from alternate kernel routing tables. Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-19This patch adds support for a new BFD session down message from zebra toDonald Sharp
protocols. BGP and OSPF are integrated to respond this BFD session down message originated in Zebra via ptmd. BGP and OSPF now have a bfd command, which tells OSPF/BGP to respond to the BFD session down message. OSPF: interface <> ip ospf bfd BGP: router bgp <> neighbor <> bfd Please note that these commands don't enable BFD as a protocol. BFD configuration and paramter tuning are via BFD applicable UI. Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com> Reviewed-by: Shrijeet Mukherjee <shm@cumulusnetworks.com>
2007-04-10[zebra] Bug #351: Don't redistribute routes to ipv4 link-local prefixesPaul Jakma
2007-04-07 Paul Jakma <paul.jakma@sun.com> * lib/prefix.h: Add define to match IPv4 Link-Local addresses * zebra/redistribute.c: (zebra_check_addr) Don't redistribute routes to IPv4 link-local prefixes, fixes bug #351. * zebra/redistribute.h: Export zebra_check_addr. * zebra/router-id.c: (router_id_bad_address) re-use zebra_check_addr rather than implementing similar logic.
2005-06-282005-06-28 Paul Jakma <paul.jakma@sun.com>paul
* (global) Extern and static'ification, with related fixups of declarations, ensuring files include their own headers, etc. if_ioctl.c: (interface_info_ioctl) fix obvious arg mis-order in list loop
2004-07-232004-07-23 Sowmini Varadhan <Sowmini.Varadhan@Sun.COM>paul
* if_ioctl_solaris.c: HAVE_IPV6 ifdef fixups * zserv.c: ditto * ioctl_solaris.c: ditto. * interface.c: cast for LLADDR * interface.h: Add guards, include redistribute.h and remove extraneous definitions of zebra_interface_{up,down}_update * ioctl.h: Add AF_IOCTL define for non SOLARIS_IPV6 * redistribute.h: include dependent header, zserv.h * zserv.h: include dependent header, rib.h
2002-12-13Initial revisionpaul