2002-12-13 21:15:29 +01:00
|
|
|
/* Redistribution Handler
|
|
|
|
* Copyright (C) 1998 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.
|
|
|
|
*
|
2017-05-13 10:25:29 +02:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; see the file COPYING; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2002-12-13 21:15:29 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <zebra.h>
|
|
|
|
|
|
|
|
#include "vector.h"
|
|
|
|
#include "vty.h"
|
|
|
|
#include "command.h"
|
|
|
|
#include "prefix.h"
|
|
|
|
#include "table.h"
|
|
|
|
#include "stream.h"
|
|
|
|
#include "zclient.h"
|
|
|
|
#include "linklist.h"
|
|
|
|
#include "log.h"
|
2015-05-22 11:39:56 +02:00
|
|
|
#include "vrf.h"
|
2016-12-05 20:05:30 +01:00
|
|
|
#include "srcdest_table.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
#include "zebra/rib.h"
|
2019-01-11 19:38:19 +01:00
|
|
|
#include "zebra/zebra_router.h"
|
2016-04-14 15:20:47 +02:00
|
|
|
#include "zebra/zebra_ns.h"
|
|
|
|
#include "zebra/zebra_vrf.h"
|
2016-05-11 17:47:02 +02:00
|
|
|
#include "zebra/zebra_routemap.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
#include "zebra/redistribute.h"
|
|
|
|
#include "zebra/debug.h"
|
2004-10-03 20:18:34 +02:00
|
|
|
#include "zebra/router-id.h"
|
2018-04-22 22:01:20 +02:00
|
|
|
#include "zebra/zapi_msg.h"
|
2015-05-29 05:48:31 +02:00
|
|
|
#include "zebra/zebra_memory.h"
|
2017-06-28 10:51:10 +02:00
|
|
|
#include "zebra/zebra_vxlan.h"
|
2018-08-24 19:14:09 +02:00
|
|
|
#include "zebra/zebra_errors.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2015-05-20 02:40:44 +02:00
|
|
|
#define ZEBRA_PTM_SUPPORT
|
|
|
|
|
2015-05-20 03:03:42 +02:00
|
|
|
/* array holding redistribute info about table redistribution */
|
|
|
|
/* bit AFI is set if that AFI is redistributing routes from this table */
|
2016-09-27 17:57:56 +02:00
|
|
|
static int zebra_import_table_used[AFI_MAX][ZEBRA_KERNEL_TABLE_MAX];
|
2018-03-27 21:13:34 +02:00
|
|
|
static uint32_t zebra_import_table_distance[AFI_MAX][ZEBRA_KERNEL_TABLE_MAX];
|
2015-05-20 03:03:42 +02:00
|
|
|
|
2019-06-25 23:07:30 +02:00
|
|
|
int is_zebra_import_table_enabled(afi_t afi, vrf_id_t vrf_id, uint32_t table_id)
|
2015-05-20 03:03:42 +02:00
|
|
|
{
|
2017-08-25 14:07:58 +02:00
|
|
|
/*
|
|
|
|
* Make sure that what we are called with actualy makes sense
|
|
|
|
*/
|
|
|
|
if (afi == AFI_MAX)
|
|
|
|
return 0;
|
|
|
|
|
2018-03-16 05:02:56 +01:00
|
|
|
if (is_zebra_valid_kernel_table(table_id) &&
|
|
|
|
table_id < ZEBRA_KERNEL_TABLE_MAX)
|
2016-09-27 17:57:56 +02:00
|
|
|
return zebra_import_table_used[afi][table_id];
|
2015-05-20 03:03:42 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
*: add VRF ID in the API message header
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
2014-10-16 03:52:36 +02:00
|
|
|
static void zebra_redistribute_default(struct zserv *client, vrf_id_t vrf_id)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2016-10-06 14:18:41 +02:00
|
|
|
int afi;
|
|
|
|
struct prefix p;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct route_table *table;
|
|
|
|
struct route_node *rn;
|
2017-06-01 13:26:25 +02:00
|
|
|
struct route_entry *newre;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-06 14:18:41 +02:00
|
|
|
for (afi = AFI_IP; afi <= AFI_IP6; afi++) {
|
2020-03-08 23:48:20 +01:00
|
|
|
|
|
|
|
if (!vrf_bitmap_check(client->redist_default[afi], vrf_id))
|
|
|
|
continue;
|
|
|
|
|
2016-10-06 14:18:41 +02:00
|
|
|
/* Lookup table. */
|
|
|
|
table = zebra_vrf_table(afi, SAFI_UNICAST, vrf_id);
|
|
|
|
if (!table)
|
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-06 14:18:41 +02:00
|
|
|
/* Lookup default route. */
|
|
|
|
memset(&p, 0, sizeof(p));
|
|
|
|
p.family = afi2family(afi);
|
|
|
|
rn = route_node_lookup(table, &p);
|
|
|
|
if (!rn)
|
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-09-15 17:47:35 +02:00
|
|
|
RNODE_FOREACH_RE (rn, newre) {
|
2017-09-11 19:13:17 +02:00
|
|
|
if (CHECK_FLAG(newre->flags, ZEBRA_FLAG_SELECTED)
|
|
|
|
&& newre->distance != DISTANCE_INFINITY)
|
|
|
|
zsend_redistribute_route(
|
2017-09-15 17:47:35 +02:00
|
|
|
ZEBRA_REDISTRIBUTE_ROUTE_ADD, client,
|
|
|
|
&rn->p, NULL, newre);
|
2017-09-11 19:13:17 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-06 14:18:41 +02:00
|
|
|
route_unlock_node(rn);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Redistribute routes. */
|
2018-03-27 21:13:34 +02:00
|
|
|
static void zebra_redistribute(struct zserv *client, int type,
|
|
|
|
unsigned short instance, vrf_id_t vrf_id,
|
|
|
|
int afi)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-06-01 13:26:25 +02:00
|
|
|
struct route_entry *newre;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct route_table *table;
|
|
|
|
struct route_node *rn;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-17 01:58:34 +02:00
|
|
|
table = zebra_vrf_table(afi, SAFI_UNICAST, vrf_id);
|
|
|
|
if (!table)
|
|
|
|
return;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-08-22 15:57:55 +02:00
|
|
|
for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
|
2017-09-15 17:47:35 +02:00
|
|
|
RNODE_FOREACH_RE (rn, newre) {
|
2018-07-10 22:02:03 +02:00
|
|
|
const struct prefix *dst_p, *src_p;
|
2018-04-23 14:26:33 +02:00
|
|
|
char buf[PREFIX_STRLEN];
|
|
|
|
|
2017-05-18 12:15:04 +02:00
|
|
|
srcdest_rnode_prefixes(rn, &dst_p, &src_p);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-08-23 14:28:43 +02:00
|
|
|
if (IS_ZEBRA_DEBUG_RIB)
|
2017-05-17 01:58:34 +02:00
|
|
|
zlog_debug(
|
2018-05-29 16:33:04 +02:00
|
|
|
"%s: client %s %s(%u) checking: selected=%d, type=%d, distance=%d, metric=%d zebra_check_addr=%d",
|
2017-05-18 12:15:04 +02:00
|
|
|
__func__,
|
2018-03-09 16:53:32 +01:00
|
|
|
zebra_route_string(client->proto),
|
2018-04-23 14:26:33 +02:00
|
|
|
prefix2str(dst_p, buf, sizeof(buf)),
|
2018-03-09 16:53:32 +01:00
|
|
|
vrf_id, CHECK_FLAG(newre->flags,
|
|
|
|
ZEBRA_FLAG_SELECTED),
|
2017-06-01 13:26:25 +02:00
|
|
|
newre->type, newre->distance,
|
2018-04-23 14:26:33 +02:00
|
|
|
newre->metric, zebra_check_addr(dst_p));
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-06-01 13:26:25 +02:00
|
|
|
if (!CHECK_FLAG(newre->flags, ZEBRA_FLAG_SELECTED))
|
2017-05-17 01:58:34 +02:00
|
|
|
continue;
|
|
|
|
if ((type != ZEBRA_ROUTE_ALL
|
2017-06-01 13:26:25 +02:00
|
|
|
&& (newre->type != type
|
|
|
|
|| newre->instance != instance)))
|
2017-05-17 01:58:34 +02:00
|
|
|
continue;
|
2017-06-01 13:26:25 +02:00
|
|
|
if (newre->distance == DISTANCE_INFINITY)
|
2017-05-17 01:58:34 +02:00
|
|
|
continue;
|
2017-05-18 12:15:04 +02:00
|
|
|
if (!zebra_check_addr(dst_p))
|
2017-05-17 01:58:34 +02:00
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-08-21 03:10:50 +02:00
|
|
|
zsend_redistribute_route(ZEBRA_REDISTRIBUTE_ROUTE_ADD,
|
|
|
|
client, dst_p, src_p, newre);
|
2017-05-17 01:58:34 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2020-04-07 16:02:21 +02:00
|
|
|
/*
|
|
|
|
* Function to check if prefix is candidate for
|
|
|
|
* redistribute.
|
|
|
|
*/
|
|
|
|
static bool zebra_redistribute_check(const struct route_entry *re,
|
|
|
|
struct zserv *client,
|
|
|
|
const struct prefix *p, int afi)
|
|
|
|
{
|
|
|
|
/* Process only if there is valid re */
|
|
|
|
if (!re)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
/* If default route and redistributed */
|
|
|
|
if (is_default_prefix(p)
|
|
|
|
&& vrf_bitmap_check(client->redist_default[afi], re->vrf_id))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
/* If redistribute in enabled for zebra route all */
|
|
|
|
if (vrf_bitmap_check(client->redist[afi][ZEBRA_ROUTE_ALL], re->vrf_id))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If multi-instance then check for route
|
|
|
|
* redistribution for given instance.
|
|
|
|
*/
|
|
|
|
if (re->instance
|
|
|
|
&& redist_check_instance(&client->mi_redist[afi][re->type],
|
|
|
|
re->instance))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
/* If redistribution is enabled for give route type. */
|
|
|
|
if (vrf_bitmap_check(client->redist[afi][re->type], re->vrf_id))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-10-21 06:52:52 +02:00
|
|
|
/* Either advertise a route for redistribution to registered clients or */
|
|
|
|
/* withdraw redistribution if add cannot be done for client */
|
2018-07-10 22:02:03 +02:00
|
|
|
void redistribute_update(const struct prefix *p, const struct prefix *src_p,
|
2019-08-14 19:30:24 +02:00
|
|
|
const struct route_entry *re,
|
|
|
|
const struct route_entry *prev_re)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
struct listnode *node, *nnode;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct zserv *client;
|
2015-10-21 06:52:52 +02:00
|
|
|
int afi;
|
2018-04-23 14:26:33 +02:00
|
|
|
char buf[PREFIX_STRLEN];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-11-20 17:48:32 +01:00
|
|
|
if (IS_ZEBRA_DEBUG_RIB) {
|
2017-06-01 13:26:25 +02:00
|
|
|
zlog_debug(
|
2019-01-30 03:35:07 +01:00
|
|
|
"%u:%s: Redist update re %p (%s), old %p (%s)",
|
2018-04-23 14:26:33 +02:00
|
|
|
re->vrf_id, prefix2str(p, buf, sizeof(buf)),
|
2019-01-30 03:35:07 +01:00
|
|
|
re, zebra_route_string(re->type), prev_re,
|
|
|
|
prev_re ? zebra_route_string(prev_re->type) : "None");
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2017-06-01 13:26:25 +02:00
|
|
|
afi = family2afi(p->family);
|
|
|
|
if (!afi) {
|
2018-09-13 21:21:05 +02:00
|
|
|
flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF,
|
2020-03-17 13:57:42 +01:00
|
|
|
"%s: Unknown AFI/SAFI prefix received\n", __func__);
|
2017-06-01 13:26:25 +02:00
|
|
|
return;
|
2015-10-21 06:52:52 +02:00
|
|
|
}
|
2019-08-14 09:18:43 +02:00
|
|
|
if (!zebra_check_addr(p)) {
|
|
|
|
if (IS_ZEBRA_DEBUG_RIB)
|
|
|
|
zlog_debug("Redist update filter prefix %s",
|
|
|
|
prefix2str(p, buf, sizeof(buf)));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-01-11 19:38:19 +01:00
|
|
|
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
|
2020-04-07 16:02:21 +02:00
|
|
|
if (zebra_redistribute_check(re, client, p, afi)) {
|
2019-08-23 14:28:43 +02:00
|
|
|
if (IS_ZEBRA_DEBUG_RIB) {
|
2018-04-23 14:26:33 +02:00
|
|
|
zlog_debug(
|
2018-05-29 16:33:04 +02:00
|
|
|
"%s: client %s %s(%u), type=%d, distance=%d, metric=%d",
|
2018-04-23 14:26:33 +02:00
|
|
|
__func__,
|
|
|
|
zebra_route_string(client->proto),
|
|
|
|
prefix2str(p, buf, sizeof(buf)),
|
|
|
|
re->vrf_id, re->type,
|
|
|
|
re->distance, re->metric);
|
|
|
|
}
|
2017-08-21 03:10:50 +02:00
|
|
|
zsend_redistribute_route(ZEBRA_REDISTRIBUTE_ROUTE_ADD,
|
|
|
|
client, p, src_p, re);
|
2020-04-07 16:02:21 +02:00
|
|
|
} else if (zebra_redistribute_check(prev_re, client, p, afi))
|
2017-08-21 03:10:50 +02:00
|
|
|
zsend_redistribute_route(ZEBRA_REDISTRIBUTE_ROUTE_DEL,
|
|
|
|
client, p, src_p, prev_re);
|
2015-10-21 06:52:52 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2019-08-14 19:30:24 +02:00
|
|
|
/*
|
|
|
|
* During a route delete, where 'new_re' is NULL, redist a delete to all
|
|
|
|
* clients registered for the type of 'old_re'.
|
|
|
|
* During a route update, redist a delete to any clients who will not see
|
|
|
|
* an update when the new route is installed. There are cases when a client
|
|
|
|
* may have seen a redist for 'old_re', but will not see
|
|
|
|
* the redist for 'new_re'.
|
|
|
|
*/
|
2018-07-10 22:02:03 +02:00
|
|
|
void redistribute_delete(const struct prefix *p, const struct prefix *src_p,
|
2019-08-14 19:30:24 +02:00
|
|
|
const struct route_entry *old_re,
|
|
|
|
const struct route_entry *new_re)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
struct listnode *node, *nnode;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct zserv *client;
|
2015-05-22 12:41:00 +02:00
|
|
|
int afi;
|
2019-08-14 19:30:24 +02:00
|
|
|
char buf[PREFIX_STRLEN];
|
|
|
|
vrf_id_t vrfid;
|
|
|
|
|
|
|
|
if (old_re)
|
|
|
|
vrfid = old_re->vrf_id;
|
|
|
|
else if (new_re)
|
|
|
|
vrfid = new_re->vrf_id;
|
|
|
|
else
|
|
|
|
return;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-11-20 17:48:32 +01:00
|
|
|
if (IS_ZEBRA_DEBUG_RIB) {
|
2019-08-14 19:30:24 +02:00
|
|
|
zlog_debug(
|
|
|
|
"%u:%s: Redist del: re %p (%s), new re %p (%s)",
|
|
|
|
vrfid, prefix2str(p, buf, sizeof(buf)),
|
|
|
|
old_re,
|
|
|
|
old_re ? zebra_route_string(old_re->type) : "None",
|
|
|
|
new_re,
|
|
|
|
new_re ? zebra_route_string(new_re->type) : "None");
|
2015-11-20 17:48:32 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Add DISTANCE_INFINITY check. */
|
2019-10-02 15:29:19 +02:00
|
|
|
if (old_re && (old_re->distance == DISTANCE_INFINITY)) {
|
|
|
|
if (IS_ZEBRA_DEBUG_RIB)
|
2020-03-24 17:38:20 +01:00
|
|
|
zlog_debug(" Skipping due to Infinite Distance");
|
2002-12-13 21:15:29 +01:00
|
|
|
return;
|
2019-10-02 15:29:19 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-22 12:41:00 +02:00
|
|
|
afi = family2afi(p->family);
|
|
|
|
if (!afi) {
|
2018-09-13 21:21:05 +02:00
|
|
|
flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF,
|
2018-08-16 22:10:32 +02:00
|
|
|
"%s: Unknown AFI/SAFI prefix received\n",
|
2019-08-14 19:30:24 +02:00
|
|
|
__func__);
|
2015-05-22 12:41:00 +02:00
|
|
|
return;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-08-14 19:30:24 +02:00
|
|
|
/* Skip invalid (e.g. linklocal) prefix */
|
2019-08-14 09:18:43 +02:00
|
|
|
if (!zebra_check_addr(p)) {
|
2019-08-14 19:30:24 +02:00
|
|
|
if (IS_ZEBRA_DEBUG_RIB) {
|
|
|
|
zlog_debug(
|
|
|
|
"%u:%s: Redist del old: skipping invalid prefix",
|
|
|
|
vrfid, prefix2str(p, buf, sizeof(buf)));
|
|
|
|
}
|
2019-08-14 09:18:43 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-01-11 19:38:19 +01:00
|
|
|
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
|
2020-03-06 16:33:40 +01:00
|
|
|
/* Do not send unsolicited messages to synchronous clients. */
|
|
|
|
if (client->synchronous)
|
|
|
|
continue;
|
2020-04-07 16:02:21 +02:00
|
|
|
/*
|
|
|
|
* Skip this client if it will receive an update for the
|
|
|
|
* 'new' re
|
|
|
|
*/
|
|
|
|
if (zebra_redistribute_check(new_re, client, p, afi))
|
|
|
|
continue;
|
2019-08-14 19:30:24 +02:00
|
|
|
|
|
|
|
/* Send a delete for the 'old' re to any subscribed client. */
|
2020-04-07 16:02:21 +02:00
|
|
|
if (zebra_redistribute_check(old_re, client, p, afi))
|
2017-08-21 03:10:50 +02:00
|
|
|
zsend_redistribute_route(ZEBRA_REDISTRIBUTE_ROUTE_DEL,
|
2019-08-14 19:30:24 +02:00
|
|
|
client, p, src_p, old_re);
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2020-04-07 16:02:21 +02:00
|
|
|
|
2018-03-06 23:57:33 +01:00
|
|
|
void zebra_redistribute_add(ZAPI_HANDLER_ARGS)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-11-10 14:51:34 +01:00
|
|
|
afi_t afi = 0;
|
|
|
|
int type = 0;
|
2018-03-27 21:13:34 +02:00
|
|
|
unsigned short instance;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2018-03-07 00:08:37 +01:00
|
|
|
STREAM_GETC(msg, afi);
|
|
|
|
STREAM_GETC(msg, type);
|
|
|
|
STREAM_GETW(msg, instance);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2018-03-09 16:53:32 +01:00
|
|
|
if (IS_ZEBRA_DEBUG_EVENT)
|
|
|
|
zlog_debug(
|
2020-02-14 14:41:04 +01:00
|
|
|
"%s: client proto %s afi=%d, wants %s, vrf %s(%u), instance=%d",
|
2018-03-09 16:53:32 +01:00
|
|
|
__func__, zebra_route_string(client->proto), afi,
|
2020-02-14 14:41:04 +01:00
|
|
|
zebra_route_string(type), VRF_LOGNAME(zvrf->vrf),
|
|
|
|
zvrf_id(zvrf), instance);
|
2018-03-09 16:53:32 +01:00
|
|
|
|
2018-07-02 16:30:40 +02:00
|
|
|
if (afi == 0 || afi >= AFI_MAX) {
|
2018-09-13 21:21:05 +02:00
|
|
|
flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF,
|
2020-03-05 19:17:54 +01:00
|
|
|
"%s: Specified afi %d does not exist", __func__, afi);
|
2009-08-27 00:27:40 +02:00
|
|
|
return;
|
2017-11-10 14:51:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (type == 0 || type >= ZEBRA_ROUTE_MAX) {
|
2018-08-16 22:10:32 +02:00
|
|
|
zlog_debug("%s: Specified Route Type %d does not exist",
|
2020-03-05 19:17:54 +01:00
|
|
|
__func__, type);
|
2017-11-10 14:51:34 +01:00
|
|
|
return;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-06 15:38:55 +02:00
|
|
|
if (instance) {
|
|
|
|
if (!redist_check_instance(&client->mi_redist[afi][type],
|
|
|
|
instance)) {
|
|
|
|
redist_add_instance(&client->mi_redist[afi][type],
|
|
|
|
instance);
|
2017-05-17 01:58:34 +02:00
|
|
|
zebra_redistribute(client, type, instance,
|
|
|
|
zvrf_id(zvrf), afi);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2017-05-17 01:58:34 +02:00
|
|
|
} else {
|
|
|
|
if (!vrf_bitmap_check(client->redist[afi][type],
|
2016-10-30 22:50:26 +01:00
|
|
|
zvrf_id(zvrf))) {
|
2018-03-09 16:53:32 +01:00
|
|
|
if (IS_ZEBRA_DEBUG_EVENT)
|
2020-02-14 14:41:04 +01:00
|
|
|
zlog_debug(
|
|
|
|
"%s: setting vrf %s(%u) redist bitmap",
|
|
|
|
__func__, VRF_LOGNAME(zvrf->vrf),
|
|
|
|
zvrf_id(zvrf));
|
2016-10-30 22:50:26 +01:00
|
|
|
vrf_bitmap_set(client->redist[afi][type],
|
|
|
|
zvrf_id(zvrf));
|
2017-05-17 01:58:34 +02:00
|
|
|
zebra_redistribute(client, type, 0, zvrf_id(zvrf), afi);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2016-10-06 15:38:55 +02:00
|
|
|
}
|
2017-11-10 14:51:34 +01:00
|
|
|
|
|
|
|
stream_failure:
|
|
|
|
return;
|
2009-08-27 00:27:40 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2018-03-06 23:57:33 +01:00
|
|
|
void zebra_redistribute_delete(ZAPI_HANDLER_ARGS)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-11-10 14:51:34 +01:00
|
|
|
afi_t afi = 0;
|
|
|
|
int type = 0;
|
2018-03-27 21:13:34 +02:00
|
|
|
unsigned short instance;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2018-03-07 00:08:37 +01:00
|
|
|
STREAM_GETC(msg, afi);
|
|
|
|
STREAM_GETC(msg, type);
|
|
|
|
STREAM_GETW(msg, instance);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2018-07-02 16:30:40 +02:00
|
|
|
if (afi == 0 || afi >= AFI_MAX) {
|
2018-09-13 21:21:05 +02:00
|
|
|
flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF,
|
2020-03-05 19:17:54 +01:00
|
|
|
"%s: Specified afi %d does not exist", __func__, afi);
|
2009-08-27 00:27:40 +02:00
|
|
|
return;
|
2017-11-10 14:51:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (type == 0 || type >= ZEBRA_ROUTE_MAX) {
|
2018-08-16 22:10:32 +02:00
|
|
|
zlog_debug("%s: Specified Route Type %d does not exist",
|
2020-03-05 19:17:54 +01:00
|
|
|
__func__, type);
|
2017-11-10 14:51:34 +01:00
|
|
|
return;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-06 15:38:55 +02:00
|
|
|
/*
|
|
|
|
* NOTE: no need to withdraw the previously advertised routes. The
|
|
|
|
* clients
|
|
|
|
* themselves should keep track of the received routes from zebra and
|
|
|
|
* withdraw them when necessary.
|
|
|
|
*/
|
|
|
|
if (instance)
|
2016-10-13 18:06:10 +02:00
|
|
|
redist_del_instance(&client->mi_redist[afi][type], instance);
|
2016-10-06 15:38:55 +02:00
|
|
|
else
|
2016-10-30 22:50:26 +01:00
|
|
|
vrf_bitmap_unset(client->redist[afi][type], zvrf_id(zvrf));
|
2017-11-10 14:51:34 +01:00
|
|
|
|
|
|
|
stream_failure:
|
|
|
|
return;
|
2009-08-27 00:27:40 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2018-03-06 23:57:33 +01:00
|
|
|
void zebra_redistribute_default_add(ZAPI_HANDLER_ARGS)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2019-01-11 22:20:13 +01:00
|
|
|
afi_t afi = 0;
|
|
|
|
|
|
|
|
STREAM_GETC(msg, afi);
|
|
|
|
|
|
|
|
if (afi == 0 || afi >= AFI_MAX) {
|
|
|
|
flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF,
|
2020-03-05 19:17:54 +01:00
|
|
|
"%s: Specified afi %u does not exist", __func__, afi);
|
2019-01-11 22:20:13 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
vrf_bitmap_set(client->redist_default[afi], zvrf_id(zvrf));
|
2016-10-30 22:50:26 +01:00
|
|
|
zebra_redistribute_default(client, zvrf_id(zvrf));
|
2019-01-11 22:20:13 +01:00
|
|
|
|
|
|
|
stream_failure:
|
|
|
|
return;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2018-03-06 23:57:33 +01:00
|
|
|
void zebra_redistribute_default_delete(ZAPI_HANDLER_ARGS)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2019-01-11 22:20:13 +01:00
|
|
|
afi_t afi = 0;
|
|
|
|
|
|
|
|
STREAM_GETC(msg, afi);
|
|
|
|
|
|
|
|
if (afi == 0 || afi >= AFI_MAX) {
|
|
|
|
flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF,
|
2020-03-05 19:17:54 +01:00
|
|
|
"%s: Specified afi %u does not exist", __func__, afi);
|
2019-01-11 22:20:13 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
vrf_bitmap_unset(client->redist_default[afi], zvrf_id(zvrf));
|
|
|
|
|
|
|
|
stream_failure:
|
|
|
|
return;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Interface up information. */
|
|
|
|
void zebra_interface_up_update(struct interface *ifp)
|
|
|
|
{
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
struct listnode *node, *nnode;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct zserv *client;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_ZEBRA_DEBUG_EVENT)
|
2018-05-29 16:33:04 +02:00
|
|
|
zlog_debug("MESSAGE: ZEBRA_INTERFACE_UP %s(%u)",
|
2019-06-24 01:46:39 +02:00
|
|
|
ifp->name, ifp->vrf_id);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-20 02:40:44 +02:00
|
|
|
if (ifp->ptm_status || !ifp->ptm_enable) {
|
2019-01-11 19:38:19 +01:00
|
|
|
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode,
|
2019-02-04 17:45:31 +01:00
|
|
|
client)) {
|
2020-03-06 16:33:40 +01:00
|
|
|
/* Do not send unsolicited messages to synchronous
|
|
|
|
* clients.
|
|
|
|
*/
|
|
|
|
if (client->synchronous)
|
|
|
|
continue;
|
|
|
|
|
2019-02-04 17:45:31 +01:00
|
|
|
zsend_interface_update(ZEBRA_INTERFACE_UP,
|
|
|
|
client, ifp);
|
|
|
|
zsend_interface_link_params(client, ifp);
|
|
|
|
}
|
Update Traffic Engineering Support for OSPFD
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-04-19 16:21:46 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Interface down information. */
|
|
|
|
void zebra_interface_down_update(struct interface *ifp)
|
|
|
|
{
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
struct listnode *node, *nnode;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct zserv *client;
|
|
|
|
|
|
|
|
if (IS_ZEBRA_DEBUG_EVENT)
|
2018-05-29 16:33:04 +02:00
|
|
|
zlog_debug("MESSAGE: ZEBRA_INTERFACE_DOWN %s(%u)",
|
2019-06-24 01:46:39 +02:00
|
|
|
ifp->name, ifp->vrf_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2019-01-11 19:38:19 +01:00
|
|
|
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
|
2020-03-06 16:33:40 +01:00
|
|
|
/* Do not send unsolicited messages to synchronous clients. */
|
|
|
|
if (client->synchronous)
|
|
|
|
continue;
|
|
|
|
|
2015-05-20 02:47:22 +02:00
|
|
|
zsend_interface_update(ZEBRA_INTERFACE_DOWN, client, ifp);
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Interface information update. */
|
|
|
|
void zebra_interface_add_update(struct interface *ifp)
|
|
|
|
{
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
struct listnode *node, *nnode;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct zserv *client;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_ZEBRA_DEBUG_EVENT)
|
2018-05-29 16:33:04 +02:00
|
|
|
zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADD %s(%u)", ifp->name,
|
2019-06-24 01:46:39 +02:00
|
|
|
ifp->vrf_id);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-02-04 17:45:31 +01:00
|
|
|
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
|
2020-03-06 16:33:40 +01:00
|
|
|
/* Do not send unsolicited messages to synchronous clients. */
|
|
|
|
if (client->synchronous)
|
|
|
|
continue;
|
|
|
|
|
2019-02-04 17:45:31 +01:00
|
|
|
client->ifadd_cnt++;
|
|
|
|
zsend_interface_add(client, ifp);
|
|
|
|
zsend_interface_link_params(client, ifp);
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void zebra_interface_delete_update(struct interface *ifp)
|
|
|
|
{
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
struct listnode *node, *nnode;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct zserv *client;
|
|
|
|
|
|
|
|
if (IS_ZEBRA_DEBUG_EVENT)
|
2018-05-29 16:33:04 +02:00
|
|
|
zlog_debug("MESSAGE: ZEBRA_INTERFACE_DELETE %s(%u)",
|
2019-06-24 01:46:39 +02:00
|
|
|
ifp->name, ifp->vrf_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2019-01-11 19:38:19 +01:00
|
|
|
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
|
2020-03-06 16:33:40 +01:00
|
|
|
/* Do not send unsolicited messages to synchronous clients. */
|
|
|
|
if (client->synchronous)
|
|
|
|
continue;
|
|
|
|
|
2016-04-22 02:12:26 +02:00
|
|
|
client->ifdel_cnt++;
|
|
|
|
zsend_interface_delete(client, ifp);
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Interface address addition. */
|
|
|
|
void zebra_interface_address_add_update(struct interface *ifp,
|
|
|
|
struct connected *ifc)
|
|
|
|
{
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
struct listnode *node, *nnode;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct zserv *client;
|
|
|
|
struct prefix *p;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_ZEBRA_DEBUG_EVENT) {
|
2015-05-23 10:08:41 +02:00
|
|
|
char buf[PREFIX_STRLEN];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
p = ifc->address;
|
2018-05-29 16:33:04 +02:00
|
|
|
zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADDRESS_ADD %s on %s(%u)",
|
|
|
|
prefix2str(p, buf, sizeof(buf)), ifp->name,
|
2019-06-24 01:46:39 +02:00
|
|
|
ifp->vrf_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2013-01-24 15:04:47 +01:00
|
|
|
if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))
|
2018-08-16 22:10:32 +02:00
|
|
|
flog_warn(
|
2018-09-13 21:21:05 +02:00
|
|
|
EC_ZEBRA_ADVERTISING_UNUSABLE_ADDR,
|
2013-01-24 15:04:47 +01:00
|
|
|
"WARNING: advertising address to clients that is not yet usable.");
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-06-28 10:51:10 +02:00
|
|
|
zebra_vxlan_add_del_gw_macip(ifp, ifc->address, 1);
|
|
|
|
|
2004-10-03 20:18:34 +02:00
|
|
|
router_id_add_address(ifc);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-03-06 16:33:40 +01:00
|
|
|
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
|
|
|
|
/* Do not send unsolicited messages to synchronous clients. */
|
|
|
|
if (client->synchronous)
|
|
|
|
continue;
|
|
|
|
|
2016-04-22 02:12:26 +02:00
|
|
|
if (CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL)) {
|
2015-05-20 02:47:22 +02:00
|
|
|
client->connected_rt_add_cnt++;
|
|
|
|
zsend_interface_address(ZEBRA_INTERFACE_ADDRESS_ADD,
|
|
|
|
client, ifp, ifc);
|
|
|
|
}
|
2020-03-06 16:33:40 +01:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Interface address deletion. */
|
|
|
|
void zebra_interface_address_delete_update(struct interface *ifp,
|
|
|
|
struct connected *ifc)
|
|
|
|
{
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
struct listnode *node, *nnode;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct zserv *client;
|
|
|
|
struct prefix *p;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
if (IS_ZEBRA_DEBUG_EVENT) {
|
2015-05-23 10:08:41 +02:00
|
|
|
char buf[PREFIX_STRLEN];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
p = ifc->address;
|
2018-05-29 16:33:04 +02:00
|
|
|
zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADDRESS_DELETE %s on %s(%u)",
|
|
|
|
prefix2str(p, buf, sizeof(buf)),
|
2019-06-24 01:46:39 +02:00
|
|
|
ifp->name, ifp->vrf_id);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-06-28 10:51:10 +02:00
|
|
|
zebra_vxlan_add_del_gw_macip(ifp, ifc->address, 0);
|
|
|
|
|
2004-10-03 20:18:34 +02:00
|
|
|
router_id_del_address(ifc);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-03-06 16:33:40 +01:00
|
|
|
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
|
|
|
|
/* Do not send unsolicited messages to synchronous clients. */
|
|
|
|
if (client->synchronous)
|
|
|
|
continue;
|
|
|
|
|
2016-04-22 02:12:26 +02:00
|
|
|
if (CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL)) {
|
2015-05-20 02:47:22 +02:00
|
|
|
client->connected_rt_del_cnt++;
|
|
|
|
zsend_interface_address(ZEBRA_INTERFACE_ADDRESS_DELETE,
|
|
|
|
client, ifp, ifc);
|
|
|
|
}
|
2020-03-06 16:33:40 +01:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2015-05-20 02:47:23 +02:00
|
|
|
|
2016-02-25 20:30:53 +01:00
|
|
|
/* Interface VRF change. May need to delete from clients not interested in
|
|
|
|
* the new VRF. Note that this function is invoked *prior* to the VRF change.
|
|
|
|
*/
|
|
|
|
void zebra_interface_vrf_update_del(struct interface *ifp, vrf_id_t new_vrf_id)
|
|
|
|
{
|
|
|
|
struct listnode *node, *nnode;
|
|
|
|
struct zserv *client;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-02-25 20:30:53 +01:00
|
|
|
if (IS_ZEBRA_DEBUG_EVENT)
|
|
|
|
zlog_debug(
|
|
|
|
"MESSAGE: ZEBRA_INTERFACE_VRF_UPDATE/DEL %s VRF Id %u -> %u",
|
2019-06-24 01:46:39 +02:00
|
|
|
ifp->name, ifp->vrf_id, new_vrf_id);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-01-11 19:38:19 +01:00
|
|
|
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
|
2020-03-06 16:33:40 +01:00
|
|
|
/* Do not send unsolicited messages to synchronous clients. */
|
|
|
|
if (client->synchronous)
|
|
|
|
continue;
|
|
|
|
|
2016-04-22 02:12:26 +02:00
|
|
|
/* Need to delete if the client is not interested in the new
|
|
|
|
* VRF. */
|
|
|
|
zsend_interface_update(ZEBRA_INTERFACE_DOWN, client, ifp);
|
|
|
|
client->ifdel_cnt++;
|
|
|
|
zsend_interface_delete(client, ifp);
|
|
|
|
zsend_interface_vrf_update(client, ifp, new_vrf_id);
|
2016-02-25 20:30:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Interface VRF change. This function is invoked *post* VRF change and sends an
|
|
|
|
* add to clients who are interested in the new VRF but not in the old VRF.
|
|
|
|
*/
|
|
|
|
void zebra_interface_vrf_update_add(struct interface *ifp, vrf_id_t old_vrf_id)
|
|
|
|
{
|
|
|
|
struct listnode *node, *nnode;
|
|
|
|
struct zserv *client;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-02-25 20:30:53 +01:00
|
|
|
if (IS_ZEBRA_DEBUG_EVENT)
|
|
|
|
zlog_debug(
|
|
|
|
"MESSAGE: ZEBRA_INTERFACE_VRF_UPDATE/ADD %s VRF Id %u -> %u",
|
2019-06-24 01:46:39 +02:00
|
|
|
ifp->name, old_vrf_id, ifp->vrf_id);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-01-11 19:38:19 +01:00
|
|
|
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
|
2020-03-06 16:33:40 +01:00
|
|
|
/* Do not send unsolicited messages to synchronous clients. */
|
|
|
|
if (client->synchronous)
|
|
|
|
continue;
|
|
|
|
|
2016-02-25 20:30:53 +01:00
|
|
|
/* Need to add if the client is interested in the new VRF. */
|
|
|
|
client->ifadd_cnt++;
|
|
|
|
zsend_interface_add(client, ifp);
|
|
|
|
zsend_interface_addresses(client, ifp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-25 23:07:30 +02:00
|
|
|
int zebra_add_import_table_entry(struct zebra_vrf *zvrf, struct route_node *rn,
|
|
|
|
struct route_entry *re, const char *rmap_name)
|
2015-05-20 03:03:42 +02:00
|
|
|
{
|
2017-06-01 13:26:25 +02:00
|
|
|
struct route_entry *newre;
|
|
|
|
struct route_entry *same;
|
2016-08-24 08:20:47 +02:00
|
|
|
struct prefix p;
|
2019-11-22 21:30:53 +01:00
|
|
|
struct nexthop_group *ng;
|
lib: Introducing a 3rd state for route-map match cmd: RMAP_NOOP
Introducing a 3rd state for route_map_apply library function: RMAP_NOOP
Traditionally route map MATCH rule apis were designed to return
a binary response, consisting of either RMAP_MATCH or RMAP_NOMATCH.
(Route-map SET rule apis return RMAP_OKAY or RMAP_ERROR).
Depending on this response, the following statemachine decided the
course of action:
State1:
If match cmd returns RMAP_MATCH then, keep existing behaviour.
If routemap type is PERMIT, execute set cmds or call cmds if applicable,
otherwise PERMIT!
Else If routemap type is DENY, we DENYMATCH right away
State2:
If match cmd returns RMAP_NOMATCH, continue on to next route-map. If there
are no other rules or if all the rules return RMAP_NOMATCH, return DENYMATCH
We require a 3rd state because of the following situation:
The issue - what if, the rule api needs to abort or ignore a rule?:
"match evpn vni xx" route-map filter can be applied to incoming routes
regardless of whether the tunnel type is vxlan or mpls.
This rule should be N/A for mpls based evpn route, but applicable to only
vxlan based evpn route.
Also, this rule should be applicable for routes with VNI label only, and
not for routes without labels. For example, type 3 and type 4 EVPN routes
do not have labels, so, this match cmd should let them through.
Today, the filter produces either a match or nomatch response regardless of
whether it is mpls/vxlan, resulting in either permitting or denying the
route.. So an mpls evpn route may get filtered out incorrectly.
Eg: "route-map RM1 permit 10 ; match evpn vni 20" or
"route-map RM2 deny 20 ; match vni 20"
With the introduction of the 3rd state, we can abort this rule check safely.
How? The rules api can now return RMAP_NOOP to indicate
that it encountered an invalid check, and needs to abort just that rule,
but continue with other rules.
As a result we have a 3rd state:
State3:
If match cmd returned RMAP_NOOP
Then, proceed to other route-map, otherwise if there are no more
rules or if all the rules return RMAP_NOOP, then, return RMAP_PERMITMATCH.
Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-06-19 23:04:36 +02:00
|
|
|
route_map_result_t ret = RMAP_PERMITMATCH;
|
2017-08-31 22:07:36 +02:00
|
|
|
afi_t afi;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-08-31 22:07:36 +02:00
|
|
|
afi = family2afi(rn->p.family);
|
2016-05-11 17:47:02 +02:00
|
|
|
if (rmap_name)
|
2017-06-01 13:26:25 +02:00
|
|
|
ret = zebra_import_table_route_map_check(
|
2019-11-22 21:30:53 +01:00
|
|
|
afi, re->type, re->instance, &rn->p,
|
2020-02-25 14:29:46 +01:00
|
|
|
re->nhe->nhg.nexthop,
|
2019-06-25 23:07:30 +02:00
|
|
|
zvrf->vrf->vrf_id, re->tag, rmap_name);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
lib: Introducing a 3rd state for route-map match cmd: RMAP_NOOP
Introducing a 3rd state for route_map_apply library function: RMAP_NOOP
Traditionally route map MATCH rule apis were designed to return
a binary response, consisting of either RMAP_MATCH or RMAP_NOMATCH.
(Route-map SET rule apis return RMAP_OKAY or RMAP_ERROR).
Depending on this response, the following statemachine decided the
course of action:
State1:
If match cmd returns RMAP_MATCH then, keep existing behaviour.
If routemap type is PERMIT, execute set cmds or call cmds if applicable,
otherwise PERMIT!
Else If routemap type is DENY, we DENYMATCH right away
State2:
If match cmd returns RMAP_NOMATCH, continue on to next route-map. If there
are no other rules or if all the rules return RMAP_NOMATCH, return DENYMATCH
We require a 3rd state because of the following situation:
The issue - what if, the rule api needs to abort or ignore a rule?:
"match evpn vni xx" route-map filter can be applied to incoming routes
regardless of whether the tunnel type is vxlan or mpls.
This rule should be N/A for mpls based evpn route, but applicable to only
vxlan based evpn route.
Also, this rule should be applicable for routes with VNI label only, and
not for routes without labels. For example, type 3 and type 4 EVPN routes
do not have labels, so, this match cmd should let them through.
Today, the filter produces either a match or nomatch response regardless of
whether it is mpls/vxlan, resulting in either permitting or denying the
route.. So an mpls evpn route may get filtered out incorrectly.
Eg: "route-map RM1 permit 10 ; match evpn vni 20" or
"route-map RM2 deny 20 ; match vni 20"
With the introduction of the 3rd state, we can abort this rule check safely.
How? The rules api can now return RMAP_NOOP to indicate
that it encountered an invalid check, and needs to abort just that rule,
but continue with other rules.
As a result we have a 3rd state:
State3:
If match cmd returned RMAP_NOOP
Then, proceed to other route-map, otherwise if there are no more
rules or if all the rules return RMAP_NOOP, then, return RMAP_PERMITMATCH.
Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-06-19 23:04:36 +02:00
|
|
|
if (ret != RMAP_PERMITMATCH) {
|
2018-04-17 19:48:30 +02:00
|
|
|
UNSET_FLAG(re->flags, ZEBRA_FLAG_SELECTED);
|
2019-06-25 23:07:30 +02:00
|
|
|
zebra_del_import_table_entry(zvrf, rn, re);
|
2017-08-31 21:25:54 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-08-31 22:07:36 +02:00
|
|
|
prefix_copy(&p, &rn->p);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-09-15 17:47:35 +02:00
|
|
|
RNODE_FOREACH_RE (rn, same) {
|
|
|
|
if (CHECK_FLAG(same->status, ROUTE_ENTRY_REMOVED))
|
2017-08-31 22:07:36 +02:00
|
|
|
continue;
|
2017-08-31 21:25:54 +02:00
|
|
|
|
2018-03-06 20:02:52 +01:00
|
|
|
if (same->type == re->type && same->instance == re->instance
|
2017-08-31 22:07:36 +02:00
|
|
|
&& same->table == re->table
|
|
|
|
&& same->type != ZEBRA_ROUTE_CONNECT)
|
|
|
|
break;
|
|
|
|
}
|
2017-08-31 21:25:54 +02:00
|
|
|
|
2018-04-15 21:25:24 +02:00
|
|
|
if (same) {
|
|
|
|
UNSET_FLAG(same->flags, ZEBRA_FLAG_SELECTED);
|
2019-06-25 23:07:30 +02:00
|
|
|
zebra_del_import_table_entry(zvrf, rn, same);
|
2018-04-15 21:25:24 +02:00
|
|
|
}
|
2017-08-31 22:07:36 +02:00
|
|
|
|
2018-03-06 20:02:52 +01:00
|
|
|
newre = XCALLOC(MTYPE_RE, sizeof(struct route_entry));
|
2017-10-04 15:41:49 +02:00
|
|
|
newre->type = ZEBRA_ROUTE_TABLE;
|
|
|
|
newre->distance = zebra_import_table_distance[afi][re->table];
|
|
|
|
newre->flags = re->flags;
|
|
|
|
newre->metric = re->metric;
|
|
|
|
newre->mtu = re->mtu;
|
2019-06-25 23:10:12 +02:00
|
|
|
newre->table = zvrf->table_id;
|
2019-05-11 07:44:42 +02:00
|
|
|
newre->uptime = monotime(NULL);
|
2017-10-04 15:41:49 +02:00
|
|
|
newre->instance = re->table;
|
|
|
|
|
2019-11-22 21:30:53 +01:00
|
|
|
ng = nexthop_group_new();
|
2020-02-25 14:29:46 +01:00
|
|
|
copy_nexthops(&ng->nexthop, re->nhe->nhg.nexthop, NULL);
|
2019-11-22 21:30:53 +01:00
|
|
|
|
|
|
|
rib_add_multipath(afi, SAFI_UNICAST, &p, NULL, newre, ng);
|
2017-10-04 15:41:49 +02:00
|
|
|
|
2015-05-20 03:03:42 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-06-25 23:07:30 +02:00
|
|
|
int zebra_del_import_table_entry(struct zebra_vrf *zvrf, struct route_node *rn,
|
|
|
|
struct route_entry *re)
|
2015-05-20 03:03:42 +02:00
|
|
|
{
|
2016-08-24 07:39:08 +02:00
|
|
|
struct prefix p;
|
2017-08-31 22:07:36 +02:00
|
|
|
afi_t afi;
|
2015-05-20 03:03:42 +02:00
|
|
|
|
2017-08-31 22:07:36 +02:00
|
|
|
afi = family2afi(rn->p.family);
|
|
|
|
prefix_copy(&p, &rn->p);
|
2015-05-20 03:03:42 +02:00
|
|
|
|
2019-06-25 23:07:30 +02:00
|
|
|
rib_delete(afi, SAFI_UNICAST, zvrf->vrf->vrf_id, ZEBRA_ROUTE_TABLE,
|
2020-02-25 14:29:46 +01:00
|
|
|
re->table, re->flags, &p, NULL, re->nhe->nhg.nexthop,
|
2019-11-22 21:30:53 +01:00
|
|
|
re->nhe_id, zvrf->table_id, re->metric, re->distance,
|
|
|
|
false);
|
2015-05-20 03:03:42 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Assuming no one calls this with the main routing table */
|
2019-06-25 23:07:30 +02:00
|
|
|
int zebra_import_table(afi_t afi, vrf_id_t vrf_id, uint32_t table_id,
|
|
|
|
uint32_t distance, const char *rmap_name, int add)
|
2015-05-20 03:03:42 +02:00
|
|
|
{
|
|
|
|
struct route_table *table;
|
2017-06-01 13:26:25 +02:00
|
|
|
struct route_entry *re;
|
2015-05-20 03:03:42 +02:00
|
|
|
struct route_node *rn;
|
2019-06-25 23:07:30 +02:00
|
|
|
struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(vrf_id);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-20 03:03:42 +02:00
|
|
|
if (!is_zebra_valid_kernel_table(table_id)
|
2019-05-04 02:54:20 +02:00
|
|
|
|| (table_id == RT_TABLE_MAIN))
|
2020-02-09 13:21:56 +01:00
|
|
|
return -1;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-05-11 17:47:02 +02:00
|
|
|
if (afi >= AFI_MAX)
|
2020-02-09 13:21:56 +01:00
|
|
|
return -1;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-11-01 20:52:47 +01:00
|
|
|
table = zebra_vrf_get_table_with_table_id(afi, SAFI_UNICAST, vrf_id,
|
|
|
|
table_id);
|
2016-05-11 17:47:02 +02:00
|
|
|
if (table == NULL) {
|
|
|
|
return 0;
|
|
|
|
} else if (IS_ZEBRA_DEBUG_RIB) {
|
2015-05-20 03:03:42 +02:00
|
|
|
zlog_debug("%s routes from table %d",
|
|
|
|
add ? "Importing" : "Unimporting", table_id);
|
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
if (add) {
|
2017-06-01 13:26:25 +02:00
|
|
|
if (rmap_name)
|
2016-05-11 17:47:02 +02:00
|
|
|
zebra_add_import_table_route_map(afi, rmap_name,
|
2015-05-20 03:03:42 +02:00
|
|
|
table_id);
|
2017-07-17 14:03:14 +02:00
|
|
|
else {
|
2016-05-11 17:47:02 +02:00
|
|
|
rmap_name =
|
2015-05-20 03:03:42 +02:00
|
|
|
zebra_get_import_table_route_map(afi, table_id);
|
2018-04-19 23:04:05 +02:00
|
|
|
if (rmap_name) {
|
2016-05-11 17:47:02 +02:00
|
|
|
zebra_del_import_table_route_map(afi, table_id);
|
2018-04-19 23:04:05 +02:00
|
|
|
rmap_name = NULL;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2015-05-20 03:03:42 +02:00
|
|
|
|
2015-05-20 03:04:26 +02:00
|
|
|
zebra_import_table_used[afi][table_id] = 1;
|
|
|
|
zebra_import_table_distance[afi][table_id] = distance;
|
2017-07-17 14:03:14 +02:00
|
|
|
} else {
|
2015-05-20 03:04:26 +02:00
|
|
|
zebra_import_table_used[afi][table_id] = 0;
|
|
|
|
zebra_import_table_distance[afi][table_id] =
|
|
|
|
ZEBRA_TABLE_DISTANCE_DEFAULT;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-06-01 13:26:25 +02:00
|
|
|
rmap_name = zebra_get_import_table_route_map(afi, table_id);
|
2018-04-19 23:04:05 +02:00
|
|
|
if (rmap_name) {
|
2017-06-01 13:26:25 +02:00
|
|
|
zebra_del_import_table_route_map(afi, table_id);
|
2018-04-19 23:04:05 +02:00
|
|
|
rmap_name = NULL;
|
|
|
|
}
|
2015-05-20 03:03:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
for (rn = route_top(table); rn; rn = route_next(rn)) {
|
|
|
|
/* For each entry in the non-default routing table,
|
|
|
|
* add the entry in the main table
|
2017-07-17 14:03:14 +02:00
|
|
|
*/
|
2015-05-20 03:03:42 +02:00
|
|
|
if (!rn->info)
|
2016-05-11 17:47:02 +02:00
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-09-15 17:47:35 +02:00
|
|
|
RNODE_FOREACH_RE (rn, re) {
|
2016-05-11 17:47:02 +02:00
|
|
|
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
|
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
break;
|
2015-05-20 03:03:42 +02:00
|
|
|
}
|
2016-05-11 17:47:02 +02:00
|
|
|
|
|
|
|
if (!re)
|
|
|
|
continue;
|
|
|
|
|
2017-07-13 19:04:25 +02:00
|
|
|
if (((afi == AFI_IP) && (rn->p.family == AF_INET))
|
2016-05-11 17:47:02 +02:00
|
|
|
|| ((afi == AFI_IP6) && (rn->p.family == AF_INET6))) {
|
2017-07-17 14:03:14 +02:00
|
|
|
if (add)
|
2019-06-25 23:07:30 +02:00
|
|
|
zebra_add_import_table_entry(zvrf, rn, re,
|
|
|
|
rmap_name);
|
2017-07-17 14:03:14 +02:00
|
|
|
else
|
2019-06-25 23:07:30 +02:00
|
|
|
zebra_del_import_table_entry(zvrf, rn, re);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
}
|
2015-05-20 03:03:42 +02:00
|
|
|
return 0;
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2019-06-25 23:07:30 +02:00
|
|
|
int zebra_import_table_config(struct vty *vty, vrf_id_t vrf_id)
|
2017-07-17 14:03:14 +02:00
|
|
|
{
|
|
|
|
int i;
|
2015-05-20 03:03:42 +02:00
|
|
|
afi_t afi;
|
|
|
|
int write = 0;
|
2016-09-27 17:57:56 +02:00
|
|
|
char afi_str[AFI_MAX][10] = {"", "ip", "ipv6", "ethernet"};
|
2016-05-11 17:47:02 +02:00
|
|
|
const char *rmap_name;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-20 03:03:42 +02:00
|
|
|
for (afi = AFI_IP; afi < AFI_MAX; afi++) {
|
2016-05-11 17:47:02 +02:00
|
|
|
for (i = 1; i < ZEBRA_KERNEL_TABLE_MAX; i++) {
|
2019-06-25 23:07:30 +02:00
|
|
|
if (!is_zebra_import_table_enabled(afi, vrf_id, i))
|
2017-08-31 21:25:54 +02:00
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-08-31 21:25:54 +02:00
|
|
|
if (zebra_import_table_distance[afi][i]
|
|
|
|
!= ZEBRA_TABLE_DISTANCE_DEFAULT) {
|
2018-03-06 20:02:52 +01:00
|
|
|
vty_out(vty, "%s import-table %d distance %d",
|
2017-08-31 21:25:54 +02:00
|
|
|
afi_str[afi], i,
|
|
|
|
zebra_import_table_distance[afi][i]);
|
|
|
|
} else {
|
2018-03-06 20:02:52 +01:00
|
|
|
vty_out(vty, "%s import-table %d", afi_str[afi],
|
|
|
|
i);
|
2015-05-20 03:03:42 +02:00
|
|
|
}
|
2017-08-31 21:25:54 +02:00
|
|
|
|
|
|
|
rmap_name = zebra_get_import_table_route_map(afi, i);
|
|
|
|
if (rmap_name)
|
2018-03-06 20:02:52 +01:00
|
|
|
vty_out(vty, " route-map %s", rmap_name);
|
2017-08-31 21:25:54 +02:00
|
|
|
|
|
|
|
vty_out(vty, "\n");
|
|
|
|
write = 1;
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2015-05-20 03:03:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return write;
|
|
|
|
}
|
2016-05-11 17:47:02 +02:00
|
|
|
|
2019-06-25 23:07:30 +02:00
|
|
|
static void zebra_import_table_rm_update_vrf_afi(struct zebra_vrf *zvrf,
|
|
|
|
afi_t afi, int table_id,
|
|
|
|
const char *rmap)
|
2016-05-11 17:47:02 +02:00
|
|
|
{
|
|
|
|
struct route_table *table;
|
2017-06-01 13:26:25 +02:00
|
|
|
struct route_entry *re;
|
2016-05-11 17:47:02 +02:00
|
|
|
struct route_node *rn;
|
|
|
|
const char *rmap_name;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-06-25 23:07:30 +02:00
|
|
|
rmap_name = zebra_get_import_table_route_map(afi, table_id);
|
|
|
|
if ((!rmap_name) || (strcmp(rmap_name, rmap) != 0))
|
|
|
|
return;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-11-01 20:52:47 +01:00
|
|
|
table = zebra_vrf_get_table_with_table_id(afi, SAFI_UNICAST,
|
|
|
|
zvrf->vrf->vrf_id, table_id);
|
2019-06-25 23:07:30 +02:00
|
|
|
if (!table) {
|
|
|
|
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
|
|
|
|
zlog_debug("%s: Table id=%d not found", __func__,
|
|
|
|
table_id);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (rn = route_top(table); rn; rn = route_next(rn)) {
|
|
|
|
/*
|
|
|
|
* For each entry in the non-default routing table,
|
|
|
|
* add the entry in the main table
|
|
|
|
*/
|
|
|
|
if (!rn->info)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
RNODE_FOREACH_RE (rn, re) {
|
|
|
|
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
|
2018-08-17 17:47:48 +02:00
|
|
|
continue;
|
2019-06-25 23:07:30 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!re)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (((afi == AFI_IP) && (rn->p.family == AF_INET))
|
|
|
|
|| ((afi == AFI_IP6) && (rn->p.family == AF_INET6)))
|
|
|
|
zebra_add_import_table_entry(zvrf, rn, re, rmap_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void zebra_import_table_rm_update_vrf(struct zebra_vrf *zvrf,
|
|
|
|
const char *rmap)
|
|
|
|
{
|
|
|
|
afi_t afi;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (afi = AFI_IP; afi < AFI_MAX; afi++) {
|
|
|
|
for (i = 1; i < ZEBRA_KERNEL_TABLE_MAX; i++) {
|
|
|
|
if (!is_zebra_import_table_enabled(
|
|
|
|
afi, zvrf->vrf->vrf_id, i))
|
2019-05-16 23:34:05 +02:00
|
|
|
continue;
|
|
|
|
|
2019-06-25 23:07:30 +02:00
|
|
|
zebra_import_table_rm_update_vrf_afi(zvrf, afi, i,
|
|
|
|
rmap);
|
2016-05-11 17:47:02 +02:00
|
|
|
}
|
|
|
|
}
|
2019-06-25 23:07:30 +02:00
|
|
|
}
|
2016-05-11 17:47:02 +02:00
|
|
|
|
2019-06-25 23:07:30 +02:00
|
|
|
void zebra_import_table_rm_update(const char *rmap)
|
|
|
|
{
|
|
|
|
struct vrf *vrf;
|
|
|
|
struct zebra_vrf *zvrf;
|
|
|
|
|
|
|
|
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
|
|
|
zvrf = vrf->info;
|
|
|
|
|
|
|
|
if (!zvrf)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
zebra_import_table_rm_update_vrf(zvrf, rmap);
|
|
|
|
}
|
2016-05-11 17:47:02 +02:00
|
|
|
}
|
Update Traffic Engineering Support for OSPFD
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-04-19 16:21:46 +02:00
|
|
|
|
|
|
|
/* Interface parameters update */
|
|
|
|
void zebra_interface_parameters_update(struct interface *ifp)
|
|
|
|
{
|
|
|
|
struct listnode *node, *nnode;
|
|
|
|
struct zserv *client;
|
|
|
|
|
|
|
|
if (IS_ZEBRA_DEBUG_EVENT)
|
2018-05-29 16:33:04 +02:00
|
|
|
zlog_debug("MESSAGE: ZEBRA_INTERFACE_LINK_PARAMS %s(%u)",
|
2019-06-24 01:46:39 +02:00
|
|
|
ifp->name, ifp->vrf_id);
|
Update Traffic Engineering Support for OSPFD
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-04-19 16:21:46 +02:00
|
|
|
|
2020-03-06 16:33:40 +01:00
|
|
|
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
|
|
|
|
/* Do not send unsolicited messages to synchronous clients. */
|
|
|
|
if (client->synchronous)
|
|
|
|
continue;
|
|
|
|
|
2019-02-04 17:45:31 +01:00
|
|
|
zsend_interface_link_params(client, ifp);
|
2020-03-06 16:33:40 +01:00
|
|
|
}
|
Update Traffic Engineering Support for OSPFD
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-04-19 16:21:46 +02:00
|
|
|
}
|