Commit graph

626 commits

Author SHA1 Message Date
ckishimo 9fdb4735ad ospfd: restart spf when distance is updated
if r1 has a route received from a neighbor with the default administrative
distance configured

    r1# sh ip route
    Codes: K - kernel route, C - connected, S - static, R - RIP,
           O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
           T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR,
           f - OpenFabric,
           > - selected route, * - FIB route, q - queued, r - rejected, b - backup
           t - trapped, o - offload failure

    O>* 1.1.1.1/32 [110/20] via 10.0.12.2, r1-r2-eth0, weight 1, 00:00:41

if we change the administrative distance

    r1(config)# router ospf
    r1(config-router)# distance 50

this is not applied as there are no changes in the routing table

    r1# sh ip route
    Codes: K - kernel route, C - connected, S - static, R - RIP,
           O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
           T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR,
           f - OpenFabric,
           > - selected route, * - FIB route, q - queued, r - rejected, b - backup
           t - trapped, o - offload failure

    O>* 1.1.1.1/32 [110/20] via 10.0.12.2, r1-r2-eth0, weight 1, 00:00:13

This commit will force the update of the routing table with the new configured distance

    r1# sh ip route
    Codes: K - kernel route, C - connected, S - static, R - RIP,
           O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
           T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR,
           f - OpenFabric,
           > - selected route, * - FIB route, q - queued, r - rejected, b - backup
           t - trapped, o - offload failure

    O>* 1.1.1.1/32 [50/20] via 10.0.12.2, r1-r2-eth0, weight 1, 00:00:14

Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
2022-02-01 08:51:17 +01:00
anlan_cs 4b939ad230 ospfd: adjust type of "aggr_delay_interval"
Adjust type of "aggr_delay_interval":
Just replace `unsigned int` with `uint16_t` for range is (50..1800).

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-01-28 20:11:40 -05:00
anlan_cs d1b1eae14b ospfd: fix missing "aggregation timer" in running configuration
Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-01-28 20:04:31 -05:00
anlan_cs 78cf887718 ospfd: a few minor fixes on ospfd cli
Two minor fixes:
    - remove redundant "(a.b.c.d/m)" in "prefix" description
    - remove some annoying space in "summary-address" and "tag"

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-01-28 20:04:31 -05:00
Donatas Abraitis 7a90d91586
Merge pull request #10408 from idryzhov/no-opaque-by-default
*: do not send opaque data to zebra by default
2022-01-28 12:54:16 +02:00
anlan_cs ec88a72a37 ospfd: fix loss of mixed form in "range" command
Currently "range" command can only accept `cost` or `substitute`
individually, and `show running` will mix them.

So need make it accept mixed form with both of them, otherwise
configuration file in mixed form will fail to start.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-01-26 16:44:46 -05:00
Russ White e48b2fea63
Merge pull request #10411 from idryzhov/if-config-vrf-name
*: do not print vrf name for interface config when using vrf-lite
2022-01-25 11:34:59 -05:00
Igor Ryzhov 870791a3b5 *: do not send opaque data to zebra by default
Opaque data takes up a lot of memory when there are a lot of routes on
the box. Given that this is just a cosmetic info, I propose to disable
it by default to not shock people who start using FRR for the first time
or upgrades from an old version.

Fixes #10101.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2022-01-24 22:18:46 +03:00
Russ White c2a0f12f78
Merge pull request #10407 from idryzhov/ospf-opaque-crash
ospfd: fix crash on "ospf send-extra-data zebra"
2022-01-24 07:34:30 -05:00
Igor Ryzhov 788a036fdb *: do not print vrf name for interface config when using vrf-lite
VRF name should not be printed in the config since 574445ec. The update
was done for NB config output but I missed it for regular vty output.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2022-01-24 14:44:05 +03:00
Russ White 2d9e10d095
Merge pull request #10318 from donaldsharp/redistribution
OSPF Redistribution
2022-01-23 22:30:24 -05:00
Igor Ryzhov 6ae27a4be5 ospfd: fix crash on "ospf send-extra-data zebra"
`ospf->new_table` is NULL if the OSPF instance has no routes.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2022-01-23 16:10:55 +03:00
Russ White 05786ac774
Merge pull request #9644 from opensourcerouting/ospf-opaque-attrs
OSPF opaque route attributes
2022-01-18 09:08:38 -05:00
Donald Sharp 0fa6d92b90 ospfd: Add counts of lsa types to summary command
Add the ability to know the number of lsa type's we
hold in the database as part of the json output.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-01-18 08:39:40 -05:00
Rafael Zalamena 4e4c027803
Merge pull request #10183 from idryzhov/rework-vrf-rename
*: rework renaming the default VRF
2022-01-17 08:45:12 -03:00
Renato Westphal 5b5d66c431 lib, ospfd, ospf6d, zebra: add OSPF opaque route attributes
Update ospfd and ospf6d to send opaque route attributes to
zebra. Those attributes are stored in the RIB and can be viewed
using the "show ip[v6] route" commands (other than that, they are
completely ignored by zebra).

Example:
```
debian# show ip route 192.168.1.0/24
Routing entry for 192.168.1.0/24
  Known via "ospf", distance 110, metric 20, best
  Last update 01:57:08 ago
  * 10.0.1.2, via eth-rt2, weight 1
    OSPF path type        : External-2
    OSPF tag              : 0

debian#
debian# show ip route 192.168.1.0/24 json
{
  "192.168.1.0\/24":[
    {
      "prefix":"192.168.1.0\/24",
      "prefixLen":24,
      "protocol":"ospf",
      "vrfId":0,
      "vrfName":"default",
      "selected":true,
      [snip]
      "ospfPathType":"External-2",
      "ospfTag":"0"
    }
  ]
}
```

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2022-01-15 17:22:27 +01:00
Donatas Abraitis a38db2fac7 ospfd: Use vty_json() for show_ip_ospf_gr_helper_cmd
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-01-12 22:51:46 +02:00
anlan_cs ea3f3df53f ospfd: correct one word of the output message
Signed-off-by: anlan_cs <anlan_cs@tom.com>
2022-01-11 08:54:21 -05:00
anlan_cs ff5c476dc2 ospfd,ospf6d: make clear the comparison of routemap name
Comparison of the two pointer is confusing, they have no relevance
except the time both of them are empty.

Additionly modify one variable name and correct some comment words, they
are same in both ospfd and ospf6d.

Signed-off-by: anlan_cs <anlan_cs@tom.com>
2022-01-10 23:24:24 -05:00
Igor Ryzhov ac2cb9bf94 *: rework renaming the default VRF
Currently, it is possible to rename the default VRF either by passing
`-o` option to zebra or by creating a file in `/var/run/netns` and
binding it to `/proc/self/ns/net`.

In both cases, only zebra knows about the rename and other daemons learn
about it only after they connect to zebra. This is a problem, because
daemons may read their config before they connect to zebra. To handle
this rename after the config is read, we have some special code in every
single daemon, which is not very bad but not desirable in my opinion.
But things are getting worse when we need to handle this in northbound
layer as we have to manually rewrite the config nodes. This approach is
already hacky, but still works as every daemon handles its own NB
structures. But it is completely incompatible with the central
management daemon architecture we are aiming for, as mgmtd doesn't even
have a connection with zebra to learn from it. And it shouldn't have it,
because operational state changes should never affect configuration.

To solve the problem and simplify the code, I propose to expand the `-o`
option to all daemons. By using the startup option, we let daemons know
about the rename before they read their configs so we don't need any
special code to deal with it. There's an easy way to pass the option to
all daemons by using `frr_global_options` variable.

Unfortunately, the second way of renaming by creating a file in
`/var/run/netns` is incompatible with the new mgmtd architecture.
Theoretically, we could force daemons to read their configs only after
they connect to zebra, but it means adding even more code to handle a
very specific use-case. And anyway this won't work for mgmtd as it
doesn't have a connection with zebra. So I had to remove this option.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-12-21 22:09:29 +03:00
Donald Sharp 9d472a3581
Merge pull request #10098 from opensourcerouting/ospf-gr-topotest-fix
ospfd: fix incorrect detection of topology changes in helper mode
2021-12-21 08:43:32 -05:00
Igor Ryzhov cb3fa0a612
Merge pull request #10124 from ton31337/feature/vty_json 2021-11-29 02:11:29 +03: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 92ef007878 ospfd: Convert vty_out to vty_json for JSON
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-25 17:50:30 +02:00
Donatas Abraitis d63f3ff7cc ospfd: Replace prefix2str for JSON to %pFX
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-25 17:30:21 +02:00
Renato Westphal 003d3dbead Revert "ospfd: remove commands for broken GR helper mode"
This reverts commit accef597df.
2021-11-23 15:31:39 -03:00
Igor Ryzhov 096f7609f9 *: cleanup ifp->vrf_id
Since f60a1188 we store a pointer to the VRF in the interface structure.
There's no need anymore to store a separate vrf_id field.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-22 20:47:23 +03:00
Donatas Abraitis 4e9a98636f *: Remove unused variables
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-18 18:45:41 +02:00
Donatas Abraitis 20308be317 ospfd: Replace inet_ntop to %pI4/6 for JSON outputs
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-18 18:45:39 +02:00
Donatas Abraitis 67ca5030f7
Merge pull request #10014 from rgirada/ospf_nbr_cov
ospfd: fixing few coverity issues in ospf_vty.c
2021-11-15 17:55:35 +02:00
Russ White b761cb131a
Merge pull request #9864 from ton31337/feature/access_list_autocomplete
lib: Add autocomplete for access-lists
2021-11-11 08:03:33 -05:00
Igor Ryzhov accef597df ospfd: remove commands for broken GR helper mode
Issue #9983 explains what is wrong with the GR helper mode.

To unblock the CI that fails almost all the time on the ospf_gr_topo1
test, remove the commands and disable the test. Also add a reminder to
completely remove the helper mode if no one fixes the code in a month.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-10 19:17:03 +03:00
rgirada 89f472acb4 ospfd: fixing few coverity issues in ospf_vty.c
Description:
	timerval datastructure is being used without initialization.
	Using these uninitialized parameters can lead unexpected results
	so initializing before using it.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-11-09 04:35:12 -08:00
Russ White 438205d540
Merge pull request #9777 from rgirada/ospf_nbr
ospfd: Few modifications in "show ip ospf neighbor" o/p.
2021-11-05 15:15:45 -04:00
Donatas Abraitis c60dec369a lib: Add autocomplete for access-lists
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-31 20:26:06 +02:00
Donatas Abraitis 1c3f03f79d ospfd: Add autocomplete for area X filter-list prefix
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-28 14:01:13 +03:00
rgirada 059fd3a48a ospfd: Adding apropriate ism state in ptop neighbors.
Description:
	In PointToPoint networks, There wont be DR and BDR.
	But by default, All neighbours ism state is shown as
	DR_OTHER.

	Changed the nbr state format to <nbrsate>/- (ex : FULL/-)
	to P2pnetworks.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-10-26 05:36:20 -07:00
rgirada eb4ed6e8c7 ospfd: Few modifications in "show ip ospf neighbor" o/p.
Description:
	1. Adding uptime to the 'show ip ospf neighbor' o/p.
	2. Adding uptime and deadtime in string format for json consumption.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-10-26 05:36:20 -07:00
Igor Ryzhov f60a11883c lib: allow to create interfaces in non-existing VRFs
It allows FRR to read the interface config even when the necessary VRFs
are not yet created and interfaces are in "wrong" VRFs. Currently, such
config is rejected.

For VRF-lite backend, we don't care at all about the VRF of the inactive
interface. When the interface is created in the OS and becomes active,
we always use its actual VRF instead of the configured one. So there's
no need to reject the config.

For netns backend, we may have multiple interfaces with the same name in
different VRFs. So we care about the VRF of inactive interfaces. And we
must allow to preconfigure the interface in a VRF even before it is
moved to the corresponding netns. From now on, we allow to create
multiple configs for the same interface name in different VRFs and
the necessary config is applied once the OS interface is moved to the
corresponding netns.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-10-19 15:29:51 +03:00
Renato Westphal 512901ae53
Merge pull request #9822 from donaldsharp/ospf_testing
Ospf testing
2021-10-13 23:38:44 -03:00
Donald Sharp 3766c36a20 ospfd: Add converged and role json output for neighbor command
The `show ip ospf neighbor json` command was displaying
state:`Full\/DR`

Where state was both the role and whether or not the neigbhor
was converged.  While from a OSPF perspective this is the state.
This state is a combination of two things.

This creates a problem in testing because we have no guarantee
that a particular ospf router will actually have a particular role
given how loaded our topotest systems are.  So add a bit of json
output to display both the converged status as well as the
role this router is playing on this neighbor/interface.

The above becomes:
state:`Full\/DR`
converged:`Full`
role:`DR`

Tests can now be modified to look for `Full` and allow it to
continue.  Most of the tests do not actually care if this
router is the DR or Backup.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-13 12:40:35 -04:00
Renato Westphal 44076f4dc7 ospfd: use ospf_get_name() wherever possible
Small cleanup to reduce code duplication.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-10-09 20:36:47 -03:00
Renato Westphal 859bce816b ospfd: rename the "graceful-restart helper-only" command
Considering that both the GR helper mode and restarting mode can be
enabled at the same time, the "graceful-restart helper-only" command
can be a bit misleading since it implies that only the helper mode
is enabled. Rename the command to "graceful-restart helper enable"
to clarify what the command does.

Start a deprecation cycle of one year before removing the original
command

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-21 17:42:03 -03:00
Donald Sharp 19d37e54a0 ospfd: Don't allocate json memory unless we have json output
Several functions in ospf_vty.c were allocating json memory
irrelevant if it was needed or not and then at the end of the loop
free'ing it if it was not used.  Clean up the access pattern.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-07 10:10:50 -04:00
Donald Sharp e77564ccd4 ospfd: Fix usage of JSON_C_TO_STRING_NOSLASHESCAPE
The usage of json_object_to_json_string_ext is meant for
generation of output string and returns a `char *` pointer
to the `formatted` output.  Just calling it does nothing
and it's expensive to boot.

Modify the code in ospfd to just output with the NOSLASHESCAPE
when outputting.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-07 09:36:39 -04:00
Mobashshera Rasool 6f3e19b736 ospfd: Memory Leak seen at show_ip_ospf_neighbor_all_common.
Problem Statement:
==================
Memory Leak seen at  show_ip_ospf_neighbor_all_common (ospf_vty.c:4635)

RCA:
=================
In function show_ip_ospf_neighbor_all_common, one child json object is not
 added to the parent child object when there is no nbma neighbor. Hence
 the memory leak.

Fix:
=================
Add the child object to the parent json object.

Fixes: #9548

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-09-03 04:06:15 -07:00
Mobashshera Rasool 2c1f2d2ad9 ospfd: add dead-interval 40 if configured in show running
Problem Statement:
==================
When hello-interval is configured as 5, automatically dead interval becomes
4 times of hello i.e 20 seconds. But user wants the dead interval as
40 seconds and hello as 5 seconds. Therefore user configures it.
Now "ip ospf dead-interval 40" is not shown in "show running-config"
Therefore when user restarts the daemon, the dead interval goes back to
20 seconds and the neighbors are down.

Fix:
==================
If user configures dead-interval as 40, show it in show running config.

Fixes: #9401

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-08-30 23:02:39 -07: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
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
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
Donald Sharp 761704b370
Merge pull request #9092 from rgirada/rmap
ospfd: OSPF hello packets not sent with configured hello timer
2021-08-03 21:18:21 -04:00
Russ White f61a950acf
Merge pull request #9239 from idryzhov/ospf-passive-fix
ospfd: fix "no ip ospf passive" command
2021-08-03 09:21:14 -04:00
Igor Ryzhov 82f0277b35 ospfd: fix "no ip ospf passive" command
This command is currently always treated as an "unset" command, assuming
that active is the default type of the interface. In reality, the default
type of the interface can be changed using "passive-interface default"
command. Both "no" and regular commands can be "set" commands, depending
on the default value. They are treated as an "unset" when there's already
a config of the opposite type.

All this logic is in ospf_passive_interface_update.

Fixes #9240.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-07-30 15:08:08 +03: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
Christian Hopps 1b8049c79f ospfd: remove gratuitous non-ascii quotation marks
Signed-off-by: Christian Hopps <chopps@labn.net>
2021-07-27 17:13:39 +00:00
rgirada be418160a7 ospfd: OSPF hello packets not sent with configured hello timer
Description :
	ospf hello timer is not getting refelcted upon
	changing the hello interval.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-07-22 10:22:07 -07:00
rgirada c88ad8ec5b ospfd: ospfd crash while giving 'clear ip ospf neighbor'
Description:
	Ospf process crashes upon giving 'clear ip ospf neighbor' with
        self routerId. It is asserting if it is a self neighbor in ospf
        neighbour kill event processing.
	Added a check to validate the provided router-id is self
        router-id.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-07-20 04:39:05 -07:00
Russ White 000df71ccd
Merge pull request #8767 from opensourcerouting/ospfd-gr
ospfd: introduce support for Graceful Restart (restarting mode)
2021-07-13 06:39:53 -04: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
Renato Westphal 1051417011 ospfd: introduce support for Graceful Restart (restarting mode)
RFC 3623 specifies the Graceful Restart enhancement to the OSPF
routing protocol. This PR implements support for the restarting mode,
whereas the helper mode was implemented by #6811.

This work is based on #6782, which implemented the pre-restart part
and settled the foundations for the post-restart part (behavioral
changes, GR exit conditions, and on-exit actions).

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 ospf`
  EXEC-level command needs to be issued before restarting the ospfd
  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 ospfd 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.

Co-authored-by: GalaxyGorilla <sascha@netdef.org>
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-07-05 11:43:02 -03:00
Mark Stapp 5537beafd1
Merge pull request #8955 from mobash-rasool/ospfv2-fixes
ospfd: show ip ospf route json does not shown metric and tag
2021-07-02 09:03:53 -04: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
Mobashshera Rasool 67df36493d ospfd: show ip ospf route json does not shown metric and tag
Problem Statement:
==================
[FRR OSPF] show ip ospf route json does not shown metric and tag.

Root Cause Analysis:
===================
In function show_ip_ospf_route_external, type 2 cost is not added in json.
Hence it is not displayed.

Fix:
=================
1. Add type2cost in the json display
2. Tag was also missing, added that as well

Issue: #8729

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-06-30 07:23:38 +00: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
Olivier Dugeon 3898a4522f
Merge pull request #8798 from opensourcerouting/ospfd-fixes
ospfd: assorted fixes
2021-06-09 09:06:42 +02:00
Renato Westphal b3d498f8b7 ospfd: fix crash when displaying neighbor data in JSON
Add a null check to protect against the case where the neighbor
inactive timer is disabled. That can happen when the router is
acting as a helper for another router that is attempting to restart
gracefully.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-06-08 11:51:12 -03:00
Igor Ryzhov 3eec4ee077 ospfd: fix passive interface configuration
Currently, passive interface flag is configured from the router node
using "passive-interface IFNAME". 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 "ip ospf"
  prefix
- it is not in line with OSPFv3 - passive flag is configured from the
  interface node using "ipv6 ospf6 passive" command
- most importantly, it doesn't work correctly when the interface is in
  a different VRF - when using VRF-lite, it incorrectly changes the
  vrf_id of the interface and it becomes desynced with the actual state;
  when using netns, it creates a new fake interface and configures it
  instead of configuring the necessary interface

To fix all the problems, this commit adds a new command to the interface
configuration node - "ip ospf passive". 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-05 18:25:01 +03:00
Don Slice b56114aa9e ospfd: "ip ospf area" command can select wrong process
Found that in some circumstances, when the "ip ospf area"
command was entered for the default vrf, the wrong ospf
process would be used to check for the presence of a
"network" statement, causing the "ip ospf area" command to
be rejected. This was due to the command using the ospf
instance lookup to find the right ospf process, which can
be in error depending on when the processes were created.

Signed-off-by: Don Slice <dslice@nvidia.com>
2021-05-20 12:09:27 -04:00
Olivier Dugeon 8db278b5e3 ospfd: Correct Coverity defects
When browsing or parsing OSPF LSA TLVs, we need to use the LSA length which is
part of the LSA header. This length, encoded in 16 bits, must be first
converted to host byte order with ntohs() function. However, Coverity Scan
considers that ntohs() function return TAINTED data. Thus, when the length is
used to control for() loop, Coverity Scan marks this part of the code as defect
with "Untrusted Loop Bound" due to the usage of Tainted variable. Similar
problems occur when browsing sub-TLV where length is extracted with ntohs().

To overcome this limitation, a size attribute has been added to the ospf_lsa
structure. The size is set when lsa->data buffer is allocated. In addition,
when an OSPF packet is received, the size of the payload is controlled before
contains is processed. For OSPF LSA, this allow a secure buffer allocation.
Thus, new size attribute contains the exact buffer allocation allowing a
strict control during TLV browsing.

This patch adds extra control to bound for() loop during TLV browsing to
avoid potential problem as suggested by Coverity Scan. Controls are based
on new size attribute of the ospf_lsa structure to avoid any ambiguity.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2021-05-19 09:48:54 +02:00
Igor Ryzhov 7bced643b9 ospfd: fix redistribution config when vrf doesn't exist
Currently ospfd relies on vrf bitmaps in zclient to check that the
redistribution is configured. This doesn't work when the VRF for OSPF
instance doesn't exist yet, because vrf bitmaps ignore VRF_UNKNOWN id.

Because of this, the following problems occur when the VRF doesn't exist:
- repeated "redistribute smth" command is processed as a first-time
  instead of an update
- "no redistribute smth" doesn't work at all

This commit fixes both issues by relying on internal redistribution
config instead of zclient vrf bitmaps.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-05 19:31:22 +03:00
rgirada 2fbb8f4543 ospfd: show ip ospf interface only shows BDR info, Added DR info.
Description:
	DR information is missing under "show ip ospf interface [json]".
	Added DR infomation to display in "show ip ospf interface".

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-04-29 04:20:14 -07:00
Russ White 8c3d6b8be5
Merge pull request #8455 from achernavin22/ospf_nssa_after_redist2
ospfd: install Type-7 when NSSA area is configured after redistribution
2021-04-20 10:28:49 -04:00
Jafar Al-Gharaibeh d75213d260
Merge pull request #8153 from reubendowle/nhrp-multicast
nhrp, ospf: add nhrp multicast for OSPF DMVPN
2021-04-13 12:49:28 -05:00
Renato Westphal 0a6a5721c6
Merge pull request #8396 from achernavin22/ospf_fast_hello_show_run
ospfd: fix output of dead-interval in show running
2021-04-13 00:14:56 -03:00
Alexander Chernavin 1c1c342d2a ospfd: install Type-7 when NSSA area is configured after redistribution
Currently, if NSSA area is configured before redistribution is enabled,
Type-7 LSA's are installed and flooded. But if NSSA area is configured
after redistribution is enabled, Type-7 LSA's are not installed.

With this change, when NSSA area is configured, schedule a task that
scans for external LSA's. If they exist, install Type-7 and flood to
all NSSA Areas.

There already was an attempt to fix this problem in 0f321812f where
ospf_asbr_nssa_redist_task() was triggered in ospf_abr_task_timer().
This turns out to be incorrect place for this operation because it's
a one-off operation needed only after "area <ID> nssa" execution. And
ospf_abr_task_timer() is a periodic operation. Triggering
ospf_asbr_nssa_redist_task() in ospf_abr_task_timer() caused a problem
that was fixed in 945eec2b6 making the problem with NSSA area
configured after redistribution actual again.

Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
2021-04-12 09:34:20 -04:00
Mark Stapp 519b14645e ospfd: permit over-write of message-digest-key
Allow over-write of message-digest-key interface config. Most
attributes handle multi-instance by ... ignoring instances,
and tolerating repeated config: do the same for md5 auth.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-04-06 15:26:51 -04:00
Alexander Chernavin 6dd632c65d ospfd: fix output of dead-interval in show running
When you set OSPF hello-interval for an interface and dead-interval is
not set for this interface, dead-interval will be calculated and set
automatically. "show running-config" will contain an invalid command:

    test(config)# interface vpp1
    test(config-if)# ip ospf area 0
    test(config-if)# ip ospf hello-interval 1
    test(config-if)# exit
    test(config)#
    test(config)# do show running-config
    ...
    interface if1
     ip ospf area 0
     ip ospf dead-interval minimal hello-multiplier 0
     ip ospf hello-interval 1
    !
    ...

It causes frr-reload.py to fail because of this:

    # vtysh -c "show running-config no-header" | vtysh -m -f -
    line 9: % Unknown command:  ip ospf dead-interval minimal hello-multiplier 0
    ...

With this change, output "ip ospf dead-interval" only if it has value
configured explicitly.

Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
2021-04-06 05:34:55 -04:00
Amol Lad bc97889b39 ospfd: Support use of ospf with DMVPN
Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2021-04-06 09:22:59 +12:00
Igor Ryzhov a900cece99 ospfd: ignore duplicated "ip ospf area" commands
Fixes #8388.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-04-02 03:22:24 +03:00
Mark Stapp ea631ac834
Merge pull request #8058 from rgirada/ospf-ecmp
ospfd: Max multipath config support
2021-03-30 11:57:33 -04:00
Mark Stapp 5c9254bd52
Merge pull request #8362 from idryzhov/fix-ospf-cli-count
ospfd: fix counting of "ip ospf area" commands
2021-03-30 08:48:25 -04:00
Igor Ryzhov cbf32f74ef ospfd: fix counting of "ip ospf area" commands
Instead of trying to maintain if_ospf_cli_count, let's directly count
the number of configured interfaces when it is needed. Current approach
sometimes leads to an incorrect counter.

Fixes #8321.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-03-30 11:51:21 +03:00
rgirada 3d5b985577 ospfd: Max multipath config support
Description:
	OSPF does not have an option to control the maximum multiple
	equal cost paths to reach a destination/route(ECMP).
	Currently, it is using the system specific max multiple paths.
	But Somtimes, It requires to control the multiple paths from ospf.
	This cli helps to configure the max number multiple paths in ospf.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-03-29 22:04:46 -07:00
Mark Stapp 9e0a845861
Merge pull request #8338 from idryzhov/fix-ospfd-sa-warning
ospfd: fix SA warning
2021-03-25 12:15:05 -04:00
Igor Ryzhov acaeb9fdd5 ospfd: fix SA warning
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-03-25 15:29:43 +03:00
ckishimo c317eddbce ospfd: add support for suppress_fa
This command will trigger the OSPF forwarding address suppression in
translated type-5 LSAs, causing a NSSA ABR to use 0.0.0.0 as a forwarding
address instead of copying the address from the type-7 LSA

Example: In a topology like: R1 --- R2(ABR) --- R3(ASBR)

R3 is announcing a type-7 LSA that is translated to type-5 by the R2 ABR.
The forwarding address in the type-5 is by default copied from the type-7

    r1# sh ip os da external

                    AS External Link States

      LS age: 6
      Options: 0x2  : *|-|-|-|-|-|E|-
      LS Flags: 0x6
      LS Type: AS-external-LSA
      Link State ID: 3.3.3.3 (External Network Number)
      Advertising Router: 10.0.25.2
      LS Seq Number: 80000001
      Checksum: 0xcf99
      Length: 36

      Network Mask: /32
            Metric Type: 2 (Larger than any link state path)
            TOS: 0
            Metric: 20
            Forward Address: 10.0.23.3    <--- address copied from type-7 lsa
            External Route Tag: 0

    r2# sh ip os database

                    NSSA-external Link States (Area 0.0.0.1 [NSSA])

    Link ID         ADV Router      Age  Seq#       CkSum  Route
    3.3.3.3         10.0.23.3          8 0x80000001 0x431d E2 3.3.3.3/32 [0x0]

                    AS External Link States

    Link ID         ADV Router      Age  Seq#       CkSum  Route
    3.3.3.3         10.0.25.2          0 0x80000001 0xcf99 E2 3.3.3.3/32 [0x0]

    r2# conf t
    r2(config)# router ospf
    r2(config-router)# area 1 nssa suppress-fa
    r2(config-router)# exit
    r2(config)# exit

    r2# sh ip os database

                    NSSA-external Link States (Area 0.0.0.1 [NSSA])

    Link ID         ADV Router      Age  Seq#       CkSum  Route
    3.3.3.3         10.0.23.3         66 0x80000001 0x431d E2 3.3.3.3/32 [0x0]

                    AS External Link States

    Link ID         ADV Router      Age  Seq#       CkSum  Route
    3.3.3.3         10.0.25.2         16 0x80000002 0x0983 E2 3.3.3.3/32 [0x0]

    r1# sh ip os da external

           OSPF Router with ID (11.11.11.11)

                    AS External Link States

      LS age: 34
      Options: 0x2  : *|-|-|-|-|-|E|-
      LS Flags: 0x6
      LS Type: AS-external-LSA
      Link State ID: 3.3.3.3 (External Network Number)
      Advertising Router: 10.0.25.2
      LS Seq Number: 80000002
      Checksum: 0x0983
      Length: 36

      Network Mask: /32
            Metric Type: 2 (Larger than any link state path)
            TOS: 0
            Metric: 20
            Forward Address: 0.0.0.0       <--- address set to 0
            External Route Tag: 0

    r2# conf t
    r2(config)# router ospf
    r2(config-router)# no area 1 nssa suppress-fa
    r2(config-router)# exit

    r1# sh ip os da external

           OSPF Router with ID (11.11.11.11)

                    AS External Link States

      LS age: 1
      Options: 0x2  : *|-|-|-|-|-|E|-
      LS Flags: 0x6
      LS Type: AS-external-LSA
      Link State ID: 3.3.3.3 (External Network Number)
      Advertising Router: 10.0.25.2
      LS Seq Number: 80000003
      Checksum: 0xcb9b
      Length: 36
      Network Mask: /32
            Metric Type: 2 (Larger than any link state path)
            TOS: 0
            Metric: 20
            Forward Address: 0.0.0.0       <--- address set to 0
            External Route Tag: 0

    r2# conf t
    r2(config)# router ospf
    r2(config-router)# no area 1 nssa suppress-fa
    r2(config-router)# exit

    r1# sh ip os da external

           OSPF Router with ID (11.11.11.11)

                    AS External Link States

      LS age: 1
      Options: 0x2  : *|-|-|-|-|-|E|-
      LS Flags: 0x6
      LS Type: AS-external-LSA
      Link State ID: 3.3.3.3 (External Network Number)
      Advertising Router: 10.0.25.2
      LS Seq Number: 80000003
      Checksum: 0xcb9b
      Length: 36

      Network Mask: /32
            Metric Type: 2 (Larger than any link state path)
            TOS: 0
            Metric: 20
            Forward Address: 10.0.23.3    <--- address copied from type-7 lsa
            External Route Tag: 0

Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
2021-03-24 16:06:38 +01:00
Igor Ryzhov 09e2d8ed97
Merge pull request #8203 from opensourcerouting/ospf-bfd-napi
ospfd,doc,topotests: rework OSPFv2 BFD integrantion
2021-03-24 10:36:48 +03:00
Rafael Zalamena 659f4e40dd ospfd: rework BFD integration
Use new BFD API to integrate with OSPFv2.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-03-23 10:18:42 -03:00
Igor Ryzhov a11bce1197 ospfd: fix "show ip ospf database" issues
Current implementation of commands `show_ip_ospf_instance_database_cmd`
and `show_ip_ospf_instance_database_type_adv_router_cmd` have the
following problems:

- they doesn't have "vrf all" argument, however the processing of this
  argument is implemented,

- they incorrectly implement json output for instances - they don't
  output anything to the vty and don't release the json object.

To fix the problems, let's do the following:

1. Split `show_ip_ospf_instance_database_cmd` into two aliases to
   `show_ip_ospf_database_max_cmd` and `show_ip_ospf_instance_database_max_cmd`.
   The code is the same and doesn't need to be duplicated.

2. Split `show_ip_ospf_instance_database_type_adv_router_cmd` into two
   separate functions - one regular and one for instances, which now
   correctly implements the processing for json output.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-03-22 23:37:41 +03:00
David Lamparter 67b0f40c98 *: require semicolon after FRR_CFG_DEFAULT_*
... again ...

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17 06:18:39 +01:00
Igor Ryzhov 409f98ab44 ospfd: don't rely on instance existence in vty
Store instance index at startup and use it when processing vty commands.
The instance itself may be created and deleted by the user in runtime
using `[no] router ospf X` command.

Fixes #7908

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-02-24 15:31:20 +03:00
Igor Ryzhov 1ac88792c0 *: fix all backets
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-02-02 19:11:25 +03:00
Donald Sharp 59293b8e70 ospfd: Remove #if 0 code
The #if 0 code in ospfd, has not been compiled since at least
2012.  If we are at least 9 years old at this point with no effort
to use or save, we should just get rid of it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-28 13:21:12 -05:00
Russ White a9294a8cbd
Merge pull request #7127 from opensourcerouting/ospf_ti-lfa
ospfd: add support for Topology Independent LFA (TI-LFA)
2021-01-26 07:32:04 -05:00
Olivier Dugeon 8b79de507d
Merge pull request #7655 from ckishimo/area
ospfd: fix area removal at interface level
2021-01-19 17:29:39 +01:00
GalaxyGorilla 385a1e07b1 ospfd: Add support for TI-LFA node protection
Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2021-01-19 15:32:13 +00:00
GalaxyGorilla 7fd0729f76 ospfd: TI-LFA basic infrastructure and algorithms
Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2021-01-19 15:32:13 +00:00
Donald Sharp 4168228f25
Merge pull request #7790 from mobash-rasool/ospfv3-max-path
ospfd: Clear ip ospf process and clear ip ospf neighbor
2021-01-18 06:44:18 -05:00
Russ White 50e091e4ad
Merge pull request #7733 from rgirada/ospf_json
ospfd: Adding authentication details to ospf interafce command o/p
2021-01-12 11:23:03 -05:00
Mobashshera Rasool f91ce319d3 ospfd: Clear ip ospf process and clear ip ospf neighbor
Implement the below 2 CLIs to clear the current data in the process
and neighbor data structure.
1. clear ip ospf process
2. clear ip ospf neighbor

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-01-12 10:52:42 +00:00
rgirada 494989342f ospfd: Adding authentication details to ospf interafce command o/p
Description:
	Display configured ospf authentication details in
	"show ip ospf interface" command o/p.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-01-08 09:04:16 -08:00
Louis Scalbert d68e47e162 ospfd: fix no show database output when selecting vrf
No output when selecting a vrf
frr# show ip ospf vrf default database router adv-router 10.125.0.1
VRF Name: default

       OSPF Router with ID (10.125.0.1)

In comparison with:
frr# show ip ospf database router adv-router 10.125.0.1

       OSPF Router with ID (10.125.0.1)

                Router Link States (Area 0.0.0.0)

  LS age: 155
  Options: 0x2  : *|-|-|-|-|-|E|-
(...)

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2020-12-24 15:07:24 +01:00
Russ White 930c9b7be8
Merge pull request #7736 from ton31337/fix/s_addr_INADDR_ANY
*: Replace s_addr check agains 0 with INADDR_ANY
2020-12-15 07:12:49 -05:00
Mark Stapp ce513ac615 ospfd: avoid inet_ntoa
some recent commits re-introduced use of inet_ntoa() - fix
them.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-12-14 17:01:18 -05:00
Donatas Abraitis 3a6290bdd1 *: Replace s_addr check agains 0 with INADDR_ANY
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-12-14 21:03:38 +02:00
Donald Sharp d3e79428d7
Merge pull request #7618 from ckishimo/nssa_role
ospfd: fix cosmetic show ip ospf when NSSA
2020-12-03 16:24:21 -05:00
ckishimo b79c30700c ospfd: fix cosmetic show ip ospf when NSSA
When executing the following command to change the NSSA translator role
from OSPF_NSSA_ROLE_ALWAYS to OSPF_NSSA_ROLE_NEVER
r2(config-router)# area 1 nssa translate-never

During the time the `ospf_abr_nssa_check_status()` function is not executed,
we are in a situation where the role is OSPF_NSSA_ROLE_NEVER (just configured)
but the NSSATranslatorState is still ENABLED

During this time the output of "show ip ospf" displays the following:

r2# show ip ospf
 Area ID: 0.0.0.1 (NSSA)
   Shortcutting mode: Default, S-bit consensus: no
   Number of interfaces in this area: Total: 1, Active: 1
   It is an NSSA configuration.
   Elected NSSA/ABR performs type-7/type-5 LSA translation.
   We are an ABR and    Number of fully adjacent neighbors in this area: 1 (**)

Basically the case TranslatorState=ENABLED && TranslatorRole=ROLE_NEVER is not
covered in `ospf_vty.c`

This PR adds the case TranslatorState=ENABLED and TranslatorRole=ROLE_NEVER
which should only happen for a small period of time

Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
2020-12-02 08:47:28 -08:00
Donald Sharp ae33f4d1ec
Merge pull request #7612 from deastoe/ospf-vlink-auth-cfg
ospfd: vlink auth type not shown in running config
2020-12-02 09:27:16 -05:00
ckishimo 58e5d14073 ospfd: fix area removal at interface level
Areas created via interface command are not being deleted when
executing the command `no ip ospf area x`

With the following configuration:
!
interface eth1
 ip address 10.0.12.2/24
 ip ospf area 0.0.0.100
!
router ospf
!

r2# sh ip ospf
 OSPF Routing Process, Router ID: 2.2.2.2
 Supports only single TOS (TOS0) routes
 ....
 Number of opaque AS LSA 0. Checksum Sum 0x00000000
 Number of areas attached to this router: 1     <--- ***
 Area ID: 0.0.0.100                             <--- ***
   Shortcutting mode: Default, S-bit consensus: ok
   Number of interfaces in this area: Total: 1, Active: 1
   Number of fully adjacent neighbors in this area: 0
   Area has no authentication
   Number of full virtual adjacencies going through this area: 0
   SPF algorithm executed 1 times
   Number of LSA 1
   Number of router LSA 1. Checksum Sum 0x0000f3d4
   Number of network LSA 0. Checksum Sum 0x00000000
   Number of summary LSA 0. Checksum Sum 0x00000000
   Number of ASBR summary LSA 0. Checksum Sum 0x00000000
   Number of NSSA LSA 0. Checksum Sum 0x00000000
   Number of opaque link LSA 0. Checksum Sum 0x00000000
   Number of opaque area LSA 0. Checksum Sum 0x00000000

However when removing the area from the interface, the command
above displays the same information

r2# conf t
r2(config)# int eth1
r2(config-if)# no ip ospf area 0.0.0.100
r2(config-if)# exit
r2(config)# exit

r2# sh ip ospf
 OSPF Routing Process, Router ID: 2.2.2.2
 Supports only single TOS (TOS0) routes
 ....
 Number of opaque AS LSA 0. Checksum Sum 0x00000000
 Number of areas attached to this router: 1       <--- ***
 Area ID: 0.0.0.100                               <--- ***
   Shortcutting mode: Default, S-bit consensus: ok
   Number of interfaces in this area: Total: 0, Active: 0
   Number of fully adjacent neighbors in this area: 0
   Area has no authentication
   Number of full virtual adjacencies going through this area: 0
   SPF algorithm executed 2 times
   Number of LSA 1
   Number of router LSA 1. Checksum Sum 0x0000e26e
   Number of network LSA 0. Checksum Sum 0x00000000
   Number of summary LSA 0. Checksum Sum 0x00000000
   Number of ASBR summary LSA 0. Checksum Sum 0x00000000
   Number of NSSA LSA 0. Checksum Sum 0x00000000
   Number of opaque link LSA 0. Checksum Sum 0x00000000
   Number of opaque area LSA 0. Checksum Sum 0x00000000

r2# sh run
!
interface eth1
 ip address 10.0.12.2/24
!
router ospf
!
end

This PR removes the area when executing `no ip ospf area` command

r2# sh ip ospf
 OSPF Routing Process, Router ID: 2.2.2.2
 Supports only single TOS (TOS0) routes
 ....
 Number of opaque AS LSA 0. Checksum Sum 0x00000000
 Number of areas attached to this router: 0

Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
2020-12-02 05:49:47 -08:00
Duncan Eastoe 83cc5a1fe7 ospfd: vlink auth type not shown in running config
The following virtual-link configuration was not represented in the
running configuration:
  area <area> virtual-link <ip> authentication [null|message-digest]

Signed-off-by: Duncan Eastoe <duncan.eastoe@att.com>
2020-12-01 21:30:28 +00:00
ckishimo d12566a16b ospfd: fix a couple of typos
Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
2020-11-24 07:35:49 -08:00
Donald Sharp fbc48492fc ospfd: Fix excessive doc string for no summary-address .. command
The `no summary-address ..` command had excessive doc string.
Fix.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-17 07:25:24 -05:00
Donald Sharp fddbafcc9e ospfd: Cleanup some clang sa issues
This commit tells the compiler we are intentionally ignoring
the lsa value returned and not doing anything with ret.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-04 11:47:57 -05:00
Olivier Dugeon e035e7142e
Merge pull request #6795 from rgirada/ospf_db_json
ospfd: json support for ospf database command.
2020-11-03 15:42:03 +01:00
rgirada 53e44d0594 ospfd: OSPF external LSA summarisation show commands
Description:
	The below show command introduced to diplay all configured
	summary addresss information along with matching corresponding
	external route information.

	show ip ospf [vrf <NAME|all>] summary-address [detail] [json]

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-11-01 22:06:12 -08:00
rgirada 423e71c45a ospfd: External LSA summarisation config commands.
Description:
	The following config commands introduced for external route
	aggregation.

	[no] summary-address A.B.C.D/M [tag (1-4294967295)]
	[no] summary-address A.B.C.D/M no-advertise
	aggregation timer (5-1800)
	no aggregation timer

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-11-01 22:02:37 -08:00
rgirada f328dc606e ospfd: json support for ospf database command.
Description:
Added json support to ospf lsdb command and its subcommands.
Added json to the following sub commands.
show ip ospf  database json
show ip ospf  database router json
show ip ospf  database network json
show ip ospf  database external json
show ip ospf  database summary json
show ip ospf  database asbr-summary json
show ip ospf  database nssa-external json
show ip ospf  databas max-age json
show ip ospf  database self-originate json

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-11-01 08:25:40 -08:00
Santosh P K 5a066545da
Merge pull request #7301 from idryzhov/ospf-fixes
many ospfd fixes
2020-10-28 20:26:02 +05:30
Olivier Dugeon 0ab14b484c
Merge pull request #7341 from kssoman/nssa_fix
ospfd: External LSA not flushed when area is configured as NSSA
2020-10-27 15:30:31 +01:00
Soman K S 44445dee9a ospfd: External LSA not flushed when area is configured as nssa or stub
Issue:
When the ospf area is changed from default to nssa or stub, the previously
advertised external LSAs are not removed from the neighbor.
The LSAs remain in database till maxage timeout.

Fix:
Advertise the external LSAs with age set to maxage and flood to the
nssa or stub area.

Signed-off-by: kssoman <somanks@gmail.com>
2020-10-24 18:05:40 +05:30
Mark Stapp 96b663a381 ospfd: replace inet_ntoa
Stop using inet_ntoa, use %pI4 etc or inet_ntop instead

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-22 13:37:25 -04:00
Donald Sharp ae32e1c298 ospfd: Convert to using %pFX
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-17 13:39:10 -04:00
Mark Stapp d05d5280e6 ospfd: make reason string production safer
Use to-string functions for GR message codes instead of raw
string array indexing; the values used can come in packets
and are not validated.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-14 12:51:52 -04:00
Igor Ryzhov 15bf52d3e2 ospfd: remove all "ip ospf area" params when clearing instance
Currently, only default area parameter is cleared, but we should do the
same for all area parameters with interface addresses.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-10-14 02:40:30 +03:00
Igor Ryzhov 0549eeda3d ospfd: don't initialize ospf every time "router ospf" is used
Move ospf initialization to the actual place where it is created.
We don't need to do that every time "router ospf" is entered.
Also remove a couple of useless checks that can never be true.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-10-14 02:22:16 +03:00
Igor Ryzhov eb364867d4 ospfd: fix check for network configuration
We should check for existing networks configuration before creating
if_params structure, or it leads to the memory leak.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-10-14 02:20:27 +03:00
Igor Ryzhov e7378cb1e9 ospfd: fix missing newline
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-10-13 22:48:56 +03:00
Jafar Al-Gharaibeh 5875867dba
Merge pull request #7295 from donaldsharp/ospf_crash
ospfd: Prevent crash if transferring config amongst instances
2020-10-13 13:27:55 -05:00
Donald Sharp 2b0a32da60 ospfd: Prevent crash if transferring config amongst instances
If we enter:

int eth0
  ip ospf area 0
  ip ospf 10 area 0
!

This will crash ospf.  Prevent this from happening.

OSPF instances:

a) Cannot be mixed with non-instance
b) Are their own process.

Since in multi-instance world ospf instances are their own process,
when an ospf processes receives an instance command we must remove
our config( if present ) and allow the new config to be active
in the new process.  The problem here is that if you have not
done a `router ospf` above the lookup of the ospf pointer will
fail and we will just crash.  Put some code in to prevent a crash
in this case.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-13 08:16:15 -04:00
Igor Ryzhov e4129293c7 ospfd: fix "no ip ospf area"
This commit fixes the following behavior:
```
nfware(config)# interface enp2s0
nfware(config-if)# ip ospf area 0
nfware(config-if)# no ip ospf area 0
% [ospfd]: command ignored as it targets an instance that is not running
```

We should be able to use the command without configuring the instance.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-10-13 14:52:38 +03:00
rgirada abd5b8c72c ospfd: GR helper specific show commands
Description:
	The following  show commands are added to display helper specific
	information.
	1.show ip ospf graceful-restart helper [detail] [json]
		--> displays user configurations and list of all helpers details.

	2.show ip ospf neighbour detail
		--> diplays helper details

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-09-22 00:02:37 -07:00
rgirada 07b33add1d ospfd: GR helper config commands
Description:
	The following commands are added for helper support.
	1.[no] graceful-restart helper-only
	2.[no] graceful-restart helper-only <A.B.C.D>
	3.[no] graceful-restart helper lsa-check-disable
	4.[no] graceful-restart helper supported-grace-time
	5.[no] graceful-restart helper planned-only

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-09-22 00:02:37 -07:00
Kaushik 182d6bdc16 ospfd : Fix for ospf dead interval and hello due.
1. Ospf dead-interval will be set as 4 times of hello-interval, incase
if it is not set by using "ip ospf dead-interval <dead-val>".
2. On resetting hello-interval using "no ip ospf hello-interval" the
dead interval and hello due will be changed accordingly.

Signed-off-by: Kaushik <kaushik@niralnetworks.com>
2020-09-19 00:29:25 -07:00
Renato Westphal beb91114ec
Merge pull request #6789 from volta-networks/feat_ldp_igp_sync
ldpd: Add support for LDP-IGP Synchronization
2020-09-11 15:55:04 -03:00
lynne 132a782eb8 ospfd: ldp-igp-sync feature: adding ospf support
Signed-off-by: Lynne Morrison <lynne@voltanet.io>
Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-09-09 14:38:44 -04:00
Jakub Urbańczyk a92706bb83 ospfd: make proactive ARP configurable
OSPFD sends ARP proactively to speed up convergence for /32 networks
on a p2p connection. It is only an optimization, so it can be disabled.

It is enabled by default.

Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
2020-08-20 17:19:25 +02:00
Igor Ryzhov 7e5ee52226 ospfd: remove redundant line continuations
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-07-20 18:18:03 +03:00
Donald Sharp 249df50a20
Merge pull request #6701 from deastoe/ospf-area-format
ospf: set display format for range command
2020-07-15 20:17:39 -04:00
George Wilkie ed709ed197 ospfd: set display format for range command
If you configure an area range in decimal format, the running
configuration displays it in dotted format.
Call ospf_area_display_format_set() for area range command,
as it is done for other variants.

Signed-off-by: Duncan Eastoe <duncan.eastoe@att.com>
2020-07-14 16:57:39 +01:00
David Lamparter 3efd0893d0 *: un-split strings across lines
Remove mid-string line breaks, cf. workflow doc:

  .. [#tool_style_conflicts] For example, lines over 80 characters are allowed
     for text strings to make it possible to search the code for them: please
     see `Linux kernel style (breaking long lines and strings)
     <https://www.kernel.org/doc/html/v4.10/process/coding-style.html#breaking-long-lines-and-strings>`_
     and `Issue #1794 <https://github.com/FRRouting/frr/issues/1794>`_.

Scripted commit, idempotent to running:
```
python3 tools/stringmangle.py --unwrap `git ls-files | egrep '\.[ch]$'`
```

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-07-14 10:37:25 +02:00
Rafael Zalamena d4badaf625 ospfd: change retransmit-interval minimum value
The command `area ... virtual-link ... retransmit-interval` supports
1-65535 range and the documentation already said
`ip ospf retransmit-interval` supports that, lets make the DEFUN to
accept that value.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-05-24 10:37:04 -03:00
Quentin Young fc746f1c01 *: manually remove some more sprintf
Take care of some more complicated cases by hand

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-20 19:14:33 -04:00
Quentin Young 772270f3b6 *: sprintf -> snprintf
Replace sprintf with snprintf where straightforward to do so.

- sprintf's into local scope buffers of known size are replaced with the
  equivalent snprintf call
- snprintf's into local scope buffers of known size that use the buffer
  size expression now use sizeof(buffer)
- sprintf(buf + strlen(buf), ...) replaced with snprintf() into temp
  buffer followed by strlcat

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-20 19:14:33 -04:00
David Lamparter f4b8291fcb *: move CLI node names to cmd_node->name
And again for the name.  Why on earth would we centralize this, just so
people can forget to update it?

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:59 +02:00
David Lamparter 243895805a *: move CLI parent data to cmd_node->parent_node
Same as before, instead of shoving this into a big central list we can
just put the parent node in cmd_node.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter 612c2c15d8 *: remove second parameter on install_node()
There is really no reason to not put this in the cmd_node.

And while we're add it, rename from pointless ".func" to ".config_write".

[v2: fix forgotten ldpd config_write]

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter 249a771b63 *: remove cmd_node->vtysh
The only nodes that have this as 0 don't have a "->func" anyway, so the
entire thing is really just pointless.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter 62b346eefa *: clean up cmd_node initializers
... and use named assignments everywhere (so I can change the struct.)

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter 4c1458b595 bgpd, ospfd, ospf6d: long is not bool :(
... Oops ...

(for context, the defaults code originally didn't have a dedicated
"bool" variant and just used long for bools...  I derp'd this when
adding bool as a separate case :( )

Reported-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-02 21:16:04 +02:00
Ruben Kerkhof 1fdc969f7b ospfd: fix range check for metric
Found with -Wlogical-op

Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
2020-03-11 13:56:26 +01:00