summaryrefslogtreecommitdiff
path: root/pbrd
AgeCommit message (Collapse)Author
2020-04-27build: make clippy Makefile rules nicerDavid Lamparter
These are easy to get subtly wrong, and doing so can cause nondeterministic failures when racing in parallel builds. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-04-27build: use VPATH for vtysh_scanDavid Lamparter
No need to put $(top_srcdir) everywhere. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-04-16*: move CLI node names to cmd_node->nameDavid Lamparter
And again for the name. Why on earth would we centralize this, just so people can forget to update it? Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16*: move CLI parent data to cmd_node->parent_nodeDavid Lamparter
Same as before, instead of shoving this into a big central list we can just put the parent node in cmd_node. Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16*: remove second parameter on install_node()David Lamparter
There is really no reason to not put this in the cmd_node. And while we're add it, rename from pointless ".func" to ".config_write". [v2: fix forgotten ldpd config_write] Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16*: remove cmd_node->vtyshDavid Lamparter
The only nodes that have this as 0 don't have a "->func" anyway, so the entire thing is really just pointless. Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16*: clean up cmd_node initializersDavid Lamparter
... and use named assignments everywhere (so I can change the struct.) Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-14pbrd: fix wording in pbr_send_pbr_map commentStephen Worley
Fix some bad wording in a comment when deciding whether to send a pbr map sequence to zebra. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-04-09pbrd: separate `set *` and `no set *` commandsStephen Worley
Separate out the `set *` and `no set *` commands into different DEFPYs to make the logic of the code easier to read. Further, allow non-exlpicit no commands. So `no set nexthop`, `no set nexthop-group`, and `no set vrf` will now work without having to specify anymore data. Before you had to match what was already there explicitly. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-04-09pbrd: implement `set *` and `match *` config replacementStephen Worley
Implement the ability to replace any existing `set *` or `match` with another one or adding more config without having to first delete the original config already there. Before, we needed to constantly execute a `no` command for everything to remove the rule before making changes to it. With this patch, you can replace configs on individual sequences much easier. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-04-09pbrd: free nexthop_group name on `no set nexthop-group`Stephen Worley
Properly free the string pointed to by `pbrms->nhgrp_name` when we are removiing the config for a nexthop group on a pbr map sequence. Found via memleak: ==3152214== 4 bytes in 1 blocks are definitely lost in loss record 308 of 8,814 ==3152214== at 0x483980B: malloc (vg_replace_malloc.c:309) ==3152214== by 0x4DC9F7E: strdup (in /usr/lib64/libc-2.30.so) ==3152214== by 0x48E373E: qstrdup (memory.c:122) ==3152214== by 0x408FE7: pbr_map_nexthop_group_magic (pbr_vty.c:264) ==3152214== by 0x408E04: pbr_map_nexthop_group (pbr_vty_clippy.c:347) ==3152214== by 0x48ACF72: cmd_execute_command_real (command.c:1073) ==3152214== by 0x48ACB3B: cmd_execute_command (command.c:1133) ==3152214== by 0x48AD063: cmd_execute (command.c:1288) ==3152214== by 0x493D8EE: vty_command (vty.c:526) ==3152214== by 0x493D397: vty_execute (vty.c:1293) ==3152214== by 0x493C4EC: vtysh_read (vty.c:2126) ==3152214== by 0x49319DC: thread_call (thread.c:1548) Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-04-09pbrd: delete pbr nhg cache after rlease from hashStephen Worley
Actually delete the allocated pbr_nhg_cache object we just released. Found via memory leak: ==3078405== 136 bytes in 1 blocks are definitely lost in loss record 8,282 of 8,802 ==3078405== at 0x483BB1A: calloc (vg_replace_malloc.c:762) ==3078405== by 0x48E35E8: qcalloc (memory.c:110) ==3078405== by 0x40EBA7: pbr_nhgc_alloc (pbr_nht.c:194) ==3078405== by 0x48CC0EB: hash_get (hash.c:148) ==3078405== by 0x40F825: pbr_nht_add_individual_nexthop (pbr_nht.c:534) ==3078405== by 0x409853: pbr_map_nexthop_magic (pbr_vty.c:400) ==3078405== by 0x4093F1: pbr_map_nexthop (pbr_vty_clippy.c:417) ==3078405== by 0x48ACF72: cmd_execute_command_real (command.c:1073) ==3078405== by 0x48ACB3B: cmd_execute_command (command.c:1133) ==3078405== by 0x48AD063: cmd_execute (command.c:1288) ==3078405== by 0x493D8EE: vty_command (vty.c:526) ==3078405== by 0x493D397: vty_execute (vty.c:1293) Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-04-09pbrd: add seqno to debug in pbr_send_pbr_mapStephen Worley
Add some more debug info for the sequence number we are sending to zebra in pbr_send_pbr_map(). Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-03-19pbrd: convert gotos in set vrf command to returnsStephen Worley
We were doing a bunch of gotos in the set vrf configcode. The code got complex enough that just returning is easier to read. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-03-19pbrd: properly handle duplicate set vrf XX configsStephen Worley
Properly handle the case where we are sent the same `set vrf` configs for a pbr map repeatedly. If we are sent the same config, we return successfully without doing anyting. If the config is different and its not a [no], then return failure as we did before since we don't support atomic replace yet. Before, we would fail anytime even if the config sent was the same as is already there. This would cause frr-reload to mark as a failure when it tried to re-apply the same config. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-03-06*: Finish off the __PRETTY_FUNCTION__ to __func__Donald Sharp
FINISH IT Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-05*: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__Donatas Abraitis
Just keep the code cool. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-04*: Use short version of bool expressionsDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-28*: change hash_backet to hash_bucketDonald Sharp
It's been a year search and destroy. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-25pbrd: unconfigure table rangeStephen Worley
Implement the [no] version of `pbr table range`. We had the command but were doing nothing with it. This just calls the set_table_range API again using the defaults. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-01-15doc: rename man pages to frr-*David Lamparter
The vrrpd one conflicts with the standalone vrrpd package; also we're installing daemons to /usr/lib/frr on some systems so they're not on PATH. Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-09lib, zebra: Allow for encode/decode of nexthop weight in pass downDonald Sharp
Add code to encode/decode the nexthop weight when we pass it down into zebra. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-12-06Merge pull request #5499 from sworleys/Pbr-DetailJafar Al-Gharaibeh
pbrd: make the show pbr map output better
2019-12-06Merge pull request #5421 from sworleys/PBR-Del-Mark-All-SeqJafar Al-Gharaibeh
pbrd: only remove interface after all seq uninstalled
2019-12-06pbrd: use yes/no for pbr map validity vty outputStephen Worley
Change the pbr map validity state to indicate yes/no rather than 1/0 in the `show pbr map` command. Humans aren't robots, so don't use binary. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-06pbrd: use spaces in show pbr map vty outputStephen Worley
We were using a mix of spaces and tabsin show pbr map vty output. Tabs can be inconsistent depending on the system settings. Using spaces is a safer option for more consistent output. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-06pbrd: make vty nexthop/nexthop-group output consistentStephen Worley
The vty output for pbr maps with a nexthop-group was not consistent with those configured with an individual nexthop. Fix that so its easier for users to read. alfred# show pbr map pbr-map TEST1 valid: 1 Seq: 222 rule: 521 Installed: yes Reason: Valid SRC Match: 2.2.2.2/32 Nexthop-Group: blue Installed: yes Tableid: 10000 Seq: 333 rule: 632 Installed: yes Reason: Valid SRC Match: 3.3.3.3/32 Nexthop-Group: blue Installed: yes Tableid: 10000 Seq: 444 rule: 743 Installed: yes Reason: Valid SRC Match: 4.4.4.4/32 Nexthop-Group: blue Installed: yes Tableid: 10000 Seq: 555 rule: 854 Installed: yes Reason: Valid SRC Match: 5.5.5.5/32 Nexthop-Group: red Installed: yes Tableid: 10001 Seq: 666 rule: 965 Installed: yes Reason: Valid SRC Match: 6.6.6.6/32 nexthop 1.1.1.1 Installed: yes Tableid: 10002 alfred# Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-06pbrd: make show pbr map detail actually workStephen Worley
The `detail` keyword was doing literally nothing. Changed the default show to be a bit more user friendly and detail to give the information you might would need for debugging. alfred# show pbr map pbr-map TEST1 valid: 1 Seq: 222 rule: 521 Installed: yes Reason: Valid SRC Match: 2.2.2.2/32 Nexthop-Group: blue(10000) Installed: yes Seq: 333 rule: 632 Installed: yes Reason: Valid SRC Match: 3.3.3.3/32 Nexthop-Group: blue(10000) Installed: yes Seq: 444 rule: 743 Installed: yes Reason: Valid SRC Match: 4.4.4.4/32 Nexthop-Group: blue(10000) Installed: yes Seq: 555 rule: 854 Installed: yes Reason: Valid SRC Match: 5.5.5.5/32 Nexthop-Group: red(10001) Installed: yes Seq: 666 rule: 965 Installed: yes Reason: Valid SRC Match: 6.6.6.6/32 nexthop 1.1.1.1 Installed: yes Tableid: 10002 alfred# show pbr map detail pbr-map TEST1 valid: 1 Seq: 222 rule: 521 Installed: 1(1) Reason: Valid SRC Match: 2.2.2.2/32 Nexthop-Group: blue(10000) Installed: 1(1) Seq: 333 rule: 632 Installed: 1(2) Reason: Valid SRC Match: 3.3.3.3/32 Nexthop-Group: blue(10000) Installed: 1(1) Seq: 444 rule: 743 Installed: 1(3) Reason: Valid SRC Match: 4.4.4.4/32 Nexthop-Group: blue(10000) Installed: 1(1) Seq: 555 rule: 854 Installed: 1(4) Reason: Valid SRC Match: 5.5.5.5/32 Nexthop-Group: red(10001) Installed: 1(1) Seq: 666 rule: 965 Installed: 1(5) Reason: Valid SRC Match: 6.6.6.6/32 nexthop 1.1.1.1 Installed: 1(1) Tableid: 10002 alfred# Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-06pbrd: refactor vty map show output into functionsStephen Worley
Refactor the pbr_map and pbr_map_sequence vty output into some functions to make the code a bit easier to read. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-03pbrd: make vty `match *` code more readableStephen Worley
Make the vty match src|dst|mark code a bit more readable in its conditonal logic. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-03pbrd: consolidate rule_notify debugs into one callStephen Worley
Consolidate the rule_notify_owner() debugs based on type into one call, making use of zapi_rule_notify_owner2str() to do so. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-03pbrd: Add newlines in `set nexthop*` vty outputStephen Worley
We were missing some newlines in handling vty outputs for the `set nexthop*` commands. Add them in there. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-03pbrd: use dst string in match dst-ip vty descriptionStephen Worley
The vty description for the `set match dst-ip` command was using "src ip" in its description. Change it to use "dst ip". Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-03pbrd: don't silently fail on atomic match MARK change attemptsStephen Worley
Also don't silently fail when we attempt to atomically change a match MARK to a new one. We would overwrite the frist one but never actually install it. Change it to explicitly fail if a config is already present for now. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-03pbrd: don't silently fail on atomic match IP change attemptsStephen Worley
Currently pbrd does not support the abilitity to make atomic changes to a config. ex) `match src-ip 1.1.1.1/32` `match src-ip 1.1.1.0/24` We would overwrite the first one but never actually install it. In the `set nexthop commands` we explicitly fail if there is already a `set nexthop` config present. This patch extends the match src/dest-ip configs to do the same. In the future we should make all these commands atomic but for now its better to not fail silently at the very least. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-03pbrd: don't set rule removed on failStephen Worley
Don't treat a remove failure as a successful remove. This can cause us to get out of sync with the kernel. Pbrd makes decisions on rule handling based on its installed state so this needs to be as close to accurate as possible. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-02pbrd: only remove interface after all seq uninstalledStephen Worley
Only remove the interface from the pbr_map after we get a callback from zapi that every sequence using that interface has been removed. Before, if we created a map with multiple sequences and put that on an interface, then removed it from that interface, it would fail to mark the sequences after the first one as uninstalled. This was because we failed to lookup the other ones after we removed the interface from the pbr_map. This patch adds a conditional to only delete the interface from the pbr map if all its sequneces using that interface have been uninstalled. This patch extends the work done in 38e9ccde2f8edd6946d48c80967027d05e64d73f Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-02*: generously apply constDavid Lamparter
const const const your boat, merrily down the stream... Signed-off-by: David Lamparter <equinox@diac24.net>
2019-11-30*: make frr_yang_module_info constDavid Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-11-21pbrd: Add `set vrf NAME` and `set vrf unchanged`Stephen Worley
`set vrf NAME` allows the pbr map to point to an arbitrary vrf table. `set vrf unchanged` will use the interface's vrf for table lookup. Further, add functionality for pbr to respond to interface events such as interface vrf changes & interface creation/deletion. Ex) ubuntu_nh# show pbr map pbr-map TEST valid: 1 Seq: 1 rule: 300 Installed: 3(1) Reason: Valid SRC Match: 3.3.3.3/32 VRF Unchanged (use interface vrf) pbr-map TEST2 valid: 1 Seq: 2 rule: 301 Installed: 3(2) Reason: Valid SRC Match: 4.4.4.4/32 VRF Lookup: vrf-red root@ubuntu_nh:/home# ip rule show 0: from all lookup local 300: from 3.3.3.3 iif dummy2 lookup main 300: from 3.3.3.3 iif dummyVRF lookup 1111 301: from 4.4.4.4 iif dummy1 lookup 1111 301: from 4.4.4.4 iif dummy3 lookup 1111 Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com-
2019-11-02*: Convert connected_free to a double pointerDonald Sharp
Set the connected pointer to set the pointer to NULL. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-02*: Convert prefix_free to double pointerDonald Sharp
Have the prefix_free code take a double pointer to free the data. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-25lib,pbrd,zebra: Use one api to delete nexthops/groupStephen Worley
Reduce the api for deleting nexthops and the containing group to just one call rather than having a special case and handling it separately. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25pbrd: nexthop_group delete cb don't free pbr->nhgStephen Worley
The pbr->nhg callback is used exclusively for individual nexthops set through `set nexthop`. If an actuall "tracked" nexthop_group is used, only the `pbrms->nhgrp_name` is set. Thus this delete does nothing. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-07pbrd: Don't track ipv6 link localsStephen Worley
Don't bother tracking ipv6 link locals to determine if a map should be installed. Every interface has a route of `fe80::/64` so its just going to return the arbitrarily first one it finds when it resolves it and hands it back to us. Instead, just track the interface we specify along with it. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-09-30Merge pull request #5009 from donaldsharp/interface_deletionRuss White
lib, zebra: Allow for interface deletion when kernel event happens
2019-09-25Merge pull request #5051 from idryzhov/fix-vrf-autocompleteDonald Sharp
*: fix missing VRF autocompletions
2019-09-24*: fix missing VRF autocompletionsIgor Ryzhov
Current autocompletion works only for simple "vrf NAME" case. This commit expands it also for the following cases: - "nexthop-vrf NAME" in staticd - usage of $varname in many daemons All daemons are updated to use single varname "$vrf_name". Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2019-09-24pbrd: We should be looking for v4 and v6 nexthop typesDonald Sharp
The code should be looking for both v4 and v6 nexthop types instead of v4 nexthop types 2 times. Found by Coverity SA Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19*: Convert zapi->interface_delete to ifp callbackDonald Sharp
Convert the callback of the interface_delete to the new ifp callback. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>