vtysh: fix build against readline 6.3readline 6.3 removes some old deprecated funnily-named types. This
updates vtysh to use the new types so it builds again.
Reported-by: Joel Teichroeb <klusark@archlinux.invalid>
References: https://bugs.archlinux.org/task/39495
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Fix ported over form Mainline Quagga to fix Ubuntu 14.04 build
lib: match route_node_lookup behavior with srcdest_rnode_lookupReturn NULL from srcdest_rnode_lookup if the found route_node has
rn->info == NULL. This is to match the behavior of route_node_lookup.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
lib,zebra: move srcdest_table from zebra_rib into libzebra- make srcdest routing table reusable by putting it into lib
- make the srcdest routing table structure more opaque
- implement a srcdest routing table iterator
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
zebra: netlink: add srcdest route supportThis implements processing the RTA_SRC attribute on routes received from
kernel, passing along the source prefix to the RIB functions, and adds
the attribute on updates to the kernel.
NB: "src" was in use as variable name for the "prefsrc" attribute on
routes, which indicates the preferred source address for IPv4. These
variables have been renamed to "prefsrc".
Signed-off-by: David Lamparter...
zebra: send/use srcdest source prefix in ZAPI/RIBNow that we can represent sourcedest routes, this fixes up the RIB's
usage of prefix data and passes source information down into the kernel
calls and out on ZAPI.
TODO: test on *BSD (NOT compile-checked!)
*: read and ignore srcdest routes on ZAPISince zebra might be sending srcdest routes down to the various daemons,
they need to understand the presence of the field at the very least.
Sadly, that's also the best we can do at this point since none of the
protocols has support for handling srcdest routes. The only consistent
thing to do is to ignore them throughout.
If an administrator wants to have the srcdest route as non-srcdest in ...
zebra: add srcdest helpers & debugThis introduces a helper function to get source and destination prefix
from a given route node (which can be either a destination or a source
route), and extends route node debug logging function.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra: add second-level route_table for srcdestIPv6 srcdest routes need to be keyed by both destination and source
prefix. Since the lookup order is destination first, the simplest thing
to do here is to add a second route_table to destination entries, which
then contain source entries. Sadly, the result is somewhat confusing
since a route_node might now be either a source node or a destination
node.
Signed-off-by: David Lamparter <equin...
lib: add route_node_lookup_maynullThe sourcedest code needs to get the route_node even if its info pointer
is NULL (which occurs when there are srcdest routes, but no general
destination route.)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib: send ZAPI IPv6 source prefixThis introduces ZAPI_MESSAGE_SRCPFX, and if set adds a source prefix
field to ZAPI IPv6 route messages sent from daemons to zebra. The
function calls all have a new prefix_ipv6 * argument specifying the
source, or NULL. All daemons currently supply NULL.
Zebra support for processing the field was added in the previous patch,
however, zebra does not do anything useful with the value yet.
Sig...
zebra: receive ZAPI IPv6 source prefixCheck and read the IPv6 source prefix on ZAPI messages, and pass it down
to the RIB functions (which do nothing with it yet.) Since the RIB
functions now all have a new extra argument, this also updates the
kernel route read functions to supply NULL.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra: factor out rib debug logsIntroduces a logging function that takes a struct route_node * argument,
and prefixes log output with that node's prefix. While this removes
some duplication, it will also later be useful for srcdest route nodes.
Behaviour before and after the patch should be exactly identical.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra: Change the mechanism for comparing route ID's.The current format uses subtraction of two ints. Unfortunately, the
subtraction method does not work for all combinations of numbers.
For example, the with numbers represented by 10.x.x.x and 192.x.x.x,
10.x.x.x - 192.x.x.x will yield a very large positive number indicating
that 10.x.x.x is larger.
Signed-off-by: Ken Williams <kenneth.j.williams@intel.com>
Acked-by: Feng Lu <lu.feng@6wind.com>...
lib: use heap to manage timersSigned-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
tests: Add tests for timersSigned-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/command.c: rewrite command matching/parsingAdd support for keyword commands.
Includes new documentation for DEFUN() in lib/command.h, for preexisting
features as well as new keyword specification.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
tests: fix build & disable testcommandsThe perils of having tests, the test wasn't tested thoroughly enough...
Fixup various automake problems, and then disable it since it depends on
configure parameters in its current version.
For 0.99.24 we can ship a static copy of vtysh_cmd.c and have it
reenabled.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
tests: add a test program for lib/command.cSigned-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
bgpd, ospfd, zebra: fix some DEFUN definitionsFixup some DEFUNS with incorrect command strings or mixed up helpstrings.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra: apply syntactic sugar to rib_dump()strip the explicit __func__ present on all calls and make the prefix
argument a transparent union.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra: set metric for directly connected routes via netlink to 0a value of 1 is hard coded for the metric field, much like the
ifconfig utility it may have roots in. in order to be in line
with the metric used in the linux kernel itself, we switch this
to 0.
Signed-off-by: Brett Ciphery <brett.ciphery@windriver.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
build: remove now-useless --{en, dis}able-testscommit d771020 "don't build tests unless make check is run" has made the
--{en,dis}able-tests switch completely useless. The differentiation is
now made by running "make check" or not doing so. The only effect of
the switch is an "empty" excursion of make into the tests/ directory.
(well, and it turns "make check" useless from the main directory if
--disable-tests is given, which I don't t...
build: improve backtrace support/detectionlibexecinfo is used to provide backtrace() on *BSD. The API is
compatible with glibc's, so this is a "free" improvement.
To improve configure behaviour, the following configure options are
modified/introduced:
* --enable-gcc-rdynamic now defaults to "on" if the compiler is gcc.
(I sadly wasn't able to find any documentation on the availability of
this option for llvm, even though at leas...
lib: fix possible off-by-one in stream_put_prefix()The STREAM_WRITEABLE() call only checks if there is space for the
prefix in the stream but does not account for the prefixlen. The
stream_putc() call reduces available space by 1 and we can end
copying one byte too much and with "endp" off by one if we are
near the buffer end.
Instead of moving the stream_putc() call before STREAM_WRITEABLE(),
we check before hand for the required space, and o...
lib: fix for dynamically grown hashesFixes commit 97c84db00c (hash: dynamically grow hash table). The
no_expand field it's not initialized and could make the hashes to
never grow the table index.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Acked-by: Feng Lu <lu.feng@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib: fix backtraces broken by 837d16c...837d16c ("*: use array_size() helper macro") accidentally changed one of
the expressions in the backtrace code, which afterwards read:
zlog_backtrace_sigsafe():
if (((size = backtrace(array,array_size(array)) <= 0) ||
which boils down to: (size = backtrace(...) <= 0). The braces were
intended to go: (size = backtrace(...)) <= 0.
All in all, this makes a nice textbook example of the ...
ospf6d: fix refcounting in ospf6_asbr_lsa_removeWhen iterating over a list, also the last node should be unlocked again.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospf6d: add "auto-cost reference-bandwidth" commandThis command allows the user to change to default reference bandwidth
for cost calculations. The default value is 100 Mbps. With a default
bandwidth of 10 MBps, the default cost becomes 10. Those values are
consistent with OSPFv2.
[DL: resolved conflicts in vty command additions & docs]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospf6d: compute interface cost from its bandwidthPreviously, the interface cost was a fixed default value that a user
was allowed to change with "ipv6 ospf6 cost XX". As what is done with
OSPFv2, we change this behaviour to compute the default interface cost
from the interface bandwidth.
The user can still force a cost with "ipv6 ospf6 cost XX". He can get
the default value with "no ipv6 ospf6 cost". Moreover, the default
cost value was 1. T...
ospf6d: solve segfaults with ospf6d on FreeBSDDo not send ospf6d hellos on fresh created interfaces without
configuration (ie. no vlan configured). Ospf6d use ip6_mtu, if it's not
initalised, Ospf6d tries to alloc indefinite size of memory.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospf6d: fix interface_down() stopping hellosinterface_down() - which also handles some nonobvious cases like the
last linklocal address disappearing - was previously not cancelling the
hello timer. This had the effect of multiple such threads ending up
scheduled after a quick down-up cycle.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospf6d: clear lsa->refresh before clearing LSAsThis fixes a SEGV when we receive a higher-SeqNum copy of a LSA that we
originated ourselves, before a reboot of ospf6d. We create a new
copy of the LSA to resync the SeqNum, but then half an hour later
the old refresh thread ends up trying to refresh the free()'d old LSA.
The SEGV is triggered by this chain:
ospf6_lsdb_maxage_remover
-> thread_execute(ospf6_lsa_refresh)
-> old->refr...
ospf6d: handle missing link local address more gracefullyospf6 can't run on an interface without a link local address.
Don't start the state machine when an interface comes up without
such an ip and bring it up later, when a usable link local
address is added.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospf6d: improve ordered shutdownImprove the _disable/_enable infrastructure so it gets into
a more usable shape and make 'no router ospf6' actually work.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
security: Fix some typos and potential NULL-derefThis patch against the git tree fixes minor typos, some of them possibily
leading to NULL-pointer dereference in rare conditions.
Signed-off-by: Remi Gacogne <rgacogne-github@coredump.fr>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Acked-by: Feng Lu <lu.feng@6wind.com>
zebra: log routes w/o gateway in rib_delete_ipv4Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Feng Lu <lu.feng@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra: match gateway when deleting NEXTHOP_IPV4_IFINDEX routesSigned-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Feng Lu <lu.feng@6wind.com>