Commit Graph

621 Commits

Author SHA1 Message Date
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
Donald Sharp
5e81f5dd1a *: Finish off the __PRETTY_FUNCTION__ to __func__
FINISH IT

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 09:23:22 -05:00
Donatas Abraitis
975a328e2e *: Replace s_addr 0 => INADDR_ANY
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-06 09:00:12 +02:00
Donald Sharp
946de1b95a bgpd, ospfd, zebra: Do not use 0 as VRF_DEFAULT
Explicitly spell out what we are trying to do.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-01-15 08:29:36 -05:00
Donald Sharp
4f63093247
Merge pull request #4765 from opensourcerouting/defaults-v2
lib/*: new config defaults system, v2
2019-12-06 14:07:42 -05:00
David Lamparter
c572fbfe2d ospfd: use new defaults mechanism (v2)
Some preprocessor constants converted to enums to make the names usable
in the preprocessor.

v2: better isolation between core and vty code to make future northbound
conversion easier.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-06 15:13:32 +01:00
Donald Sharp
c84355a932 ospfd: interface name and ip address can be 32 bytes
We are only saving 20 bytes of string output for ospf neighbor
commands.  Fixed output:

act-7326-05# show ip ospf vrf vrf1012 neighbor all
VRF Name: vrf1012

Neighbor ID     Pri State           Dead Time Address         Interface                        RXmtL RqstL DBsmL
9.9.12.11         1 Full/DROther      39.973s 200.254.2.10    swp49s0.2:200.254.2.9                4     0     0
9.9.12.12         1 Full/DROther      39.995s 200.254.2.14    swp49s1.2:200.254.2.13               9     0     0
9.9.12.13         1 Exchange/DROthe   39.981s 200.254.2.18    swp49s2.2:200.254.2.17             157     0     0

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

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-02 15:01:29 +01:00
Igor Ryzhov
1e81afc365 *: remove redundant brackets in commands
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2019-10-08 15:31:40 +03:00
Juergen Werner
0f3af7386e zebra: Do not use connection dest for bcast
The `destination` field of the connection structure was used to store
the broadcast address, if the connection was not p2p. This multipurpose
is not very evident and the benefits over calculating the bcast address
on the fly minimal.

Signed-off-by: Juergen Werner <juergen@opensourcerouting.org>
2019-08-18 18:54:46 +02:00
David Lamparter
d5eac1e0ca ospfd: clean up default route logic
What a mess...

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-08-02 11:29:03 +02:00
Chirag Shah
cb0b2ac6a5 ospfd: fix show ip ospf neigh json
Same ospf neigbor can be learnt via multiple
interfaces, ospf detail json only displayed
last instance only.

Fix json output format to contain "neighbors"
keyword, under which to display all neighbors
for a given vrf.

Fix
show ip ospf neighbor detail json
show ip ospf neighbor detail all json
show ip ospf neighbor <intf name> detail json

Ticket:CM-25528
Reviewed By:
Testing Done:

Run the output with JSON formatter and the output
has passed.

switch1# show ip ospf vrf all neighbor detail json
{
  "default":{
    "vrfName":"default",
    "vrfId":0,
    "neighbors":{
      "0.0.0.2":[
        {
          "ifaceAddress":"14.0.0.22",
          "areaId":"0.0.0.0",
          "ifaceName":"Bridge1.510",
          "nbrPriority":1,
          "nbrState":"Full",
          "stateChangeCounter":6,
          "lastPrgrsvChangeMsec":82668,
          "routerDesignatedId":"14.0.0.22",
          "routerDesignatedBackupId":"14.0.0.21",
          "optionsCounter":2,
          "optionsList":"*|-|-|-|-|-|E|-",
          "routerDeadIntervalTimerDueMsec":36195,
          "databaseSummaryListCounter":0,
          "linkStateRequestListCounter":0,
          "linkStateRetransmissionListCounter":0,
          "threadInactivityTimer":"on",
          "threadLinkStateRequestRetransmission":"on",
          "threadLinkStateUpdateRetransmission":"on",
          "peerBfdInfo":{
            "type":"single hop",
            "detectMultiplier":4,
            "rxMinInterval":600,
            "txMinInterval":800,
            "status":"Down",
            "lastUpdate":"0:00:00:29"
          }
        },
        {
          "ifaceAddress":"14.0.0.26",
          "areaId":"0.0.0.0",
          "ifaceName":"Bridge1.511",
          "nbrPriority":1,
          "nbrState":"Full",
          "stateChangeCounter":6,
          "lastPrgrsvChangeMsec":82658,
          "routerDesignatedId":"14.0.0.26",
          "routerDesignatedBackupId":"14.0.0.25",
          "optionsCounter":2,
          "optionsList":"*|-|-|-|-|-|E|-",
          "routerDeadIntervalTimerDueMsec":36196,
          "databaseSummaryListCounter":0,
          "linkStateRequestListCounter":0,
          "linkStateRetransmissionListCounter":0,
          "threadInactivityTimer":"on",
          "threadLinkStateRequestRetransmission":"on",
          "threadLinkStateUpdateRetransmission":"on"
        },
     ]
    }
  }
}

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-07-09 18:13:22 -07:00
Quentin Young
2951a7a4c2 *: s/TRUE/true/, s/FALSE/false/
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-07-01 17:26:05 +00:00
Donald Sharp
a36898e755
Revert "Ospf missing interface handling 2" 2019-06-23 19:46:39 -04:00
Philippe Guibert
a41c4e1b1f *: change interface structure, from vrf_id to vrf
Field vrf_id is replaced by the pointer of the struct vrf *.
For that all other code referencing to (interface)->vrf_id is replaced.
This work should not change the behaviour.
It is just a continuation work toward having an interface API handling
vrf pointer only.

some new generic functions are created in vrf:
vrf_to_id, vrf_to_name,

a zebra function is also created:
zvrf_info_lookup

an ospf function is also created:
ospf_lookup_by_vrf

it is to be noted that now that interface has a vrf pointer, some more
optimisations could be thought through all the rest of the code. as
example, many structure store the vrf_id. those structures could get
the exact vrf structure if inherited from an interface vrf context.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-12 14:10:28 +02:00
Philippe Guibert
f11e98eca3 *: change if_lookup_by_name() api with vrf
the vrf_id parameter is replaced by struct vrf * parameter.
this impacts most of the daemons that look for an interface based on the
name and the vrf identifier.
Also, it fixes 2 lookup calls in zebra and sharpd, where the vrf_id was
ignored until now.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-12 08:37:54 +02:00
Philippe Guibert
4c634658a6 ospf, ospf6d, zebra, lib: change if_get_by_name prototype with vrf
vrf pointer is used as reference when calling if_get_by_name() function.
this will permit to create interfaces with an unknown vrf_id, since it
is only necessary to get the vrf structure to store the interfaces.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-11 17:10:47 +02:00
Donald Sharp
e425c0196c ospfd: rn may be null
rn is not set the first time through the do {} while (); loop
As such we need to protect against it from being null( although
highly unlikely to ever happen given the ospf code base.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-06 20:10:52 -04:00
Mark Stapp
50ad4b42c1 ospfd: fix some json timer output
Fix a few json output values: a few are in seconds, not msecs,
and one is a number-per-second, not a duration.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-03-13 15:25:46 -04:00
Donald Sharp
1af62044d9 ospfd: When converting to ms divide by 1000
When converting to miliseconds divide by 1000 not
the other way around.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-03-12 20:44:31 -04:00
Quentin Young
4d65d9278e ospfd: strncpy -> strlcpy
strncpy is a byte copy function not a string copy function

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-26 20:50:17 +00:00
Emanuele Di Pascale
188823b080 ospfd: fix no virtual-link cmd
the  command was not checking
correctly in all cases whether the virtual link existed. This caused
bugs in some corner cases, e.g. when two virtual links were created,
one of them was deleted, and the second one was reset with no
authentication - this would instead create a new virtual link with
the area in decimal format.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2019-01-18 12:43:35 +01:00
Renato Westphal
986b87cb3d ospfd: convert a couple of "show" commands to DEFPY
DEFPY commands are easier to maintain and less susceptible to
bugs. In the long term we should try to merge the plethora of
"show ip ospf neighbor" commands (total of 14) into a single DEFPY.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-12-31 11:14:46 -02:00
Renato Westphal
f4f4b6bff5 ospfd: fix wrong argv index in the "show ip ospf neighbor" command
Fixes Issue #3544.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-12-31 11:03:53 -02:00
Philippe Guibert
03ed9f02dc ospfd: remove call to if_lookup_all_vrf
so as to isolate ospf contexts separately for each vrf, the interface
used is cornered to the passed vrf context.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-12-10 08:31:59 +01:00
Philippe Guibert
e9f07a30a9 ospfd: permit reconfiguring network after area suppressed
avoid counting twice the number of areas configured, when entering back
to router ospf config node.

PR=61288
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Acked-by: Emmanuel Vize <emmanuel.vize@6wind.com>
2018-11-09 09:48:38 +01:00
Renato Westphal
8f90d89ba9 lib: retrofit interface commands to the new northbound model
The frr-interface YANG module models interfaces using a YANG list keyed
by the interface name and the interface VRF. Interfaces can't be keyed
only by their name since interface names might not be globally unique
when the netns VRF backend is in use. When using the VRF-Lite backend,
however, interface names *must* be globally unique. In this case, we need
to validate the uniqueness of interface names inside the appropriate
northbound callback since this constraint can't be expressed in the
YANG language. We must also ensure that only inactive interfaces can be
removed, among other things we need to validate in the northbound layer.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-10-27 16:16:12 -02:00
Olivier Dugeon
13894ce894
Merge pull request #3077 from rgirada/ospf_2980_fix
ospfd: Resolved the inconsistency behavior when “default-info origina…
2018-10-09 19:07:33 +02:00
rgirada
1fb93326ad ospfd: issue with the "default-information originate always" command #2980
Made changes such that message wont be sent to zebra to validate default
route existence  if user configured with “always”.

Signed-off-by: rgirada <rgirada@vmware.com>
2018-10-09 02:52:27 -07:00
Sarita Patra
990baca057 ospfd: handling of OSPF_AREA_RANGE_ADVERTISE flag
Issue: # https://github.com/FRRouting/frr/issues/1836

Issue 1: if the router ospf current configuration is "area 0.0.0.2
range 1.0.0.0/24 cost 23" and user try to configure "area 0.0.0.2
range 1.0.0.0/24 not-advertise", the existing o/p is "area 0.0.0.2
range 1.0.0.0/24 cost 23 not-advertise". The keywords "not-advertise"
& "cost" are multually exclusive, so they should not come together.
The vice versa way configuration is working fine.

Fix: When ospf area range "not-advertise", the cost should be initialized
to OSPF_AREA_RANGE_COST_UNSPEC.

Issue 2: if the router ospf current configuration "area 0.0.0.2 range
1.0.0.0/24 substitute 2.0.0.0/24" and user try to configure "area 0.0.0.2
range 1.0.0.0/24 not-advertise" the existing o/p is "area 0.0.0.2 range
1.0.0.0/24 not-advertise substitute 2.0.0.0/24". The keywords
"not-advertise" & "substiture" are multually exclusive, so they should
not come together. The vice versa way configuration is working fine.

Fix: When ospf area range "not-advertise" is configured,
ospf_area_range_substitute_unset() should be get called.

Issue 3: if the router ospf6 current configuration is "area 0.0.0.2
range 2001::/64 cost 23" and user try to configure "area 0.0.0.2 range
2001::/64 advertise", the existing o/p is area 0.0.0.2 range 2001::/64.
The keyword "cost 23" disappears.

Fix: When ospf area range "advertise" is configured and the range is not
NULL, the cost should not be modified.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2018-09-24 21:46:16 -07:00
Donatas Abraitis
766b826f16 osfpd: Install default route after second try instantly
Signed-off-by: Donatas Abraitis donatas.abraitis@gmail.com
2018-09-20 14:30:42 +03:00
David Lamparter
1fbd4e382a
Merge pull request #2945 from dslicenc/bgp-ospf-json
bgpd/ospfd: make bgp and ospf json response a bit more consistent
2018-09-01 05:05:30 +02:00
Don Slice
874f58d87b ospfd: fix more warnings with the bgp ospf json commit
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-08-30 17:24:57 +00:00
Don Slice
94d4c685c5 bgpd/ospfd: resolve warnings for bgp/ospf json commit
Signed-off-by: Don Slice <dslice@cumulusnetwork.com>
2018-08-30 15:54:46 +00:00
Don Slice
9f049418bc bgpd/ospfd: make bgp and ospf json response a bit more consistent
Problem reported that some bgp and ospf json commands did not return
any json output at all if the bgp/ospf instance did not exist.
Additionally, some bgp and ospf json commands did not return any json
output if the instance existed but no neighbors were defined.  This
fix makes these commands more consistent in returning empty braces for
json output and issue a message if not using json output.  Additionally,
made the flag "use_json" a bool to make it consistent since previously,
it had been defined as an int, char, u_char, and bool at various places.

Ticket: CM-21040
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-08-30 12:40:18 +00:00
Philippe Guibert
6895b354ef ospfd: adaptations to handle vrf alias
Some adaptations are done to handle alias when creationg ospf instance.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-08-28 16:23:50 +02:00
Donald Sharp
ec50871f91 ospfd: Remove deprecated code
This code has been deprecated for over a year, let's remove it now.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-09 12:37:54 -04:00
F. Aragon
b575a12c87
bgpd lib ospfd pimd ripngd: null chk (PVS-Studio)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-07-03 15:39:50 +02:00
paco
13f0e43443
ospfd: OoB access (Coverity 1399304 1399286)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-25 17:07:31 +02:00
paco
a2b6e694b1
bgpd isisd ldpd lib ospfd pimd: redundancy (infer)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-20 22:25:28 +02:00
Rafael Zalamena
e4a374681d
Merge pull request #2426 from pacovn/Coverity_23089_Buffer_not_null_terminated
ospfd: buffer termination (Coverity 23089)
2018-06-14 18:02:34 -03:00
paco
1f9d4e3d49
ospfd: buffer termination (Coverity 23089)
Details:
- INET_ADDRSTRLEN is 16, for xxx.xxx.xxx\0, so 15 is now passed
 to the strncpy call instead of 16, ensuring ASCII-z output

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-14 17:43:19 +02:00
paco
e89ffeee92
ospfd: null check (Coverity 1457300)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-13 19:04:43 +02:00
paco
92692be16a
ospfd: dead code (Coverity 1399232)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-13 14:30:06 +02:00
Lou Berger
e24be24183 *: Only test CONFDATE when VERSION_TYPE_DEV defined
Signed-off-by: Lou Berger <lberger@labn.net>
2018-04-03 13:47:50 -04:00
Quentin Young
d7c0a89a3a
*: use C99 standard fixed-width integer types
The following types are nonstandard:
- u_char
- u_short
- u_int
- u_long
- u_int8_t
- u_int16_t
- u_int32_t

Replace them with the C99 standard types:
- uint8_t
- unsigned short
- unsigned int
- unsigned long
- uint8_t
- uint16_t
- uint32_t

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-27 15:13:34 -04:00
Lou Berger
996c93142d *: conform with COMMUNITY.md formatting rules, via 'make indent'
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-06 14:04:32 -05:00
Rafael Zalamena
ddbb463d4f
Merge pull request #1723 from chiragshah6/ospf_vrf_dev
ospfd: fix ospf interface and neighbor json
2018-02-22 17:24:35 -03:00
Chirag Shah
926b88f00d ospfd: Fix distance command
Reset prevoiusly configured distance command options
if user enters new (different) parameters.

Ticket:CM-19635
Testing Done:

R1(config-router)# distance ospf intra-area 45 external 45
R1# show running-config ospfd
router ospf
 distance ospf intra-area 45 external 45

R1(config-router)# distance ospf inter-area 45
R1# show running-config ospfd
router ospf
 distance ospf inter-area 45

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-02-11 21:05:37 -08:00
Chirag Shah
6282e1247d ospfd: fix ospf interface and neighbor json
show ip ospf [vrf all] interface json and
show ip ospf [vrf all] neighbor json to display
objects in dictionary output rather in array list.

Ticket:CM-19115,CM-19097

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-02-07 18:37:50 -08:00
Chirag Shah
29ab3b60d1 ospfd: fix redistribute running config
Testing:
CL(config)# router ospf
CL(config-router)# redistribute static metric-type 2
CL(config)# router ospf
CL(config-router)# default-information originate always metric-type 2

show running output
router ospf
 redistribute static
 default-information originate always
!

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-01-30 10:05:20 -08:00
Chirag Shah
951da43571 ospfd: Fix default-info and redis cmd options
Fix default-information parsing of metric-type,
route-map.
show running to display metic-type 2.

metric, metric-type and route-map can be configured in
any order, running-config displays in specific order..

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-01-29 21:33:32 -08:00
Martin Winter
08c9af9375
Merge pull request #1659 from chiragshah6/ospf_vrf_dev
ospfd: show ip ospf neighbor json output format
2018-01-27 09:17:45 -08:00
Renato Westphal
ea38ced19f ospfd: allow multiple options in the redistribute command
Other variants of the redistribute command (e.g. "redistribute
<ospf|table> (1-65535) ..." already accept multiple options.

Fixes Issue #1670.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-01-24 21:19:28 -02:00
Philippe Guibert
fe3da9e773 ospfd: fix compilation issue with ospfd
the change of vrf_id field from 16 bit to 32 bit leads to some changes
in other daemon.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-01-22 13:52:24 +01:00
Chirag Shah
2bc7673f11 ospfd: show ip ospf neighbor json output format
Current json output does not differentiate start of
neighbor ip object. Adding "neighbors" keyword at the
beginning of neighbor list. This is useful when
displaying vrf level output along with neighbors
list.

Ticket:CM-19097
Testing Done:
show ip ospf neighbor json
show ip ospf vrf all neighbor json

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-01-20 19:30:59 -08:00
Olivier Dugeon
4ff9eb721d
Merge pull request #1647 from chiragshah6/ospf_vrf_dev
ospfd: show ip ospf interface json output format
2018-01-19 17:40:14 +01:00
Donald Sharp
044506e7f8 ospfd: LSDB_LOOP treat it as a loop.
Inform the .clang-format file about LSDB_LOOP and
put the proper indentation for this loop into the
code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-01-17 13:29:58 -05:00
Chirag Shah
7dab10ce94 ospfd: show ip ospf interface json output format
Current json output does not differentiate start of
interface objects. Adding "interfaces" keyword at the
beginning of the interface list. This is useful
when displaying vrf level output along with interface list.

Ticket:CM-19115
Testing Done:
show ip ospf vrf all interface json
show ip ospf vrf all interface <specific intf> json
show ip ospf interface json
show ip ospf interface <specific intf> json

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-01-16 12:49:31 -08:00
Chirag Shah
1406159faa ospfd: Speed up show ip ospf [vrf all] route json
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-01-15 18:00:49 -08:00
Daniel Walton
2b0a905a2e ospfd: do not complain if same area is reconfigured
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

Before
------
cel-redxp-10(config)# router ospf vrf RED
cel-redxp-10(config-router)# network 1.1.1.1/32 area 0.0.0.0
cel-redxp-10(config-router)# network 1.1.1.1/32 area 0.0.0.0
There is already same network statement.
cel-redxp-10(config-router)#

When we see the "There is already same network statement." message
vtysh exits non-zero.  This scenario breaks frr-reload because
the command took and it in the config, it should exit zero here.

After
-----
cel-redxp-10(config)# router ospf vrf RED
cel-redxp-10(config-router)# network 1.1.1.1/32 area 0.0.0.0
cel-redxp-10(config-router)# network 1.1.1.1/32 area 0.0.0.0
cel-redxp-10(config-router)# network 1.1.1.1/32 area 0.0.0.0
cel-redxp-10(config-router)# network 1.1.1.1/32 area 0
cel-redxp-10(config-router)#
cel-redxp-10(config-router)# network 1.1.1.1/32 area 0.0.0.1
There is already same network statement.
cel-redxp-10(config-router)#
2018-01-08 21:16:18 +00:00
Chirag Shah
9a0dfa3aa9 ospfd: Fix no passive interface command parsing
Ticket: CM-19365

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-01-08 08:08:36 -08:00
lihongguang
ca19319b2e ospfd: fix [no] area authentication command
Signed-off-by: lihongguang lhg803@163.com
2018-01-04 07:01:58 +08:00
Chirag Shah
e99734f1d0 ospfd: prevent passive interface cmd crash
Current OSPF VRF configuration are allow pre-provisining even if
VRF is not configured. In such case ospf->vrf_id would VRF_UNKNOWN,
when passive interface configuration done under such ospf instance,
it would lookup all vrf_device and try to create ifp with unknown
vrf_id.

for passive interface config command lookup ifp for vrf_id is within range.

Ticket:CM-19156
Testing Done:
Configure
Cumulus#: router ospf vrf vrf1
Cumulus(config-router)#: passive interface swp16
 interface swp16 not found.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-12-08 17:02:54 -08:00
Chirag Shah
545f0503ed ospfd: fix crash no router ospf/show running
no router ospf removes default ospf instance,
if there are other non-default vrf instance present
with interface level configuration. Lookup ospf instance
for ifp->vrf_id, if ospf instnace present use that
   to access 'instance id'.

Ticket: CM-19078
Testing Done:
run no router ospf and show running config along with other
non-default vrf aware ospf configurations.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-12-04 16:38:16 -08:00
Chirag Shah
c7fd72d2f7 ospfd: Display all vrf aware interface config
OSPF interface specific configuration can be done independent
of router ospf [vrf x] global config.
In cases where ospf interface non default vrf configuration
is done prior to 'router ospf vrf x', show running-config
would not display such configuration.

To display configuration now walk all vrfs and interface list
and only display where OSPF configure params are set.

Ticket:CM-18952
Testing Done:
Tried ospf interface specific configuration with VRF,
where router ospf vrf x is not present.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-12-04 14:54:28 -08:00
Renato Westphal
2e4c229616 *: make clippy usage more consistent
Fixes #1511.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-12-04 19:46:38 -02:00
Russ White
50a157ca96
Merge pull request #1484 from chiragshah6/ospfv3_dev
ospfd: Display NSSA in show running-config
2017-11-29 07:45:04 -05:00
Russ White
1d04ad057d
Merge pull request #1482 from chiragshah6/mdev1
ospfd:  Running-config display ospf (non active) vrf config, OSPF Route json support
2017-11-29 07:44:39 -05:00
Russ White
074f2a3789
Merge pull request #1477 from chiragshah6/ospf_vrf_dev
ospfd: Forward reference ospf area config
2017-11-29 07:39:35 -05:00
Chirag Shah
2643b2bc9d ospfd: Display nssa in show running-config
Display area x.x.x.x nssa configuration in
running-config. Using nssa translate candiate (default)
case to display 'area x nssa'.

Ticket:CM-18947
Reviewed By:
Testing Done:
Tried various combinations of nssa config,
verified show running-config ospfd output

router ospf
 area 2.2.2.2 nssa
  area 2.2.2.2 nssa no-summary

router ospf
 area 2.2.2.2 nssa translate-always
  area 2.2.2.2 nssa no-summary

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-11-26 12:53:44 -08:00
Chirag Shah
0f478e3050 ospfd: show ip ospf route json support
Define JSON_C_TO_STRING_NOSLASHESCAPE used for
escaping forward slash.

Disply json output for
'show ip ospf route [vrf all] json'

Ticket:CM-18659
Reviewed By:
Testing Done:
Configure multiple non-default VRF, inject external routes
via redistribute to ospf area.
checked show ip ospf route vrf all /json based output.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-11-26 09:18:19 -08:00
Chirag Shah
88d771091b ospfd: Running config to display VRF aware OSPF
show running-config to display VRF aware ospf instances
even if VRF is not active. This will allow the user to
configured ospf instances configurations even if VRF is not
active. 'show ip ospf vrf all' does not display until VRF
is active.

Ticket:CM-18949
Reviewed By:
Testing Done:
Configure non-default vrf aware ospfs with prior vrf devices
configured.
All vrf aware 'router ospf' displayed in running-configuration.
Disable one of the vrf device still all vrf aware 'router ospf'
displayed in running-config, but 'show ip ospf vrf all' does
not display for which VRF is not active.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-11-25 18:26:31 -08:00
Chirag Shah
aed7cc626d ospfd: Forward reference ospf area config
Upon restart frr interface configuration applied
prior to 'router ospf' configuration. 'ip ospf area x'
config fails if ospf instance is not active.

Allow 'ip ospf area x' configuration to allow in absence
of ospf instance. Upon 'router ospf' walk through vrf
aware interfaces, active area cofigurations.
When vrf is enabled, router-id update also walk through
vrf aware interfaces to enable area configuration
via network_run_interface.

Ticket: CM-18927
Reviewed By:
Testing Done:
Configured multiple interfaces with 'ip ospf area x'
with multiple areas/interface combinations.
Upon router ospf enable along with vrf is active,
interfaces comes up in respective area, ospf neighborship
comes up fine.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-11-22 13:23:38 -08:00
Chirag Shah
de1ac5fd63 ospfd: Make external routes in ospf VRF aware
Currently, ospf external routers are part of struct
ospf_master which is not vrf aware ospf instance.
All ospf external routes are injected/leaked into all
vrfs.

Moved ospf external routes db to struct ospf to make
vrf aware, such one external routes learnt in one vrf
is not leaked into another vrf.

Ticket:CM-18855
Testing Done:
Inject external route in non-default vrf x, validated
ospf database across the vrf x, validated ospf routes
for vrf x.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-11-21 11:23:08 -08:00
Chirag Shah
6021c6c059 ospfd: VRF aware Router-ID update
Ensure zebra received router-id isolated per vrf instance.
Store zebra received router-id within ospf instance.

Ticket:CM-18657
Reviewed By:
Testing Done:
Validated follwoing sequence
- Create vrf1111
- Create ospf vrf1111 with no router-id
- Assign ip to vrf111
- ospf is assigned zebra assigned router-id which is vrf ip.
- upon remvoing vrf ip, the router-id retained as same until
ospfd restarted.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-11-06 13:15:41 -08:00
Jafar Al-Gharaibeh
49d087178d
Merge pull request #1410 from chiragshah6/mdev
ospfd: clearnup [no] router ospf command
2017-11-06 09:40:49 -06:00
Chirag Shah
34d6798fb5 ospfd: clearnup [no] router ospf command
no router ospf followed by router ospf throws
a message, there isn't active ospf instance.

Fix ospf instance lookup.

Ticket:CM-18675
Testing Done:
Validated router ospf, no router ospf with
VRF and with multi-instance version 'router ospf 2'
configuration clis.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-11-04 16:38:38 -07:00
Chirag Shah
cef262c34a ospfd: fix show ospf neigh json for multile nbrs
Same neighbor learned from multiple ospf interfaces
(all) were not displayed in json, only last was displayed.
Created list within dictionary using neighbor-id as key.
lookup neigbhor-id in json obejct prior to creating new list.

spine-2# show ip ospf neighbor

Neighbor ID   Pri State     Dead Time Address     Interface
0.0.1.16        1 Full/DR   36.754s   8.0.3.15    swp1:8.0.3.16
0.0.1.16        1 Full/DR   30.903s   7.0.3.15    swp2:7.0.3.16

spine-2# show ip ospf neighbor json
{
   "0.0.1.16":[
   {
      "priority":1,
         "state":"Full\/DR",
         "deadTimeMsecs":35114,
         "address":"8.0.3.15",
         "ifaceName":"swp1:8.0.3.16",
         "retransmitCounter":0,
         "requestCounter":0,
         "dbSummaryCounter":0
   },
   {
      "priority":1,
      "state":"Full\/DR",
      "deadTimeMsecs":39264,
      "address":"7.0.3.15",
      "ifaceName":"swp2:7.0.3.16",
      "retransmitCounter":0,
      "requestCounter":0,
      "dbSummaryCounter":0
   }
   ]
}

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-30 19:31:28 -07:00
Chirag Shah
b1c3ae8ce3 ospfd: add vrf option to operational command
Seperate the display option in both vty and json
case 'vrf' is used in show command.
   show ip ospf 'vrf all' [json]
   Display vrf name as key object in json and vrf name
   in vty output.
case 'vrf' is not used then only display default
   vrf ospf instance and vrf name is not shown in vty and
   json.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-28 16:09:44 -07:00
Renato Westphal
efd7904eab *: add missing \n in some help strings
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-24 19:30:30 -02:00
Chirag Shah
c93396633c ospfd: show comand for ospf packet stats
Display OSPFv2 Protocol packets stats per interface.

tor-1# show ip ospf vrf all interface traffic

Interface    HELLO    DB-Desc   LS-Req LS-Update   LS-Ack
             Rx/Tx    Rx/Tx     Rx/Tx  Rx/Tx       Rx/Tx
------------------------------------------------------------
swp1         1/0      2/3       1/1    2/2         1/1
swp2         6/0      2/7       1/1    1/4         3/2

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-23 14:47:59 -07:00
Chirag Shah
7ef56a7321 ospfd: fix ospf nssa command
-Fix ordering of nssa command with translate options
and no-summary option.
Just like ospf stub no-summary keep the order order
of nssa no-summary.
- Fix NSSA options.
- Avoid displaying translate-candiate (default) option
in running-config.

cumulus(config-router)# area 2.2.2.2 nssa
  <cr>
  no-summary           Do not inject inter-area routes into nssa
  translate-always     Configure NSSA-ABR to always translate
  translate-candidate  Configure NSSA-ABR for translate election (default)
  translate-never      Configure NSSA-ABR to never translate

Running-config output:
router ospf
 area 2.2.2.2 nssa translate-always
 area 2.2.2.2 nssa no-summary

Ticket:CM-8312

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-16 10:02:05 -07:00
Donald Sharp
5b8d8894f8 Merge pull request #1298 from opensourcerouting/iface-rb-tree
Use rb-trees to store interfaces instead of linked-lists
2017-10-16 12:00:38 -04:00
Chirag Shah
52d0c099a0 ospfd: OSPFv2 VRF abstact api
Create an api to display vrf name in vty or json format.
Use VRF Name for vtysh and vrfName for json output.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-10 09:43:54 -07:00
Chirag Shah
87bd50e857 ospfd: OSPFv2 VRF, vrf in show command output
Add VRF name in both vtysh and json format of
show commands.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-10 09:36:48 -07:00
Renato Westphal
451fda4f9a *: use the FOR_ALL_INTERFACES abstraction from babeld
This improves code readability and also future-proofs our codebase
against new changes in the data structure used to store interfaces.

The FOR_ALL_INTERFACES_ADDRESSES macro was also moved to lib/ but
for now only babeld is using it.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-10 09:05:46 -03:00
Renato Westphal
8928a08f65 *: eliminate IFINDEX_DELETED in favor of IFINDEX_INTERNAL
IFINDEX_DELETED is not necessary anymore as we moved from a global
list of interfaces to a list of interfaces per VRF.

This reverts commit 84361d615.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-10 09:05:02 -03:00
Renato Westphal
f4e14fdba7 *: use rb-trees to store interfaces instead of sorted linked-lists
This is an important optimization for users running FRR on systems with
a large number of interfaces (e.g. thousands of tunnels). Red-black
trees scale much better than sorted linked-lists and also store the
elements in an ordered way (contrary to hash tables).

This is a big patch but the interesting bits are all in lib/if.[ch].

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-10 09:05:02 -03:00
Renato Westphal
bcc245799b lib: nuke the if_*_by_name_len() functions
Make use of strnlen() and strlcpy() so we can get rid of these
convoluted if_*_by_name_len() functions.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-10 09:01:24 -03:00
Chirag Shah
f1a0393033 ospfd: OSPFv2 VRF remove iflist from master
Remove instances of ospf master's iflist and use vrf_list
with ospf vrf_id.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-03 09:22:47 -07:00
Chirag Shah
35955c14c2 ospfd: OSPFv2 VRF fixesI
Fix ospf interface running config to display vrf
fix clang warnings

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-03 09:22:47 -07:00
Chirag Shah
43b8d1d8a1 ospfd: OSPFv2 VRF Changes II
Accomodate review comments

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-03 09:15:20 -07:00
Chirag Shah
c0f3f7cdf8 ospfd: fix clang warning & ci-ospf test
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-03 09:15:19 -07:00
Chirag Shah
b5a8894de6 ospfd: OSPFv2 VRF Support
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-03 09:15:19 -07:00
Quentin Young
07fb10ad90 Merge pull request #1263 from vjardin6WIND/cleanup
Cleanup - scan-build
2017-10-03 11:39:59 -04:00
Chirag Shah
baf9eaad50 ospfd: ospf use macro for authentication
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-02 09:52:43 -07:00
Vincent JARDIN
c31a793b48 scan-build: cleanup some warnings
Current cleanup is for unset values or variables that are not used anymore.

Regarding ospfd/ospf_vty.c: argv_find()
  we'll never get it NULL, so get coststr = argv[idx]->arg;
2017-10-02 09:14:03 +02:00
Chirag Shah
cbb9b53d32 ospfd: fix area virtual-link command
Adjust to review comments

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-09-30 19:50:44 -07:00
Chirag Shah
55d1da2490 ospfd: ospf virtual-link fix
Initialize idx to 0 and remove reassignment of idx

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-09-29 10:52:11 -07:00
Chirag Shah
3d1c6dc2c6 ospfd: fix ospf virtual-link command options
use argv_find to extract ospf area virtual-link command options.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-09-27 17:33:12 -07:00
Chirag Shah
65536c82c3 ospfd: fix virtual-link config command
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-09-26 16:00:21 -07:00
Renato Westphal
8941a38520 Merge pull request #1078 from dwalton76/ospfd-network-cmd-warning
*: return CMD_WARNING if command was already configured
2017-08-31 13:23:25 -03:00
Jafar Al-Gharaibeh
959768e8d0 Merge pull request #1044 from donaldsharp/combination
Coverity Cleanup of Stuff
2017-08-31 10:25:55 -05:00
Daniel Walton
851fcbaebe *: return CMD_WARNING if command was already configured
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

If the user configures some command that is already in the config we
should return CMD_WARNING instead of CMD_WARNING_CONFIG_FAILED
2017-08-31 15:14:01 +00:00
Donald Sharp
32592ffb4f Merge pull request #1056 from opensourcerouting/oldbits-0
"pathspace" options, vtysh-suid-cleanups, "vty_frame()"
2017-08-29 17:48:36 -04:00