summaryrefslogtreecommitdiffstats
path: root/pbrd/pbr_vty.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* pbrd: disallow ipv4/ipv6 mismatching in match src/dstStephen Worley2020-12-171-0/+10
| | | | | | | | | Disallow mismatching of ipv4/ipv6 matching in src/dst. Doesn't make a lot of sense to allow this based on how IP Headers work. The kernel does not allow it at all obviously. Signed-off-by: Stephen Worley <sworley@nvidia.com>
* pbrd: Fix memory leak in json outputDonald Sharp2020-11-041-3/+9
| | | | | | Fix a memory leak in using some pbr json commands. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* :* Convert prefix2str to %pFXDonatas Abraitis2020-10-221-11/+4
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: move "show debugging ..." commands to enable nodeIgor Ryzhov2020-10-021-1/+1
| | | | | | Use the same node for "show debugging" commands in all daemons. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* *: move "debug ..." commands to enable nodeIgor Ryzhov2020-10-021-1/+1
| | | | | | Use the same node for "debug" commands in all daemons. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* pbrd: Convert pnhc->nexthop to it's own dataDonald Sharp2020-08-281-3/+3
| | | | | | | | | | | The pnhc->nexthop was a pointer copy. Causing issues with the ability to move pointers around for the different pnhc since the pnhc mirrored the nexthop caches. When we received a vrf change if we shared pointers it was impossible to know if we had already updated the code. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pbrd: Allow interfaces to be deleted then added back inDonald Sharp2020-08-281-2/+4
| | | | | | | | | PBR needs the ability to allow ephermeal interfaces( bonds, vrfs, dummy, bridges, etc ) to be destroyed and then recreated and at the same time keep track of them and rebuild state as appropriate when we get a change. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: Allow nexthop simple display to take an alternate ifp nameDonald Sharp2020-08-281-1/+1
| | | | | | | | | | | The nexthop_group_write_nexthop_simple function outputs the interface name, because we've stored the ifindex. The problem is that there are ephermeal interfaces in linux that can be destroyed/recreated. Allow us to keep that data and do something a bit smarter to allow show run's and other show commands to continue to work when the interface is deleted. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pbrd: Properly hook back up when vrf is destroyed than recreatedDonald Sharp2020-08-281-2/+27
| | | | | | | | | | | | | | | | | Currently when a vrf is deleted than added back in PBR was not going through and touching up all the data structures that needed to be massaged to allow it to start working again. This includes: a) Search through the nexthop groups to find any nexthop that references the old nexthop id and set it right again. b) Search through the nexthop cache for nht and reset those nexthops to the right vrf as well as re-register Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pbrd: expose dscp & ecn to json for `show pbr map`Wesley Coakley2020-07-151-0/+6
| | | | Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
* pbrd: dscp interpret standard codepointsWesley Coakley2020-07-151-6/+40
| | | | | | | Matching by dscp may now also be specified by its standard codepoint (provided it has one), such as `cf0` or `af11`. Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
* pbrd, zebra, lib: DSCP / ECN-based PBR MatchingWesley Coakley2020-07-151-0/+67
| | | | | | | | | | | | | | | | Extend PBR maps to discriminate by Differentiated Services Code Point and / or Explicit Congestion Notification fields. These fields are used in the IP header for classifying network traffic. 0 1 2 3 4 5 6 7 +-----+-----+-----+-----+-----+-----+-----+-----+ | DS FIELD, DSCP | ECN FIELD | +-----+-----+-----+-----+-----+-----+-----+-----+ DSCP: differentiated services codepoint ECN: Explicit Congestion Notification Signed-off-by: Wesley Coakley <wcoakley@nvidia.com> Signed-off-by: Saurav Kumar Paul <saurav@cumulusnetworks.com>
* pbrd: Be a bit more lenient with `set nexthop A.B.C.D <intf>`Donald Sharp2020-07-021-6/+17
| | | | | | | | | | | | | | When specifying an interface in a pbr-map `set nexthop ..` command be a bit more lenient about the interface. a) If the interface does not exist bail on the command (this is the same) b) If the interface exists but is in a different vrf than specified use the vrf it is actually in. (this is new behavior) Ticket: CM-30187 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pbrd, lib, doc: fix new `show` json key semanticsWesley Coakley2020-05-271-6/+6
| | | | | | | | | | | | Revise new `show pbr` keys to be consistent with existing json in other daemons target->nexthop id->tableId (where relevant) isValid->valid isInstalled->installed Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
* pbrd, doc: pbr map json `sequences` -> `policies`Wesley Coakley2020-05-271-1/+1
| | | | | | Semantics Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
* pbrd: `show` directives give arrays where approposWesley Coakley2020-05-271-6/+5
| | | | | | | The new json output for the `show pbr` directives return arrays instead of associative arrays, which are more meaningful in this context Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
* pbrd, lib: verbosity++ for json `show` directivesWesley Coakley2020-05-271-36/+26
| | | | | | | Increased the verbosity of the json keys and flattened the returned structure by removing superfluous keys. Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
* pbrd, lib: opt. json for `show pbr nexthop-group`Wesley Coakley2020-05-271-3/+19
| | | | Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
* pbrd: optional json for `show pbr map`Wesley Coakley2020-05-271-2/+109
| | | | Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
* pbrd: json added to `show pbr interface [json]`Wesley Coakley2020-05-271-2/+35
| | | | Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
* *: 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: 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-091-141/+71
| | | | | | | | | | | | | 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: 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>
* 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>
* 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>
* 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: 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: Add `set vrf NAME` and `set vrf unchanged`Stephen Worley2019-11-211-8/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | `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 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>
* pbrd: Don't track ipv6 link localsStephen Worley2019-10-081-1/+3
| | | | | | | | | | | 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>
* *: 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: initial fwmark support for pbr matches #4460Marcin Matląg2019-09-031-0/+33
| | | | | | | | | | | | | 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>
* lib: Private api for nexthop_group manipulationStephen Worley2019-06-261-1/+2
| | | | | | | | | | | 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>
* 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>
* Merge pull request #3776 from opensourcerouting/pbrd-interface-nexthopsDonald Sharp2019-03-221-40/+48
|\ | | | | pbrd: add support for interface nexthops
| * lib, pbrd: fix indentation of a few commandsRenato Westphal2019-02-151-4/+4
| | | | | | | | | | | | | | When displaying the running configuration, we should use a single space to indent commands when necessary (and not two spaces). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>