Commit Graph

1212 Commits

Author SHA1 Message Date
Donald Sharp
6926bedfb3 ospf6d: Fix debug string in rare case
When looking up the o_path->ls_prefix if it is not found
the debug statement was using a buf that was never initialized.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-21 07:54:54 -04:00
Donald Sharp
9ffafdd76b ospf6d: Always pre-init all header values to 0
When making the ospf6 header, let's actually fill
in all the header values

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-21 07:54:54 -04:00
Donald Sharp
d0606e0a85 ospf6d: Use appropriate integer size and more context for reason strings
The ospfv3 spf reason strings are just presented internally in the code
without any real context.  Give a tiny bit more useful information for
the developer and convert the integer to a uint32_t

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-21 07:53:30 -04:00
Renato Westphal
f4f0098ca0 ospf6d: rework filtering commands to be in line with ospfd
Issue #9535 describes how the export-list/import-list commands work
differently on ospfd and ospf6d.

In short:
* On ospfd, "area A.B.C.D export-list" filters which internal
  routes an ABR exports to other areas. On ospf6d, instead, that
  command filters which inter-area routes an ABR exports to the
  configured area (which is quite counter-intuitive). In other words,
  both commands do the same but in opposite directions.
* On ospfd, "area A.B.C.D import-list" filters which inter-area
  routes an ABR imports into the configured area. On ospf6d, that
  command filters which inter-area routes an interior router accepts.
* On both daemons, "area A.B.C.D filter-list prefix NAME <in|out>"
  works exactly the same as import/export lists, but using prefix-lists
  instead of ACLs.

The inconsistency on how those commands work is undesirable. This
PR proposes to adapt the ospf6d commands to behave like they do
in ospfd.

These changes are obviously backward incompatible and this PR doesn't
propose any mitigation strategy other than warning users about the
changes in the next release notes. Since these ospf6d commands are
undocumented and work in such a peculiar way, it's unlikely many
users will be affected (if any at all).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-20 13:06:35 -03:00
Donald Sharp
cbcf3335b3 ospf6d: Use bool instead of an int
intra_brouter_calc is a int that is being used a bool,
convert to a bool.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-19 07:55:19 -04:00
Renato Westphal
b275f44a4a ospf6d: fix build problem with ancient json-c versions
Some CI VMs are using really old versions of json-c (pre 2013 [1])
that expect filenames to be passed as "char *" instead of "const char *".

Add some explicit casts to fix the resulting compiler errors on those
VMs (passing "char *" when the API expects "const char *" is fine).
Hopefully this commit should be reverted once the CI is updated to use
newer versions of json-c.

[1] https://github.com/json-c/json-c/commit/20e4708c

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-16 12:26:48 -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
Renato Westphal
1a898463a3 ospf6d: add missing entry to array of strings
Commit b8212e0310 introduced OSPF6_SPF_FLAGS_ASBR_STATUS_CHANGE but
didn't update the 'ospf6_spf_reason_str' array accordingly. Fix this.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-16 12:26:05 -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
Igor Ryzhov
390dce1275 ospf6d: fix possible NULL dereference
OSPF6_CMD_CHECK_RUNNING doesn't check that ospf6 is not NULL.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-09-15 13:48:29 +03:00
Mark Stapp
5fbbd15d1e
Merge pull request #9438 from ranjanyash54/debug_comm
ospf6d: Add debug commands for lsa all and route all
2021-09-14 11:38:21 -04:00
Russ White
3e2321b88c
Merge pull request #9019 from pjdruddy/ospfv3-early-break-list-walk
ospf6d: break early on route prefix mismatch
2021-09-10 14:29:53 -04:00
Donald Sharp
7932dd9331 ospf6d: Cleanup headers to our standard
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-09 16:42:52 -04:00
Renato Westphal
8a60820f70 ospf6d: add support for NSSA totally stub areas
Add a knob to turn a NSSA area into a totally stub area. In this
configuration a Type-3 default summary route is generated by default.

Syntax: `area A.B.C.D nssa no-summary`.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-07 11:43:35 -03:00
Igor Ryzhov
0f90ef494a
Merge pull request #9521 from opensourcerouting/ospf6d-gr-fixes
ospf6d: minor GR fixes
2021-09-06 12:36:54 +03:00
Donald Sharp
819a0202ae ospf6d: Prevent crash of show ipv6 ospf data adv-router 0.0.0.0 linkstate-id 0.0.0.0
With this sequence of events:
eva# conf
eva(config)# router ospf6
eva(config-ospf6)# end
eva# show ipv6 ospf data adv-router 0.0.0.0 linkstate-id 0.0.0.0
OSPF6: Received signal 11 at 1630442431 (si_addr 0x0, PC 0x559dcfa3a656); aborting...
OSPF6: zlog_signal+0x18c                  7fd2cc8229f7     7fff606775d0 /lib/libfrr.so.0 (mapped at 0x7fd2cc770000)
OSPF6: core_handler+0xe3                  7fd2cc8616ad     7fff606776f0 /lib/libfrr.so.0 (mapped at 0x7fd2cc770000)
OSPF6: funlockfile+0x50                   7fd2cc74f140     7fff60677840 /lib/x86_64-linux-gnu/libpthread.so.0 (mapped at 0x7fd2cc73b000)
OSPF6:     ---- signal ----
OSPF6: ospf6_lsdb_type_show_wrapper+0x5d     559dcfa3a656     7fff60677dd0 /usr/lib/frr/ospf6d (mapped at 0x559dcf9a5000)
OSPF6: show_ipv6_ospf6_database_adv_router_linkstate_id+0x1f9     559dcfa3c24a     7fff60677e50 /usr/lib/frr/ospf6d (mapped at 0x559dcf9a5000)

OSPF6 crashes.  Fix.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-01 08:07:53 -04:00
Renato Westphal
3ebc5e4be9 ospf6d: fix display of debug command in the running configuration
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-08-31 01:48:22 -03:00
Renato Westphal
950b49f80c ospf6d: fix unguarded GR debug message
The message about ignoring a one-way hello should only be logged
when the router is acting a helper for another one.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-08-31 01:45:50 -03:00
Russ White
26bf593efb
Merge pull request #9503 from opensourcerouting/ospf6d-redistribute-metrics
ospf6d: extend the "redistribute" command with more options
2021-08-28 09:20:44 -04:00
David Lamparter
8268be3d16
Merge pull request #9496 from idryzhov/vrf-cmd-init-unused-arg
lib: remove unused argument from vrf_cmd_init
2021-08-27 10:39:45 +02:00
Renato Westphal
476e957517 ospf6d: extend the "redistribute" command with more options
Add the "metric" and "metric-type" options to the "redistribute"
command.

This is a small commit since the logic of setting the metric
value and type of external routes was already present due to the
implementation of the "default-information originate" command months
ago. This commit merely extends the "redistribute" command to
leverage that functionality.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-08-26 15:05:53 -03:00
Christian Hopps
d448e2c5f9
Merge pull request #9331 from idryzhov/explicit-exit
*: explicitly print "exit" at the end of every node config
2021-08-26 11:57:33 -04:00
Igor Ryzhov
cfc369c43a lib: remove unused argument from vrf_cmd_init
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-26 12:01:22 +03:00
Yash Ranjan
d5cb350834 ospf6d: Add debug commands for lsa all and route all
Debug commad for all lsa types and route types are not present.

Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2021-08-25 04:54:11 -07:00
Donatas Abraitis
d10bda270e *: Drop break after using frr_help_exit() in switch/case
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-08-25 10:49:05 +03:00
Igor Ryzhov
bf41d65ebe
Merge pull request #9449 from opensourcerouting/ospf6d-nssa-fixes
ospf6d: NSSA fixes
2021-08-24 22:34:29 +03:00
Mark Stapp
ea5e814cf7
Merge pull request #9457 from anlancs/ospf6-void
ospf6d: suppress coverity warning of return value
2021-08-24 15:30:45 -04:00
Mark Stapp
5809c297fb
Merge pull request #9458 from anlancs/fix-ospf6-null
ospf6d: fix lock leak of using ALL_LSDB in GR helper
2021-08-24 12:12:05 -04:00
Renato Westphal
aea082d578 ospf6d: further validate NSSA ASBR routes used for route computation
Add missing sanity check specified in the NSSA RFC.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-08-24 11:53:36 -03:00
Renato Westphal
0c293b92ee ospf6d: do not allow an area to be stub and NSSA at the same time
That should not be allowed under any circumstance.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-08-24 11:53:36 -03:00
Renato Westphal
9142948e39 ospf6d: fix logging of border router routes
The prefix of routes to border routers consists of two pieces of
information embedded in a single struct (prefix.u.lp):

  struct prefix {
          uint8_t family;
          uint16_t prefixlen;
          union {
  		[snip]
                  struct {
                          struct in_addr id;
                          struct in_addr adv_router;
                  } lp;
          } u __attribute__((aligned(8)));
  };

As such, using prefix2str() (or the %pFX format specifier) isn't
correct when logging such routes.

This commit adds a few special cases here and there to handle
OSPF6_DEST_TYPE_ROUTER routes differently. It'd probably be a good
idea to add a helper function to handle all cases in a single place,
but that can be left for a second moment.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-08-24 11:53:36 -03:00
Renato Westphal
6df89791ba ospf6d: remove incorrect debug guard
Also, update the ospf6_topo2 topotest since the expected output
was wrong. With this fix, NSSA routes will be created on r2
("redistribute connected"), and NSSA routes appear in the routing
table as regular external routes.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-08-24 00:39:56 -03:00
Renato Westphal
dd551b9d1f ospf6d: flush external LSAs when NSSA is configured
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-08-24 00:24:41 -03:00
Renato Westphal
ccfffce4a0 ospf6d: fix flushing of all LSAs when NSSA is unconfigured
Once NSSA is unconfigured on an area, all self-originated Type-7
LSAs need to be flushed. The existing code was iterating over the
LSDB in the wrong way, causing ospf6_nssa_flush_area() to flush
LSAs of all types.  Use the ALL_LSDB_TYPED_ADVRTR macro to perform
the intended iteration correctly.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-08-24 00:24:41 -03:00
Renato Westphal
bb257321b2 ospf6d: don't delete area when NSSA is unconfigured
Once NSSA is unconfigured, the OSPF area should still be operational
as a normal area instead of being deleted.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-08-24 00:24:41 -03:00
Renato Westphal
d36a6a19d9 ospf6d: always unset the E-bit on NSSA ABRs
RFC 3101 - Section 2.1 says:
"(..) Interfaces associated with an NSSA will not send or receive
Type-5 LSAs on that interface but may send and receive Type-7 LSAs.
Therefore, if the N-bit is set in the options field, the E-bit must
be clear."

If the E-bit isn't cleared on an NSSA ABR, that will cause hello
packets to be dropped (due to parameters mismatch), which will
prevent the ABR from forming adjacencies with others routers in
the NSSA area.

This problem didn't affect the existing NSSA topotest by chance
of luck.  In that topotest, in the NSSA ABR, the NSSA area is
configured before any interface is associated to it. That caused
ospf6_check_and_set_router_abr() to return false, leading to
the unsetting of the E-bit. With this fix, the order in which
areas/interfaces are configured shouldn't matter because the E-bit
will always be unset on NSSA areas.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-08-24 00:24:41 -03:00
Igor Ryzhov
07679ad98a *: explicitly print "exit" at the end of every node config
There is a possibility that the same line can be matched as a command in
some node and its parent node. In this case, when reading the config,
this line is always executed as a command of the child node.

For example, with the following config:
```
router ospf
 network 193.168.0.0/16 area 0
!
mpls ldp
 discovery hello interval 111
!
```
Line `mpls ldp` is processed as command `mpls ldp-sync` inside the
`router ospf` node. This leads to a complete loss of `mpls ldp` node
configuration.

To eliminate this issue and all possible similar issues, let's print an
explicit "exit" at the end of every node config.

This commit also changes indentation for a couple of existing exit
commands so that all existing commands are on the same level as their
corresponding node-entering commands.

Fixes #9206.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-23 22:08:20 +03:00
Igor Ryzhov
6b73885556
Merge pull request #9446 from mobash-rasool/ospfv3-bug-fixes
ospf6d: External LSAs reoriginates on every redistribute CLI
2021-08-23 19:00:23 +03:00
Mobashshera Rasool
058c4c783f ospf6d: External LSAs reoriginates on every redistribute CLI
Problem Statement:
==================
Everytime redistribute CLI is executed, external LSAs are
re-originated. When there is no change in the CLI parameters
the LSAs should not get re-originated.

Fix:
=================
Check if the CLI params are same, do not re-originate the LSA.

Fixes: #9445

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-08-23 04:47:10 -07:00
anlan_cs
37692712a5 ospf6d: fix lock leak of using ALL_LSDB in GR helper
The lsa and lsanext must be unlocked if break out of ALL_LSDB loop.

Incidentally correct the comment of ALL_LSDB.

Signed-off-by: anlan_cs <anlan_cs@tom.com>
2021-08-22 05:26:20 -04:00
anlan_cs
4d97dde2d1 ospf6d: suppress coverity warning of return value
Fix #CID 1506511

Signed-off-by: anlan_cs <anlan_cs@tom.com>
2021-08-21 22:04:12 -04:00
Renato Westphal
f70b917249
Merge pull request #8935 from rgirada/ospfv3_gr_helper
ospf6d: Support for ospfv3  graceful restart  helper functionality
2021-08-19 15:01:34 -03:00
Russ White
0512687b30
Merge pull request #9342 from mobash-rasool/ospfv3-asbr-summarisation
OSPF6d: Fixed assert at ospf6_originate_summary_lsa asbr.c:2849 and flushing of Type-7 LSAs
2021-08-17 10:31:29 -04:00
Quentin Young
6ddb368d6b ospf6d: JSON output for database dump show command
Added missing output to "show ipv6 ospf6 databse dump json" VTY shell
command.

Co-authored-by: David Schweizer dschweizer@opensourcerouting.org
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2021-08-12 16:26:01 -04: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
9a06f23d0b ospf6d: GR helper exit scenarios
Description:
	Changes to cover all the following  GR helper exit scenarios.
	1. Upon receiving max age grace lsa.( successful graceful restart)
	2. Topo change
	3. Grace timer expiry.
	4. User changes( like config deletion , interface down)

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-08-10 02:57:23 -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
rgirada
0694366601 ospf6d: debug command support for helper support.
Description:
	Adding debug support for helper functionality.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-08-10 02:57:23 -07:00
rgirada
59790f521a ospf6d: Init/De-init gr helper functionality
Description:
	Graceful restart helper functionality initialisation and deinit apis.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-08-10 02:57:23 -07:00
rgirada
91c169f7d7 ospf6d: Datastructure modification for GR helper functionality.
Description:
	Adding GR helper specific datastructures.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-08-10 02:57:23 -07:00
Mobashshera Rasool
523232c5c5 ospf6d: Remove Type-7 LSA when Type-5 LSA is removed
Fix:
When summarised Type-5 LSA is removed, the corresponding Type-7
LSAs also need to be removed from area.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-08-09 09:11:10 -07:00
Mobashshera Rasool
4e0702dc74 ospf6d: Remove assert and fix LSA removal in ASBR summarisation
Fix:
1. The assert at line ospf6_asbr.c:2849 is not required.
2. When Individual LSAs are present and summarisation is configured
we need to remove such LSAs and originate the summarised ones.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-08-09 09:11:04 -07:00
Yash Ranjan
a867da2b6b ospf6d: Check the cost only when asbr_present for ECMP routes
For ECMP routes, the metric cost and metric type are compared
even when the asbr entry is not present. This stops the routes
from getting removed when max age LSAs are received for the
ECMP routes.

Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2021-08-04 05:03:10 -07:00
Donald Sharp
3e18e550ed
Merge pull request #9108 from opensourcerouting/ospf6d-range-fixes
ospf6d: fix argument processing in the "area ... range" command
2021-08-03 21:15:12 -04:00
Renato Westphal
488599bfa2
Merge pull request #9232 from idryzhov/interface-node-cleanup
*: cleanup interface node installation
2021-08-02 21:13:29 -03:00
Russ White
e448fefbb4
Merge pull request #9028 from mobash-rasool/ospfv3-asbr-summarisation
Ospfv3 ASBR summarisation feature
2021-07-30 06:37:50 -04:00
Russ White
3ad921a98c
Merge pull request #9193 from mobash-rasool/ospfv3-bug-fixes
ospf6d: Type-7 LSA originated with wrong sequence number
2021-07-29 15:00:55 -04:00
Igor Ryzhov
9da01b0b7b *: cleanup interface node installation
The only difference in daemons' interface node definition is the config
write function. No need to define the node in every daemon, just pass
the callback as an argument to a library function and define the node
there.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-07-29 21:35:25 +03:00
Igor Ryzhov
36d3fcccb4
Merge pull request #8944 from opensourcerouting/ospf6-mtu-revert
ospf6d: revert PR #8622
2021-07-27 16:06:40 +03:00
Mobashshera Rasool
96cad17163 ospf6d: Type-7 LSA originated with wrong sequence number
RCA: When Type-7 LSA is updated, the LSDB is searched, if the
LSA is present in the LSDB then the LSA is updated with next
sequence number and if not then it is originated with the
INITIAL sequence number.
Here while originating Type-7 LSA Process Level LSDB is searched
for instead of area level LSDB.

Fix: Search in the area level LSDB and not in the process level.

Fixes #9099

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-07-27 05:39:37 -07:00
Donald Sharp
cb01669fe6
Merge pull request #9090 from opensourcerouting/ospfv3-fixes-20210720
ospf6d: small batch of random fixes/improvements
2021-07-27 08:06:54 -04:00
Renato Westphal
848db95c5a ospf6d: fix argument processing in the "area ... range" command
* When the "cost" argument isn't present, the default cost should be
  used instead of preserving the previously configured one (if any);
* When the "not-advertise" argument isn't present, the "not-advertise"
  flag should be unset regardless if it was previously configured or
  not.

Configuration commands should be deterministic and work in the same
way regardless of the current state.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-07-21 15:02:13 -03:00
David Lamparter
63116a7008 build: fix AM_LDFLAGS usage (and gcov)
like the other automake variables, setting `xyz_LDFLAGS` causes
`AM_LDFLAGS` to be ignored for `xyz`.  For some reason I had in my mind
that automake doesn't do this for LDFLAGS, but... it does.  (Which is
consistent with `_CFLAGS` and co.)

So, all the libraries and modules have been ignoring `AM_LDFLAGS` (which
includes `SAN_FLAGS` too).  Set up new `LIB_LDFLAGS` and
`MODULE_LDFLAGS` to handle all of this correctly (and move these bits to
a central location.)

Fixes: #9034
Fixes: 0c4285d77e ("build: properly split CFLAGS from AC_CFLAGS")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-07-21 17:10:08 +02:00
Mobashshera Rasool
ad21f6c285 ospf6d: ASBR summarisation per VRF
Added code to support the ASBR summarisation per VRF.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-07-21 05:20:33 +00:00
Mobashshera Rasool
22813fdb86 ospf6d: Store ospf6 back pointer in route struct
Storing the pointer to ospf6 struct in route struct.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-07-21 05:20:30 +00:00
Mobashshera Rasool
789828186e ospf6d: Review comment fixes
This commit is ease reviewing the review comment fixes.

Signed:-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-07-21 05:16:54 +00:00
Mobashshera Rasool
c405b00fcf ospf6d: install summary route NULL0 as nexthop
This is a requirement for avoiding sending traffic somewhere it was not
supposed to go: install summary route to local RIB to send traffic to
Null0.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-07-21 05:16:54 +00:00
Mobashshera Rasool
d2e5d5d444 ospf6d: support blackhole next hops
This feature is required for creating summary routes that drop traffic
without more specific routes.

Authored-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-07-21 05:16:54 +00:00
Mobashshera Rasool
c3a70f6517 ospf6d: ASBR summarisation feature changes for NSSA area
1. ASBR summarisation for Type-7 LSAs are done here.

2. Fixed Code warnings

Signed-off-by: Mobashshera Rasool<mrasool@vmware.com>
2021-07-21 05:16:54 +00:00
Mobashshera Rasool
4dc4388691 ospf6d: ASBR Summarisation feature implementation
Feature Implementation.
========================
This feature will help in advertising the External LSAs with aggregation.
The commands allow us to tune the advertisement with different parameters
as mentioned in the CLI List below.
It can also help in case we do not want to advertise any prefix with the
no-advertise option.

New CLIs added:
===============
summary-address X:X::X:X/M$prefix [tag (1-4294967295)] [{metric (0-16777215) | metric-type (1-2)}]
no summary-address X:X::X:X/M$prefix [tag (1-4294967295)] [{metric (0-16777215) | metric-type (1-2)}]
summary-address X:X::X:X/M$prefix no-advertise
no summary-address X:X::X:X/M$prefix no-advertise
aggregation timer (5-1800)
no aggregation timer (5-1800)
show ipv6 ospf6 summary-address [detail$detail] [json]
debug ospf6 lsa aggregation

CAT RUN:
========
QE to add test scripts

Signed-Off-by: Mobashshera Rasool <mrassol@vmware.com>
2021-07-21 05:16:54 +00:00
Rafael Zalamena
80d1eb49b1 ospf6d: always generate default route for stubs
In RFC 2328 OSPF Version 2, Section 12.4.3.1 "Originating summary-LSAs
into stub areas" mentions that the stub areas should not import external
routes and instead should generate a 'default summary-LSA' set to
default destination.

> In a stub area, instead of importing external routes
> each area border router originates a "default summary-
> LSA" into the area. The Link State ID for the default
> summary-LSA is set to DefaultDestination, and the metric
> set to the (per-area) configurable parameter
> StubDefaultCost.  Note that StubDefaultCost need not be
> configured identically in all of the stub area's area
> border routers.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-07-20 09:43:03 -03:00
Pat Ruddy
0c7f982a38 ospf6d: break early on route prefix mismatch
The route linked list in ospf6d is ordered in prefix batches which
are associated with a the route node denoting the prefix. So if
you look up the prefix in the tree and start walking the list, if you
find a prefix which differs from the one you are interested in then
you have gone beyond the batch of routes for that prefix.

In some cases the route database linked list is used on a per-prefix
basis. The existing code simply does a continue when the prefix does
not match and continues to walk. This works with small numbers of
routes because the walk continues through unrelated prefix batches and
never finds anything to operate on. However if we have many thousands
of routes these walks become expensive and can cause the SPF thread
(amongst others) to run very long, causing issues with adjacencies
where the dead timer is short.

Add a break to these prefix-based loops to exit early if we get a
prefix mismatch to avoid continuing down the route list if we have
overshot.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-07-20 11:19:48 +01:00
David Lamparter
621ee705b5 ospf6d: use OSPF6_INTERFACE_LOOPBACK state
The OSPF6_INTERFACE_LOOPBACK interface state wasn't entered anywhere,
even if the interface was OSPF6_IFTYPE_LOOPBACK.  Fix.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-07-20 11:22:21 +02:00
David Lamparter
2e9db233b1 ospf6d: don't create Adv-ID:0.0.0.0 LSAs at start
When ospf6d comes up, it gets interface and address state before it
decides on its router ID.  This results in a bunch of LSAs with
advertising router ID 0.0.0.0 in the LSDB.  Not quite right.

There's a whole bunch of paths leading to this, so just drop the LSA in
ospf6_lsa_originate.  The router-ID change causes everything to be
readvertised anyway (... but the delete doesn't catch the 0.0.0.0 stuff
because the router-ID is now different.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-07-20 11:22:21 +02:00
David Lamparter
b08221513c ospf6d: actually print prefix options
Well at least I had a good laugh at the "xxx".

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-07-20 11:22:21 +02:00
David Lamparter
4699ad7296 ospf6d: move prefix_options from _path to _route
Prefix options are per-prefix, not per-path.  As evident by the fact
that the field is never used on ECMP paths.  Move it where it belongs.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-07-20 11:22:21 +02:00
Rafael Zalamena
ae2ba0c219 ospf6d: remove extra debug message
Somehow the hello message debugging code slipped outside the debug
guard. Lets just remove it.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-07-14 14:52:26 -03:00
Donald Sharp
802a83935f
Merge pull request #9037 from idryzhov/ospf6-freebsd
ospf6d: fix freebsd mcast group issues
2021-07-13 09:40:13 -04:00
Igor Ryzhov
93828a9923 ospf6d: fix freebsd mcast group issues
There's a delay in FreeBSD between issuing a command to leave a
multicast group and an actual leave. If we execute "no router ospf6" and
"router ospf6" fast enough, we can end up in a situation when OS
performs the leave later than it performs the join and the interface
remains without a multicast group.

Instead of counting on a one second delay, we must wait until the
interface actually leaves the group.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-07-12 22:56:04 +03:00
Donald Sharp
482467dc6a ospf6d: Correct spelling in debug
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-07-12 07:24:16 -04:00
Igor Ryzhov
cf420d4b48
Merge pull request #9010 from opensourcerouting/ospf-misc
doc,lib,ospfd,ospf6d: trivial improvements
2021-07-09 19:19:13 +03:00
Igor Ryzhov
d0f980f8bb
Merge pull request #9016 from LabNConsulting/chopps/ospf6d-fix-backlink-chk
ospf6d: fix backlink check
2021-07-09 15:46:43 +03:00
Rafael Zalamena
a0fbad5869 ospf6d: rework default-information configuration
Move code to its own function and remove most of the code indentation
(e.g. test for failure and quit as soon as possible).

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-07-09 07:55:25 -03:00
Rafael Zalamena
1fe59b44fc lib,ospfd,ospf6d: remove duplicated function
Move `is_default_prefix` variations to `lib/prefix.h` and make the code
use the library version instead of implementing it again.

NOTE
----

The function was split into per family versions to cover all types.
Using `union prefixconstptr` is not possible due to static analyzer
warnings which cause CI to fail.

The specific cases that would cause this failure were:
 - Caller used `struct prefix_ipv4` and called the generic function.
 - `is_default_prefix` with signature using `const struct prefix *` or
   `union prefixconstptr`.

The compiler would complain about reading bytes outside of the memory
bounds even though it did not take into account the `prefix->family`
part.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-07-09 07:55:25 -03:00
Rafael Zalamena
f45f6a22b0
Merge pull request #8978 from kssoman/ospf_new
ospf6d : Send LSA update immediately when ospf instance is deleted
2021-07-09 07:46:11 -03:00
Christian Hopps
ff2052eefc ospf6d: fix backlink check
This code has been wrong ~ever (according to git history). There are 3
conditional blocks with the added assertion that both the LSA and the
vertex being checked can't both be network LSAs.

The third block is clearly assuming both LSA and vertex are router
LSAs b/c it is accessing the backlink and lsdesc as router lsdesc's also
making sure both are p2p links (which they would have to be to point at
each other).

The programming error here is that (A && B) == False does NOT imply !A,
but the code is written that way.

So we end up in the third block one of LSA or vertex being network LSAs
rather easily (whenever that is the case and the desc isn't the backlink
being sought).

This was caught by ASAN b/c the lsdesc and backlinks are being accessed
(> 4 byte field offsets) as if they were router lsdesc's in the third
block, when in fact one of them is a network lsdesc which is only 4
bytes long -- so ASAN flags the access beyond bounds.

Signed-off-by: Christian Hopps <chopps@labn.net>
2021-07-09 04:15:34 -04:00
Soman K.S
7359e9ba71 ospf6d : Send LSA update immediately when ospf instance is deleted
Fix: The fix is to call ospf6_write to send the packet immediately to all neighbors

Signed-off-by: kssoman <somanks@gmail.com>
2021-07-08 19:10:29 +05:30
Igor Ryzhov
5ee7655ee9
Merge pull request #8987 from mobash-rasool/ospfv3-bug-fixes
ospf6d: Fix crash in ospf6_asbr_lsa_remove at ospf6d/ospf6_asbr.c:696
2021-07-07 17:28:14 +03:00
Donald Sharp
568f6d6c94
Merge pull request #8919 from mobash-rasool/ospfv3-fixes
ospf6d: Max aged LSAs are not getting deleted from DB
2021-07-06 16:13:05 -04:00
Donald Sharp
54ce9feb5a
Merge pull request #8930 from pjdruddy/ospf6_packet_debug
Ospf6 packet debug
2021-07-06 16:09:07 -04:00
github login name
908f5e616b ospf6d: Fix crash in ospf6_asbr_lsa_remove at ospf6d/ospf6_asbr.c:696
Issue: Crash observed when LSAs are removed from LSDB after max age
when there is no area configured.
(gdb) bt
0  raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
1  0x00007fdb190548bc in core_handler (signo=6, siginfo=0x7ffdd2f5a470, context=<optimized out>) at lib/sigevent.c:262
2  <signal handler called>
3  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
4  0x00007fdb185ad921 in __GI_abort () at abort.c:79
5  0x00007fdb1907f199 in _zlog_assert_failed (xref=xref@entry=0x55f30902aa20 <_xref.21999>, extra=extra@entry=0x0) at lib/zlog.c:581
6  0x000055f308dc4f78 in ospf6_asbr_lsa_remove (lsa=0x55f30a7546d0, asbr_entry=0x0) at ospf6d/ospf6_asbr.c:696
7  0x000055f308dd8f0d in ospf6_lsdb_remove (lsa=0x55f30a7546d0, lsdb=lsdb@entry=0x55f30a73d300) at ospf6d/ospf6_lsdb.c:166
8  0x000055f308dd9701 in ospf6_lsdb_maxage_remover (lsdb=0x55f30a73d300) at ospf6d/ospf6_lsdb.c:376
9  0x000055f308dee724 in ospf6_maxage_remover (thread=<optimized out>) at ospf6d/ospf6_top.c:603
10 0x00007fdb1906520d in thread_call (thread=thread@entry=0x7ffdd2f5ae90) at lib/thread.c:1919
11 0x00007fdb19023e48 in frr_run (master=0x55f30a569b70) at lib/libfrr.c:1155
12 0x000055f308dc09b6 in main (argc=6, argv=0x7ffdd2f5b198, envp=<optimized out>) at ospf6d/ospf6_main.c:235
(gdb)

Steps to reproduce the issue:
1. router ospf6
2. redistribute static
3. ipv6 route 1::1/128 Null0
4. no redistribute static
5. wait for Max aged LSA to flush
6. Check DB, crash occurs.

RCA:
Crash occurred while accessing listgetdata(listhead(ospf6->area_list))
When there is no area attached to any of the interface listhead(ospf6->area_list)
is NULL. Therefore it crashed due to NULL access.

Fix:
Check before accessing null pointer.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-07-06 08:32:23 -07:00
Donald Sharp
30885c7099
Revert "ospf6d: fix LSAs remain in LSDB with an old router-id value" 2021-07-02 12:38:11 -04:00
Mark Stapp
0a9fcd96d1
Merge pull request #8970 from ton31337/fix/use_IPV6_MAX_BITLEN
*: Do not use 32/128 numbers for prefixlen
2021-07-02 07:52:22 -04:00
Philippe Guibert
1e15822698
Merge pull request #8795 from louis-oui/fix-ospf6-router-id
ospf6d: fix LSAs remain in LSDB with an old router-id value
2021-07-02 11:11:47 +02:00
Donatas Abraitis
12256b84a5 *: Convert numeric 32 into IPV4_MAX_BITLEN for prefixlen
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-07-01 23:50:39 +03:00
Donatas Abraitis
f4d81e5507 *: Replace IPV6_MAX_PREFIXLEN to IPV6_MAX_BITLEN
Just drop IPV6_MAX_PREFIXLEN at all, no need keeping both.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-07-01 17:41:09 +03:00
Louis Scalbert
c295917b4a ospf6d: harmonize ospf6_asbr_redistribute_disable and _reset
Harmonize the code of functions ospf6_asbr_redistribute_disable and
ospf6_asbr_redistribute_reset.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2021-07-01 14:40:14 +02:00
Louis Scalbert
c54fb080a0 ospf6d: reset areas and redistribution at router-id modification
The ospf6 router-id is provided by order of preference by:

 ospf6d itself if the "ospf6 router-id X.X.X.X" command is set.
- zebra. If the "ip router-id X.X.X.X" zebra command is set, the
  configured IP is provided as the ID or alternatively the highest
  loopback IPv4 address or else the highest interface IPv4 address.

The running ospf6 router-id is stored in ospf6->router-id.

ospf6->router-id can change in the following conditions:

- A configuration change provides a new router-id value according to
  the above rules. ospf6->router-id is updated to the new value if
  there is no adjacency in FULL state. Otherwise, the ospf6d process
  must be restarted to take the new router-id into account.
- On startup of both zebra and ospf6d, if ospf6d has not yet received a
  valid router-id, ospf6d->router-id is set to 0 (i.e. 0.0.0.0). Then,
  zebra notifies ospf6d that the router-id is available.

At ospf6->router-id, the current behavior of ospf6d is the following:

- The self generated LSAs that refer to the previous router-id as the
  advertising router are kept.
- Self generated LSAs are created with router-id value.
- LSAs from the redistribution that refer to the previous router-id are
  kept and no new redistribution LSAs are created.

As a consequence, the routers in the ospf6 areas will get incorrect
LSAs and might not be able to install prefixes of those LSAs into their
RIB.

This fix solves this issue by resetting the areas and the redistribution
when ospf6->router-id updated.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2021-07-01 14:40:14 +02:00
Louis Scalbert
6794884231 ospf6d: factorize router-id update
ospf6_router_id_update function is used by ospf6_router_id_update_zebra
to update the running the ospf6 router-id.

This patches makes the functions to (un)configure ospf6 router-id use
the same function as ospf6_router_id_update_zebra.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
---
2021-07-01 14:40:14 +02:00
Louis Scalbert
08965422d0 ospf6d: don't update router-id if at least one adjacency is Full
When a router-id change is notified by zebra to ospf6d, we only take
into account the change if no adjacencies are in Full state.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2021-07-01 14:40:07 +02:00
Igor Ryzhov
bc65216a29
Merge pull request #8954 from mobash-rasool/ospfv3-feature
ospf6d: route-map config changed, not getting applied on all types of…
2021-07-01 14:47:40 +03:00
Mobashshera Rasool
2f43e34de1 ospf6d: route-map config changed, not getting applied on all types of routes
Problem Statement:
==================
when route-map config is changed from permit to deny, it is not getting
applied to both connected and static and vice versa

RCA:
==================
When route-map changes from permit to deny or vice versa, a notification is
sent to ospf6 daemon via ospf6_asbr_routemap_update. In this function, a thread
is scheduled after 5 seconds to apply the route-map changes. In this thread
(ospf6_asbr_routemap_update_timer), only the first type is passed as argument
and only the first type i.e "connected" is passed and hence in callback only
on this type of route route-map gets applied.

Fix:
====
Need to loop through all the route-types in the call back and process
the route-map changes. Added a flag to mark which all route-types needs
to be processed.

Test Executed:
===============
1. Change route-map from permit to deny.
2. Change route-map from deny to permit.
3. Add new route and checked.
4. Verified summarised routes.

Risk:
============
Low

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-06-30 11:55:17 +00:00
Igor Ryzhov
3c5122c5a7 ospf6d: use per-vrf router id instead of one global
This code was not fully completed when adding support for VRFs.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-29 18:10:41 +03:00
David Lamparter
0c3a104a7a Revert "ospf6d: Limit the number of interface addresses being supported"
This reverts commit f85b76195a.
2021-06-29 15:17:01 +02:00
Igor Ryzhov
ba88ced84c
Merge pull request #8835 from ranjanyash54/clear_process
ospf6d: "clear ipv6 ospf6 process" command
2021-06-29 11:54:39 +03:00
Quentin Young
3f8711681e
Merge pull request #8850 from opensourcerouting/ospf6-checksum-json
ospf6d: consistent checksum JSON output
2021-06-29 02:23:06 +00:00
Yash Ranjan
f71ed6df3e ospf6d: "clear ipv6 ospf6 process" command
Adding the "clear ipv6 ospf6 command" . It resets
the ospfv3 datastructures and clears the database
as well as route tables. It resets the neighborship
by restarting the interface state machine.
If the user wants to change the router-id, this
command updates the router-id to the latest static
router-id and starts the neighbor formation with
the new router-id.

Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2021-06-27 20:56:10 -07:00
Pat Ruddy
779d972213 ospf6d: remove inet_ntop calls in ospf6_write
substitute pI6 formatter.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-06-26 11:16:19 +01:00
Pat Ruddy
a91f9d699c ospf6d: correctly protect packet debugs in ospf6_write
Some unprotected debugs need to have macro protection,
Split these into the existing covering macro section to remove
a check per-packet from the main path.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-06-26 11:16:19 +01:00
Pat Ruddy
0dd5ec1297 ospf6: fix coverity overflow issues
Coverity flagged the possibility of an overflow in the latency
calculation, ensure that 64 bit integers are used in the
calculation to avoid this error.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-06-26 11:16:19 +01:00
Igor Ryzhov
709bd20421 ospf6d: fix duplicated packet read
When OSPFv3 router is configured in both default and non-default VRFs,
every packet destined to a non-default VRF is read twice. This makes it
impossible to establish neighborship because every DbDesc packet is
treated as duplicated and we end up infinitely exchanging DbDescs.

We should drop packets received in the default VRF if an interface we
received it on is bound to another VRF.

Same thing was done for OSPFv2 in 555691e.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-26 12:57:26 +03:00
Mobashshera Rasool
c1e4c0dcf8 ospf6d: Max aged LSAs are not getting deleted from DB
Problem Statement:
==================
Max aged LSAs are not getting deleted from DB when there are multiple
neighbors in a LAN.

Root Cause Analysis:
====================
When the LSA is added to the neighbor's retransmit list, the LSA retrans count
is incremented but it is not checked if the LSA is already present in the
retransmit list leading to the count being incremented multiple times
untill the ack is not received and when the ack is received the count is
decremented once and hence the count never becomes 0 and
it remains in the DB forever.

Fix:
====================
Do not increment the retrans count multiple times if the LSA is already
present in the retransmit list of the neighbor. Also do not add the LSA
in the retransmit List if already present.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-06-24 11:16:12 +00:00
Igor Ryzhov
1c06b80f04
Merge pull request #8904 from rameshabhinay/ospf6_show
ospf6d: Show neighbor displays twice for every neighbor.
2021-06-23 18:35:13 +03:00
Rafael Zalamena
bc496de111
Merge pull request #8899 from idryzhov/ospf6-asbr
ospf6 redistribution fixes
2021-06-23 07:15:12 -03:00
Abhinay Ramesh
4069972831 ospf6d: Show neighbor displays twice for every neighbor.
Problem Statement:
=================
When show ipv6 ospf6 neighbor is executed each neighbor gets
displayed twice.

frr# show ipv6 ospf6 neighbor
Neighbor ID     Pri    DeadTime    State/IfState         Duration I/F[State]
1.1.1.1           1    00:00:39     Full/DR              00:00:10 ens192[BDR]
1.1.1.1           1    00:00:39     Full/DR              00:00:10 ens192[BDR]

RCA:
====
Since ospf6_interface gets added twice to if_list we see multiple
display output.

Fix:
====
add ospf6_interface to if_list only when newly area gets attached
to the interface. If its already added no need to add it again.

Risk:
=====
Low

Tests Executed:
===============
Have tested the defect scenario.

frr# show ipv6 ospf6 neighbor
Neighbor ID     Pri    DeadTime    State/IfState         Duration I/F[State]
1.1.1.1           1    00:00:35     Full/DR              00:36:04 ens192[BDR]
frr#

Signed-off-by: Abhinay Ramesh <rabhinay@vmware.com>
2021-06-23 09:24:35 +00:00
Igor Ryzhov
edfab98f9e ospf6d: fix NSSA status update
We should update ASBR status only when the NSSA status is actually changed.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-23 01:05:07 +03:00
Igor Ryzhov
bf84c96dae ospf6d: fix redistribute configuration
ospf6_asbr_redistribute_unset must not be called if the redistribution
is not yet configured, because it decrements redistribution counter and
makes it negative in this case.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-23 01:05:07 +03:00
Igor Ryzhov
2fdc4f8dea ospf6d: small ospf6_asbr_redistribute_set improvement
We always have a pointer to the ospf6 instance when the function is called.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-23 01:05:07 +03: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
Russ White
b79f1e068e
Merge pull request #8725 from pjdruddy/ospfv3_fair_socket
OSPFv3 socket rework
2021-06-22 10:58:33 -04:00
Russ White
6d824d6940
Merge pull request #8891 from idryzhov/no-vrf-interface
lib: remove vrf-interface config when removing the VRF
2021-06-22 09:55:11 -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
Igor Ryzhov
f5eef2d5a8 lib: remove vrf-interface config when removing the VRF
If we have the following configuration:
```
vrf red
 smth
 exit-vrf
!
interface red vrf red
 smth
```
And we delete the VRF using "no vrf red" command, we end up with:
```
interface red
 smth
```
Interface config is preserved but moved to the default VRF.

This is not an expected behavior. We should remove the interface config
when the VRF is deleted.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-21 18:04:46 +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
Donald Sharp
cd551a0fd5
Merge pull request #8841 from volta-networks/fix_ospf6_bad_seqnum
ospf6: Drop LSA with bad seqnumber
2021-06-19 12:21:26 -04:00
Donald Sharp
457d4ee329
Merge pull request #8868 from ranjanyash54/redistribute_fix
ospf6d: redistribute command minor fixes
2021-06-19 12:20:04 -04:00
lynne
c5467a12ea ospf6: Drop LSA with bad seqnumber
In RFC 2328 seqnumber 0x80000000 is reserved and not used.   If an LSA
is received with seqnumber the LSA is now dropped and a debug error log
is printed.

Signed-off-by: Lynne Morrison <lynne@voltanet.io>
2021-06-18 11:48:18 -04:00
Donald Sharp
a61bbb35a5
Merge pull request #8839 from volta-networks/fix_ospf6_flags_for_error_logs
ospf6d: move error logs out from behind debug flags
2021-06-18 08:18:25 -04:00
Yash Ranjan
f84504e686 ospf6d: Set metric from default values when route-map metric not present
For redistribute commands if route map is set, then route takes it's metric
values from the route map. But in the case that routemap is set but the
metric for the route map is not, then the route metric is set to type-1.

Check if the metric is set for the routemap. If not then set it as per
redistributed default values (type 2)

Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2021-06-18 04:59:04 -07:00
Yash Ranjan
a5bc334beb ospf6d: Change the default metric parameter for redistribute
The default values will be set at the time of ospf6_redist_add
similar to ospfv2. Hence the default values will change as well.
Default metric type = E2
Default metic value = 20

Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2021-06-18 04:59:04 -07:00
Pat Ruddy
78156066b9 ospf6d: add write-multiplier configuration
allow amount of work done by read and write threads in a single
invocation to be tuned to between 1 and 100 packets (default 20)

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-06-18 09:40:42 +01:00
Pat Ruddy
bb382e24f1 ospf6d: add warning log for late hello packets
On transmit and receive calculate the time since the last hello was seen
and log a warning if it is late by more than the hello period.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-06-18 09:40:42 +01:00
Pat Ruddy
432b7daf3d ospf6d: add lsupdate messages to tx fifo
queue outgoing lsupdate messages to the interface tx FIFO and schedule
the ospf_write task to deal with them.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-06-18 09:40:42 +01:00
Pat Ruddy
dd784cf9fa ospf6d: add lsack messages to tx fifo
queue outgoing lsack messages to the interface tx FIFO and schedule
the ospf_write task to deal with them.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-06-18 09:40:42 +01:00
Pat Ruddy
571eed235d ospf6d: add lsreq messages to tx fifo
queue outgoing lsreq messages to the interface tx FIFO and schedule
the ospf_write task to deal with them.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-06-18 09:40:42 +01:00
Pat Ruddy
d6a39b53f5 ospf6d: add dbdesc messages to tx FIFO
enqueue outgoing dbdesc messages to the end of the tx FIFO and
schedule the ospf6_write task to deal with them.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-06-18 09:40:42 +01:00
Pat Ruddy
3d9680313e ospf6d: add hello messages to tx fifo
queue outgoing hello messages to the interface tx FIFO and schedule
the ospf_write task to deal with them.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-06-18 09:40:42 +01:00
Pat Ruddy
531f925b4d ospf6d: add packet apis
Add APIs to create, queue and dequeue OSPFv3 packets

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-06-18 09:40:42 +01:00
Pat Ruddy
4f7bf1ab05 ospf6d: add tx fifo infrastructure
Add per interface fifo and per instance write list as a precursor
to implementing fairer sharing of the ospf6 oscket resources.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-06-18 09:40:42 +01:00
Pat Ruddy
aa6a96ba78 ospf6d: read ospf6 socket until failure
To ensure we read all the datagrams availabe from a socket when the
read task is scheduled, make the read helper return and error or
continue enum and loop unitl an error is received.
This requires the read from the socket to be non blocking

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-06-18 09:40:42 +01:00
Pat Ruddy
ec44732ea3 ospf6d: create an ospf_read_helper function
Take the contents of ospf6_receive and split the funtionality that
deals with a single packet receipt and place it in a separate helper
function.
This is the first step in a refactor process to allow the ospf6_read
task to read until failure.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-06-18 09:40:42 +01:00
lynne
1b1f7b4f15 ospf6d: move error logs out from behind debug flags
The logging in ospf6 is very verbose.  If you turn on logging on a scaled
system you get too many logs.   The problem is that there are some errors
that occur that are hidden behind the debug flags, and to see these errors
we currently need to turn on the debug logging.  This change converts these
error logs to warnings and removes the debug flags.

Signed-off-by: Lynne Morrison <lynne@voltanet.io>
2021-06-14 15:46:49 -04:00
David Schweizer
2804f2d241
ospf6d: Link state ID in LSA database JSON output
Added link state ID to JSON output of LSA database.

Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
2021-06-14 08:41:10 +02:00
David Schweizer
d6265808f4
ospf6d: consistent checksum json output
Changed LSA checksum JSON output variable name from "checkSum" to
"checksum" to maintain consistency.

Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
2021-06-14 08:21:42 +02:00
Stephen Worley
5c2b86bba9 ospf6d: fix undefined function
Some wires got crossed during a couple merges using/changing
this function.

Update it to its new name.

Signed-off-by: Stephen Worley <sworley@nvidia.com>
2021-06-10 17:39:56 -04:00
Rafael Zalamena
ea67959995
Merge pull request #8823 from donaldsharp/ospfv3_coverity
Ospfv3 coverity
2021-06-10 15:13:11 -03:00
Rafael Zalamena
0614153799
Merge pull request #8733 from idryzhov/ipv6-ospf6-area
ospf6d: fix interface area configuration
2021-06-10 10:34:45 -03:00
Donald Sharp
95b3f03d89 ospf6d: Rename ospf6_is_router_abr to more accurately reflect what it does
The ospf6_is_router_abr is checking to see if ospfv3 is an abr router
and also setting values.  Let's rename it too `ospf6_check_and_set_router_abr`
to more accurately reflect what it is doing.

Additionally fix coverity #1505176 where we were not checking the return
value of ospf6_is_router_abr like we did every other time.  In this
case we don't care about the return value so indicate that we do not.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-06-10 07:59:06 -04:00
Donald Sharp
0d882ec7a3 ospf6d: Fix coverity Possible null deref
There exists a code path where ospf6 could be NULL and passing
to a function where it would always be derefed is a bad idea.

Put some small code in place to prevent this and allow this to be debuged
if it happens in the future.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-06-10 07:46:36 -04:00
Igor Ryzhov
42cabc552d ospf6d: fix interface area configuration
Currently the interface area is configured from the router node using
"interface IFNAME area ID" command. There are multiple problems with
this command:
- it is not in line with all other interface-related commands - other
  parameters are configured from the interface node using "ipv6 ospf6"
  prefix
- it is not in line with OSPFv2 - area is configured from the interface
  node using "ip ospf area" command
- most importantly, it doesn't work correctly when the interface is in
  a different VRF - instead of configuring the interface, it creates a
  new fake interface and configuring it instead

To fix all the problems, this commit adds a new command to the interface
configuration node - "ipv6 ospf6 area ID". The purpose of the command is
completely the same, but it works correctly in a multi-VRF environment.

The old command is preserved for the backward compatibility, but the
warning is added that it is deprecated because it doesn't work correctly
with VRFs.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-08 21:38:09 +03:00
Renato Westphal
461d106dae lib, ospfd, ospf6d: fix logging of pointer addresses
The %p printf format specifier does already print the pointer address
with a leading "0x" prefix (indicating a hexadecimal number). There's
no need to add that prefix manually.

While here, replace explicit function names in log messages by
__func__.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-06-08 11:50:44 -03:00
Rafael Zalamena
4f785c075e ospf6d: missing NSSA areas handling
Patch provided by Soman K.S. with small alterations.

Signed-off-by: Soman K.S <somanks@gmail.com>
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-06-04 07:23:10 -03:00
Kaushik
35769de430 ospf6d: support for nssa in ospfv3
Fix for the routes which is not classified as best routes.

Signed-off-by: Kaushik <kaushiknath.null@gmail.com>
2021-06-04 07:23:10 -03:00
Kaushik
ad500b22b5 ospf6d: Support for nssa in ospfv3
The following is implemented.
1. Configuring area as NSSA.
2. Generating Type 7 LSA.
3. Conversion of Type 7 to Type 5 ( Default Behavior).
4. NSSA ABR selection.

Reviewed-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Co-authored-by: Kaushik <kaushiknath.null@gmail.com>
Co-authored-by: Soman K.S <somanks@gmail.com>
Signed-off-by: Kaushik <kaushiknath.null@gmail.com>
2021-06-04 07:23:10 -03:00
Donald Sharp
9dddf5fe69
Merge pull request #8759 from idryzhov/ospf6-vrf-fix
ospf6d: fix using vrf interface as a loopback
2021-06-01 16:31:26 -04:00
Rafael Zalamena
06e4c62631
Merge pull request #8765 from idryzhov/bfd-vrf
isisd, ospf6d, pimd: set vrf_id when creating bfd sessions
2021-06-01 17:15:06 -03:00
Mark Stapp
2030df4d30
Merge pull request #8748 from idryzhov/ospf6-vrf-unlink
ospf6d: unlink router from vrf on deletion
2021-06-01 12:06:08 -04:00
Igor Ryzhov
63262607c1 isisd, ospf6d, pimd: set vrf_id when creating bfd sessions
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-31 15:04:13 +03:00
Igor Ryzhov
d16cff32b2 ospf6d: fix using vrf interface as a loopback
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-28 16:14:34 +03:00
Pat Ruddy
de4a0bdaa6 ospf6: fix memory leak in ospf6_abr_examin_summary
Ensure that if allocated route is not added to a table then it is
deleted to avoid leaking memory.
Add a new memory type for route table so that ospf6 routes can be
distinguished in the show memory output in isolation.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-05-27 12:57:25 +01:00
Igor Ryzhov
92699b9bbe ospf6d: unlink router from vrf on deletion
Otherwise `ospf6_lookup_by_vrf_id` returns stale pointer.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-27 14:39:28 +03:00
Igor Ryzhov
6e33da3839
Merge pull request #8738 from gromit1811/bugfix_ospf6_set_tag
ospf6d: Fix route map "set tag" command
2021-05-27 10:07:13 +03:00
Rafael Zalamena
12a52d5551
Merge pull request #8736 from idryzhov/fix-ospf6-debug
ospf6d: fix debug message issues
2021-05-26 15:25:08 -03:00
Mark Stapp
1c8fe10c98
Merge pull request #8732 from idryzhov/fix-ospf6d-crashes
ospf6d: fix possible crashes
2021-05-26 11:32:33 -04:00
Martin Buck
45024ca042 ospf6d: Fix route map "set tag" command
So far, "set tag" was 99% implemented in ospf6d, but registration of the
hook functions was missing, causing "set tag" actions in route maps to be
ignored in ospf6d.

This commit adds the missing hook registration.

Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
2021-05-26 16:03:51 +02:00
Igor Ryzhov
c9ac777a7e ospf6d: fix debug message config write
Fix the following issues:
- if "send" is combined with "recv-hdr", only "send" is shown
- if "recv" is combined with "send-hdr", only "recv" is shown
- if both "send-hdr" and "recv-hdr" are enabled, "; header only" is shown

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-26 11:48:09 +03:00
Igor Ryzhov
63d00b52e7 ospf6d: fix invalid "no debug ospf6 message unknown"
The message is always shown in the config, because IS_OSPF6_DEBUG_MESSAGE
works incorrectly when negated because of missing outer brackets.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-26 11:45:07 +03:00
Igor Ryzhov
b4b6bd0017 ospf6d: fix possible crashes
OSPF6 instance may not exist when processing interface state change.
Do not execute processing steps that require an instance if an area is
not configured for an interface.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-25 21:59:46 +03:00
Rafael Zalamena
0f8443653d ospf6d: fix address sanitizer crash
Don't `memcpy` a `struct prefix` the memory size varies depending on the
original intended type. In this case the original type was (casted away)
`struct prefix_ipv6` and we tried to copy `struct prefix` which is
bigger.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-05-24 08:30:26 -03:00
Donald Sharp
d516382e12
Merge pull request #8645 from idryzhov/ospf6-redistribute-fixes
ospf6 redistribution fixes
2021-05-19 14:42:54 -04:00
Igor Ryzhov
23929ec918 ospf6d: free "default-information originate" config when removing router
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-18 01:27:16 +03:00
Igor Ryzhov
c84bbb2ad0 ospf6d: fix crash when removing router from vrf that doesn't exist
`listgetdata(listhead(list))` crashes for an empty list.

Reproducible with:
```
router ospf6 vrf doesntexist
 default-information originate always
 exit
no router ospf6 vrf doesntexist
```

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-18 01:27:16 +03:00
Igor Ryzhov
8696e8be34 ospf6d: always free redistribute config
When the ospf6 instance in unknown VRF is deleted, the redistribution
config is not freed, because it is not registered in zebra. We should
always free the config regardless of zebra registration status.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-18 01:27:16 +03:00
Igor Ryzhov
82bc4b8a96 ospf6d: fix "default-information originate" in non-existing vrf
If the default route redistribution is configured in OSPF6 router before
the VRF is created, then this is not currently registered in zebra after
the VRF creation.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-18 01:24:22 +03:00
Martin Winter
d390582e64
Merge pull request #8658 from gromit1811/bugfix_8567
Fix #8567 OSPFv3-26.13 ANVL failure
2021-05-13 20:12:43 +02:00
lynne
f85b76195a ospf6d: Limit the number of interface addresses being supported
The code had no limits on addresses configured on an interface running
ospf6d.  The code would crash when more than 100 addresses were added.
This change limits the number of interface address to 100 if mtu is set
to the default value.  If the mtu is set to a jumbo packet size or larger
we will support 200 interface addresses.

Signed-off-by: Lynne Morrison <lynne@voltanet.io>
2021-05-11 09:43:07 -04:00
Martin Buck
2d84ae9c29 ospf6d: Send MAXAGE LS update for received old self-originated LSAs
Fixes OSPFv3-26.13 ANVL RFC conformance bug #8576 by improving the bugfix
for #7030 from 4c63a76a. That commit changed handling of received old
non-MAXAGE LSAs with a MAXAGE counterpart in the LSDB from "add all LSAs to
LSDB and flood non-self-originated ones" to "add & flood only
non-self-originated LSAs and ignore self-originated LSAs". The new behaviour
is similar but adds sending a MAXAGE LS Update for received self-originated
LSAs to remove the old LSAs from the network, resulting in "add & flood
non-self-originated LSAs, don't add but send MAXAGE LS Update for
self-originated LSAs". The missing MAXAGE LS Update is what OSPFv3-26.13
ANVL complained about.

Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
2021-05-11 11:52:07 +02:00
Rafael Zalamena
34723b2fad
Merge pull request #8639 from idryzhov/isis-new-bfd-lib
isisd: rework BFD integration
2021-05-09 17:10:42 -03:00
Russ White
d2b7ab9445
Merge pull request #8347 from volta-networks/fix_ospv6_filter_debug
ospf6d: Fix when an "export-list" or "filter-list out" is configured
2021-05-07 14:27:01 -04:00
Igor Ryzhov
c97b34cf1a lib: remove old bfd library
This commit also adds missing `bfd_protocol_integration_set_shutdown` to
ospf6d and pimd.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-07 12:03:57 +03:00
Rafael Zalamena
4478793c43
Merge pull request #8636 from idryzhov/ospfv3-vrf-support
OSPFv3 VRF support
2021-05-06 08:50:32 -03: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
harios_niral
4e8ccd9213 ospf6d: add internal support for multiple vrfs
Co-authored-by: Kaushik Nath <kaushiknath.null@gmail.com>
Signed-off-by: harios_niral <hari@niralnetworks.com>
2021-05-05 23:17:01 +03:00
lynne
f6c5f2e0c3 ospf6d: Fix when an "export-list" or "filter-list out" is applied.
When an "export-filter" or "filter-list out" was configured on an area the
filter was not applied to existing database.    The user would either have
to restart the neighboring router in the other area or issue a "clear ipv6
ospf6 interface" to cause the neighbor router to resend it's LSAs.   The
new filter would then be applied to these LSAs and permit or deny summary
LSAs from being added/removed from the database.  The code now applies the
filters to the existing database without user needing to take any action
to clear ospfv3 adjacencies.

The second part of the problem was if a rule changed the updated filter was
not applied.  The code has been modifed to now process the rule update and
reapply the filter.

Signed-off-by: Lynne Morrison <lynne@voltanet.io>
2021-05-04 15:28:56 -04:00
Russ White
52a65a8cc6
Merge pull request #8587 from volta-networks/fix_ospf6_message_logs
ospf6d: Make debug logs configurable to only display message headers
2021-05-04 11:53:17 -04:00
Russ White
be7916a032
Merge pull request #8504 from ranjanyash54/link_lsa_priority
ospf6d: Send Link LSAs when interface priority is changed
2021-05-04 10:24:45 -04:00
Russ White
7e4085ca98
Merge pull request #8506 from ranjanyash54/route_json_change
ospf6d: Change structure of "show ipv6 ospf6 route json" command
2021-05-04 10:24:03 -04:00
Mark Stapp
f71e1ff6a9
Merge pull request #8545 from opensourcerouting/assert-our-own
*: make our own assert() actually work
2021-05-03 11:17:36 -04:00
Yash Ranjan
17ab36c6c4 ospf6d: Send Link LSAs when interface priority is changed
As per the ospfv3 conformance test 24.3

SETUP: Configure DIface-0 with priority set to <hprty>.
ANVL: Establish full adjacency with DUT for neighbor Rtr-0-A on DIface-0.
DUT: Exchange all the <OSPF-DD> packets, during adjacency establish- ment.
ANVL: Verify that the received <OSPF-DD> packets contain: • one header of Link-LSA, originated by DUT.
ANVL: Send <OSPF-LSR> packet from neighbor Rtr-0-A to DIface-0 con- taining:
• One Request Tuple for Link-LSA originated by DUT.
ANVL: Listen (for upto 2 * <RxmtInterval> seconds) on DIface-0. DUT: Send <OSPF-LSU> packet.
ANVL: Verify that the received <OSPF-LSU> packet contains:
• •
one Link-LSA, originated by DUT, contains: Rtr Pri field set to <hprty>.
----------
When interface priority is changed Link LSAs should be tranmitted
with the priority set.

When the link priorty chanages, the drbdr algorithm is called, which
can change the state of the interface. But if the state does not
changes then LINK LSAs are not transmitted.

This PR fixes this issue. If the state is changed, then LINK LSAs
will anyways be tranmitted. But in case the state is not changed,
even in that case Link LSAs are tranmitted.

Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2021-05-02 10:19:16 -07:00
lynne
f44d0f5eca ospf6d: Make debug logs configurable to only display message headers
This change allows the user to only log the message header and not
include all the LSAs in each packet.   In a large setup printing out
all the LSAs in each packet can make the system very hard to debug.
When the user finds an issue with the adjacency not coming up or in a
specific packet type they can turn on a full dump of the message.

Signed-off-by: Lynne Morrison <lynne@voltanet.io>
2021-04-29 08:40:34 -04:00
Yash Ranjan
a49ef569de ospf6d: Change structure of "show ipv6 ospf6 route json" command
The output of "show ipv6 ospf6 route json" was not in the same
format as "show ip ospf route json". Currently ipv6 and ipv4 route
tables as well as ospfv2 have prefix as the key, but the same
is not true for ospfv3.

The structure of the json objects needs to be changed.

Currently the structure present is
frr(config-ospf6)# do show ipv6 ospf6 route json
{
  "routes":[
    {
      "destination":"66:ff::\/64",
      "isBestRoute":true,
      "destinationType":"N",
      "pathType":"IA",
      "duration":"00:00:06",
      "nextHops":[
        {
          "nextHop":"::",
          "interfaceName":"ens256"
        }
      ]
    }
  ]
}
It is changed to:
frr(config-ospf6)# do show ipv6 ospf6 route json
{
  "routes":{
    "12::2\/128":{
      "isBestRoute":true,
      "destinationType":"N",
      "pathType":"IA",
      "duration":"00:01:22",
      "nextHops":[
        {
          "nextHop":"::",
          "interfaceName":"ens192"
        }
      ]
    }
}

Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2021-04-28 21:18:04 -07:00
Russ White
43f337aee8
Merge pull request #8487 from pguibert6WIND/ospf6_vrfs
ospf6d: add 'show ipv6 ospf6 vrfs' command
2021-04-27 15:06:11 -04:00
David Lamparter
1f8031f79a *: make sure config.h or zebra.h is first
`config.h` has all the defines from autoconf, which may include things
that switch behavior of other included headers (e.g. _GNU_SOURCE
enabling prototypes for additional functions.)

So, the first include in any `.c` file must be either `config.h` (with
the appropriate guard) or `zebra.h` (which includes `config.h` first
thing.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-04-23 12:06:35 +02:00
Rafael Zalamena
1f7be0d242 ospf6d: add support for BFD profiles
Allow user to pre configure BFD sessions using profiles.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-04-22 16:10:04 -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
0c4285d77e build: properly split CFLAGS from AC_CFLAGS
`CFLAGS` is a "user variable", not intended to be controlled by
configure itself.  Let's put all the "important" stuff in AC_CFLAGS and
only leave debug/optimization controls in CFLAGS.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-04-21 15:42:36 +02:00
David Lamparter
09781197b6 build: make builddir include path consistent
... by referencing all autogenerated headers relative to the root
directory.  (90% of the changes here is `version.h`.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-04-21 15:42:33 +02:00
Mobashshera Rasool
ffdc63f9b4 ospf6d: Do not delete external table when configure max-path
Issue: When maximum-path is configured in ospf6 view, the
function ospf6_restart_spf deletes the external table as well
which is not required since that stores the redistribute routes.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-04-19 05:28:24 +00:00
Yash Ranjan
f85a41124b ospf6d: Fix coredump when "no interface IFNAME area <A.B.C.D>" is called
When oi->area == NULL, it tries to print the
interface's area name, but no area is present.
Print the area name from the command argument instead.

Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2021-04-18 04:22:56 -07:00
Philippe Guibert
dd7fb1db6c ospf6d: add 'show ipv6 ospf6 vrfs' command
this command summarises the ospf6 instances along with the router-id and
the vrf_id associated.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-04-16 16:21:13 +02:00