]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
8 years agolib: Add helper function for working with argv, update bgpd to use it
Quentin Young [Thu, 20 Oct 2016 20:31:24 +0000 (20:31 +0000)]
lib: Add helper function for working with argv, update bgpd to use it

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agolib: Allow '_' in arguments to VARIABLE_TKN
Quentin Young [Thu, 20 Oct 2016 19:24:36 +0000 (19:24 +0000)]
lib: Allow '_' in arguments to VARIABLE_TKN

second attempt

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agoRevert "lib: Allow '_' in arguments to VARIABLE_TKN"
Quentin Young [Thu, 20 Oct 2016 19:21:37 +0000 (19:21 +0000)]
Revert "lib: Allow '_' in arguments to VARIABLE_TKN"

This reverts commit e0a467872b307021477ea7b4ba27ffc5d20aedd0.

8 years agolib: Allow '_' in arguments to VARIABLE_TKN
Quentin Young [Thu, 20 Oct 2016 19:17:36 +0000 (19:17 +0000)]
lib: Allow '_' in arguments to VARIABLE_TKN

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agoMerge branch 'cmaster-next' into vtysh-grammar
Quentin Young [Thu, 20 Oct 2016 16:31:49 +0000 (16:31 +0000)]
Merge branch 'cmaster-next' into vtysh-grammar

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

8 years agolib: Fix redist memory free'ing
Donald Sharp [Wed, 19 Oct 2016 15:44:39 +0000 (11:44 -0400)]
lib: Fix redist memory free'ing

When shutting down, properly free memory associated
with zclient.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agolib: Add cleanup for routemaps
Donald Sharp [Wed, 19 Oct 2016 15:09:57 +0000 (11:09 -0400)]
lib: Add cleanup for routemaps

Some new routemap hash data structures were not being
properly cleaned up.  Add the hash_free code in.

This code does not fix the variety of daemons that
don't actually call route_map_finish.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years ago*: Consolidate routemap initialization
Donald Sharp [Wed, 19 Oct 2016 14:55:01 +0000 (10:55 -0400)]
*: Consolidate routemap initialization

Consolidate the routemap initialization into one
function.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
8 years agovtysh: refactor vtysh_client_{config,execute}
David Lamparter [Wed, 12 Oct 2016 15:05:51 +0000 (17:05 +0200)]
vtysh: refactor vtysh_client_{config,execute}

Triggered by a bugreport / patch by Gautam Kumar <gauta@amazon.com>,
this is a full rewrite vtysh_client_{config,execute}.  (The patch didn't
quite apply anymore.)

vtysh_client_run() now has a buffering implementation that can be read
without losing one's sanity and/or requiring alcoholic beverages.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agobgpd, lib: memory cleanups for valgrind, plus debug changes
Lou Berger [Wed, 10 Apr 2013 19:30:04 +0000 (12:30 -0700)]
bgpd, lib: memory cleanups for valgrind, plus debug changes

Description:
    We use valgrind memcheck quite a bit to spot leaks in
    our work with bgpd. In order to eliminate false positives,
    we added code in the exit path to release the remaining
    allocated memory.

    Bgpd startup log message now includes pid.

Some little tweaks by Paul Jakma <paul.jakma@hpe.com>:

* bgp_mplsvpn.c: (str2prefix_rd) do the cleanup in common code at the end
  and goto it.

[DL: dropped several chunks from original commit which are obsolete by
now on this tree.]

8 years agolib/zebra: remove code duplication in redist_del_instance()
Renato Westphal [Thu, 13 Oct 2016 16:06:10 +0000 (13:06 -0300)]
lib/zebra: remove code duplication in redist_del_instance()

Change redist_check_instance() to return a pointer instead of returning 1
on success. This way this function can be reused in redist_del_instance()
instead of duplicating the same logic there.

Also, remove unnecessary call to redist_check_instance() in
zebra_redistribute_delete().

While here, remove unnecessary cast from void* in redist_add_instance().

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agozebra: fix processing of redistribute messages
Renato Westphal [Thu, 6 Oct 2016 13:38:55 +0000 (10:38 -0300)]
zebra: fix processing of redistribute messages

We should not check/modify client->redist[] when the requested instance
is different than zero.

In the same way, we should not check/modify client->mi_redist[] when
the requested instance is zero.

Failure to respect these conditions can lead to unexpected behavior in
the client daemons.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agoldpd: remove dead code from zsend_redistribute_route()
Renato Westphal [Thu, 6 Oct 2016 13:16:58 +0000 (10:16 -0300)]
ldpd: remove dead code from zsend_redistribute_route()

As a general rule of thumb, we should write functions that do one thing
and that do it well. All callers of zsend_redistribute_route() are already
checking if the route should be redistributed or not (as the comment
says), so we definitely shouldn't bother with that in this function.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agozebra: cleanup redistribution code
Renato Westphal [Thu, 6 Oct 2016 12:18:41 +0000 (09:18 -0300)]
zebra: cleanup redistribution code

Remove code duplication and reduce excessive indentation levels whenever
possible.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agozebra: fix redistribution of default routes
Renato Westphal [Thu, 6 Oct 2016 12:45:27 +0000 (09:45 -0300)]
zebra: fix redistribution of default routes

We were always redistributing the default routes (IPv[46]) in
redistribute_update() because the 'client->redist_default' condition
always returns true.

The 'redist_default' member of the 'zserv' structure is a pointer and is
always initialized with vrf_bitmap_init() in the zebra_client_create()
function.

To fix this, use vrf_bitmap_check() instead.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agozebra/ldpd: introduce ZEBRA_ROUTE_ALL wildcard route type
Renato Westphal [Wed, 5 Oct 2016 20:58:01 +0000 (17:58 -0300)]
zebra/ldpd: introduce ZEBRA_ROUTE_ALL wildcard route type

The ZEBRA_ROUTE_ALL route type can be used by a client to request
all routes from zebra. The main motivation for introducing this is
to allow ldpd to get routes from all OSPF instances, not only from
the default one. Without ZEBRA_ROUTE_ALL, ldpd would need to send a
ZEBRA_REDISTRIBUTE_ADD message for each possible OSPF instance (65k),
which doesn't scale very well.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agobgpd: bgp_nexthop_cache not deleted with peers
Paul Jakma [Tue, 6 Sep 2016 16:23:48 +0000 (17:23 +0100)]
bgpd: bgp_nexthop_cache not deleted with peers

* Fix mild leak, bgp_nexthop_caches were not deleted when their peer was.
  Not a huge one, but makes valgrinding for other leaks noisier.

  Credit to Lou Berger <lberger@labn.net> for doing the hard work of
  debugging and pinning down the leak, and supplying an initial fix.
  That one didn't quite get the refcounting right, it seemed, hence
  this version.

  This version also keeps bncs pinned so long as the peer is defined, where
  Lou's tried to delete whenever the peer went through bgp_stop. That causes
  lots of zebra traffic if down peers go Active->Connect->Active, etc., so
  leaving bnc's in place until peer_delete seemed better.

* bgp_nht.c: (bgp_unlink_nexthop_by_peer) similar to bgp_unlink_nexthop, but
  by peer.
* bgp_nht.c: (bgp_unlink_nexthop_check) helper to consolidate checking
  if a bnc should be deleted.
  (bgp_unlink_nexthop_by_peer) ensure the bnc->nht_info peer reference
  is removed, and hence allow bncs to be removed by previous.
* bgpd.c: (peer_delete) cleanup the peer's bnc.

8 years agobgpd: Fix crash in 'show ip bgp nexthop'
Paul Jakma [Tue, 6 Sep 2016 10:20:27 +0000 (11:20 +0100)]
bgpd: Fix crash in 'show ip bgp nexthop'

* bgp_nexthop.c: (show_ip_bgp_nexthop_table) the AFIs are sparse, and start
  from 1, check there's a table before derefing so as not to crash.

8 years agolib: add event_counter
Christian Franke [Tue, 3 May 2016 17:59:42 +0000 (19:59 +0200)]
lib: add event_counter

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
8 years agolib: add api method to read current config path
Christian Franke [Tue, 3 May 2016 17:59:41 +0000 (19:59 +0200)]
lib: add api method to read current config path

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
8 years agobgpd: fix MRT table dumps for locally-originated routes
Colin Petrie [Wed, 11 May 2016 09:56:58 +0000 (11:56 +0200)]
bgpd: fix MRT table dumps for locally-originated routes

I've been working on a small patch to correct an issue in the BGP MRT
table dump code. It's a quick'n'easy fix initially, and I'd appreciate
any feedback on making it better :)

Issue:

When the BGP table dump code runs, it generates the peer_index_table.
This walks the list of peers, and dumps out their IP, ASN, address
family, etc. It also sets the peer index number in the peer struct.

Then the code walks the RIB, and for each prefix, writes out RIB
entries, that refer to the peer index number.

However, when it finds prefixes that are locally originated, the
associated peer is the 'self' peer, which wasn't in the list of peers,
never gets an index number assigned, but because it is calloc'd, the
index number is set to 0.

End result: locally-originated routes are associated with whichever peer
happens to be first in the list of remote peers in the index table :)

Example (from one of our route collectors) - these are two of our
originated prefixes (bgpdump output):
TABLE_DUMP2|1457568002|B|12.0.1.63|7018|84.205.80.0/24||IGP|193.0.4.28|0|0||NAG|64512
10.255.255.255|
TABLE_DUMP2|1457568006|B|12.0.1.63|7018|2001:7fb:ff00::/48||IGP|::|0|0||NAG||

The prefixes are announced by us (note it has an empty AS PATH (the
field after the prefix)) but also looks like it was received from AS7018
(12.0.1.63). In fact, the AS7018 peer just happens to be the first peer
in the index table.

Fix:

The simplest fix (which is also the method adopted by both OpenBGPd and
the BIRD mrtdump branch) is to create an empty placeholder 'peer' at the
start of the peer index table, for all the routes which are locally
originated to refer to.

I've attached a patch for this.
Here's a resulting bgpdump output after the patch:
TABLE_DUMP2|1458828539|B|0.0.0.0|0|93.175.150.0/24||IGP|0.0.0.0|0|0||NAG||
Now it is more obvious that the prefix is locally originated.

There are more complicated potential ways of fixing it
1) skip the local routes when dumping the RIB. This leads to questions
about what an MRT table dump *should* contain :)
2) include the 'self' peer in the list of peers used to generate the
index table.
etc etc.

But I'm quite happy with my 'create a fake peer, and associate local
routes with it' method :)

Your thoughts and feedback are welcome!

Regards,

Colin Petrie
Systems Engineer
RIPE NCC RIS Project
Tested-by: NetDEF CI System <cisystem@netdef.org>
8 years agozebra: use unsigned args for *addattr
David Lamparter [Tue, 11 Oct 2016 16:17:28 +0000 (18:17 +0200)]
zebra: use unsigned args for *addattr

[based on a patch by Paul Jakma changing it to size_t]

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agotests: fix MIN()-related sign warnings
David Lamparter [Tue, 11 Oct 2016 15:44:39 +0000 (17:44 +0200)]
tests: fix MIN()-related sign warnings

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agozebra: Fix route deletion on *BSD
Timo Teräs [Fri, 19 Feb 2016 02:19:54 +0000 (18:19 -0800)]
zebra: Fix route deletion on *BSD

Fix for not handling RTM_CHANGE correctly.  This patch change it to
delete/add instead.  Using RTM_CHANGE on kernels where it works is better,
but is left as an exercise for developer who has access and will to fix it
on *BSD.

[ed note: collaboration with Martin Winter]

8 years agozebra: kernel interface simplification
Timo Teräs [Fri, 15 Jan 2016 15:36:29 +0000 (17:36 +0200)]
zebra: kernel interface simplification

[DL: picked out from: "atomic FIB updates"]

This simplifies the OS-specific route update API into a single entry
point, kernel_route_rib(), which dispatches the various operations
internally.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
8 years agozebra: remove rt_ioctl kernel interface
David Lamparter [Sat, 28 Jun 2014 19:49:18 +0000 (21:49 +0200)]
zebra: remove rt_ioctl kernel interface

None of the BSDs uses ioctls to set routes anymore.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Acked-by: Greg Troxel <gdt@ir.bbn.com>
Acked-by: Feng Lu <lu.feng@6wind.com>
Acked-by: Paul Jakma <paul@jakma.org>
8 years agobgpd: Fix crash reported by NetDEF CI
Lou Berger [Fri, 5 Feb 2016 02:29:49 +0000 (21:29 -0500)]
bgpd: Fix crash reported by NetDEF CI

This patch is part of the previously submitted patch set on VPN and
Encap SAFIs.  It fixes an issue identified by NetDEF CI.

Ensure temp stack structures are initialized Add protection against
double frees / post free access to bgp_attr_flush

Signed-off-by: Lou Berger <lberger@labn.net>
8 years agobgp: add bgp_isvalid_nexthop helper and additional NHT zebra checks
Lou Berger [Tue, 11 Oct 2016 15:30:55 +0000 (11:30 -0400)]
bgp: add bgp_isvalid_nexthop helper and additional NHT zebra checks

8 years agobgp: ignore NHT when bgpd has never connected to zebra
Lou Berger [Fri, 7 Oct 2016 13:44:42 +0000 (09:44 -0400)]
bgp: ignore NHT when bgpd has never connected to zebra

8 years agorfapi: cleanup some warnings
Lou Berger [Thu, 6 Oct 2016 00:44:57 +0000 (20:44 -0400)]
rfapi: cleanup some warnings

8 years agoMerge branch 'cmaster-next' into vtysh-grammar
Quentin Young [Mon, 17 Oct 2016 23:36:21 +0000 (23:36 +0000)]
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

8 years agozebra: Fix dist so that zebra includes right .h
Donald Sharp [Sun, 16 Oct 2016 03:44:17 +0000 (23:44 -0400)]
zebra: Fix dist so that zebra includes right .h

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agozebra: Fix compile failure in CI
Donald Sharp [Mon, 17 Oct 2016 22:00:19 +0000 (18:00 -0400)]
zebra: Fix compile failure in CI

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agozebra: Refactor netlink interactions
vivek [Mon, 17 Oct 2016 19:39:55 +0000 (12:39 -0700)]
zebra: Refactor netlink interactions

Separate core netlink functions and library functions from route-related
interactions and interface-related interactions.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Ticket: CM-13199
Reviewed By: CCR-5254
Testing Done: bgp-min, ospf-min

8 years agozebra: Derive VRF Id for slave interfaces correctly
vivek [Fri, 14 Oct 2016 23:02:37 +0000 (16:02 -0700)]
zebra: Derive VRF Id for slave interfaces correctly

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Ticket: CM-13195
Reviewed By: CCR-5250
Testing Done: Manual

<DETAILED DESCRIPTION (REPLACE)>

8 years agozebra: Ensure correct use of VRF ID versus NS ID
vivek [Fri, 14 Oct 2016 22:31:58 +0000 (15:31 -0700)]
zebra: Ensure correct use of VRF ID versus NS ID

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-13194
Reviewed By: CCR-5248
Testing Done: None (trivial)

<DETAILED DESCRIPTION (REPLACE)>

8 years agozebra: Clear off pointer array into which netlink attributes are parsed
vivek [Fri, 14 Oct 2016 01:21:49 +0000 (18:21 -0700)]
zebra: Clear off pointer array into which netlink attributes are parsed

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Ticket: CM-13018
Reviewed By: CCR-5237
Testing Done: None

8 years agovtysh: fix build failure in vtysh_writeconfig_integrated()
Daniel Walton [Thu, 13 Oct 2016 13:48:02 +0000 (13:48 +0000)]
vtysh: fix build failure in vtysh_writeconfig_integrated()

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agozebra: Fix signed / unsigned build error
Daniel Walton [Thu, 13 Oct 2016 13:43:12 +0000 (13:43 +0000)]
zebra: Fix signed / unsigned build error

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoospf6d: fix a few vty help strings
Renato Westphal [Thu, 13 Oct 2016 00:20:16 +0000 (21:20 -0300)]
ospf6d: fix a few vty help strings

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years ago*: rename all instances of OSPFv6 to OSPF6 or OSPFv3
Renato Westphal [Thu, 13 Oct 2016 00:20:15 +0000 (21:20 -0300)]
*: rename all instances of OSPFv6 to OSPF6 or OSPFv3

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agolib/vtysh: fix duplicate installation of some vty commands
Renato Westphal [Wed, 12 Oct 2016 15:39:02 +0000 (12:39 -0300)]
lib/vtysh: fix duplicate installation of some vty commands

This is a followup to commits 735e62 and 0b1442, where we forgot to apply
the same VIEW/ENABLE consolidation logic to vtysh. Also, we can't call
install_default() for the ENABLE node because some of the vty commands
installed by this function were already installed in the VIEW node before.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agovtysh: infer integrated config usage from existence of Quagga.conf
Christian Franke [Mon, 26 Sep 2016 20:01:37 +0000 (22:01 +0200)]
vtysh: infer integrated config usage from existence of Quagga.conf

Only write to integrated config if integrated config is configured
explicitly or it is already in use.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
8 years agovtysh: Add missing stomps
Quentin Young [Wed, 12 Oct 2016 04:21:18 +0000 (04:21 +0000)]
vtysh: Add missing stomps

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agovtysh: Update extract.pl.in
Quentin Young [Wed, 12 Oct 2016 01:44:50 +0000 (01:44 +0000)]
vtysh: Update extract.pl.in

CLI stomps updated. Need to be eliminated.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agobgp: Fix bi->extra->tag if statement
Donald Sharp [Tue, 11 Oct 2016 12:47:32 +0000 (08:47 -0400)]
bgp: Fix bi->extra->tag if statement

bi->extra->tag is a 3 byte array, the statement
as written will always be true.  Modify code
to see if we actually have any data in the
tag and then print the label.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Lou Berger <lberger@labn.net>
8 years agobgpd: Fix peer->weight usage
Donald Sharp [Tue, 11 Oct 2016 12:24:03 +0000 (08:24 -0400)]
bgpd: Fix peer->weight usage

When setting the weight make sure to use the
correct afi safi to get what we need.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Lou Berger <lberger@labn.net>
8 years agozebra: Fix signed / unsigned comparisons
Donald Sharp [Tue, 11 Oct 2016 12:21:41 +0000 (08:21 -0400)]
zebra: Fix signed / unsigned comparisons

clang is complaining about signed/unsigned comparisons
for rta_addattr_l.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agorfapi: cleanup some warnings
Lou Berger [Thu, 6 Oct 2016 00:44:57 +0000 (20:44 -0400)]
rfapi: cleanup some warnings

8 years agobgpd/rfp: fix remaining index_sub uses
David Lamparter [Tue, 11 Oct 2016 11:37:26 +0000 (13:37 +0200)]
bgpd/rfp: fix remaining index_sub uses

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agobuild: remove accidentally-added configure outputs
David Lamparter [Tue, 11 Oct 2016 11:08:10 +0000 (13:08 +0200)]
build: remove accidentally-added configure outputs

these files do not belong in the git tree.  (They're temporaries during
a ./configure run and normally removed at the end;  let's add them to
.gitignore anyway.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agoospfd: Fix arm compile issue
Donald Sharp [Mon, 10 Oct 2016 23:35:43 +0000 (19:35 -0400)]
ospfd: Fix arm compile issue

size_t printf formatter is %zd!

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agobgpd: 'neighbor x.x.x.x weight' should be per address-family
Daniel Walton [Mon, 10 Oct 2016 14:53:34 +0000 (07:53 -0700)]
bgpd: 'neighbor x.x.x.x weight' should be per address-family

Ticket: CM-13053
Reviewed By: dslice@cumulusnetworks.com

'neighbor x.x.x.x weight' was implemented as a per-peer knob instead of
a per-peer per-afi-safi option. This makes it configurable per-peer
per-afi-safi so that we can do things like soft clear that afi/safi when
weight is modified.

8 years agobgpd: Fix changes caused by index_sub change.
Donald Sharp [Sat, 8 Oct 2016 20:37:48 +0000 (16:37 -0400)]
bgpd: Fix changes caused by index_sub change.

The qobj changes changed how index_sub was handled.

This commit leaves some issues still.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years ago*: Consolidate all double VIEW_NODE and ENABLE_NODE's
Donald Sharp [Fri, 11 Mar 2016 19:27:13 +0000 (14:27 -0500)]
*: 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>
8 years agolib: Consolidate VIEW_NODE to be ENABLE_NODE as well
Donald Sharp [Fri, 11 Mar 2016 19:27:12 +0000 (14:27 -0500)]
lib: Consolidate VIEW_NODE to be ENABLE_NODE as well

If you are in VIEW_NODE, the command should exist in ENABLE_NODE
as well.  This is being done to reduce chances of code being
added to one but not the other NODE.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agobgpd, lib: Remove RESTRICTED_NODE from code base
Donald Sharp [Fri, 11 Mar 2016 19:27:11 +0000 (14:27 -0500)]
bgpd, lib: Remove RESTRICTED_NODE from code base

The RESTRICTED_NODE command is not used, introduces code
complexity and provides no additional levels of security.

The only way to get into RESTRICTED_NODE is to add, under
vty configuration the command 'anonymous restricted', and
then telnet to a daemon, provide a password, then type
'enable' and fail to enter the password three times.
Then the user can enter a very limited set of commands to
monitor bgp and only bgp behavior.

This commit removes both the RESTRICTED_NODE usage as well
as the lib/* usage of the code

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoripngd: add support for route tags
Christian Franke [Sat, 1 Oct 2016 20:35:32 +0000 (22:35 +0200)]
ripngd: add support for route tags

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
8 years agoripd: add support for route tags
Christian Franke [Sat, 1 Oct 2016 19:43:17 +0000 (21:43 +0200)]
ripd: add support for route tags

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
8 years agoospf6d: add support for route tags
Christian Franke [Sat, 1 Oct 2016 04:41:40 +0000 (06:41 +0200)]
ospf6d: add support for route tags

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
8 years ago*: Consistently support 32-bit route tags
Christian Franke [Sat, 1 Oct 2016 18:42:34 +0000 (20:42 +0200)]
*: 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>
8 years agoospfd: Update route in zebra when tag changes
Christian Franke [Sat, 1 Oct 2016 02:06:03 +0000 (04:06 +0200)]
ospfd: Update route in zebra when tag changes

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
8 years agozebra: Fix some warnings found during compile.
Donald Sharp [Tue, 22 Dec 2015 20:24:25 +0000 (15:24 -0500)]
zebra: Fix some warnings found during compile.

This commit fixes some warnings found in Martin's Testbed
that compiles sun solaris and freebsd images.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agolib: Remove `show commandtree`, add `list permutations`
Quentin Young [Fri, 7 Oct 2016 21:44:10 +0000 (21:44 +0000)]
lib: Remove `show commandtree`, add `list permutations`

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agolib: Add naive deduplication checks when installing commands
Quentin Young [Fri, 7 Oct 2016 18:41:41 +0000 (18:41 +0000)]
lib: Add naive deduplication checks when installing commands

Since not all duplicate commands can be caught during graph
construction, do a linear search over all commands before
installing.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agolib: Improve formatting for matcher tracing output
Quentin Young [Fri, 7 Oct 2016 18:40:37 +0000 (18:40 +0000)]
lib: Improve formatting for matcher tracing output

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agotools: Pretty print graph after input permutations
Quentin Young [Fri, 7 Oct 2016 18:39:24 +0000 (18:39 +0000)]
tools: Pretty print graph after input permutations

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agolib: Remove unknown protocol.
Donald Sharp [Fri, 7 Oct 2016 16:35:06 +0000 (12:35 -0400)]
lib: Remove unknown protocol.

What is MASC anyways?

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agolib: Fix ordering issue in protocol names
Donald Sharp [Fri, 7 Oct 2016 16:20:33 +0000 (12:20 -0400)]
lib: Fix ordering issue in protocol names

The protocol names and enum must be kept
in the same order.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agobgpd: remove the "exit" at the end of "router bgp"
Daniel Walton [Fri, 7 Oct 2016 14:13:26 +0000 (14:13 +0000)]
bgpd: remove the "exit" at the end of "router bgp"

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agozebra: use qobj and enable concurrent config edits
David Lamparter [Fri, 30 Sep 2016 13:38:03 +0000 (15:38 +0200)]
zebra: use qobj and enable concurrent config edits

This puts all the proper VTY_DECLVAR_CONTEXT calls in place, removing
all vty->index uses in the process.  With that, vty_config_lockless can
be enabled in zebra.

[v2: fix ordering screw-up in "interface XXX" command]

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agoldpd: replace global vars w/ qobj for vty context
Renato Westphal [Thu, 29 Sep 2016 17:16:50 +0000 (14:16 -0300)]
ldpd: replace global vars w/ qobj for vty context

ldpd was keeping track of the vty session's position in config editing
with 3 global static variables.  This worked because only one vty could
be in configuration-editing mode before.

Replace with vty->qobj_index infrastructure and enable
vty_config_lockless.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agoldpd: qobj: register everything
Renato Westphal [Wed, 22 Jun 2016 12:59:28 +0000 (09:59 -0300)]
ldpd: qobj: register everything

Place the appropriate QOBJ_* calls.  A bit more complicated for ldpd due
to the dup-merge config scheme.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agoldpd: add in-process API for creating/deleting
Renato Westphal [Wed, 22 Jun 2016 12:59:28 +0000 (09:59 -0300)]
ldpd: add in-process API for creating/deleting

These functions are currently unused but will be used by the Cap'n Proto
interface.  They're not a particular burden to maintain in-tree, so here
they go.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agoldpd: merge/dup/reload void **ref support
Renato Westphal [Wed, 22 Jun 2016 12:59:28 +0000 (09:59 -0300)]
ldpd: merge/dup/reload void **ref support

Extend configuration duplication-merge mechanism to allow keeping track
of a single specific object.  A "void **" pointer is passed in; the
"void *" pointer it points to is updated with the new address of the
object it points to.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agoldpd: reset interface configuration when it's disabled
Renato Westphal [Thu, 29 Sep 2016 17:52:32 +0000 (14:52 -0300)]
ldpd: reset interface configuration when it's disabled

This is necessary to prevent the same old configuration to come back
when the interface is reactivated later for a given address-family.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agolib, isisd: enable concurrent configuration editing
David Lamparter [Tue, 27 Sep 2016 14:53:25 +0000 (16:53 +0200)]
lib, isisd: enable concurrent configuration editing

Finally, this disables the config editing lock for isisd.  It also
enables deprecation warnings for the lib/ and isisd/ to catch accidental
uses of vty->index.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agoisisd: use qobj for vty->index context position
David Lamparter [Mon, 26 Sep 2016 16:36:13 +0000 (18:36 +0200)]
isisd: use qobj for vty->index context position

This converts all uses of vty->index over to qobj.  With this, isisd now
supports concurrent configuration editing as there are no more unsafe
references held anywhere while in config-edit mode.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agolib: replace vty->index_sub with qobj
David Lamparter [Tue, 27 Sep 2016 14:51:58 +0000 (16:51 +0200)]
lib: replace vty->index_sub with qobj

The keychain code is the only user of vty->index_sub;  this is also
replaced with a qobj safe-pointer.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agolib: use qobj for vty->index context position
David Lamparter [Mon, 26 Sep 2016 18:17:12 +0000 (20:17 +0200)]
lib: use qobj for vty->index context position

Prepares the library CLI functions for concurrent config access.  Note
the vty->index pointer is still kept functional for the daemons to use.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agolib: vty: add infrastructure for qobj ID "index"
David Lamparter [Mon, 26 Sep 2016 16:36:49 +0000 (18:36 +0200)]
lib: vty: add infrastructure for qobj ID "index"

As mentioned in previous commits, this prepares to replace the vty's
"void *index" context position with a safe qobj pointer.  This will
allow concurrent configuration editing by multiple users, as soon as no
more code (library included) in the daemon uses vty->index anymore.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agoisisd: qobj: register everything
David Lamparter [Tue, 5 Apr 2016 21:54:53 +0000 (18:54 -0300)]
isisd: qobj: register everything

Wire up all neccessary isisd first-class objects to be able to use qobj
safe-pointers on them.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agolib: qobj: register ifaces, routemaps & keychains
David Lamparter [Tue, 27 Sep 2016 12:51:08 +0000 (14:51 +0200)]
lib: qobj: register ifaces, routemaps & keychains

This places the appropriate calls so library objects can be used with
qobj "pointers", especially in the CLI.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agolib: add "qobj" object-ID infrastructure
David Lamparter [Mon, 26 Sep 2016 15:30:30 +0000 (17:30 +0200)]
lib: add "qobj" object-ID infrastructure

This adds 64-bit random identifiers as "safe pointers" which are also
type-tracked / can have type-specific extension methods.

This will be used by both the CLI (to keep safe references while in
config editing mode) as well as the Cap'n Proto code (to hand out
pointers to the user in a safe way and add per-type handlers)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agolib: Fix `show running-config` and `write terminal`
Quentin Young [Fri, 7 Oct 2016 02:33:37 +0000 (02:33 +0000)]
lib: Fix `show running-config` and `write terminal`

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agoall: removed all DEFUN command stomps (fix build errors)
Daniel Walton [Thu, 6 Oct 2016 20:23:13 +0000 (20:23 +0000)]
all: removed all DEFUN command stomps (fix build errors)

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
8 years agoall: removed all DEFUN command stomps
Daniel Walton [Thu, 6 Oct 2016 19:56:13 +0000 (19:56 +0000)]
all: removed all DEFUN command stomps

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agolib: Log invalid/unknown commands to log file
Quentin Young [Thu, 6 Oct 2016 18:39:31 +0000 (18:39 +0000)]
lib: Log invalid/unknown commands to log file

Ticket: CM-6855

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agovtysh: extract.pl <0-255> to (0-255) changes
Daniel Walton [Thu, 6 Oct 2016 13:51:52 +0000 (13:51 +0000)]
vtysh: extract.pl <0-255> to (0-255) changes

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
8 years agobgpd: 'Last write' does not update when we TX a keepalive
Daniel Walton [Thu, 6 Oct 2016 13:20:02 +0000 (13:20 +0000)]
bgpd: 'Last write' does not update when we TX a keepalive

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

8 years agozebra: Fix static route helper function
Quentin Young [Thu, 6 Oct 2016 04:08:34 +0000 (04:08 +0000)]
zebra: Fix static route helper function

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agolib: Make <cr> appear first in completions
Quentin Young [Thu, 6 Oct 2016 01:15:48 +0000 (01:15 +0000)]
lib: Make <cr> appear first in completions

When a command is complete and <cr> appears in tab- or
?-completions, make sure it appears first

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agolib: Check match level when calculating completions
Quentin Young [Thu, 6 Oct 2016 00:03:39 +0000 (00:03 +0000)]
lib: Check match level when calculating completions

Adds a missing check that resulted in partial token
matches being accepted as exact matches when calculating
input completions.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agolib: Add tracing capabilities to command matcher
Quentin Young [Wed, 5 Oct 2016 23:56:17 +0000 (23:56 +0000)]
lib: Add tracing capabilities to command matcher

Compile with -DTRACE_MATCHER to enable matcher
debugging to stdout.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agolib: Invalid commands are errors, fix msg formatting
Quentin Young [Wed, 5 Oct 2016 23:50:49 +0000 (23:50 +0000)]
lib: Invalid commands are errors, fix msg formatting

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agozebra: Fix typo in zebra command desc
Quentin Young [Wed, 5 Oct 2016 23:02:57 +0000 (23:02 +0000)]
zebra: Fix typo in zebra command desc

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agolib: Allow / and . to match VARIABLE_TKN, fix range matches
Quentin Young [Tue, 4 Oct 2016 20:56:30 +0000 (20:56 +0000)]
lib: Allow / and . to match VARIABLE_TKN, fix range matches

Range matching function was returning 0 instead of no_match
on failed match, causing all input to match ranges.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agolib: Add logging for invalid commands
Quentin Young [Tue, 4 Oct 2016 20:41:52 +0000 (20:41 +0000)]
lib: Add logging for invalid commands

Ticket: CM-6855

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agoall: Fix various syntax errors
Quentin Young [Tue, 4 Oct 2016 19:21:45 +0000 (19:21 +0000)]
all: Fix various syntax errors

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agolib: fix password and enable password syntax
Quentin Young [Tue, 4 Oct 2016 18:47:17 +0000 (18:47 +0000)]
lib: fix password and enable password syntax

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>