]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
7 years agolib: temporary-catch a SEGV in command completion
David Lamparter [Mon, 28 Nov 2016 17:41:34 +0000 (18:41 +0100)]
lib: temporary-catch a SEGV in command completion

Getting FULL_MATCH with matched[0] == NULL in tests/testcli.  Catch and
print error for now.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agotests: update testcli reference output
David Lamparter [Mon, 28 Nov 2016 17:40:25 +0000 (18:40 +0100)]
tests: update testcli reference output

These are expected changes in CLI behaviour.  There's still a diff of
unexpected changes that need fixing (or are missing features, e.g.
keyword arguments).

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agotests: fixup for vtysh-grammar merge
David Lamparter [Mon, 28 Nov 2016 17:32:45 +0000 (18:32 +0100)]
tests: fixup for vtysh-grammar merge

Tests weren't updated for vtysh-grammar yet...
NB: things still fail since some CLI behaviour changed.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agoxml2cli/ldpd: sync with the latest changes in CLI code
Renato Westphal [Fri, 25 Nov 2016 13:13:15 +0000 (11:13 -0200)]
xml2cli/ldpd: sync with the latest changes in CLI code

* use argv[N]->arg instead of argv[N];
* don't skip over non-variable args anymore;
* convert <>s to ()s and ()s to <>s;

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agoMerge commit '34d5ef459140ee7e'
David Lamparter [Mon, 28 Nov 2016 17:10:21 +0000 (18:10 +0100)]
Merge commit '34d5ef459140ee7e'

(some build fixups for vtysh-grammar)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agoMerge branch 'vtysh-grammar'
David Lamparter [Mon, 28 Nov 2016 16:56:29 +0000 (17:56 +0100)]
Merge branch 'vtysh-grammar'

Conflicts:
isisd/isisd.c
lib/Makefile.am
lib/thread.c

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agolib: merge-prep lib/command.c (partial revert)
David Lamparter [Mon, 28 Nov 2016 16:51:45 +0000 (17:51 +0100)]
lib: merge-prep lib/command.c (partial revert)

This reverts commit 45ef43000030a5801efc6c158786595c31355335,
for lib/command.c (to make a merge conflict go away).

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agolib: pre-remove str.[ch] for merge, move strmatch()
David Lamparter [Mon, 28 Nov 2016 16:46:55 +0000 (17:46 +0100)]
lib: pre-remove str.[ch] for merge, move strmatch()

lib/str.[ch] was removed in cleaning up autoconf deadweight.
best place for strmatch seems to be a #define in zebra.h

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agoMerge branch 'cmaster-next-isisd-bpf' into cmaster-next-releng
David Lamparter [Mon, 28 Nov 2016 16:36:04 +0000 (17:36 +0100)]
Merge branch 'cmaster-next-isisd-bpf' into cmaster-next-releng

7 years agoMerge remote-tracking branch 'cmaster-next' into cmaster-next-releng
David Lamparter [Mon, 28 Nov 2016 16:35:08 +0000 (17:35 +0100)]
Merge remote-tracking branch 'cmaster-next' into cmaster-next-releng

7 years agozebra: add missing license headers to two files
Renato Westphal [Mon, 21 Nov 2016 21:24:09 +0000 (19:24 -0200)]
zebra: add missing license headers to two files

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
7 years agoripngd: fix drop of multicast membership when the interface is down
Renato Westphal [Fri, 18 Nov 2016 17:39:25 +0000 (15:39 -0200)]
ripngd: fix drop of multicast membership when the interface is down

When an interface is shut down, ripng_multicast_leave() is called after
ifp->flags is updated in ripng_interface_down(). So we shouldn't check
if the interface is up in order to proceed with the membership drop.

For consistency's sake, don't check for if_is_up() in
ripng_multicast_join() as well. In this case, this function is only
called when the interface is up, so the check was unnecessary.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
7 years agoripngd: implement the "clear ipv6 ripng" vty command
Renato Westphal [Thu, 17 Nov 2016 18:33:09 +0000 (16:33 -0200)]
ripngd: implement the "clear ipv6 ripng" vty command

This command deletes all received routes from the RIPng routing table. It
should be used with caution as it can create black holes in the network
(until it reconverges). Very useful to make automated testing (e.g. ANVL)
more predictable.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
7 years agoripngd: implement optional heuristic suggested by RFC 2080
Renato Westphal [Wed, 16 Nov 2016 18:14:45 +0000 (16:14 -0200)]
ripngd: implement optional heuristic suggested by RFC 2080

RFC 2080 - Section 2.4.2:
"If the new metric is the same as the old one, examine the timeout for the
existing route.  If it is at least halfway to the expiration point, switch
to the new route.  This heuristic is optional, but highly recommended".

Implement this optional heuristic only when ECMP is disabled globally ("no
allow-ecmp"), otherwise all routes with the same metric should be used.

Fixes IxANVL RIPng test 7.21.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
7 years agoripd: minor code simplification
Renato Westphal [Sat, 12 Nov 2016 21:34:37 +0000 (19:34 -0200)]
ripd: minor code simplification

* Simplify the RIP_TIMER_OFF macro and use it on more places;
* Be more explicit when creating the RIP UDP socket - cosmetic change
  since socket(AF_INET,SOCK_DGRAM,0) defaults to UDP on every known
  UNIX/Linux platform.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
7 years agoripd: make use of the IP_MULTICAST_LOOP sockoption
Renato Westphal [Sat, 12 Nov 2016 21:11:13 +0000 (19:11 -0200)]
ripd: make use of the IP_MULTICAST_LOOP sockoption

We still need to check for self-generated packets on rip_read() because
ripd may also send broadcast packets. But using IP_MULTICAST_LOOP on the
ripd socket will at least prevent us from receiving a lot unnecessary
multicast packets when RIPv2 is being used, thus improving performance.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
7 years ago*: create a helper function to set the IP_MULTICAST_LOOP sockoption
Renato Westphal [Sat, 12 Nov 2016 21:05:08 +0000 (19:05 -0200)]
*: create a helper function to set the IP_MULTICAST_LOOP sockoption

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
7 years agopimd/zebra: fix setting of IP_MULTICAST_LOOP on OpenBSD
Renato Westphal [Sat, 12 Nov 2016 20:39:51 +0000 (18:39 -0200)]
pimd/zebra: fix setting of IP_MULTICAST_LOOP on OpenBSD

Linux, FreeBSD and NetBSD (and possibly others too) accept both uint8_t
and int for the IP_MULTICAST_LOOP sockoption. OpenBSD, in the other hand,
accepts only uint8_t. To make setting IP_MULTICAST_LOOP work on every
supported platform, always pass a uint8_t variable as a parameter.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
7 years agoripd: fix race condition on input processing
Renato Westphal [Fri, 11 Nov 2016 22:19:13 +0000 (20:19 -0200)]
ripd: fix race condition on input processing

In the early days of ripd, we supported running RIP on secondary IP
addresses. To do that, everytime we needed to send a multicast packet,
we would create a new temporary socket for each of the interface's
addresses and call bind() to change the source IP of the outgoing packets.

The problem with these temporary sockets is that they are more specific
than the global RIP socket (bound to INADDR_ANY). Then, even though these
sockets only exist for a short amount of time, they can receive some RIP
packets that were supposed to be received on the global RIP socket. And
since we never read from the temporary sockets, these packets are dropped.

Since we don't support secondary addresses anymore, the simplest way to
fix this problem is to stop using temporary sockets for sending multicast
packets. We are already setting IP_MULTICAST_IF before sending each
multicast packet, and in this case the primary address of the selected
interface is used as the source IP of the outgoing packets, which is
exactly what we want.

If we decide to reintroduce support for secondary addresses in the future,
we should try one of the following:
* Use IP_SENDSRCADDR/IP_PKTINFO to set the source address of the outgoing
  multicast packets;
* Create one permanent UDP socket for each possible interface address,
  and enable reading on all sockets.

Fixes the following IxANVL RIP tests: 7.10 and 14.1.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
7 years agoripd: fix the "neighbor" command.
Renato Westphal [Thu, 10 Nov 2016 17:35:47 +0000 (15:35 -0200)]
ripd: fix the "neighbor" command.

We can't use if_lookup_prefix() in rip_update_process() because this
function uses prefix_cmp() internally to try matching an interface
address to a static neighbor's address.

Since prefix_cmp() tries to match exact prefixes, if_lookup_prefix()
was always returning NULL.

What we really need here is to use prefix_match(), which checks if
one prefix includes the other (e.g. one /24 interface including a /32
static neighbor's address). The fix then is to replace the call to
if_lookup_prefix() and use if_lookup_address() instead, which uses
prefix_match() internally.

Fixes IxANVL RIP test 17.1

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
7 years agoripd: add "none" option to the "ip rip receive version" command
Renato Westphal [Thu, 10 Nov 2016 15:15:43 +0000 (13:15 -0200)]
ripd: add "none" option to the "ip rip receive version" command

RFC 2453 says (section 5.1):
"(...) For completeness, routers should also implement a receive control
switch which would determine whether to accept, RIP-1 only, RIP-2 only,
both, or none.  It should also be configurable on a per-interface basis".

For the "ip rip send version" command, we don't need to implement the
"none" option because there's already the "passive-interface" command
for that.

Fixes IxANVL RIP test 16.8.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
7 years agoripd: implement the "ip rip v2-broadcast" CLI command
Renato Westphal [Thu, 10 Nov 2016 14:55:09 +0000 (12:55 -0200)]
ripd: implement the "ip rip v2-broadcast" CLI command

This command allows ripd to send v2 updates as broadcast packets instead
of multicast packets. Useful as a technique to help with RIPv1/v2
interop issues.

Fixes IxANVL RIP test 16.2

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
7 years agoripd: ignore request for RTEs from unknown address-families
Renato Westphal [Thu, 10 Nov 2016 14:54:07 +0000 (12:54 -0200)]
ripd: ignore request for RTEs from unknown address-families

Fixes IxANVL RIP test 6.5.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
7 years agoripd: reject authentication strings with zeros in the middle
Renato Westphal [Thu, 10 Nov 2016 14:53:21 +0000 (12:53 -0200)]
ripd: reject authentication strings with zeros in the middle

RFC 2453 says:
"If the password is under 16 octets, it must be left-justified and padded
to the right with nulls (0x00)".

Fixes IxANVL RIP test 10.3.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
7 years agoisisd: fix loss of packets after circuit is brought up
Renato Westphal [Thu, 24 Nov 2016 23:28:03 +0000 (21:28 -0200)]
isisd: fix loss of packets after circuit is brought up

The last parameter of THREAD_TIMER_ON() is the timeout, and we were
using circuit->fd for that. So, when a circuit was brought up, isisd
would miss all received packets on this circuit for quite a few seconds,
slowing down the convergence process.

To fix this, use the same logic we use in isis_receive() to calculate
this timeout.

This bug doesn't happen on Linux, which uses a different method to read
packets from the network.

Fixes the following ANVL tests on FreeBSD: ISIS-17.1, ISIS-18.6 (and
probably others too).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
7 years agolib: Fix nexthop strings to coincide with enum
vivek [Wed, 23 Nov 2016 20:14:07 +0000 (12:14 -0800)]
lib: Fix nexthop strings to coincide with enum

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
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 agoMerge remote-tracking branch 'cmaster-next' into cmaster-next-releng
David Lamparter [Sat, 19 Nov 2016 10:58:52 +0000 (11:58 +0100)]
Merge remote-tracking branch 'cmaster-next' into cmaster-next-releng

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 agoisisd: use BPF on Linux/PF_PACKET
David Lamparter [Mon, 14 Nov 2016 23:26:56 +0000 (08:26 +0900)]
isisd: use BPF on Linux/PF_PACKET

we *really* don't want to receive every single packet (of any protocol
type) coming in on an IS-IS enabled interface.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agolib: replace strlcpy & strlcat with glibc versions
David Lamparter [Tue, 15 Nov 2016 08:15:49 +0000 (17:15 +0900)]
lib: replace strlcpy & strlcat with glibc versions

It seems these two were at some point copied in from rsync; replace with
more recent versions that will hopefully become available in glibc as
well.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agobuild: remove LGPL v2.0, add LGPL v2.1
David Lamparter [Tue, 15 Nov 2016 08:19:10 +0000 (17:19 +0900)]
build: remove LGPL v2.0, add LGPL v2.1

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agobuild: use ac_configure_args for CONFIG_ARGS
David Lamparter [Tue, 15 Nov 2016 05:05:28 +0000 (14:05 +0900)]
build: use ac_configure_args for CONFIG_ARGS

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agobuild: massively remove needless checks
David Lamparter [Tue, 15 Nov 2016 04:37:14 +0000 (13:37 +0900)]
build: massively remove needless checks

Since we have autoconf results from a wide swath of target platforms, we
can go remove checks that have the same result on all systems.

This also removes several "fallback" implementations of functions that,
at some point in the history, weren't available on all target platforms.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agobuild: chop down complicated CFLAGS logic
David Lamparter [Tue, 15 Nov 2016 02:18:43 +0000 (11:18 +0900)]
build: chop down complicated CFLAGS logic

Other packages don't have --with-cflags; we don't need it either.  The
user can specify CFLAGS= in the environment or on ./configure and that
would work perfectly fine.  If only it weren't for autoconf being an
idiot and adding its own "-g -O2" ... so we work around that.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agobgpd/rfapi: Fix missing files in distribution ("make dist") package
Martin Winter [Mon, 14 Nov 2016 08:21:47 +0000 (00:21 -0800)]
bgpd/rfapi: Fix missing files in distribution ("make dist") package

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agobuild: don't use deprecation warning on ICC
David Lamparter [Tue, 15 Nov 2016 05:03:11 +0000 (14:03 +0900)]
build: don't use deprecation warning on ICC

icc doesn't do the pragma warning push/pop thing to selectively disable
the warning.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agozebra: fix sign warning in SNMP code
David Lamparter [Tue, 15 Nov 2016 04:49:34 +0000 (13:49 +0900)]
zebra: fix sign warning in SNMP code

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agobuild: fix -Wmaybe-uninitialized warnings
David Lamparter [Tue, 15 Nov 2016 02:17:50 +0000 (11:17 +0900)]
build: fix -Wmaybe-uninitialized warnings

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years agobuild: unconditionally try -rdynamic
David Lamparter [Tue, 15 Nov 2016 01:52:09 +0000 (10:52 +0900)]
build: unconditionally try -rdynamic

-rdynamic is needed for useful backtraces and future plugin loading
support.  Try and enable it unconditionally.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
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 agobuild: fix some minor autoconf & automake breakage
David Lamparter [Thu, 10 Nov 2016 12:14:48 +0000 (13:14 +0100)]
build: fix some minor autoconf & automake breakage

- use AS_HELP_STRING in configure.ac
- don't define HAVE_SETNS twice
- remove unused AM_LDFLAGS
- AC_PROG_RANLIB is automatically called by LT_INIT

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
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 agoisisd: remove topology generator
David Lamparter [Mon, 14 Nov 2016 02:14:00 +0000 (11:14 +0900)]
isisd: remove topology generator

Licensing is unclear and the tool is a testbed-only half-broken pile of
goo.  Remove.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
7 years ago*: fix some licensing SNAFUs
David Lamparter [Mon, 14 Nov 2016 02:07:41 +0000 (11:07 +0900)]
*: fix some licensing SNAFUs

bgpd/bgpd.c had a typo
zebra/zebra_mpls_netlink.c was derived from rt_netlink.c
isisd/include-netbsd/* are not needed (2 constants moved over)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
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>