Commit Graph

459 Commits

Author SHA1 Message Date
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
Quentin Young
0e88de35b9
ospfd: deprecate timers lsa arrival ...
Don't need two of these that do the exact same thing.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-07 16:11:10 -04:00
Chirag Shah
64ac44f6f0 ospfd: Handle multi instance router ospf command
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-08-04 22:59:40 -07:00
Chirag Shah
ac28e4ecaf ospfd: Fix MI-OSPF CLIs
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>
2017-08-04 18:03:45 -07:00
Chirag Shah
a3d826f0ea ospfd: Fix MI-OSPF configuraton clis
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>
2017-08-04 07:47:45 -07:00
Renato Westphal
163076686e bgpd/ospfd: fix json leaks and blank output
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-07-26 12:28:56 -03:00
David Lamparter
9d303b37d7 Revert "*: reindent pt. 2"
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>
2017-07-22 14:52:33 +02:00
whitespace / reindent
c14777c6bf
*: reindent pt. 2
w/ clang 5

* reflow comments
* struct members go 1 per line
* binpack algo was adjusted
2017-07-17 15:26:02 -04:00
whitespace / reindent
d62a17aede *: reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'`

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17 14:04:07 +02:00
David Lamparter
2d8270596a Merge remote-tracking branch 'frr/master' into newline-redux
Lots of conflicts from CMD_WARNING_CONFIG_FAILED...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 13:07:30 +02:00
David Lamparter
625e016d14 *: remove VTYNL, part 6 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:03 +02:00
David Lamparter
55f70b671f *: remove VTYNL, part 4 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:03 +02:00
David Lamparter
61b7d449bd *: remove VTYNL, part 3 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:03 +02:00
David Lamparter
26a429fe8e *: remove VTYNL, part 2 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:02 +02:00
David Lamparter
6d3c2ed4ed *: remove VTYNL, part 1 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:02 +02:00
Daniel Walton
f1a05de982 vtysh: return non-zero for configuration failures
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.
2017-07-13 19:56:08 +00:00
David Lamparter
5c7571d43f *: ditch vty_outln(), part 1 of 2
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-13 20:29:22 +02:00
Quentin Young
7111c1a0cd
*: fix excess docstring
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-05 15:33:00 -04:00
Donald Sharp
36337a6de7 ospfd: Fix 'advanced' type data base show
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>
2017-06-30 11:31:25 -04:00
Quentin Young
8e25c8ce2f *: rebase vty_outln() -> master
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:38:59 +00:00
Quentin Young
e31b6333f4 *: vty_outln (vty, "") --> vty_out (vty, VTYNL)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:34:56 +00:00
Quentin Young
1318e7c841 *: s/VTY_NEWLINE/VTYNL/g
Should be able to fit more vty_out onto one line now

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:34:54 +00:00
Quentin Young
96ade3ed77 *: use vty_outln
Saves 400 lines

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:31:28 +00:00
Russ White
0bc44f61c9 Merge pull request #754 from qlyoung/fix-argv-arg
use argv->text where appropriate
2017-06-29 11:06:15 -04:00
Jafar Al-Gharaibeh
0eef52fd95 Merge pull request #759 from qlyoung/remove-vty-argparsers
*: remove VTY_GET_*
2017-06-29 09:36:06 -05:00
Donald Sharp
b440fe5c82 Merge remote-tracking branch 'origin/stable/3.0' 2017-06-29 10:10:15 -04:00
Jafar Al-Gharaibeh
8c9b599276 ospfd: The CLI validates the IP address
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2017-06-28 23:21:14 -05:00
Jafar Al-Gharaibeh
52c62ab894 ospfd: Bring in some OSPF useful changes that were lost during Quagga fork
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
2017-06-28 17:06:53 -05:00
Quentin Young
facfee22f5 *: remove VTY_GET_*
CLI validates input tokens, so there's no need to do it in handler
functions anymore.

spatch follows
----------------

@getull@
expression v;
expression str;
@@
<...
- VTY_GET_ULL(..., v, str)
+ v = strtoull (str, NULL, 10)
...>

@getul@
expression v;
expression str;
@@
<...
- VTY_GET_ULONG(..., v, str)
+ v = strtoul (str, NULL, 10)
...>

@getintrange@
expression name;
expression v;
expression str;
@@
<...
- VTY_GET_INTEGER_RANGE(name, v, str, ...)
+ v = strtoul (str, NULL, 10)
...>

@getint@
expression v;
expression str;
@@
<...
- VTY_GET_INTEGER(..., v, str)
+ v = strtoul (str, NULL, 10)
...>

@getv4@
expression v;
expression str;
@@
<...
- VTY_GET_IPV4_ADDRESS(..., v, str)
+ inet_aton (str, &v)
...>

@getv4pfx@
expression v;
expression str;
@@
<...
- VTY_GET_IPV4_PREFIX(..., v, str)
+ str2prefix_ipv4 (str, &v)
...>

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-27 19:04:41 +00:00
Quentin Young
7e045c3d42 *: use ->text and strmatch where appropriate
Still need to go fix all the places where we do a 1-char strncmp...

spatch follows
------------------

@asdf@
expression idx;
@@
<...
 strcmp (
- argv[idx]->arg,
+ argv[idx]->text,
  ...)
...>

@depends on asdf@
expression idx;
@@
<...
- !strcmp (argv[idx]->text,
+ strmatch (argv[idx]->text,
           ...)
...>

@depends on asdf@
expression idx;
expression arg;
@@
<...
- strcmp (argv[idx]->text, arg) == 0
+ strmatch (argv[idx]->text, arg)
...>

@depends on asdf@
expression idx;
expression arg;
@@
<...
- strcmp (argv[idx]->text, arg) != 0
+ !strmatch (argv[idx]->text, arg)
...>

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-27 17:46:42 +00:00
Quentin Young
56b4067930 *: simplify log message lookup
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>
2017-06-21 15:22:21 +00:00
Chirag Shah
05b15adcc2 ospfd: ospf bandwidth handling
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>
2017-06-12 09:55:56 -07:00
David Lamparter
326452238a Merge branch 'stable/3.0'
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-06-06 17:37:41 +02:00
Quentin Young
7d6e13e138 ospfd: fix 'show ip ospf interface json'
json obj not recreated for each interface

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-04 18:50:12 +00:00
Quentin Young
0c2206de31 ospfd: shufflin
move virtual-link command down to be next to its no form

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-04 18:49:07 +00:00
Quentin Young
f1c2f41143 ospfd: fix virtual-link timers commands
Use {} semantics, correct docstrings, switchup parsing.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-04 18:48:57 +00:00
Renato Westphal
b49f20e36d Merge pull request #663 from chiragshah6/pim_dev
ospfd: Fix ospf timers commands
2017-06-03 18:45:23 -03:00
Chirag Shah
fac05f2fd6 ospfd: fix clear ip ospf interface cmd
clear ip ospf interface <IFNAME> parsing issue,
instead of arguement of interface "IFNAME" parsed.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-06-02 22:52:41 -07:00
Chirag Shah
3ba2603926 ospfd: Fix ospf timers command
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>
2017-06-02 15:49:13 -07:00
Quentin Young
b1c02cec70 ospfd: shufflin
move virtual-link command down to be next to its no form

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-31 19:08:33 +00:00
Quentin Young
a663a38ef8 ospfd: fix virtual-link timers commands
Use {} semantics, correct docstrings, switchup parsing.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-31 19:07:49 +00:00
Donald Sharp
9e962de4b6 Merge remote-tracking branch 'origin/stable/3.0' 2017-05-24 11:22:35 -04:00
Quentin Young
86573dcbbe ospfd: remember format for ospf area id
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>
2017-05-19 18:40:18 +00:00
David Lamparter
92eedda1fb Merge branch stable/2.0 into stable/3.0
Conflicts:
	bgpd/bgp_fsm.c
	ospf6d/ospf6_lsa.c
	ospfd/ospf_vty.c
	zebra/redistribute.c

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-18 12:23:13 +02:00
David Lamparter
b2b6f8f33c Pre-revert nonmergeable changes
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>
2017-05-18 12:09:50 +02:00
Donald Sharp
934ec54171 Merge remote-tracking branch 'origin/stable/3.0' 2017-05-17 08:51:25 -04:00
Donald Sharp
70a4754dd0 ospfd: Fix possible crash and wrong data being shown
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>
2017-05-16 15:11:33 -04:00
Donald Sharp
1a5ce38b9f ospfd: Actually fix ospf redistribute.
This is the final time I swear!

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-16 08:29:03 -04:00
David Lamparter
896014f4bc *: make consistent & update GPLv2 file headers
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>
2017-05-15 16:37:41 +02:00
Donald Sharp
6281320446 Merge remote-tracking branch 'origin/stable/3.0' 2017-05-08 16:51:21 -04:00
Renato Westphal
313605cb92 *: fix a bunch of segfaults detected by a CLI fuzzer
This patch fixes the following segfaults:
zebra aborted: vtysh -c "show ipv6 mroute"
zebra aborted: vtysh -c "configure terminal" -c "debug zebra kernel msgdump"
zebra aborted: vtysh -c "configure terminal" -c "interface eth99" -c "link-params" -c "no packet-loss"
zebra aborted: vtysh -c "configure terminal" -c "interface eth99" -c "link-params" -c "no metric"
zebra aborted: vtysh -c "configure terminal" -c "interface eth99" -c "link-params" -c "no ava-bw"
zebra aborted: vtysh -c "configure terminal" -c "interface eth99" -c "link-params" -c "no res-bw"
zebra aborted: vtysh -c "configure terminal" -c "interface eth99" -c "link-params" -c "no use-bw"
ospfd aborted: vtysh -c "configure terminal" -c "router ospf" -c "area 1.1.1.1 nssa"
ospfd aborted: vtysh -c "configure terminal" -c "router ospf" -c "area 4294967295 nssa"
pimd aborted: vtysh -c "show ip msdp sa 1.1.1.1"
pimd aborted: vtysh -c "configure terminal" -c "ip ssmpingd"
pimd aborted: vtysh -c "configure terminal" -c "no ip ssmpingd"
pimd aborted: vtysh -c "configure terminal" -c "no ip msdp mesh-group WORD source"
pimd aborted: vtysh -c "configure terminal" -c "interface eth99" -c "ip pim hello 180"
bgpd aborted: vtysh -c "show bgp l2vpn evpn rd 1:1"
bgpd aborted: vtysh -c "clear vnc nve un *"
bgpd aborted: vtysh -c "clear vnc nve un 1.1.1.1"
bgpd aborted: vtysh -c "clear vnc nve un 2001:db8::1"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 1.1.1.1 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 1.1.1.1 cost 255 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 1.1.1.1 cost 255"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 1.1.1.1"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 2001:db8::1 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 2001:db8::1 cost 255 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 2001:db8::1 cost 255"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 2001:db8::1"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 1.1.1.1 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 1.1.1.1 cost 255 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 1.1.1.1 cost 255"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 1.1.1.1"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 2001:db8::1 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 2001:db8::1 cost 255 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 2001:db8::1 cost 255"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 2001:db8::1"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp 1" -c "no vnc export bgp ipv4 prefix-list NAME"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp 1" -c "no vnc export bgp ipv6 prefix-list NAME"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp 1" -c "no vnc export bgp route-map NAME"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp 1" -c "no vnc export zebra ipv4 prefix-list NAME"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp 1" -c "no vnc export zebra ipv6 prefix-list NAME"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp 1" -c "no vnc export zebra route-map NAME"
bgpd aborted: vtysh -c "configure terminal" -c "route-map RMAP permit 1" -c "no set ipv6 vpn next-hop"
bgpd aborted: vtysh -c "configure terminal" -c "route-map RMAP permit 1" -c "set vpnv4 next-hop"
bgpd aborted: vtysh -c "configure terminal" -c "route-map RMAP permit 1" -c "set vpnv6 next-hop"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp" -c "address-family ipv6 vpn" -c "network 2001:db8::1/128 rd 1:1 tag WORD"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp" -c "address-family vpnv6 unicast" -c "network 2001:db8::1/128 rd 1:1 tag WORD"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp" -c "no neighbor WORD shutdown message MSG..."
bgpd aborted: vtysh -c "configure terminal" -c "router bgp" -c "neighbor WORD shutdown message MSG..."

More to come later.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-05-04 14:39:58 -03:00
Donald Sharp
d476347d5d Merge remote-tracking branch 'origin/stable/3.0' 2017-05-04 13:35:25 -04:00
Renato Westphal
6cf3661ddf ospfd: fix small problem in the redistribute command
The use of {<>} is unnecessary and not correct.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-05-03 10:08:03 -03:00
Donald Sharp
05ba625af7 Merge remote-tracking branch 'origin/stable/3.0' 2017-05-02 15:52:09 -04:00
Donald Sharp
df581cd3e1 Merge remote-tracking branch 'origin/stable/2.0' 2017-05-02 15:11:46 -04:00
Donald Sharp
f4d78586df ospfd: Fix a variant of the ospf redistribute command
Fix 'redistribute (ospf|table) ....' command

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-02 13:56:41 -04:00
Hung-Weic Chiu
c604467a08 Fix the "Uninitialized argument value" of clang SA.
Signed-off-by: Hung-Weic Chiu <sppsorrg@gmail.com>
2017-04-29 15:35:32 +00:00
Hung-Weic Chiu
3a6570a1f1 Fix the "Dead assignment" of clang SA.
- Remove duplicated assignemt.
- Remove unused initialized.

Signed-off-by: Hung-Weic Chiu <sppsorrg@gmail.com>
2017-04-29 15:25:32 +00:00
Donald Sharp
6be4da3dfa ospfd: Fix the 'show ip ospf int ...' command
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>
2017-04-08 08:47:59 -04:00
David Lamparter
ffc37fa151 Merge pull request #330 from dwalton76/ospf-no-log-adjacency-changes-detail
ospfd: "no log-adjacency-changes detail" disables log-adjacency-changes
2017-04-04 21:45:14 +02:00
Daniel Walton
7994b01d26 ospfd: "no log-adjacency-changes detail" disables log-adjacency-changes
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-04 18:13:43 +00:00
David Lamparter
3e7c8d040c Merge branch 'stable/2.0'
Fixed minor conflicts from "defaults" change on stable.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-04-04 19:01:47 +02:00
Quentin Young
eaa1ae0db4 ospfd, ospf6d: fix distance commands
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>
2017-04-03 20:17:12 +00:00
David Lamparter
505e50567f *: apply DEFUN_NOSH for node-switch CLI commands
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>
2017-03-28 15:48:07 -04:00
David Lamparter
8efe88eacf *: track version & "defaults" in configs
[CF]: Move default name to autoconf and update tests

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2017-03-28 19:18:42 +02:00
Donald Sharp
baaea325e6 *: Refactor ifindex2ifname to be VRF aware
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:43:21 -04:00
Donald Sharp
92a57eb206 *: Refactor if_get_by_name to be VRF aware
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:36:38 -04:00
Donald Sharp
1306c09a1b *: Refactor if_lookup_by_name to be VRF aware
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:36:23 -04:00
Donald Sharp
7e2b760345 *: Remove non-vrf based ifindex lookup
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:26:53 -04:00
David Lamparter
4525281af1 *: get rid of zlog(*, LOG_LEVEL, ...)
Result of running the following Coccinelle patch + fixups:
<<EOF
/* long-forms: zlog(NULL, <level>, ...)
 *    =>       zlog_level(...)
 */

@@
expression list args;
@@
- zlog(NULL, LOG_DEBUG, args)
+ zlog_debug(args)

@@
expression list args;
@@
- zlog(NULL, LOG_NOTICE, args)
+ zlog_notice(args)

@@
expression list args;
@@
- zlog(NULL, LOG_INFO, args)
+ zlog_info(args)

@@
expression list args;
@@
- zlog(NULL, LOG_WARNING, args)
+ zlog_warn(args)

@@
expression list args;
@@
- zlog(NULL, LOG_ERR, args)
+ zlog_err(args)

/* long-forms: zlog(base->log, <level>, ...)
 *    =>       zlog_level(...)
 */

@@
expression base;
expression list args;
@@
- zlog(base->log, LOG_DEBUG, args)
+ zlog_debug(args)

@@
expression base;
expression list args;
@@
- zlog(base->log, LOG_NOTICE, args)
+ zlog_notice(args)

@@
expression base;
expression list args;
@@
- zlog(base->log, LOG_INFO, args)
+ zlog_info(args)

@@
expression base;
expression list args;
@@
- zlog(base->log, LOG_WARNING, args)
+ zlog_warn(args)

@@
expression base;
expression list args;
@@
- zlog(base->log, LOG_ERR, args)
+ zlog_err(args)

EOF

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08 00:15:39 +01:00
Donald Sharp
40d1cbfbb3 *: Fix redistribute issue
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>
2017-01-27 15:52:12 -05:00
David Lamparter
cbf3e3eb3a ospfd: time: replace local helpers with monotime
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>
2017-01-23 18:26:28 +01:00
Donald Sharp
efd64b137a Merge remote-tracking branch 'frr/master' into cli_cleanup 2017-01-15 18:56:01 -05:00
Donald Sharp
effe821e25 ospfd: Fix some more virtual-link crashes
This commit fixes 2 virtual link cli crashes.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-15 18:45:09 -05:00
David Lamparter
b6f1faf045 Merge branch 'stable/2.0-for-merge'
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>
2017-01-13 15:24:25 +01:00
Quentin Young
b84aadae44 Merge branch 'master' into fix-proto_redistnum 2017-01-06 19:44:46 -05:00
Donald Sharp
3b14d86eed Merge remote-tracking branch 'origin/stable/2.0' 2017-01-06 09:58:21 -05:00
Donald Sharp
36da066554 ospfd: Stop attempt to read beyond end of argv
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>
2017-01-05 19:39:56 -05:00
David Lamparter
ab0181eed3 build: rename (2 of ?): route_types macros
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>
2016-12-20 18:34:29 +01:00
Quentin Young
6d681bd874 all: use ->text when parsing protocol argument
and match on full protocol name in proto_redistnum()

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-12-16 05:39:44 +00:00
David Lamparter
5304ba7e56 *: kill useless if(...) after VTY_DECLVAR_CONTEXT
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>
2016-12-09 17:50:01 +01:00
David Lamparter
52c6b0e20a *: fix remaining vty->index & add coccinelle patch
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>
2016-12-09 17:36:25 +01:00
David Lamparter
cdc2d76507 *: coccinelle-replace vty->index
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-09 17:36:25 +01:00
Quentin Young
6fd800be4a Merge remote-tracking branch 'osr/master' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	lib/command_match.c
2016-12-06 19:51:33 +00:00
David Lamparter
d7d73ffc8f *: fix up DEFUNs without install_element calls
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>
2016-12-05 20:28:24 +01:00
David Lamparter
7ddcfca4fb Merge branch 'queue/osr/vtysh-generic'
WARNING: Merge contains nontrivial fixups in vrf_cmd handling.

Conflicts:
	lib/if.c
	zebra/interface.c
2016-12-05 20:04:08 +01:00
David Lamparter
53dc2b05c7 Merge branch 'stable/2.0'
Conflicts:
	bgpd/bgp_route.c
	lib/if.c
	ripd/rip_interface.c
	zebra/interface.c
	zebra/zebra_vty.c
2016-12-05 19:48:38 +01:00
Quentin Young
0b11464604 Merge remote-tracking branch 'osr_private_quagga/queue/osr/vtysh-generic' into vtysh-grammar 2016-12-02 19:02:06 +00:00
Donald Sharp
45d430e81d ospfd: Fix json Crash with inactive timer
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>
2016-12-02 16:59:02 +01:00
David Lamparter
0b84f29490 *: make DEFUN installations file-local
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>
2016-12-01 17:25:56 +01:00
David Lamparter
0577b824e1 Merge branch 'stable/2.0' 2016-12-01 17:24:03 +01:00
Donald Sharp
0cad6e2653 ospfd: Fix memory leak when not using json
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>
2016-12-01 16:28:12 +01:00
Quentin Young
9973d18404 all: Replace "JavaScript Object Notation\n" with JSON_STR
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-29 23:26:03 +00:00
Quentin Young
3a2d747c2e all: Fix all underfull doc strings
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>
2016-11-29 23:07:11 +00:00
David Lamparter
030204c7b0 *: fix CLI copypasta mixups
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>
2016-11-29 14:15:05 +01:00
Quentin Young
99a522c71b ospfd, ospf6d: Clean up and unify doc strings
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-17 20:19:27 +00:00
Quentin Young
47b91972ad ospfd: Fix typo in retransmit-interval arg parsing
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-17 20:18:34 +00:00
Quentin Young
537eae3f28 ospfd: Use sane cmd names and organize install_element's
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-16 08:09:32 +00:00
Quentin Young
0d829fa74c ospfd: Clean up ospf_vty.c
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>
2016-11-16 07:46:49 +00:00
Quentin Young
5c2fc921e5 ospfd: Fix and consolidate ospf cost commands
Also hide deprecated unconfiguration forms.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-16 01:05:39 +00:00
Quentin Young
fefa0d8214 ospfd: Fix bad index for ospf message-digest-key
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-15 01:45:58 +00:00
Quentin Young
bc7d452fe6 ospfd: Update ospf area vlink interval commands
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-06 07:17:54 +00:00
Quentin Young
16cedbb01f all: Fix underfull doc strings, part 1
Add missing docstrings and separating \n.
Also eat some low-hanging refactoring fruit.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-04 23:03:03 +00:00
Quentin Young
e9e190f245 Merge branch 'cmaster-next' into vtysh-grammar
Conflicts:
	vtysh/vtysh.c
	zebra/zebra_vty.c
2016-10-25 19:38:04 +00:00
Donald Sharp
882261e18b Merge remote-tracking branch 'origin/cmaster' into cmaster-next 2016-10-21 16:05:03 -04:00
Quentin Young
39e92c066f Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	bgpd/bgp_encap.c
	bgpd/bgp_route.c
	lib/command.c
	lib/command.h
	ospf6d/ospf6d.c
	vtysh/vtysh.c
2016-10-21 19:27:49 +00:00
Christian Franke
c8cdf5c774 ospfd: fix double assignment in ospf_vl_set_timers
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-10-20 20:28:26 -04:00
Quentin Young
e52702f29d Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	bgpd/bgp_route.c
	bgpd/bgp_routemap.c
	bgpd/bgp_vty.c
	isisd/isis_redist.c
	isisd/isis_routemap.c
	isisd/isis_vty.c
	isisd/isisd.c
	lib/command.c
	lib/distribute.c
	lib/if.c
	lib/keychain.c
	lib/routemap.c
	lib/routemap.h
	ospf6d/ospf6_asbr.c
	ospf6d/ospf6_interface.c
	ospf6d/ospf6_neighbor.c
	ospf6d/ospf6_top.c
	ospf6d/ospf6_zebra.c
	ospf6d/ospf6d.c
	ospfd/ospf_routemap.c
	ospfd/ospf_vty.c
	ripd/rip_routemap.c
	ripngd/ripng_routemap.c
	vtysh/extract.pl.in
	vtysh/vtysh.c
	zebra/interface.c
	zebra/irdp_interface.c
	zebra/rt_netlink.c
	zebra/rtadv.c
	zebra/test_main.c
	zebra/zebra_routemap.c
	zebra/zebra_vty.c
2016-10-17 23:36:21 +00:00
Donald Sharp
0b1442e37b *: Consolidate all double VIEW_NODE and ENABLE_NODE's
If a command is put into the VIEW_NODE, it is going into the
ENABLE_NODE as well.  This is especially true for show commands.
As such if a command is in both consolidate it down to VIEW_NODE.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-10-07 21:05:06 -04:00
Christian Franke
dc9ffce878 *: Consistently support 32-bit route tags
This patch improves zebra,ripd,ripngd,ospfd and bgpd so that they can
make use of 32-bit route tags in the case of zebra,ospf,bgp or 16-bit
route-tags in the case of ripd,ripngd.

It is based on the following patch:

    commit d25764028829a3a30cdbabe85f32408a63cccadf
    Author: Paul Jakma <paul.jakma@hpe.com>
    Date:   Fri Jul 1 14:23:45 2016 +0100

    *: Widen width of Zserv routing tag field.

But also contains the changes which make this actually useful for all
the daemons.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2016-10-07 21:05:05 -04:00
Don Slice
a452df33aa ospfd: Display all ospf peers with show ip ospf neighbor detail all
Problem reported that no peers are displayed when the command "show
ip ospf neighbor detail all" is entered.  Determined that the problem
was actually that the function only displayed NBMA peers, and since
we rarely (if ever) define NBMA peers, nothing is normally displayed.
Changed the code to display both NBMA and non-NBMA peers, in both the
up and down state.  Manual testing attached to the jira ticket.

Ticket: CM-5878
Signed-off-by: Don Slice
Reviewed-by: Daniel Walton
2016-10-06 13:50:36 -04:00
Quentin Young
12dcf78e0b all: Fix various syntax errors
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-04 19:21:45 +00:00
Quentin Young
ccb8e0c7fb ospfd, ospf6d, ripd: Fix miscellaneous syntax errors
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-04 01:13:44 +00:00
Quentin Young
e83a94147f all: fix sundry syntax errors
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-01 04:20:30 +00:00
Daniel Walton
22b27e9530 ospfd: added some missing <>s
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-30 16:05:55 +00:00
root
7a7be51923 ospfd: resolve argc CHECK MEs in ospf_vty.c
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2016-09-30 11:18:14 -04:00
Daniel Walton
2aac576795 use JSON_C_TO_STRING_PRETTY for json_object_to_json_string
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-28 04:52:36 +00:00
Daniel Walton
a636c635ae bgpd: collaps show ip bgp, show ip bgp x.x.x.x, etc calls
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-26 18:08:45 +00:00
Daniel Walton
199d90a10e Expand #defines in command strings
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-25 16:49:39 +00:00
Daniel Walton
9ccf14f739 Expand #defines in command strings
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-25 14:10:48 +00:00
Daniel Walton
8d769265c4 ospfd: add 'int idx_foo' argv index variables
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 20:01:26 +00:00
Daniel Walton
6147e2c694 convert <1-255> to (1-255), ()s to <>s, etc
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 13:47:20 +00:00
Daniel Walton
b162fa7858 Change {json} to [json]
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 11:39:50 +00:00
Daniel Walton
f412b39a33 ALIAS removal for bgp, ospf, pim, isis, rip, ripng, lib and zebra
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 03:55:26 +00:00
Daniel Walton
bf2bfafd7e ospfd: argv update for all but ospf_vty.c
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-22 19:15:24 +00:00
Donald Sharp
87aea55d34 ospfd: Fix crash with usage of incorrect command
Entering 'show ip ospf interface json' causes ospf
to crash.

Entering 'show ip ospf interface <intf> json' causes
ospf to crash if intf has no neighbors on the otherside

Modify the code to not crash in these cases.

Ticket: CM-12776
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-13 14:12:41 -04:00
Donald Sharp
b8dfa54478 ospfd: Fix crash with usage of incorrect command
Entering 'show ip ospf interface json' causes ospf
to crash.

Entering 'show ip ospf interface <intf> json' causes
ospf to crash if intf has no neighbors on the otherside

Modify the code to not crash in these cases.

Ticket: CM-12776
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-09 14:53:24 -04:00
Olivier Dugeon
16f1b9ee29 Update Traffic Engineering Support for OSPFD
NOTE: I am squashing several commits together because they
do not independently compile and we need this ability to
do any type of sane testing on the patches.  Since this
series builds together I am doing this. -DBS

This new structure is the basis to get new link parameters for
Traffic Engineering from Zebra/interface layer to OSPFD and ISISD
for the support of Traffic Engineering

* lib/if.[c,h]: link parameters struture and get/set functions
* lib/command.[c,h]: creation of a new link-node
* lib/zclient.[c,h]: modification to the ZBUS message to convey the
link parameters structure
* lib/zebra.h: New ZBUS message

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>

Add support for IEEE 754 format

* lib/stream.[c,h]: Add stream_get{f,d} and stream_put{f,d}) demux and muxers to
  safely convert between big-endian IEEE-754 single and double binary
  format, as used in IETF RFCs, and C99.  Implementation depends on host
  using __STDC_IEC_559__, which should be everything we care about.  Should
  correctly error out otherwise.
* lib/network.[c,h]: Add ntohf and htonf converter
* lib/memtypes.c: Add new memeory type for Traffic Engineering support

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>

Add link parameters support to Zebra

* zebra/interface.c:
   - Add new link-params CLI commands
   - Add new functions to set/get link parameters for interface
* zebra/redistribute.[c,h]: Add new function to propagate link parameters
to routing daemon (essentially OSPFD and ISISD) for Traffic Engineering.
* zebra/redistribute_null.c: Add new function
zebra_interface_parameters_update()
* zebra/zserv.[c,h]: Add new functions to send link parameters

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>

Add support of new link-params CLI to vtysh

In vtysh_config.c/vtysh_config_parse_line(), it is not possible to continue
to use the ordered version for adding line i.e. config_add_line_uniq() to print
Interface CLI commands as it completely break the new LINK_PARAMS_NODE.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>

Update Traffic Engineering support for OSPFD

These patches update original code to RFC3630 (OSPF-TE) and add support of
RFC5392 (Inter-AS v2) & RFC7471 (TE metric extensions) and partial support
of RFC6827 (ASON - GMPLS).

* ospfd/ospf_dump.[c,h]: Add new dump functions for Traffic Engineering
* ospfd/ospf_opaque.[c,h]: Add new TLV code points for RFC5392
* ospfd/ospf_packet.c: Update checking of OSPF_OPTION
* ospfd/ospf_vty.[c,h]: Update ospf_str2area_id
* ospfd/ospf_zebra.c: Add new function ospf_interface_link_params() to get
Link Parameters information from the interface to populate Traffic Engineering
metrics
* ospfd/ospfd.[c,h]: Update OSPF_OPTION flags (T -> MT and new DN)
* ospfd/ospf_te.[c,h]: Major modifications to update the code to new
link parameters structure and new RFCs

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>

tmp
2016-09-03 11:05:50 -04:00
Joakim Tjernlund
953cde65c5 ospfd: Impl. per interface 'ip ospf area' command
Use with interface command:
 interface ppp0
 ip ospf area 0.0.0.0
This will enable OSPF on ppp0 with area 0.0.0.0

Remove with "no ip ospf area"

* ospf_vty.c: add "ip ospf area (A.B.C.D|<0-4294967295>)" interface command

* ospfd.c: (ospf_interface_{un,}set) new helper function to enable/disable
  OSPF on a specific interface.
  (ospf_if_update) 2 possible paths now to deal with interface updates.

Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
[DL: this restores the tree to deccaf9...]
2016-08-18 07:35:39 -04:00
David Lamparter
2c494df3fa Revert "per-interface ospf enable and area set command."
This reverts commit e723861da1.

The code is from Joakim Tjernlund; this is just to fix the history (and
attribution) of it.  The last commit will restore the exact same tree
state.

THIS COMMIT WILL PROBABLY NOT COMPILE.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-08-18 07:35:38 -04:00
Donald Sharp
cd66cd4ce1 ospfd: Remove HAVE_OPAQUE_LSA
HAVE_OPAQUE_LSA is used by default and you have to actively turn it off
except that OPAQUE_LSA is an industry standard and used pretty much
everywhere.  There is no need to have special #defines for this anymore.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit 36fef5708d074a3ef41f34d324c309c45bae119b)
2016-08-16 12:43:05 -04:00
Sid Khot
e018c7cc9a bgpd: Reverting fix for CM-5040: BGP and OSPF should accept "router-id use-loopback"
ospfd: Reverting fix for CM-5040: BGP and OSPF should accept "router-id use-loopback"

This reverts commit cdb805bc9e.

Conflicts:
	bgpd/bgp_vty.c
2016-08-12 17:09:27 -07:00
Sid Khot
cdb805bc9e bgpd: BGP should accept "router-id IFNAME"
ospfd: OSPF should accept "router-id IFNAME"

Added commands in BGP and OSPF where user can specify interface for router-id.

Ticket: CM-5040
Reviewed By: CCR-4908
Testing Done: Manual
2016-07-01 17:25:30 -07:00
Don Slice
70bd3c4369 ospfd/ospf6d/zebra: Change interface bandwidth range and auto-cost range to 100G
Prior to this change, interface bandwidth could not be defined above 10G. With
the use of higher speed interfaces, the ability to effectively define the path
links was highly impacted. Additionally, the default auto-cost reference-bandwidth
for ospf and ospfv3 was set to 100M, which relects a much earlier time.  Changed both
the range of interface bandwidth definitions and reference bandwidths to be up to
100G.  Set the default interface bandwidth (if not defined) to 10G to make the ratio
continue to cause a cost of 10 as before.  Manual testing as well as ospf-min and
ospf-smoke passed successfully.

Ticket: CM-10756
Signed-of-by: Don Slice
Reviewed-by: Donald Sharp
2016-06-13 09:06:45 -04:00
Paul Jakma
801e0e1492 ospfd: Remove the blocking of opaque LSAs origination & flooding 'optimisation'
* Opaque support contains some kind of hack/optimisation to
  origination/flooding to suppress some origins/floods until an opaque LS
  Acks are received.  Previous versions of the code have already been shown
  to have bugs in them (see e16fd8a5, e.g.). It seems over-complex and fragile,
  plus its conceptually the wrong place to try implement flooding hacks that,
  AFAICT, do not depend particularly on the semantics of opaque LSA.

  Nuke.

Tested-by: Olivier Dugeon <olivier.dugeon@orange.com>
2016-06-08 14:41:16 -04:00
Paul Jakma
d3a9c76878 ospfd: Some small tweaks to the SPF execution reason patch
* ospf_spf.h: use an enum for the reason, and have it as a new argument to
  ospf_spf_calculate_schedule, no need for additional call, and let compiler
  do the checking.
* ospf_spf.c: format changes - Quagga coding style places function names
  at the start of a new line, for easy grepping for definition.
  (ospf_spf_calculate_timer) Change the log format of SPF execution time to
  avoid ginormous line, and make logging conditional, as is the norm.

(cherry picked from commit b6eef003e1a79471addea0b01853b08aed812cc8)

Conflicts:
	ospfd/ospf_spf.c
2016-05-26 20:46:24 +00:00
Paul Jakma
f842f16640 ospfd: Make ospf_passive_interface_update calls friendly to static analysis
* ospf_vty.c: ({no_}ospf_passive_interface_addr_cmd) To a static analyser,
  the call to ospf_passive_interface_update can look like uninitialised memory
  in addr might be read from. It won't be, as ospf_passive_interface_update
  only reads addr if params != IF_DEF_PARAMS, but not clear. Split up the
  helper into the two cases to make it clear.

(cherry picked from commit e1bcd4741c24ff990a9413ead9a9e37b80153046)
2016-05-26 15:33:30 +00:00
Donald Sharp
cb2af5d07a ospfd: Fix compiler warnings
Two issues:

1) nbr->oi->ifp->name is an array it would
always evaluate to true.

2) There exist a code path where addr
would be used without initialization.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-05-20 09:34:32 -04:00
Daniel Walton
535c84b16b OSPF LSA may not be refreshed within 1800s, ANVL OSPF test 12.4 fails
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-10948

The previous formula for calculating delay was:

    delay = OSPF_LS_REFRESH_TIME - LS_AGE (lsa) - OSPF_LS_REFRESH_JITTER
              + (random () % (2*OSPF_LS_REFRESH_JITTER));

If LS_AGE() is 0 we get:

  delay = 1800 - 0 - 60 + (random() % 2*60)

So delay will be 1740 + 0..120, so we could easily pick a delay that is
greater than OSPF_LS_REFRESH_TIME (1800).  For the normal case where
we hit this else the LS_AGE will be > 0 so that reduces the chances of
delay being greater than 1800.
2016-05-18 13:36:38 +00:00
Daniel Walton
54b7214fb9 OSPF refreshTimerMsecs in json output is off
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-10960

The timer is in seconds and was being divided by 1000 instead of
multiplying by 1000 when converting to ms.
2016-05-13 18:19:56 +00:00
Donald Sharp
b2d7c082a2 quagga: Remove iflist global variable
The file if.c has a iflist that had the list of interfaces
in the default vrf.  Remove this variable and replace
with a vrf_iflist lookup on the default vrf where it
was used.

Additionally, modify ptm code to iterate over all vrf's
when enabling ptm.

Ticket: CM-10338
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Radhika Mahankali <radhika@cumulusnetworks.com>
2016-04-08 13:15:59 -04:00
Don Slice
84361d615d quagga: delete interface from default table when moved to vrf
All daemons changed to flag an interface that has been moved to a vrf as DELETED instead of INTERNAL.
When they were flagged as IFINDEX_INTERNAL, ospf, rip, and isis would re-install them in the default
assuming that they were being "pre-defined" before the kernel definitions.

Ticket: CM-9265
Signed-off-by: Don Slice
Reviewed-by: Donald Sharp
2016-03-18 19:53:15 +00:00
Donald Sharp
d8f70b86d7 ospfd: Fix Dereference of Null Pointer during config
This construct:

struct ospf *ospf = vty->index;
if (!ospf)
  return CMD_SUCCESS;

Is present throughout the entire ospfd code base.  The command:
distance ospf external 255

Is not protected by this construct. I added this construct
to the command and in addition did a quick search to find
any others not protected and to protect them.

Ticket: CM-9725
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
2016-03-17 17:26:46 -04:00
Daniel Walton
747e489cd8 Make duplicate ospf commands hidden
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2016-03-02 19:56:28 +00:00
Donald Sharp
a1afa410da ospfd: Fix some missing 'no XXX' commands
A recent modification accidently removed the 'no XXXX'
form of some commands that cl-ospf depended on.

Tickets: CM-9481
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-02-24 07:43:22 -05:00
Daniel Walton
12fde75be5 OSPFv2 has both "router-id x.x.x.x" and "ospf router-id x.x.x.x"
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Don Slice <dslice@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-9285
2016-02-19 13:36:06 +00:00
Daniel Walton
2b053042aa OSPF distance command does not accept "external <1-255>"
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2016-02-10 21:02:23 +00:00
Daniel Walton
813d4307f9 Should be able to "no" the full text of any config line
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-5816
2015-11-23 18:05:03 +00:00
Donald Sharp
db7c85284f Quagga: Fixup cli and json keyword
The json keyword was being read incorrectly.
Basically some commands read a variable # of arguments
and in ospf the command values were being placed into
argc and argv.  With a variable # of arguments their
existed a possibility that less arguments would be read
from the cli than were being tested for in the command function
handler.  This caused core dumps in some situations.

All code to read to decide to use the json keyword has
been centralized through a function and all code
converted to use it, irrelevant if it exhibited the bug

Ticket: CM-8278
Reviewed by: CCR-3830
Testing: OSPF no longer crashes and all other test suites still run

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-11-18 15:36:04 -08:00
Daniel Walton
c3150466c8 OSPF: remove deprecated commands
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-8142
2015-11-13 02:38:42 +00:00
Daniel Walton
692c795432 Enable OSPF "log-adjacency-changes" by default
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-7941
2015-11-03 10:48:30 -08:00
Vipin Kumar
73b9f7037b Print an error when user tries to change a previously configured area.
Ticket: CM-5673
Reviewed By: Donald
Testing Done:  Cherry picking from 2.5.4, no testing in 3.0 yet.
2015-10-20 15:06:25 -07:00
radhika
68fe91d6c7 Support of BFD status in Quagga
Ticket:CM-6802, CM-6952
Reviewed By: Donald, Kanna
Testing Done:

Double commit of b76943235e09472ec174edcf7204fc82d27fe966 from br2.5. But, manually resolved all the compilation errors. Also, modified the shows to support the json format which was not supported in br2.5.

CM-6802 – Currently, BFD session status can be monitored only through ptmctl. There is no way to check the BFD status of a peer/neighbor through Quagga. Debugging becomes easier if BFD status is shown in Quagga too. BFD status is relevant when it is shown against the BGP peer/OSPF neighbor. For, this following code changes have been done:
   - Only down messages from PTM were being propagated from Zebra daemon to clients (bgpd, ospfd and ospf6d). Now, both up and down messages are redistributed to the clients from zebra. BFD status field has been added to the messaging. Handling of BFD session up messages has been added to the client code. BGP/OSPF neighbor is brought down only if the old BFD session status is ‘Up’ to handle extra/initial down messages.
   - BFD status and last update timestamp fields have been added to the common BFD info structure. Also, common show functions for showing BFD information have been added to BFD lib.
   - Modified the BGP neighbor show functions to call common BFD lib functions.
   - For ospf and ospf6, BFD information was maintained only at interface level. To show BFD status per neighbor, BFD information has been added at neighbor level too. “show ip ospf interface”, “show ip ospf neighbor detail”, “show ipv6 ospf6 interface” and “show ipv6 ospf6 neighbor detail” output have been modified to show BFD information.

CM-6952 - IBGP peers were always assumed to be multi-hop since there was no easy way to determine whether an IBGP peer was single hop or multihop unlike EBGP. But, this is causing problem with IBGP link local peers since BFD doesn't allow multihop BFD session with link local IP addresses. Link local peers were discovered when the interface peering was enabled. Interface peering is always singlehop. So, added checks to treat all interface based peers as single hop irrespective of whether the peer is IBGP or EBGP.
2015-08-31 14:56:11 -07:00
Morgan Stewart
3ac237f89a Added json formating support to several show-...-detail ospf commands.
Ticket: CM-6520
Reviewed By: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed By: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-By: Morgan Stewart <morgan@cumulusnetworks.com>
Testing Done: Manual testing and smoketested

Whenever some sort of output is encountered, added a json version with
proper logic as well.
2015-08-07 11:16:18 -07:00
Michael Rossberg
ac7424f9de configuration options for faster OSPF convergence
Allow configuration of faster OSPF convergence via the
min_ls_interval and min_ls_arrival timer lengths.

This patch was originated by Michael, and cross-ported
to Cumulus's Quagga.

Signed-off-by: Michael Rossberg <michael.rossberg@tu-ilmenau.de>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-07-31 06:29:35 -07:00
Donald Sharp
b07c4cb33e arm compilation failures.
Ticket: Trivial
Reviewed by: Trivial
Testing: arm/powerpc/amd64 targets now build

Apparently we have a arm build.  Who knew?  This fixes the compile warnings/errors
produced when you compile a arm build with -Werror.
2015-07-29 16:02:26 -07:00