zebra: install MPLS CLI commands only if MPLS is enabled.
To keep things simple, zebra's code should be the same whether MPLS
is enabled or not. Then, when MPLS is not enabled, we just disable all
MPLS CLI commands. This way we don't need to add a lot of #ifdef cruft
in zebra's core, improving code readability.
Quagga: Fix MPLS LSP scheduling to follow nexthop route update
Fix LSP scheduling to occur only after routes are processed because
the LSP resolution depends on the nexthop route being selected. This
is similar to how NHT processing is scheduled.
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Ticket: CM-6743
Reviewed By: CCR-3233
Testing Done: Verified the failed test multiple times.
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
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.
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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)
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)
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.
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>
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.
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.
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).
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.
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)
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)
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).
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.
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>
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>
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