Commit Graph

360 Commits

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