]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
16 months agobgpd: fix dereference of null pointer in bgp_attr_aspath
Philippe Guibert [Fri, 3 Feb 2023 08:41:41 +0000 (09:41 +0100)]
bgpd: fix dereference of null pointer in bgp_attr_aspath

The peer pointer theorically have a NULL bgp pointer. This triggers
a SA issue. So let us fix it.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agobgpd: fix dereference of null pointer in 'bgp_evpn_es_evi_show_entry'
Philippe Guibert [Mon, 28 Nov 2022 09:31:58 +0000 (10:31 +0100)]
bgpd: fix dereference of null pointer in 'bgp_evpn_es_evi_show_entry'

The bgp_evpn_es_evi_show_entry() function tries to access the vni
attribute, while the vpn structure may be null.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agotopotests: add bgp_asdot_regex test
Philippe Guibert [Mon, 28 Nov 2022 09:13:07 +0000 (10:13 +0100)]
topotests: add bgp_asdot_regex test

This test ensures that the regex used to filter as paths has to
be expressed in the asnotation of the BGP instance where prefixes
are received. 2 aspaths have been forged, both for AS 65540, but
only the former is expressed in asdot. If the local BGP instance
is expressed in asdot format, then only the former ASPATH will
match properly the incoming update. Reversely, when the local BGP
instance is expressed in plain format, then only the latter ASPATH
will match properly the incoming update.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agobgpd: add as notation support for bgp rpki service
Philippe Guibert [Fri, 25 Nov 2022 16:51:33 +0000 (17:51 +0100)]
bgpd: add as notation support for bgp rpki service

Rpki service uses AS number:
- some show commands use the as number as paramter.
use asnotation support.
- the as number of entries is displayed based on the
asnotation mode of the chose bgp instance.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agobgpd: handle network rd parameter in network configuration
Philippe Guibert [Fri, 25 Nov 2022 11:24:15 +0000 (12:24 +0100)]
bgpd: handle network rd parameter in network configuration

The bgp network command creates static routes with an optional
route-distinguisher parameter for VPN and EVPN address families.
Store the rd parameter in those static routes. This will be used
by the 'show running-config' later.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agotests: add unit tests to bgp aspath to check as dot format
Philippe Guibert [Fri, 25 Nov 2022 09:07:28 +0000 (10:07 +0100)]
tests: add unit tests to bgp aspath to check as dot format

4 aspath tests are added, and expect the output string format
tobe in dot+ format.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agotopotests: add bgp_local_asn_dot test
Philippe Guibert [Thu, 24 Nov 2022 16:32:10 +0000 (17:32 +0100)]
topotests: add bgp_local_asn_dot test

This test performs AS handling operations on BGP instances,
and does some checks by using the asdot notation. AS4B values
are used for configuration.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agobgpd: support for route-distinguisher format with 3 fields
Philippe Guibert [Thu, 24 Nov 2022 15:13:08 +0000 (16:13 +0100)]
bgpd: support for route-distinguisher format with 3 fields

The ietf proposes to define a RD with a 3 field separated by
the ':' character. The last 2 fields stands for the usual
fields, namely AS4B:NN, AS2B,NNNN, IP:NN. The first field
stands for the kind of route distinguisher used.

Today, except with the route-map, no other RD configuration
supports this mode. Handle the support for this in FRR.

Link: https://github.com/FRRouting/frr/blob/master/yang/ietf/ietf-routing-types.yang#L258
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agoyang: route-distinguisher typedef support asdot notation
Philippe Guibert [Thu, 24 Nov 2022 14:44:53 +0000 (15:44 +0100)]
yang: route-distinguisher typedef support asdot notation

Some route-distinguisher notation is not supported today.
route-map rmap permit 1
 match evpn rd 1.1:1
 match evpn rd 0.65000:1
!

Add support for this.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agoyang: route-distinguisher typedef for route-maps reworked
Philippe Guibert [Thu, 24 Nov 2022 13:02:31 +0000 (14:02 +0100)]
yang: route-distinguisher typedef for route-maps reworked

Some route-distinguisher combinations were not possible under
route-maps:
route-map rmap permit 1
 match evpn rd 65540:44
 match evpn rd 1.2.3.4:44
 match evpn rd 2000000:44

Do not use the ietf definition for route-distinguisher by overriding
a new definition in bgp-route-map.yang itself. When the BGP northbound
API will be done, this route-distinguisher definition will have to
be used too.

Fixes: ("48cb7ea99d10") bgpd: North-bound implementation for bgp rmaps
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agotopotests: add test with aspath list encoded as asdot+ format
Philippe Guibert [Wed, 23 Nov 2022 14:46:34 +0000 (15:46 +0100)]
topotests: add test with aspath list encoded as asdot+ format

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agobgpd: store the route-distinguisher from config as a string
Philippe Guibert [Tue, 22 Nov 2022 10:20:51 +0000 (11:20 +0100)]
bgpd: store the route-distinguisher from config as a string

The route-distinguisher string can be expressed in different
ways when the AS number is part of the RD. And the configured
string value has to be kept intact.
The following vty commands store the string value internally:
- router bgp / address-family ipv4 unicast / rd vpn export <>
- router bgp / address-family l2vpn evpn / rd <>
- router bgp / address-family l2vpn evpn / vni <> / rd <>

The vty commands where RD is configured in the below places is
not considered:
- router bgp / rfapi related commands
- router bgp / address-family xxx xxx / network .. rd <>

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agobgpd: support for as notation format for route distinguisher
Philippe Guibert [Tue, 22 Nov 2022 08:57:10 +0000 (09:57 +0100)]
bgpd: support for as notation format for route distinguisher

RD may be built based on an AS number. Like for the AS, the RD
may use the AS notation. The two below examples can illustrate:

RD 1.1:20 stands for an AS4B:NN RD with AS4B=65536 in dot format.
RD 0.1:20 stands for an AS2B:NNNN RD with AS2B=0.1 in dot+ format.

This commit adds the asnotation mode to prefix_rd2str() API so as
to pick up the relevant display.

Two new printfrr extensions are available to display the RD with
the two above display methods.
- The pRDD extension stands for dot asnotation format
- The pRDE extension stands for dot+ asnotation format.
- The pRD extension has been renamed to pRDP extension

The code is changed each time '%pRD' printf extension is called.
Possibly, the asnotation may change the output, then a macro defines
the asnotation mode to use. A side effect of forging the mode to
use is that the string could not be concatenated with other strings
in vty_out and snprintfrr. Those functions have been called multiple
times. When zlog_debug needs to display the RD with some other string,
the prefix_rd2str() old API is used instead of the printf extension.

Some code has been kept untouched:
- code related to running-config. Actually, wherever an RD is displayed,
its configured name should be dumped.
- bgp rfapi code
- bgp evpn multihoming code (partially done), since the logic is
missing to get the asnotation of 'struct bgp_evpn_es'.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agobgpd: the neighbor as are displayed with as-notation mode
Philippe Guibert [Fri, 18 Nov 2022 15:58:14 +0000 (16:58 +0100)]
bgpd: the neighbor as are displayed with as-notation mode

The as-notation mode of the BGP instance will impact the way
the neighbor AS information is dumped in the show commands.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agobgpd: store the confederation as identifier as a string
Philippe Guibert [Fri, 18 Nov 2022 15:56:09 +0000 (16:56 +0100)]
bgpd: store the confederation as identifier as a string

The confederation peers as and the confederation identifier as
are stored as a string to preserve the output in the running
configuration.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agobgpd: store the neighbor as identifier as a string
Philippe Guibert [Fri, 18 Nov 2022 15:02:55 +0000 (16:02 +0100)]
bgpd: store the neighbor as identifier as a string

This identifier is used to display the peer configuration in
the running-config, like it has been configured.
The following commands are using a specific string attribute:
- neighbor .. remote-as ASN
- neighbor .. local-as ASN

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agobgpd: modify bgp as number output
Philippe Guibert [Fri, 18 Nov 2022 12:49:53 +0000 (13:49 +0100)]
bgpd: modify bgp as number output

A json AS number API is created in order to output a
given AS number. In order to keep backward compatibility,
if the as-notation uses a number, then the json is encoded
as an integer, otherwise the encoding will be a string.

For what is not relevant to running-configuration, the
as-notation mode is the one used for the BGP instance.

Also, the vty completion gets the configured 'as_pretty'
string value, when an user wants to get the available
BGP instances.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agobgpd: aspath list format binds on as-notation format
Philippe Guibert [Mon, 14 Nov 2022 14:56:40 +0000 (15:56 +0100)]
bgpd: aspath list format binds on as-notation format

Each BGP prefix may have an as-path list attached. A forged
string is stored in the BGP attribute and shows the as-path
list output.

Before this commit, the as-path list output was expressed as
a list of AS values in plain format. Now, if a given BGP instance
uses a specific asnotation, then the output is changed:

new output:
router bgp 1.1 asnotation dot
!
 address-family ipv4 unicast
  network 10.200.0.0/24 route-map rmap
  network 10.201.0.0/24 route-map rmap
  redistribute connected route-map rmap
 exit-address-family
exit
!
route-map rmap permit 1
 set as-path prepend 1.1 5433.55 264564564
exit

ubuntu2004# do show bgp ipv4
BGP table version is 2, local router ID is 10.0.2.15, vrf id 0
Default local pref 100, local AS 1.1
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

    Network          Next Hop            Metric LocPrf Weight Path
 *> 4.4.4.4/32       0.0.0.0                  0         32768 1.1 5433.55 4036.61268 ?
 *> 10.0.2.0/24      0.0.0.0                  0         32768 1.1 5433.55 4036.61268 ?
    10.200.0.0/24    0.0.0.0                  0         32768 1.1 5433.55 4036.61268 i
    10.201.0.0/24    0.0.0.0                  0         32768 1.1 5433.55 4036.61268 i

The changes include:
- the aspath structure has a new field: asnotation type
The ashash list will differentiate 2 aspaths using a different
asnotation.
- 3 new printf extensions display the as number in the wished
format: pASP, pASD, pASE for plain, dot, or dot+ format (extended).

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agobgpd: add as-notation keyword to 'router bgp' vty command
Philippe Guibert [Thu, 3 Nov 2022 20:17:57 +0000 (21:17 +0100)]
bgpd: add as-notation keyword to 'router bgp' vty command

A new keyword permits changing the BGP as-notation output:
- [no] router bgp <> [vrf BLABLA] [as-notation [<dot|plain|dot+>]]

At the BGP instance creation, the output will inherit the way the
BGP instance is declared. For instance, the 'router bgp 1.1'
command will configure the output in the dot format. However, if
the client wants to choose an alternate output, he will have to
add the extra command: 'router bgp 1.1 as-notation dot+'.

Also, if the user wants to have plain format, even if the BGP
instance is declared in dot format, the keyword can also be used
for that.

The as-notation output is only taken into account at the BGP
instance creation. In the case where VPN instances are used,
a separate instance may be dynamically created. In that case,
the real as-notation format will be taken into acccount at the
first configuration.

Linking the as-notation format with the BGP instance makes sense,
as the operators want to keep consistency of what they configure.

One technical reason why to link the as-notation output with the
BGP instance creation is that the as-path segment lists stored
in the BGP updates use a string representation to handle aspath
operations (by using regexp for instance). Changing on the fly
the output needs to regenerate this string representation to the
correct format. Linking the configuration to the BGP instance
creation avoids refreshing the BGP updates. A similar mechanism
is put in place in junos too.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agolib, bgp: add initial support for asdot format
Philippe Guibert [Wed, 2 Nov 2022 17:17:21 +0000 (18:17 +0100)]
lib, bgp: add initial support for asdot format

AS number can be defined as an unsigned long number, or
two uint16 values separated by a period (.). The possible
valus are:
- usual 32 bit values : [1;2^32 -1]
- <1.65535>.<0.65535> for dot notation
- <0.65535>.<0.65535> for dot+ notation.

The 0.0 value is forbidden when configuring BGP instances
or peer configurations.

A new ASN type is added for parsing in the vty.
The following commands use that new identifier:
- router bgp ..
- bgp confederation ..
- neighbor <> remote-as <>
- neighbor <> local-as <>
- clear ip bgp <>
- route-map / set as-path <>

An asn library is available in lib/ and provides some
services:
- convert an as string into an as number.
- parse an as path list string and extract a number.
- convert an as number into a string.

Also, the bgp tests forge an as_zero_path, and to do that,
an API to relax the possibility to have a 0 as value is
specifically called from the tests.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agobgpd: store the bgp as identifier in the configured as-notation
Philippe Guibert [Tue, 15 Nov 2022 15:42:40 +0000 (16:42 +0100)]
bgpd: store the bgp as identifier in the configured as-notation

This is a preliminary work to handle various ways to configure
a BGP Autonomous System. When creating a BGP instance, the
user may want to define the AS number as a dotted value,
instead of using an integer value.

To handle both cases, an as_pretty char attribute will store
the as number as it has been given to the vtysh command:

router bgp <as number>

Whenever the as integer of the BGP instance was dumped,
the as_pretty original format is used.

The json output reuses the integer value to keep backward
compatibility with old displays.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
16 months agoMerge pull request #12757 from opensourcerouting/fix/advance_versions_for_packages
Donald Sharp [Fri, 10 Feb 2023 00:36:54 +0000 (19:36 -0500)]
Merge pull request #12757 from opensourcerouting/fix/advance_versions_for_packages

tools: Bump versions for Redhat and Debian packages in changelogs

16 months agoMerge pull request #12762 from sri-mohan1/sri-bable
Donald Sharp [Fri, 10 Feb 2023 00:36:08 +0000 (19:36 -0500)]
Merge pull request #12762 from sri-mohan1/sri-bable

babeld: changes for code maintainability

16 months agoMerge pull request #12782 from opensourcerouting/fix/bgpd_aspath_str_crash
Donald Sharp [Fri, 10 Feb 2023 00:25:19 +0000 (19:25 -0500)]
Merge pull request #12782 from opensourcerouting/fix/bgpd_aspath_str_crash

bgpd: Intern default-originate attributes to avoid use-after-free

16 months agoMerge pull request #12781 from opensourcerouting/fix/memory_leak
Donald Sharp [Fri, 10 Feb 2023 00:25:05 +0000 (19:25 -0500)]
Merge pull request #12781 from opensourcerouting/fix/memory_leak

lib: Release memory of YANG translation module on error

16 months agolib: Free dnode before returning if YANG translator model is already loaded
Donatas Abraitis [Thu, 9 Feb 2023 21:14:46 +0000 (23:14 +0200)]
lib: Free dnode before returning if YANG translator model is already loaded

Seems just a missed one because at `goto error` we release dnode.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
16 months agotests: Check if BGP default-originate withdraw works correctly
Donatas Abraitis [Thu, 9 Feb 2023 20:55:53 +0000 (22:55 +0200)]
tests: Check if BGP default-originate withdraw works correctly

And also do not crash when we do `clear ip bgp ...`.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
16 months agobgpd: Intern default-originate attributes to avoid use-after-free
Donatas Abraitis [Thu, 9 Feb 2023 20:29:25 +0000 (22:29 +0200)]
bgpd: Intern default-originate attributes to avoid use-after-free

When we receive a default route from a peer and we originate default route
using `neighbor default-originate`, we do not track of struct attr we use,
and when we do `no neighbor default-originate` we withdraw our generated
default route, but we announce default-route from the peer.

After we do this, we unintern aspath (which was used for default-originate),
BUT it was used also for peer's default route we received.

And here we have a use-after-free crash, because bgp_process_main_one()
reaps old paths that are marked as BGP_PATH_REMOVED with aspath->refcnt > 0,
but here it's 0.

```
0 0x55c24bbcd022 in aspath_key_make bgpd/bgp_aspath.c:2070
1 0x55c24b8f1140 in attrhash_key_make bgpd/bgp_attr.c:777
2 0x7f52322e66c9 in hash_release lib/hash.c:220
3 0x55c24b8f6017 in bgp_attr_unintern bgpd/bgp_attr.c:1271
4 0x55c24ba0acaa in bgp_path_info_free_with_caller bgpd/bgp_route.c:283
5 0x55c24ba0a7de in bgp_path_info_unlock bgpd/bgp_route.c:309
6 0x55c24ba0af6d in bgp_path_info_reap bgpd/bgp_route.c:426
7 0x55c24ba17b9a in bgp_process_main_one bgpd/bgp_route.c:3333
8 0x55c24ba18a1d in bgp_process_wq bgpd/bgp_route.c:3425
9 0x7f52323c2cd5 in work_queue_run lib/workqueue.c:282
10 0x7f52323aab92 in thread_call lib/thread.c:2006
11 0x7f5232300dc7 in frr_run lib/libfrr.c:1198
12 0x55c24b8ea792 in main bgpd/bgp_main.c:520
13 0x7f5231c3a082 in __libc_start_main ../csu/libc-start.c:308
14 0x55c24b8ef0bd in _start (/usr/lib/frr/bgpd+0x2c90bd)
    ```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
16 months agolib: Release memory of YANG translation module on error
Donatas Abraitis [Thu, 9 Feb 2023 15:59:11 +0000 (17:59 +0200)]
lib: Release memory of YANG translation module on error

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
16 months agolib: add copy function for bitfield_t
Hiroki Shirokura [Thu, 30 Dec 2021 13:13:37 +0000 (13:13 +0000)]
lib: add copy function for bitfield_t

Add a function to copy a bitfield_t structure.

Add a ‘void *’ to ‘word_t *’ converstion in bf_init() to avoid the
following error:

> ./lib/bitfield.h: In function ‘bf_copy’:
> ./lib/bitfield.h:75:12: error: request for implicit conversion from ‘void *’ to ‘word_t *’ {aka ‘unsigned int *’} not permitted in C++ [-Werror=c++-compat]
>    (v).data = XCALLOC(MTYPE_BITFIELD, ((v).m * sizeof(word_t)));  \
>             ^
> ./lib/bitfield.h:278:2: note: in expansion of macro ‘bf_init’
>   bf_init(dst, WORD_SIZE * (src.m - 1));
>   ^~~~~~~

Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
16 months agoisisd: add affinity-map support
Louis Scalbert [Mon, 7 Nov 2022 10:16:36 +0000 (11:16 +0100)]
isisd: add affinity-map support

Add the support of the affinity-map command to isisd.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
16 months agolib,yang,zebra: add affinity-map support
Louis Scalbert [Thu, 3 Nov 2022 13:30:23 +0000 (14:30 +0100)]
lib,yang,zebra: add affinity-map support

Add the affinity-map global command to zebra. The syntax is:

> affinity-map NAME bit-position (0-1023)

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
16 months agoMerge pull request #12730 from louis-6wind/fix-ext-te-metrics
Olivier Dugeon [Thu, 9 Feb 2023 14:12:41 +0000 (15:12 +0100)]
Merge pull request #12730 from louis-6wind/fix-ext-te-metrics

Fix for Extended TE metrics

16 months agodoc: update workflow docs for SPDX header
David Lamparter [Thu, 9 Feb 2023 11:41:55 +0000 (12:41 +0100)]
doc: update workflow docs for SPDX header

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
16 months ago*: remove some leftover license blurbs
David Lamparter [Thu, 9 Feb 2023 11:19:23 +0000 (12:19 +0100)]
*: remove some leftover license blurbs

The regex'ing left some paragraphs that didn't exactly match.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
16 months agoyang: add SPDX License IDs
David Lamparter [Thu, 9 Feb 2023 11:00:38 +0000 (12:00 +0100)]
yang: add SPDX License IDs

YANG files get to keep their license boilerplate in addition to the SPDX
header, since they are likely to be copied around individually.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
16 months agolib: SPDX License ID on skiplist code
David Lamparter [Wed, 8 Feb 2023 14:16:39 +0000 (15:16 +0100)]
lib: SPDX License ID on skiplist code

The skiplist code has a very "colorful" history.  Use the SPDX
"LicenseRef" syntax/notation to track it.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
16 months ago*: auto-convert to SPDX License IDs
David Lamparter [Wed, 8 Feb 2023 12:17:09 +0000 (13:17 +0100)]
*: auto-convert to SPDX License IDs

Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
16 months ago*: manual SPDX License ID conversions
David Lamparter [Wed, 8 Feb 2023 12:21:36 +0000 (13:21 +0100)]
*: manual SPDX License ID conversions

The files converted in this commit either had some random misspelling or
formatting weirdness that made them escape automated replacement, or
have a particularly "weird" licensing setup (e.g. dual-licensed.)

This also marks a bunch of "public domain" files as SPDX License "NONE".

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
16 months ago*: sort out & explain licenses used in FRR
David Lamparter [Wed, 8 Feb 2023 11:03:28 +0000 (12:03 +0100)]
*: sort out & explain licenses used in FRR

New "introduction" note in `COPYING`, and all the licenses moved into
`doc/licenses/`.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
16 months agoMerge pull request #12773 from donaldsharp/pbr_table_values
mobash-rasool [Thu, 9 Feb 2023 10:47:54 +0000 (16:17 +0530)]
Merge pull request #12773 from donaldsharp/pbr_table_values

pbrd: fix large tableids displayed as negative

16 months agoMerge pull request #12738 from taspelund/adj-rib-specific
Donatas Abraitis [Thu, 9 Feb 2023 09:02:11 +0000 (11:02 +0200)]
Merge pull request #12738 from taspelund/adj-rib-specific

Improvements to advertised/received/bestpath-routes commands

16 months agopim6d: Modify "show ipv6 mld join json" o/p
Sarita Patra [Thu, 9 Feb 2023 07:38:18 +0000 (23:38 -0800)]
pim6d: Modify "show ipv6 mld join json" o/p

Currently "show ipv6 mld join json" o/p is
frr# show ipv6 mld joins json
{
  "default":{
    "ens192":{
      "ff02:2":{
        "::":{
          "state":"JOIN",
          "created":"00:01:50.595",
          "lastSeen":"00:00:38.403",
        }
      }
    }
  }
}

Here, I modified the o/p as below for better understanding.
frr# show ipv6 mld joins json
{
  "default":{
    "vrf":"default",
    "ens192":{
      "ff02::2":{
        "*":{
          "state":"JOIN",
          "created":"00:00:42.766",
          "lastSeen":"00:00:05.266"
        }
      }
    }
  }
}

Issue: #12755

Signed-off-by: Sarita Patra <saritap@vmware.com>
16 months agoospfd: Fix "show ip ospf neighbor swp1 detail json" output
Pooja Jagadeesh Doijode [Wed, 8 Feb 2023 22:34:06 +0000 (14:34 -0800)]
ospfd: Fix "show ip ospf neighbor swp1 detail json" output

1. When OSPF unnumbered neighbor doesn't exist in any VRF,
   OSPFD prints a bunch of empty JSON objects. Fixed it
   by adding an outer JSON object with VRF information in it
2. Added "vrf" option to this command so that per VRF
   unnumbered OSPF neighbor information can be retrieved

JSON output:
    nl1# show ip ospf neighbor swp1 detail json
        {
          "default":{
          },
          "vrf1012":{
          },
          "vrf1013":{
          },
          "vrf1014":{
          }
        }

    nl1# show ip ospf vrf vrf1012 neighbor swp4.2 detail json
        {
          "9.9.12.10":[
            {
              "ifaceAddress":"200.254.2.46",
              "areaId":"0.0.0.0",
              "ifaceName":"swp4.2",
              "localIfaceAddress":"200.254.2.45",
              "nbrPriority":1,
              "nbrState":"Full",
              "role":"DR",
              "stateChangeCounter":6,
              "lastPrgrsvChangeMsec":1462758,
              "routerDesignatedId":"200.254.2.46",
              "routerDesignatedBackupId":"200.254.2.45",
              "optionsCounter":2,
              "optionsList":"*|-|-|-|-|-|E|-",
              "routerDeadIntervalTimerDueMsec":37140,
              "databaseSummaryListCounter":0,
              "linkStateRequestListCounter":0,
              "linkStateRetransmissionListCounter":0,
              "threadInactivityTimer":"on",
              "threadLinkStateRequestRetransmission":"on",
              "threadLinkStateUpdateRetransmission":"on"
            }
          ]
        }
        nl1#

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
16 months agopbrd: fix large tableids displayed as negative
Wesley Coakley [Tue, 20 Jul 2021 13:25:01 +0000 (09:25 -0400)]
pbrd: fix large tableids displayed as negative

Ticket: 2699411
Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
16 months agodoc: optional keyword info for bestpath-routes
Trey Aspelund [Fri, 3 Feb 2023 21:13:38 +0000 (21:13 +0000)]
doc: optional keyword info for bestpath-routes

Adds information about the optional keywords for the bestpath-routes
bgp show command.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
16 months agodoc: prefix match for advertised/received-routes
Trey Aspelund [Fri, 3 Feb 2023 21:11:48 +0000 (21:11 +0000)]
doc: prefix match for advertised/received-routes

Doc changes for new prefix matching.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
16 months agobgpd: prefix match for advertised/received-routes
Trey Aspelund [Fri, 3 Feb 2023 20:59:34 +0000 (20:59 +0000)]
bgpd: prefix match for advertised/received-routes

This introduces the option for a user to lookup one specific prefix in
the advertised-routes or received-routes table of a peer.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
16 months agobgpd: add 'detail' option to bestpath-routes
Trey Aspelund [Fri, 3 Feb 2023 20:44:27 +0000 (20:44 +0000)]
bgpd: add 'detail' option to bestpath-routes

Introduce 'detail' keyword for 'show bgp <afi> <safi> bestpath-routes'.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
16 months agoMerge pull request #12769 from donaldsharp/missing_syslog
Donatas Abraitis [Wed, 8 Feb 2023 20:40:32 +0000 (22:40 +0200)]
Merge pull request #12769 from donaldsharp/missing_syslog

tools: Fix missing pbrd in rsyslog.d 45-frr.conf file

16 months agoMerge pull request #12768 from louis-6wind/fix-grep-vpnv4-noretain
Donatas Abraitis [Wed, 8 Feb 2023 19:53:19 +0000 (21:53 +0200)]
Merge pull request #12768 from louis-6wind/fix-grep-vpnv4-noretain

tests: do not use exclude grep

16 months agotools: Fix missing pbrd in rsyslog.d 45-frr.conf file
Donald Sharp [Wed, 8 Feb 2023 18:04:01 +0000 (13:04 -0500)]
tools: Fix missing pbrd in rsyslog.d 45-frr.conf file

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
16 months agotests: do not use exclude grep
Louis Scalbert [Wed, 8 Feb 2023 11:05:15 +0000 (12:05 +0100)]
tests: do not use exclude grep

Filter out keys in JSON output with "grep -v" does not work when JSON
does not use the pretty format.

Use native python code to filter out keys.

Fixes: 6c13bd5744 ("topotests: fix bgp_vpnv4_noretain")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
16 months agoMerge pull request #12761 from anlancs/fix/bgpd-crash-evpn-vni-both-rts
Donatas Abraitis [Wed, 8 Feb 2023 08:07:07 +0000 (10:07 +0200)]
Merge pull request #12761 from anlancs/fix/bgpd-crash-evpn-vni-both-rts

bgpd: fix use-after-free crash for evpn

16 months agoospfd: Option to query specific neighbor in VRF
Pooja Jagadeesh Doijode [Tue, 7 Feb 2023 23:29:31 +0000 (15:29 -0800)]
ospfd: Option to query specific neighbor in VRF

Added VRF option to
"show ip ospf [vrf NAME] neighbor X.X.X.X [detail] [json]"
command so that the user can query information regarding a
specific neighbor within a VRF.

r1# show ip ospf vrf default neighbor 10.0.255.2
10.0.255.2        1 Full/-          33m10s             9.891s 10.0.3.2        r1-eth1:10.0.3.4                     0     0     0

r1# show ip ospf vrf default neighbor 10.0.255.2 json
    {
      "10.0.255.2":[
        {
          "priority":1,
          "state":"Full/-",
          "nbrPriority":1,
          "nbrState":"Full/-",
          "converged":"Full",
          "role":"DROther",
          "upTimeInMsec":13877947,
          "deadTimeMsecs":9498,
          "routerDeadIntervalTimerDueMsec":9498,
          "upTime":"3h51m17s",
          "deadTime":"9.498s",
          "address":"10.0.3.2",
          "ifaceAddress":"10.0.3.2",
          "ifaceName":"r1-eth1:10.0.3.4",
          "retransmitCounter":0,
          "linkStateRetransmissionListCounter":0,
          "requestCounter":0,
          "linkStateRequestListCounter":0,
          "dbSummaryCounter":0,
          "databaseSummaryListCounter":0
        }
      ]
    }
r1# show ip ospf vrf default neighbor 10.0.255.2 detail
     Neighbor 10.0.255.2, interface address 10.0.3.2
        In the area 0.0.0.0 via interface r1-eth1 local interface IP 10.0.3.4
        Neighbor priority is 1, State is Full/-, Role is DROther, 5 state changes
        Most recent state change statistics:
          Progressive change 3h51m27s ago
        DR is 0.0.0.0, BDR is 0.0.0.0
        Options 2 *|-|-|-|-|-|E|-
        Dead timer due in 8.458s
        Database Summary List 0
        Link State Request List 0
        Link State Retransmission List 0
        Thread Inactivity Timer on
        Thread Database Description Retransmision off
        Thread Link State Request Retransmission on
        Thread Link State Update Retransmission on

        Graceful restart Helper info:
          Graceful Restart HELPER Status : None

r1# show ip ospf vrf default neighbor 10.0.255.2 detail json
    {
      "10.0.255.2":[
        {
          "ifaceAddress":"10.0.3.2",
          "areaId":"0.0.0.0",
          "ifaceName":"r1-eth1",
          "localIfaceAddress":"10.0.3.4",
          "nbrPriority":1,
          "nbrState":"Full/-",
          "role":"DROther",
          "stateChangeCounter":5,
          "lastPrgrsvChangeMsec":13889856,
          "routerDesignatedId":"0.0.0.0",
          "routerDesignatedBackupId":"0.0.0.0",
          "optionsCounter":2,
          "optionsList":"*|-|-|-|-|-|E|-",
          "routerDeadIntervalTimerDueMsec":9715,
          "databaseSummaryListCounter":0,
          "linkStateRequestListCounter":0,
          "linkStateRetransmissionListCounter":0,
          "threadInactivityTimer":"on",
          "threadLinkStateRequestRetransmission":"on",
          "threadLinkStateUpdateRetransmission":"on",
          "grHelperStatus":"None"
        }
      ]
    }
r1#

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
16 months agolib: Helper function to print empty JSON
Pooja Jagadeesh Doijode [Tue, 7 Feb 2023 22:29:54 +0000 (14:29 -0800)]
lib: Helper function to print empty JSON

Introduced a helper function to print empty JSON object.

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
16 months agoMerge pull request #12654 from Pdoijode/evpn-evi-detail-json-changes
Donatas Abraitis [Tue, 7 Feb 2023 21:31:53 +0000 (23:31 +0200)]
Merge pull request #12654 from Pdoijode/evpn-evi-detail-json-changes

zebra: fix JSON fields for show evpn vni detail

16 months agoMerge pull request #12707 from donaldsharp/missed_enums
Donatas Abraitis [Tue, 7 Feb 2023 20:22:27 +0000 (22:22 +0200)]
Merge pull request #12707 from donaldsharp/missed_enums

Missed enums

16 months agotools: Bump versions for Redhat and Debian packages in changelogs
Donatas Abraitis [Tue, 7 Feb 2023 19:37:18 +0000 (21:37 +0200)]
tools: Bump versions for Redhat and Debian packages in changelogs

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
16 months agoMerge pull request #12759 from opensourcerouting/fix/revalidate_commit_on_pr_update
Donald Sharp [Tue, 7 Feb 2023 20:13:50 +0000 (15:13 -0500)]
Merge pull request #12759 from opensourcerouting/fix/revalidate_commit_on_pr_update

tools: Revalidate commits when PR is updated

16 months agotools: Fetch more commits for commitlint to validate the commit
Donatas Abraitis [Tue, 7 Feb 2023 20:03:42 +0000 (22:03 +0200)]
tools: Fetch more commits for commitlint to validate the commit

Note: It's necessary that you specify the fetch-depth argument to
actions/checkout@v2 step. By default they fetch only latest commit of the
branch, but we need more commits since we validate a range of commit messages.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
16 months agotools: Revalidate commits when PR is updated
Donatas Abraitis [Tue, 7 Feb 2023 19:55:31 +0000 (21:55 +0200)]
tools: Revalidate commits when PR is updated

Trigger GH action also if labeled, unlabeled.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
16 months agoMerge pull request #12756 from opensourcerouting/fix/add_build_to_commits
Donald Sharp [Tue, 7 Feb 2023 19:50:00 +0000 (14:50 -0500)]
Merge pull request #12756 from opensourcerouting/fix/add_build_to_commits

tools: Add `build` as a valid prefix for commit messages

16 months agotools: Add `build` as a valid prefix for commit messages
Donatas Abraitis [Tue, 7 Feb 2023 19:31:00 +0000 (21:31 +0200)]
tools: Add `build` as a valid prefix for commit messages

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
16 months agobuild: FRR 9.0 development version
Donatas Abraitis [Tue, 7 Feb 2023 19:25:42 +0000 (21:25 +0200)]
build: FRR 9.0 development version

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
16 months agoMerge pull request #12722 from opensourcerouting/vim-xref
Jafar Al-Gharaibeh [Tue, 7 Feb 2023 16:43:27 +0000 (10:43 -0600)]
Merge pull request #12722 from opensourcerouting/vim-xref

tools: add `GotoXref` vim script

16 months agoMerge pull request #12715 from opensourcerouting/fix/contribution_guid_squash_random_...
Jafar Al-Gharaibeh [Tue, 7 Feb 2023 16:42:53 +0000 (10:42 -0600)]
Merge pull request #12715 from opensourcerouting/fix/contribution_guid_squash_random_commits

Commits hygiene

16 months agoMerge pull request #12748 from opensourcerouting/fix/route_map_vpn_import
Russ White [Tue, 7 Feb 2023 16:40:03 +0000 (11:40 -0500)]
Merge pull request #12748 from opensourcerouting/fix/route_map_vpn_import

tests: Check if route-map vpn import basic funtionality works fine

16 months agoMerge pull request #12720 from opensourcerouting/fix/ecommunity_ipv6_missing_token
Russ White [Tue, 7 Feb 2023 14:21:07 +0000 (09:21 -0500)]
Merge pull request #12720 from opensourcerouting/fix/ecommunity_ipv6_missing_token

bgpd: ecommunity_token_rt6 is not handled

16 months agoMerge pull request #12741 from thesamesam/missing-time
Donatas Abraitis [Tue, 7 Feb 2023 09:05:46 +0000 (11:05 +0200)]
Merge pull request #12741 from thesamesam/missing-time

pceplib: add <time.h> include for time_t

16 months agobabeld: changes for code maintainability
sri-mohan1 [Tue, 7 Feb 2023 08:05:04 +0000 (13:35 +0530)]
babeld: changes for code maintainability

these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
16 months agoospfd: Added missing fields to "show ip ospf neighbor detail"
Pooja Jagadeesh Doijode [Wed, 18 Jan 2023 20:26:01 +0000 (12:26 -0800)]
ospfd: Added missing fields to "show ip ospf neighbor detail"

"role" and "local interface address" fields were missing in
"show ip ospf neighbor detail" command.

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
16 months agopceplib: add <time.h> include for time_t
Sam James [Sat, 4 Feb 2023 23:29:59 +0000 (23:29 +0000)]
pceplib: add <time.h> include for time_t

Fixes build on musl. Used for time_t in the header.

Bug: https://bugs.gentoo.org/862558
Signed-off-by: Sam James <sam@gentoo.org>
16 months agobgpd: Add more context in logs about from where to where routes are leaked
Donatas Abraitis [Mon, 6 Feb 2023 16:41:19 +0000 (18:41 +0200)]
bgpd: Add more context in logs about from where to where routes are leaked

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
16 months agobgpd: Drop struct bgp from vpn_leak_to_vrf_withdraw()
Donatas Abraitis [Mon, 6 Feb 2023 16:40:44 +0000 (18:40 +0200)]
bgpd: Drop struct bgp from vpn_leak_to_vrf_withdraw()

Not used at all, just drop it.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
16 months agotests: Check if `route-map vpn import` basic funtionality works fine
Donatas Abraitis [Mon, 6 Feb 2023 16:38:52 +0000 (18:38 +0200)]
tests: Check if `route-map vpn import` basic funtionality works fine

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
16 months agobgpd: fix use-after-free crash for evpn
anlan_cs [Mon, 6 Feb 2023 01:27:05 +0000 (09:27 +0800)]
bgpd: fix use-after-free crash for evpn

```
anlan(config-router-af)# vni 33
anlan(config-router-af-vni)# route-target both 44:55
anlan(config-router-af-vni)# no route-target both 44:55
vtysh: error reading from bgpd: Resource temporarily unavailable (11)Warning: closing connection to bgpd because of an I/O error!
```

When `bgp_evpn_vni_rt_cmd` deals with "both" type, it wrongly created
only one node ( should be two nodes ) for lists of both `vpn->import_rtl` and
`vpn->export_rtl`.  At this time, the two lists are already wrong.

In `no route-target both RT`, it will free the single node from lists of both
`vpn->import_rtl` and `vpn->export_rtl`.  After freed from `vpn->import_rtl`,
it is "use-after-free" at the time of freeing it from `vpn->export_rtl`.
It causes crash sometimes, or other unexpected behaviours.

This issue is introduced by commit `3b7e8d`, which have adjusted both
`bgp_evpn_vni_rt_cmd` and `bgp_evpn_vrf_rt_cmd`.

Since `bgp_evpn_vrf_rt_cmd/no_bgp_evpn_vrf_rt_cmd` works well again
unintentionally with commit `7022da`, only `bgp_evpn_vni_rt_cmd` needs to
modify - add two nodes for "both" type and some explicit comments for this
special case of "both" type.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
16 months agoMerge pull request #12740 from vfreex/babel-fix-filtering
Donatas Abraitis [Mon, 6 Feb 2023 13:24:56 +0000 (15:24 +0200)]
Merge pull request #12740 from vfreex/babel-fix-filtering

babeld: Fix filtering against all interfaces

16 months agobabeld: Fix filtering against all interfaces
Yuxiang Zhu [Sat, 4 Feb 2023 17:20:43 +0000 (17:20 +0000)]
babeld: Fix filtering against all interfaces

The first argument of `access_list_lookup` and `prefix_list_lookup`
should be `AFI_` constants instead of `AF_` constants.

Signed-off-by: Yuxiang Zhu <vfreex@gmail.com>
16 months agoMerge pull request #12668 from anlancs/fix/zebra-evpn-missing-advertise
Donatas Abraitis [Sat, 4 Feb 2023 10:52:22 +0000 (12:52 +0200)]
Merge pull request #12668 from anlancs/fix/zebra-evpn-missing-advertise

zebra: fix wrong conversion for evpn advertising

16 months agoMerge pull request #12732 from donaldsharp/fix_bgp_open_issues
Mark Stapp [Fri, 3 Feb 2023 12:17:00 +0000 (07:17 -0500)]
Merge pull request #12732 from donaldsharp/fix_bgp_open_issues

bgpd: Don't try to recursively hold peer io mutex

16 months agobgpd: Don't try to recursively hold peer io mutex
Donald Sharp [Thu, 2 Feb 2023 19:13:12 +0000 (14:13 -0500)]
bgpd: Don't try to recursively hold peer io mutex

BGP was modified in a0b937de428e14e869b8541f0b7810113d619c2e
to grab the peer->io_mtx before validating the header to ensure
that the input Queue was not being modified by anyone else at that
moment in time.  Unfortunately validate_header can detect a problem
and attempt to relock the mutex, which deadlocks.  This deadlock in
the bgp_io pthread is the lone deadlock at first, eventually though
bgp attempts to write another packet to the peer( say when the
it's time to send the next packet ) and the main pthread of bgpd
becomes deadlocked and then the whole bgpd process is stuck at that
point in time leaving us dead in the water.

The point of locking the mutex earlier was to ensure that the input
Queue wasn't being modified by anyone else, (Say reading off it )
as that we wanted to ensure that we don't hold more packets then necessary.

Let's grab the mutex long enough to look at the input Q size, this
ensure that we have room and then we can validate_header and do the right
thing from there.  We'll need to lock the mutex when we actually move it
into the input Q as well.

Fixes: #12725
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
16 months agoMerge pull request #12731 from donaldsharp/remove_pretty_print
Russ White [Thu, 2 Feb 2023 20:44:45 +0000 (15:44 -0500)]
Merge pull request #12731 from donaldsharp/remove_pretty_print

lib, bgpd: Add ability to specify that some json output should not be…

16 months agobgpd: Convert evpn output to not pretty print json
Donald Sharp [Thu, 2 Feb 2023 15:40:07 +0000 (10:40 -0500)]
bgpd: Convert evpn output to not pretty print json

Commit: 3cdb03fba7b40240fb38469a12b7b05a11043e09
changed the vty_json output to not be pretty printing.
The previous commit in the tree added vty_json_no_pretty
let's use that instead

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
16 months agolib, bgpd: Add ability to specify that some json output should not be pretty
Donald Sharp [Thu, 2 Feb 2023 15:28:19 +0000 (10:28 -0500)]
lib, bgpd: Add ability to specify that some json output should not be pretty

Initial commit: 23b2a7ef524c9fe083b217c7f6ebaec0effc8f52
changed the json output of `show bgp <afi> <safi> json` to
not have pretty print because when under a situation where
there are a bunch of routes with a large scale ecmp show
output was taking forever and this commit cut 2 minutes out
of vtysh run time.

Subusequent commit: f4ec52f7cc99f709756d9030623a20c98a086125
changed this back.

When upgrading to latest version the long run time was noticed
due to testing.  Let's add back this functionality such that
FRR can have reduced run times with vtysh when it's really
needed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
16 months agoisisd: use the te anormal macro
Louis Scalbert [Thu, 2 Feb 2023 15:06:59 +0000 (16:06 +0100)]
isisd: use the te anormal macro

Use the te anormal macro

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
16 months agoisisd: fix te link delay display
Louis Scalbert [Thu, 2 Feb 2023 15:13:39 +0000 (16:13 +0100)]
isisd: fix te link delay display

Apply the TE_EXT_MASK mask to display a 24 bits instead of a wrong 32
bits value that includes unrelated bits.

Fixes: 1b3f47d04c ("isisd: Update TLVs processing for TE, RI & SR")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
16 months agolib: fix traffic engineering extended mask
Louis Scalbert [Thu, 2 Feb 2023 14:44:31 +0000 (15:44 +0100)]
lib: fix traffic engineering extended mask

RFC7471 and RFC8570 have defined the Extended Traffic Engineering
metrics that are carried within TLV of 32 bits data length. Extended
metrics, excepting bandwidth ones, use the following format:

>     0                   1                   2                   3
>     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
>    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>    |   Type        |     Length    |
>    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>    |A|  RESERVED   |                   Value                       |
>    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Data contains a flag/reserved of 8 bits and a 24 bits value.

The TE_EXT_MASK mask macro extracts a 28 bits value from a 32 bits
variable instead of 24 bits. It works in most of the case because
RESERVED bits are generally set to 0.

Fix the TE_EXT_MASK mask.

Fixes: 16f1b9ee29 ("Update Traffic Engineering Support for OSPFD")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
16 months agoMerge pull request #12729 from opensourcerouting/fix/treat-as-withdraw_nlri_update
Donald Sharp [Thu, 2 Feb 2023 13:29:59 +0000 (08:29 -0500)]
Merge pull request #12729 from opensourcerouting/fix/treat-as-withdraw_nlri_update

bgpd: Set attr to NULL when passing NLRI_UPDATE with treat-as-withdraw

16 months agobgpd: Set attr to NULL when passing NLRI_UPDATE with treat-as-withdraw
Donatas Abraitis [Tue, 24 Jan 2023 08:32:13 +0000 (10:32 +0200)]
bgpd: Set attr to NULL when passing NLRI_UPDATE with treat-as-withdraw

Before this patch, we always passed `struct attr` for NLRI_UPDATE, but if we
have a situation with treat-as-withdraw (for example: malformed attribute, or
using a command like `neighbor path-attribute treat-as-withdraw`) the route
MUST be withdrawn form the BGP table.

Hence, we MUST pass attr as NULL, in this case we already have this check
under NLRI_ATTR_ARG() macro, just reuse it properly.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
16 months agobgpd: Add `neighbor path-attribute treat-as-withdraw` command
Donatas Abraitis [Tue, 24 Jan 2023 09:02:24 +0000 (11:02 +0200)]
bgpd: Add `neighbor path-attribute treat-as-withdraw` command

To filter out routes with unwanted prefixes.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
16 months agobgpd: Set attr to NULL when passing NLRI_UPDATE with treat-as-withdraw
Donatas Abraitis [Tue, 24 Jan 2023 08:32:13 +0000 (10:32 +0200)]
bgpd: Set attr to NULL when passing NLRI_UPDATE with treat-as-withdraw

Before this patch, we always passed `struct attr` for NLRI_UPDATE, but if we
have a situation with treat-as-withdraw (for example: malformed attribute, or
using a command like `neighbor path-attribute treat-as-withdraw`) the route
MUST be withdrawn form the BGP table.

Hence, we MUST pass attr as NULL, in this case we already have this check
under NLRI_ATTR_ARG() macro, just reuse it properly.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
16 months agotests: Check if routes are withdrawn with unwanted attributes
Donatas Abraitis [Tue, 24 Jan 2023 08:29:13 +0000 (10:29 +0200)]
tests: Check if routes are withdrawn with unwanted attributes

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
16 months agodoc: Add `neighbor path-attribute treat-as-withdraw` command
Donatas Abraitis [Sun, 22 Jan 2023 19:22:09 +0000 (21:22 +0200)]
doc: Add `neighbor path-attribute treat-as-withdraw` command

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
16 months agoMerge pull request #12672 from donaldsharp/remove_insecure
Donatas Abraitis [Wed, 1 Feb 2023 20:45:20 +0000 (22:45 +0200)]
Merge pull request #12672 from donaldsharp/remove_insecure

vtysh: Remove shell access code

16 months agoMerge pull request #12713 from opensourcerouting/fix/json_naming_deprecation
Donald Sharp [Wed, 1 Feb 2023 20:39:18 +0000 (15:39 -0500)]
Merge pull request #12713 from opensourcerouting/fix/json_naming_deprecation

*: Drop deprecated incorrect JSON fields with wrong naming

16 months agoMerge pull request #12721 from opensourcerouting/format-warnings-redux
Christian Hopps [Wed, 1 Feb 2023 16:13:46 +0000 (11:13 -0500)]
Merge pull request #12721 from opensourcerouting/format-warnings-redux

*: more format string fixing

16 months agovtysh: Schedule shell access for deprecation
Donald Sharp [Wed, 1 Feb 2023 15:26:41 +0000 (10:26 -0500)]
vtysh: Schedule shell access for deprecation

Schedule shell access for deprecation and removal in
a years time.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
16 months agotests: add missing printf attribute
David Lamparter [Tue, 31 Jan 2023 21:17:10 +0000 (22:17 +0100)]
tests: add missing printf attribute

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
16 months agotests: yank asprintfrr duplicate
David Lamparter [Tue, 31 Jan 2023 21:12:41 +0000 (22:12 +0100)]
tests: yank asprintfrr duplicate

I think this one predates the existence of asprintfrr.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>