lib: assert(0) still needs a returnassert(0) is not guaranteed to not return since assert() in general can
be optimised out when building without debug / with optimisation. This
breaks the build in clang, which warns/errors about the missing return.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib: fix "reduce strcmp in CLI" fallout (10bac801)In "lib/cli: reduce strcmp in CLI hot paths", I failed to notice that
CMD_VARIABLE as a boolean test covers a superset of the other types of
variables. Thus, the patch broke processing of IP/IPv6/Integer range
parameters in the CLI.
Fix by some reordering and introducing TERMINAL_RECORD macro (which
marks whether a given terminal type is a parameter) to be used in places
where the check is re...
lib: straighten out ORF prefix list supportBGP ORF prefix lists are in a separate namespace; this was previously
hooked up with a special-purpose AFI value. This is a little kludgy for
extension, hence this splits it off.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Acked-by: Paul Jakma <paul@jakma.org>
lib: hide internal prefix list structuresThese are about to be touched and there's no point in other code
touching into prefix list's internas. Add some isolation.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
bgpd: speed up "no-hit" withdraws for routeserversThis accelerates handling of incoming Withdraw messages for routes that
don't exist in the table to begin with. Cisco IOS 12.4(24)T4 has a bug
in this regard - it sends withdraws instead of doing nothing for
prefixes that are filtered.
Pulling up the adj_in removal in Quagga should have no ill effect, but
we can avoid the costly iteration over all rsclients if there was no
adj_in entry.
Perf...
ospfd: Remove the blocking of opaque LSAs origination & flooding 'optimisation'* Opaque support contains some kind of hack/optimisation to
origination/flooding to suppress some origins/floods until an opaque LS
Acks are received. Previous versions of the code have already been shown
to have bugs in them (see e16fd8a5, e.g.). It seems over-complex and fragile,
plus its conceptually the wrong place to try implement flooding hacks that,
AFAICT, do not depend parti...
ospfd: Make ospf_passive_interface_update calls friendly to static analysis* ospf_vty.c: ({no_}ospf_passive_interface_addr_cmd) To a static analyser,
the call to ospf_passive_interface_update can look like uninitialised memory
in addr might be read from. It won't be, as ospf_passive_interface_update
only reads addr if params != IF_DEF_PARAMS, but not clear. Split up the
helper into the two cases to make it clear.
lib/cli: reduce strcmp in CLI hot pathsEr, no idea how anyone could ever have thought that it would be a good
idea to have a zillion of strcmp() calls in the CLI's active paths, just
to compare against things like "A.B.C.D".
Reduces 40k prefix list load time from 1.65s to 1.23s (1.34:1).
Acked-by: Paul Jakma <paul@jakma.org>
[v2: killed CMDS_* macros]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib: constify sockunion apiAdd const to read-only api calls.
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra: fix rtadv check for non-glibc linuxDefault RTADV enabled for non-glibc linux (fixes check for musl libc).
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra: fix build with rtadv disabledOtherwise we get warning on rtadv_init() prototype not being
defined when compiling rtadv.c (as dummy stub is provided always).
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
isisd: fix crash on processing own p2p helloisis_pdu.c :
isisd crashes if router's own p2p hello packets get processed
thereby creating an adjacecncy with itself. Asserts at
isis_find_vertex. So discard own p2p IIH PDU and avoid
creating adjacency with self. This would also fix duplicate
systemID on an interface. These checks already exists for IS-IS
LAN Level 1/2 Hello PDU in process_lan_hello, but not for
point-to-point IIH PDUs.
Sign...
HACKING: Use space char for indentation.* HACKING.tex: Whitespace/indent section is probably out of date. Rephrase.
Remove the editor recommendations, as I don't know what would be correct.
Acked-by: Vincent Jardin <vincent.jardin@6wind.com>
gdb: Add a directory of files with gdb macros* gdb/: Directory to contain files with GDB macros. Organised by topic into
separate files.
* gdb/lib.txt: General OS API and Quagga lib macros:
(def_ntohs) convert big-endian short to host order.
(def_ntohl) convert big-endian long to host order.
(walk_route_table_next) Walk to next route_node in a table, according
to given top and current node arguments.
(walk_route_table) walk th...
Merge branch 'volatile/fix_warnings'Thanks to Donald Sharp and Greg Troxel for providing feedback!
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra: fix NetBSD interface stats printf"format '%qu' expects type 'long long unsigned int', but argument 3 has
type '__uint64_t'"
Move to %llu, which is more standard.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
*: fix more initialisers (for BSD)FreeBSD and NetBSD spew a few more warnings about variable initialisers.
Found with OSR's/NetDEF's fancy new CI system.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
tests: fix warningsWhile I don't see -Werror being used on tests anytime soon, there's no
reason to keep the warnings in tests unfixed.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra: silence zebra_serv_un unused warningzebra_serv_un() is unused if --enable-tcp-zebra is given.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
pimd: fix out of tree buildpimd/Makefile.am was missing srcdir/lib from its include paths, breaking
out-of-tree build regarding route_types.h
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
build: add --enable-werrorThis allows enabling -Werror in a consistent way. Note that this is
different from just specifiying it in CFLAGS, since that would either
break configure tests (if done on ./configure), or would override
configure's CFLAGS (if done on make).
Using --enable-werror instead provides a new WERROR variable that is
additionally used during make with a consistent set of warning flags.
The tests/ di...
build: determine CFLAGS more intelligentlyInstead of hardcoding some compiler detection, this just checks which
CFLAGS actually work with the compiler specified by the user.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
bgpd: fix SNMP write supportThis code - dating back to the initial import in 2002 - probably never
worked. Calling asn_parse_int seems to always have been wrong, and in
the meantime, there no longer is a "struct variable *" argument for
write_method. If anyone tried to use it, it'd probably have crashed.
(I didn't try.)
Fix this up so it actually works. It's the only place in Quagga where a
SNMP write is actually supp...
snmp: fix warningsbatch-fix all warnings that come up when enabling AgentX SNMP support.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
vtysh: drop unused variables & RETSIGTYPEDrop unused return values in vtysh. Also gets rid of the rather funny
prototyping of signal setup in vtysh - which as a side effect makes it
not need AC_TYPE_SIGNAL in configure.ac anymore. It wasn't used
sensibly to begin with...
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
vtysh: fix function prototypesThis makes a whole bunch of vtysh functions static, fixes prototypes for
a few more, and masks user_free() and user_write_config() (both unused.)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
vtysh: don't use '\0' as NULLfor some reason, the vty code was using '\0' in place of NULL.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospf6d: fix pointer arithmetic warningcaddr_t was signed; this buffer size comparison is better done in
unsigned.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospf6d: use existing union, avoid strict-aliasingThere are preexisting fields u.lp.id and u.lp.adv_router in struct
prefix that do the same thing as these type-punning pointer derefs.
Use these and shut up the strict-aliasing warnings.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
watchquagga: break excessively long help stringwatchquagga's command line help string exceeds the ISO C maximum string
length (4095 characters). Just break it in two.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib, vtysh: reduce unneccessary C extension usageWe're only supporting GCC, Clang and ICC; but there's no reason to use
nonstandard C constructs if they don't actually provide any benefit.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib: use const consistently for zserv pathThe global variable is missing its const, but the accessor function has
a meaningless extra const in exchange...
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib: silence type range warning in macroWhile splitting up the CLI input macro is a bit annoying, this seems to
be the least annoying way to get rid of the "< 0" comparison warning for
unsigned long.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
pimd: cast ioctl values when printing themioctl values might be int or long, cast them to unsigned long for
consistent printing. (They're long on FreeBSD, but were printed with
%d.)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
pimd: cast to sockaddr_in to sockaddrWhile glibc seems to have something in the system headers that prevents
this from triggering a warning, FreeBSD doesn't. Fix the warning.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
pimd: mask unused zclient_broken()this function is used by the currently not present zclient reconnect
code. It'll be unmasked again when that code hits master.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra: clean up misc_null pragmasThe no-op alternatives provided in misc_null trigger a few warnings
since they provide functions / use pragmas without prototypes.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra: static int inline -> static inline intThe BSD socket kernel interface had some weird ordering of function
attribute keywords. ("static int inline foobar()")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra: use SA_SIZE for RT_ROUNDUP on FreeBSDFreeBSD provides SA_SIZE (and none of the other options to infer padded
size of a struct sockaddr). Just define SAROUNDUP to SA_SIZE if it is
available.
This also drops a superfluous-looking extra macro branch which would
require ROUNDUP. It seemed redundant to my eyes, but I have no idea
what odd things might have triggered addition of this in the first
place...
Signed-off-by: David Lampar...
zebra: remove unused netlink_route()/kernel_rtm_ipv6()kernel_delete_ipv6_old(), removed in 51bdeba a little while ago, was the
last user of netlink_route() and kernel_rtm_ipv6(). Everything else
uses the _multipath variants of these functions.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra, isisd: cast to unsigned char for ctypesctype.h macros take int as arguments, but expect arguments to be in
unsigned char's range. Even though it probably works, this isn't
correct on systems that have a signed char type. Cast explicitly.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
isisd: remove unused process_is_hello()The code uses process_lan_hello() or process_p2p_hello(). The unused
process_is_hello() seems to be a leftover generic version.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
isisd: fix size_t confusionsisisd had a few places that mixed up size_t vs. unsigned long, and %zd
vs. %ld. Clean out.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
isisd: assorted fixes (unused variables, static)This just mops up a few warnings in isisd.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
isisd: fix minor & vs. && mix-upapparently we were displaying all IPv6 reachabilities as external.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>