Commit Graph

621 Commits

Author SHA1 Message Date
Pooja Jagadeesh Doijode
5bec85d971 ospfd: Added missing fields to "show ip ospf neighbor detail"
"role" and "local interface address" fields were missing in
"show ip ospf neighbor detail" command.

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2023-02-06 15:41:44 -08:00
Donatas Abraitis
1ce23106eb *: Drop deprecated incorrect JSON fields with wrong naming
Deprecation cycle already passed.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-01-31 10:18:28 +02:00
mobash-rasool
c6188284fb
Merge pull request #12677 from opensourcerouting/fix/ospf_potential_memory_leak
ospfd: Free memory for JSON allocated object before return
2023-01-24 09:54:44 +05:30
Donatas Abraitis
88c5852b72 ospfd: Free memory for JSON allocated object before return
For show_ip_ospf_database_type_adv_router_common().

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-01-23 13:46:42 +02:00
Donatas Abraitis
cb2689d3e5 ospfd: Free memory for JSON allocated object before return
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-01-22 21:15:44 +02:00
Chirag Shah
1ffbb2e487 ospfd: fix crash show ip ospf border-routers json
When show ip ospf border-routers json (without vrf)
specificed, it leads to crash if there no border-routers
information.

Fix:
Do not free json object if use_vrf flag (means vrf option
is not passed) is not set.

Ticket:#3229017
Issue:3229017
Testing Done:

with fix:
l1# show ip ospf border-routers json
{
}
l1# show ip ospf vrf default border-routers json
{
}

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2023-01-20 23:24:44 -08:00
Manoj Naragund
75b837a3d5 ospfd: CLI changes to enable/disable OSPFv2 Flood reduction.
Description:
	The CLIs for enabling/disabling FR, at instance level and
	at the area.

Signed-off-by: Manoj Naragund <mnaragund@vmware.com>
2023-01-19 21:03:03 -08:00
Donatas Abraitis
405e1c848f Revert "ospfd: rSPF calc and messaging for optimal route reflection"
This reverts commit a3d3a14c09.
2023-01-17 18:11:56 +02:00
Donatas Abraitis
1ea57af264 Revert "bgpd, ospfd: BGP ORR CI warning fixes"
This reverts commit d6b2761134.
2023-01-17 18:10:04 +02:00
Donatas Abraitis
3228977f58 Revert "ospfd: few fixes in rSPF calc when LSA received from non root node"
This reverts commit 9f2984d97c.
2023-01-17 18:09:55 +02:00
Rei Shimizu
ff68181eda ospfd: show ospf database info using formatted json
Signed-off-by: Rei Shimizu <rshimizu@apache.org>
2023-01-03 02:06:35 +00:00
Donald Sharp
f9f19fef9d ospfd: Fix some json mem leaks and some issues
a) if show_function happened to be NULL we would leak json memory
b) json_lsa_type was being allocated but only used in the default case, leaking memory
c) json output would sometimes produce text output and that is incorrect

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-20 08:45:51 -05:00
Sindhu Parvathi Gopinathan
2c248c3ed2 ospfd: json support for show ip ospf border-routers
show ip ospf border-routers json support added.
commands:
  - show ip ospf vrf default border-routers json
  - show ip ospf vrf all border-routers json
  - show ip ospf border-routers json

Testing Done: Unit testing completed.

rut# show ip ospf vrf all border-routers json
{
  "default":{
    "vrfName":"default",
    "vrfId":0,
    "routers":{
      "0.0.0.8":{
        "routeType":"R ",
        "cost":10,
        "area":"0.0.0.1",
        "routerType":"abr",
        "nexthops":[
          {
            "ip":"12.0.0.2",
            "via":"swp1"
          }
        ]
      },
      "0.0.0.9":{
        "routeType":"R ",
        "cost":10,
        "area":"0.0.0.1",
        "routerType":"abr",
        "nexthops":[
          {
            "ip":"12.0.1.2",
            "via":"swp2"
          }
        ]
      }
    }
  }
}

rut#
rut# show ip ospf vrf all border-routers json
{
  "default":{
	"vrfName":"default",
	"vrfId":0,
        "routers":{
  	  "0.0.0.15":{
	    "routeType":"R ",
	    "cost":30,
	    "area":"0.0.0.0",
	    "routerType":"abr",
	    "nexthops":[
		{
		  "ip":"11.0.0.2",
		  "via":"br1"
		}
	     ]
	  }
      }
  }
}

rut# show ip ospf border-routers json
{
  "routers":{
    "0.0.0.15":{
      "routeType":"R ",
      "cost":30,
      "area":"0.0.0.0",
      "routerType":"abr",
      "nexthops":[
        {
	  "ip":"11.0.0.2",
          "via":"br1"
	}
      ]
   }
 }
}

Ticket:#3229017
Issue:3229017

Co-authored-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-12-16 08:46:10 -08:00
Donatas Abraitis
bd162aae09 ospfd: Get route-map name for default-information originate
LR1.wue3(config)# route-map foo-bar-baz10 permit 10
LR1.wue3(config-route-map)# exit
LR1.wue3(config)# router ospf
LR1.wue3(config-router)#  ospf router-id 172.18.254.201
LR1.wue3(config-router)#  log-adjacency-changes
LR1.wue3(config-router)# default-information originate metric 50 metric-type 1 route-map foo-bar-baz10
LR1.wue3(config-router)# end

Results in:

LR1.wue3# show run
...
!
router ospf
 ospf router-id 172.18.254.201
 log-adjacency-changes
 default-information originate metric 50 metric-type 1 route-map oute-map
exit
!
route-map foo-bar-baz10 permit 10
exit
!
end

Let's fix this.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-11-07 22:23:07 +02:00
Donald Sharp
d7cde18c63
Merge pull request #12196 from opensourcerouting/xref-vtysh
*: rewrite `extract.pl` using `xref` infra
2022-11-03 08:54:09 -04:00
David Lamparter
89cb86aeb0 build, vtysh: extract vtysh commands from .xref
Rather than running selected source files through the preprocessor and a
bunch of perl regex'ing to get the list of all DEFUNs, use the data
collected in frr.xref.

This not only eliminates issues we've been having with preprocessor
failures due to nonexistent header files, but is also much faster.
Where extract.pl would take 5s, this now finishes in 0.2s.  And since
this is a non-parallelizable build step towards the end of the build
(dependent on a lot of other things being done already), the speedup is
actually noticeable.

Also files containing CLI no longer need to be listed in `vtysh_scan`
since the .xref data covers everything.  `#ifndef VTYSH_EXTRACT_PL`
checks are equally obsolete.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-10-26 17:12:34 +01:00
anlan_cs
6c3aae9c56 ospfd: fix missing max-metric in show running config
```
(ospf)  max-metric router-lsa administrative
```

Currently this running config depends at least one `area` with *active*
`network`, otherwise it will not occur.

The check on this dependency is redundant and wrong, just remove it.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-10-26 08:50:17 -04:00
Madhuri Kuruganti
9f2984d97c ospfd: few fixes in rSPF calc when LSA received from non root node
Signed-off-by: Madhuri Kuruganti <maduri111@gmail.com>
2022-10-12 13:43:55 +05:30
Madhuri Kuruganti
d6b2761134 bgpd, ospfd: BGP ORR CI warning fixes
Signed-off-by: Madhuri Kuruganti <maduri111@gmail.com>
2022-10-12 13:43:55 +05:30
Madhuri Kuruganti
a3d3a14c09 ospfd: rSPF calc and messaging for optimal route reflection
Signed-off-by: Madhuri Kuruganti <maduri111@gmail.com>
2022-10-12 13:43:55 +05:30
Donatas Abraitis
083e241235 ospfd: Remove deprecated command graceful-restart helper-only
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-23 22:10:44 +03:00
Manoj Naragund
b345a3d9b4 ospfd: Added clis to change default timers for LSA refresh and maxage remove delay.
Description:
Added hidden clis that will allow you to reset the default timers
for LSA refresh and LSA maxage remove delay, these will help in testing
LSA refresh scenarios in upcoming OSPFv2 Flood reduction feature(rfc4136).

IETF Link : https://datatracker.ietf.org/doc/html/rfc4136

Signed-off-by: Manoj Naragund <mnaragund@vmware.com>
2022-08-31 23:10:09 -07:00
rgirada
7b71c1e3f7 ospfd: Adding per neighbour json details to GR helper detail command
Description:
	Per neighbor GR enabled information is  missing from json
	output in "show ip ospf gr helper details json" command.

      Example config:

	frr(config-router)# graceful-restart helper enable 2.2.2.2
	frr(config-router)#
	frr(config-router)# do show ip ospf  graceful-restart helper  detail

       OSPF Router with ID (10.112.156.220)

	Graceful restart helper support disabled.
	Strict LSA check is enabled.
	Helper supported for Planned and Unplanned Restarts.
	Supported Graceful restart interval: 1800(in seconds).
	Enable Router list:
		2.2.2.2,

	frr(config-router)# do show ip ospf  graceful-restart helper  detail json
	{
	 "routerId":"10.112.156.220",
	 "helperSupport":"Disabled",
	 "strictLsaCheck":"Enabled",
	 "restartSupoort":"Planned and Unplanned Restarts",
	 "supportedGracePeriod":1800,
	}
	frr(config-router)#

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2022-08-23 21:15:12 -07:00
Donald Sharp
f54b256b93 ospfd: Add how many packets the interface has queued to send
In `show ip ospf interface traffic` how many packets this
interface has queued to send.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-11 13:30:32 -04:00
Donald Sharp
fe61ceaee7 ospfd: Cleanup indentation surrounding oi->nbr
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-11 13:30:32 -04:00
Donald Sharp
cccd44f3b1 ospfd: Remove various macros that overlap THREAD_OFF
Let's just use THREAD_OFF consistently in the code base
instead of each daemon having a special macro that needs to
be looked at and remembered what it does.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-21 08:27:35 -04:00
rgirada
25804ce593 ospfd: fixing few coverity issue in 'show_ip_ospf_neighbour_brief'
Description:
	timerval data structure 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>
2022-06-23 06:43:22 -07:00
rgirada
e8a8b11610 ospfd: Fixing "show ip ospf neighbour <nbrid>" command
Description:
	"show ip ospf neighbour [nbrid] [json]" is expected to give brief output
	of the specific neighbour. But it gives the detailed output without
	the detail keyword.
	"show ip ospf neighbour [nbrid] [deatil] [json]" command is failed to
	fetch the ecpected o/p. Corrected it.

	Ex o/p:
	frr(config-if)# do show ip ospf  neighbor

	Neighbor ID     Pri State           Up Time         Dead Time Address         Interface                        RXmtL RqstL DBsmL
	8.8.8.8           1 Full/DR         17m03s            31.192s 20.1.1.194      ens192:20.1.1.220                    0     0     0
	30.1.1.100        1 Full/DR         56.229s           32.000s 30.1.1.100      ens224:30.1.1.220                    0     0     0

	frr(config-if)#
	frr(config-if)#
	frr(config-if)# do show ip ospf  neighbor 8.8.8.8
	Neighbor 8.8.8.8, interface address 20.1.1.194
	In the area 0.0.0.0 via interface ens192
	Neighbor priority is 1, State is Full/DR, 6 state changes
	Most recent state change statistics:
	  Progressive change 17m18s ago
	DR is 20.1.1.194, BDR is 20.1.1.220
	Options 2 *|-|-|-|-|-|E|-
	Dead timer due in 35.833s
	Database Summary List 0
	Link State Request List 0
	Link State Retransmission List 0
	Thread Inactivity Timer on
	Thread Database Description Retransmision off
	Thread Link State Request Retransmission on
	Thread Link State Update Retransmission on

	Graceful restart Helper info:
	  Graceful Restart HELPER Status : None

	frr(config-if)# do show ip ospf  neighbor 8.8.8.8 detail
	No such interface.
	frr(config-if)# do show ip ospf  neighbor 8.8.8.8 detail json
	{}
	frr(config-if)#

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2022-06-22 08:40:24 -07:00
Donatas Abraitis
70dd370f5a *: Use autocomplete for route-maps under commands that require it
For example:

```
donatas-laptop# show bgp ipv4 unicast neighbors 127.0.0.2 advertised-routes route-map ?
  RMAP_NAME  Name of the route map
       testas2 testas

donatas-laptop(config)# router bgp
donatas-laptop(config-router)# address-family ipv4
donatas-laptop(config-router-af)# redistribute connected route-map ?
  RMAP_NAME  Pointer to route-map entries
       testas2 testas

donatas-laptop(config-router-af)# network 192.168.0.0/23 route-map ?
  RMAP_NAME  Name of the route map
       testas2 testas
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-06-13 21:00:51 +03:00
Christian Hopps
d86760acad ospfd: cli: add "show ip ospf reachable-routers" CLI
Signed-off-by: Christian Hopps <chopps@labn.net>
2022-06-02 16:37:16 -04:00
Donatas Abraitis
8998807f69 *: Avoid casting to the same type as on the left
Just not necessary.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-08 16:07:42 +03:00
Donatas Abraitis
41710ed15e ospfd: Show neighbor state in full format (e.g. Full/DR instead of Full)
Before:
```
$ vtysh -c 'show ip ospf neighbor json' | jq '.neighbors."100.100.200.100"[0].nbrState'
"Full/DR"
$ vtysh -c 'show ip ospf neighbor detail json' | jq '.neighbors."100.100.200.100"[0].nbrState'
"Full"
```

After:
```
$ vtysh -c 'show ip ospf neighbor json' | jq '.neighbors."100.100.200.100"[0].nbrState'
"Full/DR"
$ vtysh -c 'show ip ospf neighbor detail json' | jq '.neighbors."100.100.200.100"[0].nbrState'
"Full/DR"
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-03-30 22:28:39 +03:00
Donatas Abraitis
1c18b0d672 ospfd: Use consistent JSON keys for show ip ospf neighbor and detail version
At the moment it's inconsistent, and very annoying. Let's just fix this, and
add a deprecation period to remove them after that.

```
vr_ib# show ip ospf neighbor json
{
  "neighbors":{
    "192.10.120.2":[
      {
        "priority":1,
        "state":"Full\/DROther",
        "deadTimeMsecs":36543,
        "address":"192.10.120.2",
        "ifaceName":"VLINK0",
        "retransmitCounter":0,
        "requestCounter":0,
        "dbSummaryCounter":0
      },
```

```
vr_ib# show ip ospf neighbor detail json
{
  "neighbors":{
    "192.10.120.2":[
      {
        "ifaceAddress":"192.10.120.2",
        "areaId":"0.0.0.0",
        "ifaceName":"VLINK0",
        "nbrPriority":1,
        "nbrState":"Full",
        "stateChangeCounter":5,
        "lastPrgrsvChangeMsec":53367612,
        "routerDesignatedId":"0.0.0.0",
        "routerDesignatedBackupId":"0.0.0.0",
        "optionsCounter":66,
        "optionsList":"*|O|-|-|-|-|E|-",
        "routerDeadIntervalTimerDueMsec":33126,
        "databaseSummaryListCounter":0,
        "linkStateRequestListCounter":0,
        "linkStateRetransmissionListCounter":0,
        "threadInactivityTimer":"on",
        "threadLinkStateRequestRetransmission":"on",
        "threadLinkStateUpdateRetransmission":"on",
        "grHelperStatus":"None"
      },
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-03-21 16:58:12 +02:00
Jafar Al-Gharaibeh
fbaafa0082 ospfd: better error messages when not enabled in a vrf
before:
```
r1# show ip ospf vrf blue
% OSPF instance not found

r1# show ip ospf vrf default
% OSPF instance not found

r1# show ip ospf
% OSPF instance not found
```

after:
```
r1# show ip ospf vrf blue
% OSPF is not enabled in vrf blue

r1# show ip ospf vrf default
% OSPF is not enabled in vrf default

r1# show ip ospf
% OSPF is not enabled in vrf default
```

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2022-03-16 00:59:26 -05:00
Donald Sharp
7baebfb715
Merge pull request #10447 from ton31337/fix/json_with_whitespaces
*: Fix JSON keys with whitespaces and PascalCase
2022-03-13 18:19:33 -04:00
anlan_cs
4d4c404bf6 *: Add necessary new line for output of vty_out()
Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-02-27 10:59:19 +08:00
Donald Sharp
1461559c24 ospfd: Fix spelling mistakes
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-14 12:53:16 -05:00
Igor Ryzhov
806be1301d
Merge pull request #10511 from anlancs/ospf-substitute
ospfd: fix loss of mixed form in "range" command
2022-02-08 20:50:22 +03:00
Donald Sharp
abb1bf8d32 ospfd: Use AF_UNSPEC instead of setting to 0
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-07 13:20:43 -05:00
Donatas Abraitis
77a2f8e592 *: Add camelCase JSON keys in addition to PascalCase
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-02-03 10:48:06 +02:00
Donatas Abraitis
08d79bce3d ospfd,ospf6d: Add JSON additional keys with no whitespaces inside
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-02-03 10:48:06 +02:00
Igor Ryzhov
0624c3cfcc
Merge pull request #10373 from anlancs/ospf-add-asbr
ospfd: fix missing "aggregation timer" in running configuration
2022-02-01 19:04:33 +03:00
ckishimo
e9b0752f11 ospfd: remove extra space
Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
2022-02-01 08:51:34 +01:00
ckishimo
0b17753880 ospfd: print maximum paths in show ip ospf json
Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
2022-02-01 08:51:34 +01:00
ckishimo
f61b005a0b ospfd: print administrative distance in show ip ospf
Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
2022-02-01 08:51:34 +01:00
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