summaryrefslogtreecommitdiff
path: root/pbrd
AgeCommit message (Collapse)Author
2023-03-17pbrd:fix mismatching in match src-dstChirag Shah
upstream commit 67765a232d has incorect address family check which prevent from deleting src/dst config under pbr rule. Ticket:#3405024 Issue:3405024 Testing Done: Config: pbr-map map6 seq 1 match src-ip 2000::200:100:100:0/96 match dst-ip 2000::100:100:100:0/96 set nexthop-group group3 Before: torc-12(config)# pbr-map map6 seq 1 torc-12(config-pbr-map)# no match src-ip 2000::200:100:100:0/96 Cannot mismatch families within match src/dst After: torc-12(config)# pbr-map map6 seq 1 torc-12(config-pbr-map)# no match src-ip 2000::200:100:100:0/96 torc-12(config-pbr-map)# Signed-off-by: Chirag Shah <chirag@nvidia.com>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-08pbrd: fix large tableids displayed as negativeWesley Coakley
Ticket: 2699411 Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
2023-01-31pbrd: Add missing enum's to switch statementDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-11-04*: Add ability for daemons to notice resilience changesDonald Sharp
This patch just introduces the callback mechanism for the resilient nexthop changes so that upper level daemons can take advantage of the change. This does nothing at this point but just call some code. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-10-26build, vtysh: extract vtysh commands from .xrefDavid Lamparter
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-07*: Create and use infrastructure to show debugs in libDonald Sharp
There are lib debugs being set but never show up in `show debug` commands because there was no way to show that they were being used. Add a bit of infrastructure to allow this and then use it for `debug route-map` Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-15pbrd: VTY_GET_CONTEXT can failDonald Sharp
Although VTY_GET_CONTEXT can return a failed value, it will never happen in pbrd because of how context work. In any event add some code to make coverity happy Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-27zebra: expand pbr rule action for dataplane programmingAnuradha Karuppiah
PBR rules are installed as match, action rules in most dataplanes. This requires the action to be resolved via a GW. And the GW to be subsequently resolved to {SMAC, DMAC}. Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
2022-05-04Merge pull request #11059 from anlancs/fix/bgpd-evnp-wrong-check-hashgetDonatas Abraitis
bgpd: fix memory leak for evpn
2022-05-03*: remove the checking returned value for hash_get()anlan_cs
Firstly, *keep no change* for `hash_get()` with NULL `alloc_func`. Only focus on cases with non-NULL `alloc_func` of `hash_get()`. Since `hash_get()` with non-NULL `alloc_func` parameter shall not fail, just ignore the returned value of it. The returned value must not be NULL. So in this case, remove the unnecessary checking NULL or not for the returned value and add `void` in front of it. Importantly, also *keep no change* for the two cases with non-NULL `alloc_func` - 1) Use `assert(<returned_data> == <searching_data>)` to ensure it is a created node, not a found node. Refer to `isis_vertex_queue_insert()` of isisd, there are many examples of this case in isid. 2) Use `<returned_data> != <searching_data>` to judge it is a found node, then free <searching_data>. Refer to `aspath_intern()` of bgpd, there are many examples of this case in bgpd. Here, <returned_data> is the returned value from `hash_get()`, and <searching_data> is the data, which is to be put into hash table. Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-05-02pbrd: fix interface compare usageRafael Zalamena
Don't use `strncmp` when we expect to match the whole string. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2022-04-02*: Fix spelling of IntefaceDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-03-27*: add SAFI argument to zclient_send_rnhDavid Lamparter
Just pushing that SAFI_UNICAST up 1 level to the caller. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-12*: When matching against a nexthop send and process what it matched againstDonald Sharp
Currently the nexthop tracking code is only sending to the requestor what it was requested to match against. When the nexthop tracking code was simplified to not need an import check and a nexthop check in b8210849b8ac1abe2d5d9a5ab2459abfde65efa5 for bgpd. It was not noticed that a longer prefix could match but it would be seen as a match because FRR was not sending up both the resolved route prefix and the route FRR was asked to match against. This code change causes the nexthop tracking code to pass back up the matched requested route (so that the calling protocol can figure out which one it is being told about ) as well as the actual prefix that was matched to. Fixes: #10766 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-27*: Add necessary new line for output of vty_out()anlan_cs
Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-01-27pbrd: pbr route maps get addr family of nhgsStephen Worley
When adding a nhg to a route map, make sure to specify the `family` of the rm by looking at the contents of the nhg. Installation in the kernel (for DSCP rules in particular) relies on this being specified in the netlink message. Signed-off-by: Wesley Coakley <wcoakley@nvidia.com> Signed-off-by: Stephen Worley <sworley@nvidia.com>
2022-01-24*: do not print vrf name for interface config when using vrf-liteIgor Ryzhov
VRF name should not be printed in the config since 574445ec. The update was done for NB config output but I missed it for regular vty output. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-12-21*: rework renaming the default VRFIgor Ryzhov
Currently, it is possible to rename the default VRF either by passing `-o` option to zebra or by creating a file in `/var/run/netns` and binding it to `/proc/self/ns/net`. In both cases, only zebra knows about the rename and other daemons learn about it only after they connect to zebra. This is a problem, because daemons may read their config before they connect to zebra. To handle this rename after the config is read, we have some special code in every single daemon, which is not very bad but not desirable in my opinion. But things are getting worse when we need to handle this in northbound layer as we have to manually rewrite the config nodes. This approach is already hacky, but still works as every daemon handles its own NB structures. But it is completely incompatible with the central management daemon architecture we are aiming for, as mgmtd doesn't even have a connection with zebra to learn from it. And it shouldn't have it, because operational state changes should never affect configuration. To solve the problem and simplify the code, I propose to expand the `-o` option to all daemons. By using the startup option, we let daemons know about the rename before they read their configs so we don't need any special code to deal with it. There's an easy way to pass the option to all daemons by using `frr_global_options` variable. Unfortunately, the second way of renaming by creating a file in `/var/run/netns` is incompatible with the new mgmtd architecture. Theoretically, we could force daemons to read their configs only after they connect to zebra, but it means adding even more code to handle a very specific use-case. And anyway this won't work for mgmtd as it doesn't have a connection with zebra. So I had to remove this option. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-29Merge pull request #10124 from ton31337/feature/vty_jsonIgor Ryzhov
2021-11-27*: Remove redundand braces for single statement blocksDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-25pbrd: Convert vty_out to vty_json for JSONDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-25*: Remove unused variablesDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-25pbrd: Replace prefix2str for JSON to %pFXDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-22*: cleanup ifp->vrf_idIgor Ryzhov
Since f60a1188 we store a pointer to the VRF in the interface structure. There's no need anymore to store a separate vrf_id field. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-11*: Convert quagga_signal_X to frr_signal_XDonald Sharp
Naming functions/data structures more appropriately for the project we are actually in. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-27Merge pull request #9837 from idryzhov/cleanup-if-by-name-vrf-allRuss White
*: fix usage of if_lookup_by_name_all_vrf
2021-10-26Merge pull request #9854 from opensourcerouting/zapi-call-tableRuss White
*: convert zclient callbacks to table
2021-10-23Merge pull request #9742 from elimbaum/add-vlan-actionsJafar Al-Gharaibeh
pbrd: add vlan actions to vty
2021-10-20*: convert zclient callbacks to tableDavid Lamparter
This removes a giant `switch { }` block from lib/zclient.c and harmonizes all zclient callback function types to be the same (some had a subset of the args, some had a void return, now they all have ZAPI_CALLBACK_ARGS and int return.) Apart from getting rid of the giant switch, this is a minor security benefit since the function pointers are now in a `const` array, so they can't be overwritten by e.g. heap overflows for code execution anymore. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-15pbrd: fix "set nexthop" for netnsIgor Ryzhov
With netns VRF backend, we may have multiple interfaces with the same name. Currently, the function is not deterministic in this case as it uses the first interface that it finds in the list. Be more restrictive and ask the user to provide the VRF name. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-10-14pbrd: protect from a possible NULL dereferenceIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-10-07pbrd: add vlan actions to vtyEli Baum
Signed-off-by: Eli Baum <ebaum@mitre.org>
2021-09-27*: Add resolve via default flagDonald Sharp
2021-08-27Merge pull request #9496 from idryzhov/vrf-cmd-init-unused-argDavid Lamparter
lib: remove unused argument from vrf_cmd_init
2021-08-26Merge pull request #9331 from idryzhov/explicit-exitChristian Hopps
*: explicitly print "exit" at the end of every node config
2021-08-26lib: remove unused argument from vrf_cmd_initIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-25*: Drop `break` after using frr_help_exit() in switch/caseDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-08-23*: explicitly print "exit" at the end of every node configIgor Ryzhov
There is a possibility that the same line can be matched as a command in some node and its parent node. In this case, when reading the config, this line is always executed as a command of the child node. For example, with the following config: ``` router ospf network 193.168.0.0/16 area 0 ! mpls ldp discovery hello interval 111 ! ``` Line `mpls ldp` is processed as command `mpls ldp-sync` inside the `router ospf` node. This leads to a complete loss of `mpls ldp` node configuration. To eliminate this issue and all possible similar issues, let's print an explicit "exit" at the end of every node config. This commit also changes indentation for a couple of existing exit commands so that all existing commands are on the same level as their corresponding node-entering commands. Fixes #9206. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-07-29*: cleanup interface node installationIgor Ryzhov
The only difference in daemons' interface node definition is the config write function. No need to define the node in every daemon, just pass the callback as an argument to a library function and define the node there. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-07-08pbrd: Add `match ip-protocol [tcp|udp]`Donald Sharp
Add the `match ip-protocol [tcp|udp]` command to allow pbr to match on tcp or udp streams. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-07-08bgpd, pbrd, zebra: Encode/decode the ip proto from daemons to zebraDonald Sharp
Ensure that we properly encode/decode the ip protocol from daemons to zebra. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-07-08pbrd: Add ability to set/unset src and dest portsDonald Sharp
Add `match src-port (1-65535)` and `match dst-port (1-65535)` commands to allow pbr to pass these values down to zebra. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-07-08pbrd: Start inclusion of src and dst ports for pbrdDonald Sharp
Start the inclusion of src_prt and dst_prt in the internal data structures. At this point we do not do anything with the data other than pass down what we have stored in pbrd. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-07-01*: Replace 4/16 integers to IPV4_MAX_BYTELEN/IPV6_MAX_BYTELENDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-07-01*: Convert numeric 32 into IPV4_MAX_BITLEN for prefixlenDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-07-01*: Convert numeric 128 into IPV6_MAX_BITLEN for prefixlenDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-06-21lib: remove vrf-interface config when removing the VRFIgor Ryzhov
If we have the following configuration: ``` vrf red smth exit-vrf ! interface red vrf red smth ``` And we delete the VRF using "no vrf red" command, we end up with: ``` interface red smth ``` Interface config is preserved but moved to the default VRF. This is not an expected behavior. We should remove the interface config when the VRF is deleted. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-25Merge pull request #8675 from wesleycoakley/pbr-table-range-core-fixMark Stapp
pbrd: implement sparse table lookup for nhg cache
2021-05-19pbrd: fix coverity warningIgor Ryzhov
CID 1500586 There was an attempt to fix it in 920bb6f7 but the commit didn't actually fix the warning. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>