Commit Graph

33688 Commits

Author SHA1 Message Date
Donald Sharp
73a4891ab3 Revert "bgpd: fix illegal memory access in bgp_ls_tlv_check_size()"
This reverts commit dae5791c44.
2023-10-10 16:31:01 -04:00
Rodrigo Nardi
e0dbeff5bc
ospfd: Fixing infinite loop when listing OSPF interfaces
The problem was happening because the ospf->oiflist has this behaviour, each interface was removed and added at the end of the list in each ospf_network_run_subnet call, generation an infinite loop.
As a solution, a copy of the list was generated and we interacted with a fixed list.

Signed-off-by: Rodrigo Nardi <rnardi@netdef.org>
2023-10-10 15:39:59 -03:00
Donald Sharp
2263d11630 Revert "bgpd: fix link_state_hash_cmp()"
This reverts commit 25408c8dbf.
2023-10-10 13:31:19 -04:00
Donald Sharp
298d534013 Revert "bgpd: fix insecure data write with ip addresses"
This reverts commit 54222f9213.
2023-10-10 13:31:13 -04:00
Donald Sharp
c0d3acb0a0 Revert "bgpd: fix insecure data write with area addresses"
This reverts commit 57d0dc565f.
2023-10-10 13:31:06 -04:00
Donald Sharp
28dab73877 Revert "bgpd: fix printing link state ospf opaque data"
This reverts commit e1333d12e0.
2023-10-10 13:30:57 -04:00
Volodymyr Huti
8ddf6a713f eigrp: use correct memory pool on interface deletion
Trying to delete an interface during the test test_eigrp_topo1.py triggers a crash.
```
EIGRP: abort+0x12b
EIGRP: _zlog_assert_failed+0x18c
EIGRP: mt_count_free+0x56
EIGRP: qfree+0x2e
EIGRP: eigrp_if_delete_hook+0x8c
EIGRP: hook_call_if_del+0x5f
EIGRP: if_delete_retain+0x1c
EIGRP: if_delete+0xfb
EIGRP: if_destroy_via_zapi+0x69
EIGRP: zclient_interface_delete+0x57
EIGRP: zclient_read+0x3d0
EIGRP: event_call+0xd8
EIGRP: frr_run+0x271
EIGRP: main+0x14b
EIGRP: __libc_start_main+0xf3
EIGRP: _start+0x2e
EIGRP: in thread zclient_read scheduled from lib/zclient.c:4514 zclient_event()
```

Signed-off-by: Volodymyr Huti <v.huti@vyos.io>
2023-10-10 20:01:17 +03:00
Donatas Abraitis
d2324b7b4a build: FRR 9.2 development version
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-10-10 19:43:56 +03:00
mobash-rasool
9b6f41bfbe
Merge pull request #13617 from anlancs/fix/pimd-remove-pimreg-vrf
pimd: Fix missing pimreg interface
2023-10-10 22:10:24 +05:30
Russ White
03d1b44c9b
Merge pull request #14535 from opensourcerouting/fix/bgp_aggregate_stuff
bgpd: Drop redundant assignment for aspath segment type and length
2023-10-10 11:36:34 -04:00
Chirag Shah
0ddda5cd96
Merge pull request #14515 from mjstapp/fix_nhg_intf_uninstall
zebra: be more careful removing 'installed' flag from nhgs
2023-10-10 08:30:55 -07:00
Russ White
cc63e16a52
Merge pull request #14548 from raja-rajasekar/frr_dev1
zebra: Prevent leaking ctx memory in err condition
2023-10-10 11:05:11 -04:00
Donald Sharp
078bef324c
Merge pull request #14550 from Keelan10/fix-nexthop_group-leak
zebra: Free nexthop_group
2023-10-10 10:11:48 -04:00
Donald Sharp
b2e0c12d72 bgpd: Convert the bgp_advertise_attr->adv to a fifo
BGP is storing outgoing updates in a couple of different
fifo's.  This is to ensure proper packet packing of
all bgp_dests that happen to use the same attribute.

How it's all put together currently:  On initial update
BGP walks through all the bgp_dest's in a table.  For each
path being sent a bgp_advertise is created.  This bgp_advertise
is placed in fifo order on the bgp_synchronize->update queue.
The bgp_advertise has a pointer to the bgp_advertise_attr which
is associated iwth the actual attribute that is being sent to
it's peer.  In turn this bgp_advertise is placed in a fifo off
of the bgp_advertise_attr structure.  As such as we have paths
that share an attribute, the path/dest is placed on the
bgp_syncrhonize->update fifo as well as being placed on the fifo
associated with the advertised attribute.

On actual creation of a packet.  The first item in the
bgp_synchronize->update fifo is popped.  The bgp_advertise_attr
pointer is grabbed, we fill out the nlri part of the bgp packet
and then walk the bgp_advertise_attr fifo to place paths/dests in
the packet.  As each path/dest is placed in the packet it is removed
from both the bgp_synchronize->update fifo and the bgp_advertise_attr
fifo.

The whole point of this change is to switch the *next, *prev
pointers in the bgp_advertise structure with a typesafe data
structure.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-10-10 10:09:10 -04:00
Keelan10
92598cb2b9 zebra: Free nexthop_group
`ng` was not properly freed, leading to a memory leak.
The commit calls `nexthop_group_delete` to free memory associated with `ng`.

The ASan leak log for reference:

```
***********************************************************************************
Address Sanitizer Error detected in isis_topo1.test_isis_topo1/r5.asan.zebra.24308

=================================================================
==24308==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x7f4f47b43d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f4f4753c0a8 in qcalloc lib/memory.c:105
    #2 0x7f4f47559526 in nexthop_group_new lib/nexthop_group.c:270
    #3 0x562ded6a39d4 in zebra_add_import_table_entry zebra/redistribute.c:681
    #4 0x562ded787c35 in rib_link zebra/zebra_rib.c:3972
    #5 0x562ded787c35 in rib_addnode zebra/zebra_rib.c:3993
    #6 0x562ded787c35 in process_subq_early_route_add zebra/zebra_rib.c:2860
    #7 0x562ded787c35 in process_subq_early_route zebra/zebra_rib.c:3138
    #8 0x562ded787c35 in process_subq zebra/zebra_rib.c:3178
    #9 0x562ded787c35 in meta_queue_process zebra/zebra_rib.c:3228
    #10 0x7f4f475f7118 in work_queue_run lib/workqueue.c:266
    #11 0x7f4f475dc7f2 in event_call lib/event.c:1969
    #12 0x7f4f4751f347 in frr_run lib/libfrr.c:1213
    #13 0x562ded69e818 in main zebra/main.c:486
    #14 0x7f4f468ffc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 152 byte(s) in 1 object(s) allocated from:
    #0 0x7f4f47b43d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f4f4753c0a8 in qcalloc lib/memory.c:105
    #2 0x7f4f475510ad in nexthop_new lib/nexthop.c:376
    #3 0x7f4f475539c5 in nexthop_dup lib/nexthop.c:914
    #4 0x7f4f4755b27a in copy_nexthops lib/nexthop_group.c:444
    #5 0x562ded6a3a1c in zebra_add_import_table_entry zebra/redistribute.c:682
    #6 0x562ded787c35 in rib_link zebra/zebra_rib.c:3972
    #7 0x562ded787c35 in rib_addnode zebra/zebra_rib.c:3993
    #8 0x562ded787c35 in process_subq_early_route_add zebra/zebra_rib.c:2860
    #9 0x562ded787c35 in process_subq_early_route zebra/zebra_rib.c:3138
    #10 0x562ded787c35 in process_subq zebra/zebra_rib.c:3178
    #11 0x562ded787c35 in meta_queue_process zebra/zebra_rib.c:3228
    #12 0x7f4f475f7118 in work_queue_run lib/workqueue.c:266
    #13 0x7f4f475dc7f2 in event_call lib/event.c:1969
    #14 0x7f4f4751f347 in frr_run lib/libfrr.c:1213
    #15 0x562ded69e818 in main zebra/main.c:486
    #16 0x7f4f468ffc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

SUMMARY: AddressSanitizer: 184 byte(s) leaked in 2 allocation(s).
***********************************************************************************
```

Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
2023-10-10 13:13:09 +04:00
Donatas Abraitis
69a0d59990
Merge pull request #14451 from m-varasteh/ospf-coverity-issues
ospfd: a possible fix for TAINTED_SCALAR coverity issues
2023-10-10 09:01:03 +03:00
Adriano Marto Reis
108adcddbb tests: Ajusting the test to the new OSPF6 behaviour
Now OSPF6 shares the /128 prefix by default. Adjusting the expected
number of next hops according to that.

Signed-off-by: Adriano Marto Reis <adrianomarto@gmail.com>
2023-10-10 12:09:07 +10:00
Adriano Marto Reis
a5677ca1e0 tests: OSPF6 point-to-multipoint topotest
* Check if FRR is running
* Check if OSPFv3 converges
* Check OSPFv3 Routing Tables
* Check Linux Kernel Routing Table

Signed-off-by: Adriano Marto Reis <adrianomarto@gmail.com>
2023-10-10 08:10:49 +10:00
Adriano Marto Reis
25dc0c1290 ospf6d: Including checksum in OSPF6 Hello messages
Including checksum in OSPF6 Hello messages.

Signed-off-by: Adriano Marto Reis <adrianomarto@gmail.com>
2023-10-10 08:10:37 +10:00
David Lamparter
22efdbdd0f doc: update user docs for OSPFv3 PtMP changes
Update & add docs for all the stuff in the previous 10-ish commits.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-10-10 08:10:10 +10:00
David Lamparter
dfe3af42d2 ospf6d: connected prefix toggle for PtP/PtMP
To announce connected prefixes, or not to announce connected prefixes,
that is the question...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-10-10 08:09:42 +10:00
David Lamparter
5c0eed0c85 ospf6d: add point-to-multipoint interface mode
This adds the PtMP interface type, which is effectively identical to PtP
except that all the database flooding & updates are unicast.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-10-10 08:08:20 +10:00
David Lamparter
0c58d83688 ospf6d: support unicast hellos on PtP/PtMP
Some lower layers still don't handle multicast correctly (or
efficiently.)  Add option to send unicast hellos on explicitly
configured neighbors for PtP/PtMP.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-10-10 08:07:52 +10:00
David Lamparter
3d1482a945 ospf6d: option to disable multicast hellos
With the configured neighbor list, unicast hellos can be sent.  Allow
disabling multicast hellos for that scenario.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-10-10 08:00:08 +10:00
David Lamparter
f5917bae53 ospf6d: option to restrict PtP neighbor list
This adds a knob to refuse forming adjacencies with neighbors not listed
in the config.  Only works on PtP/PtMP of course, otherwise the DR/BDR
machinery gets broken.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-10-10 07:58:21 +10:00
David Lamparter
65e955890c ospf6d: allow configuring PtP neighbors & cost
Add a list of configured neighbors for each interface.  Only stores cost
(and "existence") for now.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-10-10 07:57:43 +10:00
David Lamparter
73940e52f2 ospf6d: factor out link-local addr change
For PtMP the cost may need to be recalculated when the LL addr changes
(since neighbors are configured by LL addr and a different entry with a
different cost may match.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-10-10 07:54:56 +10:00
David Lamparter
6fdd69ed07 ospf6d: advertise local addresses with LA bit
Both for virtual links and correct PtMP operation, advertising local
addresses as Intra-Prefix with LA set is a prerequisite.  Add the
appropriate entries.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-10-10 07:54:39 +10:00
David Lamparter
829f3a0bd5 lib: remove unused connected_add prototype
This function is not implemented anywhere.  Not sure it ever existed.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-10-10 07:54:15 +10:00
Donald Sharp
556fdaa69d
Merge pull request #14533 from mjstapp/fix_rule_notify_vrf
lib,*: add vrf id to pbr rule results zapi message
2023-10-09 14:07:12 -04:00
Rajasekar Raja
11b987ed2f zebra: Prevent leaking ctx memory in err condition
When netlink_link_change() errors out for a new link for
interface without MTU set, the allocated ctx is not freed..
Adding code for correctness

Ticket# 3628313

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2023-10-09 17:09:57 +00:00
Donald Sharp
b966802362
Merge pull request #14543 from mjstapp/fix_pbr_rule_unique
zebra: add zclient to iprules key
2023-10-09 10:36:00 -04:00
Rafael Zalamena
4a60045688
Merge pull request #10733 from anlancs/zebra-remove-update
zebra: remove ZEBRA_INTERFACE_VRF_UPDATE
2023-10-08 10:52:54 -03:00
Rafael Zalamena
5c0a5aa616
Merge pull request #14541 from idryzhov/isis-fix-cb-destroy
isisd: remove redundant northbound destroy callbacks
2023-10-08 10:49:03 -03:00
anlan_cs
56f141e64b doc: replace commands list with header file
Signed-off-by: anlan_cs <anlan_cs@tom.com>
2023-10-07 10:06:59 +08:00
anlan_cs
b580c52698 *: remove ZEBRA_INTERFACE_VRF_UPDATE
Currently when one interface changes its VRF, zebra will send these messages to
all daemons in *order*:
    1) `ZEBRA_INTERFACE_DELETE` ( notify them delete from old VRF )
    2) `ZEBRA_INTERFACE_VRF_UPDATE` ( notify them move from old to new VRF )
    3) `ZEBRA_INTERFACE_ADD` ( notify them added into new VRF )

When daemons deal with `VRF_UPDATE`, they use
`zebra_interface_vrf_update_read()->if_lookup_by_name()`
to check the interface exist or not in old VRF. This check will always return
*NULL* because `DELETE` ( deleted from old VRF ) is already done, so can't
find this interface in old VRF.

Send `VRF_UPDATE` is redundant and unuseful. `DELETE` and `ADD` are enough,
they will deal with RB tree, so don't send this `VRF_UPDATE` message when
vrf changes.

Since all daemons have good mechanism to deal with changing vrf, and don't
use this `VRF_UPDATE` mechanism.  So, it is safe to completely remove
all the code with `VRF_UPDATE`.

Signed-off-by: anlan_cs <anlan_cs@tom.com>
2023-10-07 10:06:39 +08:00
Donatas Abraitis
5e81120961 bgpd: Implement EBGP-OAD peering type
At each EBGP boundary, BGP path attributes are modified as per [RFC4271], which includes stripping any IBGP-only attributes.

Some networks span more than one autonomous system and require more flexibility in the propagation of path attributes. It is worth noting that these multi-AS networks have a common or single administrative entity. These networks are said to belong to One Administrative Domain (OAD). It is desirable to carry IBGP-only attributes across EBGP peerings when the peers belong to an OAD.

This document defines a new EBGP peering type known as EBGP-OAD, which is used between two EBGP peers that belong to an OAD. This document also defines rules for route announcement and processing for EBGP-OAD peers.

https://datatracker.ietf.org/doc/html/draft-uttaro-idr-bgp-oad

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-10-06 21:53:43 +03:00
Donatas Abraitis
ba67eb6bd0 tests: Check if EBGP-OAD works
https://datatracker.ietf.org/doc/html/draft-uttaro-idr-bgp-oad

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-10-06 21:53:43 +03:00
Donatas Abraitis
1dd0e45eb3 doc: Add neighbor oad command
https://datatracker.ietf.org/doc/html/draft-uttaro-idr-bgp-oad

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-10-06 21:53:36 +03:00
Mark Stapp
a09cb688a0 zebra: add zclient to iprules key
Include a zclient value in the hash and tree key computations
for iprules in zebra: clients may collide without this.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-10-06 12:26:38 -04:00
Igor Ryzhov
6d8963f3e6 isisd: remove redundant northbound destroy callbacks
Fixes startup warnings:
```
ISIS: [ZKB8W-3S2Q4][EC 100663330] unneeded 'destroy' callback for '/frr-isisd:isis/instance/segment-routing-srv6/msd/node-msd/max-segs-left'
ISIS: [ZKB8W-3S2Q4][EC 100663330] unneeded 'destroy' callback for '/frr-isisd:isis/instance/segment-routing-srv6/msd/node-msd/max-end-pop'
ISIS: [ZKB8W-3S2Q4][EC 100663330] unneeded 'destroy' callback for '/frr-isisd:isis/instance/segment-routing-srv6/msd/node-msd/max-h-encaps'
ISIS: [ZKB8W-3S2Q4][EC 100663330] unneeded 'destroy' callback for '/frr-isisd:isis/instance/segment-routing-srv6/msd/node-msd/max-end-d'
```

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-10-06 17:37:41 +03:00
Mark Stapp
4fabe90c7f lib,*: add vrf id to pbr rule results zapi message
The iprule/pbr rule object has a vrf id, and zebra uses
that internally, but the vrf id isn't returned to clients
who install rules and are waiting for results. Include the
vrf_id sent by the client in the zapi result notification
message; update the existing clients so they decode the id.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-10-05 16:22:40 -04:00
Donatas Abraitis
fc9a8da45e bgpd: Drop redundant assignment for aspath segment type and length
They are already initialized via assegment_new().

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-10-05 22:46:54 +03:00
Donald Sharp
c516447847
Merge pull request #14534 from mjstapp/fix_topo_nhgid
tests: locate nhg id from json output in all_proto_startup
2023-10-05 15:36:27 -04:00
Mark Stapp
22fb94a248 tests: locate nhg id from json output in all_proto_startup
Don't hard-code a sharpd nhg id: those values aren't stable
if the daemons/protos/route-types change. Use json show output
to find the id in the 'resilient' nhg test case in
the all_protocol_startup suite.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-10-05 13:47:17 -04:00
Donald Sharp
580bc71aca
Merge pull request #14517 from adrianomarto/pim-msdp-sa-rp
pimd: Indicating the configured PIM Rendezvous Point (RP) in the MSDP SA message
2023-10-05 10:27:06 -04:00
Rafael Zalamena
0fb9f9145f
Merge pull request #14474 from donaldsharp/strsep_fixup
staticd: Memory leak of string in staticd
2023-10-05 09:25:45 -03:00
Donald Sharp
7d86229ca6 staticd: Memory leak of string in staticd
XSTRDUP and then calling strsep mangles the
pointer returned by XSTRDUP.  Keep a copy
of the orig and when we are done, free that instead.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-10-04 14:11:49 -04:00
Donald Sharp
a079aae947
Merge pull request #14527 from opensourcerouting/fix/guard_debug_messages_for_ttl
bgpd: Add guards for zlog_debug when setting GTSM for the peer
2023-10-04 07:33:12 -04:00
Adriano Marto Reis
95e31a6081 pimd: Indicating the rp in the msdp sa message
Indicating the configured PIM Rendezvous Point (RP) in the MSDP SA
message

The RFC-3618, section 12.2.1, describes the fields included in the MSDP
SA message. The "RP address" field is "the address of the RP in the
domain the source has become active in".

In the most common case, we will establish an MSDP connection from RP to
RP. However, there are cases where we want to establish a MSDP
connection from an interface/address that is not the RP. Section 3 of
RFC-3618 describes that scenario as "intermediate MSDP peer". Moreover,
the RP could be another router in the PIM domain - not the one
establishing the MSDP connection.

The current implementation could be problematic even with a single
router per PIM domain. Consider the following scenario:
* There are two PIM domains, each one with a single router.
* The two routers are connected via two independent networks. Let's say
that is to provide redundancy.
* The routers are configured to establish two MSDP connections, one on
each network (redundancy again).
* A multicast source becomes active on the router 1. It will be
communicated to router 2 via two independent MSDP SA messages, one per
MSDP connection.
* Without these changes, each MSDP SA message will indicate a different
RP.
* Both RP addresses will pass the RPF check, and both MSDP sources will
be accepted.
* If the router has clients interested in that multicast group, it will
send PIM Join messages to both RPs and start receiving the multicast
traffic from both.

With the changes included in this commit, the multicast source available
in router 1 would still be communicated to router 2 twice. But both MSDP
SA messages would indicate the same RP, and one of them would be
discarded due to failure in the RPF-check failure. Also, the changes
allow us to define the RP that will be included in the MSDP SA message,
and it could be one of the interfaces used to establish the MSDP
connection, some other interface on the router, a loopback interface, or
another router in the PIM domain.

These changes should not create compatibility issues. As I mentioned, we
usually establish MSDP connections from RP to RP. In this case, the
result will be the same. We would still indicate the address used to
establish the MSDP connection if the RP is not set - I wonder if that
should even be a valid configuration.

Signed-off-by: Adriano Marto Reis <adrianomarto@gmail.com>
2023-10-04 14:30:44 +10:00