David Lamparter [Tue, 3 Mar 2015 07:51:53 +0000 (08:51 +0100)]
*: use void * for printing pointers
On higher warning levels, compilers expect %p printf arguments to be
void *. Since format string / argument warnings can be useful
otherwise, let's get rid of this noise by sprinkling casts to void *
over printf calls.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Tue, 3 Mar 2015 07:48:11 +0000 (08:48 +0100)]
*: use long long to print time_t
Since we can't assume time_t to be long, int, or even long long, this
consistently uses %lld/long long (or %llu/unsigned long long in a few
cases) to print time_t/susecond_t values. This should fix a bunch of
warnings, on NetBSD in particular.
(Unfortunately, there seems to be no "PRId64" style printing macro for
time_t...)
* linklist.{c,h}: (listnode_move_to_tail) new unction to move a
listnode to tail of list.
* ospf_packet.c: (ospf_write) remove debug that seemed to be mostly covered
by existing debug.
Use listnode_move_to_tail to just move the list node to the end of the
tail, rather than freeing the one to hand and allocing a new one.
Donald Sharp [Wed, 10 Jun 2015 00:22:42 +0000 (20:22 -0400)]
Add code to extract.pl.in to prevent further cli function overwrites
Currently extract.pl.in is used to build the vtysh cli. When two
different cli's collide with the same command name, the original
cli is never called, because it is dropped. This code notes the
silent drop and tracks the number of drops. If they change then
the code will fail the build. The current number of drops was
figured out by running extract.pl and counting up the drops
then adding code to compare the numbers returned.
If you have added to the problem, the solution is to fix your cli
command to not stomp on someone else's command. If you have removed
a stomp, safely modify extract.pl.in as part of your commit.
Signed-off-by: Donald Sharp <sharpd at cumulusnetworks.com> Acked-by: Vincent Jardin <vincent.jardin@6wind.com>
David Lamparter [Mon, 18 Nov 2013 22:04:27 +0000 (23:04 +0100)]
lib: unstupidify thread debug information
the library's thread scheduling functions keep track of the thread
function's name, so far so good. However, copying the compiler-provided
constant into a buffer inside the thread structure is plain useless.
Also, strip_funcname() was trying to support something that never
happens.
Instead, let's use some bytes here to track where threads are scheduled
from. Another commit will print that information on crashes.
Ripping out useless stuff: -64 bytes in the thread structure
Re-add as const ptr: +8 bytes
Extra debug info: +12 bytes
David Lamparter [Tue, 3 Mar 2015 07:52:22 +0000 (08:52 +0100)]
bgpd: don't use #ifdef inside macro args
Using #ifdef inside preprocessor macro argument lists is not guaranteed
to work. In reality it mostly does, but we don't need these ifdefs for
HAVE_IPV6 anymore, so let's get rid of the warning nonetheless.
Milan Kocian [Mon, 1 Dec 2014 12:48:25 +0000 (12:48 +0000)]
bgpd: fix negative values in output
Negative value in output of ecommunities (and as numbers)
seems odd :-). This patch fixes it. And add minor formating
modification, better for big as numbers.
Signed-off-by: Milan Kocian <milon@wq.cz> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit cb4fc59c8a0f9df81109d38acbeaab5627e361f5)
David Lamparter [Thu, 14 May 2015 12:47:05 +0000 (14:47 +0200)]
tests: add testcli reference in/out & do DejaGNU
This adds reference in & output for the previously added testcli tool,
to check basic CLI parsing/help functions. Unlike "testcommands", this
one doesn't depend on compile-time system details.
David Lamparter [Tue, 5 May 2015 09:04:59 +0000 (11:04 +0200)]
tests: add CLI dummy command-exec tool
This adds some common CLI testtool code as well as a tool that has a
bunch of commands to be poked for their correct processing.
The tool doesn't work correctly from a script at stdin at this point
because the vty code will throw away all buffered when it sees EOF, so
the tail end of the input file is lost.
David Lamparter [Sat, 22 Nov 2014 18:31:33 +0000 (10:31 -0800)]
build: remove --disable-ipv6
Building with IPv6 disabled tends to break rather often and sprinkles
ugly #ifdefs around the code. All that only to support systems where
the C library doesn't have IPv6 capability.
The year now being 2015, if this is a problem the thing to fix is the C
library.
The implication of this patch is that future patches need not care about
HAVE_IPV6 = 0 and may remove ifdefs gratuitously. This patch doesn't
remove these ifdefs to not create unneccessary churn.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Paul Jakma <paul@jakma.org>
David Lamparter [Sat, 28 Jun 2014 20:07:41 +0000 (22:07 +0200)]
build: remove --enable-solaris parameter
This switch controlled descending into the solaris/ subdirectory, which
contains package descriptions and init scripts. If they're not
appropriate, they'd better be removed outright.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Greg Troxel <gdt@ir.bbn.com> Acked-by: Feng Lu <lu.feng@6wind.com> Acked-by: Paul Jakma <paul@jakma.org>
David Lamparter [Sat, 28 Jun 2014 19:26:36 +0000 (21:26 +0200)]
zebra, ripngd: remove ::/64 special-casing
In the 90ies, IPv4 was believed to exist within IPv6, with some kernels
implementing this belief in code... Our code here is keyed to "#ifdef
LINUX", yet no Linux from the past 10 years had this, making the code
completely useless.
FreeBSD 10.0 does in fact have a "::/96 via ::1 dev lo0 reject" route.
IMHO we shouldn't mess with that, the admin can filter as neccessary
anyway.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Greg Troxel <gdt@ir.bbn.com> Acked-by: Feng Lu <lu.feng@6wind.com>
[DL: slightly adjusted commit message to remove misunderstanding] Acked-by: Paul Jakma <paul@jakma.org>
Donald Sharp [Wed, 1 Jun 2016 19:31:02 +0000 (15:31 -0400)]
pimd: Add support for displaying ip mroute
When you enter a static mroute under an interface
the 'show run' is not displaying this information.
Add code to allow this.
Ticket: CM-11257 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Donald Sharp [Wed, 1 Jun 2016 01:27:48 +0000 (21:27 -0400)]
pimd: Allow command zclient to find it's data
pim has two zclient sockets to zebra. One
is used exclusively to do mrib lookups. The
other is to do the normal day to day communication
between pim and zebra. With the change
to the zebra api to send up all data to all
sockets this caused the mrib lookup socket
to accumulate data in between mrib lookups.
So if at some point in time we get upcoming
data but no mrib lookups modify the code
to find the mrib lookup it is looking for.
Long term we need to figure something else out
but this change will get us moving forward again.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Donald Sharp [Thu, 26 May 2016 23:31:38 +0000 (19:31 -0400)]
pimd: Add ability to safely ignore route-maps
pim was not parsing route-map code and causing issues
using vtysh because of this. Add code to safely
ignore the route-map code and set us up for future
expansion into route-maps if neeeded.
Ticket: CM-11219 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Thu, 26 May 2016 16:41:55 +0000 (12:41 -0400)]
pimd: Double read of stream
The addition of the zclient_read_header call
reads the entirety of the stream for you and
makes sure it's consistent with the header.
When the function call was added it read the
stream data in zclient_read_header and then
reread the data after that.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Paul Jakma [Thu, 9 Oct 2014 13:19:51 +0000 (14:19 +0100)]
ospfd: Some small tweaks to the SPF execution reason patch
* ospf_spf.h: use an enum for the reason, and have it as a new argument to
ospf_spf_calculate_schedule, no need for additional call, and let compiler
do the checking.
* ospf_spf.c: format changes - Quagga coding style places function names
at the start of a new line, for easy grepping for definition.
(ospf_spf_calculate_timer) Change the log format of SPF execution time to
avoid ginormous line, and make logging conditional, as is the norm.
Paul Jakma [Tue, 21 Oct 2014 15:59:01 +0000 (16:59 +0100)]
bgpd: Fixes for recent well-known-attr check patch.
* bgp_attr.c: Recent patch to tighten well-known attr checks and apply that
to all AFIs has some breakage with MP-extensions and GR, which needs to be
fixed.
(bgp_attr_check) Graceful Restart EoR can be an empty UPDATE for IPv4/uni.
MP-Ext allow UPDATE with just MP_UNREACH_NLRI. Check for these and return
proceed.
NEXT_HOP becomes optional, if MP_REACH_NLRI is present and there's no
v4 NLTI, update NEXT_HOP check accordingly.
Print the missing attr in string form in the log message.
(bgp_attr_parse) AS_PATH need not be there, so
bgp_attr_munge_as4_attrs call needs to be conditional on that.
Paul Jakma [Tue, 23 Sep 2014 14:23:01 +0000 (15:23 +0100)]
bgpd: well-known attr check only run for v4/uni, which could cause a crash.
* ANVL testing by Martin Winter threw up a crash in bgpd in aspath_dup
called from bgp_packet_attribute, if attr->aspath was NULL, on an IPv6
UPDATE.
This root cause is that the checks for well-known, mandatory attributes
were being applied only if an UPDATE contained the IPv4 NLRI and the
peer was configured for v4/unicast (i.e. not deconfigured). This is
something inherited from GNU Zebra, and never noticed before.
* bgp_attr.c: (bgp_attr_parse) Move the well-known mandatory attribute
check to here, so that it can be run immediately after all attributes
are parsed, and before any further processing of attributes that might
assume the existence of WK/M attributes (e.g. AS4-Path).
(bgp_attr_munge_as4_attrs) Missing AS_PATH shouldn't happen here anymore,
but retain a check anyway for robustness - it's definitely a hard error
though.
* bgp_attr.h: (bgp_attr_check) No longer needs to be exported, make static.
* bgp_packet.c: (bgp_update_receive) Responsibility for well-known check
now in bgp_attr_parse.
Paul Jakma [Fri, 19 Sep 2014 13:42:23 +0000 (14:42 +0100)]
Fix most compiler warnings in default GCC build.
Fix lots of warnings. Some const and type-pun breaks strict-aliasing
warnings left but much reduced.
* bgp_advertise.h: (struct bgp_advertise_fifo) is functionally identical to
(struct fifo), so just use that. Makes it clearer the beginning of
(struct bgp_advertise) is compatible with with (struct fifo), which seems
to be enough for gcc.
Add a BGP_ADV_FIFO_HEAD macro to contain the right cast to try shut up
type-punning breaks strict aliasing warnings.
* bgp_packet.c: Use BGP_ADV_FIFO_HEAD.
(bgp_route_refresh_receive) fix an interesting logic error in
(!ok || (ret != BLAH)) where ret is only well-defined if ok.
* bgp_vty.c: Peer commands should use bgp_vty_return to set their return.
* jhash.{c,h}: Can take const on * args without adding issues & fix warnings.
* libospf.h: LSA sequence numbers use the unsigned range of values, and
constants need to be set to unsigned, or it causes warnings in ospf6d.
* md5.h: signedness of caddr_t is implementation specific, change to an
explicit (uint_8 *), fix sign/unsigned comparison warnings.
* vty.c: (vty_log_fixed) const on level is well-intentioned, but not going
to fly given iov_base.
* workqueue.c: ALL_LIST_ELEMENTS_RO tests for null pointer, which is always
true for address of static variable. Correct but pointless warning in
this case, but use a 2nd pointer to shut it up.
* ospf6_route.h: Add a comment about the use of (struct prefix) to stuff 2
different 32 bit IDs into in (struct ospf6_route), and the resulting
type-pun strict-alias breakage warnings this causes. Need to use 2
different fields to fix that warning?
general:
* remove unused variables, other than a few cases where they serve a
sufficiently useful documentary purpose (e.g. for code that needs
fixing), or they're required dummies. In those cases, try mark them as
unused.
* Remove dead code that can't be reached.
* Quite a few 'no ...' forms of vty commands take arguments, but do not
check the argument matches the command being negated. E.g., should
'distance X <prefix>' succeed if previously 'distance Y <prefix>' was set?
Or should it be required that the distance match the previously configured
distance for the prefix?
Ultimately, probably better to be strict about this. However, changing
from slack to strict might expose problems in command aliases and tools.
* Fix uninitialised use of variables.
* Fix sign/unsigned comparison warnings by making signedness of types consistent.
* Mark functions as static where their use is restricted to the same compilation
unit.
* Add required headers
* Move constants defined in headers into code.
* remove dead, unused functions that have no debug purpose.
Lu Feng [Fri, 11 Jul 2014 07:52:15 +0000 (07:52 +0000)]
zebra: fix rtnh_len in the rt_netlink messages for multipath case
In _netlink_route_build_multipath():
- Each time when appending a IPv4 gateway in the message, rtnh_len
is increased by sizeof (struct rtattr) + 4, where we should use
"bytelen" instead of the hard coding "4".
- As what done for IPv4, we should increase rtnh_len accordingly
along with adding a IPv6 gateway, or else the IPv6 gateways will
be lost.
Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 621e2aaf33d8ab73bf44b0eea3f3900135d34996)
Lu Feng [Fri, 18 Jul 2014 06:13:19 +0000 (06:13 +0000)]
ripd: allow to enable/disable the ECMP feature
Introduce a new command "[no] allow-ecmp" to enable/disable the
ECMP feature in RIP. By default, ECMP is not allowed.
Once ECMP is disabled, only one route entry can exist in the list.
* rip_zebra.c: adjust a debugging information, which shows the number
of nexthops according to whether ECMP is enabled.
* ripd.c: rip_ecmp_add() will reject the new route if ECMP is not
allowed and some entry already exists.
A new configurable command "allow-ecmp" is added to control
whether ECMP is allowed.
When ECMP is disabled, rip_ecmp_disable() is called to
remove the multiple nexthops.
* ripd.h: Add a new member "ecmp" to "struct rip", indicating whether
ECMP is allowed or not.
Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 0b74a0a5db7bcf65bf68c44b547b02b1310b5cdb)
Lu Feng [Fri, 18 Jul 2014 06:13:18 +0000 (06:13 +0000)]
ripd: add ECMP support
* Each node in the routing table is changed into a list, holding
the multiple equal-cost paths.
* If one of the multiple entries gets less-preferred (greater
metric or greater distance), it will be directly deleted instead
of starting a garbage-collection timer for it.
The garbage-collection timer is started only when the last entry
in the list gets INFINITY.
* Some new functions are used to maintain the ECMP list. And hence
rip_rte_process(), rip_redistribute_add() and rip_timeout() are
significantly simplified.
* rip_zebra_ipv4_add() and rip_zebra_ipv4_delete() now can share
the common code. The common part is moved to rip_zebra_ipv4_send().
Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit b397cf4f0fc484c5ebfc8a680090055c8e6cbe32)
Paul Jakma [Tue, 16 Feb 2016 11:30:33 +0000 (11:30 +0000)]
configure: Fix warnings on CentOS and bump the minimum autoconf version
* configure.ac: Bump the minimum version to 2.60 as needed by
AC_USE_SYSTEM_EXTENSIONS. AC 2.60 is nearly 10 years old, note. Add
AC_PROG_RANLIB, for when --disable-shared is used.
There are other warnings on, e.g., CentOS 6.7 with 2.63, but they
don't go away if the suggestion to add AC_SYSTEM_EXTENSIONS is
followed. This warning doesn't occur on Fedora with AC 2.69.
Note: autoconf (and other auto*) should only be needed on developer
machines building direct from git. Other systems should be using the
'make dist' tarballs, with a ready-made build system, that does not
need auto* intalled.
Paul Jakma [Tue, 16 Feb 2016 11:28:35 +0000 (11:28 +0000)]
doc: older versions of texinfo seem to be sensitive to location of unmacro
* bgpd.texi: The unmacro of mprec seems to be disliked by older texinfos.
Moving it to after the section fixes it. Even easier, just don't undef the
macro.
Martin Winter [Fri, 30 Oct 2015 05:15:42 +0000 (22:15 -0700)]
distro/redhat: Update to support CentOS/RHEL/Fedora, upstart/init/systemd
* redhat/quagga.spec.in: Update to support CentOS, RHEL and Fedora, and
support the various init systems across different versions of these
distros, e.g. upstart/init/systemd.
Clean up various warnings from rpmlint.
Remove configure options that are gone.
A few edits and commit message by:
Paul Jakma <paul.jakma@hpe.com> / <paul@jakma.org>
* redhat/quagga.spec.in: remove with_ipv6, it should just be the norm now.
The actual pimd binary wasn't being packaged, fix.
Remove deprecated pam.stack support.
Paul Jakma [Fri, 4 Sep 2015 13:25:13 +0000 (14:25 +0100)]
distro: fix redhat/quagga.spec.in
* quagga.spec.in: Add default for with_pimd macro.
Remove ancient condtional on quagga_buildreqs.
More recent rpmbuild complains about too many levels of recursion in
quagga_buildreqs, so use %{expand:..}.
Actually use quagga_buildreqs in BuildRequires!
groff is needed for build.
texi2html --number argument has disappeared, split into 2.
Paul Jakma [Wed, 2 Dec 2015 16:47:43 +0000 (16:47 +0000)]
docs: Update bgpd docs, inc. on decision process, and with a section on MED.
* bgpd.texi: Document the -l argument. Update the 'BGP decision process' table
to reflect what /actually/ is implemented. Add docs on 'compare-routerid' in
the bestpath section.
Add a section on MED, to highlight the issues it has by default, and to
highlight that it is terminally broken for its original purpose in many
modern iBGP topologies.
Mention the potential workarounds and fixes.
* routemap.texi: set an anchor on 'set metric' so bgpd.texi can reference it.
Paul Jakma [Tue, 20 Oct 2015 15:14:56 +0000 (16:14 +0100)]
doc: Add 'OSPF Fundamentals' section to OSPF docs
* ospf_fundamentals.texi: New section explaining the fundamentals of OSPF
for system admins, to help them debug their networks.
* {Makefile.am,ospfd.texi}: include and build previous
Donald Sharp [Tue, 29 Sep 2015 13:25:10 +0000 (09:25 -0400)]
quagga: Additional centos 6 -enable-werror fixes
This commit fixes these warnings:
1) bgpd/bgp_nexthop.c - dereferencing pointer 'X' does break strict-aliasing rules
2) pimd/pim_igmp_join.c - dereferencing pointer 'X' does break strict-aliasing rules
3) ripd/ripd.c - 'ifaddr.prefixlen' may be used uninitialized in this function
David Lamparter [Tue, 15 Sep 2015 09:19:46 +0000 (02:19 -0700)]
build: make libraries self-reliant
libospf and libospfclient both need libzebra, so they should link
against it. The days of libtool propagating upwards such dependencies
are nearing their end...
Paul Jakma [Sun, 21 Jun 2015 22:00:13 +0000 (23:00 +0100)]
HACKING: Change format to MarkDown
* HACKING: Converted initially from LaTeX to markdown with:
'pandoc -f latex -t markdown HACKING.tex'
Then tweaked by hand to add a header with some suitable variables for the
pandoc LaTeX template to make better use of the page space, and to add
newpages so the title page is standalone as in the previous version.
Also went through and reflowed paragraphs best as I could to make them
match the previous document, to make it a little easier to verify nothing
had been changed other than the markup, via diff.
PDF can be generated with: 'pandoc -o HACKING.pdf HACKING.md'
Morgan Stewart [Thu, 17 Sep 2015 23:04:30 +0000 (19:04 -0400)]
Fixed if_add_update possible null dereference
Coverity Scan #1221454
In zebra/interface.c if_data could be null dereferenced without early
check.
Signed-off-by: Morgan Stewart <morgan@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit c8394ace7081ef0e71f3d162067c83c2629fc088)
I found that zebra doesn't set correct IPv6 address in its result because of
using *addr's address. Although I'm using 0.99.22, the latest version has
also use "&addr". Shouldn't it use "addr"?
Signed-off-by: Hiroshi Yokoi <hiroshi.yokoi.0313@gmail.com> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit 8ccd74c29f5242f312c1e0561497558482c9be65)
Fernando Soto [Mon, 11 May 2015 20:52:00 +0000 (20:52 +0000)]
ospfd: trap on state change seems to send incorrect value for ospfNbrState
The ospfNbrState in the ospf trap sent from ospfd shows an incorrect state.
For example, when the connection goes down, the ospfNbrState in the trap is
sent as '8' (full). When the connection is reestablished, the state is sent
as '7' (loading).
The reason seems to be that the trap is sent from nsm_notice_state_change()
before the state is actually updated by calling nsm_change_state().
After applying the attached patch, the traps are sent with nbrState '1' when
the connection goes down and '8' when it goes back up.