2023-02-08 13:17:09 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2015-08-26 14:21:40 +02:00
|
|
|
/*
|
|
|
|
* Zebra routemap header
|
|
|
|
* Copyright (C) 2015 Cumulus Networks, Inc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ZEBRA_ROUTEMAP_H__
|
|
|
|
#define __ZEBRA_ROUTEMAP_H__
|
|
|
|
|
2018-04-22 22:01:20 +02:00
|
|
|
#include "lib/routemap.h"
|
|
|
|
|
2019-03-25 15:11:55 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2017-12-08 00:35:29 +01:00
|
|
|
extern void zebra_route_map_init(void);
|
2018-10-11 19:49:34 +02:00
|
|
|
extern void zebra_routemap_config_write_protocol(struct vty *vty,
|
|
|
|
struct zebra_vrf *vrf);
|
2016-05-11 17:47:02 +02:00
|
|
|
extern char *zebra_get_import_table_route_map(afi_t afi, uint32_t table);
|
|
|
|
extern void zebra_add_import_table_route_map(afi_t afi, const char *rmap_name,
|
|
|
|
uint32_t table);
|
|
|
|
extern void zebra_del_import_table_route_map(afi_t afi, uint32_t table);
|
|
|
|
|
zebra: import table match against interface name could fail
If an import table route-map is trying to match against
a particular interface, The code is matching against
the actual vrf the route entry is in -vs- the vrf
the nexthop entry is in. Let's modify the code
to actually allow the import table entry to match
against the nexthops vrf.
Not working:
ip import-table 91
ip import-table 93 route-map FOO
no service integrated-vtysh-config
!
debug zebra events
!
interface green
ip address 192.168.4.3/24
exit
!
route-map FOO permit 10
match interface green
exit
eva# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued, r - rejected, b - backup
t - trapped, o - offload failure
K>* 0.0.0.0/0 [0/100] via 192.168.119.1, enp13s0, 1d10h07m
T[91]>* 1.2.3.5/32 [15/0] via 192.168.119.1, enp13s0, 00:00:05
K>* 169.254.0.0/16 [0/1000] is directly connected, virbr0 linkdown, 1d16h34m
C>* 192.168.44.0/24 is directly connected, virbr1, 01:30:51
C>* 192.168.45.0/24 is directly connected, virbr2, 01:30:51
C>* 192.168.119.0/24 is directly connected, enp13s0, 1d16h34m
C>* 192.168.122.0/24 is directly connected, virbr0 linkdown, 01:30:51
eva# show ip route table 91
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued, r - rejected, b - backup
t - trapped, o - offload failure
VRF default table 91:
K>* 1.2.3.5/32 [0/0] via 192.168.119.1, enp13s0, 00:00:15
eva# show ip route table 93
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued, r - rejected, b - backup
t - trapped, o - offload failure
VRF default table 93:
K * 1.2.3.4/32 [0/0] via 192.168.4.5, green (vrf green), 00:03:05
Working:
eva# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued, r - rejected, b - backup
t - trapped, o - offload failure
K>* 0.0.0.0/0 [0/100] via 192.168.119.1, enp13s0, 00:03:09
T[93]>* 1.2.3.4/32 [15/0] via 192.168.4.5, green (vrf green), 00:02:21
T[91]>* 1.2.3.5/32 [15/0] via 192.168.119.1, enp13s0, 00:02:26
K>* 169.254.0.0/16 [0/1000] is directly connected, virbr0, 00:03:09
C>* 192.168.44.0/24 is directly connected, virbr1, 00:03:09
C>* 192.168.45.0/24 is directly connected, virbr2, 00:03:09
C>* 192.168.119.0/24 is directly connected, enp13s0, 00:03:09
C>* 192.168.122.0/24 is directly connected, virbr0, 00:03:09
eva# show ip route table 91
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued, r - rejected, b - backup
t - trapped, o - offload failure
VRF default table 91:
K * 1.2.3.5/32 [0/0] via 192.168.119.1, enp13s0, 00:03:12
eva# show ip route table 93
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued, r - rejected, b - backup
t - trapped, o - offload failure
VRF default table 93:
K * 1.2.3.4/32 [0/0] via 192.168.4.5, green (vrf green), 00:03:14
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-11 16:18:41 +02:00
|
|
|
extern route_map_result_t zebra_import_table_route_map_check(
|
|
|
|
int family, int rib_type, uint8_t instance, const struct prefix *p,
|
|
|
|
struct nexthop *nexthop, route_tag_t tag, const char *rmap_name);
|
2018-05-17 16:29:49 +02:00
|
|
|
extern route_map_result_t
|
2021-01-11 19:53:42 +01:00
|
|
|
zebra_route_map_check(afi_t family, int rib_type, uint8_t instance,
|
2018-07-10 22:02:03 +02:00
|
|
|
const struct prefix *p, struct nexthop *nexthop,
|
2018-10-11 19:44:55 +02:00
|
|
|
struct zebra_vrf *zvrf, route_tag_t tag);
|
2016-05-11 17:47:02 +02:00
|
|
|
extern route_map_result_t
|
2019-01-21 15:30:36 +01:00
|
|
|
zebra_nht_route_map_check(afi_t afi, int client_proto, const struct prefix *p,
|
2018-10-11 19:44:55 +02:00
|
|
|
struct zebra_vrf *zvrf, struct route_entry *,
|
|
|
|
struct nexthop *nexthop);
|
2015-08-26 14:21:40 +02:00
|
|
|
|
2022-12-09 14:51:34 +01:00
|
|
|
extern void zebra_routemap_vrf_delete(struct zebra_vrf *zvrf);
|
|
|
|
|
2019-03-25 15:11:55 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2020-03-16 03:23:38 +01:00
|
|
|
extern void zebra_routemap_finish(void);
|
2020-10-30 08:41:19 +01:00
|
|
|
|
|
|
|
extern const struct frr_yang_module_info frr_zebra_route_map_info;
|
2015-08-26 14:21:40 +02:00
|
|
|
#endif
|