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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
-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>
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>
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>
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>
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>
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>
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;
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
Using the previously-added vty_frame() support, this gets rid of all the
pointless empty "interface XYZ" blocks that get added for any interface
that shows up in the system (e.g. dummys, tunnels, etc.)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Handle all instance base clis calling ospf_lookup_instance()
to return CMD_NOT_MY_INSTANCE in case of ospf is not found.
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
Multi-Instance OSPF configuration CLI would fail because
first client return error upon seeing qobj_index being 0.
With new marco generate new error code to return from each
instance (vtysh client) and if the command is intended for given
instance, its qobj_index would be nonzero and process the command
and push correct ospf context. Other instance would return the error.
On vtysh end, check all instance return an error log a message to a
file.
Testing Done:
Verfied various MI-OSPF configuration CLI with multi instances.
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
This reverts commit c14777c6bf.
clang 5 is not widely available enough for people to indent with. This
is particularly problematic when rebasing/adjusting branches.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
This allows frr-reload.py (or anything else that scripts via vtysh)
to know if the vtysh command worked or hit an error.
Two things:
1) Some advanced 'show ip ospf database'... code
was not working properly. Fix the cli to handle
this appropriately
2) Consolidate two cli functions into one.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworkscom>
Several changes were made from the original patch to resolve conflicts
and also to fix various issues that were discovered during testing. Below
is the original commit message minus a few parts that correspond to code
that was dropped during bug fixing.
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
ospfd: Extend 'ip ospf area' to take address argument + rationalise ospf enable
* ospfd.c: (general) Clean up the whole running of OSPF on interfaces.
(add_ospf_interface) taking (struct interface *) arg is pointless here.
(ospf_is_ready) new helper.
(ospf_network_run_subnet) Put all the code for choosing whether to enable
OSPF on a subnet, and if so which area configuration to use, here. If a
subnet should not be enabled, ensure an existing oi is freed.
(ospf_network_run_interface) Just call run_subnet for all subnets on an
interface.
(ospf_network_run) Just call run_interface for all interfaces.
(ospf_if_update) Just call run_interface for the given interface.
(ospf_network_unset) Just call run_subnet for existing ois.
(ospf_update_interface_area) helper: update area on an oi, or create it.
(ospf_interface_set) renamed to ospf_interface_area_set for clarity.
Ensures OSPF is created, then into if_update.
(ospf_interface_unset) renamed to ospf_interface_area_unset and collapses
down to simple loop to call run_subnet for all ois.
* ospf_interface.h: add a more general OSPF_IF_PARAM_IS_SET, which does the
right thing and takes default config into account.
* doc/ospfd.texi: add 'ip ospf area' command.
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
This patch has been part of Quagga since October 2015
Orignial Author: Paul Jakma <paul@quagga.net>
Date: Thu Aug 27 16:51:42 2009 +0100
log.c provides functionality for associating a constant (typically a
protocol constant) with a string and finding the string given the
constant. However this is highly delicate code that is extremely prone
to stack overflows and off-by-one's due to requiring the developer to
always remember to update the array size constant and to do so correctly
which, as shown by example, is never a good idea.b
The original goal of this code was to try to implement lookups in O(1)
time without a linear search through the message array. Since this code
is used 99% of the time for debugs, it's worth the 5-6 additional cmp's
worst case if it means we avoid explitable bugs due to oversights...
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
if bandwidth is not set from Zebra use speed as bandwidth
for ospf route.
Testing Done:
Verfied over bond which has aggregated speed of all member interfaces,
cost is reflected in ospf route and ip route.
Manually changed interface bandwidth which replaces speed as bw, instead
uses cli entered value as bw, verifid output of ospf route and ip route.
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
clear ip ospf interface <IFNAME> parsing issue,
instead of arguement of interface "IFNAME" parsed.
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
ospf timers related commands under router ospf were not accepted
due to incorrect argument count check.
timers throttle lsa all (0-5000)
timers throttle spf (0-600000) (0-600000) (0-600000)
timers lsa arrival (0-1000)
timers lsa min-arrival (0-600000)
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
If the user enters a decimal, display a decimal.
If the user enters a dotted quad, display a dotted quad.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Revert "ospf6d: fix decimal area ID cli"
commit a27cb3cfe9
Revert "bgpd: add back unicast option to 'address-family vpnv(4&6)' Issue #459"
commit 399598bf6b
Revert "Fix the memory leak"
commit d8d58e9839
Revert "zebra: 'no ip route 4.1.1.19 255.255.255.255 99' is ambiguous"
commit 83f3561935
Revert "ospf6d: Allow unconfig of unknown lsa's"
commit 5b0747d71d
Revert "Fix the "Dead assignment" of clang SA."
commit 3a6570a1f1
Revert "snapcraft: Improve README.usage.md based on feedback received"
commit 2a3a819a9c
Revert "zebra: stop deregistering static nexthops unless removing the static"
commit 1dac3a9619
All of these changes do not apply on stable/3.0 due to either CLI
changes or another fix already being present.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
When you have more than one ospf interface configured
to be used, we were attempting to reuse the
json_interface_sub pointer after we added it
to the json data structure.
Ticket: CM-13597
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
The FSF's address changed, and we had a mixture of comment styles for
the GPL file header. (The style with * at the beginning won out with
580 to 141 in existing files.)
Note: I've intentionally left intact other "variations" of the copyright
header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Fixed output:
robot.cumulusnetworks.com# show ip ospf int
enp0s3 is up
ifindex 2, MTU 1500 bytes, BW 0 Mbit <UP,BROADCAST,RUNNING,MULTICAST>
Internet Address 10.0.2.15/24, Broadcast 10.0.2.255, Area 0.0.0.0
MTU mismatch detection:enabled
Router ID 192.168.0.1, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State Waiting, Priority 1
No backup designated router on this network
Multicast group memberships: OSPFAllRouters
Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5
Hello due in 9.611s
Neighbor Count is 0, Adjacent neighbor count is 0
enp0s10 is up
ifindex 7, MTU 1500 bytes, BW 0 Mbit <UP,BROADCAST,RUNNING,MULTICAST>
Internet Address 192.168.201.146/24, Broadcast 192.168.201.255, Area 0.0.0.0
MTU mismatch detection:enabled
Router ID 192.168.0.1, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State Waiting, Priority 1
No backup designated router on this network
Multicast group memberships: OSPFAllRouters
Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5
Hello due in 7.241s
Neighbor Count is 0, Adjacent neighbor count is 0
robot.cumulusnetworks.com# show ip ospf int enp0s3
enp0s3 is up
ifindex 2, MTU 1500 bytes, BW 0 Mbit <UP,BROADCAST,RUNNING,MULTICAST>
Internet Address 10.0.2.15/24, Broadcast 10.0.2.255, Area 0.0.0.0
MTU mismatch detection:enabled
Router ID 192.168.0.1, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State Waiting, Priority 1
No backup designated router on this network
Multicast group memberships: OSPFAllRouters
Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5
Hello due in 2.915s
Neighbor Count is 0, Adjacent neighbor count is 0
robot.cumulusnetworks.com# show ip ospf int enp0s10 json
{
"enp0s10":{
"ifUp":true,
"ifIndex":7,
"mtuBytes":1500,
"bandwidthMbit":0,
"ifFlags":"<UP,BROADCAST,RUNNING,MULTICAST>",
"ospfEnabled":true,
"ipAddress":"192.168.201.146",
"ipAddressPrefixlen":24,
"ospfIfType":"Broadcast",
"localIfUsed":"192.168.201.255",
"area":"0.0.0.0",
"routerId":"192.168.0.1",
"networkType":"BROADCAST",
"cost":10,
"transmitDelayMsecs":1000,
"state":"Waiting",
"priority":1,
"mcastMemberOspfAllRouters":true,
"timerMsecs":100,
"timerDeadMsecs":25,
"timerWaitMsecs":25,
"timerRetransmit":200,
"timerHelloInMsecs":2106,
"nbrCount":0,
"nbrAdjacentCount":0
}
}
robot.cumulusnetworks.com#
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
OSPF distance commands were broken in a variety of ways. Fix 'em.
* `distance ospf` and `distance ospf6` were accepted commands
* Inconsistent doc strings
* Make use of {keyword|tokens}
* Add ability to reset specific distance without specifying a value
Ex: ~# no distance ospf6 intra
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
These have copies in vtysh that do the node-switch locally and are
listed in extract.pl's ignore list. The ignore list however is
redundant since DEFUN_NOSH does the same thing...
ldpd is a bit hacky, but Renato is reworking this anyway.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Somewhere in the past we switched from
using the auto-generated redistribute statements
to a non-generated version. This caused us to
loose new protocols to redistribute as they are
added. Put it back.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This ditches tv_add, tv_sub, tv_cmp, etc. in favour of
monotime{,_since,_until}() which actually makes the code much more
readable in some locations.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts (CLI vs. atol()):
- bgpd/bgp_vty.c
- ospfd/ospf_vty.c
- zebra/zebra_vty.c
NB: pull req #65 (LabNConsulting/working/2.0/afi-safi-vty/c) was
excluded from this merge.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
When unconfiguring certain commands in ospf, you can
run into situations where we attempt to read beyond
the end of a argv[] vector created. On certain platforms
this will crash it.
Ticket: CM-14090
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
All of the autogenerated macros in lib/route_types.pl are now called
FRR_* instead of QUAGGA_*.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
VTY_DECLVAR_CONTEXT already contains a NULL check, vty warning message
and return statement. These are not needed.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Fix instances that the coccinelle patch didn't catch (or which
coccinelle couldn't parse), and add the patch file for future posterity
(and application to yet-unmerged branches).
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
These now generate warnings which will break the build with -Werror.
Note this may have enabled commands that should be disabled, or the
other way around...
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
When nbr->t_inactivity is not active, and
you do a show json over the neighbor it
will crash ospfd. Fix the code so it
prints out -1 when the timer is inactive.
Ticket:CM-13835
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
(cherry picked from commit 78d8fcb9623ab4d9cebf6187a451448e056a84bf)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This moves all install_element calls into the file where the DEFUNs are
located. This fixes several small related bugs:
- ospf6d wasn't installing a "no interface FOO" command
- zebra had a useless copy of "interface FOO"
- pimd's copy of "interface FOO" was not setting qobj_index, which means
"description LINE" commands would fail with an error
The next commit will do the actual act of making "foo_cmd" static.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
When doing a show command under ospf, if
not using json we would have a small memory
leak in show_ip_ospf_common.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit 50750712b1ac8364e290c67782eaf371025dc59e)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Additionally:
* Add [ip] to a couple bgp show commands
* Quick refactor of a couple ISIS commands
* Quick refactor of a couple OSPF6 commands
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Nice clang catch: ospfd/ospf_vty.c:6710:1: error: all paths through
this function will call itself [-Werror,-Winfinite-recursion]
(same in vtysh/vtysh.c)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Refactor a bunch of commands.
* Make hidden configuration items consistent
* Remove duplicate code
* Make unconfig consistent with config
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>