Commit Graph

2195 Commits

Author SHA1 Message Date
Donald Sharp
59402d840e ospfd: Ensure show ip ospf interface json code is guarded
When not using json, do not allocate json memory.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-07-03 12:56:38 -04:00
Donald Sharp
913f02f167
Merge pull request #13895 from mjstapp/fix_ospf_sync_json_null
ospfd: check for NULLs in ldp-igp sync json code
2023-07-02 15:40:14 -04:00
Donald Sharp
1f322e4cef
Merge pull request #13847 from opensourcerouting/fix/free_zclient_sync_on_destroy
Stop and free synchronous Zebra client on destroy
2023-07-01 14:35:42 -04:00
Mark Stapp
864a3bc185 ospfd: check for NULLs in vty code
There were a couple of cli paths that NULL-checked in the
vtysh output path, but not in the json path.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-06-30 13:58:16 -04:00
Mark Stapp
220dc6df98 isisd, ospfd: fix opaque zapi source parsing
Opaque zapi messages carry the sender's zclient tuple now,
daemons shouldn't try to parse those bits directly.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-06-27 16:32:54 -04:00
Donatas Abraitis
a9c81cc289 ospfd: Stop and free synchronous Zebra client on OSPF termination
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-06-26 16:31:47 +03:00
Acee
c6e3af3013 ospfd: Add config callbacks and suppress hello during config load.
Signed-off-by: Acee <aceelindem@gmail.com>
2023-06-23 07:20:35 -04:00
Russ White
609491fe0d
Merge pull request #13612 from chiragshah6/fdev1
ospfd: fix interface param type update
2023-06-13 09:55:07 -04:00
Jafar Al-Gharaibeh
f34076da81
Merge pull request #13596 from Pdoijode/pdoijode/ospf-intf-json-changes
ospfd: json hierarchy change for "show ip ospf interface json"
2023-06-08 14:03:14 -05:00
Donatas Abraitis
1c7d8fa8c3
Merge pull request #13390 from ryndia/master
ospfd: ospf_route.c memory leak fix
2023-06-08 10:02:28 +03:00
Chirag Shah
0d005b2d5c ospfd: fix interface param type update
interface link update event needs
to be handle properly in ospf interface
cache.

Example:
When vrf (interface) is created its default type
would be set to BROADCAST because ifp->status
is not set to VRF.
Subsequent link event sets ifp->status to vrf,
ospf interface update need to compare current type
to new default type which would be VRF (OSPF_IFTYPE_LOOPBACK).
Since ospf type param was created in first add event,
ifp vrf link event didn't update ospf type param which
leads to treat vrf as non loopback interface.

Ticket:#3459451
Testing Done:

Running config suppose to bypass rendering default
network broadcast for loopback/vrf types.

Before fix:

vrf vrf1
 vni 4001
exit-vrf
!
interface vrf1
 ip ospf network broadcast
exit

After fix: (interface vrf1 is not displayed).

vrf vrf1
 vni 4001
exit-vrf

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2023-06-01 10:39:21 -07:00
Renato Westphal
2882096fad ospfd, ospf6d: fix time_t truncation
Change timestamp parameter from int to time_t to avoid truncation.

Found by Coverity Scan (CID 1563226 and 1563222)

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-05-30 19:47:28 -03:00
ryndia
ce0d06d921 ospfd: ospf_route.c memory leak fix
The rn variable has its info attribute being replaced with a new ospf route before being freed properly.

Signed-off-by: ryndia <dindyalsarvesh@gmail.com>
2023-05-30 20:44:30 +04:00
Pooja Jagadeesh Doijode
be469ddc88 ospfd: re-added old json hierarchy for ospf intf json
Re-added the old JSON hierarchy for "show ip ospf interface json"
command in addition to new, so that the scripts don't break.
Old hierarchy will be deprecated after a year.

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2023-05-26 17:18:04 -07:00
Pooja Jagadeesh Doijode
dac17990c4 ospfd: fix json object name for newly added fields
Fixed the JSON object name for "grHelloDelaySecs" and "p2mpDelayReflood"
JSON fields.

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2023-05-24 16:28:54 -07:00
Pooja Jagadeesh Doijode
d540f9edfc ospfd: fix the json object name
Fixed the JSON object name for "drId" and "drAddress"
JSON fields

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2023-05-24 15:29:38 -07:00
Trey Aspelund
72eab6953d ospfd: add oi to show ip ospf interface json
Currently "show ip ospf interface json" will walk all oi's bound to a
given interface, but every oi overwrites the same json keys.
This adds a new hierarchy to the json output which will allow each oi to
have its info displayed separately (instead of stomping on each other).

Before:
```
tor-11# show ip ospf interface swp2 json
{
  "interfaces":{
    "swp2":{
      "ifUp":true,
      "ifIndex":4,
      "mtuBytes":9216,
      "bandwidthMbit":10000,
      "ifFlags":"<UP,BROADCAST,RUNNING,MULTICAST>",
      "ospfEnabled":true,
      "ipAddress":"100.64.3.15",
      "ipAddressPrefixlen":24,
      "ospfIfType":"Broadcast",
      "localIfUsed":"100.64.3.255",
      "area":"0.0.0.1",
      "routerId":"6.0.0.15",
      "networkType":"NBMA",
      "cost":10,
      "transmitDelaySecs":1,
      "state":"Backup",
      "priority":100,
      "bdrId":"6.0.0.15",
      "bdrAddress":"100.64.3.15",
      "mcastMemberOspfAllRouters":true,
      "timerMsecs":10000,
      "timerDeadSecs":40,
      "timerWaitSecs":40,
      "timerRetransmitSecs":5,
      "timerHelloInMsecs":2502,
      "nbrCount":1,
      "nbrAdjacentCount":1
    }
  }
}
```

After:
```
leaf-12# show ip ospf interface swp3 json
{
  "interfaces":{
    "swp3":{
      "ifUp":true,
      "ifIndex":5,
      "mtuBytes":9216,
      "bandwidthMbit":10000,
      "ifFlags":"<UP,BROADCAST,RUNNING,MULTICAST>",
      "ospfEnabled":true,
      "interfaceIp":{
        "100.64.2.6":{
          "ipAddress":"100.64.2.6",
          "ipAddressPrefixlen":24,
          "ospfIfType":"Broadcast",
          "localIfUsed":"100.64.2.255",
          "area":"0.0.0.0",
          "routerId":"6.0.0.6",
          "networkType":"NBMA",
          "cost":10,
          "transmitDelaySecs":1,
          "state":"DR",
          "priority":2,
          "bdrId":"6.0.0.15",
          "bdrAddress":"100.64.2.15",
          "networkLsaSequence":2147483652,
          "mcastMemberOspfAllRouters":true,
          "timerMsecs":10000,
          "timerDeadSecs":40,
          "timerWaitSecs":40,
          "timerRetransmitSecs":5,
          "timerHelloInMsecs":1559,
          "nbrCount":1,
          "nbrAdjacentCount":1
        },
        "100.64.3.6":{
          "ipAddress":"100.64.3.6",
          "ipAddressPrefixlen":24,
          "ospfIfType":"Broadcast",
          "localIfUsed":"100.64.3.255",
          "area":"0.0.0.1",
          "routerId":"6.0.0.6",
          "networkType":"NBMA",
          "cost":10,
          "transmitDelaySecs":1,
          "state":"DR",
          "priority":222,
          "bdrId":"6.0.0.15",
          "bdrAddress":"100.64.3.15",
          "networkLsaSequence":2147483651,
          "mcastMemberOspfAllRouters":true,
          "timerMsecs":10000,
          "timerDeadSecs":40,
          "timerWaitSecs":40,
          "timerRetransmitSecs":5,
          "timerHelloInMsecs":1559,
          "nbrCount":1,
          "nbrAdjacentCount":1
        }
      }
    }
  }
}
```

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2023-05-24 15:29:32 -07:00
Acee
0d8ef0477c ospfd: OSPF P2MP Delayed Reflooding configuration
Currently, delayed reflooding on P2MP interfaces for LSAs received
from neighbors on the interface is unconditionally (see commit
c706f0e32b). In some cases, this
change wasn't desirable and this feature makes delayed reflooding
configurable for P2MP interfaces via the CLI command:
"ip ospf network point-to-multipoint delay-reflood" in interface
submode.

Signed-off-by: Acee <aceelindem@gmail.com>
2023-05-22 15:51:41 -04:00
Russ White
425fc1f5b7
Merge pull request #12949 from opensourcerouting/ospf-unplanned-gr
OSPF GR for unplanned outages
2023-05-16 08:37:19 -04:00
Keelan10
10ca618db9 ospf_ti_lfa: Free p_space memory allocation
Free p_space

Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
2023-05-12 15:05:46 +04:00
Jafar Al-Gharaibeh
bc05bccbdc
Merge pull request #13489 from LabNConsulting/ospf-opaque-stale-fix
ospfd: OSPF opaque LSA stale processing fix and topotests.
2023-05-10 15:51:21 -05:00
Jafar Al-Gharaibeh
45625b6fa8
Merge pull request #13485 from donaldsharp/ospf_loopback_cost
ospfd: Respect loopback's cost that is set and set loopback costs to 0
2023-05-10 11:13:15 -05:00
Donald Sharp
dd2bc4fb40 ospfd: Respect loopback's cost that is set and set loopback costs to 0
When setting an loopback's cost, set the value to 0, unless the operator
has assigned a value for the loopback's cost.

RFC states:

If the state of the interface is Loopback, add a Type 3
link (stub network) as long as this is not an interface
to an unnumbered point-to-point network. The Link ID
should be set to the IP interface address, the Link Data
set to the mask 0xffffffff (indicating a host route),
and the cost set to 0.

FRR is going to allow this to be overridden if the operator specifically
sets a value too.

Fixes: #13472
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-10 08:35:45 -04:00
Jeevesh Rishi Dindyal (Sarvesh)
c824d9792e ospfd: opsf_abr.c memory leak fix, free range
The new create range attribute is send to add to ranges, but not use if the prefix already exist in the ranges.

Signed-off-by: ryndia <dindyalsarvesh@gmail.com>
2023-05-10 10:59:20 +04:00
Acee
4e7eb1e62c ospfd: OSPF opaque LSA stale processing fix and topotests.
1. Fix OSPF opaque LSA processing to preserve the stale opaque
            LSAs in the Link State Database for 60 seconds consistent with
            what is done for other LSA types.
         2. Add a topotest that tests for cases where ospfd is restarted
            and a stale OSPF opaque LSA exists in the OSPF routing domain
            both when the LSA is purged and when the LSA is reoriginagted
            with a more recent instance.

Signed-off-by: Acee <aceelindem@gmail.com>
2023-05-09 16:51:03 -04:00
Renato Westphal
0c05ceae00 ospfd, ospf6d: introduce the "graceful-restart hello-delay" command
This command makes unplanned GR more reliable by manipulating the
sending of Grace-LSAs and Hello packets for a certain amount of time,
increasing the chance that the neighboring routers are aware of
the ongoing graceful restart before resuming normal OSPF operation.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-05-08 21:47:44 -03:00
Renato Westphal
d8cf2fc52f ospfd, ospf6d: log when GR messages are sent to zebra
This should be useful to troubleshoot possible GR problems in the
future.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-05-08 21:47:44 -03:00
Renato Westphal
ab749e7eea ospfd: add support for unplanned graceful restart
In practical terms, unplanned GR refers to the act of recovering
from a software crash without affecting the forwarding plane.

Unplanned GR and Planned GR work virtually the same, except for the
following difference: on planned GR, the router sends the Grace-LSAs
*before* restarting, whereas in unplanned GR the router sends the
Grace-LSAs immediately *after* restarting.

For unplanned GR to work, ospf6d was modified to send a
ZEBRA_CLIENT_GR_CAPABILITIES message to zebra as soon as GR is
enabled.  This causes zebra to freeze the OSPF routes in the RIB as
soon as the ospfd daemon dies, for as long as the configured grace
period (the defaults is 120 seconds). Similarly, ospfd now stores in
non-volatile memory that GR is enabled as soon as GR is configured.
Those two things are no longer done during the GR preparation phase,
which only happens for planned GRs.

Unplanned GR will only take effect when the daemon is killed
abruptly (e.g. SIGSEGV, SIGKILL), otherwise all OSPF routes will
be uninstalled while ospfd is exiting.  Once ospfd starts, it will
check whether GR is enabled and enter in the GR mode if necessary,
sending Grace-LSAs out all operational interfaces.

One disadvantage of unplanned GR is that the neighboring routers
might time out their corresponding adjacencies if ospfd takes too
long to come back up. This is especially the case when short dead
intervals are used (or BFD). For this and other reasons, planned
GR should be preferred whenever possible.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-05-08 21:47:44 -03:00
Donald Sharp
74e21732db ospfd: Fix memory leaks w/ show ip ospf int X json commands
FRR has a memory leak in the case when int X does not
exist and a memory leak when int X does exist.  Fix
these

Fixes: #13434
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-04 12:56:13 -04:00
Philippe Guibert
7b343a9ed5
Merge pull request #12933 from Orange-OpenSource/link_state
lib: Update edge key in link state database
2023-04-20 18:33:21 +02:00
Donatas Abraitis
5db1931962
Merge pull request #13166 from Jafaral/ospf-external-metric
ospfd: use rib metric as the base for set metric +/-
2023-04-19 21:11:25 +03:00
Russ White
59b2a1048f
Merge pull request #13236 from Orange-OpenSource/ospf-te
ospfd: Force Opaque LSA & co to default VRF
2023-04-18 08:32:20 -04:00
Olivier Dugeon
30ce6361b9 ospfd: Force Opaque LSA & co to default VRF
Ospf segfault when Router Information is enabled in a non default VRF,
see issue #13144.

This patch forces vrf_id to default VRF for Opaque LSA and extension based
on Opaque LSA: Router Information, Traffic Engineering, Extended Prefix,
Extended Link and Segment Routing. Indeed, non default VRF is not yet
supported for Opaque LSA & co.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2023-04-18 10:30:50 +02:00
Jafar Al-Gharaibeh
f61cd36ada ospfd: handle type-7 routes
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2023-04-18 00:48:16 -05:00
Jafar Al-Gharaibeh
055355e104 lib, ospfd, yang: add route map set for min/max metric
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2023-04-18 00:48:16 -05:00
Jafar Al-Gharaibeh
6af89f8f03 ospfd: use rib metric as the base for set metric +/-
When using route maps with external routes in OSPF as follows:
```
   set metric +10
 ```
The current behavior is to use the default ospf metric as the base and then add
to 10 to it. The behavior isn't useful as-is. A value 30 (20 dfeault + 10) can
be set directly instead. the behavior is also not consistent with bgp. bgp does
use the rib metric in this case as the base. The current behavior also doesn't
allow the metric to accumulate when crossing different routing domains such as
vrfs causing the metric to reset every time the route enters a new vrf with a new
ospf network.

This PR changes the behavior such that the rib metric is used as a base for
ospf exteral routes when used with `set metric -/+`

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2023-04-18 00:21:05 -05:00
Donatas Abraitis
eee1fca3eb
Merge pull request #13141 from mjstapp/fix_ospf_json_keys
ospfd: remove deprecated json attrs for neighbor show
2023-04-16 21:33:20 +03:00
Donald Sharp
13a1758a6a
Merge pull request #13177 from mjstapp/fix_ospf_supoort_typo
ospf,ospf6: fix json key typo supoort
2023-04-12 14:26:22 -04:00
Donald Sharp
6a5d103257
Merge pull request #13269 from Keelan10/ospf_lsa-memory-leak
ospfd: Fix ospf_lsa memory leak
2023-04-12 11:39:26 -04:00
Keelan10
c0ccfbfd45 ospfd: Fix ospf_lsa memory leak
Free translated LSA when LSA installation fails

Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
2023-04-12 13:52:08 +04:00
Mark Stapp
04a0401f2d ospfd: support write socket per interface
Add support for a write socket per interface, enabled by
default at the ospf instance level. An ospf instance-level
config allows this to be disabled, reverting to the older
behavior where a single per-instance socket is used for
sending and receiving packets.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-04-11 10:16:07 -04:00
Russ White
e80c797a1f
Merge pull request #13227 from mjstapp/ospf_sock_bufsizes
ospfd: support configuration of socket buffer sizes
2023-04-11 08:55:47 -04:00
Mark Stapp
a63fecfb56 ospf,ospf6: fix json key typo supoort
Fix json key 'supoort' -> 'support'; add 1-year deprecation
notice; fix topotests to use corrected json key.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-04-07 16:19:01 -04:00
Mark Stapp
f5419bf927 ospfd: remove deprecated json attrs for neighbor show
The date for removing some deprecated json attributes from
'show neighbor' has arrived, so remove the attrs (and the
CPP_NOTICE block).

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-04-07 16:17:59 -04:00
Olivier Dugeon
dad17a2195 ospfd: Update TE to new Link State Edge key
Following the modification of the edge key in link state database
this patch updates the ospf_te.c file to replace the old uint64_t edge key by
the new ls_edge_key structure. For ospf, only IPv4 address is take into
account.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2023-04-07 16:40:25 +02:00
Donald Sharp
b589466918 *: Use a struct prefix *p instead of a struct prefix in functions
When passing a prefix into a function let's pass by address instead
of pass by value.  Let's save our stack space.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-04-06 18:00:09 -04:00
Mark Stapp
6e6e1020dd ospfd: support configuration of socket buffer sizes
Add configurable socket send and receive buffer sizes,
configured at the instance level.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-04-06 14:16:43 -04:00
Russ White
4d0f3e819d
Merge pull request #13160 from chiragshah6/fdev2
ospfd:display correct DR-BDR router-id in nbr cmd
2023-04-04 10:02:48 -04:00
Russ White
4af5e39b2c
Merge pull request #12969 from opensourcerouting/ospfd-nssa
ospfd: implement NSSA default routes & ranges
2023-04-04 09:38:55 -04:00
Russ White
c0656e9040
Merge pull request #12837 from donaldsharp/unlikely_routemap
Unlikely routemap
2023-04-04 08:20:25 -04:00