summaryrefslogtreecommitdiffstats
path: root/pbrd (follow)
Commit message (Collapse)AuthorAgeFilesLines
* build: make clippy Makefile rules nicerDavid Lamparter2020-04-271-5/+4
| | | | | | | 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>
* build: use VPATH for vtysh_scanDavid Lamparter2020-04-271-2/+2
| | | | | | No need to put $(top_srcdir) everywhere. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: move CLI node names to cmd_node->nameDavid Lamparter2020-04-161-0/+3
| | | | | | | 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>
* *: move CLI parent data to cmd_node->parent_nodeDavid Lamparter2020-04-161-0/+2
| | | | | | | 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>
* *: remove second parameter on install_node()David Lamparter2020-04-161-5/+8
| | | | | | | | | | 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>
* *: remove cmd_node->vtyshDavid Lamparter2020-04-161-3/+0
| | | | | | | 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>
* *: clean up cmd_node initializersDavid Lamparter2020-04-161-3/+13
| | | | | | ... and use named assignments everywhere (so I can change the struct.) Signed-off-by: David Lamparter <equinox@diac24.net>
* pbrd: fix wording in pbr_send_pbr_map commentStephen Worley2020-04-141-1/+1
| | | | | | | 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>
* pbrd: separate `set *` and `no set *` commandsStephen Worley2020-04-091-31/+64
| | | | | | | | | | | | | | | 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>
* pbrd: implement `set *` and `match *` config replacementStephen Worley2020-04-097-168/+130
| | | | | | | | | | | | | 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>
* pbrd: free nexthop_group name on `no set nexthop-group`Stephen Worley2020-04-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | 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>
* pbrd: delete pbr nhg cache after rlease from hashStephen Worley2020-04-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | 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>
* pbrd: add seqno to debug in pbr_send_pbr_mapStephen Worley2020-04-091-3/+3
| | | | | | | 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>
* pbrd: convert gotos in set vrf command to returnsStephen Worley2020-03-191-12/+7
| | | | | | | 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>
* pbrd: properly handle duplicate set vrf XX configsStephen Worley2020-03-191-3/+33
| | | | | | | | | | | | | | | 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>
* *: Finish off the __PRETTY_FUNCTION__ to __func__Donald Sharp2020-03-062-19/+14
| | | | | | FINISH IT Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__Donatas Abraitis2020-03-053-75/+56
| | | | | | Just keep the code cool. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: Use short version of bool expressionsDonatas Abraitis2020-03-041-1/+1
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: change hash_backet to hash_bucketDonald Sharp2020-02-281-2/+2
| | | | | | | It's been a year search and destroy. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* pbrd: unconfigure table rangeStephen Worley2020-02-251-2/+15
| | | | | | | | | 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>
* doc: rename man pages to frr-*David Lamparter2020-01-151-1/+1
| | | | | | | | 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>
* lib, zebra: Allow for encode/decode of nexthop weight in pass downDonald Sharp2019-12-091-0/+1
| | | | | | | Add code to encode/decode the nexthop weight when we pass it down into zebra. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Merge pull request #5499 from sworleys/Pbr-DetailJafar Al-Gharaibeh2019-12-071-57/+83
|\ | | | | pbrd: make the show pbr map output better
| * pbrd: use yes/no for pbr map validity vty outputStephen Worley2019-12-061-1/+2
| | | | | | | | | | | | | | | | | | 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>
| * pbrd: use spaces in show pbr map vty outputStephen Worley2019-12-061-14/+16
| | | | | | | | | | | | | | | | 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>
| * pbrd: make vty nexthop/nexthop-group output consistentStephen Worley2019-12-061-16/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * pbrd: make show pbr map detail actually workStephen Worley2019-12-061-13/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * pbrd: refactor vty map show output into functionsStephen Worley2019-12-061-57/+56
| | | | | | | | | | | | | | 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>
* | Merge pull request #5421 from sworleys/PBR-Del-Mark-All-SeqJafar Al-Gharaibeh2019-12-071-1/+32
|\ \ | |/ |/| pbrd: only remove interface after all seq uninstalled
| * pbrd: only remove interface after all seq uninstalledStephen Worley2019-12-021-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | pbrd: make vty `match *` code more readableStephen Worley2019-12-031-17/+22
| | | | | | | | | | | | | | Make the vty match src|dst|mark code a bit more readable in its conditonal logic. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* | pbrd: consolidate rule_notify debugs into one callStephen Worley2019-12-031-10/+3
| | | | | | | | | | | | | | | | 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>
* | pbrd: Add newlines in `set nexthop*` vty outputStephen Worley2019-12-031-4/+4
| | | | | | | | | | | | | | 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>
* | pbrd: use dst string in match dst-ip vty descriptionStephen Worley2019-12-031-1/+1
| | | | | | | | | | | | | | 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>
* | pbrd: don't silently fail on atomic match MARK change attemptsStephen Worley2019-12-031-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | pbrd: don't silently fail on atomic match IP change attemptsStephen Worley2019-12-031-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | pbrd: don't set rule removed on failStephen Worley2019-12-031-0/+5
|/ | | | | | | | | | 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>
* *: generously apply constDavid Lamparter2019-12-021-1/+1
| | | | | | const const const your boat, merrily down the stream... Signed-off-by: David Lamparter <equinox@diac24.net>
* *: make frr_yang_module_info constDavid Lamparter2019-11-301-1/+1
| | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* pbrd: Add `set vrf NAME` and `set vrf unchanged`Stephen Worley2019-11-219-51/+550
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | `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-
* *: Convert connected_free to a double pointerDonald Sharp2019-11-021-1/+1
| | | | | | Set the connected pointer to set the pointer to NULL. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Convert prefix_free to double pointerDonald Sharp2019-11-021-8/+4
| | | | | | Have the prefix_free code take a double pointer to free the data. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib,pbrd,zebra: Use one api to delete nexthops/groupStephen Worley2019-10-251-2/+0
| | | | | | | | 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>
* pbrd: nexthop_group delete cb don't free pbr->nhgStephen Worley2019-10-251-1/+0
| | | | | | | | | 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>
* pbrd: Don't track ipv6 link localsStephen Worley2019-10-083-4/+19
| | | | | | | | | | | 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>
* Merge pull request #5009 from donaldsharp/interface_deletionRuss White2019-09-303-36/+12
|\ | | | | lib, zebra: Allow for interface deletion when kernel event happens
| * *: Convert zapi->interface_delete to ifp callbackDonald Sharp2019-09-191-20/+1
| | | | | | | | | | | | | | Convert the callback of the interface_delete to the new ifp callback. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
| * *: Convert interface_down to interface down callbackDonald Sharp2019-09-191-11/+1
| | | | | | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
| * *: Convert from ->interface_up to the interface callbackDonald Sharp2019-09-191-11/+1
| | | | | | | | | | | | | | For all the places we have a zclient->interface_up convert them to use the interface ifp_up callback instead. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
| * *: Switch all zclient->interface_add to interface create callbackDonald Sharp2019-09-191-14/+1
| | | | | | | | | | | | | | Switch the zclient->interface_add functionality to have everyone use the interface create callback in lib/if.c Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>