Julien Courtat [Tue, 17 May 2016 14:26:22 +0000 (16:26 +0200)]
bgpd: configure preserve forwarding state from vty
Preserve forwarding state bit can be set in OPEN message with the use of
new vty commands
bgp graceful-restart preserve-fw-state
no bgp graceful-restart preserve-fw-state
This must be set before activating the connection to a peer, since it is
for forging graceful restart capability of OPEN messages.
Julien Courtat [Fri, 20 May 2016 10:10:07 +0000 (12:10 +0200)]
bgpd: enable send of Graceful Restart Preserve State F bit
Enhance struct bgp to add a new flag BGP_FLAG_GR_PRESERVE_FWD, which
allow to set the Preserve State F bit of Graceful Restart capability in
OPEN messages.
Olivier Dugeon [Tue, 20 Dec 2016 14:02:34 +0000 (15:02 +0100)]
Rationalize Link Parameters flags
* lib/if.h: Remove LP_TE as Link Parameters is set if different from 0
See IS_LINK_PARAMS_SET macro and use LP_TE_METRIC to determine if TE metric
is set or not
* lib/if.c: replace LP_TE by LP_TE_METRIC in default LP status
* zebra/interface.c: replace LP_TE by LP_TE_METRIC and check if TE metric
is equal to standard metric or not
* ospfd/ospf_te.c: replace LP_TE by LP_TE_METRIC
* isisd/isis_te.c: replace LP_TE by LP_TE_METRIC
Julien Courtat [Fri, 17 Jun 2016 13:31:09 +0000 (15:31 +0200)]
bgpd: support End-Of-Rib of VPNv4 address family
After graceful restart procedure, when BGP speaker has finished to send
its VPNv4 routes to the restarting peer, it also sends End-Of-Rib
message for afi=AFI_IPv4 safi=SAFI_MPLS_VPN.
Julien Courtat [Wed, 25 May 2016 15:28:31 +0000 (17:28 +0200)]
bgpd: graceful restart for vpnv4 address family
This patch enable the support of graceful restart for routes sets with
vpnv4 address family format. In this specific case, data model is
slightly different and some additional processing must be done when
accessing bgp tables and nodes.
The clearing stale algorithm takes into account the specificity where
the 2 node level for MPLS has to be reached.
Signed-off-by: Julien Courtat <julien.courtat@6wind.com> Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
David Lamparter [Wed, 23 Nov 2016 18:20:15 +0000 (19:20 +0100)]
lib: parser: remove startnode & sentence_root
This removes an artificial restriction for the first token in a
command's graph to be a WORD_TKN. The intention seems to be to prohibit
empty paths through a command, and to restrict "explosion" of choices in
the root node.
The better approach to the former is to check for an empty path after
the definition is parsed. The latter will happen anyway, by duplication
of the command, which just makes it worse...
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Fri, 16 Dec 2016 19:43:26 +0000 (20:43 +0100)]
lib: parser: accept number-only word tokens
There seems to be no reason why numbers don't work as plain word tokens;
this is useful to have "number choices" or constants, e.g. <128|192|256>
for bit encryption lengths.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Fri, 16 Dec 2016 16:33:31 +0000 (17:33 +0100)]
build: automake 1.12 to deal with flex & bison
bison conditionally writes its output to different files based on the
filenames specified in the source code. This could be disabled,
however... flex changes its output filenames when "prefix" is
specified. And ylwrap from <1.11 doesn't understand how to handle the
header file...
...so this requires automake 1.12 which can deal with this properly.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Thu, 15 Dec 2016 22:20:04 +0000 (23:20 +0100)]
tests: adjust testcli ref output to new argv rules
Now that we have keyword argument support in the matcher again, this
needs to be updated because argv[] will be 1:1 user input without
mangling or reordering.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Thu, 15 Dec 2016 22:53:02 +0000 (23:53 +0100)]
lib: parser: fix SEGV when Tab hits non-WORD_TKN
If <Tab> processing finds that there is only 1 candidate, but that
candidate is not a WORD_TKN that we can tab-complete on, the status
would remain at CMD_COMPLETE_FULL_MATCH, but the resulting list of
possible completions is empty.
This then SEGVs in lib/vty.c where it tries to access the first element
of the list, assuming FULL_MATCH always has 1 element there...
Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Cc: Quentin Young <qlyoung@cumulusnetworks.com>
David Lamparter [Fri, 18 Nov 2016 14:56:18 +0000 (15:56 +0100)]
lib: parser: support keyword arguments
This re-adds "{foo WORD|bar WORD}" keyword-argument support to the CLI
parser. Note that token graphs may now contain loops for this purpose;
therefore the matching functions retain a history of already-matched
tokens. Each token can thus only be consumed once.
And then LINE... gets its special treatment with allowrepeat.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Fredi Raspall [Wed, 30 Nov 2016 18:15:07 +0000 (19:15 +0100)]
zebra_mpls. Set best lsp nhlfe to null on deletion
When a nhlfe was deleted and it happened to be the best,
lsp->best_nhlfe was not updated causing lsp_process() to see
an inexistent nhlfe.
Fix: set lsp->best_nhlfe to null on deletion.
Donald Sharp [Mon, 12 Dec 2016 12:59:16 +0000 (07:59 -0500)]
lib: Partial Revert of 4ecc09d and modify zclient connect behavior
Commit 43cc09d has been shown to cause several issues with clients
connecting.
Partial revert, since I wanted to keep the debug logs added
for that commit, as well remove the piece of code that
stops attempting to connect to zebra. If we've failed
a bunch of times, there is nothing wrong with continuing
to do so once every 60 seconds. I've debug guarded
the connect failure for those people running bgp
without zebra.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Renato Westphal [Mon, 12 Dec 2016 20:35:30 +0000 (18:35 -0200)]
ldpd: add missing check on disc_find_iface()
When we find an interface on disc_find_iface(), we need to check if it's
enabled for the address-family (IPv4 or IPv6) of the received packet. We
were doing that only for targeted hellos, do it for link hellos as well.
Renato Westphal [Thu, 8 Dec 2016 19:36:03 +0000 (17:36 -0200)]
zebra: fix segfault on exit when RIB debugging is enabled
Fixes the following crash on exit:
(gdb) bt
0 _rnode_zlog (...) at zebra_rib.c:104
1 0x0000000000417726 in rib_unlink (...) at zebra_rib.c:2370
2 0x000000000042db80 in zebra_rtable_node_destroy (...) at zebra_vrf.c:336
3 0x00007ffff7b6ce2e in route_node_free (...) at table.c:81
4 0x00007ffff7b6ced7 in route_table_free (...) at table.c:118
5 0x00007ffff7b6cd88 in route_table_finish (...) at table.c:53
6 0x000000000042defa in zebra_vrf_delete (...) at zebra_vrf.c:278
7 0x00007ffff7b9e044 in vrf_delete (...) at vrf.c:162
8 0x00007ffff7b9e89f in vrf_terminate () at vrf.c:458
9 0x000000000041027c in sigint () at main.c:205
10 0x00007ffff7b953f2 in quagga_sigevent_process () at sigevent.c:111
11 0x00007ffff7b681dd in thread_fetch (...) at thread.c:1297
12 0x000000000040c7ed in main (...) at main.c:471
To fix the problem, free the table->info pointer only after
route_table_finish() is called for the table.
Fix instances that the coccinelle patch didn't catch (or which
coccinelle couldn't parse), and add the patch file for future posterity
(and application to yet-unmerged branches).
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Renato Westphal [Wed, 7 Dec 2016 15:21:46 +0000 (13:21 -0200)]
*: always set SO_SNDBUF and SO_RCVBUF using a best effort approach
If we fail to set any socket's buffer size, try again with a smaller value
and keep going until it succeeds. This is better than just giving up or,
even worse, abort the creation of a socket (ospf6d and ripd).
Fix broken ospf6d on FreeBSD.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Renato Westphal [Wed, 7 Dec 2016 15:21:45 +0000 (13:21 -0200)]
ospfd: set the OSPF socket's send buffer size only once
This reverts commit b7fe4141, which introduced a logic where the OSPF
send buffer size was dynamically updated to reflect the maximum MTU
of the OSPF enabled interfaces (this was done to make ospfd work with
interfaces configured for jumbo frames).
Since commit a78d75b0, this is not necessary anymore because
ospf_sock_init() now sets the OSPF send buffer size to a very high value
(8MB). Also, the previous logic was broken because it didn't account
for run-time interface MTU changes.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Donald Sharp [Thu, 1 Dec 2016 15:49:22 +0000 (10:49 -0500)]
lib, zebra: Minimize display of link-params sub data
When link-params is configured it auto starts displaying
6000-02# conf t
dell-s6000-02(config)# int swp1
dell-s6000-02(config-if)# link-params
dell-s6000-02(config-link-params)# admin-grp 0x12345678
dell-s6000-02(config-link-params)# end
dell-s6000-02# show run
vivek [Sun, 4 Dec 2016 02:51:49 +0000 (21:51 -0500)]
bgpd: Remove nexthop for peer only for "real" peer
During connection establishment, there is a separate peer structure created
for the doppelganger (for incoming connection). When this is deleted after
the connection has established, take care to ensure that the nexthop entry
for the peer is not deleted.
Quentin Young [Fri, 2 Dec 2016 21:02:51 +0000 (21:02 +0000)]
lib: make CLI completions less surprising
* If a token matches exactly at the end of input, it still
shows up in completions, e.g.
ex# clear<?>
clear Reset functions
ex(config)# ip route 1.2.3.4<?>
A.B.C.D IP destination prefix
A.B.C.D/M IP destination prefix (e.g. 10.0.0.0/8)
* If a token in mid-line exactly matches one token and
partially matches on one or more additional tokens,
the command tree(s) under the partially matching tokens
will be ignored in favor of the exact match when compiling
completions for the full line, e.g.
ex(config)# ip <?>
will only show completions for commands under 'ip' and not
those under 'ipv6', which the input partially matches.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
vivek [Fri, 2 Dec 2016 13:22:21 +0000 (08:22 -0500)]
bgpd: Fix route node unlock when clearing adj-out
When clearing the adj-out for a subgroup (e.g., upon peer going down),
ensure that the adj-out is removed before unlocking the route node that
it points to, otherwise, there is a possibility that the route node may
be prematurely freed.
Donald Sharp [Fri, 2 Dec 2016 13:19:26 +0000 (08:19 -0500)]
ospfd: Fix json Crash with inactive timer
When nbr->t_inactivity is not active, and
you do a show json over the neighbor it
will crash ospfd. Fix the code so it
prints out -1 when the timer is inactive.
Ticket:CM-13835 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
(cherry picked from commit 78d8fcb9623ab4d9cebf6187a451448e056a84bf) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Wed, 16 Nov 2016 06:03:51 +0000 (15:03 +0900)]
lib: parser: use reentrant mode on flex & bison
This removes remaining global variables from the lexer, pushing the
lexer state into struct parser_ctx too. At the same time, "cmd_yy" is
used as prefix for all parser & lexer routines.
The result is that (a) there is no collision anymore if a program uses
flex/bison and links libzebra, and (b) the parser is fully encapsulated
and could be called in parallel from multiple threads.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Wed, 23 Nov 2016 08:02:08 +0000 (09:02 +0100)]
lib: parser: wrap state in struct parser_ctx
This encapsulates all parser state into a new "struct parser_ctx", which
is allocated on stack and passed around as pointer. The parser no
longer has any global variables with this.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Wed, 23 Nov 2016 07:42:27 +0000 (08:42 +0100)]
lib: move command_parse_format prototype
The function prototype for command_parse_format() is better left in
command.h, so that the bison-generated header file doesn't need to be
included for that.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Wed, 16 Nov 2016 06:00:52 +0000 (15:00 +0900)]
*: make DEFUN installations file-local
This moves all install_element calls into the file where the DEFUNs are
located. This fixes several small related bugs:
- ospf6d wasn't installing a "no interface FOO" command
- zebra had a useless copy of "interface FOO"
- pimd's copy of "interface FOO" was not setting qobj_index, which means
"description LINE" commands would fail with an error
The next commit will do the actual act of making "foo_cmd" static.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Thu, 1 Dec 2016 16:18:57 +0000 (17:18 +0100)]
lib: replace MIT license with ISC
Since other parts (e.g. ldpd) use the ISC license, and the ISC license
is just a simplified form of the MIT license, just move things over and
reduce the number of different licenses we have in use here.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>