summaryrefslogtreecommitdiffstats
path: root/pbrd (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: Convert event.h to frrevent.hDonald Sharp2023-03-243-3/+3
| | | | | | | We should probably prevent any type of namespace collision with something else. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert `struct event_master` to `struct event_loop`Donald Sharp2023-03-242-2/+2
| | | | | | Let's find a better name for it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert struct thread_master to struct event_master and it's ilkDonald Sharp2023-03-242-2/+2
| | | | | | | Convert the `struct thread_master` to `struct event_master` across the code base. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Rename thread.[ch] to event.[ch]Donald Sharp2023-03-243-3/+3
| | | | | | | | | | | This is a first in a series of commits, whose goal is to rename the thread system in FRR to an event system. There is a continual problem where people are confusing `struct thread` with a true pthread. In reality, our entire thread.c is an event system. In this commit rename the thread.[ch] files to event.[ch]. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* pbrd:fix mismatching in match src-dstChirag Shah2023-03-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* *: auto-convert to SPDX License IDsDavid Lamparter2023-02-0915-210/+15
| | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* pbrd: fix large tableids displayed as negativeWesley Coakley2023-02-081-4/+4
| | | | | Ticket: 2699411 Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
* pbrd: Add missing enum's to switch statementDonald Sharp2023-01-311-1/+2
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Add ability for daemons to notice resilience changesDonald Sharp2022-11-043-3/+7
| | | | | | | | | 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>
* build, vtysh: extract vtysh commands from .xrefDavid Lamparter2022-10-263-8/+0
| | | | | | | | | | | | | | | | | | | 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>
* *: Create and use infrastructure to show debugs in libDonald Sharp2022-10-071-0/+2
| | | | | | | | | 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>
* pbrd: VTY_GET_CONTEXT can failDonald Sharp2022-08-151-0/+54
| | | | | | | | 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>
* zebra: expand pbr rule action for dataplane programmingAnuradha Karuppiah2022-06-271-2/+6
| | | | | | | | 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>
* Merge pull request #11059 from anlancs/fix/bgpd-evnp-wrong-check-hashgetDonatas Abraitis2022-05-041-6/+8
|\ | | | | bgpd: fix memory leak for evpn
| * *: remove the checking returned value for hash_get()anlan_cs2022-05-021-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | pbrd: fix interface compare usageRafael Zalamena2022-05-021-2/+1
|/ | | | | | Don't use `strncmp` when we expect to match the whole string. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* *: Fix spelling of IntefaceDonald Sharp2022-04-021-1/+1
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: add SAFI argument to zclient_send_rnhDavid Lamparter2022-03-271-1/+2
| | | | | | Just pushing that SAFI_UNICAST up 1 level to the caller. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: When matching against a nexthop send and process what it matched againstDonald Sharp2022-03-121-3/+6
| | | | | | | | | | | | | | | | | | 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>
* *: Add necessary new line for output of vty_out()anlan_cs2022-02-271-1/+1
| | | | Signed-off-by: anlan_cs <vic.lan@pica8.com>
* pbrd: pbr route maps get addr family of nhgsStephen Worley2022-01-274-1/+56
| | | | | | | | | | 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>
* *: do not print vrf name for interface config when using vrf-liteIgor Ryzhov2022-01-241-6/+2
| | | | | | | 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>
* *: rework renaming the default VRFIgor Ryzhov2021-12-211-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Merge pull request #10124 from ton31337/feature/vty_jsonIgor Ryzhov2021-11-291-17/+5
|\
| * *: Remove redundand braces for single statement blocksDonatas Abraitis2021-11-271-4/+2
| | | | | | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
| * pbrd: Convert vty_out to vty_json for JSONDonatas Abraitis2021-11-251-13/+3
| | | | | | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* | *: Remove unused variablesDonatas Abraitis2021-11-251-1/+0
| | | | | | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* | pbrd: Replace prefix2str for JSON to %pFXDonatas Abraitis2021-11-251-6/+2
|/ | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: cleanup ifp->vrf_idIgor Ryzhov2021-11-224-20/+4
| | | | | | | 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>
* *: Convert quagga_signal_X to frr_signal_XDonald Sharp2021-11-111-1/+1
| | | | | | | Naming functions/data structures more appropriately for the project we are actually in. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* Merge pull request #9837 from idryzhov/cleanup-if-by-name-vrf-allRuss White2021-10-271-2/+25
|\ | | | | *: fix usage of if_lookup_by_name_all_vrf
| * pbrd: fix "set nexthop" for netnsIgor Ryzhov2021-10-151-2/+25
| | | | | | | | | | | | | | | | | | 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>
* | Merge pull request #9854 from opensourcerouting/zapi-call-tableRuss White2021-10-261-7/+11
|\ \ | | | | | | *: convert zclient callbacks to table
| * | *: convert zclient callbacks to tableDavid Lamparter2021-10-201-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Merge pull request #9742 from elimbaum/add-vlan-actionsJafar Al-Gharaibeh2021-10-234-5/+153
|\ \ \ | |/ / |/| | pbrd: add vlan actions to vty
| * | pbrd: add vlan actions to vtyEli Baum2021-10-074-5/+153
| | | | | | | | | | | | Signed-off-by: Eli Baum <ebaum@mitre.org>
* | | pbrd: protect from a possible NULL dereferenceIgor Ryzhov2021-10-141-1/+1
| |/ |/| | | | | Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | *: Add resolve via default flagDonald Sharp2021-09-271-1/+1
|/
* Merge pull request #9496 from idryzhov/vrf-cmd-init-unused-argDavid Lamparter2021-08-271-1/+1
|\ | | | | lib: remove unused argument from vrf_cmd_init
| * lib: remove unused argument from vrf_cmd_initIgor Ryzhov2021-08-261-1/+1
| | | | | | | | Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | Merge pull request #9331 from idryzhov/explicit-exitChristian Hopps2021-08-261-1/+2
|\ \ | |/ |/| *: explicitly print "exit" at the end of every node config
| * *: explicitly print "exit" at the end of every node configIgor Ryzhov2021-08-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | *: Drop `break` after using frr_help_exit() in switch/caseDonatas Abraitis2021-08-251-1/+0
|/ | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: cleanup interface node installationIgor Ryzhov2021-07-291-11/+1
| | | | | | | | | 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>
* pbrd: Add `match ip-protocol [tcp|udp]`Donald Sharp2021-07-083-1/+47
| | | | | | | 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>
* bgpd, pbrd, zebra: Encode/decode the ip proto from daemons to zebraDonald Sharp2021-07-081-0/+1
| | | | | | | Ensure that we properly encode/decode the ip protocol from daemons to zebra. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* pbrd: Add ability to set/unset src and dest portsDonald Sharp2021-07-081-0/+51
| | | | | | | 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>
* pbrd: Start inclusion of src and dst ports for pbrdDonald Sharp2021-07-082-2/+8
| | | | | | | | | 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>
* *: Replace 4/16 integers to IPV4_MAX_BYTELEN/IPV6_MAX_BYTELENDonatas Abraitis2021-07-011-3/+5
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: Convert numeric 32 into IPV4_MAX_BITLEN for prefixlenDonatas Abraitis2021-07-011-1/+1
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>