Commit Graph

414 Commits

Author SHA1 Message Date
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
David Lamparter
a8b828f3c3 *: remove empty "interface XYZ" config blocks
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>
2017-08-29 08:36:03 +02:00
Quentin Young
5d1a2ee87b
ospf6d, ospfd: add no ospf6 router-id ...
* Deprecate `router-id A.B.C.D` for ospf6d
* Add `ospf6 router-id A.B.C.D`
* Add `no ospf6 router-id [A.B.C.D]`
* Add deprecation notices for previously deprecated ospf commands

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-28 13:50:21 -04:00
Donald Sharp
cc9b06ad5e eigrpd, ospfd: Cleanup inet_aton return code checking
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24 20:34:24 -04:00
Quentin Young
3257307337
ospfd, ospf6d: cleanup some no commands
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-22 10:55:12 -04:00
David Lamparter
f66bd13f3c Merge pull request #994 from dwalton76/ospfd-show-neighbor
ospfd: "show ip ospf neighbor" options not passed
2017-08-17 12:37:25 +02:00
Daniel Walton
b4e84315e4 ospfd: "show ip ospf neighbor" options not passed
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-08-16 18:40:12 +00:00
Quentin Young
5ed0add5e4
ospfd: remember area-id format for ifaces
Display dotted quad or decimal back in the config depending on what the
user enters.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-16 11:18:11 -04:00