]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
7 years agovtysh: fix some macro breakage
David Lamparter [Fri, 11 Nov 2016 06:23:02 +0000 (07:23 +0100)]
vtysh: fix some macro breakage

vtysh's extract.pl script doesn't cope with install_element(var, ) where
"var" is not one of the FOO_NODE constants.  Also, the future defun_lex
tool doesn't deal well with preprocessor expansions in the same regard.

This tries simplifying out some of these.  lib/distribute.c needs
further thinking.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agovtysh: initialise readline before binding key
David Lamparter [Sat, 19 Nov 2016 09:42:52 +0000 (10:42 +0100)]
vtysh: initialise readline before binding key

when libreadline initialises itself, it also reads .inputrc, which may
result in keybindings being set up.  This means the builtin help on the
'?' key can be overridden by that.  Consistent availability of '?'
behaviour trumps .inputrc setup here, so let's initialise readline
first before binding that key (which means our keybinding wins).

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agobuild: remove memtypes.h, put back in .gitignore
David Lamparter [Wed, 23 Nov 2016 07:30:10 +0000 (08:30 +0100)]
build: remove memtypes.h, put back in .gitignore

The file crept back in, better to keep it in .gitignore I guess.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agobuild: drop and ignore ylwrap
David Lamparter [Fri, 18 Nov 2016 15:26:01 +0000 (16:26 +0100)]
build: drop and ignore ylwrap

ylwrap is a YACC wrapper that is automatically installed by autoreconf /
bootstrap.sh.  It shouldn't really be kept around in git.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agobgpd: Fix ambiguous commands for `...attribute-unchanged...`
Quentin Young [Tue, 22 Nov 2016 22:43:39 +0000 (22:43 +0000)]
bgpd: Fix ambiguous commands for `...attribute-unchanged...`

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agoMerge branch 'cmaster-next' into vtysh-grammar
Quentin Young [Tue, 22 Nov 2016 21:36:54 +0000 (21:36 +0000)]
Merge branch 'cmaster-next' into vtysh-grammar

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Conflicts:
zebra/interface.c

7 years agoMerge remote-tracking branch 'origin/cmaster' into cmaster-next
Donald Sharp [Sat, 19 Nov 2016 17:31:41 +0000 (12:31 -0500)]
Merge remote-tracking branch 'origin/cmaster' into cmaster-next

Conflicts:
debian/changelog
zebra/zebra_rnh.c

7 years agolib: Fix `ipv6 access-list...` and `ipv6 prefix-list...`
Quentin Young [Fri, 18 Nov 2016 21:27:30 +0000 (21:27 +0000)]
lib: Fix `ipv6 access-list...` and `ipv6 prefix-list...`

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agobgpd: Fix `no ip as-path access-list...`
Quentin Young [Fri, 18 Nov 2016 20:51:40 +0000 (20:51 +0000)]
bgpd: Fix `no ip as-path access-list...`

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agovtysh, zebra: Fix link-params to use exit-link-params
Donald Sharp [Fri, 18 Nov 2016 20:42:41 +0000 (15:42 -0500)]
vtysh, zebra: Fix link-params to use exit-link-params

Fix the link-params submode to use the 'exit-link-params'
to indicate we are exiting a submode.

Fixup all the relevant bits.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
7 years agoMerge remote-tracking branch 'opensourcerouting/cmaster-next-linkpar' into cmaster...
Donald Sharp [Fri, 18 Nov 2016 18:51:33 +0000 (13:51 -0500)]
Merge remote-tracking branch 'opensourcerouting/cmaster-next-linkpar' into cmaster-next

7 years ago*: Fix up licensing to be right
Donald Sharp [Fri, 18 Nov 2016 15:11:46 +0000 (10:11 -0500)]
*: Fix up licensing to be right

These files were submitted by Cumulus but did
not properly setup the licensing of them.
This fixes that issue.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
7 years agobgpd: Fix incorrect config dumps for `dump bgp...`
Quentin Young [Fri, 18 Nov 2016 00:23:29 +0000 (00:23 +0000)]
bgpd: Fix incorrect config dumps for `dump bgp...`

* Correct dump type was not showing for routes-mrt &
  updates-et
* Could not unconfigure most of them

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agobgpd: Fix `ip as-path access-list ...` breakage
Quentin Young [Thu, 17 Nov 2016 22:51:32 +0000 (22:51 +0000)]
bgpd: Fix `ip as-path access-list ...` breakage

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agozebra: Fix `no ip nht ...` commands
Quentin Young [Thu, 17 Nov 2016 21:54:36 +0000 (21:54 +0000)]
zebra: Fix `no ip nht ...` commands

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agobgpd: Add missing [ip] qualifiers to a couple BGP commands
Quentin Young [Thu, 17 Nov 2016 21:33:04 +0000 (21:33 +0000)]
bgpd: Add missing [ip] qualifiers to a couple BGP commands

Missed these when I was unifying the `show bgp` and
`show ip bgp` command trees.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agolib, ospf6d: Change SECONDS_STR to be more generic
Quentin Young [Thu, 17 Nov 2016 20:39:41 +0000 (20:39 +0000)]
lib, ospf6d: Change SECONDS_STR to be more generic

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agoospfd, ospf6d: Clean up and unify doc strings
Quentin Young [Thu, 17 Nov 2016 20:19:27 +0000 (20:19 +0000)]
ospfd, ospf6d: Clean up and unify doc strings

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agoospfd: Fix typo in retransmit-interval arg parsing
Quentin Young [Thu, 17 Nov 2016 20:18:34 +0000 (20:18 +0000)]
ospfd: Fix typo in retransmit-interval arg parsing

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agobgpd: 'show ip bgp neighbor json' some keys are in the wrong place
Daniel Walton [Wed, 16 Nov 2016 15:33:35 +0000 (15:33 +0000)]
bgpd: 'show ip bgp neighbor json' some keys are in the wrong place

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Sam Tannous <stannous@cumulusnetworks.com>
Ticket: CM-13511

7 years agobgpd: 'show ip bgp neighbor json' some keys are in the wrong place
Daniel Walton [Wed, 16 Nov 2016 14:25:04 +0000 (14:25 +0000)]
bgpd: 'show ip bgp neighbor json' some keys are in the wrong place

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-13511

connectionsEstablished, etc are no longer under the addressFamilyInfo
keyword, they are now at the top level

7 years agoospfd: Use sane cmd names and organize install_element's
Quentin Young [Wed, 16 Nov 2016 08:09:32 +0000 (08:09 +0000)]
ospfd: Use sane cmd names and organize install_element's

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agoospfd: Clean up ospf_vty.c
Quentin Young [Wed, 16 Nov 2016 07:46:49 +0000 (07:46 +0000)]
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>
7 years agoospfd: Fix and consolidate ospf cost commands
Quentin Young [Wed, 16 Nov 2016 01:05:39 +0000 (01:05 +0000)]
ospfd: Fix and consolidate ospf cost commands

Also hide deprecated unconfiguration forms.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agolib: Fix nondeterministic command matches in rare cases
Quentin Young [Tue, 15 Nov 2016 22:15:18 +0000 (22:15 +0000)]
lib: Fix nondeterministic command matches in rare cases

When a user erroneously defines two commands which can
match the same input and at least one of the tokens defined
last in the command is a selector or option, the matcher
does not detect an ambiguous match and matches the command
installed first (leftmost in the graph).

Fix is to do a full walkthrough of the follow set when
matching the final token in a command to check that there
is exactly one possible match, and to throw an ambiguity
error otherwise.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agoospfd: Fix bad index for ospf message-digest-key
Quentin Young [Tue, 15 Nov 2016 01:45:58 +0000 (01:45 +0000)]
ospfd: Fix bad index for ospf message-digest-key

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agobgpd: Fix partial match on <external|internal> for remote-as
Quentin Young [Mon, 14 Nov 2016 19:15:43 +0000 (19:15 +0000)]
bgpd: Fix partial match on <external|internal> for remote-as

Ticket: CM-8545

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
Don Slice [Mon, 14 Nov 2016 16:37:47 +0000 (08:37 -0800)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

7 years agozebra: remove recursively derived static routes correctly
Don Slice [Thu, 10 Nov 2016 23:49:45 +0000 (15:49 -0800)]
zebra: remove recursively derived static routes correctly

Problem reported that in certain configs, when a router is initially
booted and the link is bounced, we can end up with a bogus static route
in the table.  This was due to the assumption in zebra_rnh that a static
route would not be recursively resolved through another static route with
a different next-hop. This fix changes this assumption.  Tested manually
and bgp-min, ospf-min, and vrf-min run with no new failures.

Ticket: CM-13328
Signed-off-by: Don Slice
Reviewed-by: CCR-5338
7 years agobgpd: Rework bgp 'attribute-unchanged' commands
Quentin Young [Sun, 13 Nov 2016 09:37:43 +0000 (09:37 +0000)]
bgpd: Rework bgp 'attribute-unchanged' commands

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agotools: Remove CLI refactoring tools
Quentin Young [Sat, 12 Nov 2016 09:17:48 +0000 (09:17 +0000)]
tools: Remove CLI refactoring tools

No longer need automatic refactoring tools for CLI backend.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agozebra: fix link-params CLI handling
David Lamparter [Sat, 12 Nov 2016 08:43:15 +0000 (17:43 +0900)]
zebra: fix link-params CLI handling

vtysh was breaking in a rather ugly way, and some "no" forms were
missing too.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agobgpd: Require `confed` or `missing-as-worst`
Quentin Young [Sat, 12 Nov 2016 05:55:05 +0000 (05:55 +0000)]
bgpd: Require `confed` or `missing-as-worst`

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agoMerge branch 'cmaster-next' into vtysh-grammar
Quentin Young [Sat, 12 Nov 2016 05:17:37 +0000 (05:17 +0000)]
Merge branch 'cmaster-next' into vtysh-grammar

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Conflicts:
lib/command.c
lib/vty.c

7 years agolib, vtysh: Fix memory leaks, change cmd_element to const
Quentin Young [Sat, 12 Nov 2016 01:06:32 +0000 (01:06 +0000)]
lib, vtysh: Fix memory leaks, change cmd_element to const

Fix a few memory issues:

* Not freeing tab-completions upon input match failure
* Invalid write when null-terminating tab-completions
* Not freeing argv[] itself in additinon to elements
* Use XFREE() instead of free() as appropriate
* Not freeing final token of an [option] during parsing

Make a few minor changes to CLI internals:

* Improve documentation on matching & completion functions
* Only make one copy of cmd_token's when building argv,
  instead of three
* Don't make a copy of the matching cmd_element

Make one major(ish) change to CLI internals:

* Change all pointers to struct cmd_element to const

Code outside of the core CLI units should never have an
occasion to modify the internal state of the command system.
Doing so could easily amount to having a CLI interface that
changes during runtime, and could conceivably lead to security
issues. Explicitly disallowing this removes any chance of
confusion.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agoCumulus: Fixup changelog and version string.
Donald Sharp [Sat, 12 Nov 2016 00:31:05 +0000 (19:31 -0500)]
Cumulus: Fixup changelog and version string.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
7 years agolib: Allow '-' to match VARIABLE_TKN
Quentin Young [Fri, 11 Nov 2016 20:37:43 +0000 (20:37 +0000)]
lib: Allow '-' to match VARIABLE_TKN

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agobgpd: Fix `bgp bestpath med ...` commands
Quentin Young [Fri, 11 Nov 2016 20:20:36 +0000 (20:20 +0000)]
bgpd: Fix `bgp bestpath med ...` commands

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agobgpd: Fix ambiguous command definition
Quentin Young [Fri, 11 Nov 2016 00:46:38 +0000 (00:46 +0000)]
bgpd: Fix ambiguous command definition

* neighbor ... attribute-unchanged

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agolib: Update `list [permutations]`
Quentin Young [Thu, 10 Nov 2016 23:30:20 +0000 (23:30 +0000)]
lib: Update `list [permutations]`

Don't show hidden or deprecated commands.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agotools: Update permutations generator for hidden/deprecated
Quentin Young [Thu, 10 Nov 2016 23:21:06 +0000 (23:21 +0000)]
tools: Update permutations generator for hidden/deprecated

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agolib: Implement hidden and deprecated commands
Quentin Young [Thu, 10 Nov 2016 23:17:07 +0000 (23:17 +0000)]
lib: Implement hidden and deprecated commands

Each token now knows whether it is part of a hidden
or deprecated command. Command completion logic hides
such tokens when generating completions. Command
matching logic works as before and will still match on
hidden and deprecated commands.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agoMerge remote-tracking branch 'opensourcerouting/cmaster-next-vty2' into cmaster-next
Donald Sharp [Thu, 10 Nov 2016 13:08:23 +0000 (08:08 -0500)]
Merge remote-tracking branch 'opensourcerouting/cmaster-next-vty2' into cmaster-next

Conflicts:
watchquagga/watchquagga.c

7 years agovtysh: fix config write
David Lamparter [Thu, 10 Nov 2016 12:59:54 +0000 (13:59 +0100)]
vtysh: fix config write

7 years agoMerge remote-tracking branch 'origin/cmaster' into cmaster-next
Donald Sharp [Thu, 10 Nov 2016 12:57:51 +0000 (07:57 -0500)]
Merge remote-tracking branch 'origin/cmaster' into cmaster-next

7 years agodoc: vtysh doc updates
David Lamparter [Wed, 9 Nov 2016 12:29:00 +0000 (13:29 +0100)]
doc: vtysh doc updates

7 years agodoc: generic updates
David Lamparter [Wed, 9 Nov 2016 12:28:40 +0000 (13:28 +0100)]
doc: generic updates

7 years agovtysh: improve config-write error reporting
David Lamparter [Wed, 9 Nov 2016 14:05:14 +0000 (15:05 +0100)]
vtysh: improve config-write error reporting

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agolib: add minimal no-config VTY mode
David Lamparter [Wed, 9 Nov 2016 13:42:47 +0000 (14:42 +0100)]
lib: add minimal no-config VTY mode

This silences the following warning from watchquagga:
"Can't save to configuration file, using vtysh."
which otherwise appears when doing a "write file" in vtysh when no
integrated-config is in use.

Also make "show memory" available in watchquagga.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agowatchquagga: Signal when we are actually up and running
Donald Sharp [Wed, 9 Nov 2016 15:22:22 +0000 (10:22 -0500)]
watchquagga: Signal when we are actually up and running

When Quagga is starting up, it is returning immediately.
This is leaving us in a state where systemd believes
Quagga is up and running, while the sytem might actually
not have restarted the code yet.

Modify the code so that when watchquagga starts up
it doesn't start communicating with systemd until
such time that it detects that all daemons are
running.

Additionally modify watchquagga to touch a
file in /var/run/quagga/ that the /usr/lib/quagga/quagga
script looks for for 10 seconds.  If it finds this
Quagga started file then we know watchquagga
has successfully communicated with all daemons.
If after 10 seconds we haven't communicated
with Quagga, continue on for the start and let the
normal start failure code work.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
7 years agoRevert "vtysh: Make vtysh run as quagga user"
David Lamparter [Tue, 8 Nov 2016 18:02:26 +0000 (19:02 +0100)]
Revert "vtysh: Make vtysh run as quagga user"

This reverts commit 5dd58b08299e85735f19fba1ee307c509fb19de7.

Changing vtysh uid/gid is now actually counterproductive.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agovtysh: funnel integrated write through watchquagga
David Lamparter [Tue, 8 Nov 2016 22:36:16 +0000 (23:36 +0100)]
vtysh: funnel integrated write through watchquagga

Running vtysh as normal user won't have permissions to write
Quagga.conf.  If we're connected to watchquagga, try "write integrated"
first.  In all cases if something fails, try directly.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agovtysh: add watchquagga to target list
David Lamparter [Tue, 8 Nov 2016 18:41:48 +0000 (19:41 +0100)]
vtysh: add watchquagga to target list

Also tag some commands as VTYSH_REALLYALL; these are absolutely
neccessary for correct vtysh operation and will cause "interesting"
breakage if not present on all daemons.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agowatchquagga: add "write integrated"
David Lamparter [Wed, 9 Nov 2016 13:15:34 +0000 (14:15 +0100)]
watchquagga: add "write integrated"

This new command - available for internal use by vtysh and explicit
usage by users - calls "vtysh -w" from watchquagga.  This ensures vtysh
is run with privileges to actually write the integrated-config file.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agowatchquagga: add ZLOG_WATCHQUAGGA
David Lamparter [Tue, 8 Nov 2016 22:56:34 +0000 (23:56 +0100)]
watchquagga: add ZLOG_WATCHQUAGGA

watchquagga logs as "NONE", which will also become visible in vtysh for
error messages.  Add "WATCHQUAGGA" log target.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agovtysh: set config file permissions
David Lamparter [Tue, 8 Nov 2016 22:36:01 +0000 (23:36 +0100)]
vtysh: set config file permissions

As vtysh may hopefully be running as root from watchquagga here, let's
try to fix up ownership and permissions for Quagga.conf.  Doing
chown/chmod instead of changing the process's user/group IDs has the
advantage of fixing up preexisting misconfigurations.

Note errors in chmod/chown will print a message but the config is
already written at that point.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agovtysh: add -w option for integrated-config write
David Lamparter [Tue, 8 Nov 2016 18:01:06 +0000 (19:01 +0100)]
vtysh: add -w option for integrated-config write

This new option is intended to be used both by watchquagga as well as
directly by users.  It performs the collect-configuration operation and
writes out Quagga.conf, regardless of whether integrated-config is
enabled or not.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agovtysh: detangle configuration writes
David Lamparter [Tue, 8 Nov 2016 17:22:30 +0000 (18:22 +0100)]
vtysh: detangle configuration writes

vtysh has a very convoluted and confusing setup where it isn't even
clear which files are written where (since some filenames come
indirectly from loading config).  Detangle.

This also removes writing vtysh.conf.  The file is intended to be
manually edited since it has some vague security concerns (if PAM is
used).

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agolib: privs: always look up VTY group
David Lamparter [Tue, 8 Nov 2016 18:42:01 +0000 (19:42 +0100)]
lib: privs: always look up VTY group

Even if we're running without user switch, we should still try to honor
the VTY group.  This applies both to watchquagga (which always runs as
root) as well as "no-userswitch" configurations for other daemons.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agolib: add and use set_cloexec()
David Lamparter [Tue, 8 Nov 2016 19:46:05 +0000 (20:46 +0100)]
lib: add and use set_cloexec()

watchquagga is already leaking an open file descriptor on its pid file
on fork+exec() invocations; next up is adding vtysh support with even
more fds.  Mark things CLOEXEC before going there.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agobgpd, vtysh: Fix failing bgp cli
Quentin Young [Wed, 9 Nov 2016 07:24:51 +0000 (07:24 +0000)]
bgpd, vtysh: Fix failing bgp cli

* bgp bestpath as-path multipath-relax
* address-family encap
* address-family encapv4

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agobgpd: actually set maxpaths
Quentin Young [Tue, 8 Nov 2016 20:46:47 +0000 (20:46 +0000)]
bgpd: actually set maxpaths

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agobgpd: don't call strtol on null pointer
Quentin Young [Tue, 8 Nov 2016 20:42:30 +0000 (20:42 +0000)]
bgpd: don't call strtol on null pointer

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agoall: Fix underfull doc strings, part 2
Quentin Young [Tue, 8 Nov 2016 01:46:04 +0000 (01:46 +0000)]
all: Fix underfull doc strings, part 2

Add missing docstrings and separating \n.
Also eat some low-hanging refactoring fruit.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agobgpd: Fix `maximum-paths (1-255)`
Quentin Young [Sun, 6 Nov 2016 07:38:50 +0000 (07:38 +0000)]
bgpd: Fix `maximum-paths (1-255)`

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agoospfd: Update ospf area vlink interval commands
Quentin Young [Sun, 6 Nov 2016 07:17:54 +0000 (07:17 +0000)]
ospfd: Update ospf area vlink interval commands

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agoall: Fix underfull doc strings, part 1
Quentin Young [Fri, 4 Nov 2016 23:03:03 +0000 (23:03 +0000)]
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>
7 years agoospfd, lib: Fix `no pce address` syntax
Quentin Young [Fri, 4 Nov 2016 20:16:07 +0000 (20:16 +0000)]
ospfd, lib: Fix `no pce address` syntax

And change parser debugging messages to zlog_debug

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agovtysh: Add address-family stomps
Quentin Young [Thu, 3 Nov 2016 23:06:59 +0000 (23:06 +0000)]
vtysh: Add address-family stomps

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agovtysh: Condense a few address-family commands
Quentin Young [Thu, 3 Nov 2016 23:02:21 +0000 (23:02 +0000)]
vtysh: Condense a few address-family commands

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agoMerge branch 'cmaster-next' into vtysh-grammar
Quentin Young [Thu, 3 Nov 2016 20:43:41 +0000 (20:43 +0000)]
Merge branch 'cmaster-next' into vtysh-grammar

7 years agolib: Remove node debug message on `list` output
Quentin Young [Thu, 3 Nov 2016 19:18:02 +0000 (19:18 +0000)]
lib: Remove node debug message on `list` output

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agobgpd: Condense `neighbor ... attribute-unchanged` commands
Quentin Young [Thu, 3 Nov 2016 19:17:33 +0000 (19:17 +0000)]
bgpd: Condense `neighbor ... attribute-unchanged` commands

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agobgpd: Fix off-by-one when extracting netmask
Quentin Young [Thu, 3 Nov 2016 19:16:42 +0000 (19:16 +0000)]
bgpd: Fix off-by-one when extracting netmask

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agobgpd: Refactor community-list commands
Quentin Young [Mon, 31 Oct 2016 20:19:49 +0000 (20:19 +0000)]
bgpd: Refactor community-list commands

Part of an ongoing campaign to remove argv parsing
helper functions.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agolib: Fix segfault on erroneous command
Quentin Young [Mon, 31 Oct 2016 03:34:27 +0000 (03:34 +0000)]
lib: Fix segfault on erroneous command

Command completion vector should only be copied if it is
non-null.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agobgpd: Consolidate aggregate-address commands
Quentin Young [Sat, 29 Oct 2016 05:34:10 +0000 (05:34 +0000)]
bgpd: Consolidate aggregate-address commands

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agolib: Various minor improvements & bugfixes to CLI backend
Quentin Young [Sat, 29 Oct 2016 04:43:04 +0000 (04:43 +0000)]
lib: Various minor improvements & bugfixes to CLI backend

- Do not allow tab-completion on anything except words
- Rewrite cmd_make_strvec to use strsep
- Remove a few trailing whitespaces
- Remove cmd_complete_command_lib

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agoModify build version.
Donald Sharp [Sat, 29 Oct 2016 00:44:12 +0000 (20:44 -0400)]
Modify build version.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
7 years agobgpd: Vestigialize `show ip bgp`, this time for real
Quentin Young [Fri, 28 Oct 2016 00:10:10 +0000 (00:10 +0000)]
bgpd: Vestigialize `show ip bgp`, this time for real

Missed a couple.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agobgpd: Unify `show bgp` and `show ip bgp` trees
Quentin Young [Thu, 27 Oct 2016 23:52:48 +0000 (23:52 +0000)]
bgpd: Unify `show bgp` and `show ip bgp` trees

Hear ye, hear ye. `ip` is now a vestigial keyword
for bgpd's show commands.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agobgpd: Clean up cli help strings
Quentin Young [Thu, 27 Oct 2016 23:18:26 +0000 (23:18 +0000)]
bgpd: Clean up cli help strings

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agolib: Log warning when commands have underfull doc string
Quentin Young [Thu, 27 Oct 2016 22:08:10 +0000 (22:08 +0000)]
lib: Log warning when commands have underfull doc string

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
7 years agobuild: configure.ac - use AC_PROG_CC_C99 instead of cflags to force c99 mode
Martin Winter [Fri, 21 Oct 2016 06:55:10 +0000 (23:55 -0700)]
build: configure.ac - use AC_PROG_CC_C99 instead of cflags to force c99 mode

7 years agobgpd: Squash spurious "unknown afi" log messages
Paul Jakma [Fri, 22 Apr 2016 11:48:49 +0000 (12:48 +0100)]
bgpd: Squash spurious "unknown afi" log messages

* bgp_packet.c: (bgp_update_receive) doesn't differentiate between NLRIs that
  are 0 AFI/SAFI cause they weren't set, and those because a peer sent a
  bogus AFI/SAFI, before sending sending what may be a misleading, spurious
  log message.  Check the .nlri pointer is set and avoid this.

Incorporating a suggestion from: G. Paul Ziemba <unp@ziemba.us>

7 years agobgpd: Remove the double-pass parsing of NLRIs
Paul Jakma [Thu, 4 Feb 2016 17:00:18 +0000 (17:00 +0000)]
bgpd: Remove the double-pass parsing of NLRIs

* bgpd parses NLRIs twice, a first pass "sanity check" and then a second pass
  that changes actual state. For most AFI/SAFIs this is done by
  bgp_nlri_sanity_check and bgp_nlri_parse, which are almost identical.

  As the required action on a syntactic error in an NLRI is to NOTIFY and
  shut down the session, it should be acceptable to just do a one pass
  parse.  There is no need to atomically handle the NLRIs.

* bgp_route.h: (bgp_nlri_sanity_check) Delete
* bgp_route.c: (bgp_nlri_parse) Make the prefixlen size check more general
  and don't hard-code AFI/SAFI details, e.g. use prefix_blen library function.

  Add error logs consistent with bgp_nlri_sanity_check as much as possible.

  Add a "defense in depth" type check of the prefixlen against the sizeof
  the (struct prefix) storage - ala bgp_nlri_parse_vpn.
  Update standards text from draft RFC4271 to the actual RFC4271 text.

  Extend the semantic consistency test of IPv6. E.g. it should skip mcast
  NLRIs for unicast safi as v4 does.

* bgp_mplsvpn.{c,h}: Delete bgp_nlri_sanity_check_vpn and make
  bgp_nlri_parse_vpn_body the bgp_nlri_parse_vpn function again.

  (bgp_nlri_parse_vpn) Remove the notifies.  The sanity checks were
  responsible for this, but bgp_update_receive handles sending NOTIFY
  generically for bgp_nlri_parse.

* bgp_attr.c: (bgp_mp_reach_parse,bgp_mp_unreach_parse) Delete sanity check.
  NLRI parsing done after attr parsing by bgp_update_receive.

Arising out of discussions on the need for two-pass NLRI parse with:

Lou Berger <lberger@labn.net>
Donald Sharp <sharpd@cumulusnetworks.com>

7 years agobgpd: Fix non v4 EOR parsing
Donald Sharp [Fri, 21 Oct 2016 18:05:54 +0000 (14:05 -0400)]
bgpd: Fix non v4 EOR parsing

When we receive a non v4 EOR, we were parsing it but
incorrectly applying the test for the flag for it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
7 years agobgpd: Regularise bgp_update_receive, add missing notifies and checks
Paul Jakma [Thu, 4 Feb 2016 13:27:04 +0000 (13:27 +0000)]
bgpd: Regularise bgp_update_receive, add missing notifies and checks

* bgp_packet.c: (bgp_update_receive) Lots of repeated code, doing same
  thing for each AFI/SAFI.  Except when it doesn't, e.g.  the IPv4/VPN
  case was missing the EoR bgp_clear_stale_route call - the only action
  really needed for EoR.

  Make this function a lot more regular, using common, AFI/SAFI
  independent blocks so far as possible.

  Replace the 4 separate bgp_nlris with an array, indexed by an enum.

  The distinct blocks that handle calling bgp_nlri_parse for each
  different AFI/SAFI can now be replaced with a loop.

  Transmogrify the nlri SAFI from the SAFI_MPLS_LABELED_VPN code-point
  used on the wire, to the SAFI_MPLS_VPN safi_t enum we use internally
  as early as possible.

  The existing code was not necessarily sending a NOTIFY for NLRI
  parsing errors, if they arose via bgp_nlri_sanity_check.  Send the
  correct NOTIFY - INVAL_NETWORK for the classic NLRIs and OPT_ATTR_ERR
  for the MP ones.

  EoR can now be handled in one block.  The existing code seemed broken
  for EoR recognition in a number of ways:

  1.  A v4/unicast EoR should be an empty UPDATE.  However, it seemed
     to be treating an UPDATE with attributes, inc.  MP REACH/UNREACH,
     but no classic NLRIs, as a v4/uni EoR.

  2.  For other AFI/SAFIs, it was treating UPDATEs with no classic
     withraw and with a zero-length MP withdraw as EoRs.  However, that
     would mean an UPDATE packet _with_ update NLRIs and a 0-len MP
     withdraw could be classed as an EoR.

  This seems to be loose coding leading to ambiguous protocol
  situations and likely incorrect behaviour, rather than simply being
  liberal.  Be more strict about checking that an UPDATE really is an
  EoR and definitely is not trying to update any NLRIs.

  This same loose EoR parsing was noted by Chris Hall previously on
  list.

  (bgp_nlri_parse) Front end NLRI parse function, to fan-out to the correct
  parser for the AFI/SAFI.

* bgp_route.c: (bgp_nlri_sanity_check) We try convert NLRI safi to
  internal code-point ASAP, adjust switch for that.  Leave the wire
  code point in for defensive coding.

  (bgp_nlri_parse) rename to bgp_nlri_parse_ip.

* tests/bgp_mp_attr_test.c: Can just use bgp_nlri_parse frontend.

7 years agobgpd: Regularise BGP NLRI sanity checks a bit
Paul Jakma [Wed, 27 Jan 2016 16:37:33 +0000 (16:37 +0000)]
bgpd: Regularise BGP NLRI sanity checks a bit

* bgp_route.h: (bgp_nlri_sanity_check) The bulk of the args are equivalent
  to a (struct bgp_nlri), consolidate.
* bgp_route.c: (bgp_nlri_sanity_check) Make this a frontend for all afi/safis.
  Including SAFI_MPLS_LABELED_VPN.
  (bgp_nlri_sanity_check_ip) Regular IP NLRI sanity check based on the
  existing code, and adjusted for (struct bgp_nlri *) arg.
* bgp_attr.c: (bgp_mp_reach_parse) Adjust for passing (struct bgp_nlri *)
  to bgp_nlri_sanity_check.
  Get rid of special-casing to not sanity check VPN.
  (bgp_mp_unreach_parse) Ditto.

* bgp_mplsvpn.c: Use the same VPN parsing code for both the sanity
  check and the actual parse.

  (bgp_nlri_parse_vpn) renamed to bgp_nlri_parse_vpn_body and made
  internal.

  (bgp_nlri_parse_vpn_body) Added (bool) argument to control whether it
  is sanity checking or whether it should update routing state for each
  NLRI.  Send a NOTIFY and reset the session, if there's a parsing
  error, as bgp_nlri_sanity_check_ip does, and as is required by the
  RFC.

  (bgp_nlri_parse_vpn) now a wrapper to call _body with update.

  (bgp_nlri_sanity_check_vpn) wrapper to call parser without
  updating.

* bgp_mplsvpn.h: (bgp_nlri_sanity_check_vpn) export for
  bgp_nlri_sanity_check.

* bgp_packet.c: (bgp_update_receive) Adjust for bgp_nlri_sanity_check
  argument changes.

* test/bgp_mp_attr_test.c: Extend to also test the NLRI parsing functions,
  if the initial MP-attr parsing has succeeded.  Fix the NLRI in the
  VPN cases.  Add further VPN tests.

* tests/bgpd.tests/testbgpmpattr.exp: Add the new test cases.

This commit a joint effort of:

Lou Berger <lberger@labn.net>
Donald Sharp <sharpd@cumulusnetworks.com>
Paul Jakma <paul.jakma@hpe.com> / <paul@jakma.org>

7 years agobgpd: make bgp_nlri_parse_encap conform with other nlri_parse funcs
Paul Jakma [Fri, 5 Feb 2016 14:57:17 +0000 (14:57 +0000)]
bgpd: make bgp_nlri_parse_encap conform with other nlri_parse funcs

* bgp_encap.{c,h} (bgp_nlri_parse_encap) afi is already in the NLRI argument.
  update or withdraw is signalled by attr being non-NULL or NULL.

* bgp_packet.c: (update_receive) fixup to match, and also make the attr
  argument conform with NLRI_ATTR_ARG for correct error handling on
  optional, transitive, partial, attributes.

7 years agoospfd: Add 'no ...' form of some commands to cli
Donald Sharp [Wed, 26 Oct 2016 12:11:12 +0000 (08:11 -0400)]
ospfd: Add 'no ...' form of some commands to cli

Also add the ability to specify some or all of the no command.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
7 years agoMerge branch 'cmaster-next' into vtysh-grammar
Quentin Young [Tue, 25 Oct 2016 20:29:52 +0000 (20:29 +0000)]
Merge branch 'cmaster-next' into vtysh-grammar

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Conflicts:
ospfd/ospf_ri.c
zebra/zebra_vty.c

7 years agoMerge branch 'cmaster-next' into vtysh-grammar
Quentin Young [Tue, 25 Oct 2016 19:38:04 +0000 (19:38 +0000)]
Merge branch 'cmaster-next' into vtysh-grammar

Conflicts:
vtysh/vtysh.c
zebra/zebra_vty.c

7 years agoospfd: Only allow ospf RI commands if RI is turned on
Donald Sharp [Tue, 25 Oct 2016 19:18:50 +0000 (15:18 -0400)]
ospfd: Only allow ospf RI commands if RI is turned on

When ospf RI commands are entered and we have not turned
on the feature, gracefully tell the user that there is
no going forward.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
7 years agoospfd: Dissallow mpls-te commands unless mpls-te has been turned on
Donald Sharp [Tue, 25 Oct 2016 19:02:41 +0000 (15:02 -0400)]
ospfd: Dissallow mpls-te commands unless mpls-te has been turned on

If ospf mpls-te has not been turned on via a 'mpls-te on'
dissallow other mpls-te commands from being silently accepted
and ignored.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
7 years agozebra: Allow v6 static routes to handle mpls not in kernel
Donald Sharp [Tue, 25 Oct 2016 18:43:07 +0000 (14:43 -0400)]
zebra: Allow v6 static routes to handle mpls not in kernel

When configuring v6 static routes, allow it to gracefully
ignore mpls commands when mpls is not turned on in the kernel.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
7 years agozebra: Disable mpls slightly different
Donald Sharp [Tue, 25 Oct 2016 18:25:29 +0000 (14:25 -0400)]
zebra: Disable mpls slightly different

When mpls is not turned on in the kernel, we
are not installing the mpls commands into the cli.
This results in vtysh attempting to run the command
and receiving a 'WTF is this command' back from zebra.
Modify the mpls code to install commands and to check
to see if the command should be accepted based
upon mpls working or not.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
7 years agozebra: If fpm is not turned on hide the cli for it
Donald Sharp [Tue, 25 Oct 2016 17:05:58 +0000 (13:05 -0400)]
zebra: If fpm is not turned on hide the cli for it

If the FPM is not enabled properly, hide the cli
for it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
7 years agobgpd: dynamically grow 'show ip bgp summ' Neighbor column width
Daniel Walton [Tue, 25 Oct 2016 14:16:31 +0000 (14:16 +0000)]
bgpd: dynamically grow 'show ip bgp summ' Neighbor column width

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Now that we display hostnames in 'show ip bgp summary' it is really easy
to have the first column be greater than 16 characters which causes a
line wrap. The line wrap makes the output difficult to read.

Before
======
superm-redxp-05# show ip bgp summ
BGP router identifier 6.0.0.11, local AS number 65001 vrf-id 0
BGP table version 56
RIB entries 19, using 2280 bytes of memory
Peers 2, using 41 KiB of memory
Peer groups 1, using 64 bytes of memory

Neighbor        V         AS MsgRcvd MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd
leaf-11-really-long-name(swp1)
                4      65101     307     322        0    0    0 00:14:15 10
leaf-12(swp2)   4      65101     105     121        0    0    0 00:14:14 Idle (Admin)

Total number of neighbors 2
superm-redxp-05#

After
=====
superm-redxp-05# show ip bgp summ
BGP router identifier 6.0.0.11, local AS number 65001 vrf-id 0
BGP table version 10
RIB entries 19, using 2280 bytes of memory
Peers 2, using 41 KiB of memory
Peer groups 1, using 64 bytes of memory

Neighbor                       V         AS MsgRcvd MsgSent   TblVer InQ OutQ  Up/Down State/PfxRcd
leaf-11-really-long-name(swp1) 4      65101      11      12        0   0    0 00:00:08           10
swp2                           4          0       0       0        0   0    0    never Idle (Admin)

Total number of neighbors 2
superm-redxp-05#
superm-redxp-05#

7 years agobgpd: fix 'show ip bgp summary' column alignment
Daniel Walton [Tue, 25 Oct 2016 13:17:59 +0000 (13:17 +0000)]
bgpd: fix 'show ip bgp summary' column alignment

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>