]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
8 years agoQuagga: Install label forwarding entries for statically configured LSPs
vivek [Sat, 16 Apr 2016 02:19:37 +0000 (19:19 -0700)]
Quagga: Install label forwarding entries for statically configured LSPs

Install the statically configured LSPs into the FIB (kernel). This is done
using the new attributes and definitions for MPLS in the kernel -
RTA_VIA, RTA_NEWDST and AF_MPLS.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket:  CM-4804
Reviewed By: CCR-3088
Testing Done: Manual in SE-1

8 years agoQuagga: Fix alignment in netlink messages in some cases
vivek [Fri, 15 Apr 2016 20:32:23 +0000 (13:32 -0700)]
Quagga: Fix alignment in netlink messages in some cases

The alignment of nlmsg_len is calculated wrong leading to wrong rta_len
calculations for nested TLVs when the data length of the last TLV added
to the nested TLV is not aligned to RTA_ALIGNTO already. Use same fix
that was implemented in iproute2 by Thomas Graf circa 2005. A reference
to the fix is at
http://oss.sgi.com/archives/netdev/2005-03/msg03103.html.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-6491
Reviewed By: CCR-3087
Testing Done: MPLS testing with other patches in SE-1

Note: Prior to MPLS, we didn't face this problem as we haven't really had
any nested TLVs; even if RTA_MULTIPATH were to be considered a nested TLV,
it didn't have any non-aligned fields.

8 years agoQuagga: Static LSP configuration
vivek [Fri, 15 Apr 2016 17:51:56 +0000 (10:51 -0700)]
Quagga: Static LSP configuration

Add support for statically configuring MPLS transit LSPs. This allows the
configuration of ILM to one or more NHLFE, as defined in RFC 3031. The
currently supported nexthop types are IPv4 or IPv6.

The two label operations supported are swap and PHP; the latter is configured
by specifying the out-label as "implicit-null". Note that the operation is
against the label, so it should be the same for all NHLFEs.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-4804, ...
Reviewed By: CCR-3085
Testing Done: In combination with other patches

8 years agoQuagga: Definitions for static LSPs
vivek [Fri, 15 Apr 2016 17:29:51 +0000 (10:29 -0700)]
Quagga: Definitions for static LSPs

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-4804, ...
Reviewed By: CCR-3084
Testing Done: Not relevant

8 years agoQuagga: Basic definitions for MPLS
vivek [Fri, 15 Apr 2016 17:13:31 +0000 (10:13 -0700)]
Quagga: Basic definitions for MPLS

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-4804, ...
Reviewed By: CCR-3083
Testing Done: Not relevant

8 years agobgp: Fix incorrect cli
Donald Sharp [Fri, 23 Sep 2016 13:06:24 +0000 (09:06 -0400)]
bgp: Fix incorrect cli

The optional parameter was entered as {JSON}
when it should have been {json}

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agobgpd: Additional Show Commands
Lou Berger [Wed, 21 Sep 2016 13:51:30 +0000 (09:51 -0400)]
bgpd: Additional Show Commands

These commands were ported forward from these
commits:
f9b6c39 bgpd: Add back old forms of 'show <afi> <safi>' for compatibility
bf1ae6c bgpd: drop machineparse / random "show" improvements
651b402 bgpd: encap show commands
35c3686 bgpd: VPNv6 show commands
135ca15 bgpd: cleanup vty bgp_node_afi/safi utils

This is the first drop of those commits.  The files have
changed too much and the diffs to extensive to try to do it
in one piece.  Break it up into smaller code chunks.

Original Code:
Signed-off-by: Lou Berger <lberger@labn.net>
Forward Port:
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agolib: Add #define str for JavaScript help string
Donald Sharp [Wed, 21 Sep 2016 12:48:04 +0000 (08:48 -0400)]
lib: Add #define str for JavaScript help string

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoospfd: Do not print warning on new interface
Donald Sharp [Tue, 20 Sep 2016 07:11:02 +0000 (03:11 -0400)]
ospfd: Do not print warning on new interface

The new TE functions will always print out a warning
that TE has not been configured on an interface.  This
should be a debug not a warn.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agobgpd: Revert --enable-bgp-standalone
Donald Sharp [Tue, 20 Sep 2016 11:57:41 +0000 (07:57 -0400)]
bgpd: Revert --enable-bgp-standalone

Reverts the --enable-bgp-standalone and makes it so that you
need to use --enable-cumulus to get the cumulus behavior.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agovtysh: work around gcc bug #69981
David Lamparter [Tue, 16 Aug 2016 15:48:44 +0000 (17:48 +0200)]
vtysh: work around gcc bug #69981

The memtypes changes break gcc -O0 build (none of the other optimisation
levels are affected, *any* of -Og, -Os, -O1, etc. make this go away).
Unfortunately, the option supposed to control this doesn't actually work
(-fno-keep-static-const; that not working is the actual gcc bug).

The workaround is to avoid DECLARE_MTYPE statements when their paired
DEFINE_MTYPE isn't linked in.  Thankfully, that's only a problem in a
single place in vtysh where bgp_memory.h gets chain-included.
(vtysh.c -> bgp_vty.h -> bgpd.h -> bgp_memory.h)

So, this just breaks the chain at bgp_vty.h.

No other compiler (clang & icc tested) has exhibited this problem.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agolib: deregister memtypes on exit/unload
David Lamparter [Sun, 20 Mar 2016 09:09:18 +0000 (10:09 +0100)]
lib: deregister memtypes on exit/unload

This is useful for DSO modules in order to get support for unloading
them dynamically.  It also runs on exit, which doesn't matter much.

At some future point, the code could be extended to check that
allocation counts are 0 on unloading a module.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agobuild: goodbye, gawk
David Lamparter [Fri, 29 May 2015 03:16:41 +0000 (05:16 +0200)]
build: goodbye, gawk

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agolib: clean/restore memory debugging functions
David Lamparter [Thu, 11 Feb 2016 16:12:44 +0000 (17:12 +0100)]
lib: clean/restore memory debugging functions

This adapts the dump-at-exit handler and removes the old leftover code.

(Note the text in log_memtype_stderr was actually incorrect as the only
caller in bgpd cleans up configuration before calling it, i.e. any
remaining allocations are missing-cleanup bugs.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years ago*: split & distribute memtypes and stop (re|ab)using lib/ MTYPEs
David Lamparter [Fri, 29 May 2015 03:48:31 +0000 (05:48 +0200)]
*: split & distribute memtypes and stop (re|ab)using lib/ MTYPEs

This is a rather large mechanical commit that splits up the memory types
defined in lib/memtypes.c and distributes them into *_memory.[ch] files
in the individual daemons.

The zebra change is slightly annoying because there is no nice place to
put the #include "zebra_memory.h" statement.

bgpd, ospf6d, isisd and some tests were reusing MTYPEs defined in the
library for its own use.  This is bad practice and would break when the
memtype are made static.

Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
[CF: rebased for cmaster-next]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
8 years agolib: migrate to new memory-type handling
David Lamparter [Wed, 6 Jan 2016 09:37:22 +0000 (10:37 +0100)]
lib: migrate to new memory-type handling

Move over to the new allocation counting added in the previous commit.

(This commit is mostly mechanical.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
8 years agolib: add new extensible memory-type handling
David Lamparter [Wed, 27 May 2015 01:45:30 +0000 (03:45 +0200)]
lib: add new extensible memory-type handling

This rewrites Quagga's memory per-type allocation counting, without
using a fixed global list of types.  Instead, source files can declare
memory types which get handled through constructor functions called by
the dynamic linker during startup.

Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
[DL: v3: forgot "nonnull" attribute on XFREE]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agolib: move memory.[ch] out of the way
David Lamparter [Fri, 29 May 2015 02:32:33 +0000 (04:32 +0200)]
lib: move memory.[ch] out of the way

The following commit will recreate memory.[ch].

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoisisd, lib, vtysh: Allow extract.pl to fully work
Donald Sharp [Sat, 17 Sep 2016 11:25:35 +0000 (07:25 -0400)]
isisd, lib, vtysh: Allow extract.pl to fully work

The regular expression for finding DEFUN/ALIAS in
extract.pl looks for "DEFUN (" or "ALIAS (" if
the *.c file does not have this then it will just
silently ignore the cli.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoisisd, vtysh: Fix isis routemaps
Donald Sharp [Sat, 17 Sep 2016 11:11:19 +0000 (07:11 -0400)]
isisd, vtysh: Fix isis routemaps

Apparently extract.pl requires in it's regular expression
a space after the DEFUN or ALIAS before the opening (
or it completely skips the command.  Brilliant?

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoisisd: Remove duplicate "no debug isis lsp-gen"
Donald Sharp [Sat, 17 Sep 2016 02:21:29 +0000 (22:21 -0400)]
isisd: Remove duplicate "no debug isis lsp-gen"

The code for 'no debug isis lsp-gen' is in
isisd.c twice.  No need for this.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agolib, bgpd: Remove 'struct fifo' from lib/zebra.h
Donald Sharp [Fri, 8 Jan 2016 12:37:14 +0000 (07:37 -0500)]
lib, bgpd: Remove 'struct fifo' from lib/zebra.h

The 'struct fifo' and it's accompanying #defines do not
belong in lib/zebra.h.  Move them into their own header.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit b0d02889624eaafa0984873dcd78c086418bdf13)

8 years agolib: Remove ZEBRA_INTERFACE_RENAME
Donald Sharp [Sat, 17 Sep 2016 01:07:28 +0000 (21:07 -0400)]
lib: Remove ZEBRA_INTERFACE_RENAME

Api in name only.  No code, so let's remove.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agolib, ospfd: Remove ospf specific #define from zebra.h
Donald Sharp [Sat, 17 Sep 2016 00:59:35 +0000 (20:59 -0400)]
lib, ospfd: Remove ospf specific #define from zebra.h

zebra.h should not know or care about ospf specific code

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agozebra: Fix afi mistake
Donald Sharp [Sat, 17 Sep 2016 00:45:35 +0000 (20:45 -0400)]
zebra: Fix afi mistake

When sending the received route in to be added to the rib,
actually use the correct Address family.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agozebra: Refactor interface statistic calling
Donald Sharp [Sat, 6 Feb 2016 02:17:08 +0000 (21:17 -0500)]
zebra: Refactor interface statistic calling

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agolib, zebra: Remove ZEBRA_IPV[4|6]_IMPORT_NEXTHOP
Donald Sharp [Wed, 14 Sep 2016 23:13:11 +0000 (19:13 -0400)]
lib, zebra: Remove ZEBRA_IPV[4|6]_IMPORT_NEXTHOP

Zebra api that was never used.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit 33361d3992c8bff66247b76e5adaf4b0de8217df)

8 years agolib, zebra: Remove unused zserv/zclient calls
Donald Sharp [Wed, 14 Sep 2016 20:04:07 +0000 (16:04 -0400)]
lib, zebra: Remove unused zserv/zclient calls

ZEBRA_IPV4_NEXTHOP_LOOKUP and ZEBRA_IPV6_NEXTHOP_LOOKUP
were never used by any protocol.  Remove dead code

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit 22cd6214bf44863bfb5a34b40ab4abba3c5c4574)

8 years agolib: Make zebra messages types a enum
Donald Sharp [Wed, 14 Sep 2016 19:57:31 +0000 (15:57 -0400)]
lib: Make zebra messages types a enum

The #define nature of zebra message types makes
it stupidly difficult to add /remove message
types.  Switch to enum

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit 0d63e3c7df981f5b50f27789672f30987911a8cd)

8 years agozebra: Pass in vrf to rib_match_ipv4_multicast
Donald Sharp [Wed, 14 Sep 2016 19:34:25 +0000 (15:34 -0400)]
zebra: Pass in vrf to rib_match_ipv4_multicast

Pass around the vrf_id to rib_match_ipv4_multicast
so that proper lookup can be maintained.  Not really
needed yet, but future fixing now.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agozebra: Fix broken rib_match
Donald Sharp [Wed, 14 Sep 2016 19:17:50 +0000 (15:17 -0400)]
zebra: Fix broken rib_match

rib_match is broken because the prefix is being
treated as a char * pointer instead of the
correct data type.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit 8b5d6c95781b7c55faa957a2d3edf00c1ecb5c5a)

8 years agozebra: Refactor nexthop sending
Donald Sharp [Wed, 14 Sep 2016 12:23:27 +0000 (08:23 -0400)]
zebra: Refactor nexthop sending

When building a stream of nexthop information,
refactor the code that writes it to 1 function.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
8 years agoUpdate isis_te.[c,h] to newly RFC7810
Olivier Dugeon [Tue, 14 Jun 2016 13:57:31 +0000 (15:57 +0200)]
Update isis_te.[c,h] to newly RFC7810
  draft-ietf-isis-te-metric-extensions-11 has been published as RFC 7810

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
(cherry picked from commit b2d48d2838ef4813f4c7c7d0ce1d55dc25e3acf1)

8 years agoospfd: Fix malformed link TLV when LP_USE_BW is set
David Lebrun [Tue, 24 May 2016 09:02:43 +0000 (11:02 +0200)]
ospfd: Fix malformed link TLV when LP_USE_BW is set

(cherry picked from commit 6e88e97786e1223e2b59a995ec330c1f49c55b26)

8 years agodoc: Get isisd.text included properly
Donald Sharp [Tue, 13 Sep 2016 19:43:54 +0000 (15:43 -0400)]
doc: Get isisd.text included properly

When building from a 'make dist' allow
the proper distribution of the new
isisd.texi to build documentation properly.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agolib: Fix tab completions memleak, memory stats corruption
Quentin Young [Fri, 9 Sep 2016 21:58:33 +0000 (21:58 +0000)]
lib: Fix tab completions memleak, memory stats corruption

Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
8 years agoMerge branch 'cmaster-next' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into...
Daniel Walton [Fri, 9 Sep 2016 20:25:24 +0000 (20:25 +0000)]
Merge branch 'cmaster-next' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster-next

8 years agoUnable to remove route-map from quagga
Daniel Walton [Fri, 9 Sep 2016 20:24:31 +0000 (20:24 +0000)]
Unable to remove route-map from quagga

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

pim was missing route-map hooks

8 years agobgpd: Add flag to not change e{u,g}id on startup and run as unprivileged user
Lou Berger [Tue, 6 Sep 2016 14:52:31 +0000 (10:52 -0400)]
bgpd: Add flag to not change e{u,g}id on startup and run as unprivileged user

* bgp_main.c: add -S / --skip_runas flag to not change effective user/group
  on start up.  Enables bgpd to be run by unprivileged user.

8 years agobgpd: Fix startup a bit more
Donald Sharp [Fri, 9 Sep 2016 20:01:27 +0000 (16:01 -0400)]
bgpd: Fix startup a bit more

There were several issues here.  The zprivs_init is being
called *before* the cli is read in to influence the user
we are running as.  This needs to be rectified.  Additionally
we need to move the log creation till after cli arguments
are read.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoospfd: Fix crash with usage of incorrect command
Donald Sharp [Fri, 9 Sep 2016 16:41:35 +0000 (12:41 -0400)]
ospfd: Fix crash with usage of incorrect command

Entering 'show ip ospf interface json' causes ospf
to crash.

Entering 'show ip ospf interface <intf> json' causes
ospf to crash if intf has no neighbors on the otherside

Modify the code to not crash in these cases.

Ticket: CM-12776
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
8 years agovrf: add a runtime check before playing with netns
Nicolas Dichtel [Thu, 3 Sep 2015 08:47:43 +0000 (10:47 +0200)]
vrf: add a runtime check before playing with netns

This patch adds a runtime check to determine if netns are available. Some
systems like OpenWRT have the system call setns() but don't have the kernel
option CONFIG_NET_NS enabled.

Reported-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Tested-by: Christian Franke <chris@opensourcerouting.org>
(cherry picked from commit 04a3aabf58d95d01c4c8168eeff43cf9d9892eee)

8 years agolib, vtysh: support multiple VRFs by using linux netns
Feng Lu [Thu, 3 Jul 2014 10:24:34 +0000 (18:24 +0800)]
lib, vtysh: support multiple VRFs by using linux netns

We realize VRFs with linux netns by default. The main job is
to associate a VRF with a netns. Currently this is done by
the configuration:

  [no] vrf N netns <netns-name>

This command is also available in vtysh and goes to only
zebra, because presently only zebra supports multiple VRF.

A file descriptor is added to "struct vrf". This is for the
associated netns file. Once the command "vrf N netns NAME"
is executed, the specified file is opened and the file
descriptor is stored in the VRF N. In this way the
association is formed.

In vrf_socket(), we first switch to the specified VRF by
using the stored file descriptor, and then can allocate
a socket which is working in the associated netns.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
(cherry picked from commit 55cfa2f190620f7c711944637659bc208970324d)

8 years agolib: Create ns.c
Donald Sharp [Sun, 4 Sep 2016 00:45:35 +0000 (20:45 -0400)]
lib: Create ns.c

Create the ns.c files from the original vrf.c code
to allow us to create the 'logical-router' command
to work within namespaces.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agozebra: assorted parts of 0abf6796c
Christian Franke [Wed, 24 Aug 2016 15:09:14 +0000 (17:09 +0200)]
zebra: assorted parts of 0abf6796c

    Author: Timo Teräs <timo.teras@iki.fi>
    Date:   Fri Jan 15 17:36:29 2016 +0200

        zebra: atomic FIB updates

        This commit updates the kernel API so that route changes are
        atomically updated using change/replaces messages instead
        of first sending a withdraw followed with update.

        Same for zclient updates, changes are sent as single ADD
        instead of DELETE + ADD.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
8 years agozebra: remove unused code from zebra netlink
Christian Franke [Wed, 24 Aug 2016 13:32:00 +0000 (15:32 +0200)]
zebra: remove unused code from zebra netlink

8 years agobgpd: Allow connections with no v4|6 addr's in some conditions
Donald Sharp [Fri, 9 Sep 2016 15:02:54 +0000 (11:02 -0400)]
bgpd: Allow connections with no v4|6 addr's in some conditions

When compiling/running in with --enable-bgp-standalone=yes allow
v4 sessions to be established with no v4 address configured.
Additionally allow v6 connections with no v6 addresses
configured.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agobgpd: Display 'no neighbor 192.168.33.44 activate'
Donald Sharp [Fri, 9 Sep 2016 13:46:28 +0000 (09:46 -0400)]
bgpd: Display 'no neighbor 192.168.33.44 activate'

Since the default for ipv4 unicast is to now assume
that the neighbor is activated, print out the
no neighbor 192.168.33.44 activate
line when it is explicitly turned off.

Ticket: CM-12809
Reported-by: Lou Berger <lberger@labn.net>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:

8 years agobgpd: Fix standalone to better handle getsockopt failure
Donald Sharp [Fri, 9 Sep 2016 12:48:23 +0000 (08:48 -0400)]
bgpd: Fix standalone to better handle getsockopt failure

When getsockopt(...,SO_BINDTODEVICE,...); fails
assume the bgp instance we are interested is the default
one.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoquagga: remove refix directory from git status
Donald Sharp [Fri, 19 Aug 2016 18:46:34 +0000 (14:46 -0400)]
quagga: remove refix directory from git status

During one of our build processes we are getting
a refix directory in some places.  Remove these
from files that git considers

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit 844cbf5d6cdfc6961e99e1c9ed35b826f3aa7562)

8 years agoMerge remote-tracking branch 'origin/cmaster' into cmaster-next
Donald Sharp [Thu, 8 Sep 2016 23:37:42 +0000 (19:37 -0400)]
Merge remote-tracking branch 'origin/cmaster' into cmaster-next

8 years agobgpd: Allow bgp to work standalone
Donald Sharp [Thu, 8 Sep 2016 22:48:02 +0000 (18:48 -0400)]
bgpd: Allow bgp to work standalone

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoquagga-reload.py fails for "net add debug ospf6 lsa as-ext"
Daniel Walton [Thu, 8 Sep 2016 13:16:25 +0000 (13:16 +0000)]
quagga-reload.py fails for "net add debug ospf6 lsa as-ext"

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

- change "as-ext" to "as-external"
- drop "grp-mbr" option, it does not have a handler
- drop "type7" option, it does not have a handler

(cherry picked from commit 51f2d198c24107a91a32764bf0930c2d50954574)

8 years agobgpd: Process directly connected IBGP peers upon interface down
vivek [Thu, 8 Sep 2016 17:03:30 +0000 (10:03 -0700)]
bgpd: Process directly connected IBGP peers upon interface down

When we have a single-hop BFD session for any peering, it really means
that the peering is directly connected (maybe over a L2 network), whether
it is IBGP or EBGP. In such a case, upon link down, immediately process
IBGP peers too (and bring them down), not just EBGP peers.

This change eliminates some peculiar state transitions in specific IBGP
topologies, thus getting rid of the problem of nexthops remaining inactive
in the zebra RIB.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Ticket: CM-12390
Reviewed By: CCR-5156
Testing Done: Manual, bgp-smoke

8 years agolib, bgpd: Log next hops
vivek [Thu, 8 Sep 2016 16:38:53 +0000 (09:38 -0700)]
lib, bgpd: Log next hops

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Ticket: CM-12390
Reviewed By: CCR-5156
Testing Done: Manual

8 years agoquagga-reload.py fails for "net add debug ospf6 lsa as-ext"
Daniel Walton [Thu, 8 Sep 2016 13:16:25 +0000 (13:16 +0000)]
quagga-reload.py fails for "net add debug ospf6 lsa as-ext"

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

- change "as-ext" to "as-external"
- drop "grp-mbr" option, it does not have a handler
- drop "type7" option, it does not have a handler

8 years agobgpd: Enhance path selection logs
vivek [Mon, 5 Sep 2016 17:53:06 +0000 (10:53 -0700)]
bgpd: Enhance path selection logs

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Ticket: CM-12390
Reviewed By: CCR-5136
Testing Done: Manual

(cherry picked from commit a6086ad4084a9dfbf930ef48e2987772767063bd)

8 years agobgpd: Fix route install upon multipath nexthop change
vivek [Mon, 5 Sep 2016 17:49:16 +0000 (10:49 -0700)]
bgpd: Fix route install upon multipath nexthop change

In multipath selection, there can be a scenario where the set of route
entries selected as multipath can be the same (i.e., from the same peers)
but one or more of these may have a change to the BGP next hop. In this
case, the route needs to be installed again in zebra even if the best
route entry selected has not changed, otherwise the zebra RIB may have
a different set of next hops (and first hops) than what the routing
protocol selected.

This patch handles this scenario by re-installing the route if any BGP
attribute has changed for any of the multipaths. Not all BGP attributes
are of relevance to the zebra RIB, but this approach follows existing
logic used in the code (e.g., when BGP attributes for the best route
entry has changed).

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Sid Khot <sidkhot@cumulusnetworks.com>
Ticket: CM-12390
Reviewed By: CCR-5135
Testing Done: Manual, bgp-smoke

(cherry picked from commit e10720512ef744483ffed8a6ef3b529ec97e130d)

8 years agobgpd: Fix route install upon non-best nexthop change
vivek [Mon, 5 Sep 2016 17:35:19 +0000 (10:35 -0700)]
bgpd: Fix route install upon non-best nexthop change

After BGP path selection, even if the best route entry selected has not
changed, ensure that the route is installed again in zebra if any non-best
but multipath route entry has a nexthop resolution change.

In the absence of this fix, if a non-best multipath route entry had a
nexthop resolution change (such as being resolved over two first hops instead
of one), the route would get reinstalled into zebra only in some situations
(i.e., when the best route entry had its IGP change flag set). If the route
does not get reinstalled by BGP, the corresponding route in the zebra RIB
would not have all the first hops.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Sid Khot <sidkhot@cumulusnetworks.com>
Ticket: CM-12390
Reviewed By: CCR-5134
Testing Done: Manual, bgp-smoke

(cherry picked from commit 3064bf43a7d8162dadada2934132f915a45d2bcb)

8 years agoQuagga won't advertise 0.0.0.0/0 with network statement
Daniel Walton [Wed, 31 Aug 2016 12:31:47 +0000 (12:31 +0000)]
Quagga won't advertise 0.0.0.0/0 with network statement

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-12561
(cherry picked from commit 337299a936d9db8951825dcbf3acc4bd3b89ac32)

8 years agozebra: Line up help output better
Donald Sharp [Tue, 6 Sep 2016 19:31:24 +0000 (15:31 -0400)]
zebra: Line up help output better

The -g, --group   line of help didn't line up properly with
the other help output of zebra.  Fix this.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agojson support for "show ip route" for "show ipv6 route"
Daniel Walton [Mon, 29 Aug 2016 19:59:53 +0000 (19:59 +0000)]
json support for "show ip route" for "show ipv6 route"

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-12633
(cherry picked from commit 18a4ded2a72cc5613f54845dd29c1ee7d05bbf04)

8 years agobgpd: Fix call of bgp_address_destroy
Donald Sharp [Tue, 6 Sep 2016 00:03:19 +0000 (20:03 -0400)]
bgpd: Fix call of bgp_address_destroy

We were prematurely deleting the bgp->address_hash.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agobgpd: Enhance path selection logs
vivek [Mon, 5 Sep 2016 17:53:06 +0000 (10:53 -0700)]
bgpd: Enhance path selection logs

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Ticket: CM-12390
Reviewed By: CCR-5136
Testing Done: Manual

8 years agobgpd: Fix route install upon multipath nexthop change
vivek [Mon, 5 Sep 2016 17:49:16 +0000 (10:49 -0700)]
bgpd: Fix route install upon multipath nexthop change

In multipath selection, there can be a scenario where the set of route
entries selected as multipath can be the same (i.e., from the same peers)
but one or more of these may have a change to the BGP next hop. In this
case, the route needs to be installed again in zebra even if the best
route entry selected has not changed, otherwise the zebra RIB may have
a different set of next hops (and first hops) than what the routing
protocol selected.

This patch handles this scenario by re-installing the route if any BGP
attribute has changed for any of the multipaths. Not all BGP attributes
are of relevance to the zebra RIB, but this approach follows existing
logic used in the code (e.g., when BGP attributes for the best route
entry has changed).

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Sid Khot <sidkhot@cumulusnetworks.com>
Ticket: CM-12390
Reviewed By: CCR-5135
Testing Done: Manual, bgp-smoke

8 years agobgpd: Fix route install upon non-best nexthop change
vivek [Mon, 5 Sep 2016 17:35:19 +0000 (10:35 -0700)]
bgpd: Fix route install upon non-best nexthop change

After BGP path selection, even if the best route entry selected has not
changed, ensure that the route is installed again in zebra if any non-best
but multipath route entry has a nexthop resolution change.

In the absence of this fix, if a non-best multipath route entry had a
nexthop resolution change (such as being resolved over two first hops instead
of one), the route would get reinstalled into zebra only in some situations
(i.e., when the best route entry had its IGP change flag set). If the route
does not get reinstalled by BGP, the corresponding route in the zebra RIB
would not have all the first hops.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Sid Khot <sidkhot@cumulusnetworks.com>
Ticket: CM-12390
Reviewed By: CCR-5134
Testing Done: Manual, bgp-smoke

8 years agoisisd: Remove impossible code
Donald Sharp [Mon, 5 Sep 2016 00:13:43 +0000 (20:13 -0400)]
isisd: Remove impossible code

te->sub_tlvs can never be NULL as that it is an
array.  Remove dead code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agobgpd: Fix crash in 'show ip nexthop'
Donald Sharp [Mon, 5 Sep 2016 00:05:16 +0000 (20:05 -0400)]
bgpd: Fix crash in 'show ip nexthop'

With the addition of the AFI_ETHER we need
to initialize the appropriate tables for
nexthop's.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agozebra: Remove unnecessary log
Donald Sharp [Sun, 4 Sep 2016 22:46:27 +0000 (18:46 -0400)]
zebra: Remove unnecessary log

Removing unnecessary zlog_info line from
zebra.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agobgpd: fix bug in ecommunity_match
Renato Westphal [Wed, 27 Jun 2012 20:18:08 +0000 (17:18 -0300)]
bgpd: fix bug in ecommunity_match

The offset used to compare extended communities should be increased by
steps of ECOMMUNITY_SIZE and not one by one.

8 years agobgpd: Addition of bgp dampening configuration commands under IPv4 Multicast address...
Balaji [Wed, 20 Jan 2016 17:29:27 +0000 (22:59 +0530)]
bgpd: Addition of bgp dampening configuration commands under IPv4 Multicast address family mode.

Signed-off-by: Balaji Gurudoss <balajig81@gmail.com>
Signed-off-by: Balaji Gurudoss <balajig81@gmail.com>
Tested-by: NetDEF CI System <cisystem@netdef.org>
8 years agobgpd: Addition of dampening show commands under v4 unicast/multicast tree
Balaji [Wed, 20 Jan 2016 17:29:26 +0000 (22:59 +0530)]
bgpd: Addition of dampening show commands under v4 unicast/multicast tree

Patch contains addition of show ip bgp ipv4 (unicast| multicast)
dampening tree.

Signed-off-by: Balaji Gurudoss <balajig81@gmail.com>
Signed-off-by: Balaji Gurudoss <balajig81@gmail.com>
8 years agobuild: detect and create AM_SILENT_RULES macro if needed
Pawel Wieczorkiewicz [Fri, 1 Apr 2016 10:54:38 +0000 (12:54 +0200)]
build: detect and create AM_SILENT_RULES macro if needed

Older libs have problem with that:
configure.ac:17: warning: macro `AM_SILENT_RULES'
  not found in library
...
configure.ac:24: error: possibly undefined macro:
   AM_SILENT_RULES
Tested-by: NetDEF CI System <cisystem@netdef.org>
8 years agobgpd: Add new configuration cli for graceful restart.
Philippe Guibert [Tue, 24 May 2016 14:52:02 +0000 (16:52 +0200)]
bgpd: Add new configuration cli for graceful restart.

There is support to configure graceful restart timer. This is the
time to wait to delete stale routes before a BGP open message is
received.

bgp graceful-restart restart-time <1-3600>
no bgp graceful-restart [<1-255>]

* bgpd/bgp_vty.c
  * Define command strings for above CLI
* bgpd/bgpd.c
  * bgp_config_write(): Output graceful restart-time configuration

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Tested-by: NetDEF CI System <cisystem@netdef.org>
8 years agobgpd: fix wrong help strings of "match peer" and "no match peer" commands
Igor Ryzhov [Wed, 11 May 2016 12:26:39 +0000 (15:26 +0300)]
bgpd: fix wrong help strings of "match peer" and "no match peer" commands

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Tested-by: NetDEF CI System <cisystem@netdef.org>
8 years agolib: add AF_ETHERNET/AFI_ETHER
Lou Berger [Tue, 19 Apr 2016 20:08:59 +0000 (16:08 -0400)]
lib: add AF_ETHERNET/AFI_ETHER

8 years agolib: dump memory stats on core
Lou Berger [Tue, 19 Apr 2016 16:42:25 +0000 (12:42 -0400)]
lib: dump memory stats on core

8 years agobgp: add "debug bgp allow-martians" next hops and related code/commands
Lou Berger [Sat, 7 May 2016 14:35:21 +0000 (10:35 -0400)]
bgp: add "debug bgp allow-martians" next hops and related code/commands

8 years agobgpd: cleanup clang uninitialized variable warning
Lou Berger [Wed, 20 Apr 2016 12:11:05 +0000 (08:11 -0400)]
bgpd: cleanup clang uninitialized variable warning

8 years agolib: fix memory leak in zprivs_caps_init
Lou Berger [Fri, 6 May 2016 21:20:25 +0000 (17:20 -0400)]
lib: fix memory leak in zprivs_caps_init

8 years agoAdd support Router Capabilities support to OSPF
Olivier Dugeon [Tue, 19 Apr 2016 17:21:17 +0000 (19:21 +0200)]
Add support Router Capabilities support to OSPF

This is an implementation of RFC4970 (Router Information) and
RFC5088 (PCE Capabilities announcement)

* ospfd/Makefile.am: Add new file ospf_ri.c and ospf_ri.h
* ospfd/ospf_opaque.c: Add new Router Capabilities code point
* ospfd/ospf_ri.[c,h]: Implementation of RFC4970 & RFC5088

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
8 years agoUpdate documentation for Traffic Engineering
Olivier Dugeon [Tue, 19 Apr 2016 17:18:18 +0000 (19:18 +0200)]
Update documentation for Traffic Engineering

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
8 years agoAdd support of Traffic Engineering to IS-IS
Olivier Dugeon [Tue, 19 Apr 2016 17:03:05 +0000 (19:03 +0200)]
Add support of Traffic Engineering to IS-IS

These patches is an implementation of RFC5305 that enable the
support of Traffic Engineering in IS-IS

* isisd/Makefile.am: Add new files isis_te.c and isis_te.h
* isisd/isis_circuit.[c,h]: Add new mpls_te_circuit structure to isis_circuit
structure to handle new Traffic Engineering TLVs
* isisd/isis_lsp.c: Update LSP handler to mux/demux Traffic Engineering TLVs
* isisd/isis_main.c: Add initialisation of ISIS TE
* isisd/isis_pdu.c: Update function process_p2p_hello() to retrieve remote IP
address to populate Traffic Engineering TLV.
* isisd/isis_te.[c,]: Implementation of RFC5305
* isisd/isis_tlv.[c,h]: Update TLV definition and function to handle
Traffic Engineering ones
* isisd/isis_zebra.c: Add new function isis_zebra_link_params() to retrieve
the link parameters of interfaces from ZBus to populate the Traffic Engineering
TLVs
* isisd/isisd.[c,h]: Add Traffic Engineering support with new debug command

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
8 years agoUpdate Traffic Engineering Support for OSPFD
Olivier Dugeon [Tue, 19 Apr 2016 14:21:46 +0000 (16:21 +0200)]
Update Traffic Engineering Support for OSPFD

NOTE: I am squashing several commits together because they
do not independently compile and we need this ability to
do any type of sane testing on the patches.  Since this
series builds together I am doing this. -DBS

This new structure is the basis to get new link parameters for
Traffic Engineering from Zebra/interface layer to OSPFD and ISISD
for the support of Traffic Engineering

* lib/if.[c,h]: link parameters struture and get/set functions
* lib/command.[c,h]: creation of a new link-node
* lib/zclient.[c,h]: modification to the ZBUS message to convey the
link parameters structure
* lib/zebra.h: New ZBUS message

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add support for IEEE 754 format

* lib/stream.[c,h]: Add stream_get{f,d} and stream_put{f,d}) demux and muxers to
  safely convert between big-endian IEEE-754 single and double binary
  format, as used in IETF RFCs, and C99.  Implementation depends on host
  using __STDC_IEC_559__, which should be everything we care about.  Should
  correctly error out otherwise.
* lib/network.[c,h]: Add ntohf and htonf converter
* lib/memtypes.c: Add new memeory type for Traffic Engineering support

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add link parameters support to Zebra

* zebra/interface.c:
   - Add new link-params CLI commands
   - Add new functions to set/get link parameters for interface
* zebra/redistribute.[c,h]: Add new function to propagate link parameters
to routing daemon (essentially OSPFD and ISISD) for Traffic Engineering.
* zebra/redistribute_null.c: Add new function
zebra_interface_parameters_update()
* zebra/zserv.[c,h]: Add new functions to send link parameters

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add support of new link-params CLI to vtysh

In vtysh_config.c/vtysh_config_parse_line(), it is not possible to continue
to use the ordered version for adding line i.e. config_add_line_uniq() to print
Interface CLI commands as it completely break the new LINK_PARAMS_NODE.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Update Traffic Engineering support for OSPFD

These patches update original code to RFC3630 (OSPF-TE) and add support of
RFC5392 (Inter-AS v2) & RFC7471 (TE metric extensions) and partial support
of RFC6827 (ASON - GMPLS).

* ospfd/ospf_dump.[c,h]: Add new dump functions for Traffic Engineering
* ospfd/ospf_opaque.[c,h]: Add new TLV code points for RFC5392
* ospfd/ospf_packet.c: Update checking of OSPF_OPTION
* ospfd/ospf_vty.[c,h]: Update ospf_str2area_id
* ospfd/ospf_zebra.c: Add new function ospf_interface_link_params() to get
Link Parameters information from the interface to populate Traffic Engineering
metrics
* ospfd/ospfd.[c,h]: Update OSPF_OPTION flags (T -> MT and new DN)
* ospfd/ospf_te.[c,h]: Major modifications to update the code to new
link parameters structure and new RFCs

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
tmp

8 years agolib, zebra: unify link layer type and hardware address handling
Timo Teräs [Fri, 15 Jan 2016 15:36:33 +0000 (17:36 +0200)]
lib, zebra: unify link layer type and hardware address handling

This removes the BSD specific usage of struct sockaddr_dl
hardware address. This unifies to use explict hw_addr member for
the address, and zebra specific enumeration for the link layer
type.

Additionally the zapi is updated to never send platform specific
structures over the wire, but the ll_type along with hw_addr_len
and hw_addr are now sent for all platforms.

Based on initial work by Paul Jakma.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
# Please enter the commit message for your changes. Lines starting
# with '#' will be kept; you may remove them yourself if you want to.
# An empty message aborts the commit.
#
# Author:    Timo Teräs <timo.teras@iki.fi>
#
# rebase in progress; onto 9c2f85d
# You are currently editing a commit while rebasing branch 'renato' on '9c2f85d'.
#
# Changes to be committed:
# modified:   isisd/isis_circuit.c
# modified:   lib/if.c
# modified:   lib/if.h
# modified:   lib/zclient.c
# modified:   zebra/interface.c
# modified:   zebra/interface.h
# modified:   zebra/kernel_socket.c
# modified:   zebra/rt_netlink.c
# modified:   zebra/rtadv.c
# modified:   zebra/zserv.c
#
# Untracked files:
# "\033\033OA\033OB\033"
# 0001-bgpd-fix-build-on-Solaris.patch
# ldpd/
# redhat/ldpd.init
# redhat/ldpd.service
# tags
#

8 years agoconfig: Give the option of disabling run as user/group
Jafar Al-Gharaibeh [Thu, 28 Jul 2016 19:41:20 +0000 (14:41 -0500)]
config: Give the option of disabling run as user/group

Leave "user/group" unset when explicitly configuring with
"--disable-user" / "--enable-user=no" and
"--disable-group" / "--enable-group=no"
This allows quagga to skip unsupported system calls such
as setuid() on certain platfroms.

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
Tested-by: NetDEF CI System <cisystem@netdef.org>
8 years agovtysh: Fix, guard against NULL pointer dereference
Jafar Al-Gharaibeh [Mon, 1 Aug 2016 23:14:38 +0000 (18:14 -0500)]
vtysh: Fix, guard against NULL pointer dereference

getpwuid() may fail returning a null value leaving subsequent
code vulnerable to a null pointer dereference.

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
Tested-by: NetDEF CI System <cisystem@netdef.org>
8 years agolib/memory: fix indirect static link with zlib
Baruch Siach [Fri, 2 Sep 2016 03:42:08 +0000 (06:42 +0300)]
lib/memory: fix indirect static link with zlib

quagga SNMP support depends on netsnmp, that optionally depends on OpenSSL,
which in turn requires zlib. zlib exports the 'zcalloc' symbol, which collides
with a function of the same name in memory.c. This is not a problem when
linking dynamically, since quagga does not use zlib directly. But static
linking fails with the error:

  CCLD     ospfd
.../output/host/usr/mips64el-buildroot-linux-uclibc/sysroot/usr/lib/libz.a(zutil.o): In function `zcalloc':
zutil.c:(.text+0x48): multiple definition of `zcalloc'
.../output/build/quagga-1.0.20160315/lib/.libs/libzebra.a(memory.o):memory.c:(.text+0x1a0): first defined here

Rename 'zcalloc' to 'zzcalloc' to avoid symbol collision.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
8 years agoconfigure: fix static linking with readline
Thomas Petazzoni [Fri, 2 Sep 2016 03:42:07 +0000 (06:42 +0300)]
configure: fix static linking with readline

When static linking is used, the order of the libraries is important,
and the libraries using a symbol from another library should be listed
*before* the library providing that symbol (see
http://eli.thegreenplace.net/2013/07/09/library-order-in-static-linking)
for details.

When vtysh is linked statically, the command line contains "-lcurses
-lreadline", which causes a build failure due to unresolved
symbols. This is because readline is using symbols from the curses
library: the order should be the opposite.

This patch fixes that problem by putting the -lreadline at the
beginning of the LIBREADLINE variable calcualted by the configure
script.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
8 years agobgpd, lib, ospfd, pimd, zebra: Use nexthop_types_t
Donald Sharp [Fri, 2 Sep 2016 14:32:14 +0000 (10:32 -0400)]
bgpd, lib, ospfd, pimd, zebra: Use nexthop_types_t

Use the 'enum nexthop_types_t' instead of
the zebra.h #defines.  And remove code from
zebra.h that does not belong there.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
8 years agolib: Remove unused ZEBRA_NEXTHOP_IPV4_ONLINK type
Donald Sharp [Fri, 2 Sep 2016 13:38:28 +0000 (09:38 -0400)]
lib: Remove unused ZEBRA_NEXTHOP_IPV4_ONLINK type

Remove the unused ZEBRA_NEXTHOP_IPV4_ONLINK type
from the system.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoquagga-reload.py should be importable
Daniel Walton [Wed, 31 Aug 2016 12:58:46 +0000 (12:58 +0000)]
quagga-reload.py should be importable

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Ticket: CM-12686
(cherry picked from commit a782e613dd44a4447e4a9ef08cfe014e09da2b2f)

8 years agozebra: stack overrun in IPv6 RA receive code (CVE ##TBA##)
David Lamparter [Wed, 31 Aug 2016 11:31:16 +0000 (13:31 +0200)]
zebra: stack overrun in IPv6 RA receive code (CVE ##TBA##)

The IPv6 RA code also receives ICMPv6 RS and RA messages.
Unfortunately, by bad coding practice, the buffer size specified on
receiving such messages mixed up 2 constants that in fact have different
values.

The code itself has:
 #define RTADV_MSG_SIZE 4096
While BUFSIZ is system-dependent, in my case (x86_64 glibc):
 /usr/include/_G_config.h:#define _G_BUFSIZ 8192
 /usr/include/libio.h:#define _IO_BUFSIZ _G_BUFSIZ
 /usr/include/stdio.h:# define BUFSIZ _IO_BUFSIZ

As the latter is passed to the kernel on recvmsg(), it's possible to
overwrite 4kB of stack -- with ICMPv6 packets that can be globally sent
to any of the system's addresses (using fragmentation to get to 8k).

(The socket has filters installed limiting this to RS and RA packets,
but does not have a filter for source address or TTL.)

Issue discovered by trying to test other stuff, which randomly caused
the stack to be smaller than 8kB in that code location, which then
causes the kernel to report EFAULT (Bad address).

Ticket: CM-12687
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit 6a98e6a916c18bb130430d1dcbd9f23a17ac97bd)

8 years agobgpd: Add fix for multiple set commands with prefer-global
root [Tue, 30 Aug 2016 12:59:08 +0000 (08:59 -0400)]
bgpd: Add fix for multiple set commands with prefer-global

In further testing, found that if there were multiple set commands in
the route-map with one being prefer-global, the removal of the prefer-global
was not recognized and reacted to correctly.  This small addition includes
that support

Ticket: CM-11480
Signed-off-by: Don Slice
Reviewed By: Donald Sharp
Testing Done: Manual testing, bgp-min and bgp-smoke completed

(cherry picked from commit 3aef92192569c33906c6a2623d0753c16c0e7a64)

8 years agozebra: refactor zsend_ipv[4|6]_nexthop_lookup
Donald Sharp [Wed, 24 Aug 2016 09:02:22 +0000 (05:02 -0400)]
zebra: refactor zsend_ipv[4|6]_nexthop_lookup

These two functions are functionally equivalent refactor.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agozebra: Remove unused function reference.
Donald Sharp [Wed, 24 Aug 2016 08:05:36 +0000 (04:05 -0400)]
zebra: Remove unused function reference.

The rib_lookup_ipv6 is not implemented. Remove it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agozebra: refactor rib_add_ipv[4|6]_multipath
Donald Sharp [Wed, 24 Aug 2016 08:01:20 +0000 (04:01 -0400)]
zebra: refactor rib_add_ipv[4|6]_multipath

The rib_add_ipv[4|6]_multipath functions are functionally
equivalent.  Refactor to 1 function.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agozebra: Refactor rib_add_ipv[4|6] to a common function
Donald Sharp [Wed, 24 Aug 2016 06:20:47 +0000 (02:20 -0400)]
zebra: Refactor rib_add_ipv[4|6] to a common function

rib_add_ipv[4|6] both were essentially the same function
combine and refactor everywhere.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agozebra: Refactor rib_delete_ipv[4|6]
Donald Sharp [Wed, 24 Aug 2016 05:39:08 +0000 (01:39 -0400)]
zebra: Refactor rib_delete_ipv[4|6]

These two functions are essentially the same.
Refactor.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agozebra: Refactor rib_match_ipv[4|6]
Donald Sharp [Wed, 24 Aug 2016 04:48:37 +0000 (00:48 -0400)]
zebra: Refactor rib_match_ipv[4|6]

the rib_match_ipv4 and rib_match_ipv6 functions were
the same.  Refactor to 1 function.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>