Commit graph

264 commits

Author SHA1 Message Date
Acee Lindem 04994891fe ospf6d: Disable and delete OSPFv3 areas that no longer have interfaces or configuration.
This fix will delete an OSPFv3 area when all the interfaces and
        configuration (ranges, NSSA ranges, stub area, NSSA area, filter-list,
        import-list and export-list) have been removed. The changes provides
        a general solution to https://github.com/FRRouting/frr/issues/18324.

Signed-off-by: Acee Lindem <acee@lindem.com>
2025-03-14 16:02:28 +00:00
Andrew Cooks 89e18bfad1 ospf6d: move lsa structs to ospf6_lsa.h
It will be cleaner to have the LSAs in a single header and the future
TLVs in a single header.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16 18:38:16 +10:00
Andrew Cooks 7c9a79f182 ospf6d: factor out generic TLV handling
In preperation for Extended LSA types and their TLVs, factor out the TLV
handling from the Gracefull Restart functionality.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16 18:38:16 +10:00
David Lamparter 52734fc8e5 ospf6d: accept CLI no for point-to-multipoint
`point-to-multipoint` was missing on the removal variant of this CLI
command.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-04-25 12:20:27 +02:00
David Lamparter d7f54c4d56 ospf6d: force recalculate on interface_up
interface_up also handles changes to the interface type, i.e. broadcast
to ptp to ptmp.  Connected routes for these are different and must be
readvertised, which is done in ospf6_interface_recalculate_cost() - but
only if the cost changed.  Use the force variant here.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-04-25 12:18:08 +02:00
David Lamparter 4aa200c7c5 ospf6d: fix loopback/ptp/ptmp conn. route checks
The code emitting connected routes was checking against the interface
state (which can also be lo/ptp/ptmp) rather than the interface type.
This was causing wrong IA prefixes for connected routes getting put up
out if the interface was down intermittently.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-04-25 12:16:35 +02:00
David Lamparter b47657600b ospf6d: fix DEFUN formatting wrecked by clang
clang-format doesn't understand `DEFUN` and formats it rather ugly.
Standard approach was to skip these in clang-format, which hasn't
happened here sadly.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-04-25 11:45:19 +02: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
David Lamparter 8b23c0b0bd *: convert struct interface->connected to DLIST
Replace `struct list *` with `DLIST(if_connected, ...)`.

NB: while converting this, I found multiple places using connected
prefixes assuming they were IPv4 without checking:

- vrrpd/vrrp.c: vrrp_socket()
- zebra/irdp_interface.c: irdp_get_prefix(), irdp_if_start(),
  irdp_advert_off()

(these fixes are really hard to split off into separate commits as that
would require going back and reapplying the change but with the old list
handling)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-22 23:00:30 +01:00
Donatas Abraitis d46c4e9402 ospf6d: Let the user override interface cost for a loopback
Fixes: 80dfa9e012 ("ospf6d: Set loopback interface cost to 0")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-11-13 21:19:54 +02:00
David Lamparter d889055d8e lib: convert if_zapi_callbacks into actual hooks
...so that multiple functions can be subscribed.

The create/destroy hooks are renamed to real/unreal because that's what
they *actually* signal.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-02 17:10:43 -07:00
Donald Sharp 8e3a96e846
Merge pull request #14546 from adrianomarto/ospf6-point-to-multipoint
OSPF6 point to multipoint
2023-10-31 18:20:04 -04:00
Adriano Marto Reis f83a824bbd ospf6: Applying clang-format
Applying clang-format to the original commits.

Signed-off-by: Adriano Marto Reis <adrianomarto@gmail.com>
2023-10-28 16:36:47 +10:00
Donatas Abraitis 80dfa9e012 ospf6d: Set loopback interface cost to 0
https://www.rfc-editor.org/rfc/rfc5340.html#page-37 states:

If the interface type is point-
      to-multipoint or the interface is in the state Loopback, the
      global scope IPv6 addresses associated with the interface (if any)
      are copied into the intra-area-prefix-LSA with the PrefixOptions
      LA-bit set, the PrefixLength set to 128, and the metric set to 0.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-10-26 07:39:28 +03:00
David Lamparter dfe3af42d2 ospf6d: connected prefix toggle for PtP/PtMP
To announce connected prefixes, or not to announce connected prefixes,
that is the question...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-10-10 08:09:42 +10:00
David Lamparter 5c0eed0c85 ospf6d: add point-to-multipoint interface mode
This adds the PtMP interface type, which is effectively identical to PtP
except that all the database flooding & updates are unicast.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-10-10 08:08:20 +10:00
David Lamparter 0c58d83688 ospf6d: support unicast hellos on PtP/PtMP
Some lower layers still don't handle multicast correctly (or
efficiently.)  Add option to send unicast hellos on explicitly
configured neighbors for PtP/PtMP.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-10-10 08:07:52 +10:00
David Lamparter 3d1482a945 ospf6d: option to disable multicast hellos
With the configured neighbor list, unicast hellos can be sent.  Allow
disabling multicast hellos for that scenario.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-10-10 08:00:08 +10:00
David Lamparter f5917bae53 ospf6d: option to restrict PtP neighbor list
This adds a knob to refuse forming adjacencies with neighbors not listed
in the config.  Only works on PtP/PtMP of course, otherwise the DR/BDR
machinery gets broken.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-10-10 07:58:21 +10:00
David Lamparter 6fdd69ed07 ospf6d: advertise local addresses with LA bit
Both for virtual links and correct PtMP operation, advertising local
addresses as Intra-Prefix with LA set is a prerequisite.  Add the
appropriate entries.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-10-10 07:54:39 +10:00
Mark Stapp adca5c22c5 * : include event ptr in event_execute api
Include an event ptr-to-ptr in the event_execute() api
call, like the various schedule api calls. This allows the
execute() api to cancel an existing scheduled task if that
task is being executed inline.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-07-25 10:17:48 -04:00
David Ward 4a1696818f ospf6d: Prevent redundant LSA generation before interface goes down
Commit 76249532fa ("ospf6d: Handle Premature Aging of LSAs") added a
duplicate call to OSPF6_INTRA_PREFIX_LSA_EXECUTE_TRANSIT(), when the
interface state changes to "Down".

Fixes: #1738

Signed-off-by: David Ward <david.ward@ll.mit.edu>
2023-05-31 16:44:44 -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 88b3d5e514 ospf6d: 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 ospf6d daemon dies, for as long as the configured grace
period (the defaults is 120 seconds). Similarly, ospf6d 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 ospf6d is exiting.  Once ospf6d 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 ospf6d 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 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 5f6eaa9b96 *: Convert a bunch of thread_XX to event_XX
Convert these functions:

thread_getrusage
thread_cmd_init
thread_consumed_time
thread_timer_to_hhmmss
thread_is_scheduled
thread_ignore_late_timer

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp 8c1186d38e *: Convert thread_execute to event_execute
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp 332beb64b8 *: Convert thread_cancelXXX to event_cancelXXX
Modify the code base so that thread_cancel becomes event_cancel

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp 907a2395f4 *: Convert thread_add_XXX functions to event_add_XXX
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp e6685141aa *: Rename struct thread to struct event
Effectively a massive search and replace of
`struct thread` to `struct event`.  Using the
term `thread` gives people the thought that
this event system is a pthread when it is not

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 e23e568319 ospf6d: update DR election to handle GR corner case
Consider the case where a DR router is performing a graceful restart,
and all neighbors attached to the DR network have their priorities
set to zero.

According to RFC 3623, the router should reclaim its DR status while
coming back up once it receives a Hello packet from a neighbor
listing the router as the DR, and the associated interface is in
Waiting state.

The problem arises when the DR election starts. Since the router
is already elected the DR, and no BDR will be elected (since all
neighbors have their priorities set to zero), the AdjOk event won't
be triggered at the end of the DR election as it would normally
happen. That causes all neighbors reachable over the broadcast
interface to get stuck in the 2-Way state.

Fix this corner case by always triggering the AdjOk event at the
end of the DR election process when a GR is in progress. Triggering
the AdjOk event when not necessary should never be a problem as
the neighbor FSM is already prepared to deal with that.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-03-02 19:38:03 -03: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
Donald Sharp 6354d63593 ospf6d: Fix auth_key string memory leak
When using auth keys in ospfv3, there are some memory
leaks when you change the key or remove the interface

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-15 11:15:33 -05:00
Donald Sharp 21c6569d6f ospf6d: Don't allocate json memory in non-json path
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-09 08:38:50 -05:00
Jafar Al-Gharaibeh 25bc53234d
Merge pull request #12280 from opensourcerouting/fix/ospv6_show_passive_interface
ospf6d: Show if the interface is passive for `show ipv6 ospf6 interface`
2022-11-08 23:25:39 -06:00
Donatas Abraitis 0b280b334c
Merge pull request #11302 from punith-shivakumar/master
ospf6d: add missing ABR task on interface start and change default task delay to 5
2022-11-08 21:28:30 +02:00
Donatas Abraitis 93bae5f81f ospf6d: Show if the interface is passive for show ipv6 ospf6 interface
donatas-pc# sh ipv6 ospf6 interface enp3s0
enp3s0 is up, type BROADCAST
  Interface ID: 2
  Internet Address:
    inet : 192.168.10.17/24
    inet6: fe80::ca5d:fd0d:cd8:1bb7/64
  Instance ID 0, Interface MTU 1500 (autodetect: 1500)
  MTU mismatch detection: enabled
  Area ID 0.0.0.0, Cost 1000
  State Waiting, Transmit Delay 1 sec, Priority 1
  Timer intervals configured:
   Hello 10(8.149), Dead 40, Retransmit 5
  DR: 0.0.0.0 BDR: 0.0.0.0
  Number of I/F scoped LSAs is 1
    0 Pending LSAs for LSUpdate in Time 00:00:00 [thread off]
    0 Pending LSAs for LSAck in Time 00:00:00 [thread off]
  Authentication Trailer is disabled
donatas-pc# con
donatas-pc(config)# int enp3s0
donatas-pc(config-if)# ipv6 ospf6 passive
donatas-pc(config-if)# do sh ipv6 ospf6 interface enp3s0
enp3s0 is up, type BROADCAST
  Interface ID: 2
  Internet Address:
    inet : 192.168.10.17/24
    inet6: fe80::ca5d:fd0d:cd8:1bb7/64
  Instance ID 0, Interface MTU 1500 (autodetect: 1500)
  MTU mismatch detection: enabled
  Area ID 0.0.0.0, Cost 1000
  State Waiting, Transmit Delay 1 sec, Priority 1
  Timer intervals configured:
   No Hellos (Passive interface)
  DR: 0.0.0.0 BDR: 0.0.0.0
  Number of I/F scoped LSAs is 1
    0 Pending LSAs for LSUpdate in Time 00:00:00 [thread off]
    0 Pending LSAs for LSAck in Time 00:00:00 [thread off]
  Authentication Trailer is disabled
donatas-pc(config-if)#

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-11-08 09:37:19 +02:00
Donald Sharp 0b368b50dd
Merge pull request #11785 from opensourcerouting/fix/remove_ospf6Enabled_from_JSON
ospf6d: Remove ospf6Enabled from JSON output
2022-08-12 20:29:47 -04:00
Donatas Abraitis 97b4474de1 ospf6d: Remove ospf6Enabled from JSON output
Time to deprecate it.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-08-11 17:32:24 +03:00
anlan_cs 4f0d3f3e8a ospf6d: fix missing cost change
After all needed interfaces ( for example: interface "a1", vrf "vrf1", and
"a1" is binded to "vrf1" ) are ready/created, then restart/start frr. zebra
at startup will call `netlink_interface()` to process all interfaces and notify
all clients, but its calling `get_iflink_speed()` maybe fails for unexpected
order of the coming interfaces: when processing "a1", "vrf1" maybe is unknown
at that time. `if_zebra_speed_update()` timer is introduced to deal with this
order problem.

Currently only ospfd and ospf6d deal with this speed change to recalculated
route cost. ospfd can deal with this change, but ospf6d will wrongly missed it.

Since both `ipv6 ospf6 cost COST` and `auto-cost reference-bandwidth COST` are
not set, cost of this ospf6 interface should be calculated with interface
speed, but it is wrongly kept to `10`, which is based on interface speed being
`0` for it missed speed change. Further, ECMP function becomes invalid after
restart frr, beacuse some ospf6 interfaces of one ECMP are wrongly with cost
`10`.

To avoid missing, recalculate cost for ospf6 interfaces based on potentially
changed speed.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-08-11 08:12:30 -04:00
Punith Kumar S a7c1a27f0e ospf6d: routes are not synced by ABR.
topology: C1--R1---R2---R3--C2
client C1 connected to router node R1
client C2 connected to router node R3
router nodes R1,R2 and R3 are back to back connected

area 0 configured between R1 and R2
R1: all routes of area 0 are learnt successfully
R2: all routes of area 0 are learnt successfully

area 1 configured between R2 and R3
R2: all routes are learnt from R3
R3: routes learnt from C1 on ABR router R2 does not get forward to R3

root cause: on interface start, ABR schedule task is missing.

fix: handle ABR schedule during interface start event

Signed-off-by: Punith Kumar S <punith.shivakumar@sophos.com>
2022-07-13 09:51:16 +00:00
Donald Sharp 7aa77e557b ospf6d: cost is uint32_t so it cannot be greater than UINT32_MAX
Remove the extra test.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-16 16:31:35 -04:00
Donald Sharp c905f04c7c ospf6d: Clean up thread interface
a) Remove setting of thread pointer to NULL after
thread invocation, this is already done.

b) Use thread_is_scheduled()

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-05-20 09:52:16 -04:00
Donald Sharp 578e092a04 ospf6d: Ensure the ospf6 interface hello timer pops in all cases
If a end users does something like this:

int enp39s0
  ipv6 ospf6 hello-interval 65535

And then the timer pops and we send the hello and immediately
if the end user does this:

  ipv6 ospf6 hello-interval 5

The timer is not being reset and FRR waits the full 65k seconds
before sending the hello again, which then immediately sets
the next hello to go out in 5 seconds.

When FRR receives the new timer value, look at how much time
is left on the timer in seconds.  If this value is greater
than the new hello timer, stop the timer and set it too that
value.

This should fix a CI system test failure found, where the
system is testing setting timer from things like 12 seconds
to 65k seconds then back down to 12 and that the ospf6 neighbor
relationship stays up.

The code was also changed from thread_add_event to thread_add_timer
in all cases.  I am not sure what would happen if a show command
comes in for a thread timer remaining with an event instead of a timer
just make it consistent.

This was chased down because the support bundle showed this:
r0# show ipv6 ospf6 vrf all interface
r0-r1-eth0 is up, type BROADCAST
  Interface ID: 6
  Internet Address:
    inet6: fe80::a4ea:d3ff:fe35:cef1/64
    inet6: fd00::1/64
  Instance ID 0, Interface MTU 1500 (autodetect: 1500)
  MTU mismatch detection: enabled
  Area ID 0.0.0.0, Cost 10
  State DR, Transmit Delay 1 sec, Priority 1
  Timer intervals configured:
   Hello 12(65480.960), Dead 48, Retransmit 5

And looking at the test code is doing stuff like this:
2022/05/16 17:08:15 OSPF6: [M7Q4P-46WDR] vty[5]@(config)# interface r1-r0-eth0

2022/05/16 17:08:15 OSPF6: [M7Q4P-46WDR] vty[5]@(config-if)# ipv6 ospf6 hello-interval 65535

2022/05/16 17:08:15 OSPF6: [M7Q4P-46WDR] vty[5]@(config-if)# no ipv6 ospf6 hello-interval
2022/05/16 17:08:16 OSPF6: [M7Q4P-46WDR] vty[5]@(config-if)# ipv6 ospf6 hello-interval 1
2022/05/16 17:08:16 OSPF6: [M7Q4P-46WDR] vty[5]@(config-if)# ipv6 ospf6 hello-interval 12

If the old timer value pops, the hello interval is set to 65k and never reset again.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-05-16 17:52:10 -04:00
Donald Sharp 6290bec97e ospf6d: Give time left in hello timer for show ipv6 ospf6 int
When running `show ipv6 ospf6 interface` the hello timer period
is shown, but there is no indication on how much time is left
on the timer.  Add a clue:

sharpd@eva ~/frr5 (master)> vtysh -c "show ipv6 ospf6 int"
enp39s0 is up, type BROADCAST
  Interface ID: 2
  Internet Address:
    inet : 192.168.119.224/24
    inet6: 2603:6080:602:509e:9a14:998:b154:9e9/64
  Instance ID 0, Interface MTU 1500 (autodetect: 1500)
  MTU mismatch detection: enabled
  Area ID 0.0.0.0, Cost 1000
  State DR, Transmit Delay 1 sec, Priority 1
  Timer intervals configured:
   Hello 10(2.652), Dead 40, Retransmit 5
  DR: 192.168.122.1 BDR: 0.0.0.0
  Number of I/F scoped LSAs is 1
    0 Pending LSAs for LSUpdate in Time 00:00:00 [thread off]
    0 Pending LSAs for LSAck in Time 00:00:00 [thread off]
  Authentication Trailer is disabled

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-05-16 11:06:29 -04:00
Donald Sharp bd4f51b10f *: Fix spelling of specifed
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-04-19 08:12:43 -04:00
Donald Sharp cc9f21da22 *: Change thread->func to return void instead of int
The int return value is never used.  Modify the code
base to just return a void instead.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-23 19:56:04 -05:00
Abhinay Ramesh 6cb85350df ospf6d: Stitching the auth trailer code with rest of ospf6.
Problem Statement:
==================
RFC 7166 support for OSPF6 in FRR code.

RCA:
====
This feature is newly supported in FRR

Fix:
====
Core functionality implemented in previous commit is
stitched with rest of ospf6 code as part of this commit.

Risk:
=====
Low risk

Tests Executed:
===============
Have executed the combination of commands.

Signed-off-by: Abhinay Ramesh <rabhinay@vmware.com>
2022-02-09 01:57:08 +00:00