Commit Graph

34980 Commits

Author SHA1 Message Date
Olivier Dugeon
6fcc86d37a ospfd: Decode Extended Link & Prefix TLVs for json
When dumping ospf database with json output, decode Extended Link and Extended
Prefix TLVs and sub-TLVs.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2024-02-12 17:52:00 +01:00
Olivier Dugeon
b27d9e4d3b ospfd: Decode Router Info. TLVs for json output
When dumping ospf database with json output, decode Router Information TLVs
and sub-TLVs.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2024-02-12 17:52:00 +01:00
Olivier Dugeon
95c9cb9aa9 ospfd: Decode TE TLVs for json output
When dumping ospf database with json output, decode Traffic Engineering TLVs
and sub-TLVs.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2024-02-12 17:52:00 +01:00
Olivier Dugeon
aa2b539bf5 ospfd: Prepare Opaque LSA for json output
Instead of output bulk of data with json output, prepare json context to decode
opaque TLVs and sub-TLVs.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2024-02-12 17:52:00 +01:00
Christian Hopps
40e51d2257 mgmtd: remove unused commit phase SEND_CFG
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-02-12 07:57:28 -05:00
Christian Hopps
8d6e7a350f tests: fix grpc test
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-02-12 07:48:50 -05:00
Christian Hopps
6374970cb8 doc: docker: update with new more strict protobuf requirements
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-02-12 06:48:12 -05:00
Christian Hopps
d71710a910
Merge pull request #15355 from idryzhov/fix-mgmtd-notif
Fix and rework YANG notifications
2024-02-12 06:17:38 -05:00
Donald Sharp
9800590ccc
Merge pull request #15346 from opensourcerouting/fix/memory_optimizations
Some more memory optimizations
2024-02-11 21:33:44 -05:00
Donald Sharp
6d3f9bf605
Merge pull request #15356 from idryzhov/configure-sysconfdir
build: fix configure output
2024-02-11 21:33:00 -05:00
Donatas Abraitis
400fe8db63
Merge pull request #15347 from askorichenko/test-bgp-ttl
bgpd: fix minttl copying during peer reset
2024-02-11 22:12:32 +02:00
Igor Ryzhov
e9d41d1441 build: fix configure output
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-11 13:34:59 +02:00
Igor Ryzhov
3ac3a6605d lib, mgmtd: rework processing of yang notifications
Currently, YANG notification processing is done using a special type of
callbacks registered in backend clients. In this commit, we start using
regular northbound infrastructure instead, because it already has a
convenient way of registering xpath-specific callbacks without the need
for creating additional structures for each necessary notification. We
also now pass a notification data to the callback, instead of a plain
JSON. This allows to use regular YANG library functions for inspecting
notification fields, instead of manually parsing the JSON.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-11 13:26:52 +02:00
Donald Sharp
8aeb63634d
Merge pull request #15354 from cscarpitta/fix/fpm-pb-add-missing-include
qpb: Add missing `#include nexthop.h`
2024-02-10 20:52:47 -05:00
Carmine Scarpitta
6d1c04f4d0 qpb: Add missing #include nexthop.h
In `qpb.h` we have a bunch of functions that make use of
`union g_addr`. `union g_addr` is defined in `nexthop.h`, which
actually is NOT included in `qpb.h`.

Let's add the missing `#include nexthop.h`.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-02-10 00:44:50 +01:00
Igor Ryzhov
7d8064c6d4
Merge pull request #15353 from vjardin/yang_converted
mgmtd: ripng, libs fully converted
2024-02-10 01:27:23 +02:00
Igor Ryzhov
d94f80fbc4 lib, mgmtd: fix processing of yang notifications
Current code assumes that notification is always sent in stripped JSON
format and therefore notification xpath starts at the third symbol of
notification data. Assuming JSON is more or less fine, because this
representation is internal to FRR, but the assumption about the xpath is
wrong, because it won't work for not top-level notifications. YANG
allows to define notification as a child for some data node deep into
the tree and in this case notification data contains not only the
notification node itself, but also all its parents.

To fix the issue, parse the notification data and get its xpath from its
schema node.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-10 01:00:24 +02:00
Vincent JARDIN
14fc0782d4 mgmtd: ripng, libs fully converted
While checking the code, we can notice that they are already converted.

Suggested-by: Igor Ryzhov <iryzhov@nfware.com>
Signed-off-by: Vincent Jardin <vjardin@free.fr>
2024-02-09 19:23:01 +01:00
Louis Scalbert
59a544c39b bgpd: fix route recursion on leaked routes
Leaked recursive routes are not resolved.

> VRF r1-cust1:
> B>  5.1.0.0/24 [200/98] via 99.0.0.1 (recursive), weight 1, 00:00:08
>  *                       via 192.168.1.2, r1-eth4, weight 1, 00:00:08
> B>* 99.0.0.1/32 [200/0] via 192.168.1.2, r1-eth4, weight 1, 00:00:08

> VRF r1-cust4:
> B   5.1.0.0/24 [20/98] via 99.0.0.1 (vrf r1-cust1) inactive, weight 1, 00:00:08
> B>* 99.0.0.1/32 [20/0] via 192.168.1.2, r1-eth4 (vrf r1-cust1), weight 1, 00:00:08

When announcing the routes to zebra, use the peer of the ultimate bgp
path info instead of the one of the first parent path info to determine
whether the route is recursive.

The result is:
> VRF r1-cust4:
> B>  5.1.0.0/24 [20/98] via 99.0.0.1 (vrf r1-cust1) (recursive), weight 1, 00:00:02
>   *                      via 192.168.1.2, r1-eth4 (vrf r1-cust1), weight 1, 00:00:02
> B>* 99.0.0.1/32 [20/0] via 192.168.1.2, r1-eth4 (vrf r1-cust1), weight 1, 00:00:02

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-09 18:25:01 +01:00
Louis Scalbert
1a348ec050 tests: check route recursion on leaked routes
Check that leaks of a route with a recursive nexthop is possible.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-09 18:25:01 +01:00
Alexander Skorichenko
f4da4398f4 bgpd: fix minttl copying during peer reset
Include gtsm_hops (minttl) field when copying peer structure,
so that a new connection could set a proper value.

Signed-off-by: Alexander Skorichenko <askorichenko@netgate.com>
2024-02-09 16:58:52 +01:00
Donatas Abraitis
4dccc31884 bgpd: Optimize memory for peer_connection struct
```
struct peer_connection {
	struct peer *              peer;                 /*     0     8 */
	enum bgp_fsm_status        status;               /*     8     4 */
	enum bgp_fsm_status        ostatus;              /*    12     4 */
	int                        fd;                   /*    16     4 */
	uint32_t                   thread_flags;         /*    20     4 */
	pthread_mutex_t            io_mtx;               /*    24    40 */
	/* --- cacheline 1 boundary (64 bytes) --- */
	struct stream_fifo *       ibuf;                 /*    64     8 */
	struct stream_fifo *       obuf;                 /*    72     8 */
	struct ringbuf *           ibuf_work;            /*    80     8 */
	struct event *             t_read;               /*    88     8 */
	struct event *             t_write;              /*    96     8 */
	struct event *             t_connect;            /*   104     8 */
	struct event *             t_delayopen;          /*   112     8 */
	struct event *             t_start;              /*   120     8 */
	/* --- cacheline 2 boundary (128 bytes) --- */
	struct event *             t_holdtime;           /*   128     8 */
	struct event *             t_connect_check_r;    /*   136     8 */
	struct event *             t_connect_check_w;    /*   144     8 */
	struct event *             t_gr_restart;         /*   152     8 */
	struct event *             t_gr_stale;           /*   160     8 */
	struct event *             t_generate_updgrp_packets; /*   168     8 */
	struct event *             t_pmax_restart;       /*   176     8 */
	struct event *             t_routeadv;           /*   184     8 */
	/* --- cacheline 3 boundary (192 bytes) --- */
	struct event *             t_process_packet;     /*   192     8 */
	struct event *             t_process_packet_error; /*   200     8 */
	union sockunion            su;                   /*   208   128 */

	/* size: 336, cachelines: 6, members: 25 */
	/* last cacheline: 16 bytes */
};   /* saved 8 bytes! */
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-02-09 17:29:35 +02:00
Donatas Abraitis
c6e5b8030f bgpd: Optimize memory for bgp_nexthop_cache struct
```
struct bgp_nexthop_cache {
	afi_t                      afi;                  /*     0     4 */
	ifindex_t                  ifindex_ipv6_ll;      /*     4     4 */
	struct bgp_nexthop_cache_item entry;             /*     8    32 */
	uint32_t                   metric;               /*    40     4 */
	uint8_t                    nexthop_num;          /*    44     1 */
	_Bool                      is_evpn_gwip_nexthop; /*    45     1 */
	uint16_t                   change_flags;         /*    46     2 */
	struct nexthop *           nexthop;              /*    48     8 */
	time_t                     last_update;          /*    56     8 */
	/* --- cacheline 1 boundary (64 bytes) --- */
	uint16_t                   flags;                /*    64     2 */

	/* XXX 2 bytes hole, try to pack */

	uint32_t                   srte_color;           /*    68     4 */
	struct bgp_nexthop_cache_head * tree;            /*    72     8 */
	struct prefix              prefix __attribute__((__aligned__(8))); /*    80    56 */
	/* --- cacheline 2 boundary (128 bytes) was 8 bytes ago --- */
	void *                     nht_info;             /*   136     8 */
	struct path_list           paths;                /*   144     8 */
	unsigned int               path_count;           /*   152     4 */

	/* XXX 4 bytes hole, try to pack */

	struct bgp *               bgp;                  /*   160     8 */

	/* size: 168, cachelines: 3, members: 17 */
	/* sum members: 162, holes: 2, sum holes: 6 */
	/* forced alignments: 1 */
	/* last cacheline: 40 bytes */
} __attribute__((__aligned__(8)));   /* saved 16 bytes! */
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-02-09 17:25:05 +02:00
Donatas Abraitis
d13abf1180 bgpd: Optimize memory for ecommunity struct
```
struct ecommunity {
	long unsigned int          refcnt;               /*     0     8 */
	uint8_t                    unit_size;            /*     8     1 */
	_Bool                      disable_ieee_floating; /*     9     1 */

	/* XXX 2 bytes hole, try to pack */

	uint32_t                   size;                 /*    12     4 */
	uint8_t *                  val;                  /*    16     8 */
	char *                     str;                  /*    24     8 */

	/* size: 32, cachelines: 1, members: 6 */
	/* sum members: 30, holes: 1, sum holes: 2 */
	/* last cacheline: 32 bytes */
};   /* saved 8 bytes! */
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-02-09 17:21:23 +02:00
Donatas Abraitis
1fce318efc bgpd: Optimize memory for bgp_adj_out struct
```
struct bgp_adj_out {
	struct rb_entry            adj_entry;            /*     0    32 */

	/* XXX last struct has 4 bytes of padding */

	struct update_subgroup *   subgroup;             /*    32     8 */
	struct {
		struct bgp_adj_out * tqe_next;           /*    40     8 */
		struct bgp_adj_out * * tqe_prev;         /*    48     8 */
	} subgrp_adj_train;                              /*    40    16 */
	struct bgp_dest *          dest;                 /*    56     8 */
	/* --- cacheline 1 boundary (64 bytes) --- */
	uint32_t                   addpath_tx_id;        /*    64     4 */
	uint32_t                   attr_hash;            /*    68     4 */
	struct attr *              attr;                 /*    72     8 */
	struct bgp_advertise *     adv;                  /*    80     8 */

	/* size: 88, cachelines: 2, members: 8 */
	/* paddings: 1, sum paddings: 4 */
	/* last cacheline: 24 bytes */
};   /* saved 8 bytes! */
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-02-09 17:18:22 +02:00
Jafar Al-Gharaibeh
75d3e43368
Merge pull request #15327 from routingrocks/pim_evpn_traffic_loss
pimd: re-evaluated S,G OILs upon RP changes and empty SG upstream oils
2024-02-09 09:15:01 -06:00
Donatas Abraitis
e4a9565137 ospfd: Add deprecation cycle for router-info X [A.B.C.D] command
Specifying an area is not relevant anymore. Use it for some time as a hidden
command to avoid breaking the scripts.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-02-09 12:48:11 +02:00
Donatas Abraitis
b7987eca20
Merge pull request #15333 from c-po/issue-14910
ospfd: can not delete "segment-routing node-msd" when SR if off
2024-02-09 12:34:58 +02:00
Donatas Abraitis
7174a7d213
Merge pull request #15336 from c-po/issue-15335
ospfd: add support for "no router-info [<area|as>] command"
2024-02-09 12:33:59 +02:00
Christian Breunig
e744db5098 ospfd: add support for "no router-info [<area|as>] command"
frr-reload.py will walk through all config contexts and prepend no to the CLI
command. This requires that the vtysh shell code accepts a full command.

To Reproduce

vtysh -c "conf t" -c "router ospf" -c "router-info area"
vtysh -c "conf t" -c "router ospf" -c "no router-info area"
% Unknown command: no router-info area
vtysh -c "conf t" -c "router ospf" -c "no router-info"

Signed-off-by: Christian Breunig <christian@breunig.cc>
2024-02-08 22:40:54 +01:00
Christian Breunig
ba45aa62e7 ospfd: can not delete "segment-routing node-msd" when SR if off
This fixes the initial implementation of commit 7743f2f8c0 ("OSPFd: Update
Segment Routing PR following review") where it wsa not possible to remove
the "segment-routing node-msd" CLI nodes via vtysh once segment-routing got
disabled.

Closes #14910

Signed-off-by: Christian Breunig <christian@breunig.cc>
2024-02-08 21:56:08 +01:00
Donald Sharp
c70af155d2
Merge pull request #15285 from idryzhov/staticd-nexthop-refcounter
staticd: fix nexthop tracking memory leak and add a topotest for VRFs
2024-02-08 15:53:30 -05:00
Rajesh Varatharaj
071d43a052 pimd: re-evaluated S,G OILs upon RP changes and for empty SG upstream oils
Topology:

TOR11 (FHR) --- LEAF-11---SPINE1 (RP)MSDP SPINE-2(RP)MSDP --- LEAF-12 -- TOR12 (LHR)
        |         |                    |				|       |
	|         -----------------------------------------------------(ECMP)   |
	|         |		                                |               |
	 -----------------------------------------------------------------------(ECMP)
Issue:
In some triggers, S,G upstream is preserved even with the PP timer expiry, resulting
in S,G with NULL OILS. This could be because we create a dummy S,G upstream and
dummy channel_oif for *,G, where RPF is UNKNOWN. As a result, PIM+VXLAN traffic is never
forwarded downstream to LHR.

Fix:
when the S,G stream is running, Determine if a reevaluation of the outgoing interface
 list (OIL) is required. S,G upstream should then inherit the OIL from *,G.

Testing:
- Evpn pim tests - TestEvpnPimSingleVtepOneMdt.test_02_broadcast_traffic_spt_zero
- pim-smoke

Ticket: #
Signed-off-by: Rajesh Varatharaj <rvaratharaj@nvidia.com>
2024-02-08 10:37:31 -08:00
Donald Sharp
b2ade8e3d2 zebra: When reinstalling a NHG, set REINSTALL flag
The current code is unsetting the fact that the
NHG is installed.  It is installed but we are
reinstalling it.  Let's note this in the code
appropriately as REINSTALL and not remove the
INSTALLED FLAG.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-08 12:32:26 -05:00
Donald Sharp
e28162b215 zebra: Move nhg reinstallation into if_up proper
The function call in to zebra_interface_nhg_reinstall
is an action that takes place on interface up events
*not* when the connected addresses are added to
a system.  this will prevent this function being
called when new connected interfaces come alive
that is an independent operation of the interface
coming up.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-08 12:22:09 -05:00
Donald Sharp
fbce9231d1 zebra: Remove function abstraction in interface.c
zebra_if_nhg_dependents_XXX were just simple wrapper
functions that inited/deleted data structures.
These were already function calls themselves.  Let's
remove the abstraction and make the code simpler.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-08 12:05:05 -05:00
Donald Sharp
2934127547 zebra: Remove ifp_nhg_XXX functions completely
These functions provided a level of abstraction that forced
us to call multiple functions when a simple data structure
change was all that is needed.  Let's consolidate down
and make things a bit simpler.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-08 11:56:40 -05:00
Donald Sharp
b9130ab51b zebra: Remove helper function if_nhg_dependents_is_empty
Let's just let the function figure this out.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-08 11:49:08 -05:00
Donald Sharp
910b2c5a4a zebra: Installation success should not set NHG as valid
The nexthop group is marked as valid/invalid and then
installed.  Not installed and then marked valid.
This is just a bit of code removed that might be covering
up other problems that need to be sorted.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-08 11:37:26 -05:00
Donald Sharp
0fa9ee396b zebra: Use switch when handling return from dplane for nhgs
Convert the dplane results function for nhg's over to
using a switch for the result enum.  Let's specifically
call out the unexpected state and also set the nexthop
group as not installed when installation fails.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-08 11:37:25 -05:00
Donald Sharp
afa07a7f3a
Merge pull request #15255 from louis-6wind/bgp-leak-interface
bgpd: fix interface of routes leaked from another VRF
2024-02-08 11:18:58 -05:00
Donald Sharp
04d0834464
Merge pull request #15326 from pguibert6WIND/bgp_flowspec_ipv6_flush
bgpd: fix flushing ipv6 flowspec entries when peering stops
2024-02-08 10:36:00 -05:00
Donald Sharp
fcf1ab9c21
Merge pull request #15325 from opensourcerouting/fix/show_getsockopt
bgpd: Do not show TCP MSS if the socket is broken
2024-02-08 10:33:34 -05:00
Donald Sharp
9e42c61305
Merge pull request #15316 from LabNConsulting/working/lb/nhrp-nexthop-race-cond
nhrp: fix race condition in  null lladdr from zebra
2024-02-08 10:31:46 -05:00
Donald Sharp
aac45c8a97
Merge pull request #15324 from opensourcerouting/fix/doc_route_map_continue
doc: Fix the documentation for route-map continue statement
2024-02-08 08:19:56 -05:00
Donald Sharp
8f76afd044 zebra: Conslidate zebra_nhg_set_valid|invalid functions
Basically the same function two times.  Let's consolidate.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-08 07:59:11 -05:00
Donald Sharp
90e5cafdb6 zebra: Fixup documentation in zebra_nhg.h
The documentation was wrong.  Let's adjust it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-08 07:58:54 -05:00
Donald Sharp
65d82a45ec zebra: dplane_nexthop_add cannot return ZEBRA_DPLANE_REQUEST_SUCCESS
When installing a NHG via dplane_nexthop_add, it can only return
REQUEST_QUEUED or REQUEST_FAILURE.  There is no way SUCCESS can
be returned with the way the dplane works at this point in time.
Remove the code that attempts to set the NHE state appropriately
as it is impossible.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-07 20:32:24 -05:00
Lou Berger
5d9ebe6181 nhrp: fix race condition
where null lladdr recieved from zebra before nhrp next hop
	is installed.

Signed-off-by: Lou Berger <lberger@labn.net>
2024-02-07 23:05:20 +00:00
Philippe Guibert
ec6e09c271 bgpd: fix flushing ipv6 flowspec entries when peering stops
When a BGP flowspec peering stops, the BGP RIB entries for IPv6
flowspec entries are removed, but not the ZEBRA RIB IPv6 entries.

Actually, when calling bgp_zebra_withdraw() function call, only
the AFI_IP parameter is passed to the bgp_pbr_update_entry() function
in charge of the Flowspec add/delete in zebra. Fix this by passing
the AFI parameter to the bgp_zebra_withdraw() function.

Note that using topotest does not show up the problem as the
flowspec driver code is not present and was refused. Without that,
routes are not installed, and can not be uninstalled.

Fixes: 529efa2346 ("bgpd: allow flowspec entries to be announced to zebra")
Link: https://github.com/FRRouting/frr/pull/2025

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-02-07 23:01:25 +01:00