Commit Graph

621 Commits

Author SHA1 Message Date
Donatas Abraitis
5fa2977d1e
Merge pull request #15953 from FRRouting/mergify/bp/stable/9.1/pr-15846
ospfd: fix the bug where ip_ospf_dead-interval_minimal_hello-multiplier did not reset hello timer (backport #15846)
2024-05-08 14:47:34 +03:00
Bing Shui
5001b8c926 ospfd:fix the bug where ip_ospf_dead-interval_minimal_hello-multiplier did not reset hello timer
Signed-off-by: Bing Shui <652023330037@smail.nju.edu.cn>
(cherry picked from commit d733fe2c04)
2024-05-07 13:59:39 +00:00
Donatas Abraitis
200eb7e92d vtysh: Show ip ospf network ... even if it's not the same as the interface type
ospfv3 shows this unconditionally, and ospfv2 does not show `ip ospf network ...` if the type of the interface matches the specified network.

Fixes: https://github.com/FRRouting/frr/issues/15817

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-04-29 16:32:26 +03:00
Bing Shui
b16d450360 ospfd: fix ospf dead-interval minimal hello-multiplier param range
Signed-off-by: Bing Shui <652023330037@smail.nju.edu.cn>
(cherry picked from commit a1793303c0)
2023-12-14 05:42:06 +00:00
teletajp
515a545026 ospfd: fix show_ip_ospf_gr_helper
Fix for the command "show ip ospf vrf NAME graceful-restart helper".
FRR did not show information by vrf's name.
If i have router ospf vrf red, vtysh's command
'show ip ospf vrf red graceful-restart helper' will not show anything.
But command 'show ip ospf vrf all graceful-restart helper' will work
normally. This fix fixes the display of information by vrf's name.

Example:
frr1# show ip ospf vrf vrf-1 graceful-restart helper
VRF Name: vrf-1

       OSPF Router with ID (192.168.255.81)

 Graceful restart helper support enabled.
 Strict LSA check is enabled.
 Helper supported for Planned and Unplanned Restarts.
 Supported Graceful restart interval: 1800(in seconds).

Signed-off-by: teletajp <teletajp@yandex.ru>
(cherry picked from commit 62754e1029)
2023-11-21 09:40:59 +00:00
Donatas Abraitis
f20879e6cb ospfd, ospf6d: Fix spacing nit for show ... summary-address command
```
r1# sh ipv6 ospf6 summary-address
VRF Name: default
aggregation delay interval :5(in seconds)
```

Just hit this random and looks ugly, let's fix it.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit ed2b593720)
2023-10-30 12:50:19 +00:00
Mahdi Varasteh
f5011cd5dd [ospfd]: add support for RFC 5709 HMAC-SHA Auth
This patch includes:
* Implementation of RFC 5709 support in OSPF. Using
openssl library and FRR key-chain,
one can use SHA1, SHA256, SHA384, SHA512 and
keyed-MD5( backward compatibility with RFC 2328) HMAC algs.
* Updating documentation of OSPF
* add topotests for new HMAC algorithms

Signed-off-by: Mahdi Varasteh <varasteh@amnesh.ir>
2023-09-16 07:38:23 +03:30
Alexander Chernavin
f050e57a2c ospfd: fix SPF calculation when changing ABR type
Currently, when changing ABR type on a working router, SPF recalculation
will only be initiated if the OSPF flags have changed after this.
Otherwise, SPF recalculation will be omitted and OSPF RIB update will
not occur. In other words, changing ABR type might not result in
inter-area routes addition/deletion.

With this fix, when ABR type is changed, the command handler initiates
SPF recalculation.

Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
2023-07-25 15:50:16 +00:00
Russ White
74630e42ef
Merge pull request #14056 from achernavin22/ospf-fix-def-metric-upd
ospfd: fix default-metric change if external LSAs already sent
2023-07-25 10:35:04 -04:00
Donatas Abraitis
3a58764e3a
Merge pull request #14034 from LabNConsulting/aceelindem/ospf_prefix_suppression
ospfd: Implement OSPF prefix-suppression as specified in RFC 6860
2023-07-21 10:14:22 +03:00
Acee
e2eea4fe8e ospfd: Implement OSPF prefix-suppression as specified in RFC 6860
Signed-off-by: Acee <aceelindem@gmail.com>
2023-07-20 14:56:43 -04:00
Alexander Chernavin
b1f759133b ospfd: fix default-metric change if external LSAs already sent
Currently, when redistribution of routes was configured, external LSAs
were already advertised to peers, and then default-metric is changed,
external LSAs refresh will not occur. In other words, the peers will not
receive the refreshed external LSAs with the new metric.

With this fix, changing default-metric will cause external LSAs to be
refreshed and flooded.

There is a similar task to refresh external LSAs when NSSA settings are
changed. And there is a function that accomplishes it -
ospf_schedule_asbr_nssa_redist_update(). Since the function does the
general work of refreshing external LSAs and is not specific to NSSA
settings, the idea is to give it a more general name and call it when
default-metric changes in order to fix the problem.

Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
2023-07-19 13:12:40 +00:00
Zhiyuan Wan
919b8f94b3 ospfd: Support show intra-area network type in 'show ip ospf route' command
User can now use 'show ip ospf route detail' command to distinguish
intra-area stub network and transit network.
Transit network will be displayed as 'N T prefix ...'.

NOTICE: Json output format has been changed, intra-area transit networks
will have a new attribute 'transit' and value is 'true'.
And 'adv' (means advertise router) change to 'advertisedRouter'.

Example output:

bsp-debianrt-exp1# show ip ospf route detail
Codes: N  - network     T - transitive
       IA - inter-area  E - external route
       D  - destination R - router

============ OSPF network routing table ============
N T  10.0.0.0/24           [32] area: 0.0.0.0
                           via 192.168.124.67, ens192
                           adv 10.0.0.5
N    10.0.30.0/24          [33] area: 0.0.0.0
                           via 192.168.124.67, ens192
                           adv 10.0.0.5
...

Signed-off-by: Zhiyuan Wan <h@iloli.bid>
2023-07-18 14:20:05 +08:00
Zhiyuan Wan
0ce2d1aaa1 ospfd: Support show advertise router in 'show ip ospf route' command
Users can now use 'show ip ospf route [detail]' command to show the
originator of each OSPF route item.

Signed-off-by: Zhiyuan Wan <h@iloli.bid>
2023-07-18 14:20:05 +08:00
Russ White
6e89a5db22
Merge pull request #13691 from LabNConsulting/aceelindem/ospf-opaque-interface-disable
ospfd: Configurable interface-level 'capability opaque' support
2023-07-11 11:47:32 -04:00
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
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
Acee
e72549c8f6 ospfd: Configurable interface-level 'capability opaque' support
Add support for "[no] ip ospf capbility opaque" at the interface
    level with the default being capability opaque enabled. The command
    "no ip ospf capability opaque" will disable opaque LSA database
    exchange and flooding on the interface. A change in configuration
    will result in the interface being flapped to update our options
    for neighbors but no attempt will be made to purge existing LSAs
    as in dense topologies, these may received by neighbors through
    different interfaces.

    Topotests are added to test both the configuration and the LSA
    opaque flooding suppression.

Signed-off-by: Acee <aceelindem@gmail.com>
2023-06-28 13:03:48 -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
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
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
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
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
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
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
Sindhu Parvathi Gopinathan
d3aef77fa9 ospfd:display correct DR-BDR router-id in nbr cmd
ospf neighbor DR and BDR router-id wrongly displays with interface
ip-address instead of router-id.

It is fixed to display the correct DR & BDR router-id  for
JSON and CLI commands.

Commands:
```
show ip ospf vrf <vrf-name> neighbor detail json
show ip ospf vrf <vrf-name> neighbor detail
```

Before Fix:-
```
r1# show ip ospf vrf default neighbor  swp1 detail
 Neighbor 0.0.0.17, interface address 11.0.0.1
    In the area 0.0.0.0 via interface swp1 local interface IP 11.0.0.2
    Neighbor priority is 1, State is Full, Role is DR, 6 state changes
    Most recent state change statistics:
      Progressive change 1d15h05m ago
    DR is 11.0.0.1, BDR is 11.0.0.2 ======> DR and BDR shows the intef &
local intf ipaddress
    Options 2 *|-|-|-|-|-|E|-
    Dead timer due in 35.178s
    Database Summary List 0
    Link State Request List 0
    Link State Retransmission List 0
    Thread Inactivity Timer on
    Thread Database Description Retransmision off
    Thread Link State Request Retransmission on
    Thread Link State Update Retransmission on

r1#

r1# show ip ospf vrf default neighbor  swp1 detail json
{
  "0.0.0.17":[
    {
      "ifaceAddress":"11.0.0.1",
      "areaId":"0.0.0.0",
      "ifaceName":"swp1",
      "localIfaceAddress":"11.0.0.2",
      "nbrPriority":1,
      "nbrState":"Full",
      "role":"DR",
      "stateChangeCounter":6,
      "lastPrgrsvChangeMsec":141141533,
      "routerDesignatedId":"11.0.0.1", =============> interface ip
instead of DR rotuer-id
      "routerDesignatedBackupId":"11.0.0.2", =======> lo-interface ip
instead of BDR rotuer-id
      "optionsCounter":2,
      "optionsList":"*|-|-|-|-|-|E|-",
      "routerDeadIntervalTimerDueMsec":32272,
      "databaseSummaryListCounter":0,
      "linkStateRequestListCounter":0,
      "linkStateRetransmissionListCounter":0,
      "threadInactivityTimer":"on",
      "threadLinkStateRequestRetransmission":"on",
      "threadLinkStateUpdateRetransmission":"on"
    }
  ]
}
r1#
```

After Fix:-
```
r1# show ip ospf vrf default neighbor detail json
{
  "default":{
    "vrfName":"default",
    "vrfId":0,
    "neighbors":{
      "0.0.0.17":[
        {
          "ifaceAddress":"11.0.0.1",
          "areaId":"0.0.0.0",
          "ifaceName":"swp1",
          "localIfaceAddress":"11.0.0.2",
          "nbrPriority":1,
          "nbrState":"Full",
          "role":"DR",
          "stateChangeCounter":6,
          "lastPrgrsvChangeMsec":4531505,
          "routerDesignatedId":"0.0.0.17", =====> DR Router-Id
          "routerDesignatedBackupId":"0.0.0.12", =====> BDR Router-Id
          "optionsCounter":2,
          "optionsList":"*|-|-|-|-|-|E|-",
          "routerDeadIntervalTimerDueMsec":38495,
          "databaseSummaryListCounter":0,
          "linkStateRequestListCounter":0,
          "linkStateRetransmissionListCounter":0,
          "threadInactivityTimer":"on",
          "threadLinkStateRequestRetransmission":"on",
          "threadLinkStateUpdateRetransmission":"on"
        }
      ],
      "0.0.0.13":[
        {
          "ifaceAddress":"11.0.2.2",
          "areaId":"0.0.0.0",
          "ifaceName":"swp2",
          "localIfaceAddress":"11.0.2.1",
          "nbrPriority":1,
          "nbrState":"Full",
          "role":"DR",
          "stateChangeCounter":6,
          "lastPrgrsvChangeMsec":4522182,
          "routerDesignatedId":"0.0.0.13", =====> DR Router-Id
          "routerDesignatedBackupId":"0.0.0.12", =====> BDR Router-Id
          "optionsCounter":2,
          "optionsList":"*|-|-|-|-|-|E|-",
          "routerDeadIntervalTimerDueMsec":37840,
          "databaseSummaryListCounter":0,
          "linkStateRequestListCounter":0,
          "linkStateRetransmissionListCounter":0,
          "threadInactivityTimer":"on",
          "threadLinkStateRequestRetransmission":"on",
          "threadLinkStateUpdateRetransmission":"on"
        }
      ],
      "0.0.0.14":[
        {
          "ifaceAddress":"11.0.3.2",
          "areaId":"0.0.0.0",
          "ifaceName":"swp3",
          "localIfaceAddress":"11.0.3.1",
          "nbrPriority":1,
          "nbrState":"Full",
          "role":"DR",
          "stateChangeCounter":6,
          "lastPrgrsvChangeMsec":4522182,
          "routerDesignatedId":"0.0.0.14",  =====> DR Router-Id
          "routerDesignatedBackupId":"0.0.0.12", =====> BDR Router-Id
          "optionsCounter":2,
          "optionsList":"*|-|-|-|-|-|E|-",
          "routerDeadIntervalTimerDueMsec":37840,
          "databaseSummaryListCounter":0,
          "linkStateRequestListCounter":0,
          "linkStateRetransmissionListCounter":0,
          "threadInactivityTimer":"on",
          "threadLinkStateRequestRetransmission":"on",
          "threadLinkStateUpdateRetransmission":"on"
        }
      ]
    }
  }
}
r1#

r1# show ip ospf vrf default neighbor swp1 detail
 Neighbor 0.0.0.17, interface address 11.0.0.1
    In the area 0.0.0.0 via interface swp1 local interface IP 11.0.0.2
    Neighbor priority is 1, State is Full, Role is DR, 6 state changes
    Most recent state change statistics:
      Progressive change 1h18m11s ago
    DR is  0.0.0.17, BDR is 0.0.0.12  =======> correct DR and BDR
router-id
    Options 2 *|-|-|-|-|-|E|-
    Dead timer due in 38.339s
    Database Summary List 0
    Link State Request List 0
    Link State Retransmission List 0
    Thread Inactivity Timer on
    Thread Database Description Retransmision off
    Thread Link State Request Retransmission on
    Thread Link State Update Retransmission on

r1#

r1# show ip ospf vrf default neighbor swp
swp1  swp2  swp3  swp4
r1# show ip ospf vrf default neighbor swp2 detail
 Neighbor 0.0.0.13, interface address 11.0.2.2
    In the area 0.0.0.0 via interface swp2 local interface IP 11.0.2.1
    Neighbor priority is 1, State is Full, Role is DR, 6 state changes
    Most recent state change statistics:
      Progressive change 12m02s ago
    DR is 0.0.0.13, BDR is 0.0.0.12 =======> correct DR and BDR
router-id
    Options 2 *|-|-|-|-|-|E|-
    Dead timer due in 37.136s
    Database Summary List 0
    Link State Request List 0
    Link State Retransmission List 0
    Thread Inactivity Timer on
    Thread Database Description Retransmision off
    Thread Link State Request Retransmission on
    Thread Link State Update Retransmission on

r1#
```

Ticket:#3395270

Issue:3395270

Testing: UT done

Signed-off-by: Sindhu Parvathi Gopinathan's <sgopinathan@nvidia.com>
2023-04-02 18:42:57 -07:00
Renato Westphal
f07ff222f8 ospfd: add support for NSSA Type-7 address ranges
Implement NSSA address ranges as specified by RFC 3101:

   NSSA border routers may be configured with Type-7 address ranges.
   Each Type-7 address range is defined as an [address,mask] pair.  Many
   separate Type-7 networks may fall into a single Type-7 address range,
   just as a subnetted network is composed of many separate subnets.
   NSSA border routers may aggregate Type-7 routes by advertising a
   single Type-5 LSA for each Type-7 address range.  The Type-5 LSA
   resulting from a Type-7 address range match will be distributed to
   all Type-5 capable areas.

Syntax:
  area A.B.C.D nssa range A.B.C.D/M [<not-advertise|cost (0-16777215)>]

Example:
  router ospf
   router-id 1.1.1.1
   area 1 nssa
   area 1 nssa range 172.16.0.0/16
   area 1 nssa range 10.1.0.0/16
  !

Since regular area ranges and NSSA ranges have a lot in common,
this commit reuses the existing infrastructure for area ranges as
much as possible to avoid code duplication.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-03-31 19:28:15 -03:00
Renato Westphal
4312d66f9f ospfd: refactor range commands
* Update the "range" helpers to accept an area pointer instead of
  an area ID;
* Always call ospf_area_display_format_set() after every "range"
  command to ensure consistency.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-03-31 19:28:15 -03:00
Renato Westphal
017714e3ad ospfd: implement Type-7 default routes for NSSA areas
Add the "default-information-originate" option to the "area X nssa"
command. That option allows the origination of Type-7 default routes
on NSSA ABRs and ASBRs.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-03-31 19:28:15 -03:00
Renato Westphal
e85194f572 ospfd: refactor the "area nssa" command using DEFPY
Combine all variation of the "area nssa" command into a single
DEFPY to improve code maintainability.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-03-31 19:28:15 -03:00
Donald Sharp
24a58196dd *: Convert event.h to frrevent.h
We should probably prevent any type of namespace collision
with something else.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
e16d030c65 *: Convert THREAD_XXX macros to EVENT_XXX macros
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
4f830a0799 *: Convert thread_timer_remain_XXX to event_timer_remain_XXX
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
cb37cb336a *: Rename thread.[ch] to event.[ch]
This is a first in a series of commits, whose goal is to rename
the thread system in FRR to an event system.  There is a continual
problem where people are confusing `struct thread` with a true
pthread.  In reality, our entire thread.c is an event system.

In this commit rename the thread.[ch] files to event.[ch].

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:16 -04:00
Renato Westphal
f54232d0b2 ospfd: Fix inconsistency in LSDB JSON output
As it can be seen below, the LSDB JSON output varies depending
whether a filter option is specified or not (e.g. "adv-router",
"self-originate"):

> show ip ospf database router json
{
  "routerId":"3.3.3.3",
  "routerLinkStates":{
    "areas":{
      "0.0.0.0":[
        {
          "lsaAge":175,
          "options":"*|-|-|-|-|-|E|-",
          [snip]

> show ip ospf database router adv-router 2.2.2.2 json
{
  "routerId":"3.3.3.3",
  "Router Link States":{
    "0.0.0.0":{
      "2.2.2.2":{
        "lsaAge":193,
        "options":"*|-|-|-|-|-|E|-",
        [snip]

This inconsistency is undesirable since it makes this data harder to
consume programmatically. Also, in the second output, "Router Link
States" is used as a JSON key, which doesn't conform to our JSON
guidelines (JSON keys need to be camelCased).

Make the required changes to ensure the first output structure is used,
regardless if any output filter is used or not.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-03-17 23:00:31 -03:00
Renato Westphal
a08f41b95b ospfd: Add "detail" option to "show ip ospf database"
This option is useful to dump detailed information about the LSDB using
a single command (instead of one command per LSA type).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-03-17 23:00:31 -03:00
Renato Westphal
b131b1ed9c ospfd: Refactor the "show ip ospf database" command
Combine all variations of this command into a single DEFPY to
improve maintainability. No behavioral changes intended.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-03-17 23:00:17 -03:00
Donatas Abraitis
ba995a720b
Merge pull request #12751 from Pdoijode/pdoijode/ospf-vrf-neighbor-detail-1
ospfd: Added missing fields and option to query specific neighbor in VRF
2023-02-24 11:56:28 +02:00
Russ White
62bd2580e3
Merge pull request #12366 from manojvn/ospfv2-flood-reduction
ospfd: Support OSPF Refresh and Flooding Reduction RFC4136.
2023-02-21 08:03:06 -05:00
David Lamparter
acddc0ed3c *: auto-convert to SPDX License IDs
Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:11 +01:00
Pooja Jagadeesh Doijode
2e86198322 ospfd: Fix "show ip ospf neighbor swp1 detail json" output
1. When OSPF unnumbered neighbor doesn't exist in any VRF,
   OSPFD prints a bunch of empty JSON objects. Fixed it
   by adding an outer JSON object with VRF information in it
2. Added "vrf" option to this command so that per VRF
   unnumbered OSPF neighbor information can be retrieved

JSON output:
    nl1# show ip ospf neighbor swp1 detail json
        {
          "default":{
          },
          "vrf1012":{
          },
          "vrf1013":{
          },
          "vrf1014":{
          }
        }

    nl1# show ip ospf vrf vrf1012 neighbor swp4.2 detail json
        {
          "9.9.12.10":[
            {
              "ifaceAddress":"200.254.2.46",
              "areaId":"0.0.0.0",
              "ifaceName":"swp4.2",
              "localIfaceAddress":"200.254.2.45",
              "nbrPriority":1,
              "nbrState":"Full",
              "role":"DR",
              "stateChangeCounter":6,
              "lastPrgrsvChangeMsec":1462758,
              "routerDesignatedId":"200.254.2.46",
              "routerDesignatedBackupId":"200.254.2.45",
              "optionsCounter":2,
              "optionsList":"*|-|-|-|-|-|E|-",
              "routerDeadIntervalTimerDueMsec":37140,
              "databaseSummaryListCounter":0,
              "linkStateRequestListCounter":0,
              "linkStateRetransmissionListCounter":0,
              "threadInactivityTimer":"on",
              "threadLinkStateRequestRetransmission":"on",
              "threadLinkStateUpdateRetransmission":"on"
            }
          ]
        }
        nl1#

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2023-02-08 14:34:06 -08:00
Pooja Jagadeesh Doijode
a8e6c2c6d0 ospfd: Option to query specific neighbor in VRF
Added VRF option to
"show ip ospf [vrf NAME] neighbor X.X.X.X [detail] [json]"
command so that the user can query information regarding a
specific neighbor within a VRF.

r1# show ip ospf vrf default neighbor 10.0.255.2
10.0.255.2        1 Full/-          33m10s             9.891s 10.0.3.2        r1-eth1:10.0.3.4                     0     0     0

r1# show ip ospf vrf default neighbor 10.0.255.2 json
    {
      "10.0.255.2":[
        {
          "priority":1,
          "state":"Full/-",
          "nbrPriority":1,
          "nbrState":"Full/-",
          "converged":"Full",
          "role":"DROther",
          "upTimeInMsec":13877947,
          "deadTimeMsecs":9498,
          "routerDeadIntervalTimerDueMsec":9498,
          "upTime":"3h51m17s",
          "deadTime":"9.498s",
          "address":"10.0.3.2",
          "ifaceAddress":"10.0.3.2",
          "ifaceName":"r1-eth1:10.0.3.4",
          "retransmitCounter":0,
          "linkStateRetransmissionListCounter":0,
          "requestCounter":0,
          "linkStateRequestListCounter":0,
          "dbSummaryCounter":0,
          "databaseSummaryListCounter":0
        }
      ]
    }
r1# show ip ospf vrf default neighbor 10.0.255.2 detail
     Neighbor 10.0.255.2, interface address 10.0.3.2
        In the area 0.0.0.0 via interface r1-eth1 local interface IP 10.0.3.4
        Neighbor priority is 1, State is Full/-, Role is DROther, 5 state changes
        Most recent state change statistics:
          Progressive change 3h51m27s ago
        DR is 0.0.0.0, BDR is 0.0.0.0
        Options 2 *|-|-|-|-|-|E|-
        Dead timer due in 8.458s
        Database Summary List 0
        Link State Request List 0
        Link State Retransmission List 0
        Thread Inactivity Timer on
        Thread Database Description Retransmision off
        Thread Link State Request Retransmission on
        Thread Link State Update Retransmission on

        Graceful restart Helper info:
          Graceful Restart HELPER Status : None

r1# show ip ospf vrf default neighbor 10.0.255.2 detail json
    {
      "10.0.255.2":[
        {
          "ifaceAddress":"10.0.3.2",
          "areaId":"0.0.0.0",
          "ifaceName":"r1-eth1",
          "localIfaceAddress":"10.0.3.4",
          "nbrPriority":1,
          "nbrState":"Full/-",
          "role":"DROther",
          "stateChangeCounter":5,
          "lastPrgrsvChangeMsec":13889856,
          "routerDesignatedId":"0.0.0.0",
          "routerDesignatedBackupId":"0.0.0.0",
          "optionsCounter":2,
          "optionsList":"*|-|-|-|-|-|E|-",
          "routerDeadIntervalTimerDueMsec":9715,
          "databaseSummaryListCounter":0,
          "linkStateRequestListCounter":0,
          "linkStateRetransmissionListCounter":0,
          "threadInactivityTimer":"on",
          "threadLinkStateRequestRetransmission":"on",
          "threadLinkStateUpdateRetransmission":"on",
          "grHelperStatus":"None"
        }
      ]
    }
r1#

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2023-02-07 15:29:31 -08:00