]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
23 months agotopotests: add bgp_vpnv6 test allocation
Philippe Guibert [Wed, 1 Feb 2023 16:28:15 +0000 (17:28 +0100)]
topotests: add bgp_vpnv6 test allocation

This test demonstrates that a label is allocated for each
ipv6 next-hop. IPv6 test introduces link local ipv6 addresses
as next hops, and compared to IPv4, one can have two different
next-hops depending if the next-hop is defined by a global
address (static route redistributed) or a bgp peer.

This test checks that:
- The labels are correctly allocated per connected next-hop.
- The default label is used for non connected prefixes.
- The withdraw operation frees the MPLS entry.
- If a recursive route is redistributed by BGP, then the nexthop
tracking will find the appropriate nexthop entry, and the
associated label will be found out.
- When a prefix moves from one peer to one another behind the
vrf, then the MPLS switching operation for return
traffic is changing the outgoing interface to use.
- When the 'label vpn export <value>' MPLS label value is changed,
then the modification is propagated to prefixes which use that value.
- Also, when unconfiguring the per-nexthop allocation mode, check
that the MPLS entries and the VPNv4 entries of r1 are changed
accordingly.
- Reversely, when re-configuring the per-nexthop allocation mode,
check that the allocation mode reuses the other label values.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
23 months agotopotests: add bgp mpls allocation per next-hop test
Philippe Guibert [Tue, 10 Jan 2023 13:53:54 +0000 (14:53 +0100)]
topotests: add bgp mpls allocation per next-hop test

A new test suite checks for the mpls label allocation
per nexthop mode. This test checks that:
- The labels are correctly allocated per connected
next-hop.
- The default label is used for non connected prefixes
- The withdraw operation frees the mpls entry.
- If a recursive route is redistributed by BGP, then the nexthop
tracking will find the appropriate nexthop entry, and the associated
label will be found out.
- When a prefix moves from one peer to one another behind the vrf,
then the MPLS switching operation for return traffic is changing
the outgoing interface to use.
- When the 'label vpn export <value>' MPLS label value is changed,
then the modification is propagated to prefixes which use that value.
- When unconfiguring the per-nexthop allocation mode, check
that the MPLS entries and the VPNv4 entries of r1 are changed
accordingly.
- Reversely, when re-configuring the per-nexthop allocation mode,
check that the allocation mode reuses the other label values.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
23 months agobgpd: add 'show bgp label-nexthop [detail]' command
Philippe Guibert [Mon, 16 Jan 2023 17:24:26 +0000 (18:24 +0100)]
bgpd: add 'show bgp label-nexthop [detail]' command

The following command is made available to list the labels
allocated per-nexthop, along with the paths registered to it.

 > # show bgp vrf vrf1 label-nexthop
 > Current BGP label nexthop cache for IP, VRF vrf1
 >  192.0.2.11, label 20 #paths 3
 >    if r1-eth1
 >    Last update: Mon Jan 16 18:52:11 2023
 >  192.0.2.12, label 17 #paths 2
 >    if r1-eth1
 >    Last update: Mon Jan 16 18:52:08 2023
 >  192.0.2.14, label 18 #paths 1
 >    if r1-eth1
 >    Last update: Mon Jan 16 18:52:07 2023
 >  192.168.255.13, label 19 #paths 1
 >    if r1-eth2
 >    Last update: Mon Jan 16 18:52:10 2023

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
23 months agobgpd: update time of last change when label nexthop entry changed
Philippe Guibert [Thu, 16 Feb 2023 12:46:32 +0000 (13:46 +0100)]
bgpd: update time of last change when label nexthop entry changed

A timer attribute is added for each label nexthop entry, in order
to know when the last change occured.
The timer value will be used for troubleshooting by a show
command in the next commit.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
23 months agobgpd: export redistributed routes with label allocation per nexthop
Philippe Guibert [Fri, 3 Mar 2023 20:33:34 +0000 (21:33 +0100)]
bgpd: export redistributed routes with label allocation per nexthop

The label allocation per nexthop mode requires to use a nexthop
tracking context. For redistributed routes, a nexthop tracking
context is created, and the resolution helps to know the real
nexthop ip address used. The below configuration example has
been used:

 > vrf vrf1
 >  ip route 172.31.0.14/32 192.0.2.14
 >  ip route 172.31.0.15/32 192.0.2.12
 >  ip route 172.31.0.30/32 192.0.2.30
 > exit
 > router bgp 65500 vrf vrf1
 >  address-family ipv4 unicast
 >   redistribute static
 >   label vpn export per-nexthop
 > [..]

The static routes are correctly imported in the BGP IPv4 RIB.
Contrary to label allocation per vrf mode, some nexthop tracking
are created/or reused:

 > # show bgp vrf vrf1 nexthop
 > 192.0.2.12 valid [IGP metric 0], #paths 3, peer 192.0.2.12
 >  if r1-eth1
 >  Last update: Fri Jan 13 15:49:42 2023
 > 192.0.2.14 valid [IGP metric 0], #paths 1
 >  if r1-eth1
 >  Last update: Fri Jan 13 15:49:42 2023
 > 192.0.2.30 valid [IGP metric 0], #paths 1
 >  if r1-eth1
 >  Last update: Fri Jan 13 15:49:51 2023
 > [..]

This results in having a BGP VPN route for each of the static
routes:

 > # show bgp ipv4 vpn
 > [..]
 > Route Distinguisher: 444:1
 >  *> 172.31.0.14/32   192.0.2.14@9<            0         32768 ?
 >  *> 172.31.0.15/32   192.0.2.12@9<            0         32768 ?
 >  *> 172.31.0.30/32   192.0.2.30@9<            0         32768 ?
 > [..]

Without that patch, only the redistributed routes that rely on a
pre-existing nexthop tracking context could be exported.

Also, a command in the code about redistributed routes is modified
accordingly, to explain that redistribute routes may be submitted
to nexthop tracking in the case label allocation per next-hop is
used.

note:
VNC routes have been removed from the redistribution,
because of a test failure in the bgp_l3vpn_to_bgp_direct test.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
23 months agobgpd: correctly initialize the IP nexthop of redistributed routes
Philippe Guibert [Fri, 13 Jan 2023 14:51:59 +0000 (15:51 +0100)]
bgpd: correctly initialize the IP nexthop of redistributed routes

This is a preliminary work to export redistributed routes from
a given VRF in an VPN network. The exportation works well, when
the label allocation is based on an per-vrf mode, but not on
a per nexthop mode.

To associate a label with a connected nexthop, the nexthop
tracking contexts are used. Until today, there was no tracking
context for redistributed routes. But when using this vpn
allocation mode, one needs to know whether the route is directly
connected or not. When using the nexthop tracking context, the
nexthop attribute of the bgp update needs to have the nexthop
properly set. This was not the case for the mp_nexthop_global_in
attribute which was empty.

This commit is mandatory in order to later use nexthop tracking
context.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
23 months agobgpd: use nexthop interface when adding LSP in BGP MPLSVPN
Philippe Guibert [Thu, 16 Feb 2023 09:39:40 +0000 (10:39 +0100)]
bgpd: use nexthop interface when adding LSP in BGP MPLSVPN

BGP MPLSVPN next hop label allocation was using only the next-hop
IP address. As MPLSVPN contexts rely on bnc contexts, the real
nexthop interface is known, and the LSP entry to enter can apply
to the specific interface. To illustrate, the BGP service is able
to handle the following two iproute2 commands:

 > ip -f mpls route add 105 via inet 192.0.2.45 dev r1-eth1
 > ip -f mpls route add 105 via inet 192.0.2.46 dev r1-eth2

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
23 months agobgpd: add support for l3vpn per-nexthop label
Philippe Guibert [Tue, 28 Feb 2023 13:25:02 +0000 (14:25 +0100)]
bgpd: add support for l3vpn per-nexthop label

This commit introduces a new method to associate a label to
prefixes to export to a VPNv4 backbone. All the methods to
associate a label to a BGP update is documented in rfc4364,
chapter 4.3.2. Initially, the "single label for an entire
VRF" method was available. This commit adds "single label
for each attachment circuit" method.

The change impacts the control-plane, because each BGP update
is checked to know if the nexthop has reachability in the VRF
or not. If this is the case, then a unique label for a given
destination IP in the VRF will be picked up. This label will
be reused for an other BGP update that will have the same
nexthop IP address.

The change impacts the data-plane, because the MPLs pop
mechanism applied to incoming labelled packets changes: the
MPLS label is popped, and the packet is directly sent to the
connected nexthop described in the previous outgoing BGP VPN
update.

By default per-vrf mode is done, but the user may choose
the per-nexthop mode, by using the vty command from the
previous commit. In the latter case, a per-vrf label
will however be allocated to handle networks that are not directly
connected. This is the case for local traffic for instance.

The change also include the following:

-  ECMP case
In case a route is learnt in a given VRF, and is resolved via an
ECMP nexthop. This implies that when exporting the route as a BGP
update, if label allocation per nexthop is used, then two possible
MPLS values could be picked up, which is not possible with the
current implementation. Actually, the NLRI for VPNv4 stores one
prefix, and one single label value, not two. Today, RFC8277 with
multiple label capability is not yet available.
To avoid this corner case, when a route is resolved via more than one
nexthop, the label allocation per nexthop will not apply, and the
default per-vrf label will be chosen.
Let us imagine BGP redistributes a static route using the `172.31.0.20`
nexthop. The nexthop resolution will find two different nexthops fo a
unique BGP update.

 > r1# show running-config
 > [..]
 > vrf vrf1
 >  ip route 172.31.0.30/32 172.31.0.20
 > r1# show bgp vrf vrf1 nexthop
 > [..]
 > 172.31.0.20 valid [IGP metric 0], #paths 1
 >  gate 192.0.2.11
 >  gate 192.0.2.12
 >  Last update: Mon Jan 16 09:27:09 2023
 >  Paths:
 >    1/1 172.31.0.30/32 VRF vrf1 flags 0x20018

To avoid this situation, BGP updates that resolve over multiple
nexthops are using the unique per-vrf label.

- recursive route case

Prefixes that need a recursive route to be resolved can
also be eligible for mpls allocation per nexthop. In that
case, the nexthop will be the recursive nexthop calculated.

To achieve this, all nexthop types in bnc contexts are valid,
except for the blackhole nexthops.

- network declared prefixes

Nexthop tracking is used to look for the reachability of the
prefixes. When the the 'no bgp network import-check' command
is used, network declared prefixes are maintained active,
even if there is no active nexthop.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
23 months agobgpd: add the bgp_label_per_nexthop_cache struct and apis
Philippe Guibert [Tue, 28 Feb 2023 13:17:17 +0000 (14:17 +0100)]
bgpd: add the bgp_label_per_nexthop_cache struct and apis

This commit introduces the necessary structs and apis to
create the cache entries that store the label information
associated to a given nexthop.

A hash table is created in each BGP instance for all the
AFIs: IPv4 and IPv6. That hash table is initialised.
An API to look and/or create an entry based on a given
nexthop.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
23 months agobgpd: introduce LP_TYPE_NEXTHOP label type
Philippe Guibert [Tue, 28 Feb 2023 13:11:30 +0000 (14:11 +0100)]
bgpd: introduce LP_TYPE_NEXTHOP label type

A new label type is introduced: LP_TYPE_NEXTHOP. This new
label type will be used in next commits to allocate labels
for a specific nexthop IP address.
The commit changes add vty and json outputs to display
the new label type and the label values associated.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
23 months agobgpd: add vty command to select label allocation per nexthop
Philippe Guibert [Wed, 15 Feb 2023 20:03:19 +0000 (21:03 +0100)]
bgpd: add vty command to select label allocation per nexthop

A new VTY command is introduced in ipv4 unicast and ipv6 unicast
address family, under a BGP instance.

 > r1# label vpn export allocation-mode per-nexthop|per-vrf

This command will update the label values associated for each
BGP update to export to the global instance. Two modes are
available: per-nexthop and per-vrf. The latter is the default
one.

With this commit only, configuring label allocation per nexthop
will only reset the BGP updates, and the per-vrf mode label
allocation will be chosen.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
23 months agobgpd: remove ATTR_NEXT_HOP for redistributed ipv6 nexthops
Philippe Guibert [Wed, 1 Feb 2023 15:52:28 +0000 (16:52 +0100)]
bgpd: remove ATTR_NEXT_HOP for redistributed ipv6 nexthops

This commit addresses an issue with an MPLS VPN network
redistributing static routes that are exported to the VPN,
and where the labels are allocated per next-hop.

For that purpose, the nexthop of the static routes is
checked against the nexthop tracking. The validation
of a valid nexthop will trigger the use of a unique
label for all prefixes using that destination.

However, the nexthop fails to be validated, with the
following message:

 > evaluate_paths: prefix 172:31::14/128 (vrf vrf1), ignoring path due to
 > martian or self-next-hop

The reason is due to the way the attr is created.
By default, the ATTR_NEXTHOP attribute is set for
all prefixes, whereas this flag should only be valid
for IPv4. In the case there is an IPv6 nexthop, remove
the ATTR_NEXTHOP flag.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
23 months agobgpd: encode_label call, remove unnecessary braces
Philippe Guibert [Sun, 19 Mar 2023 17:26:41 +0000 (18:26 +0100)]
bgpd: encode_label call, remove unnecessary braces

Remove unnecessary braces.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
23 months agozebra: mpls nexthop entry displays also interface when available
Philippe Guibert [Thu, 2 Mar 2023 09:46:31 +0000 (10:46 +0100)]
zebra: mpls nexthop entry displays also interface when available

The 'show mpls table json' command displays the outgoing interface
name only when the nexthop type is either NEXTHOP_TYPE_IFINDEX or
NEXTHOP_TYPE_IPV6_IFINDEX. add the interface name for the nexthop
type NEXTHOP_TYPE_IPV4_IFINDEX.

Fixes: ("b78b820d46d6") MPLS: Display enhancements and JSON support
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
23 months agozebra: handle nexthop vrf_id in ZEBRA_MPLS_LABELS messages
Philippe Guibert [Thu, 12 Jan 2023 07:44:29 +0000 (08:44 +0100)]
zebra: handle nexthop vrf_id in ZEBRA_MPLS_LABELS messages

This commit addresses the case where a service wants to install
an LSP entry to a next-hop located in a VRF instance. The incoming
MPLS packet is on the namespace and has to be directed to a nexthop
located behind an interface that sits in a specific VRF instance.
The below iproute command can illustrate:

  > ip link add vrf1 type vrf table 10
  > ip link set dev vrf1 up
  > ip link set dev eth0 master vrf1
  > ip a a 192.0.2.1/24 dev eth0
  > ip -f mpls route add 105 via inet 192.0.2.45 dev eth0

If a service uses the ZEBRA_MPLS_LABELS messages, then the LSP
message is ignored: from zebra perspective, the MPLS entries are
visible via the 'show mpls table' command, but no LSP entry is
installed in the kernel.

The issue is in the nhlfe_nexthop_active_ipv[4/6] function: the
outgoing interface mentioned in the nexthop is searched in the
main VRF, whereas the interface is in a separate VRF. The interface
is not found, and the nhlfe to install is considered not active.

To address this issue, reuse the incoming vrf_id parameter transmitted
in the nexthop structure from the ZEBRA_MPLS_LABELS message. When
creating an NHLFE entry, the vrf_id is used instead of the DEFAULT_VRF.
And the nhlfe entry can be considered as active.

One alternate solution to reuse the vrf_id parameter in the mpls network
context would be to modify the search function in nhlfe_nexthop_active..()
function: looking for an existing ifindex in the zns. However, this
solution may not fit later when netns backend would be used.

Note that some changes have not been done yet and are considered
sufficient for now:
- The 'nhlfe_find' API: the assumption is done that only the linux vrf
backend is used for now.

- The 'mpls_lsp_install()' API: It is currently used by the CLI command
which does not handle the interface parameter, and the SRTE service, whih
always sends LSPs towards a nexthop located in the VRF_DEFAULT.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
23 months agozebra: accept LSP entries with an mpls-less outgoing interface
Philippe Guibert [Thu, 12 Jan 2023 07:33:50 +0000 (08:33 +0100)]
zebra: accept LSP entries with an mpls-less outgoing interface

The ZEBRA_MPLS_LABELS_[ADD/DELETE/REPLACE] messages may change an
LSP entry based on an incoming MPLS entry, followed by a given
next-hop.
Having a next hop with no label information inside is rejected
by the zebra layer. As illustration, the following ZAPI message
would be rejected, because the next hop does not contain any
label information.

  > ip -f mpls route add 105 via inet 192.0.2.45

At the same time, such configuration is desirable to be
supported:

An attempt has been done to configure the next-hop with an implicit-
null label. But the message is rejected by the kernel:

  > ip -f mpls route add 104 as 3 via inet 192.0.2.45
  > Error: Implicit NULL Label (3) can not be used in encapsulation.

The commit proposes to accept ZEBRA_MPLS_LABELS_[XX] messages with
a nexthop that does not contain any label information.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
23 months agoMerge pull request #13429 from opensourcerouting/feature/mark_pr_as_need_rebase
Donald Sharp [Tue, 9 May 2023 17:39:38 +0000 (13:39 -0400)]
Merge pull request #13429 from opensourcerouting/feature/mark_pr_as_need_rebase

github: Add rebase label on PR if it's > 50 commits behind

23 months agoMerge pull request #13438 from gpnaveen/vrf_on_loopback
Donald Sharp [Tue, 9 May 2023 17:39:18 +0000 (13:39 -0400)]
Merge pull request #13438 from gpnaveen/vrf_on_loopback

tests: removing un used loopback interface from bgp admin dist.

23 months agoMerge pull request #13460 from Jafaral/ospf-fix2
Donald Sharp [Tue, 9 May 2023 17:37:40 +0000 (13:37 -0400)]
Merge pull request #13460 from Jafaral/ospf-fix2

tests: remove sleep ospf test

23 months agoMerge pull request #13484 from sri-mohan1/srib-ldpd
Donald Sharp [Tue, 9 May 2023 17:30:00 +0000 (13:30 -0400)]
Merge pull request #13484 from sri-mohan1/srib-ldpd

ldpd: changes for code maintainability

23 months agoMerge pull request #13470 from crosser/fix-test-frrscript
Donald Sharp [Tue, 9 May 2023 15:30:17 +0000 (11:30 -0400)]
Merge pull request #13470 from crosser/fix-test-frrscript

test_frrscript: fix dep for out of tree build

23 months agoldpd: changes for code maintainability 13484/head
sri-mohan1 [Tue, 9 May 2023 13:15:27 +0000 (18:45 +0530)]
ldpd: changes for code maintainability

these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
23 months agoMerge pull request #13445 from donaldsharp/lua_scripting_mem_leak
Donatas Abraitis [Tue, 9 May 2023 12:38:06 +0000 (15:38 +0300)]
Merge pull request #13445 from donaldsharp/lua_scripting_mem_leak

zebra: Reduce creation and fix memory leak of frrscripting pointers

23 months agoMerge pull request #13437 from raja-rajasekar/raja-rajasekar/show_cmd_fix
Donatas Abraitis [Tue, 9 May 2023 09:51:16 +0000 (12:51 +0300)]
Merge pull request #13437 from raja-rajasekar/raja-rajasekar/show_cmd_fix

bgpd: Fixing the show bgp <vrf> <afi> <safi> detail command

23 months agogithub: Add rebase label on PR if it's > 50 commits behind 13429/head
Donatas Abraitis [Wed, 3 May 2023 20:17:58 +0000 (23:17 +0300)]
github: Add rebase label on PR if it's > 50 commits behind

The idea is to catch some PRs and rerun them in CI to avoid merging PRs that
are based on the stale base branch and causes issues afterwards.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
23 months agoMerge pull request #13471 from opensourcerouting/fix/aigp_non_transitive
Jafar Al-Gharaibeh [Tue, 9 May 2023 04:25:07 +0000 (23:25 -0500)]
Merge pull request #13471 from opensourcerouting/fix/aigp_non_transitive

bgpd: AIGP should be non-transitive

23 months agotests: remove sleep ospf test 13460/head
Jafar Al-Gharaibeh [Mon, 8 May 2023 05:18:25 +0000 (00:18 -0500)]
tests: remove sleep ospf test

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
23 months agotests: Fix out of tree build for lua scripting 13470/head
Eugene Crosser [Mon, 8 May 2023 16:38:40 +0000 (18:38 +0200)]
tests: Fix out of tree build for lua scripting

test_frrscript is run from the `tests` directory and expects the sample
lua script `script1.lua` to be present in the `lib` directory. When the
package is built out of tree (which always happens when a debian
package is built), and scripting is enabled, test fails because the lua
file is not present in the `tests/lib/` subdir of the _build_ directory.

Fix this by adding `script1.lua` as an extra dependency for
`test_frrscript`, and a recipe that copies the file from the source tree
to the build tree (note: it needs to be marked ".PHONY" because
otherwise `make` thinks that it already exists, in the source tree).

After this commit, the following command starts to work:

    dpkg-buildpackage --build-profiles=pkg.frr.lua -b -uc

Signed-off-by: Eugene Crosser <crosser@average.org>
23 months agotests: Adjust AIGP metric numbers for iBGP setup 13471/head
Donatas Abraitis [Mon, 8 May 2023 20:22:26 +0000 (23:22 +0300)]
tests: Adjust AIGP metric numbers for iBGP setup

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
23 months agobgpd: Make sure AIGP attribute is non-transitive
Donatas Abraitis [Mon, 8 May 2023 19:49:10 +0000 (22:49 +0300)]
bgpd: Make sure AIGP attribute is non-transitive

The AIGP attribute is an optional, non-transitive BGP path attribute.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
23 months agodoc: add documentation for show [ip] bgp [vrf] [afi] [safi] detail [json] 13437/head
Rajasekar Raja [Fri, 5 May 2023 16:28:40 +0000 (09:28 -0700)]
doc: add documentation for show [ip] bgp [vrf] [afi] [safi] detail [json]

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
23 months agoMerge pull request #13468 from opensourcerouting/ripd-memtype-fix
Donald Sharp [Mon, 8 May 2023 19:15:15 +0000 (15:15 -0400)]
Merge pull request #13468 from opensourcerouting/ripd-memtype-fix

ripd: fix another memtype mismatch

23 months agoMerge pull request #13413 from chiragshah6/fdev2
Mark Stapp [Mon, 8 May 2023 18:36:07 +0000 (14:36 -0400)]
Merge pull request #13413 from chiragshah6/fdev2

zebra: re-install NHG on interface up

23 months agoMerge pull request #13464 from sri-mohan1/srib-ldpd
Donald Sharp [Mon, 8 May 2023 16:42:10 +0000 (12:42 -0400)]
Merge pull request #13464 from sri-mohan1/srib-ldpd

ldpd: changes for code maintainability

23 months agoripd: fix another memtype mismatch 13468/head
Renato Westphal [Mon, 8 May 2023 14:07:54 +0000 (11:07 -0300)]
ripd: fix another memtype mismatch

Fixes #13447.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
23 months agoMerge pull request #13465 from donaldsharp/ospf_metric_ifindex
Jafar Al-Gharaibeh [Mon, 8 May 2023 14:43:56 +0000 (09:43 -0500)]
Merge pull request #13465 from donaldsharp/ospf_metric_ifindex

tests: ospf_metric_propagation is looking for a specific ifindex and vrfid

23 months agoMerge pull request #13453 from donaldsharp/dplane_memory_leak
Mark Stapp [Mon, 8 May 2023 14:27:08 +0000 (10:27 -0400)]
Merge pull request #13453 from donaldsharp/dplane_memory_leak

Dplane memory leak

23 months agotests: ospf_metric_propagation should not look for a specific vrfId 13465/head
Donald Sharp [Mon, 8 May 2023 12:06:30 +0000 (08:06 -0400)]
tests: ospf_metric_propagation should not look for a specific vrfId

There is no guarantee that the vrfId is going to be the same across
tests, as that the vrfId is chosen based upon the ifindex of the
vrf device.  As such we should not be looking for the vrfId, but
the correct vrf name.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
23 months agotests: ospf_metric_propagation is looking for a specific ifindex
Donald Sharp [Mon, 8 May 2023 11:47:49 +0000 (07:47 -0400)]
tests: ospf_metric_propagation is looking for a specific ifindex

The test ospf_metric_propagation is looking for a specific ifindex
this ifindex is not guaranteed to be any particular value by the underlying
OS.  So let's remove this test for it.  As a side note I am seeing
tests fail in upstream CI because of this.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
23 months agoMerge pull request #13446 from louis-6wind/fix-ext-comm
Donatas Abraitis [Mon, 8 May 2023 10:44:56 +0000 (13:44 +0300)]
Merge pull request #13446 from louis-6wind/fix-ext-comm

bgpd: fix show running of nt extcommunity

23 months agoldpd: changes for code maintainability 13464/head
sri-mohan1 [Mon, 8 May 2023 09:58:50 +0000 (15:28 +0530)]
ldpd: changes for code maintainability

these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
23 months agoMerge pull request #13440 from zice312963205/bgpfix
Donatas Abraitis [Mon, 8 May 2023 08:47:14 +0000 (11:47 +0300)]
Merge pull request #13440 from zice312963205/bgpfix

bgpd: fix the issue of connected tag error when BGP subscribes to NHT…

23 months agoMerge pull request #13458 from sri-mohan1/srib-ldpd
Donatas Abraitis [Mon, 8 May 2023 07:22:27 +0000 (10:22 +0300)]
Merge pull request #13458 from sri-mohan1/srib-ldpd

ldpd: changes for code maintainability

23 months agoldpd: changes for code maintainability 13458/head
sri-mohan1 [Sun, 7 May 2023 15:30:52 +0000 (21:00 +0530)]
ldpd: changes for code maintainability

these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
23 months agoMerge pull request #13455 from sri-mohan1/srib-ldpd
Donatas Abraitis [Sat, 6 May 2023 19:47:27 +0000 (22:47 +0300)]
Merge pull request #13455 from sri-mohan1/srib-ldpd

ldpd: changes for code maintainability

23 months agoldpd: changes for code maintainability 13455/head
sri-mohan1 [Sat, 6 May 2023 14:22:34 +0000 (19:52 +0530)]
ldpd: changes for code maintainability

these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
23 months agoMerge pull request #13451 from sri-mohan1/srib-ldpd
Donald Sharp [Sat, 6 May 2023 12:49:24 +0000 (08:49 -0400)]
Merge pull request #13451 from sri-mohan1/srib-ldpd

ldpd: changes for code maintainability

23 months agoMerge pull request #13424 from LabNConsulting/chopps/log-config-file-cmds
Donald Sharp [Sat, 6 May 2023 10:47:05 +0000 (06:47 -0400)]
Merge pull request #13424 from LabNConsulting/chopps/log-config-file-cmds

23 months agobgpd: fix the issue of connected tag error when BGP subscribes to NHT from Zebra 13440/head
Jack.zhang [Fri, 5 May 2023 06:58:32 +0000 (14:58 +0800)]
bgpd: fix the issue of connected tag error when BGP subscribes to NHT from Zebra

Imagine the following scenario:
1.Create a multihop ebgp peer and config the ttl as 254 for both side.
2.Call bgp_start and start an active connection.
Bgp will send a nht register with non-connected flag.
3.The function bgp_accept be called by remote connection.
Bgp will create a accept peer as a passive connection with default ttl(1). And then will send a nht register again with connected flag. This register result will cover the first one.
4.The active connection come to establish first. In funciton "peer_xfer_conn", check for "PEER_FLAG_CONFIG_NODE" flag of "from_peer->doppelganger" will not be pass, so we can not repair the nht register error forever.
Then the bgp nexthop will be like this:
2000::60 invalid, #paths 0, peer 2000::60
Must be Connected
Last update: Thu May 4 09:35:14 2023

The route from this peer can not be treat with a vaild nexthop forever.
This change will fix this error.

Signed-off-by: Jack.zhang <hanyu.zly@alibaba-inc.com>
23 months agozebra: dplane_gre_set could return while leaking ctx 13453/head
Donald Sharp [Fri, 5 May 2023 23:03:40 +0000 (19:03 -0400)]
zebra: dplane_gre_set could return while leaking ctx

Prevent this function from leaking the ctx memory.
Also properly record that something has gone wrong.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
23 months agozebra: Dplane ctx allocation cannot fail
Donald Sharp [Fri, 5 May 2023 22:57:21 +0000 (18:57 -0400)]
zebra: Dplane ctx allocation cannot fail

Having tests for memory allocation success makes no sense
given what happens when frr fails to allocate memory.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
23 months agozebra:re-install dependent nhgs on interface up 13413/head
Chirag Shah [Sat, 29 Apr 2023 02:09:55 +0000 (19:09 -0700)]
zebra:re-install dependent nhgs on interface up

Upon interface up associated singleton NHG's
dependent NHGs needs to be reinstalled as
kernel would have deleted if there is no route
referencing it.

Ticket:#3416477
Issue:3416477
Testing Done:
flap interfaces which are part of route NHG,
upon interfaces up event, NHGs are resynced
into dplane.

Signed-off-by: Chirag Shah <chirag@nvidia.com>
23 months agozebra: re-install nhg on interface up
Ashwini Reddy [Wed, 19 Apr 2023 18:35:25 +0000 (11:35 -0700)]
zebra: re-install nhg on interface up

Intermittently zebra and kernel are out of sync
when interface flaps and the add's/dels are in
same processing queue and zebra assumes no change in nexthop.
Hence we need to bring in a reinstall to kernel
of the nexthops and routes to sync their states.

Upon interface flap kernel would have deleted NHGs
associated to a interface (the one flapped),
zebra retains NHGs for 3 mins even though upper
layer protocol removes the nexthops (associated NHG).
As part of interface address add ,
re-add singleton NHGs associated to interface.

Ticket: #3173663
Issue: 3173663

Signed-off-by: Ashwini Reddy <ashred@nvidia.com>
Signed-off-by: Chirag Shah <chirag@nvidia.com>
23 months agoldpd: changes for code maintainability 13451/head
sri-mohan1 [Fri, 5 May 2023 18:11:01 +0000 (23:41 +0530)]
ldpd: changes for code maintainability

these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
23 months agozebra: Reduce creation and fix memory leak of frrscripting pointers 13445/head
Donald Sharp [Fri, 5 May 2023 15:05:12 +0000 (11:05 -0400)]
zebra: Reduce creation and fix memory leak of frrscripting pointers

There are two issues being addressed:

a) The ZEBRA_ON_RIB_PROCESS_HOOK_CALL script point
was creating a fs pointer per dplane ctx in
rib_process_dplane_results().

b) The fs pointer was not being deleted and directly
leaked.

For (a) Move the creation of the fs to outside
the do while loop.

For (b) At function end ensure that the pointer
is actually deleted.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
23 months agobgpd: fix show running of nt extcommunity 13446/head
Louis Scalbert [Fri, 5 May 2023 14:05:42 +0000 (16:05 +0200)]
bgpd: fix show running of nt extcommunity

Setting

> bgp extcommunity-list standard EXT seq 5 permit nt 192.168.1.3:0

results in:

> bgp extcommunity-list standard EXT seq 5 permit NT:192.168.1.3

Fix the display

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
23 months agoMerge pull request #13436 from donaldsharp/ospf_json_mem_leak
Donatas Abraitis [Fri, 5 May 2023 12:14:16 +0000 (15:14 +0300)]
Merge pull request #13436 from donaldsharp/ospf_json_mem_leak

ospfd: Fix memory leaks w/ `show ip ospf int X json` commands

23 months agoMerge pull request #13428 from opensourcerouting/ripd-bfd-fixes
Donald Sharp [Fri, 5 May 2023 12:04:57 +0000 (08:04 -0400)]
Merge pull request #13428 from opensourcerouting/ripd-bfd-fixes

ripd: fix problemas

23 months agoMerge pull request #13435 from mjstapp/fix_pim_cpp_notice
Donald Sharp [Fri, 5 May 2023 12:04:23 +0000 (08:04 -0400)]
Merge pull request #13435 from mjstapp/fix_pim_cpp_notice

pimd: replace CPP_NOTICE lines with TODO comments

23 months agoMerge pull request #13423 from LabNConsulting/chopps/coverity-string-fix
Donald Sharp [Fri, 5 May 2023 11:35:06 +0000 (07:35 -0400)]
Merge pull request #13423 from LabNConsulting/chopps/coverity-string-fix

mgmtd: simplify commit id to just be a timeval string

23 months agobgpd: Fixing the show bgp <vrf> <afi> <safi> detail command
Rajasekar Raja [Thu, 27 Apr 2023 21:03:03 +0000 (14:03 -0700)]
bgpd: Fixing the show bgp <vrf> <afi> <safi> detail command

Adding support to show cmds like  show bgp vrf all detail, show bgp
<afi> <safi> detail & show bgp <vrf> <afi> <safi> detail

Issue:3168406
Ticket:#3168406

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
23 months agotests: removing un used loopback interface from bgp admin dist. 13438/head
Naveen Guggarigoud [Fri, 5 May 2023 05:20:40 +0000 (05:20 +0000)]
tests: removing un used loopback interface from bgp admin dist.

Signed-off-by: Naveen Guggarigoud <nguggarigoud@vmware.com>
23 months agolib: log commands read from config file 13424/head
Christian Hopps [Wed, 3 May 2023 04:41:19 +0000 (00:41 -0400)]
lib: log commands read from config file

When the user specifies `--command-log-always` in CLI arguments then also log
commands executed from loading the config file.

Signed-off-by: Christian Hopps <chopps@labn.net>
23 months agomgmtd: simplify commit id to just be a timeval string 13423/head
Christian Hopps [Tue, 2 May 2023 21:17:51 +0000 (17:17 -0400)]
mgmtd: simplify commit id to just be a timeval string

Also fixes coverity warning

Signed-off-by: Christian Hopps <chopps@labn.net>
23 months agoMerge pull request #13357 from Jafaral/fix_ospf_prop
Christian Hopps [Thu, 4 May 2023 18:46:56 +0000 (14:46 -0400)]
Merge pull request #13357 from Jafaral/fix_ospf_prop

tests: clear the ospf neighbor to force a state change

23 months agoospfd: Fix memory leaks w/ `show ip ospf int X json` commands 13436/head
Donald Sharp [Thu, 4 May 2023 16:53:42 +0000 (12:53 -0400)]
ospfd: Fix memory leaks w/ `show ip ospf int X json` commands

FRR has a memory leak in the case when int X does not
exist and a memory leak when int X does exist.  Fix
these

Fixes: #13434
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
23 months agopimd: replace CPP_NOTICE lines with TODO comments 13435/head
Mark Stapp [Thu, 4 May 2023 14:26:33 +0000 (10:26 -0400)]
pimd: replace CPP_NOTICE lines with TODO comments

Replace the noisy CPP_NOTICE lines with TODO comments.

Signed-off-by: Mark Stapp <mjs@labn.net>
23 months agotests: clear the ospf neighbor to force a state change 13357/head
Jafar Al-Gharaibeh [Sat, 22 Apr 2023 18:10:16 +0000 (13:10 -0500)]
tests: clear the ospf neighbor to force a state change

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
23 months agoripd: use correct memory type when freeing BFD profile 13428/head
Renato Westphal [Wed, 3 May 2023 20:02:58 +0000 (17:02 -0300)]
ripd: use correct memory type when freeing BFD profile

Fixes #13415.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
23 months agoripd: fix null-pointer dereference
Renato Westphal [Wed, 3 May 2023 20:01:36 +0000 (17:01 -0300)]
ripd: fix null-pointer dereference

Fixes #13416.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
23 months agoMerge pull request #13425 from FRRouting/revert-12646-mpls_alloc_per_nh
Donald Sharp [Wed, 3 May 2023 11:35:37 +0000 (07:35 -0400)]
Merge pull request #13425 from FRRouting/revert-12646-mpls_alloc_per_nh

Revert "MPLS allocation mode per next hop"

23 months agoRevert "MPLS allocation mode per next hop" 13425/head
Donatas Abraitis [Wed, 3 May 2023 10:50:26 +0000 (13:50 +0300)]
Revert "MPLS allocation mode per next hop"

Broken tests, let's revert now.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
23 months agoMerge pull request #13422 from donaldsharp/pim_thread_off_fix
Mark Stapp [Tue, 2 May 2023 18:57:25 +0000 (14:57 -0400)]
Merge pull request #13422 from donaldsharp/pim_thread_off_fix

pimd: Fix old commit that got in

23 months agopimd: Fix old commit that got in 13422/head
Donald Sharp [Tue, 2 May 2023 18:49:32 +0000 (14:49 -0400)]
pimd: Fix old commit that got in

An old fix that used THREAD_OFF was pushed in, should
have used EVENT_OFF instead.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
23 months agoMerge pull request #13020 from SaiGomathiN/2462808-3
Donald Sharp [Tue, 2 May 2023 15:55:34 +0000 (11:55 -0400)]
Merge pull request #13020 from SaiGomathiN/2462808-3

pimd: PIM not sending register packets after changing from non DR to DR

23 months agoMerge pull request #12646 from pguibert6WIND/mpls_alloc_per_nh
Donatas Abraitis [Tue, 2 May 2023 15:36:45 +0000 (18:36 +0300)]
Merge pull request #12646 from pguibert6WIND/mpls_alloc_per_nh

MPLS allocation mode per next hop

23 months agoMerge pull request #13376 from louis-6wind/fix-flex-algo-mem-leak
Russ White [Tue, 2 May 2023 15:33:38 +0000 (11:33 -0400)]
Merge pull request #13376 from louis-6wind/fix-flex-algo-mem-leak

isisd, lib: fix flex-algo memory leak

23 months agoMerge pull request #13366 from zmw12306/rte_tag
Donatas Abraitis [Tue, 2 May 2023 14:56:09 +0000 (17:56 +0300)]
Merge pull request #13366 from zmw12306/rte_tag

ripd: add non-zero check for RIPv1 reserved field

23 months agoMerge pull request #13403 from anlancs/fix/zebra-missing-vrf-flag
Russ White [Tue, 2 May 2023 14:47:41 +0000 (10:47 -0400)]
Merge pull request #13403 from anlancs/fix/zebra-missing-vrf-flag

zebra: Fix missing VRF flag

23 months agoMerge pull request #13404 from louis-6wind/fix-flex-algo-race-condition
Russ White [Tue, 2 May 2023 14:42:39 +0000 (10:42 -0400)]
Merge pull request #13404 from louis-6wind/fix-flex-algo-race-condition

isisd: fix a flex algo race condition and a minor fix

23 months agoMerge pull request #13235 from Orange-OpenSource/link-state
Russ White [Tue, 2 May 2023 14:31:10 +0000 (10:31 -0400)]
Merge pull request #13235 from Orange-OpenSource/link-state

lib: Fix memory leaks in Link State library

23 months agoMerge pull request #13270 from pguibert6WIND/better_srv6_output_seg6local
Russ White [Tue, 2 May 2023 14:30:15 +0000 (10:30 -0400)]
Merge pull request #13270 from pguibert6WIND/better_srv6_output_seg6local

zebra: display seg6local only when specified

23 months agoMerge pull request #13354 from zmw12306/parse_request_subtlv
Russ White [Tue, 2 May 2023 14:28:20 +0000 (10:28 -0400)]
Merge pull request #13354 from zmw12306/parse_request_subtlv

babeld: add parse_request_subtlv into parse_packet

23 months agoMerge pull request #13377 from donaldsharp/ospf_dead_interval
Russ White [Tue, 2 May 2023 14:25:46 +0000 (10:25 -0400)]
Merge pull request #13377 from donaldsharp/ospf_dead_interval

tests: Increase the dead interval to be longer for neighbor testing

23 months agoMerge pull request #13389 from anlancs/fix/pimd-wrong-mrt-sockopt
Donald Sharp [Tue, 2 May 2023 13:21:24 +0000 (09:21 -0400)]
Merge pull request #13389 from anlancs/fix/pimd-wrong-mrt-sockopt

pimd: Fix wrong setsockopt() call

23 months agoMerge pull request #13393 from opensourcerouting/fix/topotest_bgp_bfd_down_cease_noti...
Donald Sharp [Tue, 2 May 2023 12:42:43 +0000 (08:42 -0400)]
Merge pull request #13393 from opensourcerouting/fix/topotest_bgp_bfd_down_cease_notification

tests: Do not try establishing a connection from r1 to r2

23 months agoMerge pull request #13395 from LabNConsulting/chopps/mgmtd-debug-flags
Donald Sharp [Tue, 2 May 2023 12:17:17 +0000 (08:17 -0400)]
Merge pull request #13395 from LabNConsulting/chopps/mgmtd-debug-flags

mgmtd: fully implement debug flags for mgmtd and clients

23 months agoMerge pull request #13405 from dmytroshytyi-6WIND/srv6_bgp_no_sid_export_auto
Donatas Abraitis [Mon, 1 May 2023 19:07:03 +0000 (22:07 +0300)]
Merge pull request #13405 from dmytroshytyi-6WIND/srv6_bgp_no_sid_export_auto

bgpd, tests: srv6 "no sid vpn export auto" per AF in vtysh

23 months agoMerge pull request #13408 from pguibert6WIND/flowspec_sanity
Donatas Abraitis [Mon, 1 May 2023 18:58:53 +0000 (21:58 +0300)]
Merge pull request #13408 from pguibert6WIND/flowspec_sanity

bgpd: add some flowspec sanity returns

23 months agoMerge pull request #13409 from chiragshah6/fdev1
Donatas Abraitis [Mon, 1 May 2023 18:55:38 +0000 (21:55 +0300)]
Merge pull request #13409 from chiragshah6/fdev1

zebra:add df flag into evpn esi json output

23 months agomgmtd: fully implement debug flags for mgmtd and clients 13395/head
Christian Hopps [Wed, 26 Apr 2023 21:50:46 +0000 (17:50 -0400)]
mgmtd: fully implement debug flags for mgmtd and clients

Signed-off-by: Christian Hopps <chopps@labn.net>
23 months agoMerge pull request #13406 from LabNConsulting/chopps/log-timestamp-buildopt
Donald Sharp [Mon, 1 May 2023 13:51:46 +0000 (09:51 -0400)]
Merge pull request #13406 from LabNConsulting/chopps/log-timestamp-buildopt

startup log timestamp precision build option

23 months agozebra: Fix missing VRF flag 13403/head
anlan_cs [Fri, 28 Apr 2023 05:39:59 +0000 (13:39 +0800)]
zebra: Fix missing VRF flag

1. No any configuration in FRR, and `ip link add vrf1 type vrf ...`.
Currently, everything is ok.

2.  `ip link del vrf1`.
`zebra` will wrongly/redundantly notify clients to add "vrf1" as a normal
interface after correct deletion of "vrf1".

```
ZEBRA: [KMXEB-K771Y] netlink_parse_info: netlink-listen (NS 0) type RTM_DELLINK(17), len=588, seq=0, pid=0
ZEBRA: [TDJW2-B9KJW] RTM_DELLINK for vrf1(93) <- Wrongly as normal interface, not vrf
ZEBRA: [WEEJX-M4HA0] interface vrf1 vrf vrf1(93) index 93 is now inactive.
ZEBRA: [NXAHW-290AC] MESSAGE: ZEBRA_INTERFACE_DELETE vrf1 vrf vrf1(93)
ZEBRA: [H97XA-ABB3A] MESSAGE: ZEBRA_INTERFACE_VRF_UPDATE/DEL vrf1 VRF Id 93 -> 0
ZEBRA: [HP8PZ-7D6D2] MESSAGE: ZEBRA_INTERFACE_VRF_UPDATE/ADD vrf1 VRF Id 93 -> 0 <-
ZEBRA: [Y6R2N-EF2N4] interface vrf1 is being deleted from the system
ZEBRA: [KNFMR-AFZ53] RTM_DELLINK for VRF vrf1(93)
ZEBRA: [P0CZ5-RF5FH] VRF vrf1 id 93 is now inactive
ZEBRA: [XC3P3-1DG4D] MESSAGE: ZEBRA_VRF_DELETE vrf1
ZEBRA: [ZMS2F-6K837] VRF vrf1 id 4294967295 deleted
OSPF: [JKWE3-97M3J] Zebra: interface add vrf1 vrf default[0] index 0 flags 480 metric 0 mtu 65575 speed 0 <- Wrongly add interface
```

`if_handle_vrf_change()` moved the interface from specific vrf to default
vrf. But it doesn't skip interface of vrf type. So, the wrong/redundant
add operation is done.

Note, the wrong add operation is regarded as an normal interface because
the `ifp->status` is cleared too early, so it is without VRF flag
( `ZEBRA_INTERFACE_VRF_LOOPBACK` ). Now, ospfd will initialize `ifp->type`
to `OSPF_IFTYPE_BROADCAST`.

3. `ip link add vrf1 type vrf ...`, add "vrf1" again. FRR will be with
wrong display:

```
interface vrf1
 ip ospf network broadcast
exit
```

Here, zebra will send `ZEBRA_INTERFACE_ADD` again for "vrf1" with
correct `ifp->status`, so it will be updated into vrf type. But
it can't update `ifp->type` from `OSPF_IFTYPE_BROADCAST` to
`OSPF_IFTYPE_LOOPBACK` because it had been already configured in above
step 2.

Two changes to fix it:

1. Skip the procedure of switching VRF for interfaces of vrf type.
It means, don't send `ZEBRA_INTERFACE_ADD` to clients when deleting vrf.

2. Put the deletion of this flag at the last.
It means, clients should get correct `ifp->status`.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2 years agotests: change topotest log timestamp precision to 6. 13406/head
Christian Hopps [Fri, 28 Apr 2023 15:11:41 +0000 (11:11 -0400)]
tests: change topotest log timestamp precision to 6.

- Often millisecond precision is not good enough to differentiate things that
occur directly one after another, and things that have some pause in between,
increase to microsecond precision (reporting)

Signed-off-by: Christian Hopps <chopps@labn.net>
2 years agolib: add build option to set startup log timestemp precision
Christian Hopps [Fri, 28 Apr 2023 15:10:56 +0000 (11:10 -0400)]
lib: add build option to set startup log timestemp precision

Signed-off-by: Christian Hopps <chopps@labn.net>
2 years agozebra:add df flag into evpn esi json output 13409/head
Sindhu Parvathi Gopinathan [Fri, 28 Apr 2023 12:28:58 +0000 (05:28 -0700)]
zebra:add df flag into evpn esi json output

FRR "show evpn es 'esi-id' json" output dont have the 'df' flag.

Modified the code to add the 'df' flag into json output.

Before Fix:

```
torm-11# show evpn es 03:44:38:39:ff:ff:01:00:00:01 json
{
  "esi":"03:44:38:39:ff:ff:01:00:00:01",
  "accessPort":"hostbond1",
  "flags":[
    "local",
    "remote",
    "readyForBgp",
    "bridgePort",
    "operUp",
    "nexthopGroupActive"
 ====================> df is missing
  ],
  "vniCount":10,
  "macCount":13,
  "dfPreference":50000,
  "nexthopGroup":536870913,
  "vteps":[
    {
      "vtep":"27.0.0.16",
      "dfAlgorithm":"preference",
      "dfPreference":32767,
      "nexthopId":268435460
    },
    {
      "vtep":"27.0.0.17",
      "dfAlgorithm":"preference",
      "dfPreference":32767,
      "nexthopId":268435461
    }
  ]
}
torm-11#
```

After Fix:-

```
torm-11# show evpn es 03:44:38:39:ff:ff:01:00:00:01 json
{
  "esi":"03:44:38:39:ff:ff:01:00:00:01",
  "accessPort":"hostbond1",
  "flags":[
    "local",
    "remote",
    "readyForBgp",
    "bridgePort",
    "operUp",
    "nexthopGroupActive",
    "df" ========================> designated-forward flag added
  ],
  "vniCount":10,
  "macCount":13,
  "dfPreference":50000,
  "nexthopGroup":536870913,
  "vteps":[
    {
      "vtep":"27.0.0.16",
      "dfAlgorithm":"preference",
      "dfPreference":32767,
      "nexthopId":268435460
    },
    {
      "vtep":"27.0.0.17",
      "dfAlgorithm":"preference",
      "dfPreference":32767,
      "nexthopId":268435461
    }
  ]
}
torm-11#

```

Ticket:# 3447935

Issue: 3447935

Testing: UT done

Signed-off-by: Sindhu Parvathi Gopinathan's <sgopinathan@nvidia.com>
Signed-off-by: Chirag Shah <chirag@nvidia.com>
2 years agotests: validate sid export per-vrf and per-af 13405/head
Dmytro Shytyi [Fri, 21 Apr 2023 12:24:33 +0000 (14:24 +0200)]
tests: validate sid export per-vrf and per-af

Verify activation and desactivation of per-vrf and per-af
sid export. Modify the configuration of r2 and verify that
changes are reflected in r1 and on connectivity between ce1 and c2.

Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
2 years agobgpd: implement "no sid vpn export auto" per AF in vtysh
Dmytro Shytyi [Fri, 21 Apr 2023 12:00:48 +0000 (14:00 +0200)]
bgpd: implement "no sid vpn export auto" per AF in vtysh

An example of implemented command for IPv4 AF is presented below.

dev-vm(config-router-af)# do show bgp segment-routing srv6
locator_name: Locator1
locator_chunks:
- 2001:db8:2:5::/64
  block-length: 40
  node-length: 24
  func-length: 16
  arg-length: 0
functions:
bgps:
- name: default
  vpn_policy[AFI_IP].tovpn_sid: (null)
  vpn_policy[AFI_IP6].tovpn_sid: (null)
  per-vrf tovpn_sid: (null)
- name: red
  vpn_policy[AFI_IP].tovpn_sid: (null)
  vpn_policy[AFI_IP6].tovpn_sid: (null)
  per-vrf tovpn_sid: (null)
dev-vm(config-router-af)# sid vpn export auto
^^^<<<<<<<<<<<<<<<<<<<<<< 1. configure sid per af
dev-vm(config-router-af)# do show bgp segment-routing srv6
locator_name: Locator1
locator_chunks:
- 2001:db8:2:5::/64
  block-length: 40
  node-length: 24
  func-length: 16
  arg-length: 0
functions:
- sid: 2001:db8:2:5:1::
  locator: Locator1
bgps:
- name: default
  vpn_policy[AFI_IP].tovpn_sid: (null)
  vpn_policy[AFI_IP6].tovpn_sid: (null)
  per-vrf tovpn_sid: (null)
- name: red
  vpn_policy[AFI_IP].tovpn_sid: 2001:db8:2:5:1::
^^^<<<<<<<<<<<<<<<<<<<<< 2. sid is configured
  vpn_policy[AFI_IP6].tovpn_sid: (null)
  per-vrf tovpn_sid: (null)
dev-vm(config-router-af)# no sid vpn export auto
^^^<<<<<<<<<<<<<<<<<<<< 3. deconfigure sid per af
dev-vm(config-router-af)# do show bgp segment-routing srv6
locator_name: Locator1
locator_chunks:
- 2001:db8:2:5::/64
  block-length: 40
  node-length: 24
  func-length: 16
  arg-length: 0
functions:
bgps:
- name: default
  vpn_policy[AFI_IP].tovpn_sid: (null)
  vpn_policy[AFI_IP6].tovpn_sid: (null)
  per-vrf tovpn_sid: (null)
- name: red
  vpn_policy[AFI_IP].tovpn_sid: (null)
^^^<<<<<<<<<<<<<<<<<<< 4. sid is deconfigured
  vpn_policy[AFI_IP6].tovpn_sid: (null)
  per-vrf tovpn_sid: (null)

Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
2 years agobgpd: add some flowspec sanity returns 13408/head
Philippe Guibert [Fri, 28 Apr 2023 19:56:19 +0000 (21:56 +0200)]
bgpd: add some flowspec sanity returns

If an error is detected in an NLRI, immediately return
an error, when there is a risk of buffer overflow.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2 years agoMerge pull request #13407 from cscarpitta/fix/fix-srv6l3vpn-topotest
Donald Sharp [Fri, 28 Apr 2023 17:49:06 +0000 (13:49 -0400)]
Merge pull request #13407 from cscarpitta/fix/fix-srv6l3vpn-topotest

tests: Fix `bgp_srv6l3vpn_to_bgp_vrf3` topotest