Commit graph

659 commits

Author SHA1 Message Date
Mark Stapp 0561943a78 ospfd: clean up -Wshadow warnings
Clean up various "shadow" warnings.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
anlan_cs 533d387a7f ospfd: fix wrong check for two commands
The users would know the failure of some case for the two commands, just
return the error ```CMD_WARNING_CONFIG_FAILED```.

Signed-off-by: anlan_cs <anlan_cs@126.com>
2025-01-07 10:58:03 +08:00
Acee Lindem 6afd56da96 ospfd: OSPF multi-instance default origination fixes
When originating a default AS-External LSA in one OSPF instance,
it wasn't working if the criteria route was installed by another OSPF
instance. This required more flexible processing of the OSPF external
route information.

Also fix problem multi-instance display for "show ip ospf
 <instance> database ...".

Signed-off-by: Acee Lindem <acee@lindem.com>
2024-11-17 13:33:48 +00:00
Russ White 408decfd77
Merge pull request #17319 from opensourcerouting/fix/no_ospf_router-id
ospfd: Use router_id what Zebra has if we remove a static router_id
2024-11-05 10:19:44 -05:00
Russ White 77632a7ec3
Merge pull request #17194 from LabNConsulting/aceelindem/ospf-ls-refresh-interval-fix
ospfd: Fix opaque LSA refresh interval and modify LSA cmds.
2024-11-01 11:37:32 -04:00
Donatas Abraitis 80bfe6784f ospfd: Add a hidden command for old no router-id
A new command is `ospf router-id ...`, but the old one is also valid. Just a no
form was missed.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-31 11:37:49 +02:00
Donatas Abraitis cf6a575cbd
Merge pull request #17189 from Shbinging/fix_some_ospf_unset_commands_syntax
ospfd:fix syntax of some ospf no commands
2024-10-29 10:43:53 +02:00
Acee Lindem c735f25abb ospfd: Fix opaque LSA refresh interval and modify LSA cmds.
The configured OSPF refresh interval was not being used for opaque LSA (it always used the constant). Also, modified the timers lsa min-arrival command to have a maximum of 5000 msecs as well as providing a path for backward command compatibility.

Added missing user documentation for both timers lsa min-arrival and timers throttle lsa all.

Signed-off-by: Acee Lindem <acee@lindem.com>
2024-10-25 14:31:10 +00:00
Shbinging 03649ffde3 ospfd:fix syntax of some no commands
Fix syntax of the following no commands:
1. `no area virtual link A.B.C.D hello-interval <NUM>`, `<NUM>` can be omitted.
2. `no area nssa default-information-originate metric <NUM>`, `<NUM>` can be omitted.
3. `no area nssa range cost <NUM>`, `<NUM>` can be omitted.
4. `no area default cost <NUM>`, `<NUM>` can be omitted.
5. `no ospf write-multiplier <NUM>`, `<NUM>` can be omitted.
6. `no default-information originate metric <NUM>`, `<NUM>` can be omitted.
7. `no distance <NUM>`, `<NUM>` can be omitted.

Signed-off-by: Shbinging <bingshui@smail.nju.edu.cn>
2024-10-23 06:01:57 +00:00
Shbinging baf604770e ospfd:fix the bug that the empty area was not free after no area range command was executed
When we use the no area X.X.X.X range A.B.C.D/M command, if the area no longer has an interface to which it belongs, then the area should be deleted from the LSDB. This processing logic is consistent with instructions such as no network area and no area authentication.

Signed-off-by: Shbinging <bingshui@smail.nju.edu.cn>
2024-10-22 05:34:36 +00:00
Donatas Abraitis 5fecb1f425
Merge pull request #17065 from Shbinging/fix_some_ospf_commands
ospfd: fix some ospf commands
2024-10-17 09:01:30 +03:00
Shbinging 774788d4c8 ospfd: fix no area shortcut MODE command, MODE can be default
Signed-off-by: Shbinging <bingshui@smail.nju.edu.cn>
2024-10-16 04:39:20 +00:00
Shbinging af0d1355c7 ospfd:fix the bug that the empty area was not free after the command was executed
When we use the no area X.X.X.X range A.B.C.D/M command, if the area no longer has an interface to which it belongs, then the area should be deleted from the LSDB. This processing logic is consistent with instructions such as no network area and no area authentication.

Signed-off-by: Shbinging <bingshui@smail.nju.edu.cn>
2024-10-15 08:10:52 +00:00
Shbinging 972308b174 ospfd: fix no_area_range_cost_NUM command, NUM can be omitted
Signed-off-by: Shbinging <bingshui@smail.nju.edu.cn>
2024-10-11 09:52:16 +00:00
Russ White e17a9834ea
Merge pull request #16853 from Shbinging/no_ip_ospf_dead_interval_minimal
ospfd: fix snytax of some no commands
2024-09-24 10:03:29 -04:00
Shbinging 4a26e53495 ospfd: reset spf_hold_multiplier when current SPF delay state is changed
Signed-off-by: Shbinging <bingshui@smail.nju.edu.cn>
2024-09-23 14:57:15 +08:00
Shbinging d2c59d68c4 ospfd: fix no ospf abr-type syntax
Signed-off-by: Shbinging <bingshui@smail.nju.edu.cn>
2024-09-20 15:06:22 +08:00
Shbinging be32e8afba ospfd: fix no ip ospf dead-interval minimal hello-multiplier syntax
Signed-off-by: Shbinging <bingshui@smail.nju.edu.cn>
2024-09-18 15:39:55 +08:00
Dmitrii Turlupov 69e31a547f ospfd: fix missing '[no]ip ospf graceful-restart hello-delay <N>' commands
Signed-off-by: Dmitrii Turlupov <turlupov@bk.ru>
2024-09-13 16:26:04 +03:00
Acee e42e58118f ospfd: Fix SA warnings in ospf_packet.c and ospf_vty.c
Fix SA warnings in ospf_packet.c and ospf_vty.c. The former was
    introduced by commit ed48014884.

Signed-off-by: Acee <aceelindem@gmail.com>
2024-08-16 13:49:41 -04:00
Donald Sharp baa0a1df5b *: Fix spelling errors found
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-15 09:19:37 -04:00
Acee Lindem c494702929 ospfd: Improve OSPF neighbor retransmission list granularity and precision
The current OSPF neighbor retransmission operates on a single per-neighbor
periodic timer that sends all LSAs on the list when it expires.
Additionally, since it skips the first retransmission of received LSAs so
that at least the retransmission interval (resulting in a delay of between
the retransmission interval and twice the interval. In environments where
the links are lossy on P2MP networks with "delay-reflood" configured (which
relies on neighbor retransmission in partial meshs), the implementation
is sub-optimal (to say the least).

This commit reimplements OSPF neighbor retransmission as follows:

   1. A new data structure making use the application managed
      typesafe.h doubly linked list implements an OSPF LSA
      list where each node includes a timestamp.
   2. The existing neighbor LS retransmission LSDB data structure
      is augmented with a pointer to the list node on the LSA
      list to faciliate O(1) removal when the LSA is acknowledged.
   3. The neighbor LS retransmission timer is set to the expiration
      timer of the LSA at the top of the list.
   4. When the timer expires, LSAs are retransmitted that within
      the window of the current time and a small delta (50 milli-secs
      default). The LSAs that are retransmited are given an updated
      retransmission time and moved to the end of the LSA list.
   5. Configuration is added to set the "retransmission-window" to a
      value other than 50 milliseconds.
   6. Neighbor and interface LSA retransmission counters are added
      to provide insight into the lossiness of the links. However,
      these will increment quickly on non-fully meshed P2MP networks
      with "delay-reflood" configured.
   7. Added a topotest to exercise the implementation on a non-fully
      meshed P2MP network with "delay-reflood" configured. The
      alternative was to use existing mechanisms to instroduce loss
      but these seem less determistic in a topotest.

Signed-off-by: Acee Lindem <acee@lindem.com>
2024-06-20 15:31:07 +00:00
Donatas Abraitis e8f5caa21b ospfd: Fix memory leak after cleaning cleaning up interfaceIp JSON field
```
=================================================================
==6717==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1008 byte(s) in 14 object(s) allocated from:
    0 0x7f9ea0dc7d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    1 0x7f9ea034d51f in json_object_new_object (/lib/x86_64-linux-gnu/libjson-c.so.3+0x351f)
    2 0x564b56d0fed6 in show_ip_ospf_interface_common ospfd/ospf_vty.c:4011
    3 0x564b56d1068c in show_ip_ospf_interface ospfd/ospf_vty.c:4285
    4 0x7f9ea06fe1c0 in cmd_execute_command_real lib/command.c:1002
    5 0x7f9ea06fe684 in cmd_execute_command lib/command.c:1060
    6 0x7f9ea06feb03 in cmd_execute lib/command.c:1227
    7 0x7f9ea08415b2 in vty_command lib/vty.c:616
    8 0x7f9ea0841a5d in vty_execute lib/vty.c:1379
    9 0x7f9ea084b367 in vtysh_read lib/vty.c:2374
    10 0x7f9ea08350cd in event_call lib/event.c:2011
    11 0x7f9ea0764386 in frr_run lib/libfrr.c:1217
    12 0x564b56c25b18 in main ospfd/ospf_main.c:295
    13 0x7f9e9fd5bc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 7168 byte(s) in 14 object(s) allocated from:
    0 0x7f9ea0dc7d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    1 0x7f9ea0350fa4 in lh_table_new (/lib/x86_64-linux-gnu/libjson-c.so.3+0x6fa4)

Indirect leak of 1232 byte(s) in 14 object(s) allocated from:
    0 0x7f9ea0dc7d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    1 0x7f9ea0350f82 in lh_table_new (/lib/x86_64-linux-gnu/libjson-c.so.3+0x6f82)

SUMMARY: AddressSanitizer: 9408 byte(s) leaked in 42 allocation(s).
***********************************************************************************
```

Fixes: e24ff4c275 ("ospfd: Drop `interfaceIp` from `show ip ospf neigh json")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-06-12 16:28:38 +03:00
Donatas Abraitis e24ff4c275 ospfd: Drop interfaceIp from show ip ospf neigh json
Deprecated. Now it's under interface field directly:

```
{
  "interfaces":{
    "enp3s0":{
      "ifUp":true,
      "ifIndex":2,
      "mtuBytes":1500,
      "bandwidthMbit":100,
      "ifFlags":"<UP,LOWER_UP,BROADCAST,RUNNING,MULTICAST>",
      "ospfEnabled":true,
      "ipAddress":"192.168.10.19",
      "ipAddressPrefixlen":24,
      "ospfIfType":"Broadcast",
      "localIfUsed":"192.168.10.255",
      "area":"0.0.0.0",
      "routerId":"100.100.100.100",
      "networkType":"POINTOPOINT",
      "cost":1000,
      "transmitDelaySecs":1,
      "state":"Point-To-Point",
      "priority":1,
      "opaqueCapable":true,
      "mcastMemberOspfAllRouters":true,
      "timerMsecs":10000,
      "timerDeadSecs":40,
      "timerWaitSecs":40,
      "timerRetransmitSecs":5,
      "timerHelloInMsecs":2924,
      "nbrCount":0,
      "nbrAdjacentCount":0,
      "grHelloDelaySecs":10,
      "prefixSuppression":false,
      "nbrFilterPrefixList":"N\/A"
    }
  }
}
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-06-11 11:59:37 +03:00
anlan_cs d15cc4741b ospfd: add instance id for one command
Add the specific instance id for the command:
```
show ip ospf [{(1-65535)$instance|vrf <NAME|all>}] graceful-restart helper [detail] [json]
```

Signed-off-by: anlan_cs <anlan_cs@tom.com>
2024-05-25 19:44:39 +08:00
Russ White 5fe0c5923b
Merge pull request #15846 from Shbinging/fix_ip_ospf_dead_interval_fast_hello
ospfd: fix the bug where ip_ospf_dead-interval_minimal_hello-multiplier did not reset hello timer
2024-05-07 09:58:29 -04:00
Bing Shui d733fe2c04 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>
2024-04-30 12:07:11 +00:00
Donald Sharp edae839119
Merge pull request #15824 from opensourcerouting/fix/ospf_show_non_default
vtysh: Show `ip ospf network ...` even if it's not the same as the interface type
2024-04-29 09:21:09 -04:00
Donatas Abraitis 0d0350aef0
Merge pull request #15783 from LabNConsulting/aceelindem/ospf-neighbor-filter
ospfd: Add prefix-list filtering of OSPF neighbors on OSPF interface
2024-04-24 22:30:11 +03:00
Donatas Abraitis 1ce626aea6 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-23 17:13:46 +03:00
Acee Lindem 0ccad8a2b0 ospfd: Add prefix-list filtering of OSPF neighbors on OSPF interface
This commit adds the capabiity to filter OSPF neighbors using a
prefix-list with rules matching the neighbor's IP source address.
Configuration, filtering, immediate neighbor pruning, topo-tests,
and documentation are included. The command is:

     ip ospf neighbor-filter <prefix-list> [A.B.C.D]

Signed-off-by: Acee Lindem <acee@lindem.com>
2024-04-18 15:32:58 +00:00
Bing Shui 913567c0e0 ospfd: fix 'no write-multiplier' command
Signed-off-by: Bing Shui <652023330037@smail.nju.edu.cn>
2024-04-17 10:41:11 +00:00
Bing Shui d249a7c9f5 ospfd: fix 'no maximum-paths' command
Signed-off-by: Bing Shui <652023330037@smail.nju.edu.cn>
2024-04-17 10:39:02 +00:00
Donatas Abraitis 8f7bc620b5 ospfd, ospf6d: Remove deprecated JSON fields
restartSupoort

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-04-11 13:34:17 +03:00
Acee Lindem 58e623714b ospfd: Implement non-broadcast support for point-to-multipoint networks
This extends non-broadcast support to point-to-multipoint networks.
Neighbors will be explicitly configured and polled in lieu of multicast
dicovery. Toptotests and documentation updates are included.

Additionally, the ospf neighbor commands have been greatly simplified taking
advantage of DEFPY() capabilities.

The AllOSPFRouters (224.0.0.5) is still joined for non-broadcast networks
since it is joined for NBMA networks. It seems this could be removed but
it should done be in a separate commit.

Signed-off-by: Acee Lindem <acee@lindem.com>
2024-04-02 21:34:29 +00:00
Igor Ryzhov c1b4976786 *: use af-specific autocompletion for prefix-lists when possible
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-04 22:26:48 +02:00
Bing Shui a1793303c0 ospfd: fix ospf dead-interval minimal hello-multiplier param range
Signed-off-by: Bing Shui <652023330037@smail.nju.edu.cn>
2023-12-13 22:23:58 +08:00
Donatas Abraitis 77ff93b8f5
Merge pull request #14710 from teletajp/fix_show_ospf_gr_helper_cmd
ospfd:fix show_ip_ospf_gr_helper
2023-11-21 11:39:31 +02:00
teletajp 62754e1029 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>
2023-11-15 16:18:46 +03:00
Donald Sharp 6de9f7fbf5 *: Move distance related defines into their own header
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-11-07 06:47:51 -05:00
Mark Stapp b6b16d99f7
Merge pull request #14688 from opensourcerouting/fix/ospf_spacing_nit
ospfd, ospf6d: Fix spacing nit for `show ... summary-address` command
2023-10-30 08:49:03 -04:00
Donatas Abraitis 73914a3e73
Merge pull request #13576 from chiragshah6/mdev1
zebra:returns empty dict when evpn is disabled II
2023-10-30 08:55:49 +02:00
Donatas Abraitis ed2b593720 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>
2023-10-30 08:40:19 +02:00
Chirag Shah 43443e828a *: modify empty json helper function
Modify empty json object to take input obj
instead of allocating always one.

There are situation where in error condition or no data
case print empty json (`{}`) with already allocated

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2023-10-29 11:20:37 -07: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