Commit Graph

541 Commits

Author SHA1 Message Date
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