Commit graph

605 commits

Author SHA1 Message Date
Ondrej Zajicek (work) 9b0a0ba9e6 Unit Testing for BIRD
- Unit Testing Framework (BirdTest)
 - Integration of BirdTest into the BIRD build system
 - Tests for several BIRD modules

 Based on squashed Pavel Tvrdik's int-test branch, updated for
 current int-new branch.
2016-11-09 16:36:34 +01:00
Ondrej Zajicek (work) 8860e991f6 Merge branch 'master' into int-new 2016-11-08 19:27:58 +01:00
Ondrej Zajicek (work) c8cafc8ebb Minor code cleanups 2016-11-08 17:46:29 +01:00
Ondrej Zajicek (work) cc5b93f72d Merge tag 'v1.6.2' into int-new 2016-11-08 17:04:29 +01:00
Ondrej Zajicek (work) 7eec398875 BSD: Fix build on OpenBSD broken by previous commit 2016-11-01 16:20:04 +01:00
Jan Moskyto Matejka 3e236955c9 Build: switch on -Wextra, get rid of most of the warnings
There are several unresolved -Wmissing-field-initializers on older
versions of GCC than 5.1, all of them false positive.
2016-11-01 14:52:54 +01:00
Ondrej Zajicek (work) 17fe57d8dc Log: Fix broken syslog name
BIRD passed string from configuration to openlog(), which kept it
internally. After reconfiguration the old string was freed, therefore
openlog had invalid copy.

Thanks to Chris Caputo for the original patch.
2016-11-01 11:37:49 +01:00
Ondrej Zajicek (work) f51b1f5565 NEWS and version update 2016-09-29 15:06:19 +02:00
Jan Moskyto Matejka ccd2a3eda2 Kernel socket missing err_hook fix
Thanks to Tim Weippert for bugreport.
2016-09-29 13:21:16 +02:00
Ondrej Zajicek (work) 79e2293ab2 NEWS and version update 2016-09-22 13:34:56 +02:00
Ondrej Zajicek (work) 6e75d0d27f KRT: Add krt_scope attribute
Add a new route attribute, krt_scope, to expose the Linux kernel route
scope. Constants from /etc/iproute2/rt_scopes (prefixed by "ips_") are
expected to be used with the attribute. Both import and export are
supported.

Also, the patch fixes device route export to the kernel, by setting link
scope automatically.
2016-09-19 12:29:56 +02:00
Pavel Tvrdik 292f7858e6 Main: Improve BIRD help messages 2016-09-15 17:30:52 +02:00
Pavel Tvrdik a290da25a1 rt-table: Fix kernel protocol export filter memory bug
Kernel protocol calls rt_export_merged(), which used @rte_update_pool for
temporary allocations, supposing it is called from other functions from
rt-table.c that handles locking and flushing of the linpool. Therefore,
linpool was not flushed properly and memory leaked.

Add linpool argument to rt_export_merged() and use @krt_filter_lp when
called from kernel protocol.

Thanks to Justin Cattle and Alexander Frolkin for the bugreport.

(Commit squashed and updated by Ondrej Zajicek)
2016-09-15 15:57:51 +02:00
Ondrej Zajicek (work) 4adcb9df1b KRT: Add kernel metric protocol option
Kernel routes with different metrics do not clash with each other,
therefore using dedicated metric value is a reliable way to avoid
overwriting routes from other sources (e.g. kernel device routes).

Although kernel route metric could already be set as a route attribute by
filters, that is not consistent with the way how Linux kernel handles
route metric - not just a route attribute, but a part of a route key.
2016-09-15 14:59:06 +02:00
Ondrej Zajicek (work) 2feaa6931b KRT: Support for IPv6 ECMP
Linux represents IPv6 ECMP routes as a sequence of unipath routes with
the same prefix. We have to translate between our representation (one
route with multipath next hop) and the Linux representation in both
directions.

Proper learning of alien IPv6 ECMP routes still not supported.

Thanks to Mikhail Sennikovskii for the original patch.
2016-09-14 11:53:54 +02:00
Ondrej Zajicek (work) a1839f3c61 KRT: Fix trivial error 2016-08-31 14:02:41 +02:00
Ondrej Zajicek (work) f9f2e280ea KRT: Forbid path merging on BSD
We support ECMP routes only on Linux. Exported routes are checked in
krt_capable(), but a route generated during path merging avoids this
check.
2016-08-30 12:43:46 +02:00
Ondřej Surý 33d22f0e9e whitespace fixes 2016-08-16 09:24:12 +02:00
Ondrej Zajicek (work) a08a81c6b4 Netlink: Fix build with older headers missing IFA_FLAGS 2016-07-20 15:31:25 +02:00
Ondrej Zajicek (work) e37d2e3e70 Netlink: Ignore tentative addresses
Ignore tentative IPv6 addresses and wait until finish of Duplicate
Address Detection (We got notification when an address is no longer
tentative) to avoid problems when protocols try to use interfaces
with tentative link-local addresses.

Based on patch from Jan Moskyto Matejka
2016-07-20 15:06:57 +02:00
Ondrej Zajicek (work) f0b822a831 Log: Fix error handling of debug file open
Logging is not yet initialized, we have to use fprintf() here.

Thanks to Pavel Tvrdik for noticing and debugging it.
2016-07-11 20:22:55 +02:00
Pavel Tvrdík 8f01879c56 cppcheck: fix va_end() functions 2016-06-27 15:07:50 +02:00
Jan Moskyto Matejka 9dbcb11cb5 Unix IO: Tried to fix strange behavior after POLLHUP or POLLERR. 2016-05-30 14:28:22 +02:00
Jan Moskyto Matejka 925aa14912 After-master-merge simple fixes.
BSD lib/setkey.h and lib/sysio.h #include fixes.
OpenBSD's flex needs -o param without space.
V6ONLY for SK_IP fix.
2016-05-24 12:12:14 +02:00
Ondrej Zajicek (work) 379f995940 BSD: Fix setkey in int-new branch 2016-05-17 16:19:50 +02:00
Ondrej Zajicek (work) 08b3a24da5 IO: Minor changes in socket AF handing
AF can be specified implicitly by saddr or daddr, flags SKF_V4ONLY and
SKF_V6ONLY are to be removed.
2016-05-17 15:21:49 +02:00
Ondrej Zajicek (work) af678af0d5 Merge remote-tracking branch 'origin/master' into int-new 2016-05-12 18:03:23 +02:00
Ondrej Zajicek (work) 286e2011d2 Miscellaneous minor fixes 2016-05-12 16:04:47 +02:00
Pavel Tvrdik 8e433d6a52 Prog Doc: Complete several missing parameters 2016-05-12 15:49:44 +02:00
Stijn Tintel 31e9e10144 netlink: update struct msghdr
The netlink code assumes an order for the members of struct msghdr.
This breaks recvmsg and sendmsg with musl libc on mips64. Fix this by
using designated initializers instead.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2016-05-10 16:05:16 +02:00
Jan Moskyto Matejka 0c6dfe5236 Merge branch 'int-new' into int-new-merged 2016-05-10 14:30:49 +02:00
Jan Moskyto Matejka 92912f063a Merge remote-tracking branch 'origin/rte-update' into int-new 2016-05-10 14:21:15 +02:00
Jan Moskyto Matejka a8caff322f Portability: Fixed C extension error generated by CLang.
sysdep/linux/netlink.c:921:10: error: fields must have a constant size:
'variable length array in structure' extension will never be supported
    char buf[128 + KRT_METRICS_MAX*8 + nh_bufsize(a->nexthops)];
         ^
1 error generated.
2016-05-10 14:08:49 +02:00
Jan Moskyto Matejka 7152e5efbb Build system reworked to one global Makefile with includes and no nesting
Also removed the lib-dir merging with sysdep. Updated #include's
accordingly.

Fixed make doc on recent Debian together with moving generated doc into
objdir.

Moved Makefile.in into root dir

Retired all.o and birdlib.a
Linking the final binaries directly from all the .o files.
2016-05-10 14:07:34 +02:00
Pavel Tvrdik f7a99acb4e Initialize variable ifr in sk_setup()
==00:00:00:02.831 2468== Syscall param socketcall.setsockopt(optval) points to uninitialised byte(s)
==00:00:00:02.831 2468==    at 0x513BDEA: setsockopt (in /usr/lib/libc-2.23.so)
==00:00:00:02.831 2468==    by 0x45C7AF: sk_setup (io.c:1216)
==00:00:00:02.831 2468==    by 0x45CDFF: sk_open (io.c:1417)
==00:00:00:02.831 2468==    by 0x44B562: rip_open_socket (packets.c:740)
==00:00:00:02.831 2468==    by 0x4481A7: rip_iface_locked (rip.c:616)
==00:00:00:02.831 2468==    by 0x4133E4: olock_run_event (locks.c:177)
==00:00:00:02.831 2468==    by 0x45A6DE: ev_run (event.c:85)
==00:00:00:02.831 2468==    by 0x45A7AD: ev_run_list (event.c:142)
==00:00:00:02.831 2468==    by 0x45E0FC: io_loop (io.c:2066)
==00:00:00:02.831 2468==    by 0x463B56: main (main.c:845)
==00:00:00:02.831 2468==  Address 0xffefffd24 is on thread 1's stack
==00:00:00:02.831 2468==  in frame #1, created by sk_setup (io.c:1188)
==00:00:00:02.831 2468==  Uninitialised value was created by a stack allocation
==00:00:00:02.831 2468==    at 0x45C6BB: sk_setup (io.c:1188)
2016-05-03 11:02:48 +02:00
Ondrej Zajicek (work) 52bae25580 NEWS and version update 2016-04-29 13:07:21 +02:00
Ondrej Zajicek (work) 937e75d8f1 Add the Babel routing protocol (RFC 6126)
This patch implements the IPv6 subset of the Babel routing protocol.
Based on the patch from Toke Hoiland-Jorgensen, with some heavy
modifications and bugfixes.

Thanks to Toke Hoiland-Jorgensen for the original patch.
2016-04-28 18:01:40 +02:00
Ondrej Zajicek (work) a7baa09862 BSD: Add the IPsec SA/SP database entries control
Add code for manipulation with TCP-MD5 keys in the IPsec SA/SP database
at FreeBSD systems. Now, BGP MD5 authentication (RFC 2385) keys are
handled automatically on both Linux and FreeBSD.

Based on patches from Pavel Tvrdik.
2016-04-13 14:37:09 +02:00
Jan Moskyto Matejka 2003a18407 Route update: move table lookup from protocols into rte_update2().
Many protocols do almost the same when creating a rte_update request
before calling rte_update2(). This commit should simplify the protocol
side of the route-creation routine.
2016-04-08 13:09:06 +02:00
Jan Moskyto Matejka 7a7ac65682 Merge branch 'master' into int-new-channels 2016-04-08 12:28:33 +02:00
Ondrej Zajicek (work) f2ae2badff Main: Add local option
Add option that changes default paths for config file and control socket
to the current working directory.
2016-04-07 12:39:49 +02:00
Jan Moskyto Matejka 4bdf1881dc Channelize: rt_notify arg conversion table -> channel 2016-04-07 10:08:23 +02:00
Ondrej Zajicek (work) bd22d7f41d IO: Avoid multiple event cycles in one loop cycle.
Event cycle may took too much time and trigger next timer events, so
avoid cycling between timer and event cycles inside the loop cycle.
2016-04-06 11:57:28 +02:00
Ondrej Zajicek (work) 9e7b3ebdf9 IO: Replace RX priority heuristic with explicit mark
In BIRD, RX has lower priority than TX with the exception of RX from
control socket. The patch replaces heuristic based on socket type with
explicit mark and uses it for both control socket and BGP session waiting
to be established.

This should avoid an issue when during heavy load, outgoing connection
could connect (TX event), send open, but then failed to receive OPEN /
establish in time, not sending notifications between and therefore
got hold timer expired error from the neighbor immediately after it
finally established the connection.
2016-04-06 11:49:34 +02:00
Ondrej Zajicek (work) e86cfd41d9 KRT: Fix route learn scan when route changed
When a kernel route changed, function krt_learn_scan() noticed that and
replaced the route in internal kernel FIB, but after that, function
krt_learn_prune() failed to propagate the new route to the nest, because
it confused the new route with the (removed) old best route and decided
that the best route did not changed.

Wow, the original code (and the bug) is almost 17 years old.
2016-04-06 11:46:25 +02:00
Jan Moskyto Matejka ea0a8be2ff IO/Poll: fix mistaken variable merge
The events variable is used in the short loop decision. The reasons are
not much clear, keeping this to keep the former behaviour.
2016-03-30 16:21:32 +02:00
Jan Moskyto Matejka 9c92f69272 Unix: Substituted select -> poll also in congestion checker
It does strange things when even one fd larger than FD_SETSIZE is
passed to select().
2016-03-18 11:47:13 +01:00
Jan Moskyto Matejka fd926ed4ee Poll: Prevent the improbable case of EAGAIN after POLLIN 2016-03-15 14:57:49 +01:00
Jan Moskyto Matejka e1c13a5a7b Unix: Rework of select-loop to poll-loop
This should lift the limit of FD_SETSIZE and allow more than 1024 fd's.
FD_SETSIZE limit doesn't matter now when creating new sockets.
2016-03-11 12:45:10 +01:00
Ondrej Zajicek (work) c2106b674c Unix: Fix bug in syslog name handling
Pointer to current_log_name has to be changed even if the name is the
same, because the old one will be invalid/freed after reconfiguration.
2016-02-11 21:53:55 +01:00