]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
8 years agobuild: fix command_lex.h deps & gitignore
David Lamparter [Wed, 7 Dec 2016 16:34:38 +0000 (17:34 +0100)]
build: fix command_lex.h deps & gitignore

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agoMerge branch 'vtysh-grammar'
David Lamparter [Thu, 8 Dec 2016 11:22:13 +0000 (12:22 +0100)]
Merge branch 'vtysh-grammar'

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agoripd: fix `ip rip receive...` command
Quentin Young [Tue, 6 Dec 2016 20:50:37 +0000 (20:50 +0000)]
ripd: fix `ip rip receive...` command

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agolib, ripngd: clean up merge leftovers
Quentin Young [Tue, 6 Dec 2016 20:10:06 +0000 (20:10 +0000)]
lib, ripngd: clean up merge leftovers

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agoMerge remote-tracking branch 'osr/master' into vtysh-grammar
Quentin Young [Tue, 6 Dec 2016 19:51:33 +0000 (19:51 +0000)]
Merge remote-tracking branch 'osr/master' into vtysh-grammar

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

8 years agolib, tests: fix failing cli tests
Quentin Young [Tue, 6 Dec 2016 19:27:58 +0000 (19:27 +0000)]
lib, tests: fix failing cli tests

Some tests still failing pending reimplementation of {}
cli definition constructs

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agolib: add back original ipv6 matcher
Quentin Young [Tue, 6 Dec 2016 18:54:04 +0000 (18:54 +0000)]
lib: add back original ipv6 matcher

inet_pton is not suitable for well behaved cli completions

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agoRevert "lib: Macroize CLI matcher tracing"
David Lamparter [Mon, 5 Dec 2016 20:01:06 +0000 (21:01 +0100)]
Revert "lib: Macroize CLI matcher tracing"

This reverts commit 54c5dce6a5e46717ad52c80f2dc99fc36a372e28.

8 years agoripd: fix indentation problems introduced by wrong conflict resolution
Renato Westphal [Mon, 5 Dec 2016 19:31:42 +0000 (17:31 -0200)]
ripd: fix indentation problems introduced by wrong conflict resolution

Restore trailing whitespaces from rip_interface_new() as well. If we
want to fix this, we need a separate commit just for this purpose.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
[DL: removed "restoring wrong whitespace" bits]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years ago*: fix up DEFUNs without install_element calls
David Lamparter [Mon, 5 Dec 2016 19:28:24 +0000 (20:28 +0100)]
*: fix up DEFUNs without install_element calls

These now generate warnings which will break the build with -Werror.

Note this may have enabled commands that should be disabled, or the
other way around...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agoMerge branch 'queue/osr/vtysh-generic'
David Lamparter [Mon, 5 Dec 2016 19:04:08 +0000 (20:04 +0100)]
Merge branch 'queue/osr/vtysh-generic'

WARNING: Merge contains nontrivial fixups in vrf_cmd handling.

Conflicts:
lib/if.c
zebra/interface.c

8 years agoMerge branch 'stable/2.0'
David Lamparter [Mon, 5 Dec 2016 18:43:38 +0000 (19:43 +0100)]
Merge branch 'stable/2.0'

Conflicts:
bgpd/bgp_route.c
lib/if.c
ripd/rip_interface.c
zebra/interface.c
zebra/zebra_vty.c

8 years agobuild: number sections in COMMUNITY.md HTML
David Lamparter [Mon, 5 Dec 2016 18:08:00 +0000 (19:08 +0100)]
build: number sections in COMMUNITY.md HTML

adds some CSS to get section numbers.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agolib: remove unused NS_BITMAP MTYPE
David Lamparter [Mon, 5 Dec 2016 15:34:15 +0000 (16:34 +0100)]
lib: remove unused NS_BITMAP MTYPE

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agoMerge branch '-rip' into stable/2.0
David Lamparter [Mon, 5 Dec 2016 15:25:58 +0000 (16:25 +0100)]
Merge branch '-rip' into stable/2.0

This fixes up a lot of RIP/RIPng compliance tests that were still
flagged up.

Tested-by: Martin Winter <mwinter@opensourcerouting.org>
8 years agoMerge branch '-renato' into stable/2.0
David Lamparter [Mon, 5 Dec 2016 15:22:16 +0000 (16:22 +0100)]
Merge branch '-renato' into stable/2.0

This contains bgp memory leak fixes as well as cleanups to VRF/namespace
handling and has been run through extended testing in Cumulus' testbed:

Tested-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agolib, zebra: Minimize display of link-params sub data
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

interface swp1
 link-params
  enable
  metric 0              <----Remove the bw lines
  max-bw 1.25e+06
  max-rsv-bw 1.25e+06
  unrsv-bw 0 1.25e+06
  unrsv-bw 1 1.25e+06
  unrsv-bw 2 1.25e+06
  unrsv-bw 3 1.25e+06
  unrsv-bw 4 1.25e+06
  unrsv-bw 5 1.25e+06
  unrsv-bw 6 1.25e+06
  unrsv-bw 7 1.25e+06
  admin-grp 305419896
  exit-link-params
!

I'd like to reduce this to:

interface enp0s3
 ip igmp
 ip pim sm
 link-params
  enable
  admin-grp 0x12345678    <----- Fix this to be what we entered
  exit-link-params
!

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agobgpd: Remove nexthop for peer only for "real" peer
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.

Fixes: f9164b1d74f6a20d69d7ef10d2e39b4ae7996cbf
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Ticket: CM-13875
Reviewed By: None
Testing Done: Manual

(cherry picked from commit 4f2bc892cbddbf36bd5e1b2f36c33260af614b33)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agodoc: update README to mention PIM-SSM and LDP support
Renato Westphal [Sat, 3 Dec 2016 23:35:23 +0000 (21:35 -0200)]
doc: update README to mention PIM-SSM and LDP support

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agobgpd: Fix 'show ip bgp' to not change it's output
Donald Sharp [Fri, 2 Dec 2016 18:57:04 +0000 (13:57 -0500)]
bgpd: Fix 'show ip bgp' to not change it's output

For unicast routes do not change the output of the 'show ip bgp' command.

This will allow people with existing scripts to continue to work.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agolib: add command_lex.h to .gitignore
Quentin Young [Fri, 2 Dec 2016 21:14:32 +0000 (21:14 +0000)]
lib: add command_lex.h to .gitignore

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agolib: make CLI completions less surprising
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>
8 years agotools: drop cmd_check.py
Quentin Young [Fri, 2 Dec 2016 19:09:11 +0000 (19:09 +0000)]
tools: drop cmd_check.py

CLI defuns are static so the compiler catches unused
definitions, ergo no longer necessary to have a script
for this.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agoMerge remote-tracking branch 'osr_private_quagga/queue/osr/vtysh-generic' into vtysh...
Quentin Young [Fri, 2 Dec 2016 19:02:06 +0000 (19:02 +0000)]
Merge remote-tracking branch 'osr_private_quagga/queue/osr/vtysh-generic' into vtysh-grammar

8 years agolib: Macroize CLI matcher tracing
Quentin Young [Fri, 2 Dec 2016 18:26:47 +0000 (18:26 +0000)]
lib: Macroize CLI matcher tracing

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agolib: Add back prototypes for lexer helper funcs
Quentin Young [Fri, 2 Dec 2016 18:26:10 +0000 (18:26 +0000)]
lib: Add back prototypes for lexer helper funcs

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agobgpd: Fix route node unlock when clearing adj-out
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.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Ticket: CM-13690
Reviewed By: None
Testing Done: bgp-smoke, resilient-hash tests

(cherry picked from commit c3d7d35f3b7152c9e50e52c3cfd60b0dc52df703)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agoospfd: Fix json Crash with inactive timer
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>
8 years agobgpd: Add missing argv handler for ipv4 prefix in `show...vpnv4` cmd
Quentin Young [Thu, 1 Dec 2016 21:13:46 +0000 (21:13 +0000)]
bgpd: Add missing argv handler for ipv4 prefix in `show...vpnv4` cmd

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agobgpd: Make `ip` optional for all `show bgp` and `show ip bgp` commands
Quentin Young [Thu, 1 Dec 2016 18:41:52 +0000 (18:41 +0000)]
bgpd: Make `ip` optional for all `show bgp` and `show ip bgp` commands

This should unify the `show bgp ...` and `show ip bgp...` command
variants under one tree.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agolib: remove misleading copy/del_cmd_element
David Lamparter [Wed, 23 Nov 2016 11:06:34 +0000 (12:06 +0100)]
lib: remove misleading copy/del_cmd_element

struct cmd_element items are static global variables, they are never
allocated, copied or freed.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agolib: parser: use reentrant mode on flex & bison
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>
8 years agolib: parser: wrap state in struct parser_ctx
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>
8 years agolib: move command_parse_format prototype
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>
8 years agolib: allow all characters in WORD tokens
David Lamparter [Fri, 18 Nov 2016 10:34:28 +0000 (11:34 +0100)]
lib: allow all characters in WORD tokens

WORD tokens (which are also used for "LINE..." input) should really
accept all characters.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agolib: make DEFUN foobar_cmd symbols static
David Lamparter [Wed, 16 Nov 2016 06:02:04 +0000 (15:02 +0900)]
lib: make DEFUN foobar_cmd symbols static

These are not externally referenced anymore;  this reduces the symbol
count of libzebra by quite a bit.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years ago*: make DEFUN installations file-local
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>
8 years agoMerge branch 'stable/2.0'
David Lamparter [Thu, 1 Dec 2016 16:24:03 +0000 (17:24 +0100)]
Merge branch 'stable/2.0'

8 years agolib: replace MIT license with ISC
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>
8 years agobuild: COMMUNITY.md: add git branch diagram
David Lamparter [Thu, 1 Dec 2016 16:16:24 +0000 (17:16 +0100)]
build: COMMUNITY.md: add git branch diagram

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agozebra: check ZEBRA_IFC_REAL on if_up
Christian Franke [Mon, 7 Nov 2016 12:37:25 +0000 (13:37 +0100)]
zebra: check ZEBRA_IFC_REAL on if_up

Only connected routes which have ZEBRA_IFC_REAL set should
be redistributed.

Signed-off-by: Christian Franke <nobody@nowhere.ws>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agobgpd: fix invalid memory access in peer_free()
Renato Westphal [Mon, 28 Nov 2016 18:47:13 +0000 (16:47 -0200)]
bgpd: fix invalid memory access in peer_free()

We shoult not call bgp_unlock() before calling
bgp_delete_connected_nexthop() in the peer_free() function. Otherwise,
if bgp->lock reaches zero, bgp_free() is called and peer->bgp becomes
an invalid pointer in the bgp_delete_connected_nexthop() function.

To fix this, move the call to bgp_unlock() to the end of peer_free().

Bug exposed by commit 37d361e ("bgpd: plug several memleaks").

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agobgpd: Fix crashes when no default bgp instance is configured.
Donald Sharp [Thu, 1 Dec 2016 14:11:12 +0000 (09:11 -0500)]
bgpd: Fix crashes when no default bgp instance is configured.

The vnc code assumes that bgp must have a default instance.
This code change checks to make sure that we do before
proceeding.  It makes no assurances that vnc will behave
correctly without a default instance.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agopimd: Fix large integer display of drpriority
Donald Sharp [Wed, 30 Nov 2016 13:23:12 +0000 (08:23 -0500)]
pimd: Fix large integer display of drpriority

When displaying drpriority you can enter unsigned
integer values from 1-2^32.  The display was
turning the unsigned value into a signed value
and thus we were displaying the wrong value.

Ticket: CM-13787
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: David Ahern <dsa@cumulusnetworks.com>
(cherry picked from commit db17265f1025e3ec578998ad537c33b49ed33cde)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agoospfd: Fix memory leak when not using json
Donald Sharp [Wed, 30 Nov 2016 13:23:11 +0000 (08:23 -0500)]
ospfd: Fix memory leak when not using json

When doing a show command under ospf, if
not using json we would have a small memory
leak in show_ip_ospf_common.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit 50750712b1ac8364e290c67782eaf371025dc59e)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agoall: Replace "JavaScript Object Notation\n" with JSON_STR
Quentin Young [Tue, 29 Nov 2016 23:26:03 +0000 (23:26 +0000)]
all: Replace "JavaScript Object Notation\n" with JSON_STR

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agoall: Fix all underfull doc strings
Quentin Young [Tue, 29 Nov 2016 23:07:11 +0000 (23:07 +0000)]
all: Fix all underfull doc strings

Additionally:
* Add [ip] to a couple bgp show commands
* Quick refactor of a couple ISIS commands
* Quick refactor of a couple OSPF6 commands

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agolib: allow all characters in WORD tokens
David Lamparter [Fri, 18 Nov 2016 10:34:28 +0000 (11:34 +0100)]
lib: allow all characters in WORD tokens

WORD tokens (which are also used for "LINE..." input) should really
accept all characters.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agobgpd: Add back missing vpnv4 commands
Quentin Young [Tue, 29 Nov 2016 20:25:24 +0000 (20:25 +0000)]
bgpd: Add back missing vpnv4 commands

* show ip bgp vpnv4 all <A.B.C.D|A.B.C.D/M> [json]
* show...vpnv4 <all|rd ...> summary...
* Fix placement of AF+SAFI specifiers for BGP clear commands
* Add more [ip]'s for bgp commands
* clean up some doc strings

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agobuild: drop TODO from redhat/quagga.spec.in
David Lamparter [Tue, 29 Nov 2016 19:31:43 +0000 (20:31 +0100)]
build: drop TODO from redhat/quagga.spec.in

Fixes: 955026c8... "build: ditch outdated documents, including HACKING"
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agobgpd: fix "show ip bgp" column alignment
Daniel Walton [Tue, 29 Nov 2016 17:47:12 +0000 (12:47 -0500)]
bgpd: fix "show ip bgp" column alignment

The "Weight" column is off:

BGP table version is 0, local router ID is 10.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, =
multipath,
              i internal, r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
*> 4.1.1.2/32       9.9.9.2                  0          32768 ?
*> 4.1.1.4/32       9.9.9.2                  0          32768 ?
Displayed  2 out of 2 total prefixes

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit 65c7395b07e8c592c847d4a1e22fc89ddf448341)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agoospfd: "ip ospf bfd" removes the "ip ospf bfd 3 250 250" command
Daniel Walton [Tue, 29 Nov 2016 17:47:11 +0000 (12:47 -0500)]
ospfd: "ip ospf bfd" removes the "ip ospf bfd 3 250 250" command

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-13712
(cherry picked from commit 367b138748e894bbfaae36d1cf7c90eafebfebc9)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agolib: use traditional yacc empty statement
David Lamparter [Tue, 29 Nov 2016 13:45:49 +0000 (14:45 +0100)]
lib: use traditional yacc empty statement

%empty was added in bison 2.7.1, which seems to not be available on some
of the BSDs by default.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years ago*: fix CLI copypasta mixups
David Lamparter [Tue, 29 Nov 2016 12:59:25 +0000 (13:59 +0100)]
*: fix CLI copypasta mixups

Nice clang catch:  ospfd/ospf_vty.c:6710:1: error: all paths through
this function will call itself [-Werror,-Winfinite-recursion]

(same in vtysh/vtysh.c)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years ago*: fix "uninitialized" warnings
David Lamparter [Tue, 29 Nov 2016 12:42:06 +0000 (13:42 +0100)]
*: fix "uninitialized" warnings

reported by clang for:
- cmd_complete_command()
- show_ip_bgp_ipv4()

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years ago*: add #include "command.h" where needed
David Lamparter [Tue, 29 Nov 2016 12:34:52 +0000 (13:34 +0100)]
*: add #include "command.h" where needed

Headers using struct cmd_token should directly include command.h so the
struct is actually defined.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agobgpd/rfpapi: update for new CLI
David Lamparter [Tue, 29 Nov 2016 12:32:34 +0000 (13:32 +0100)]
bgpd/rfpapi: update for new CLI

May contain bugs/mistakes.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agobuild: improve COMMUNITY.md formatting
David Lamparter [Tue, 29 Nov 2016 09:44:17 +0000 (10:44 +0100)]
build: improve COMMUNITY.md formatting

Add a render_md.py helper to convert it to HTML (needs python "markdown"
module installed).

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agobgpd: fix invalid memory access in peer_free()
Renato Westphal [Mon, 28 Nov 2016 17:00:05 +0000 (15:00 -0200)]
bgpd: fix invalid memory access in peer_free()

We shoult not call bgp_unlock() before calling
bgp_delete_connected_nexthop() in the peer_free() function. Otherwise,
if bgp->lock reaches zero, bgp_free() is called and peer->bgp becomes
an invalid pointer in the bgp_delete_connected_nexthop() function.

To fix this, move the call to bgp_unlock() to the end of peer_free().

Bug exposed by commit 37d361e ("bgpd: plug several memleaks").

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agoMerge branch 'stable/2.0'
David Lamparter [Mon, 28 Nov 2016 18:26:28 +0000 (19:26 +0100)]
Merge branch 'stable/2.0'

8 years agobuild: add markdown-ised version of new guidelines
David Lamparter [Mon, 28 Nov 2016 18:25:21 +0000 (19:25 +0100)]
build: add markdown-ised version of new guidelines

This isn't quite done and renders rather badly on markdown_py.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agozebra: plug more memory leaks
Renato Westphal [Mon, 31 Oct 2016 17:15:16 +0000 (15:15 -0200)]
zebra: plug more memory leaks

Try to free all memory explicitly on exit. This should help to detect
new memory leaks in the future with tools like valgrind.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agozebra: loop through all static routes on vrf enable/disable
Renato Westphal [Tue, 1 Nov 2016 09:57:39 +0000 (07:57 -0200)]
zebra: loop through all static routes on vrf enable/disable

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agozebra/lib: remove redundant fields from zebra_vrf
Renato Westphal [Sun, 30 Oct 2016 21:50:26 +0000 (19:50 -0200)]
zebra/lib: remove redundant fields from zebra_vrf

There's no need to duplicate the 'vrf_id' and 'name' fields from the 'vrf'
structure into the 'zebra_vrf' structure. Instead of that, add a back
pointer in 'zebra_vrf' that should point to the associated 'vrf' structure.

Additionally, modify the vrf callbacks to pass the whole vrf structure
as a parameter. This allow us to make further simplifications in the code.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agolib/zebra: put vrf_get() on a diet
Renato Westphal [Sun, 30 Oct 2016 00:44:06 +0000 (22:44 -0200)]
lib/zebra: put vrf_get() on a diet

Also, for some reason we had two functions to search a VRF by its name:
zebra_vrf_lookup_by_name() and zebra_vrf_list_lookup_by_name().  The first
one would loop through vrf_table and the other one through vrf_list. This
is not necessary anymore, so remove zebra_vrf_lookup_by_name() and rename
zebra_vrf_list_lookup_by_name() to zebra_vrf_lookup_by_name().

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agozebra: order VRFs by name on user output
Renato Westphal [Sat, 29 Oct 2016 22:44:04 +0000 (20:44 -0200)]
zebra: order VRFs by name on user output

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agolib/zebra: convert vrf_list to a red-black tree
Renato Westphal [Sat, 29 Oct 2016 22:30:57 +0000 (20:30 -0200)]
lib/zebra: convert vrf_list to a red-black tree

Since we're already using a red-black tree to store VRFs sorted by their
vrf_id's, create a new tree to store VRFs sorted by their names.

The biggest advantage of doing this is that we reduce the time complexity
of vrf_list_lookup_by_name() from O(n) to O(log n).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years ago*: rename two vrf functions
Renato Westphal [Wed, 2 Nov 2016 14:16:58 +0000 (12:16 -0200)]
*: rename two vrf functions

Since VRFs can be searched by vrf_id or name, make this explicit in the
helper functions.

s/vrf_lookup/vrf_lookup_by_id/
s/zebra_vrf_lookup/zebra_vrf_lookup_by_id/

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agolib: convert vrf code to use red-black trees as well
Renato Westphal [Sat, 29 Oct 2016 16:37:11 +0000 (14:37 -0200)]
lib: convert vrf code to use red-black trees as well

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agolib: convert namespace code to use red-black trees
Renato Westphal [Sat, 29 Oct 2016 01:03:35 +0000 (23:03 -0200)]
lib: convert namespace code to use red-black trees

We definitely need to stop abusing the route table data structure when
it's not necessary.  Convert the namespace code to use red-black trees
instead. This greatly improves code readability.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agozebra: nuke zvrf_list and always use vrf_list instead
Renato Westphal [Sat, 29 Oct 2016 00:26:04 +0000 (22:26 -0200)]
zebra: nuke zvrf_list and always use vrf_list instead

zvrf_list doesn't need to exist, it's basically a duplicate version
of vrf_list.

Also, zebra_vrf_delete() wasn't removing zvrf from zvrf_list, which was
a bug.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agolib: fix creation of pre-provisioned VRFs
Renato Westphal [Fri, 28 Oct 2016 18:53:38 +0000 (16:53 -0200)]
lib: fix creation of pre-provisioned VRFs

If we configure a VRF that doesn't match any device in the kernel, we'll
fall in the first case of the vrf_get() function. In this function,
a vrf structure is callocated and it's vrf_id is never set explicitly,
which means it's set to zero (the vrf-id of the default VRF). When this
happens, commands like "router-id A.B.C.D vrf ..." will act on the
default VRF and not on the pre-provisioned VRF.  To fix this, always
set the vrf_id of pre-provisioned VRFs to VRF_UNKNOWN.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agozebra/lib: move some code around
Renato Westphal [Sat, 29 Oct 2016 00:32:07 +0000 (22:32 -0200)]
zebra/lib: move some code around

* move netlink code from zebra_nc.c to kernel_netlink.c;
* move vrf CLI commands from if.c/interface.c to vrf.c/zebra_vrf.c;
* move declaration of the 'ns' structure to a header file.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agolib: remove unused ns code
Renato Westphal [Wed, 26 Oct 2016 14:58:32 +0000 (12:58 -0200)]
lib: remove unused ns code

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agozebra/lib: plug several memleaks
Renato Westphal [Tue, 1 Nov 2016 20:57:53 +0000 (18:57 -0200)]
zebra/lib: plug several memleaks

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agobgpd: release all memory explicitly on exit
Renato Westphal [Tue, 25 Oct 2016 02:04:24 +0000 (00:04 -0200)]
bgpd: release all memory explicitly on exit

8 years agobgpd: plug several memleaks
Renato Westphal [Fri, 21 Oct 2016 22:13:51 +0000 (20:13 -0200)]
bgpd: plug several memleaks

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agobgpd: reuse sockunion2hostprefix() on bgp_nht.c
Renato Westphal [Wed, 2 Nov 2016 02:29:46 +0000 (00:29 -0200)]
bgpd: reuse sockunion2hostprefix() on bgp_nht.c

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agobgpd: optimize copy of strings on peer_xfer_conn()
Renato Westphal [Tue, 1 Nov 2016 09:37:50 +0000 (07:37 -0200)]
bgpd: optimize copy of strings on peer_xfer_conn()

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agobgpd: use loops to reduce code duplication
Renato Westphal [Mon, 24 Oct 2016 23:53:37 +0000 (21:53 -0200)]
bgpd: use loops to reduce code duplication

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
8 years agobuild: ditch outdated documents, including HACKING
David Lamparter [Mon, 28 Nov 2016 18:03:10 +0000 (19:03 +0100)]
build: ditch outdated documents, including HACKING

To be re-added with a clean slate.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agobuild: bump version to 2.0-rc0
David Lamparter [Mon, 28 Nov 2016 17:58:52 +0000 (18:58 +0100)]
build: bump version to 2.0-rc0

This isn't quite a release candidate yet, but to get things going let's
set this to "2.0-rc0".

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agobuild: bump version to 2.0.999 for development
David Lamparter [Mon, 28 Nov 2016 17:55:31 +0000 (18:55 +0100)]
build: bump version to 2.0.999 for development

2.0 will be the release just forked off, so this can be 2.0.999 to flag
it as in-progress tree.

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

8 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

8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>