Commit graph

172 commits

Author SHA1 Message Date
David Lamparter b666ee510e zebra: guard against junk in nexthop->rmap_src
rmap_src wasn't initialized, so for IPv4 the unused 12 bytes would
contain whatever junk is on the stack on function entry.  Also move
the IPv4 parse before the IPv6 parse so if it's successful we can be
sure the other bytes haven't been touched.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-01-29 16:48:37 +01:00
Sougata Barik 86b294698f zebra: Fix ip protocol route-map issue.
"ip/ipv6 protocol any route-map <route map>" cli is setting
wrong route type ( ZEBRA_ROUTE_MAX ), It should set route type
ZEBRA_ROUTE_ALL.

Ticket: #4101560

Signed-off-by: Sougata Barik <sougatab@nvidia.com>
2025-01-06 17:02:21 +05:30
Nathan Bahr be2a7ed6af zebra: Add ability to import alternate tables into the MRIB
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>
2024-10-29 20:17:59 +00:00
Donatas Abraitis 2419fc5104 bgpd: Show which AFI is affected when prefix-list is not found
When the prefix-list is not found, show which AFI is the real one we are
looking for.

E.g.: looking at this output is not clear:

```
[RYF1Z-ZKDRS] route_match_address_prefix_list: Prefix List p1 specified does not exist defaulting to NO_MATCH
```

route_match_address_prefix_list() is called by route_match_ipv6_address_prefix_list(),
and route_match_ip_address_prefix_list().

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-07-31 13:20:59 +03:00
Pooja Jagadeesh Doijode 705e8ef78f zebra: Deny the routes if ip protocol CLI refers to an undefined rmap
Currently zebra does not deny the routes if `ip protocol <proto> route-map
FOO`
commmand is configured with reference to an undefined route-map (FOO in
this case).
However, on FRR restart, in zebra_route_map_check() routes get denied
if route-map name is available but the route-map is not defined. This
change was introduced in fd303a4ba1.

Fix:
When `ip protocol <proto> route-map FOO` CLI is configured with reference to an
undefined route-map FOO, let the processing in ip_protocol_rm_add() and
ip_protocol_rm_del() go through so that zebra can deny the routes instead
of simply returning. This will result in consistent behavior.

Testing Done:

Before fix:
```
spine-1# configure
spine-1(config)# ip protocol bgp route-map rmap7

root@spine-1:mgmt:/var/home/cumulus# vtysh -c "show run" | grep rmap7
ip protocol bgp route-map rmap7
root@spine-1:mgmt:/var/home/cumulus#

spine-1(config)# do 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, A - Babel, D - SHARP, F - PBR, f - OpenFabric,
       Z - FRR,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

C>* 27.0.0.1/32 is directly connected, lo, 02:27:45
B>* 27.0.0.3/32 [20/0] via fe80::202:ff:fe00:21, downlink_1, weight 1, 02:27:35
B>* 27.0.0.4/32 [20/0] via fe80::202:ff:fe00:29, downlink_2, weight 1, 02:27:40
B>* 27.0.0.5/32 [20/0] via fe80::202:ff:fe00:31, downlink_3, weight 1, 02:27:40
B>* 27.0.0.6/32 [20/0] via fe80::202:ff:fe00:39, downlink_4, weight 1, 02:27:40
```

After fix:
```
spine-1(config)# ip protocol bgp route-map route-map67
spine-1(config)# do 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, A - Babel, D - SHARP, F - PBR, f - OpenFabric,
       Z - FRR,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

C>* 27.0.0.1/32 is directly connected, lo, 00:35:03
B   27.0.0.3/32 [20/0] via fe80::202:ff:fe00:21, downlink_1 inactive, weight 1, 00:34:58
B   27.0.0.4/32 [20/0] via fe80::202:ff:fe00:29, downlink_2 inactive, weight 1, 00:34:57
B   27.0.0.5/32 [20/0] via fe80::202:ff:fe00:31, downlink_3 inactive, weight 1, 00:34:57
B   27.0.0.6/32 [20/0] via fe80::202:ff:fe00:39, downlink_4 inactive, weight 1, 00:34:58
spine-1(config)#

root@spine-1:mgmt:/var/home/cumulus# ip route show
root@spine-1:mgmt:/var/home/cumulus#
```

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2024-05-20 12:50:18 -07:00
Igor Ryzhov 3900813298 zebra: convert to mgmtd
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28 23:28:40 +02:00
Igor Ryzhov 741d1d0090 zebra: convert vrf configuration output to NB
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28 23:28:40 +02:00
Igor Ryzhov 010bd3e570 zebra: convert route-map delay-timer command to NB
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28 23:28:40 +02:00
Igor Ryzhov cc619176fe zebra: convert ip nht commands to NB
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28 23:28:40 +02:00
Igor Ryzhov f776dda1ec zebra: convert ip protocol commands to NB
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28 23:28:40 +02:00
Donald Sharp d381190a55 zebra: Remove tag from zebra_rmap_obj
The tag value in all cases was being set to the re->tag.
re is already stored, so let's just use that.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-11 11:21:03 -04:00
Donald Sharp 17bcaad841 zebra: Use the re->metric instead of 0 for zebra_rmap_obj
The zebra_rmap_obj was storing the re->metric and allowing
matches against it, but in most cases it was just using 0.
Use the Route entries metric instead.  This should fix
some bugs where a match metric never worked.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-11 11:17:29 -04:00
Donald Sharp b7542d5af8 zebra: Remove instance from zebra_rmap_obj data structure
In all cases the instance is derived from the re pointer
and since the re pointer is already stored, let's just
remove it from the game and cut to the chase.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-11 11:15:06 -04:00
Donald Sharp cad4d0c332 zebra: Replace source_protocol with just using re in route map object
Replace the source_protocol with just saving a pointer to the re
in the `struct zebra_rmap_obj` data structure.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-11 11:11:40 -04:00
Donald Sharp 8d56ba855b zebra: Remove vrf_id from passed around object
The nexthop that is stored already knows it's nexthop and
in all cases the vrf id is derived from the nexthop->vrf_id
let's just cut to the chase and not do this.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-11 11:06:04 -04:00
Donald Sharp 112bb33db5 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 10:33:16 -04:00
Donald Sharp 28a8065ec4 zebra: Rename struct nh_rmap_obj to struct zebra_rmap_obj
This structure is really the generic route map object for
handling routemaps in zebra.  Let's name it appropriately.
Future commits will consolidate the data to using the
struct route_entry as part of this data instead of copying
bits and bobs of it.  This will allow future work to
set/control the route_entry more directly.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-11 10:33:16 -04:00
guozhongfeng 1193611f8e zebra: The command ipv6 nht xxx not work
If the command is ipv6 nht protocol route-map rmap, this parameter should use AFI_IP6

Signed-off-by: guozhongfeng <guozhongfeng.gzf@alibaba-inc.com>
2023-07-16 17:52:31 +08:00
Russ White c0656e9040
Merge pull request #12837 from donaldsharp/unlikely_routemap
Unlikely routemap
2023-04-04 08:20:25 -04:00
Donald Sharp e16d030c65 *: Convert THREAD_XXX macros to EVENT_XXX macros
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp 907a2395f4 *: Convert thread_add_XXX functions to event_add_XXX
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp e6685141aa *: Rename struct thread to struct event
Effectively a massive search and replace of
`struct thread` to `struct event`.  Using the
term `thread` gives people the thought that
this event system is a pthread when it is not

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp cc09ba4584 bgpd, ospfd, zebra: Use unlikely for DEBUG_ROUTEMAP_DETAIL
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-23 07:54:56 -04:00
Donald Sharp 8383d53e43
Merge pull request #12780 from opensourcerouting/spdx-license-id
*: convert to SPDX License identifiers
2023-02-17 09:43:05 -05:00
Donald Sharp 774cd0cd6c zebra: Add access-list lookup failures to debug routemap detail
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-13 09:40:47 -05:00
Donald Sharp ca4795dae6 zebra: Add prefix-list lookup failures to routemap debug detail
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-13 09:40:47 -05:00
David Lamparter acddc0ed3c *: auto-convert to SPDX License IDs
Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:11 +01:00
Donald Sharp a98701f053 zebra: Add missing enums to switch statements
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-01-31 15:15:42 -05:00
Sindhu Parvathi Gopinathan 63e7deba05 zebra: json support for show ip nht route-map
Changes:
JSON support added for below commands,
     - show ip nht route-map vrf all json
     - show ip nht route-map vrf <name> json
     - show ipv6 nht route-map vrf all json
     - show ipv6 nht route-map vrf <name> json
     - show ipv6 nht route-map json
     - show ip nht route-map json

Testing Done: Unit testing completed.

tor-1# show ip nht route-map vrf default json
{
  "afi":"ipv4",
  "vrfs":{
	"default":{
	  "protocols":{
		"system":"none",
		"kernel":"none",
		"connected":"connected-policy",
		"static":"none",
		"rip":"none",
		"ripng":"none",
		"ospf":"none",
		"ospf6":"none",
		"isis":"none",
		"bgp":"bgp-policy",
		"pim":"none",
		"eigrp":"none",
		"nhrp":"none",
		"hsls":"none",
		"olsr":"none",
		"table":"none",
		"ldp":"none",
		"vnc":"none",
		"vnc-direct":"none",
		"vnc-rn":"none",
		"bgp-direct":"none",
		"bgp-direct-to-nve-groups":"none",
		"babel":"none",
		"sharp":"none",
		"pbr":"none",
		"bfd":"none",
		"openfabric":"none",
		"vrrp":"none",
		"zebra":"none",
		"frr":"none",
		"wildcard":"none",
		"any":"none"
	  }
	}
  }
}

tor-1# show ip nht route-map vrf all json
{
  "afi":"ipv4",
  "vrfs":{
	"default":{
	  "protocols":{
		"system":"none",
		"kernel":"none",
		"connected":"connected-policy",
		"static":"none",
		"rip":"none",
		"ripng":"none",
		"ospf":"none",
		"ospf6":"none",
		"isis":"none",
		"bgp":"bgp-policy",
		"pim":"none",
		"eigrp":"none",
		"nhrp":"none",
		"hsls":"none",
		"olsr":"none",
		"table":"none",
		"ldp":"none",
		"vnc":"none",
		"vnc-direct":"none",
		"vnc-rn":"none",
		"bgp-direct":"none",
		"bgp-direct-to-nve-groups":"none",
		"babel":"none",
		"sharp":"none",
		"pbr":"none",
		"bfd":"none",
		"openfabric":"none",
		"vrrp":"none",
		"zebra":"none",
		"frr":"none",
		"wildcard":"none",
		"any":"none"
	  }
	},
	"mgmt":{
	  "protocols":{
		"system":"none",
		"kernel":"none",
		"connected":"none",
		"static":"none",
		"rip":"none",
		"ripng":"none",
		"ospf":"none",
		"ospf6":"none",
		"isis":"none",
		"bgp":"none",
		"pim":"none",
		"eigrp":"none",
		"nhrp":"none",
		"hsls":"none",
		"olsr":"none",
		"table":"none",
		"ldp":"none",
		"vnc":"none",
		"vnc-direct":"none",
		"vnc-rn":"none",
		"bgp-direct":"none",
		"bgp-direct-to-nve-groups":"none",
		"babel":"none",
		"sharp":"none",
		"pbr":"none",
		"bfd":"none",
		"openfabric":"none",
		"vrrp":"none",
		"zebra":"none",
		"frr":"none",
		"wildcard":"none",
		"any":"none"
	  }
	},
	"sym_1":{
	  "protocols":{
		"system":"none",
		"kernel":"none",
		"connected":"none",
		"static":"none",
		"rip":"none",
		"ripng":"none",
		"ospf":"none",
		"ospf6":"none",
		"isis":"none",
		"bgp":"bgp-policy",
		"pim":"none",
		"eigrp":"none",
		"nhrp":"none",
		"hsls":"none",
		"olsr":"none",
		"table":"none",
		"ldp":"none",
		"vnc":"none",
		"vnc-direct":"none",
		"vnc-rn":"none",
		"bgp-direct":"none",
		"bgp-direct-to-nve-groups":"none",
		"babel":"none",
		"sharp":"none",
		"pbr":"none",
		"bfd":"none",
		"openfabric":"none",
		"vrrp":"none",
		"zebra":"none",
		"frr":"none",
		"wildcard":"none",
		"any":"none"
	  }
	}
  }
}

tor-1# show ipv6 nht route-map vrf default json
{
  "afi":"ipv6",
  "vrfs":{
	"default":{
	  "protocols":{
		"system":"none",
		"kernel":"kernel-policy",
		"connected":"connected-policy",
		"static":"none",
		"rip":"none",
		"ripng":"none",
		"ospf":"none",
		"ospf6":"none",
		"isis":"none",
		"bgp":"none",
		"pim":"none",
		"eigrp":"none",
		"nhrp":"none",
		"hsls":"none",
		"olsr":"none",
		"table":"none",
		"ldp":"none",
		"vnc":"none",
		"vnc-direct":"none",
		"vnc-rn":"none",
		"bgp-direct":"none",
		"bgp-direct-to-nve-groups":"none",
		"babel":"none",
		"sharp":"none",
		"pbr":"none",
		"bfd":"none",
		"openfabric":"none",
		"vrrp":"none",
		"zebra":"none",
		"frr":"none",
		"wildcard":"none",
		"any":"none"
	  }
	}
  }
}

Ticket:#3229016
Issue:3229016

Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-12-16 08:42:53 -08:00
Donald Sharp cda0f501fb zebra: Free up routemap name memory on vrf deletion event
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-09 09:47:06 -05:00
David Lamparter 89cb86aeb0 build, vtysh: extract vtysh commands from .xref
Rather than running selected source files through the preprocessor and a
bunch of perl regex'ing to get the list of all DEFUNs, use the data
collected in frr.xref.

This not only eliminates issues we've been having with preprocessor
failures due to nonexistent header files, but is also much faster.
Where extract.pl would take 5s, this now finishes in 0.2s.  And since
this is a non-parallelizable build step towards the end of the build
(dependent on a lot of other things being done already), the speedup is
actually noticeable.

Also files containing CLI no longer need to be listed in `vtysh_scan`
since the .xref data covers everything.  `#ifndef VTYSH_EXTRACT_PL`
checks are equally obsolete.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-10-26 17:12:34 +01:00
David Lamparter 0cbed9511a lib, zebra, pimd: clean up/fix VRF DECLVAR macros
There's a common pattern of "get VRF context for CLI node" here, which
first got a helper macro in zebra that then permeated into pimd.

Unfortunately the pimd copy wasn't quite adjusted correctly and thus
caused two coverity warnings (CID 1517453, CID 1517454).

Fix the PIM one, and clean up by providing a common base macro in
`lib/vty.h`.

Also rename the macros (add `_VRF`) to make more clear what they do.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-04-28 11:09:26 +02:00
Donald Sharp cc9f21da22 *: Change thread->func to return void instead of int
The int return value is never used.  Modify the code
base to just return a void instead.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-23 19:56:04 -05:00
Donald Sharp d597533a9d zebra: Start carrying safi for rnh processing
PIM is going to need to be able to send down the address it is
trying to resolve in the multicast rib.  We need a way to signal
this to the end developer.  Start the conversion by adding the
ability to have a safi.  But only allow SAFI_UNICAST at the moment.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27 12:38:08 -04:00
Donald Sharp 6071e5e96e zebra: remove 'enum rnh_type' from system
This code is now dead code since there are not two
nexthop resolution types.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27 12:38:08 -04:00
David Lamparter 09781197b6 build: make builddir include path consistent
... by referencing all autogenerated headers relative to the root
directory.  (90% of the changes here is `version.h`.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-04-21 15:42:33 +02:00
Sarita Patra e71627cbcb zebra: North-bound implementation for zebra rmaps
This commit introduces the implementation for the north-bound
callbacks for the zebra-specific route-map match and set clauses.

Signed-off-by: NaveenThanikachalam <nthanikachal@vmware.com>
Signed-off-by: Sarita Patra <saritap@vmware.com>
2021-03-30 22:58:42 +03:00
David Lamparter 224ccf29d9 zebra: kill zebra_memory.h, use MTYPE_STATIC
This one also needed a bit of shuffling around, but MTYPE_RE is the only
one left used across file boundaries now.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-22 20:02:17 +01:00
Donald Sharp 431deca7ea
Merge pull request #7905 from mjstapp/fix_zapi_nhg
zebra, sharpd: async results for NHGs
2021-01-25 10:29:04 -05:00
Mark Stapp f5b7e50f9a zebra: use afi_t for route-map address family arg
Use afi_t in the route_map_check api

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-01-21 10:13:57 -05:00
Donald Sharp d33da0e071 zebra: A zebra route-map delay-timer 0 command should still run the route-map
Setting `zebra route-map delay-timer 0` completely turns of any
route-map processing in zebra.  Which is completely wrong.  A timer
of 0 means `do it now`.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-15 19:34:33 -05:00
Donald Sharp 4dfcfabfa9 zebra: Push timer out if another route-map change comes in for zebra
If we are running with a delayed timer to handle route-map changes
in zebra, if another route-map change is made to the cli, push
out the timer instead of not modifying the timer.  This will
allow a large set of route-maps to be possibly be read in by
the system and we don't have a state where new route-map
changes are being read in and having the timer pop in
the middle of it.

Additionally convert to use THREAD_OFF, preventing a possible
use after free as well as aligning the thread api usage
with what we consider correct.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-15 19:34:33 -05:00
Donald Sharp cfcd844c0b zebra: Limit routemap changes to reconsider only routes associated with that rm
Current code when a route map changes schedules a rerun of all routes in the
particular table.  So if you modify the `ip protocol XX route-map FOO`
route-map `FOO` all routes will be rechecked.  This is extremely expensive.

Modify zebra to only update the routes associated with the route-map.  So
if we have 800k bgp routes and 50 ospf routes and we are route-map'ing
the ospf routes we'll only look at 50 routes.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-15 19:34:33 -05:00
Donald Sharp 54aeba3540 zebra: Allow rib_update_table to receive a specified route type
When we need to cause a reprocessing of data the code currently
marks all routes as needing to be looked at.  Modify the
rib_update_table code to allow us to specify a specific route
type we only want to reprocess.  At this point none
of the code is behaving differently this is just setup
for a future code change.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-15 19:34:33 -05:00
Donald Sharp 3d34678f1d doc: Document the "zebra route-map delay-timer" functionality
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-15 19:34:33 -05:00
Donald Sharp 9df81095f8 zebra: zebra route-map delay-timer is global not per vrf
The zebra route-map delay timer value is a global value
not a per vrf change.  As such we should only print it
out one time.

We are seeing this:

zebra route-map delay-timer 33
 exit-vrf
zebra route-map delay-timer 33

When we have 2 vrf's configured.

Fix the code to only write it out for the default vrf

Ticket: CM-32888
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-08 22:34:41 -05:00
Donald Sharp c70e585e05 zebra: Remove uncalled function
Remove the dead function zebra_route_map_write_delay_timer

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-08 22:34:41 -05:00
Donatas Abraitis 82b773e63b
Merge pull request #7524 from donaldsharp/zebra_route_map_tighten
zebra: deny when route map is specified but does not exist yet
2020-12-10 11:01:25 +02:00
Donald Sharp fd303a4ba1 zebra: deny when route map is specified but does not exist yet
If we have `ip protocol <proto> route-map FOO` and FOO has
not been defined in any way shape fashion or form, we
should deny the match instead of permitting it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-13 21:11:48 -05:00
Donald Sharp 1782514fb9 *: Remove route_map_object_t from the system
The route_map_object_t was being used to track what protocol we were
being called against.  But each protocol was only ever calling itself.
So we had a variable that was only ever being passed in from route_map_apply
that had to be carried against and everyone was testing if that variable
was for their own stack.

Clean up this route_map_object_t from the entire system.  We should
speed some stuff up.  Yes I know not a bunch but this will add up.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-13 19:35:20 -05:00