Commit Graph

1591 Commits

Author SHA1 Message Date
Patrick Ruddy
d2a516dc7a
Merge pull request #7279 from donaldsharp/17_coverity
17 coverity
2020-10-13 11:48:37 +01:00
Russ White
7fabf208b0
Merge pull request #6811 from rgirada/test_helper
ospfd: ospfv2 graceful restart helper support.
2020-10-12 10:16:27 -04:00
Donald Sharp
28ef0ee121 *: Use proper semantics for turning off thread
We have this pattern in the code base:

if (thread)
	THREAD_OFF(thread);

If we look at THREAD_OFF we check to see if thread
is non-null too.  So we have a double check.
This is unnecessary.  Convert to just using THREAD_OFF

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-12 08:35:18 -04:00
Donald Sharp
8ced966f39 ospfd: When failing to set socket options just note the failure
Instead of closing the socket, just note the failure and
continue on.  If we actually failed here so many other
things would not be working at all, that actually
closing the fd won't matter.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-11 12:56:02 -04:00
ckishimo
96fad84aa0 ospfd: fix typos
Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
2020-10-07 01:53:13 -07:00
Donald Sharp
7302f333e5
Merge pull request #7228 from idryzhov/vtysh-dynamic-daemons
vtysh: dynamically generate the list of daemons for commands
2020-10-02 18:07:31 -04:00
Igor Ryzhov
31011d9cbe isisd, ospfd: fix missing/excessive docstrings
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-10-02 18:51:12 +03:00
Igor Ryzhov
d7b86ae4fe vtysh: dynamically generate the list of daemons for commands
Some daemons were actually missing from the static definitions: nhrpd,
babeld, eigrpd and bfdd.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-10-02 15:06:27 +03:00
ckishimo
ab1464ddb0 ospfd: flush type 5 when type 7 is removed
When the ASBR stops announcing a prefix into the NSSA area, the LSA
type 7 is removed from the area. However the ABR is refreshing the
type 5 in its LSDB while removing the Type 7 LSA. Routers outside
the area do not get an update.

With the following topology: r1---r2---r3, with r3 being the ASBR
announcing type 7 LSA:

r3 configuration
router ospf
 redistribute static
 network 10.0.23.0/24 area 1
 area 1 nssa
!

We stop announcing prefix 3.3.3.3 in the ASBR
r3# conf
r3(config)# router ospf
r3(config-router)# no redistribute static
r3(config-router)#

r2 (ABR)
r2# sh ip os database

                NSSA-external Link States (Area 0.0.0.1 [NSSA])

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         33.33.33.33     3600 0x8000002f 0x13be E2 3.3.3.3/32 [0x0]  <-- flushed

                AS External Link States

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         10.0.25.2          7 0x8000002f 0x73c7 E2 3.3.3.3/32 [0x0]  <-- refreshed(?)

With PR#7086 the LSA type 5 is flushed from the LSDB in r2 and the change is
announced to routers outside the area (r1)

r2# sh ip os da

                NSSA-external Link States (Area 0.0.0.1 [NSSA])

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         33.33.33.33     3600 0x80000002 0x6d91 E2 3.3.3.3/32 [0x0]  <-- flushed

                AS External Link States

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         10.0.25.2       3600 0x80000002 0xcd9a E2 3.3.3.3/32 [0x0]  <-- flushed

r1# sh ip os da

                AS External Link States

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         10.0.25.2       3600 0x80000002 0xcd9a E2 3.3.3.3/32 [0x0]  <-- flushed

Unfortunately I just realized that with PR#7086 I'm introducing a new bug, as Type-5 LSA
are not being refreshed when reaching MaxAge

r2# sh ip os da

                NSSA-external Link States (Area 0.0.0.1 [NSSA])

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         33.33.33.33       35 0x80000002 0x6d91 E2 3.3.3.3/32 [0x0]  <--- refreshed

                AS External Link States

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         10.0.25.2       3600 0x80000002 0xcd9a E2 3.3.3.3/32 [0x0]  <--- not refreshed!

So this PR should fix the original issue and the bug introduced later, so when stopping
redistribution in the ASBR, both type 5 and type 7 are flushed:

r2# sh ip os da

                NSSA-external Link States (Area 0.0.0.1 [NSSA])

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         33.33.33.33     3600 0x80000002 0x6d91 E2 3.3.3.3/32 [0x0]

                AS External Link States

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         10.0.25.2       3600 0x80000002 0xcd9a E2 3.3.3.3/32 [0x0]

Routers outside the area are also notified

r1# sh ip os da

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         10.0.25.2       3600 0x80000002 0xcd9a E2 3.3.3.3/32 [0x0]

Re-enabling redistribution, both LSA will be advertised again

r3# conf
r3(config)# router ospf
r3(config-router)# no redistribute static
r3(config-router)# redistribute static
r3(config-router)#

r2# sh ip os da

                NSSA-external Link States (Area 0.0.0.1 [NSSA])

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         33.33.33.33       19 0x80000001 0x6f90 E2 3.3.3.3/32 [0x0]

                AS External Link States

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         10.0.25.2         11 0x80000001 0xcf99 E2 3.3.3.3/32 [0x0]

and they are refreshed when reaching MaxAge

                NSSA-external Link States (Area 0.0.0.1 [NSSA])

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         33.33.33.33       10 0x80000002 0x6d91 E2 3.3.3.3/32 [0x0] <-- Seq 2

                AS External Link States

Link ID         ADV Router      Age  Seq#       CkSum  Route
3.3.3.3         10.0.25.2          2 0x80000002 0xcd9a E2 3.3.3.3/32 [0x0] <-- Seq 2

Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
2020-09-29 13:58:49 -07:00
ckishimo
945eec2b64 ospfd: fix lsa type-7 continuously refreshed
Having an NSSA ABR redistributing statics, the type-7 LSA are being
continuously refreshed (every ~14 secs). The LSA Seq number keeps
incrementing and the LSA age is going back to 0 when reaching ~14s.

This PR fixes the issue by not forcing the LSA update

However I ignore if the "force" parameter was used in purpose. With this
PR updates are sent in case the metric or metric type are changed

Sep 24 08:54:48 r2 ospfd[7137]: ospf_flood_through: LOCAL NSSA FLOOD of Type-7.
Sep 24 08:55:02 r2 ospfd[7137]: ospf_flood_through: LOCAL NSSA FLOOD of Type-7.
Sep 24 08:55:16 r2 ospfd[7137]: ospf_flood_through: LOCAL NSSA FLOOD of Type-7.
Sep 24 08:55:30 r2 ospfd[7137]: ospf_flood_through: LOCAL NSSA FLOOD of Type-7.
Sep 24 08:55:44 r2 ospfd[7137]: ospf_flood_through: LOCAL NSSA FLOOD of Type-7.
Sep 24 08:55:58 r2 ospfd[7137]: ospf_flood_through: LOCAL NSSA FLOOD of Type-7.
Sep 24 08:56:12 r2 ospfd[7137]: ospf_flood_through: LOCAL NSSA FLOOD of Type-7.
Sep 24 08:56:26 r2 ospfd[7137]: ospf_flood_through: LOCAL NSSA FLOOD of Type-7.
Sep 24 08:56:40 r2 ospfd[7137]: ospf_flood_through: LOCAL NSSA FLOOD of Type-7.

ip route 2.2.2.2/32 blackhole
router ospf
 network 10.0.23.0/24 area 1
 area 1 nssa
!

r2# conf t
r2(config)# router ospf
r2(config-router)# redistribute static

r2# sh ip os da

                NSSA-external Link States (Area 0.0.0.1 [NSSA])

Link ID         ADV Router      Age  Seq#       CkSum  Route
2.2.2.2         10.0.25.2         13 0x8000000f 0x3f17 E2 2.2.2.2/32 [0x0]   <<< Seq: f, age 13

r2# sh ip os da

                NSSA-external Link States (Area 0.0.0.1 [NSSA])

Link ID         ADV Router      Age  Seq#       CkSum  Route
2.2.2.2         10.0.25.2          0 0x80000010 0x3d18 E2 2.2.2.2/32 [0x0]   <<< Seq: 10, age 0

r2# sh ip os da

                NSSA-external Link States (Area 0.0.0.1 [NSSA])

Link ID         ADV Router      Age  Seq#       CkSum  Route
2.2.2.2         10.0.25.2          3 0x8000001b 0x2723 E2 2.2.2.2/32 [0x0]   <<< Seq: 1b, age 3

Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
2020-09-29 08:48:11 -07:00
Donald Sharp
e2dcd0c2c5
Merge pull request #7132 from volta-networks/fix_ldp_sync_cmds
Fix ldp sync cmds
2020-09-22 14:20:21 -04:00
Russ White
b4b7ca8944
Merge pull request #7122 from ckishimo/type4
ospfd: do not generate type 4 LSA from NSSA ABR
2020-09-22 11:30:06 -04:00
rgirada
caa1cd9eab ospfd: Debug support to ospf GR helper functionality
Description:
	Added the following debug commands to enable debugs
	GR helper functionality.
	[no] debug ospf gr helper

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-09-22 03:07:31 -07:00
rgirada
abd5b8c72c ospfd: GR helper specific show commands
Description:
	The following  show commands are added to display helper specific
	information.
	1.show ip ospf graceful-restart helper [detail] [json]
		--> displays user configurations and list of all helpers details.

	2.show ip ospf neighbour detail
		--> diplays helper details

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-09-22 00:02:37 -07:00
rgirada
07b33add1d ospfd: GR helper config commands
Description:
	The following commands are added for helper support.
	1.[no] graceful-restart helper-only
	2.[no] graceful-restart helper-only <A.B.C.D>
	3.[no] graceful-restart helper lsa-check-disable
	4.[no] graceful-restart helper supported-grace-time
	5.[no] graceful-restart helper planned-only

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-09-22 00:02:37 -07:00
rgirada
df074ec33a ospfd: GR helper exit scenarios
Description:
	The follwoing helper exit scenarios are handled.
	1. Recv Max age grace LSA from RESTARTER.
	2. Grace timer expiry.
	3. Due to topo change if lsa check is enabled.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-09-22 00:02:37 -07:00
rgirada
5a77dd8feb ospfd: GR Helper functionality changes
Description:
	1. Skipping inactivity timer during  graceful restart to make
	   the RESTARTER active even after dead timer expiry.
	2. Handling HELPER on unplanned outages.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-09-22 00:02:37 -07:00
rgirada
ad68699217 ospfd: Grace LSA processing
Description:
	1. Grace LSA processing.
	2. Validations to become a Helper. rfc3623 section 3.1

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-09-22 00:02:37 -07:00
rgirada
06bc3110d3 ospfd: ospf GR helper initialization
Description:
	1. Graceful restart helper init/de-init.
	2. Defining dedicated memory for helper.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-09-22 00:02:33 -07:00
rgirada
f96f271366 ospfd: ospf GR helper data structure definitions.
Description:
	Graceful restart helper support specific data structure
	changes.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-09-21 23:59:59 -07:00
lynne
9919bec70a ospfd: updates to the ldp-sync ospf commands
Improve the output of the show ip ospf mpls ldp-sync command.

Signed-off-by: Lynne Morrison <lynne@voltanet.io>
2020-09-21 12:07:13 -04:00
Donald Sharp
68f383438d
Merge pull request #7133 from Niral-Networks/niral_fix_ospf_timer
ospfd : Fix for ospf dead interval and hello due.
2020-09-19 08:18:46 -04:00
Kaushik
182d6bdc16 ospfd : Fix for ospf dead interval and hello due.
1. Ospf dead-interval will be set as 4 times of hello-interval, incase
if it is not set by using "ip ospf dead-interval <dead-val>".
2. On resetting hello-interval using "no ip ospf hello-interval" the
dead interval and hello due will be changed accordingly.

Signed-off-by: Kaushik <kaushik@niralnetworks.com>
2020-09-19 00:29:25 -07:00
Donald Sharp
cb4e6e4665
Merge pull request #7074 from Niral-Networks/acl_fix
ospfd : Resolving conflict in distribute-list update during MaxAge LSA.
2020-09-18 20:46:37 -04:00
Donald Sharp
27baa2c056
Merge pull request #7086 from ckishimo/flush_type5
ospfd: flush type 5 when type 7 is removed
2020-09-18 14:58:14 -04:00
ckishimo
8273ee4448 ospfd: do not generate type 4 LSA from NSSA ABR
In a topology like R1 -- R2 -- R5, with R2 being NSSA ABR and R5 being
ASBR redistributing external routes, the ABR R2 will translate type-7
LSA into type-5 and advertise to the backbone. In the current implementation
R2 is also advertising a type-4 LSA when there is no need.

RFC 3101: "...NSSA's border routers never originate Type-4 summary-LSAs
for the NSSA's AS boundary routers, since Type-7 AS-external-LSAs are
never flooded beyond the NSSA's border..."

With this PR a type-4 LSA will not be advertised

Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
2020-09-17 07:44:14 -07:00
ckishimo
919714bd3f ospfd: fix debug ospf nssa prints wrong info
Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
2020-09-15 17:38:33 +02:00
ckishimo
a5f7319294 ospfd: flush type 5 when type 7 is removed
When the ASBR stops announcing a prefix into the NSSA area, the LSA
type 7 is removed from the area. However the ABR is refreshing the
type 5 in its LSDB while removing the Type 7 LSA. Routers outside
the area do not get an update.

With this change the LSA type 5 is flushed from the LSDB and the
change is announced to routers outside the area

Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
2020-09-12 11:42:24 -07:00
Kaushik
e6baea10a4 ospfd : Resolving conflict in distribute-list update during MaxAge LSA.
1. Fix for duplicating calls of ospf_external_lsa_refresh()
   in ospf_distribute_list_update_timer().
2. Added the comment and change from PR 6981.

Signed-off-by: Kaushik <kaushik@niralnetworks.com>
2020-09-12 06:24:30 -07:00
Renato Westphal
beb91114ec
Merge pull request #6789 from volta-networks/feat_ldp_igp_sync
ldpd: Add support for LDP-IGP Synchronization
2020-09-11 15:55:04 -03:00
lynne
132a782eb8 ospfd: ldp-igp-sync feature: adding ospf support
Signed-off-by: Lynne Morrison <lynne@voltanet.io>
Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-09-09 14:38:44 -04:00
Santosh P K
d6165cf543
Merge pull request #6982 from achernavin22/ospf_nssa_after_redist
ospfd: install Type-7 when NSSA enabled after redistribution
2020-09-07 18:24:41 +05:30
Alexander Chernavin
0f321812f5 ospfd: install Type-7 when NSSA enabled after redistribution
If NSSA is enabled before redistribution is configured, Type-7 LSA's
are installed. But if NSSA is enabled after redistribution is
configured, Type-7 LSAs are missing.

With this change, when NSSA is enabled, scan for external LSA's and
if they exist, install Type-7.

Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
2020-09-03 08:12:05 -04:00
Santosh P K
371ded520b
Merge pull request #6987 from Niral-Networks/acl_fix
lib, ospf : Fix when redist is performed with route-map using access-list
2020-09-03 09:51:21 +05:30
Kaushik
e641623d90 ospfd : Fix in lsa refresh when redist is done with route-map using access-list.
1. Minor change in distribute-list update timer based on lsa flag.

Co-authored-by: harios <hari@niralnetworks.com>
Signed-off-by: Kaushik <kaushik@niralnetworks.com>
2020-09-02 02:44:25 -07:00
Olivier Dugeon
2e5b029865
Merge pull request #7003 from GalaxyGorilla/ospf_ti_lfa_prep
ospfd: use a new vertex list for every SPF run
2020-09-01 16:39:29 +02:00
Donald Sharp
2f826685a7
Merge pull request #7005 from Orange-OpenSource/dev_ospf_sr
ospfd: Coverity corrections
2020-08-27 07:15:38 -04:00
GalaxyGorilla
81443a283b ospfd: use a new vertex list for every SPF run
In the context of TI-LFA it is necessary to have multiple
representations of SPFs for so called P and Q spaces. Hence it makes
sense to start with fresh vertex lists, and only delete them when
the SPF calculation is not a 'dry run'.

Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2020-08-27 09:05:51 +00:00
Olivier Dugeon
83df36e845 ospfd: Coverity corrections
Following PR #6726, Coverity Scan detected some new errors in the OSPF Segment
Routing code. This patch corrects them.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2020-08-26 17:27:16 +02:00
Renato Westphal
cd8ce25a70
Merge pull request #6726 from Orange-OpenSource/dev_ospf_sr
ospfd: Segment Routing Improvement
2020-08-24 16:23:45 -03:00
Olivier Dugeon
4f4eed1cff
Merge pull request #6912 from GalaxyGorilla/ospf_ti_lfa_prep
ospfd: preparation for TI-LFA
2020-08-24 18:12:03 +02:00
Jakub Urbańczyk
a92706bb83 ospfd: make proactive ARP configurable
OSPFD sends ARP proactively to speed up convergence for /32 networks
on a p2p connection. It is only an optimization, so it can be disabled.

It is enabled by default.

Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
2020-08-20 17:19:25 +02:00
Olivier Dugeon
0d174b6697 OSPFd: Correct Extended Prefix flooding for SR
PR #6416 that solves opsf crash when segment routing is restarted, introduce a
regression in Extended Prefix flooding: when segment routing prefix is modified
or removed, new segment routing prefix is no more flooded. This patch correct
this regression.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2020-08-20 15:51:48 +02:00
Olivier Dugeon
f786c4d7c9 OSPFd: Explicit Null option for Segment-Routing
Add new option to `segment-routing prefix` command to set the
Explcit Null flag in addition to the No-PHP flag. MPLS LFIB configuration
has been also updated to take into account the Explicit Null flag.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2020-08-20 15:51:48 +02:00
Olivier Dugeon
6f751f1493 ospfd: Add Segment Routing Local Block
RFC 8665 defines a Segment Routing Local Block for Adjacency SID.
This patch provides the possibility to modify the SRLB as well as
reserved the block range from the Label Manager.

 - Introduce new CLI 'segment-routing local-block'
 - Add local block to SRDB structure
 - Parse / Serialize SRLB in Router Information LSA
 - Update OSPF-SR topotest
 - Update documentation

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2020-08-20 14:37:40 +02:00
Olivier Dugeon
d81b8e0e1a ospfd: Add Label Manager for Segment Routing
Segment Routing Global Block is now using the Label Manager to reserved
label range. Label Manager connection uses the synchronous mode and dedicated
thread timer is used to establish the connection in safe manner without
blocking OSPFd is the Label Manager is not available.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2020-08-20 14:33:00 +02:00
GalaxyGorilla
6fc9528e8b ospfd: bring back some P2P SPF interface code
In the case of P2P links it is possible to use IP unnumbered which
yields a strong dependency to the interface data for nexthop
resolution in the SPF calculations. While the SPF code strives to
be as independent of non-LSA data as possible there is no way
around here: one has to resolve the nexthop for such a special case
using the interface data.

For this purpose a new flag 'spf_root_node' is introduced to signal
that interface data can be used for P2P links. For now this flag is
always 'true' since the SPF currently always uses the calculating
node as the root node. This will change with the introduction of
TI-LFA where other nodes can be root nodes.

Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2020-08-18 11:13:56 +00:00
GalaxyGorilla
3a76b1be88 ospfd: add print helper for SPF trees and route tables
Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2020-08-18 10:58:50 +00:00
GalaxyGorilla
1d376ff539 ospfd: introduce a 'dry run' into SPF code
in OSPF interface data is used for the nexthop resolution
during the SPF algorithm, see RFC2328 16.1.1. However, for
certain technologies like TI-LFA it is desirable to be able
to calculate SPFs for arbitrary root nodes, not just the
calculating node. Since interface data is not available for
other nodes it is necessary to remove this dependency and
make its usage optional, depending on the intent of
changing the RIB with the generated tree (or not).

To signal that a SPF run is used without the intent to
change the RIB an additional flag `spf_dry_run` is
introduced to the ospf_area struct. This flag is currently
only used within the pure SPF code but will be extended
to the SPF postprocessing later on.

Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2020-08-18 10:58:45 +00:00
GalaxyGorilla
5ec5929c62 ospfd: clean some bitrot in SPF code
Just non-functional changes, cosmetics, removal of eye
cancer. The intention here is to make the SPF code more
approachable.

Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2020-08-14 09:44:05 +00:00
Jakub Urbańczyk
aa530b627d ospfd: send ARP requests using zebra
Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
2020-08-12 23:20:52 +02:00
GalaxyGorilla
29df0fc749 ospfd: fix processing of SR RI LSAs
Router Information are contained in opaque LSAs and when such a LSA
is received a new SR node for the advertising router is created.

However, the RI related data is currently not set when such a SR node
already exists. This can happen when e.g. link and prefix information
arrive before the RI and therefore an SR node is created.

This is now fixed by setting the data everytime the RI is received,
independent of the SR node already existing or not.

Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2020-08-10 13:52:08 +00:00
Aaron LI
1a08238236 ospfd: Fix Zebra route add message truncation issue
The `INET_ADDRSTRLEN` is 16 and is only enough to format an IPv4 address.
So when there is a prefix (`/xx`), the debug output may get truncated.
Use `PREFIX2STR_BUFFER` macro instead to fix the issue.

Signed-off-by: Aaron LI <aly@aaronly.me>
2020-07-30 08:16:18 -07:00
Quentin Young
65b86778c1
Merge pull request #6711 from GalaxyGorilla/bfd_isis_profiles
Add BFD profiles for IS-IS
2020-07-21 14:45:31 -04:00
Igor Ryzhov
7e5ee52226 ospfd: remove redundant line continuations
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-07-20 18:18:03 +03:00
Donald Sharp
249df50a20
Merge pull request #6701 from deastoe/ospf-area-format
ospf: set display format for range command
2020-07-15 20:17:39 -04:00
Donald Sharp
3eb15671ee
Merge pull request #6731 from opensourcerouting/style-string-prep
*: string coding style
2020-07-15 20:06:55 -04:00
Rafael Zalamena
6d8016115a
Merge pull request #6333 from Spantik/ospf_default
ospf: Default-information originate with routemap
2020-07-15 14:55:16 -03:00
George Wilkie
ed709ed197 ospfd: set display format for range command
If you configure an area range in decimal format, the running
configuration displays it in dotted format.
Call ospf_area_display_format_set() for area range command,
as it is done for other variants.

Signed-off-by: Duncan Eastoe <duncan.eastoe@att.com>
2020-07-14 16:57:39 +01:00
David Lamparter
3efd0893d0 *: un-split strings across lines
Remove mid-string line breaks, cf. workflow doc:

  .. [#tool_style_conflicts] For example, lines over 80 characters are allowed
     for text strings to make it possible to search the code for them: please
     see `Linux kernel style (breaking long lines and strings)
     <https://www.kernel.org/doc/html/v4.10/process/coding-style.html#breaking-long-lines-and-strings>`_
     and `Issue #1794 <https://github.com/FRRouting/frr/issues/1794>`_.

Scripted commit, idempotent to running:
```
python3 tools/stringmangle.py --unwrap `git ls-files | egrep '\.[ch]$'`
```

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-07-14 10:37:25 +02:00
GalaxyGorilla
4affdba79e *: add BFD profile support for IS-IS
BFD profiles can now be used on the interface level like this:

	interface eth1
	  ip router isis 1
          isis bfd
          isis bfd profile default

Here the 'default' profile needs to be specified as usual in the
bfdd configuration.

Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2020-07-10 11:28:43 +00:00
Donald Sharp
7e0274f822 ospfd: allow interfaces to come up in rare situation
On startup of both zebra and ospfd.  If ospfd has not
received a valid router-id *but* has received interface
data, interfaces will not be turned on in the state
machine.  When ospf finally receives a valid router-id
it would never actually kick the state machine into
action for those interfaces it has been configured for.

Modify ospf on router id changes, *if* the old
router id was INADDR_ANY *and* the interface is
operative *and* the oi->state is ISM_Down, give
it the old kick in the patooeys

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-07-08 10:56:18 -04:00
Santosh P K
1febb13de7 ospf: Default-information originate with routemap
Default originate with route-map was broken. Routemap
was not getting applied for redistribute route but was
getting applied default route itself. No default route
was originated even when routemap was satisfied.

Signed-off-by: Santosh P K <sapk@vmware.com>
2020-07-07 04:53:14 -07:00
Mark Stapp
41b21bfa60 *: have daemons call frr_fini() at termination
Fix a number of library and daemon issues so that daemons can
call frr_fini() during normal termination. Without this,
temporary logging files are left behind in /var/tmp/frr/.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-11 15:31:54 -04:00
Donald Sharp
b71ca5ae42
Merge pull request #6460 from rgirada/ospf_external_lsa
ospfd: External LSA lookup in LSDB failed in a specific scenario
2020-06-10 12:35:17 -04:00
Donald Sharp
2d8c1bc235
Merge pull request #5323 from opensourcerouting/filter-nb
lib: migrate FRR filter to northbound
2020-06-10 06:59:32 -04:00
Rafael Zalamena
c2aab69336 *: add filter northbound support
Allow all daemons to work with filter northbound.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-06-05 14:31:26 -03:00
Olivier Dugeon
43e7abb555 ospfd: Move Segment Routing Zebra functions
For coherency, move and rename functions that send MPLS labels configurations
from ospf_sr.c to ospf_zebra.c:
 - ospf_zebra_update_prefix_sid()
 - ospf_zebra_delete_prefix_sid()
 - ospf_zebra_send_adjacency_sid()

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2020-06-03 19:35:47 +02:00
Olivier Dugeon
21baf89aff ospfd: Update Prefix & Adjacency SIDs Management
SIDs are not uninstall in LFIB when ospf adjacenyi or loopback goes down as
self LSA flusing is not handle by ospf_ext_link_lsa_update(). The patch
introduces new functions ospf_sr_ext_itf_add() and ospf_sr_ext_itf_delete() in
ospf_sr.c to directly manage LFIB for SIDs when change is detected in
ospf_ext_link_ism_change() and ospf_ext_link_nsm_change().

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2020-06-03 19:35:47 +02:00
Olivier Dugeon
b61264a8a3 ospfd: OSPF Segment Routing improvement
- Improve parsing of Router Information, especially when a router
   stops advertising Segment Routing capabilities
 - Finish conversion to '%pFX' and '%pI4'

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2020-06-03 19:35:44 +02:00
Olivier Dugeon
b37eb79c01 ospfd: Add ECMP support to OSPF Segment Routing
* Change sr_prefix structure in ospf_sr.h to add support to ECMP
 * Add new Segment Routing information to ospf_paths in ospf_route.h
 * Backport MPLS label configuration from IS-IS Segment Routing implementation
 * Re-write log message in ospf_sr.c and ospf_ext.c

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2020-06-03 19:31:50 +02:00
rgirada
64f46c2268 ospfd: External LSA lookup in LSDB failed in a specific scenario
Description:
OSPF uses an algo to generate unique LSIDs when route updates
exists with same adrress and different masklens. It genearates
the unique LSIDs by masking its hostbits.
Ex :
Rt1 : 10.0.0.0/32 - LSID : 10.0.0.0
Rt2 : 10.0.0.0/16 - LSID : 10.0.255.255
Rt3 : 10.0.0.0/24 - LSID : 10.0.0.255

Observed an issue with external LSAs when such routes originated.
If the first route (with actual address as LSID) is got deleted,
the routes with same addresss(different msaks) are failed
to get LSA pointers  from LSDB due to current fetching API design.
api : ospf_external_info_find_lsa

Here , it is allowing to look up the LSA with address specific
unique LSID (address with host bits set ex: 10.0.255.255) only
if the LSA exists where LSID as actual address of the route
(ex: 10.0.0.0 ) which is not expected and cauing for other issues.

Fix:
Corrected this logic, by looking up the LSA with unique LSID first
if it doesn’t exist then It is allowing to look up the LSDB with LSID
as address of the route.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-05-29 04:24:28 -07:00
Renato Westphal
ca4f4a3660
Merge pull request #6416 from Orange-OpenSource/master
ospfd: Solve crash after removing and adding conf.
2020-05-28 20:03:43 -03:00
Olivier Dugeon
731271b0bd ospfd: Solve crash after removing and adding conf.
Issue number #6291 describes how OSPFd crashes after being deleted and then
added again with configuration when segment routing is used.

The problem occurs in ospf_ri.c because the OspfRI structures retains
the reference to the old area pointer which is mofified when ospfd is
reactivated by configuration. When segment routing is activated, the LSA Router
Information is sent with reference to the old area pointer, instead the new one,
which causes the crash. The same problem is also present in ospf_ext.c with
OspfEXT structure and Extended Link/Prefix structure.

This commit introduces Extended Link/Prefix and Router Information LSAs flusing
when OSPFd is stopped when configuration is removed and adds the correct
initialization to the area pointer in OspfRI and Extended Link/Prefix structure
when OSPFd is re-enabled with the configuration. Area pointer has been removed
from the OspfEXT structure as it is never used with this commit.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2020-05-26 11:57:04 +02:00
Rafael Zalamena
d4badaf625 ospfd: change retransmit-interval minimum value
The command `area ... virtual-link ... retransmit-interval` supports
1-65535 range and the documentation already said
`ip ospf retransmit-interval` supports that, lets make the DEFUN to
accept that value.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-05-24 10:37:04 -03:00
rgirada
04e94d3929 ospfd: Restoring the original tag in external lsas
Description:
When a routemap applied to set a tag, all the permitted routes are
refreshed with new tag, but when a different route map applied with
a different action still the same tag persits in the external route.
The actual tag received from zebra is expected to be set back to the
routes here. Corrected this behaviour by restoring a original tag
received from zebra.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-05-17 22:02:34 -07:00
rgirada
87e6e11ee8 ospfd: Route-tag is not set to external lsas when applying with rmap
Description:
Route-tag is not set to external lsas originated by ospf when a routemap
applied by setting a specific tag. When applying a route-map on redistribution,
external lsas will be refreshed if there is any change in the route parametrs
after applying routemap. But changing tag is not handled here.
Added the apripriate fix to correct this.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-05-17 21:40:48 -07:00
David Lamparter
94cfb0692e build: make clippy Makefile rules nicer
These are easy to get subtly wrong, and doing so can cause
nondeterministic failures when racing in parallel builds.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-04-27 09:52:41 +02:00
David Lamparter
2768748b88 build: use VPATH for vtysh_scan
No need to put $(top_srcdir) everywhere.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-04-27 09:30:01 +02:00
David Lamparter
c334a16ef1
Merge pull request #6262 from qlyoung/remove-sprintf 2020-04-23 20:27:26 +02:00
Donald Sharp
e1c511c694 ospfd: Limit possible message read to our buffer size
It's possible(but unlikely) that a read of data from the
network will give us bogus data.  Don't automatically
just trust the data size from the network and limit
the read to the size of the buffer we have in play.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-04-22 07:31:07 -04:00
Quentin Young
fc746f1c01 *: manually remove some more sprintf
Take care of some more complicated cases by hand

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-20 19:14:33 -04:00
Quentin Young
772270f3b6 *: sprintf -> snprintf
Replace sprintf with snprintf where straightforward to do so.

- sprintf's into local scope buffers of known size are replaced with the
  equivalent snprintf call
- snprintf's into local scope buffers of known size that use the buffer
  size expression now use sizeof(buffer)
- sprintf(buf + strlen(buf), ...) replaced with snprintf() into temp
  buffer followed by strlcat

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-20 19:14:33 -04:00
Rafael Zalamena
5920b3eb38 *: replace all random() calls
Replace all `random()` calls with a function called `frr_weak_random()`
and make it clear that it is only supposed to be used for weak random
applications.

Use the annotation described by the Coverity Scan documentation to
ignore `random()` call warnings.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-04-17 20:57:43 -03:00
Donald Sharp
b2145a4004 ospfd: Fix possible null deref
It is possible that area is null, let's ensure it isn't.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-04-16 20:16:02 -04:00
Donald Sharp
a83014ccd6
Merge pull request #6247 from FRRouting/nb_conversions
Merge nb_converions branch to master
2020-04-16 19:39:14 -04:00
Chirag Shah
6fd8972aef *: include vrf northbound module in init
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-04-16 08:00:15 -07:00
David Lamparter
f4b8291fcb *: move CLI node names to cmd_node->name
And again for the name.  Why on earth would we centralize this, just so
people can forget to update it?

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:59 +02:00
David Lamparter
243895805a *: move CLI parent data to cmd_node->parent_node
Same as before, instead of shoving this into a big central list we can
just put the parent node in cmd_node.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter
612c2c15d8 *: remove second parameter on install_node()
There is really no reason to not put this in the cmd_node.

And while we're add it, rename from pointless ".func" to ".config_write".

[v2: fix forgotten ldpd config_write]

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter
249a771b63 *: remove cmd_node->vtysh
The only nodes that have this as 0 don't have a "->func" anyway, so the
entire thing is really just pointless.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter
62b346eefa *: clean up cmd_node initializers
... and use named assignments everywhere (so I can change the struct.)

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
Olivier Dugeon
0b4b9672b7
Merge pull request #6218 from qlyoung/fix-ospf-router-lsa-missing-length-check
ospfd: router LSA link info missing length check
2020-04-14 19:49:53 +02:00
Quentin Young
04d6a0f823 ospfd: router LSA link info missing length check
Fix
- Modulo check on data length not inclusive enough
- Garbage heap read when bounds checking

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-14 11:29:10 -04:00
Quentin Young
f45be0e105 ospfd: fix uaf upon rx of self-originated lsa
ospf_opaque_self_originated_lsa_received decrements refcount which can
result in a free, this is followed by a call to ospf_ls_ack_send which
accesses the freed LSA

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-14 01:43:13 -04:00
Donatas Abraitis
c4efd0f423 *: Do not cast to the same type
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-04-08 17:15:06 +03:00
David Lamparter
4c1458b595 bgpd, ospfd, ospf6d: long is not bool :(
... Oops ...

(for context, the defaults code originally didn't have a dedicated
"bool" variant and just used long for bools...  I derp'd this when
adding bool as a separate case :( )

Reported-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-02 21:16:04 +02:00
David Lamparter
63efca0e95 *: remove line breaks from log messages
Line break at the end of the message is implicit for zlog_* and flog_*,
don't put it in the string.  Mid-message line breaks are currently
unsupported.  (LF is "end of message" in syslog.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-03-24 19:43:18 +01:00
David Lamparter
d6951e5ef9 *: remove tabs from log messages
Some logging systems are, er, "allergic" to tabs in log messages.
(RFC5424: "The syslog application SHOULD avoid octet values below 32")

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-03-24 18:47:12 +01:00
Ruben Kerkhof
bdee80838f ospfd: stop checking for ancient OpenBSD
Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
2020-03-19 16:16:47 +01:00