]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
2 years agotests: Use inequality operator for strings 12911/head
Donatas Abraitis [Mon, 27 Feb 2023 20:08:47 +0000 (22:08 +0200)]
tests: Use inequality operator for strings

tests/topotests/lib/ospf.py:2819: SyntaxWarning: "is not" with a literal. Did you mean "!="?
    _age is not "get"

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #12899 from patrasar/pimv6_mld_interface_cmd
Donatas Abraitis [Mon, 27 Feb 2023 19:01:43 +0000 (21:01 +0200)]
Merge pull request #12899 from patrasar/pimv6_mld_interface_cmd

pim6d: Fix display issue in "show ipv6 mld interface" command

2 years agoMerge pull request #12906 from patrasar/pim_core
Donatas Abraitis [Mon, 27 Feb 2023 18:54:50 +0000 (20:54 +0200)]
Merge pull request #12906 from patrasar/pim_core

pimd, pim6d: Upstream IIF pointing towards PIM and IGMP disabled source conn…

2 years agoMerge pull request #12907 from donaldsharp/memory_why_you_do_this
Donatas Abraitis [Mon, 27 Feb 2023 18:51:53 +0000 (20:51 +0200)]
Merge pull request #12907 from donaldsharp/memory_why_you_do_this

bgpd: Prevent asn dot memory leak

2 years agoMerge pull request #12908 from opensourcerouting/fix/memory_leak_path_attributes
Igor Ryzhov [Mon, 27 Feb 2023 18:46:21 +0000 (20:46 +0200)]
Merge pull request #12908 from opensourcerouting/fix/memory_leak_path_attributes

bgpd: Free temporary memory after using argv_concat()

2 years agobgpd: Free temporary memory after using argv_concat() 12908/head
Donatas Abraitis [Mon, 27 Feb 2023 14:26:32 +0000 (16:26 +0200)]
bgpd: Free temporary memory after using argv_concat()

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #12866 from anlancs/lib/dotas-zero
Donatas Abraitis [Mon, 27 Feb 2023 09:05:47 +0000 (11:05 +0200)]
Merge pull request #12866 from anlancs/lib/dotas-zero

lib: some ASNUMs should be forbidden

2 years agopimd, pim6d: Upstream IIF pointing towards PIM and IGMP disabled source connected... 12906/head
Sarita Patra [Mon, 27 Feb 2023 06:25:05 +0000 (22:25 -0800)]
pimd, pim6d: Upstream IIF pointing towards PIM and IGMP disabled source connected interface

Topology:
=========
RP---FHR<ens224>---Source

Problem Statement:
=================
Step 1:
Enable PIM and IGMP on source connected interface ens224

Step 2:
Start multicast traffic. (s,g) mroute and upstream will be created as expected.

dev# show ip mroute
IP Multicast Routing Table
Flags: S - Sparse, C - Connected, P - Pruned
       R - SGRpt Pruned, F - Register flag, T - SPT-bit for SSM FHR
 Source    Group      Flags  Proto  Input   Output  TTL  Uptime
 50.0.0.4  225.1.1.1  SF     PIM    ens224  pimreg  1    00:37:55

dev# show ip pim upstream
 Iif     Source    Group      State      Uptime    JoinTimer  RSTimer   KATimer   RefCnt
 ens224  50.0.0.4  225.1.1.1  NotJ,RegJ  00:37:57  --:--:--   --:--:--  00:02:43  1

Step 3:
Disable PIM on source connected interafce ens224

dev# show ip mroute
IP Multicast Routing Table
Flags: S - Sparse, C - Connected, P - Pruned
       R - SGRpt Pruned, F - Register flag, T - SPT-bit for SSM FHR
 Source    Group      Flags  Proto  Input   Output  TTL  Uptime
 50.0.0.4  225.1.1.1  SF     PIM    ens224  pimreg  1    00:38:05

dev# show ip pim upstream
 Iif     Source    Group      State      Uptime    JoinTimer  RSTimer   KATimer   RefCnt
 ens224  50.0.0.4  225.1.1.1  NotJ,RegJ  00:38:08  --:--:--   --:--:--  00:02:32  1

Step 4:
Disable IGMP on source connected interface ens224

dev# show ip pim upstream
 Iif     Source    Group      State      Uptime    JoinTimer  RSTimer   KATimer   RefCnt
 ens224  50.0.0.4  225.1.1.1  NotJ,RegJ  00:38:15  --:--:--   --:--:--  00:03:27  1

dev# show ip mroute
IP Multicast Routing Table
Flags: S - Sparse, C - Connected, P - Pruned
       R - SGRpt Pruned, F - Register flag, T - SPT-bit for SSM FHR
 Source    Group      Flags  Proto  Input   Output  TTL  Uptime
 50.0.0.4  225.1.1.1  SF     PIM    <iif?>  pimreg  1    00:38:18

Pim upstream IIF is still pointing towards the source connected
interface which is not pim enabled and not IGMP enabled and
Mroute is still present in the kernel and KAT timer is still running
on the interface, where ifp->info is already set to NULL.
This leads to crash.

Root Cause:
==========
When "no ip pim" commands get executed on source connected interface,
we are updating upstream IIF only when IGMP is not enabled on the same
interface.

Fix:
===
When PIM is disabled on source connected interface, update upstream IIF
no matter if IGMP is enabled or not on the same interface.

Issue: #12848
Issue: #10782

Signed-off-by: Sarita Patra <saritap@vmware.com>
2 years agobgpd: Prevent asn dot memory leak 12907/head
Donald Sharp [Sat, 25 Feb 2023 12:43:30 +0000 (07:43 -0500)]
bgpd: Prevent asn dot memory leak

When allocating a new bit of memory free the old first.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agopim6d: Fix missing parameters in "show ipv6 mld interface" command 12899/head
Sarita Patra [Fri, 24 Feb 2023 15:13:30 +0000 (07:13 -0800)]
pim6d: Fix missing parameters in "show ipv6 mld interface" command

Before fix:
==========
frr# show ipv6 mld interface
Interface         State  V  Querier                    Timer               Uptime
ens224            up     1  fe80::250:56ff:feb7:a7e3   query 00:00:24.219  00:00:07.031

After fix:
=========
frr(config-if)# do show ipv6 mld interface
 Interface  State  Address                   V  Querier  QuerierIp                 Query Timer   Uptime
 ens224     up     fe80::250:56ff:feb7:a7e3  1  local    fe80::250:56ff:feb7:a7e3  00:01:22.263  00:08:00.237

Issue: #11241

Signed-off-by: Sarita Patra <saritap@vmware.com>
2 years agoMerge pull request #12900 from opensourcerouting/fix/memory_leak_aspath_dup_astype
Donald Sharp [Sat, 25 Feb 2023 00:17:20 +0000 (19:17 -0500)]
Merge pull request #12900 from opensourcerouting/fix/memory_leak_aspath_dup_astype

bgpd: Avoid double aspath_dup() for confederation when remote-as != AS_SPECIFIED

2 years agobgpd: Avoid double aspath_dup() for confederation when remote-as != AS_SPECIFIED 12900/head
Donatas Abraitis [Fri, 24 Feb 2023 20:01:15 +0000 (22:01 +0200)]
bgpd: Avoid double aspath_dup() for confederation when remote-as != AS_SPECIFIED

Just was blind when not seing it's already dup'ed above:

``` if (peer->sort == BGP_PEER_EBGP
    && (!CHECK_FLAG(peer->af_flags[afi][safi],
    PEER_FLAG_AS_PATH_UNCHANGED)
|| attr->aspath->segments == NULL)
    && (!CHECK_FLAG(peer->af_flags[afi][safi],
    PEER_FLAG_RSERVER_CLIENT))) {
aspath = aspath_dup(attr->aspath); <<<<<<<<<<<<<<<
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agopim6d: Display primary address in "show ipv6 mld interface json" cmd
Sarita Patra [Fri, 24 Feb 2023 15:11:57 +0000 (07:11 -0800)]
pim6d: Display primary address in "show ipv6 mld interface json" cmd

Signed-off-by: Sarita Patra <saritap@vmware.com>
2 years agopim6d: Don't display MLD disabled or down interfaces in "show ipv6 mld interface...
Sarita Patra [Fri, 24 Feb 2023 15:01:22 +0000 (07:01 -0800)]
pim6d: Don't display MLD disabled or down interfaces in "show ipv6 mld interface" cmd

We should not display down interfaces or MLD disabled interfaces in
"show ipv6 mld interface" command.

Before fix:
==========
frr# show ipv6 mld interface
Interface         State  V  Querier                    Timer               Uptime
ens192            up     2  fe80::250:56ff:feb7:d04    query 00:00:25.432  00:00:07.038
ens224            up     1  fe80::250:56ff:feb7:a7e3   query 00:00:24.219  00:00:07.031
pim6reg            down

After fix:
=========
frr# show ipv6 mld interface
Interface         State  V  Querier                    Timer               Uptime
ens192            up     2  fe80::250:56ff:feb7:d04    query 00:00:25.432  00:00:07.038
ens224            up     1  fe80::250:56ff:feb7:a7e3   query 00:00:24.219  00:00:07.031

Issue: #11241

Signed-off-by: Sarita Patra <saritap@vmware.com>
2 years agoMerge pull request #12888 from opensourcerouting/fix/peer_af_flag_check_integer
Donald Sharp [Fri, 24 Feb 2023 14:28:41 +0000 (09:28 -0500)]
Merge pull request #12888 from opensourcerouting/fix/peer_af_flag_check_integer

bgpd: Flags fixes

2 years agoMerge pull request #12841 from opensourcerouting/topofix_bgp_gr_retain_routes
Donald Sharp [Fri, 24 Feb 2023 14:24:28 +0000 (09:24 -0500)]
Merge pull request #12841 from opensourcerouting/topofix_bgp_gr_retain_routes

tests: Change bgp_gr_retained_routes to use json output of "ip route"

2 years agolib: some ASNUMs should be forbidden 12866/head
anlan_cs [Wed, 22 Feb 2023 12:57:07 +0000 (20:57 +0800)]
lib: some ASNUMs should be forbidden

In current code, some ASNUMs with redundant zero are legal,
e.g. "1.01", "01.1", "1.001", "001.1", and more.  They should
be forbidden.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2 years agoMerge pull request #12881 from donaldsharp/bgp_rpki_take_two
Martin Winter [Fri, 24 Feb 2023 13:09:59 +0000 (05:09 -0800)]
Merge pull request #12881 from donaldsharp/bgp_rpki_take_two

2 years agoMerge pull request #12889 from LabNConsulting/chopps/fix-nb-context-arg
Donald Sharp [Fri, 24 Feb 2023 12:37:09 +0000 (07:37 -0500)]
Merge pull request #12889 from LabNConsulting/chopps/fix-nb-context-arg

lib: fix init. use of nb_context to be by value not by reference

2 years agoMerge pull request #12751 from Pdoijode/pdoijode/ospf-vrf-neighbor-detail-1
Donatas Abraitis [Fri, 24 Feb 2023 09:56:28 +0000 (11:56 +0200)]
Merge pull request #12751 from Pdoijode/pdoijode/ospf-vrf-neighbor-detail-1

ospfd: Added missing fields and option to query specific neighbor in VRF

2 years agoMerge pull request #12885 from donaldsharp/bmp_afi_str
Donatas Abraitis [Fri, 24 Feb 2023 09:36:12 +0000 (11:36 +0200)]
Merge pull request #12885 from donaldsharp/bmp_afi_str

lib, bgpd: bmp was not specifying l2vpn afi

2 years agoMerge pull request #12884 from donaldsharp/flowspec_overflow
Christian Hopps [Fri, 24 Feb 2023 07:52:49 +0000 (02:52 -0500)]
Merge pull request #12884 from donaldsharp/flowspec_overflow

bgpd: Flowspec overflow issue

2 years agoMerge pull request #12887 from donaldsharp/remove_ospf_unused_function
Christian Hopps [Fri, 24 Feb 2023 07:49:45 +0000 (02:49 -0500)]
Merge pull request #12887 from donaldsharp/remove_ospf_unused_function

ospfd: Remove unused function

2 years agolib: fix init. use of nb_context to be by value not by reference 12889/head
Christian Hopps [Fri, 24 Feb 2023 01:23:51 +0000 (20:23 -0500)]
lib: fix init. use of nb_context to be by value not by reference

Pass context argument by value on initialization to be clear that the
value is used/saved but not a pointer to the value. Previously the
northbound code was incorrectly holding a pointer to stack allocated
context structs.

However, the structure definition also had some musings (ifdef'd out
code) and a comment that might be taken to imply that user data could
follow the structure and thus be maintained by the code; it won't; so it
can't; so get rid of the disabled misleading code/text from the
structure definition.

The common use case worked b/c the transaction which cached the pointer
was created and freed inside a single function
call (`nb_condidate_commit`) that executed below the stack allocation.

All other use cases (grpc, confd, sysrepo, and -- coming soon -- mgmtd)
were bugs.

Signed-off-by: Christian Hopps <chopps@labn.net>
2 years agotests: Check if peer->af_flags can be higher than uint32_t 12888/head
Donatas Abraitis [Thu, 23 Feb 2023 21:10:26 +0000 (23:10 +0200)]
tests: Check if peer->af_flags can be higher than uint32_t

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agobgpd: Renumber peer->af_flags to be without any gaps
Donatas Abraitis [Thu, 23 Feb 2023 21:51:10 +0000 (23:51 +0200)]
bgpd: Renumber peer->af_flags to be without any gaps

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoospfd: Remove unused function 12887/head
Donald Sharp [Thu, 23 Feb 2023 21:47:47 +0000 (16:47 -0500)]
ospfd: Remove unused function

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agobgpd: Convert missing uint32_t to uint64_t for for af_flags/flags
Donatas Abraitis [Thu, 23 Feb 2023 21:02:35 +0000 (23:02 +0200)]
bgpd: Convert missing uint32_t to uint64_t for for af_flags/flags

It was hard to catch those unless using higher values than uint32_t, but
already hit, it's time to fix completely.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agobgpd: Convert peer_af_flag_check() to bool
Donatas Abraitis [Thu, 23 Feb 2023 20:54:12 +0000 (22:54 +0200)]
bgpd: Convert peer_af_flag_check() to bool

Since we increased peer->af_flags from uint32_t to uint64_t,
peer_af_flag_check() was historically returning integer, and not bool
as should be.

The bug was that if we have af_flags higher than uint32_t it will never
returned a right value.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #12876 from opensourcerouting/fix/align_show_bgp_with_confederation
Donald Sharp [Thu, 23 Feb 2023 20:48:06 +0000 (15:48 -0500)]
Merge pull request #12876 from opensourcerouting/fix/align_show_bgp_with_confederation

bgpd: Align `show bgp ...` output with the header for wide option

2 years agolib, bgpd: bmp was not specifying l2vpn afi 12885/head
Donald Sharp [Thu, 23 Feb 2023 19:22:33 +0000 (14:22 -0500)]
lib, bgpd: bmp was not specifying l2vpn afi

The l2vpn afi was not being properly displayed
when a show run was being issued.  Add a
afi2str_lower function and use it.

Fixes: #12867
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agobgpd: Flowspec overflow issue 12884/head
Donald Sharp [Thu, 23 Feb 2023 18:29:32 +0000 (13:29 -0500)]
bgpd: Flowspec overflow issue

According to the flowspec RFC 8955 a flowspec nlri is <length, <nlri data>>
Specifying 0 as a length makes BGP get all warm on the inside.  Which
in this case is not a good thing at all.  Prevent warmth, stay cold
on the inside.

Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoMerge pull request #12879 from opensourcerouting/pim-ssm-no-rp
Donald Sharp [Thu, 23 Feb 2023 15:42:14 +0000 (10:42 -0500)]
Merge pull request #12879 from opensourcerouting/pim-ssm-no-rp

pimd: don't try to check RPF for incoming SSM data

2 years agobgpd: Another rpki fix 12881/head
Donald Sharp [Thu, 23 Feb 2023 15:02:59 +0000 (10:02 -0500)]
bgpd: Another rpki fix

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agopimd: don't try to check RPF for incoming SSM data 12879/head
David Lamparter [Fri, 6 May 2022 13:39:26 +0000 (15:39 +0200)]
pimd: don't try to check RPF for incoming SSM data

For incoming no-receiver SSM traffic, there isn't going to be a RP, much
less a RPF.  We should install an MFC entry with empty oif regardless,
so we don't get swamped with further notifications.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2 years agopimd: try to reinstall MFC when we get NOCACHE 12878/head
David Lamparter [Wed, 1 Jun 2022 07:54:31 +0000 (09:54 +0200)]
pimd: try to reinstall MFC when we get NOCACHE

Whether due to a pimd bug, some expiry, or someone just deleting MFC
entries, when we're in NOCACHE we *know* there's no MFC entry.  Add an
install call to make sure pimd's MFC view aligns with the actual kernel
MFC.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2 years agoMerge pull request #12869 from donaldsharp/cleanup_debug_log
Donatas Abraitis [Wed, 22 Feb 2023 20:30:04 +0000 (22:30 +0200)]
Merge pull request #12869 from donaldsharp/cleanup_debug_log

bgpd: Give better debug message when configuration is being read in

2 years agobgpd: Align `show bgp ...` output with the header for wide option 12876/head
Donatas Abraitis [Wed, 22 Feb 2023 20:22:28 +0000 (22:22 +0200)]
bgpd: Align `show bgp ...` output with the header for wide option

Before:

```
r1# sh ip bgp wide
BGP table version is 1, local router ID is 192.168.2.1, vrf id 0
Default local pref 100, local AS 65001
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
 *  172.16.255.254/32                            192.168.2.2                                    0             0 (65003) i
 *>                                              192.168.1.2                                    0             0 (65002) i

Displayed  1 routes and 2 total paths
r1#
```

After:

```
r1# sh ip bgp wide
BGP table version is 1, local router ID is 192.168.2.1, vrf id 0
Default local pref 100, local AS 65001
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
 *  172.16.255.254/32                            192.168.2.2                                    0             0 (65003) i
 *>                                              192.168.1.2                                    0             0 (65002) i

Displayed  1 routes and 2 total paths
r1#
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #12865 from mjstapp/fix_rfapi_timer_wcb
Donatas Abraitis [Wed, 22 Feb 2023 19:49:42 +0000 (21:49 +0200)]
Merge pull request #12865 from mjstapp/fix_rfapi_timer_wcb

bgpd: free rfapi callback object always

2 years agoMerge pull request #12868 from taspelund/evpn_prefix_guard_debug
Mark Stapp [Wed, 22 Feb 2023 19:01:23 +0000 (14:01 -0500)]
Merge pull request #12868 from taspelund/evpn_prefix_guard_debug

lib: add missing debug guards for route-map

2 years agoMerge pull request #12864 from donaldsharp/fix_warnings
Donatas Abraitis [Wed, 22 Feb 2023 17:17:54 +0000 (19:17 +0200)]
Merge pull request #12864 from donaldsharp/fix_warnings

bgpd: Fixup rpki and asn parsing

2 years agoMerge pull request #12861 from opensourcerouting/fix/bgp_confederation_with_astype
Donald Sharp [Wed, 22 Feb 2023 17:17:25 +0000 (12:17 -0500)]
Merge pull request #12861 from opensourcerouting/fix/bgp_confederation_with_astype

bgpd: Confederation fixes with remote-as external/internal

2 years agoMerge pull request #12863 from sri-mohan1/sri-mohan-ldp
Donald Sharp [Wed, 22 Feb 2023 17:14:23 +0000 (12:14 -0500)]
Merge pull request #12863 from sri-mohan1/sri-mohan-ldp

ldpd: changes for code maintainability

2 years agobgpd: Give better debug message when configuration is being read in 12869/head
Donald Sharp [Wed, 22 Feb 2023 16:38:00 +0000 (11:38 -0500)]
bgpd: Give better debug message when configuration is being read in

Sometimes bgp connections can be rejected for a variety of reasons.  Give
a bit more context about what is going wrong so that the operator can
make better decisions about their network.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agolib: add missing debug guards for route-map 12868/head
Trey Aspelund [Wed, 22 Feb 2023 16:30:24 +0000 (16:30 +0000)]
lib: add missing debug guards for route-map

Fixes missing debug guards for EVPN prefix conversion for optimized
route-map lookup.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2 years agobgpd: free rfapi callback object always 12865/head
Mark Stapp [Wed, 22 Feb 2023 13:58:28 +0000 (08:58 -0500)]
bgpd: free rfapi callback object always

An rfapi timer callback is responsible for the memory in a
context object, even in special-case exit paths. Always
free that object.

Signed-off-by: Mark Stapp <mjs@labn.net>
2 years agopimd: make logs useful for input drops
David Lamparter [Thu, 10 Mar 2022 12:59:26 +0000 (13:59 +0100)]
pimd: make logs useful for input drops

This path here is pretty far on top of the list of issues that operators
will run into and have to debug when setting up PIM.  Make the log
messages actually tell what's going on.  Also escalate some from
`debug mroute detail` to `debug mroute`.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2 years agobgpd: Fixup rpki and asn parsing 12864/head
Donald Sharp [Wed, 22 Feb 2023 13:56:55 +0000 (08:56 -0500)]
bgpd: Fixup rpki and asn parsing

Commit  6ccfd1030b42771cfb182e9e6ad53c5368d4b10e
did not properly handle asn parsing of the new
asn format.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoldpd: changes for code maintainability 12863/head
sri-mohan1 [Wed, 22 Feb 2023 09:38:50 +0000 (15:08 +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>
2 years agotests: Check if BGP confederation works with AS_EXTERNAL (!AS_SPECIFIED) 12861/head
Donatas Abraitis [Tue, 21 Feb 2023 21:37:04 +0000 (23:37 +0200)]
tests: Check if BGP confederation works with AS_EXTERNAL (!AS_SPECIFIED)

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agobgpd: Pass global ASN for confederation peers if not AS_SPECIFIED
Donatas Abraitis [Tue, 21 Feb 2023 21:10:45 +0000 (23:10 +0200)]
bgpd: Pass global ASN for confederation peers if not AS_SPECIFIED

When we specify remote-as as external/internal, we need to set local_as to
bgp->as, instead of bgp->confed_id. Before this patch, (bgp->as != *as) is
always valid for such a case because *as is always 0.

Also, append peer->local_as as CONFED_SEQ to avoid other side withdrawing
the routes due to confederation own AS received and/or malformed as-path.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #12839 from taspelund/evpn_prefix 12855/head
Donatas Abraitis [Tue, 21 Feb 2023 19:31:33 +0000 (21:31 +0200)]
Merge pull request #12839 from taspelund/evpn_prefix

lib: skip route-map optimization if !AF_INET(6)

2 years agoMerge pull request #12798 from donaldsharp/rib_match_multicast
Russ White [Tue, 21 Feb 2023 16:40:36 +0000 (11:40 -0500)]
Merge pull request #12798 from donaldsharp/rib_match_multicast

Rib match multicast

2 years agoMerge pull request #12818 from imzyxwvu/fix/other-table-inactive
Donald Sharp [Tue, 21 Feb 2023 16:37:31 +0000 (11:37 -0500)]
Merge pull request #12818 from imzyxwvu/fix/other-table-inactive

zebra: Fix other table inactive when ip import-table is on

2 years agolib: skip route-map optimization if !AF_INET(6) 12839/head
Trey Aspelund [Fri, 17 Feb 2023 21:47:09 +0000 (21:47 +0000)]
lib: skip route-map optimization if !AF_INET(6)

Currently we unconditionally send a prefix through the optimized
route-map codepath if the v4 and v6 LPM tables have been allocated and
optimization has not been disabled.
However prefixes from address-families that are not IPv4/IPv6 unicast
always fail the optimized route-map index lookup, because they occur on
an LPM tree that is IPv4 or IPv6 specific.
e.g.
Even if you have an empty permit route-map clause, Type-3 EVPN routes
are always denied:
```
--config
route-map soo-foo permit 10

--logs
2023/02/17 19:38:42 BGP: [KZK58-6T4Y6] No best match sequence for pfx: [3]:[0]:[32]:[2.2.2.2] in route-map: soo-foo, result: no match
2023/02/17 19:38:42 BGP: [H5AW4-JFYQC] Route-map: soo-foo, prefix: [3]:[0]:[32]:[2.2.2.2], result: deny
```

There is some existing code that creates an AF_INET/AF_INET6 prefix
using the IP/prefix information from a Type-2/5 EVPN route, which
allowed only these two route-types to successfully attempt an LPM lookup
in the route-map optimization trees via the converted prefix.

This commit does 3 things:
1) Reverts to non-optimized route-map lookup for prefixes that are not
   AF_INET or AF_INET6.
2) Cleans up the route-map code so that the AF check is part of the
   index lookup + the EVPN RT-2/5 -> AF_INET/6 prefix conversion occurs
   outside the index lookup.
3) Adds "debug route-map detail" logs to indicate when we attempt to
   convert an AF_EVPN prefix into an AF_INET/6 prefix + when we fallback
   to a non-optimized lookup.

Additional functionality for optimized lookups of prefixes from other
address-families can be added prior to the index lookup, similar to how
the existing EVPN conversion works today.

New behavior:
```
2023/02/17 21:44:27 BGP: [WYP1M-NE4SY] Converted EVPN prefix [5]:[0]:[32]:[192.0.2.7] into 192.0.2.7/32 for optimized route-map lookup
2023/02/17 21:44:27 BGP: [MT1SJ-WEJQ1] Best match route-map: soo-foo, sequence: 10 for pfx: 192.0.2.7/32, result: match
2023/02/17 21:44:27 BGP: [H5AW4-JFYQC] Route-map: soo-foo, prefix: 192.0.2.7/32, result: permit

2023/02/17 21:44:27 BGP: [WYP1M-NE4SY] Converted EVPN prefix [2]:[0]:[48]:[aa:bb:cc:00:22:22]:[32]:[20.0.0.2] into 20.0.0.2/32 for optimized route-map lookup
2023/02/17 21:44:27 BGP: [MT1SJ-WEJQ1] Best match route-map: soo-foo, sequence: 10 for pfx: 20.0.0.2/32, result: match
2023/02/17 21:44:27 BGP: [H5AW4-JFYQC] Route-map: soo-foo, prefix: 20.0.0.2/32, result: permit

2023/02/17 21:44:27 BGP: [KHG7H-RH4PN] Unable to convert EVPN prefix [3]:[0]:[32]:[2.2.2.2] into IPv4/IPv6 prefix. Falling back to non-optimized route-map lookup
2023/02/17 21:44:27 BGP: [MT1SJ-WEJQ1] Best match route-map: soo-foo, sequence: 10 for pfx: [3]:[0]:[32]:[2.2.2.2], result: match
2023/02/17 21:44:27 BGP: [H5AW4-JFYQC] Route-map: soo-foo, prefix: [3]:[0]:[32]:[2.2.2.2], result: permit
```

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2 years agoMerge pull request #12832 from opensourcerouting/fix/deprecate_bgp_internet_community
Russ White [Tue, 21 Feb 2023 16:35:26 +0000 (11:35 -0500)]
Merge pull request #12832 from opensourcerouting/fix/deprecate_bgp_internet_community

bgpd: Deprecate BGP `internet` community

2 years agolib: use MAX_BITLEN instead of magic number
Trey Aspelund [Fri, 17 Feb 2023 20:41:13 +0000 (20:41 +0000)]
lib: use MAX_BITLEN instead of magic number

Fixes up evpn_prefix2prefix() to use IPV(4|6)_MAX_BITLEN instead of
32/128 directly.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2 years agoMerge pull request #12805 from karlquan/kquan_self_orig
Russ White [Tue, 21 Feb 2023 13:38:07 +0000 (08:38 -0500)]
Merge pull request #12805 from karlquan/kquan_self_orig

bgpd: BGP troubleshooting - Add a keyword self-originate to display o…

2 years agoMerge pull request #12838 from opensourcerouting/feature/backport_timer_on_shutdown
Russ White [Tue, 21 Feb 2023 13:28:37 +0000 (08:28 -0500)]
Merge pull request #12838 from opensourcerouting/feature/backport_timer_on_shutdown

bgpd: Fix bgp no shutdown

2 years agoMerge pull request #12851 from sri-mohan1/sri-mohan-ldp
Russ White [Tue, 21 Feb 2023 13:28:28 +0000 (08:28 -0500)]
Merge pull request #12851 from sri-mohan1/sri-mohan-ldp

ldpd: changes for code maintainability

2 years agoMerge pull request #12854 from opensourcerouting/fix/bgp_withdraw_attr_not_used
Russ White [Tue, 21 Feb 2023 13:18:37 +0000 (08:18 -0500)]
Merge pull request #12854 from opensourcerouting/fix/bgp_withdraw_attr_not_used

bgpd: Drop struct attr from bgp_withdraw()

2 years agoMerge pull request #12795 from pguibert6WIND/vpnv6_nexthop_encoding
Russ White [Tue, 21 Feb 2023 13:15:43 +0000 (08:15 -0500)]
Merge pull request #12795 from pguibert6WIND/vpnv6_nexthop_encoding

Vpnv6 nexthop encoding

2 years agoMerge pull request #12366 from manojvn/ospfv2-flood-reduction
Russ White [Tue, 21 Feb 2023 13:03:06 +0000 (08:03 -0500)]
Merge pull request #12366 from manojvn/ospfv2-flood-reduction

ospfd: Support OSPF Refresh and Flooding Reduction RFC4136.

2 years agoMerge pull request #12248 from pguibert6WIND/bgpasdot
Russ White [Tue, 21 Feb 2023 13:01:03 +0000 (08:01 -0500)]
Merge pull request #12248 from pguibert6WIND/bgpasdot

lib, bgp: add initial support for asdot format

2 years agobgpd: Drop struct attr from bgp_withdraw() 12854/head
Donatas Abraitis [Tue, 21 Feb 2023 09:35:59 +0000 (11:35 +0200)]
bgpd: Drop struct attr from bgp_withdraw()

It's not used at all.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #12849 from opensourcerouting/fix/tests_enum
Donald Sharp [Tue, 21 Feb 2023 00:28:25 +0000 (19:28 -0500)]
Merge pull request #12849 from opensourcerouting/fix/tests_enum

tests: Cover all enum values for unit tests

2 years agoMerge pull request #12850 from LabNConsulting/chopps/ospfapi-fixes
Donald Sharp [Tue, 21 Feb 2023 00:27:56 +0000 (19:27 -0500)]
Merge pull request #12850 from LabNConsulting/chopps/ospfapi-fixes

ospfd client api bugfix and refinements

2 years agotests: improve the ospfapi test (move to square topology) 12850/head
Christian Hopps [Sun, 6 Feb 2022 14:41:12 +0000 (09:41 -0500)]
tests: improve the ospfapi test (move to square topology)

Signed-off-by: Christian Hopps <chopps@labn.net>
2 years agoospfclient: remove register "READY" requirement
Christian Hopps [Sun, 20 Feb 2022 08:59:41 +0000 (03:59 -0500)]
ospfclient: remove register "READY" requirement

- also add ability of the apibin to process commands on stdin

Signed-off-by: Christian Hopps <chopps@labn.net>
2 years agoospfclient: bugfix and no implicit register
Christian Hopps [Sun, 19 Feb 2023 23:55:58 +0000 (18:55 -0500)]
ospfclient: bugfix and no implicit register

- dont delete the callback on opaque data delete
- require explicit registration

Signed-off-by: Christian Hopps <chopps@labn.net>
2 years agoospfd: compare prefix values in host order
Christian Hopps [Sun, 6 Feb 2022 20:01:28 +0000 (15:01 -0500)]
ospfd: compare prefix values in host order

Signed-off-by: Christian Hopps <chopps@labn.net>
2 years agoospfd: small bugfix for miscounting A[S]BRs
Christian Hopps [Sun, 6 Feb 2022 14:40:24 +0000 (09:40 -0500)]
ospfd: small bugfix for miscounting A[S]BRs

- improve the debug for the second add router call.

Signed-off-by: Christian Hopps <chopps@labn.net>
2 years agoospfd: inc. opaque data in `show opaque info detail json` output
Christian Hopps [Sat, 18 Feb 2023 17:16:18 +0000 (12:16 -0500)]
ospfd: inc. opaque data in `show opaque info detail json` output

Signed-off-by: Christian Hopps <chopps@labn.net>
2 years agoldpd: changes for code maintainability 12851/head
sri-mohan1 [Mon, 20 Feb 2023 16:42:24 +0000 (22:12 +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>
2 years agotests: Cover all enum values for unit tests 12849/head
Donatas Abraitis [Mon, 20 Feb 2023 15:59:09 +0000 (17:59 +0200)]
tests: Cover all enum values for unit tests

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #12842 from opensourcerouting/fix/convert_flags_inverted_override_...
Donald Sharp [Mon, 20 Feb 2023 01:23:16 +0000 (20:23 -0500)]
Merge pull request #12842 from opensourcerouting/fix/convert_flags_inverted_override_to_uint64

bgpd: Convert flags_invert/flags_override to uint64_t

2 years agoMerge pull request #12830 from anlancs/fix/doc-ripd-rst
Donatas Abraitis [Sun, 19 Feb 2023 11:09:15 +0000 (13:09 +0200)]
Merge pull request #12830 from anlancs/fix/doc-ripd-rst

doc: cosmetic changes for ripd

2 years agobgpd: Convert flags_invert/flags_override to uint64_t 12842/head
Donatas Abraitis [Sat, 18 Feb 2023 07:58:37 +0000 (09:58 +0200)]
bgpd: Convert flags_invert/flags_override to uint64_t

peer->af_flags got this correctly.
peer->flags were already converted a time ago, but these were missed...

Let's fix this.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #12843 from donaldsharp/use_define
Donatas Abraitis [Sun, 19 Feb 2023 09:25:56 +0000 (11:25 +0200)]
Merge pull request #12843 from donaldsharp/use_define

bgpd: Use actual defines to set values

2 years agoMerge pull request #12845 from sri-mohan1/sri-mohan-ldp
Donatas Abraitis [Sun, 19 Feb 2023 09:25:12 +0000 (11:25 +0200)]
Merge pull request #12845 from sri-mohan1/sri-mohan-ldp

ldpd: changes for code maintainability

2 years agoldpd: changes for code maintainability 12845/head
sri-mohan1 [Sun, 19 Feb 2023 05:27:25 +0000 (10:57 +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>
2 years agobgpd: Use actual defines to set values 12843/head
Donald Sharp [Sat, 18 Feb 2023 12:24:12 +0000 (07:24 -0500)]
bgpd: Use actual defines to set values

Instead of hard coding so that if something ever changes
it will break.  Let's use the #defines that FRR has
included for us.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agotests: Change bgp_gr_retained_routes to use json output of "ip route" 12841/head
Martin Winter [Sat, 18 Feb 2023 01:16:26 +0000 (02:16 +0100)]
tests: Change bgp_gr_retained_routes to use json output of "ip route"

Depending on ip_route and kernel, the output might include a nhid
which causes the test to fail with a strict text output check.
Change to json output to avoid the issue

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2 years agobgpd: Fix bgp no shutdown 12838/head
Rafael Zalamena [Fri, 23 Sep 2022 13:14:02 +0000 (10:14 -0300)]
bgpd: Fix bgp no shutdown

When leaving the BGP shutdown state we must restart the peer timers
otherwise nothing will happen.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #12791 from taspelund/loc_rib_json_fix
Donatas Abraitis [Fri, 17 Feb 2023 18:24:33 +0000 (20:24 +0200)]
Merge pull request #12791 from taspelund/loc_rib_json_fix

bgpd: fix 'json detail' output structure

2 years agobgpd: Deprecate BGP `internet` community 12832/head
Donatas Abraitis [Fri, 17 Feb 2023 16:28:17 +0000 (18:28 +0200)]
bgpd: Deprecate BGP `internet` community

Quite a few well-known communities from IANA's list do
   not receive special treatment in Cisco IOS XR, and at least one
   community on Cisco IOS XR's special treatment list, internet == 0:0,
   is not formally a well-known community as it is not in [IANA-WKC] (it
   is taken from the Reserved range [0x00000000-0x0000FFFF]).

https://datatracker.ietf.org/doc/html/rfc8642

This is Cisco-specific command which is causing lots of questions when it
comes to debugging and/or configuring it properly, but overall, this behavior
is very odd and it's not clear how it should be treated between different
vendor implementations.

Let's deprecate it and let the operators use 0:0/0 communities as they want.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #12780 from opensourcerouting/spdx-license-id
Donald Sharp [Fri, 17 Feb 2023 14:43:05 +0000 (09:43 -0500)]
Merge pull request #12780 from opensourcerouting/spdx-license-id

*: convert to SPDX License identifiers

2 years agodoc: cosmetic changes for ripngd 12830/head
anlan_cs [Fri, 17 Feb 2023 10:10:09 +0000 (18:10 +0800)]
doc: cosmetic changes for ripngd

Correct `ripngd` doc based on code, and remove one non-existed command.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2 years agodoc: cosmetic changes for ripd
anlan_cs [Fri, 17 Feb 2023 09:10:00 +0000 (17:10 +0800)]
doc: cosmetic changes for ripd

Correct `ripd` doc based on code.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2 years agoMerge pull request #12727 from opensourcerouting/feature/bgp_software_version_capability
Donald Sharp [Fri, 17 Feb 2023 13:18:22 +0000 (08:18 -0500)]
Merge pull request #12727 from opensourcerouting/feature/bgp_software_version_capability

bgpd: Software Version Capability

2 years agoMerge pull request #12824 from donaldsharp/coverity_evpn
Donatas Abraitis [Thu, 16 Feb 2023 21:05:09 +0000 (23:05 +0200)]
Merge pull request #12824 from donaldsharp/coverity_evpn

Coverity evpn

2 years agoMerge pull request #12734 from donaldsharp/fixup_helper
Donatas Abraitis [Thu, 16 Feb 2023 20:06:47 +0000 (22:06 +0200)]
Merge pull request #12734 from donaldsharp/fixup_helper

lib: Fix non-use of option

2 years agoMerge pull request #12817 from donaldsharp/fix_determine_med
Donatas Abraitis [Thu, 16 Feb 2023 19:45:44 +0000 (21:45 +0200)]
Merge pull request #12817 from donaldsharp/fix_determine_med

some missed upstream commits

2 years agotests: update tests using 'show bgp json detail' 12791/head
Trey Aspelund [Mon, 13 Feb 2023 22:14:16 +0000 (22:14 +0000)]
tests: update tests using 'show bgp json detail'

There were a few tests using "show bgp ... json detail" that did json
comparisons against a predefined json structure. This updates those
predefined json structures to match the new format of the output.
(new output moves path array under "paths" key and adds header keys)

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2 years agobgpd: fix 'json detail' output structure
Trey Aspelund [Fri, 10 Feb 2023 19:05:27 +0000 (19:05 +0000)]
bgpd: fix 'json detail' output structure

"show bgp <afi> <safi> json detail" was incorrectly displaying header
information from route_vty_out_detail_header() as an element of the
"paths" array. This corrects the behavior for 'json detail' so that a
route holds a dictionary with keys for "paths" and header info, which
aligns with how we structure the output for a specific prefix, e.g.
"show bgp <afi> <safi> <prefix> json".

Before:
```
ub20# show ip bgp json detail
{
 "vrfId": 0,
 "vrfName": "default",
 "tableVersion": 3,
 "routerId": "100.64.0.222",
 "defaultLocPrf": 100,
 "localAS": 1,
 "routes": { "2.2.2.2/32": [
  {                           <<<<<<<<<  should be outside the array
    "prefix":"2.2.2.2/32",
    "version":1,
    "advertisedTo":{
      "192.168.122.12":{
        "hostname":"ub20-2"
      }
    }
  },
  {
    "aspath":{
      "string":"Local",
      "segments":[
      ],
      "length":0
    },
<snip>
```

After:
```
ub20# show ip bgp json detail
{
 "vrfId": 0,
 "vrfName": "default",
 "tableVersion": 3,
 "routerId": "100.64.0.222",
 "defaultLocPrf": 100,
 "localAS": 1,
 "routes": { "2.2.2.2/32": {
"prefix": "2.2.2.2/32",
"version": "1",
"advertisedTo": {
  "192.168.122.12":{
    "hostname":"ub20-2"
  }
}
,"paths": [
  {
    "aspath":{
      "string":"Local",
      "segments":[
      ],
      "length":0
    },
```

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2 years agopimd: Remove impossible situation 12824/head
Donald Sharp [Thu, 16 Feb 2023 14:17:20 +0000 (09:17 -0500)]
pimd: Remove impossible situation

Coverity complains that MLAG_MSG_NONE cannot be reached in
the switch statement.  Which is true so let's make it happy.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agozebra: Ensure bvlan is non null
Donald Sharp [Thu, 16 Feb 2023 14:06:59 +0000 (09:06 -0500)]
zebra: Ensure bvlan is non null

Coverity rightly points out that a call into zebra_l2_bridge_if_vlan_find
is NULL checked 4/5 times.  Let's make it 5/5

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agolib: Fix non-use of option 12734/head
Donald Sharp [Thu, 2 Feb 2023 21:28:27 +0000 (16:28 -0500)]
lib: Fix non-use of option

Commit d7c6467ba2f55d1055babbb7fe82716ca3efdc7e added the
ability to specify non pretty printing but unfortunately
forgot to use the option variable to make the whole
thing work.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agodoc: Add `show ipv6 rpf X:X::X:X` command to docs 12798/head
Donald Sharp [Mon, 13 Feb 2023 17:29:17 +0000 (12:29 -0500)]
doc: Add `show ipv6 rpf X:X::X:X` command to docs

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agozebra: Remove code duplication for v4 and v6 versions of rib_match_multicast
Donald Sharp [Mon, 13 Feb 2023 17:13:42 +0000 (12:13 -0500)]
zebra: Remove code duplication for v4 and v6 versions of rib_match_multicast

a) Consolidate v4 and v6 versions of rib_match_multicast
b) Improve debug to show what we matched against as well.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>