summaryrefslogtreecommitdiff
path: root/zebra/zebra_srv6_vty.c
AgeCommit message (Collapse)Author
2024-12-22zebra: Remove tests for `srv6_locator_alloc` failureCarmine Scarpitta
`srv6_locator_alloc` can never fail. Let's remove the tests for allocation failure. Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-08-18zebra: Fix compilation warningCarmine Scarpitta
Make sure the variable `srv6` is not NULL before dereferencing it. Fixes the following compilation warnings: ``` error 15-Aug-2024 14:20:01 zebra/zebra_srv6_vty.c:974:8: warning: Access to field 'locators' results in a dereference of a null pointer (loaded from variable 'srv6') [core.NullDereference] error 15-Aug-2024 14:20:01 for (ALL_LIST_ELEMENTS_RO(srv6->locators, node, locator)) { error 15-Aug-2024 14:20:01 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error 15-Aug-2024 14:20:01 ./lib/linklist.h:345:11: note: expanded from macro 'ALL_LIST_ELEMENTS_RO' error 15-Aug-2024 14:20:01 (node) = listhead(list), ((data) = NULL); \ error 15-Aug-2024 14:20:01 ^~~~~~~~~~~~~~ error 15-Aug-2024 14:20:01 ./lib/linklist.h:63:22: note: expanded from macro 'listhead' error 15-Aug-2024 14:20:01 #define listhead(X) ((X) ? ((X)->head) : NULL) error 15-Aug-2024 14:20:01 ^ ``` Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-06-13zebra: CLI to specify format of an SRv6 locatorCarmine Scarpitta
Add the CLI to choose the SID format of a locator. When the SID format of a locator is changed, the SIDs allocated from that locator might no longer be valid (for example, because the new format might involve a different SID allocation schema). In such a case, it is necessary to notify all the zclients so that they can withdraw/uninstall the old SIDs that use the previous format and allocate/install/advertise the new SIDs based on the new format. Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-06-13zebra: Add support for SRv6 SID blocksCarmine Scarpitta
An SRv6 block is an IPv6 prefix from which SIDs are allocated. This commit adds support for SRv6 SID blocks. Specifically, it adds a data structure to store information about an SRv6 block (e.g., its occupancy status, which SIDs have been allocated and which are available, which SID format is used for that block, etc.). It also adds some functions to manage the block (allocate / free / lookup). These functions will be used in the next commits to support the allocation of SIDs from a block in the SID Manager. Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-06-13zebra: CLI to override default SID format configCarmine Scarpitta
Add CLI commands to support overriding default configuration of the SID format. Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-06-13zebra: Add support for SRv6 SID formatsCarmine Scarpitta
Add functionalities to manage SRv6 SID formats (register / unregister / lookup) and create two SID formats upon SRv6 Manager initialization: `uncompressed-f4024` and `usid-f3216`. In future commits, we will add the CLI to allow the user to choose between the two formats. Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-06-04zebra: display srv6 encapsulation source-address when configuredPhilippe Guibert
The 'show running-config' does not display the ipv6 source address when a locator is not configured. Fix this by systematically displaying the ipv6 source address. Fixes: 6a0956169b31 ("zebra: Add encap source address to SRv6 config write function") Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-12-14zebra: Add encap source address to SRv6 config write functionCarmine Scarpitta
When writing the SRv6 config from zebra, we must also include the source address of outer encapsulating IPv6 header. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-12-14zebra: Add CLI command to verify SRv6 ManagerCarmine Scarpitta
Add a new CLI command `show segment-routing srv6 manager [json]` to verify the overall SRv6 state. The current output displays only the configured source address of outer encapsulating IPv6 header. The output can be extended in the future to show more information, including summary SRv6 information and supported capabilities. Example: ``` r1# show segment-routing srv6 manager Parameters: Encapsulation: Source Address: Configured: fc00:0:1::1 r1# show segment-routing srv6 manager json { "parameters":{ "encapsulation":{ "sourceAddress":{ "configured":"fc00:0:1::1" } } } } ``` Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-12-14zebra, lib, vtysh: Add CLI cmd to set/unset SRv6 encap source addressCarmine Scarpitta
- Add a new node `SRV6_ENCAP_NODE` to the CLI graph. This node allows users to configure encapsulation parameters for SRv6, including the source address of the outer encapsulating IPv6 header. - Install a new CLI command `source-address` under the `SRV6_ENCAP_NODE` node. This command is used to configure the source address of the outer encapsulating IPv6 header. - Install a new CLI command `no source-address` under the `SRV6_ENCAP_NODE` node. This command is used to unset the source address of the outer encapsulating IPv6 header and restore the default source address. Examples: ``` router# segment-routing router(sr)# srv6 router(srv6)# encapsulation router(srv6-encap)# source-address fc00:0:1::1 ``` ``` router# segment-routing router(sr)# srv6 router(srv6)# encapsulation router(srv6-encap)# no source-address ``` Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-12-05zebra: Add missing newline in SRv6 config writeCarmine Scarpitta
The `behavior usid` command is installed under the SRv6 Locator node in the zebra VTY. However, in the SRv6 config write function this command is wrongly put on the same line as the `prefix X:X::X:X/M` command. This causes a failure when an SRv6 uSID locator is configured in zebra and `frr-reload.py` is used to reload the FRR configuration. This commit prepends a newline character to the `behavior usid` command in the SRv6 config write function. The output of `show running-config` before and after this commit is shown below. Before: ``` Building configuration... Current configuration: ! frr version 8.5-dev ! segment-routing srv6 locators locator loc1 prefix fc00:0:1::/48 block-len 32 node-len 16 behavior usid exit ! exit ! exit ! exit ! end ``` After: ``` Building configuration... Current configuration: ! segment-routing srv6 locators locator loc1 prefix fc00:0:1::/48 block-len 32 node-len 16 behavior usid exit ! exit ! exit ! exit ! end ``` Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-11-22bgpd: Fix the other of SR locator parametersRyoga Saito
The latest FRR's frr-reload.py is broken and we can't reload FRR gracefully with segment routing locator configuration (if we execute frr-reload.py, FRR will stop suddenly). The root cause of this issue is very simple. FRR will display the current configuration like this (the below is the result of "show running-configuration"). `` segment-routing srv6 locators locator default prefix fd00:1:0:1::/64 block-len 40 node-len 24 func-bits 16 exit ! exit ! exit ! exit ``` However, FRR doesn't accept segment routing locator parameters if we specify block-len and node-len earlier than func-bits. Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
2022-11-14Merge pull request #12219 from cscarpitta/feature/srv6-usid-behavior-supportDonatas Abraitis
bgpd, zebra: Add support for SRv6 uSID Behaviors
2022-11-08zebra: Add `behavior usid` command to VTYCarmine Scarpitta
Install a new command `behavior usid` into the `SRV6_LOC_NODE` CLI node. This command allows the user to set/unset the `SRV6_LOCATOR_USID` flag for an SRv6 locator. The `SRV6_LOCATOR_USID` flag indicates whether a locator is a uSID locator or not. When the flag is set, the routing daemons (e.g., bgpd) will install SRv6 behaviors with the uSID in the dataplane. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-11-08lib,zebra: Add SRv6 uSID info to VTY outputCarmine Scarpitta
In this commit, we extend to print the `SRV6_LOCATOR_USID` flag. The output appears as follows: ``` { "locators":[ { "name":"loc1", "prefix":"fc00:0:1::/48", "blockBitsLength":32, "nodeBitsLength":16, "functionBitsLength":16, "argumentBitsLength":0, "uSID":true, "statusUp":true, "chunks":[ { "prefix":"fc00:0:1::/48", "proto":"bgp" } ] } ] } ``` Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-10-26build, vtysh: extract vtysh commands from .xrefDavid Lamparter
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>
2022-10-18zebra: Do not allow SRv6 func_bit_len > 20Carmine Scarpitta
Currently, the SID transposition algorithm implemented in bgpd handles incorrectly the SRv6 locators with function length greater than 20 bits. To prevent issues, we currently limit the function length to 20 bits. This limit will be removed when the bgpd SID transposition is fixed. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-10-18zebra: Ensure SRv6 SID length does not exceed 128Carmine Scarpitta
According to RFC 8986, the SRv6 SID length cannot exceed 128 bits. This commit ensures that the condition `block_len + node_len + function_len + arg_len <= 128` is satisfied when a new SRv6 locator is created. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-10-18zebra: add missing bits len to SRv6 locator detailCarmine Scarpitta
This commit adds SRv6 locator's block length, node length and argument length to the output of the command "show segment-routing srv6 locator NAME detail [json]". Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-10-18zebra: add block/node/arg len to zebra sr configCarmine Scarpitta
This commit adds the SRv6 locator's block length, node length and argument length to the SRv6 configuration. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-10-18zebra: add new CLI args "block-len" and "node-len"Carmine Scarpitta
In the current implementation, an SRv6 locator only supports the following structure: * node-len = 24 * block-len = prefix-len - 24 * function-len = <configurable> * argument-len = 0 This commit adds two optional arguments to the locator_prefix CLI command: "node-len" and "block-len". These arguments allows an user to configure the block length and node length of a SRv6 locator according to the following logic: * the node-len + block-len = prefix-len constraint must always be satisfied; * if node-len and block-len are both omitted, they are calculated as in the current implementation (for backward compatibility reasons) * if node-len is omitted, its value is computed as prefix-len - block-len * if block-len is omitted, its value is computed as prefix-len - node-len Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-10-07zebra: expand func-bitsRyoga Saito
In order to set function length of SID freely, this PR relieves the lower limitation of `func-bits`. Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
2022-10-07zebra: add default SRv6 Function lengthRyoga Saito
Add default SRv6 Function Length for usecases like SRv6 L3VPN. The default value (16) comes from the default Function length for SRv6 L3VPN in BGPd. Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
2022-03-28zebra: output optional param "func-bits" for SRv6Nobuhiro MIKI
Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
2021-12-14Merge pull request #9899 from Drumato/zebra-srv6-locator-detail-json-supportDonatas Abraitis
zebra: Add support for json output in srv6 locator detail command
2021-11-28zebra: Add support for json output in srv6 locator detail commandYamato Sugawara
Signed-off-by: Yamato Sugawara <yamato.sugawara@linecorp.com>
2021-11-25zebra: Convert vty_out to vty_json for JSONDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-09-07zebra: add srv6's no commandsHiroki Shirokura
CURRENT_CONFIGURATION: configure terminal segment-routing srv6 locators locator loc1 locator loc2 locator loc3 CMD1: delete single locator configure terminal segment-routing srv6 locators no locator loc1 CMD2: delete srv6 whole config (== delete all locators) configure terminal segment-routing no srv6 Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-08-23*: explicitly print "exit" at the end of every node configIgor Ryzhov
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>
2021-06-02*: fix code format accourding to checkpatchHiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02zebra: add zapi_srv6_locator_chunk_{en,de}codeHiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02zebra: rewrite locator_prefix_cmd with DEFPYHiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02*: fix code format accourding to checkpatchHiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02zebra: add new CLI to manipulate srv6-locator (step2)Hiroki Shirokura
This commit is a part of #5853 works that add new clis to configure SRv6 locator and its show commands. Following clis are added on this commit. vtysh -c 'conf te' \ -c 'segment-routing' \ -c ' srv6' \ -c ' locators' \ -c ' locator LOC1' \ -c ' prefix A::/64' - "show segment-routing srv6 sid [json]" - "show segment-routing srv6 locator [json]" - "show segment-routing srv6 locator NAME detail [json]" - "show runnning-config" (make it to print srv6 configuration) Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02*: new cli-nodes for SRv6 manager (step2)Hiroki Shirokura
This commit is a part of #5853 that add new cmd-node for SRv6 configuration. This commit just add cmd-node and moving node cli only, acutual SRv6 config command isn't added. (that is added later commit. of this branch) new cli nodes: * SRv6 * SRv6-locators * SRv6-locator Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>