summaryrefslogtreecommitdiffstats
path: root/pbrd (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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>
| * *: Add infrastructure to support zapi interface callbacksDonald Sharp2019-09-193-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Start the conversion to allow zapi interface callbacks to be controlled like vrf creation/destruction/change callbacks. This will allow us to consolidate control into the interface.c instead of having each daemon read the stream and react accordingly. This will hopefully reduce a bunch of cut-n-paste stuff Create 4 new callback functions that will be controlled by lib/if.c create -> A upper level protocol receives an interface creation event The ifp is brand spanking newly created in the system. up -> A upper level protocol receives a interface up event This means the interface is up and ready to go. down -> A upper level protocol receives a interface down destroy -> A upper level protocol receives a destroy event This means to delete the pointers associated with it. At this point this is just boilerplate setup for future commits. There is no new functionality. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | Merge pull request #5051 from idryzhov/fix-vrf-autocompleteDonald Sharp2019-09-251-4/+4
|\ \ | | | | | | *: fix missing VRF autocompletions
| * | *: fix missing VRF autocompletionsIgor Ryzhov2019-09-241-4/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | 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>
* / pbrd: We should be looking for v4 and v6 nexthop typesDonald Sharp2019-09-241-1/+1
|/ | | | | | | | 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>
* pbrd: Handle GATEWAY_IFINDEX nht conflictsStephen Worley2019-09-131-16/+104
| | | | | | | | | | | | | | | | | In pbrd we did not care if the nexthop interface nexthop tracking sent us back did not match the one specified with `nexthop [GATEWAY] [INTERFACE]`. This happened if the gateway was resolvable via a different interface and the inteface we specified in the config was unnumbered (no ipv4 address on it) since the default route gets forced onlink when it gets into zebra. This patch adds a check to not install the rule if the interface we got back was different from the specified. This patch also reworks the nexthop update path to make it a little more clear what its doing. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* pbrd: initial fwmark support for pbr matches #4460Marcin Matląg2019-09-034-7/+41
| | | | | | | | | | | | | Adds support to specify marks in pbr-map match clause. Marks should be provided as decimal (unsigned int). Currently supported on Linux only. Attempting to configure marks on other platform will result in: "pbr marks are not supported on this platform" Signed-off-by: Marcin Matlag <marcin.matlag@gmail.com> Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
* pbrd, sharpd, staticd: Add some color to sample configuration filesDonald Sharp2019-08-191-0/+16
| | | | | | | | The sample configuration files for pbrd, sharpd and staticd where all the same. Add some bit of color to help new people get rolling on these three daemons. Signed-off-by: Donald Sharp <sharpd@cumulusnetwork.com>
* pbrd: Do not install nexthop group until we have nexthopsDonald Sharp2019-07-171-1/+0
| | | | | | | | | The creation of a nexthop group results in a callback with just the nexthop group name. At this point in time we do not have any nexthop information so there is nothing to install. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: Private api for nexthop_group manipulationStephen Worley2019-06-262-4/+6
| | | | | | | | | | | Add a file that exposes functions which modify nexthop groups. Nexthop groups are techincally immutable but there are a few special cases where we need direct access to add/remove nexthops after the group has been made. This file provides a way to expose those functions in a way that makes it clear this is a private/hidden api. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* zebra,pbrd: Update pbrd to handle NHT properlyStephen Worley2019-06-101-0/+27
| | | | | | | | | | | | | Update pbrd to properly handle nexthop tracking. When we get a notification that a change happened on a nexthop, re-install it if its still valid. Before, we were running over all routes and re-queueing them if they were PBR routes. This commit removes that and puts all the processing in PBR instead. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* pbrd: Set next/prev to NULL on cached nexthopsStephen Worley2019-06-101-0/+2
| | | | | | | | | | When we copy a new nexthop to cache and track, set its next and prev pointers to NULL. We don't want those since this is to be treated as a single nexthop.Other nexthops that aren't in a group could hash to this nexthop so it doesn't make sense to keep those pointers in the cache. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* pbrd: Allow autocompletion for pbr-map PBRMAPDonald Sharp2019-06-051-3/+22
| | | | | | Allow the end user to auto-complete the pbr-map name. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib, pbrd, sharpd, vtysh: Add autocompletion for 'nexthop-group'Donald Sharp2019-06-051-1/+1
| | | | | | Add some auto-completion for the nexthop-group command Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>