Commit graph

112 commits

Author SHA1 Message Date
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 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
Francois Dumontet c1e57dc4bd ospf6d: add localLinkLocalAddress field
add localIfaceAdress field in show ipv6 ospf6 neighbor detail json
command.

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-03-07 14:33:47 +01:00
Donald Sharp 84877e60db ospf6d: Value set is never used
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-09 13:03:43 -05:00
David Lamparter 484608f065 ospf6d: fix uninitialized value warning in p2xp
GCC is complaining prev_cost may be used uninitialized.  It really
can't, but let's get rid of the warning.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-17 14:42:28 +01: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
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 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 65e955890c ospf6d: allow configuring PtP neighbors & cost
Add a list of configured neighbors for each interface.  Only stores cost
(and "existence") for now.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-10-10 07:57:43 +10:00
David Lamparter 73940e52f2 ospf6d: factor out link-local addr change
For PtMP the cost may need to be recalculated when the LL addr changes
(since neighbors are configured by LL addr and a different entry with a
different cost may match.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-10-10 07:54:56 +10:00
Donald Sharp 0cbd5855a9 ospf6d: Convert ospf6_lsa_unlock to a better api
Make the ospf6_lsa_unlock take the same parameters
that the ospf_lsa_unlock does to make it consistent
and to also ensure that no-one can make the mistake
of getting the pointer cleared up.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-07-12 17:56:29 -04:00
Donald Sharp 77e838eb9a ospf6d: Fix crash because neighbor structure was freed
The loading_done event needs a event pointer to prevent
use after free's.  Testing found this:

    ERROR: AddressSanitizer: heap-use-after-free on address 0x613000035130 at pc 0x55ad42d54e5f bp 0x7ffff1e942a0 sp 0x7ffff1e94290
    READ of size 1 at 0x613000035130 thread T0
        #0 0x55ad42d54e5e in loading_done ospf6d/ospf6_neighbor.c:447
        #1 0x55ad42ed7be4 in event_call lib/event.c:1995
        #2 0x55ad42e1df75 in frr_run lib/libfrr.c:1213
        #3 0x55ad42cf332e in main ospf6d/ospf6_main.c:250
        #4 0x7f5798133c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
        #5 0x55ad42cf2b19 in _start (/usr/lib/frr/ospf6d+0x248b19)

    0x613000035130 is located 48 bytes inside of 384-byte region [0x613000035100,0x613000035280)
    freed by thread T0 here:
        #0 0x7f57998d77a8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7a8)
        #1 0x55ad42e3b4b6 in qfree lib/memory.c:130
        #2 0x55ad42d5d049 in ospf6_neighbor_delete ospf6d/ospf6_neighbor.c:180
        #3 0x55ad42d1e1ea in interface_down ospf6d/ospf6_interface.c:930
        #4 0x55ad42ed7be4 in event_call lib/event.c:1995
        #5 0x55ad42ed84fe in _event_execute lib/event.c:2086
        #6 0x55ad42d26d7b in ospf6_interface_clear ospf6d/ospf6_interface.c:2847
        #7 0x55ad42d73f16 in ospf6_process_reset ospf6d/ospf6_top.c:755
        #8 0x55ad42d7e98c in clear_router_ospf6_magic ospf6d/ospf6_top.c:778
        #9 0x55ad42d7e98c in clear_router_ospf6 ospf6d/ospf6_top_clippy.c:42
        #10 0x55ad42dc2665 in cmd_execute_command_real lib/command.c:994
        #11 0x55ad42dc2b32 in cmd_execute_command lib/command.c:1053
        #12 0x55ad42dc2fa9 in cmd_execute lib/command.c:1221
        #13 0x55ad42ee3cd6 in vty_command lib/vty.c:591
        #14 0x55ad42ee4170 in vty_execute lib/vty.c:1354
        #15 0x55ad42eec94f in vtysh_read lib/vty.c:2362
        #16 0x55ad42ed7be4 in event_call lib/event.c:1995
        #17 0x55ad42e1df75 in frr_run lib/libfrr.c:1213
        #18 0x55ad42cf332e in main ospf6d/ospf6_main.c:250
        #19 0x7f5798133c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

    previously allocated by thread T0 here:
        #0 0x7f57998d7d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
        #1 0x55ad42e3ab22 in qcalloc lib/memory.c:105
        #2 0x55ad42d5c8ff in ospf6_neighbor_create ospf6d/ospf6_neighbor.c:119
        #3 0x55ad42d4c86a in ospf6_hello_recv ospf6d/ospf6_message.c:464
        #4 0x55ad42d4c86a in ospf6_read_helper ospf6d/ospf6_message.c:1884
        #5 0x55ad42d4c86a in ospf6_receive ospf6d/ospf6_message.c:1925
        #6 0x55ad42ed7be4 in event_call lib/event.c:1995
        #7 0x55ad42e1df75 in frr_run lib/libfrr.c:1213
        #8 0x55ad42cf332e in main ospf6d/ospf6_main.c:250
        #9 0x7f5798133c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Add an actual event pointer and just track it appropriately.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-07-01 13:23:08 -04: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 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
Donatas Abraitis ba427e6348 ospfd, ospf6d: Add more logging details
Basically just router-id or interface/IP.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-03-17 10:14:26 +02: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
Manoj Naragund 47cd634819 ospf6d: Fixing memory leak in ospf6_lsa_create_headeronly for both master and slave.
Problem Statement:
=================
Memory leak backtraces

2022-11-23 01:51:10,525 - ERROR: ==842== 1,100 (1,000 direct, 100 indirect) bytes in 5 blocks are definitely lost in loss record 29 of 31
2022-11-23 01:51:10,525 - ERROR: ==842==    at 0x4C31FAC: calloc (vg_replace_malloc.c:762)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x4E8A1BF: qcalloc (memory.c:111)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x13555A: ospf6_lsa_alloc (ospf6_lsa.c:723)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x1355F3: ospf6_lsa_create_headeronly (ospf6_lsa.c:756)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x135702: ospf6_lsa_copy (ospf6_lsa.c:790)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x13B64B: ospf6_dbdesc_recv_slave (ospf6_message.c:976)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x13B64B: ospf6_dbdesc_recv (ospf6_message.c:1038)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x13B64B: ospf6_read_helper (ospf6_message.c:1838)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x13B64B: ospf6_receive (ospf6_message.c:1875)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x4EB741B: thread_call (thread.c:1692)
2022-11-23 01:51:10,526 - ERROR: ==842==    by 0x4E85B17: frr_run (libfrr.c:1068)
2022-11-23 01:51:10,526 - ERROR: ==842==    by 0x119585: main (ospf6_main.c:228)
2022-11-23 01:51:10,526 - ERROR: ==842==

2022-11-23 01:51:10,524 - ERROR: Found memory leak in module ospf6d
2022-11-23 01:51:10,525 - ERROR: ==842== 220 (200 direct, 20 indirect) bytes in 1 blocks are definitely lost in loss record 21 of 31
2022-11-23 01:51:10,525 - ERROR: ==842==    at 0x4C31FAC: calloc (vg_replace_malloc.c:762)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x4E8A1BF: qcalloc (memory.c:111)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x13555A: ospf6_lsa_alloc (ospf6_lsa.c:723)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x1355F3: ospf6_lsa_create_headeronly (ospf6_lsa.c:756)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x135702: ospf6_lsa_copy (ospf6_lsa.c:790)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x13BBCE: ospf6_dbdesc_recv_master (ospf6_message.c:760)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x13BBCE: ospf6_dbdesc_recv (ospf6_message.c:1036)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x13BBCE: ospf6_read_helper (ospf6_message.c:1838)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x13BBCE: ospf6_receive (ospf6_message.c:1875)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x4EB741B: thread_call (thread.c:1692)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x4E85B17: frr_run (libfrr.c:1068)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x119585: main (ospf6_main.c:228)
2022-11-23 01:51:10,525 - ERROR: ==842==

RCA:
====
These memory leaks are beacuse of last lsa in neighbour's request_list is not
getting freed beacuse of lsa lock. The last request has an addtional lock which
is added as a part of ospf6_make_lsreq, this lock needs to be removed
in order for the lsa to get freed.

Fix:
====
Check and remove the lock on the last request in all the functions.

Signed-off-by: Manoj Naragund <mnaragund@vmware.com>
2022-12-19 04:15:36 -08: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 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
anlan_cs d6b901ac78 ospf6d: give error information for commands with non-exist vrfs
Currently the ospf6d's commands with non-exist vrfs can't give the error
informations to users.

This commit adds a macro "OSPF6_CMD_CHECK_VRF" to give error information
if with non-exist vrfs. As usual, skip the checking process in the case
of json.

So one command can call this macro to do the checking process in its
end. At that time it need know json style or not, so add "json" parameter for
several related functions.

BTW, suppress the build warning of the macro `OSPF6_FIND_VRF_ARGS`:
"Macros starting with if should be enclosed by a do - while loop to avoid
possible if/else logic defects."

Signed-off-by: anlan_cs <anlan_cs@tom.com>
2022-01-11 04:21:05 -05:00
Donatas Abraitis c48349e346 *: Remove redundand braces for single statement blocks
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-27 11:20:59 +02:00
Donatas Abraitis 5a6c232bf8 ospf6d: Convert vty_out to vty_json for JSON
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-25 17:50:37 +02:00
David Lamparter 067967b8c7 ospfd6d: replace handler vector with array
No point in using the vector code for this really.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-16 13:34:46 +01:00
Donald Sharp 81e06dd3c3 ospf6d: Prevent crash in adj_ok
The adj_ok thread event is being added but not killed
when the underlying interface is deleted.  I am seeing
this crash:

OSPF6: Received signal 11 at 1636142186 (si_addr 0x0, PC 0x561d7fc42285); aborting...
OSPF6: zlog_signal+0x18c                  7f227e93519a     7ffdae024590 /lib/libfrr.so.0 (mapped at 0x7f227e884000)
OSPF6: core_handler+0xe3                  7f227e97305e     7ffdae0246b0 /lib/libfrr.so.0 (mapped at 0x7f227e884000)
OSPF6: funlockfile+0x50                   7f227e863140     7ffdae024800 /lib/x86_64-linux-gnu/libpthread.so.0 (mapped at 0x7f227e84f000)
OSPF6:     ---- signal ----
OSPF6: need_adjacency+0x10                561d7fc42285     7ffdae024db0 /usr/lib/frr/ospf6d (mapped at 0x561d7fbc6000)
OSPF6: adj_ok+0x180                       561d7fc42f0b     7ffdae024dc0 /usr/lib/frr/ospf6d (mapped at 0x561d7fbc6000)
OSPF6: thread_call+0xc2                   7f227e989e32     7ffdae024e00 /lib/libfrr.so.0 (mapped at 0x7f227e884000)
OSPF6: frr_run+0x217                      7f227e92a7f3     7ffdae024ec0 /lib/libfrr.so.0 (mapped at 0x7f227e884000)
OSPF6: main+0xf3                          561d7fc0f573     7ffdae024fd0 /usr/lib/frr/ospf6d (mapped at 0x561d7fbc6000)
OSPF6: __libc_start_main+0xea             7f227e6b0d0a     7ffdae025010 /lib/x86_64-linux-gnu/libc.so.6 (mapped at 0x7f227e68a000)
OSPF6: _start+0x2a                        561d7fc0f06a     7ffdae0250e0 /usr/lib/frr/ospf6d (mapped at 0x561d7fbc6000)
OSPF6: in thread adj_ok scheduled from ospf6d/ospf6_interface.c:678 dr_election()

The crash is in the on->ospf6_if pointer is NULL.  The only way this could
happen from what I can tell is that the event is added to the system
and then we immediately delete the interface, removing the memory
but not freeing up the adj_ok thread event.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-05 18:00:10 -04:00
Donald Sharp 9318fc6a38 ospf6d: Prevent use after free
I am seeing a crash of ospf6d with this stack trace:

OSPF6: Received signal 11 at 1636042827 (si_addr 0x0, PC 0x55efc2d09ec2); aborting...
OSPF6: zlog_signal+0x18c                  7fe20c8ca19a     7ffd08035590 /lib/libfrr.so.0 (mapped at 0x7fe20c819000)
OSPF6: core_handler+0xe3                  7fe20c90805e     7ffd080356b0 /lib/libfrr.so.0 (mapped at 0x7fe20c819000)
OSPF6: funlockfile+0x50                   7fe20c7f8140     7ffd08035800 /lib/x86_64-linux-gnu/libpthread.so.0 (mapped at 0x7fe20c7e4000)
OSPF6:     ---- signal ----
OSPF6: ospf6_neighbor_state_change+0xdc     55efc2d09ec2     7ffd08035d90 /usr/lib/frr/ospf6d (mapped at 0x55efc2c8e000)
OSPF6: exchange_done+0x15c                55efc2d0ab4a     7ffd08035dc0 /usr/lib/frr/ospf6d (mapped at 0x55efc2c8e000)
OSPF6: thread_call+0xc2                   7fe20c91ee32     7ffd08035df0 /lib/libfrr.so.0 (mapped at 0x7fe20c819000)
OSPF6: frr_run+0x217                      7fe20c8bf7f3     7ffd08035eb0 /lib/libfrr.so.0 (mapped at 0x7fe20c819000)
OSPF6: main+0xf3                          55efc2cd7573     7ffd08035fc0 /usr/lib/frr/ospf6d (mapped at 0x55efc2c8e000)
OSPF6: __libc_start_main+0xea             7fe20c645d0a     7ffd08036000 /lib/x86_64-linux-gnu/libc.so.6 (mapped at 0x7fe20c61f000)
OSPF6: _start+0x2a                        55efc2cd706a     7ffd080360d0 /usr/lib/frr/ospf6d (mapped at 0x55efc2c8e000)
OSPF6: in thread exchange_done scheduled from ospf6d/ospf6_message.c:2264 ospf6_dbdesc_send_newone()

The stack trace when decoded is:

(gdb) l *(ospf6_neighbor_state_change+0xdc)
0x7bec2 is in ospf6_neighbor_state_change (ospf6d/ospf6_neighbor.c:200).
warning: Source file is more recent than executable.
195				   on->name, ospf6_neighbor_state_str[prev_state],
196				   ospf6_neighbor_state_str[next_state],
197				   ospf6_neighbor_event_string(event));
198		}
199
200		/* Optionally notify about adjacency changes */
201		if (CHECK_FLAG(on->ospf6_if->area->ospf6->config_flags,
202			       OSPF6_LOG_ADJACENCY_CHANGES)
203		    && (CHECK_FLAG(on->ospf6_if->area->ospf6->config_flags,
204				   OSPF6_LOG_ADJACENCY_DETAIL)

OSPFv3 is creating the event without a managing thread and as such
if the event is not run before a deletion event comes in memory
will be freed up and we'll start trying to access memory we should
not.  Modify ospfv3 to track the thread and appropriately stop
it when the memory is deleted or it is no longer need to run
that bit of code.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-05 18:00:07 -04:00
Renato Westphal a526c05525 ospf6d: declare neighbor memtype as static
This is the only ospf6d memtype that wasn't being declared as static.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-10-05 21:21:43 -03:00
Donatas Abraitis f2b64253b8 ospf6d: Do not explicitly set the thread pointer to NULL
FRR should only ever use the appropriate THREAD_ON/THREAD_OFF
semantics.  This is espacially true for the functions we
end up calling the thread for.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-04 19:29:06 +03:00
Renato Westphal 7116509803 ospf6d: introduce support for Graceful Restart (restarting mode)
RFC 5187 specifies the Graceful Restart enhancement to the OSPFv3
routing protocol. This commit implements support for the GR
restarting mode.

Here's a quick summary of how the GR restarting mode works:
* GR can be enabled on a per-instance basis using the `graceful-restart
  [grace-period (1-1800)]` command;
* To perform a graceful shutdown, the `graceful-restart prepare ipv6
  ospf` EXEC-level command needs to be issued before restarting the
  ospf6d daemon (there's no specific requirement on how the daemon
  should be restarted);
* `graceful-restart prepare ospf` will initiate the graceful restart
  for all GR-enabled instances by taking the following actions:
  o Flooding Grace-LSAs over all interfaces
  o Freezing the OSPF routes in the RIB
  o Saving the end of the grace period in non-volatile memory (a JSON
    file stored in `$frr_statedir`)
* Once ospf6d is started again, it will follow the procedures
  described in RFC 3623 until it detects it's time to exit the graceful
  restart (either successfully or unsuccessfully).

Testing done:
* New topotest featuring a multi-area OSPF topology (including stub
  and NSSA areas);
* Successful interop tests against IOS-XR routers acting as helpers.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-16 12:26:48 -03:00
Igor Ryzhov 175c92e67e ospf6d: cleanup useless checks
om6->ospf6 is always initialized at the start of the execution.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-09-15 19:21:47 +03:00
rgirada 0fc3e11323 ospf6d: GR helper configurations
Description:
	Adding the following cli commands to enable/disable GR helper
	functionality.
	1. [no] graceful-restart helper-only [A.B.C.D]
	2. [no] graceful-restart helper lsa-check-disable
	3. [no] graceful-restart helper planned-only
	4. [no] graceful-restart helper supported-grace-time (10-1800)

	show commands:
	show ipv6 ospf6 graceful-restart helper [detail] [json]

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-08-11 23:06:49 -07:00
rgirada 0d1753a7db ospf6d: Helper functionality changes
Description:
	1. changes to process GRACE LSA packet.
	2. Validation changes to enter Helper role.
	3. Helper functionality during graceful restart.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-08-10 02:57:23 -07:00
Russ White 590303a029
Merge pull request #8878 from idryzhov/fix-ospf6-neighbor-detail
ospf6d: fix "show ipv6 ospf6 neighbor" command
2021-06-22 11:27:17 -04:00
Igor Ryzhov ee3e6d7ff3 ospf6d: fix "show ipv6 ospf6 neighbor" command
Simplify the logic and fix processing of "detail" and "drchoice"
arguments.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-21 18:42:49 +03:00
Yash Ranjan bc09f3e6bb ospf6d: Release last dbdesc packet after router dead interval
During the database description exchange process, the slave
releases the last dbdesc packet after router_dead_interval.
This was not implemented in the code.
I have written the function ospf6_neighbor_last_dbdesc_release,
which releases the last dbdesc packet after router_dead_interval.
This change was required as per the conformance test 13.11:

In state Full reception of a Database Description packet from
the master after this interval (RouterDeadInterval) will
generate a SeqNumberMismatch neighbor event.

Associated Parameters
  ICMPv6 Packet Listen Time
  ICMPv6 Packet Tolerance Factor
  ICMPv6 Packet Tolerance Time
  OSPFV3 DUT Interface Transmit Delay
  OSPF Reset Adjacencies Timeout
Test Actions
1.
2. 3.
ANVL: Establish full adjacency with DUT for neighbor Rtr-0-A on DIface-0, with DUT as slave.
ANVL: Wait (for <RouterDeadInterval> seconds).
ANVL: Send <OSPF-DD> packet from neighbor Rtr-0-A to DIface-0 con- taining:
• •
I-bit field not set M-bit field not set
MS-bit field set
DD sequence number same as the one last sent by ANVL.

. ANVL: Listen (for upto 2 * <RxmtInterval> seconds) on DIface-0.
5. DUT: Trigger the event SeqNumberMismatch and set the neighbor state for neighbor Rtr-0-A to ExStart.
6. DUT: Send <OSPF-DD> packet.
7. ANVL: Verify that the received <OSPF-DD> packet contains:
• I-bit field set
• M-bit field set
• MS-bit field set.

Test Reference
• RFC 5340, s4.2.1.2 p19 Sending Database Description Packets
  RFC 2328, s10.8 p104 Sending Database Description Packets.

Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2021-06-19 11:17:24 -07:00
harios_niral d48ef099db ospf6d: add vty support for multiple vrfs
Co-authored-by: Kaushik Nath <kaushiknath.null@gmail.com>
Signed-off-by: harios_niral <hari@niralnetworks.com>
2021-05-06 10:54:31 +03:00
Rafael Zalamena d06cc41644 ospf6d: rework BFD integration
Use the new BFD library to integrate with BFD.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-04-22 16:10:01 -03:00
David Lamparter 30043e4ce2 ospf6d: kill ospf6_memory.h, use MTYPE_STATIC
Same as other commits -- convert most DEFINE_MTYPE into the _STATIC
variant, and move the remaining non-static ones to appropriate places.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-22 19:31:56 +01:00
David Lamparter 8451921b70 *: require semicolon after DEFINE_HOOK & co.
See previous commit.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17 06:18:17 +01:00
Yash Ranjan 786b76d03a ospf6d: Router-ID filter is not filtering the show command "do show ipv6 ospf6 neighbour A.B.C.D"
Compare the neighbour id string from the arguments to the router_id of
the neighbor. If equal then call the show function.

Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2020-12-04 04:15:30 -08:00
github login name 6a5bb30062 ospf6d: Json support added for command "show ipv6 ospf6 neighbor [json]"
Modify code to add JSON format output in show command
"show ipv6 ospf6 neighbor" with proper formating

Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2020-11-04 22:44:21 -08:00
harios_niral beadc736bb ospf6d : Transformation changes for ospf6 vrf support.
1. All the changes are related to handle ospf6 with different vrf.
2. The dependancy of global ospf6 is removed.

Co-authored-by: Kaushik <kaushik@niralnetworks.com>
Signed-off-by: harios_niral <hari@niralnetworks.com>
2020-10-30 23:50:08 -07:00
Donald Sharp 2e37407f9d ospf6d, tests: Prevent use after free
The code pattern:

for (ALL_LSDB(lsdb, lsa)) {
	remove_lsa(lsa)
}

has a use after free in ALL_LSDB, since we ask for the next pointer,
after it has been freed.

Modify the code such that we grab the next pointer before we can
possibly free it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-10-11 11:16:44 -04:00
Donald Sharp e2e60c48bf ospf6d: Revert "ospf6d: Prevent use after free"
This reverts commit 0f9f74baeb.

This commit was causing crashes and the goal of this commit
was to make coverity sanity happy.  I'd rather have coverity
sad and not have ospfv3 crash

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-05-14 15:35:19 -04:00
David Lamparter 2b64873d24 *: generously apply const
const const const your boat, merrily down the stream...

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-02 15:01:29 +01:00