Commit graph

736 commits

Author SHA1 Message Date
Ondrej Zajicek (work)
be17805c0b Add support for source-specific IPv6 routes to BIRD core
This patch adds support for source-specific IPv6 routes to BIRD core.
This is based on Dean Luga's original patch, with the review comments
addressed. SADR support is added to network address parsing in confbase.Y
and to the kernel protocol on Linux.

Currently there is no way to mix source-specific and non-source-specific
routes (i.e., SADR tables cannot be connected to non-SADR tables).

Thanks to Toke Hoiland-Jorgensen for the original patch.
Minor changes by Ondrej Santiago Zajicek.
2018-02-13 16:39:07 +01:00
Ondrej Zajicek (work)
28b3b55122 KRT: Fix IPv6 route learn
Internal table used for route learn was created with non-matching net
type for IPv6 kernel proto.

Thanks to Toke Hoiland-Jorgensen for the bugreport
2018-02-06 16:08:45 +01:00
Ondrej Zajicek (work)
75d98b6013 Merge branch 'master' into int-new 2018-01-23 18:29:32 +01:00
Ondrej Zajicek (work)
d6cf996151 IO: Fix socket priority
On Linux, setting the ToS will also set the priority and the range of
accepted values is quite limited (masked by 0x1e). Therefore, 0xc0 is
translated to a priority of 0, not something we want, overriding the
"7" priority which was set previously explicitely. To avoid that, just
move setting priority later in the code.

Thanks to Vincent Bernat for the patch.
2018-01-23 17:05:45 +01:00
Ondrej Zajicek (work)
ace3072e09 KRT: Fix option 'merge paths' 2018-01-23 15:12:43 +01:00
Ondrej Zajicek (work)
e5ff7929c4 KRT: Remove useless option 2018-01-23 14:48:07 +01:00
Ondrej Zajicek (work)
b940579115 Filter: Allow silent filter execution
A filter should log messages only if executed explicitly (e.g., during
route export or route import). When a filter is executed for technical
reasons (e.g., to establish whether a route was exported before), it
should run silently.
2018-01-16 16:20:01 +01:00
Ondrej Zajicek (work)
4db4ac7243 NEWS and version update 2018-01-14 21:52:58 +01:00
Ondrej Zajicek (work)
4d36796131 KRT: Fix direct routes for BSD
Old way to set direct routes is to use local IP as gateway, but that does
not work properly on newer FreeBSDs. Now we use sockaddr_dl containing
interface index as gateway.
2018-01-14 19:21:39 +01:00
Ondrej Zajicek (work)
a63e78c31a Fix build without limited protocol set 2017-12-18 23:15:07 +01:00
Ondrej Zajicek (work)
3013fc57bd Netlink: Fix memory leak 2017-12-16 00:42:56 +01:00
Ondrej Zajicek (work)
c36a298c21 Use git describe for BIRD version
Based on patch from Pavel Tvrdik
2017-12-13 19:18:30 +01:00
Ondrej Zajicek (work)
3e7923507b Netlink: Use linpool instead of static buffer 2017-12-13 15:27:33 +01:00
Ondrej Zajicek (work)
ac48e72bf6 Fix some minor issues 2017-12-12 15:57:14 +01:00
Ondrej Zajicek (work)
66acbc8d7f Revive FIB and kernel MPLS code 2017-12-12 00:05:49 +01:00
Ondrej Zajicek (work)
d4eada9e0f NEWS and version update 2017-12-11 02:05:35 +01:00
Ondrej Zajicek (work)
c99050cce2 KRT: Fix bug in multipath handling 2017-12-11 01:04:15 +01:00
Ondrej Zajicek (work)
cf3e3845c2 Doc: Documentation update 2017-12-10 22:47:38 +01:00
Maria Jan Matejka
6b0f5f68a8 Switchoff for MPLS in kernel. 2017-12-10 18:30:00 +01:00
Ondrej Zajicek (work)
67a2eb9177 Lib: Check size of nets 2017-12-10 13:18:36 +01:00
Ondrej Zajicek (work)
517d05dff1 Enable ECMP and Link detection by default
ECMP is not enabled on BSD, where it is not supported by BIRD.
2017-12-08 16:00:33 +01:00
Ondrej Zajicek (work)
46434a3cad Merge commit '7b2c5f3d2826e3175bf31b1c36056c9efc587a2b' into int-new 2017-12-07 18:35:46 +01:00
Ondrej Zajicek (work)
4ff15a75c5 Merge commit '98bb80a243b58c43453e9be69d19d0350286549c' into int-new 2017-12-07 17:41:09 +01:00
Ondrej Zajicek (work)
cd80c9b070 BSD: Fix in the last commit 2017-12-07 14:21:38 +01:00
Ondrej Zajicek (work)
a6f79ca57f Timers: Revert temporary names and remove old timer.h 2017-12-07 13:54:59 +01:00
Ondrej Zajicek (work)
574b232427 Timers: Fix TBF and some last remains 2017-12-07 13:53:42 +01:00
Ondrej Zajicek (work)
6b5cd7c05f Sysdep: Remove old timer code 2017-12-07 13:53:42 +01:00
Ondrej Zajicek (work)
3e405fb188 Nest: Update to new timers 2017-12-07 13:53:42 +01:00
Ondrej Zajicek (work)
ee528fbd5d Timers: Add typecast to unit-converting macros 2017-12-07 13:53:42 +01:00
Ondrej Zajicek (work)
21f4f0f4b0 Kernel: Update to new timers 2017-12-07 13:52:21 +01:00
Ondrej Zajicek (work)
f047271cb9 Timers: Parse and format functions for microsecond times
Date/time output (e.g. in logs, show commands) can use %f to specify
subsecond time. By default, millisecond precision is used in output.
2017-12-07 13:49:27 +01:00
Ondrej Zajicek (work)
025525266f Timers: Replace old timers with microsecond timers
The old timer interface is still kept, but implemented by new timers. The
plan is to switch from the old inteface to the new interface, then clean
it up.
2017-12-07 13:49:27 +01:00
Ondrej Zajicek (work)
28a7d3943e Timers: Integrate microsecond timers to the main loop 2017-12-07 13:46:53 +01:00
Ondrej Zajicek (work)
534215a18f Timers: Split microsecond timers from BFD code to lib 2017-12-07 13:46:53 +01:00
Ondrej Zajicek (work)
7c454d9186 BSD: Minor fix of penultimate commit 2017-12-07 13:44:00 +01:00
Ondrej Zajicek (work)
abae1cc58b KRT: Minor fix of last commit 2017-12-07 13:28:24 +01:00
Ondrej Zajicek (work)
153f02da3b Nest: Maintain separate IPv4, IPv6 and LLv6 preferred addresses
Also redesign preferred address selection and update protocols to use
appropriate preferred address.

Based on a previous work by Jan Maria Matejka.
2017-12-07 13:06:01 +01:00
Ondrej Zajicek (work)
943478b00f Basic VRF support
Add basic VRF (virtual routing and forwarding) support. Protocols can be
associated with VRFs, such protocols will be restricted to interfaces
assigned to the VRF (as reported by Linux kernel) and will use sockets
bound to the VRF. E.g., different multihop BGP instances can use diffent
kernel routing tables to handle BGP TCP connections.

The VRF support is preliminary, currently there are several limitations:

- Recent Linux kernels (4.11) do not handle correctly sockets bound
to interaces that are part of VRF, so most protocols other than multihop
BGP do not work. This will be fixed by future kernel versions.

- Neighbor cache ignores VRFs. Breaks config with the same prefix on
local interfaces in different VRFs. Not much problem as single hop
protocols do not work anyways.

- Olock code ignores VRFs. Breaks config with multiple BGP peers with the
same IP address in different VRFs.

- Incoming BGP connections are not dispatched according to VRFs.
Breaks config with multiple BGP peers with the same IP address in
different VRFs. Perhaps we would need some kernel API to read VRF of
incoming connection? Or probably use multiple listening sockets in
int-new branch.

- We should handle master VRF interface up/down events and perhaps
disable associated protocols when VRF goes down. Or at least disable
associated interfaces.

- Also we should check if the master iface is really VRF iface and
not some other kind of master iface.

- BFD session request dispatch should be aware of VRFs.

- Perhaps kernel protocol should read default kernel table ID from VRF
iface so it is not necessary to configure it.

- Perhaps we should have per-VRF default table.
2017-09-06 17:38:48 +02:00
Ondrej Zajicek (work)
98bb80a243 KRT: Fix IPv6 ECMP handling with Linux 4.11+
Starting from Linux 4.11, IPv6 ECMP routes are now notified using
RTA_MULTIPATH, like IPv4 ones. The patch adds support for RTA_MULTIPATH
parsing for IPv6 routes. This also enables to parse ECMP alien routes
correctly.

Thanks to Vincent Bernat for the original patch.
2017-09-05 00:02:20 +02:00
Ondrej Zajicek (work)
9befc7cc4f BSD: Fix alignment issue
Incorrect structure alignment breaks kernel routing table updates on
FreeBSD/ARM (and perhaps other platforms).

Thanks to Eugene Sevastyanov for the original patch.
2017-09-04 22:32:45 +02:00
Ondrej Zajicek (work)
a1f5e514ef Implement onlink flag for nexthops
Add proper support for per-nexthop onlink flag in routes to handle next
hop addresses that are not covered by interface IP ranges. Supported by
kernel and static protocols.

Thanks to Vincent Bernat for the idea.
2017-07-04 23:36:21 +02:00
Ondrej Zajicek (work)
734e9fb8a9 Minor cleanups and fixes 2017-05-23 13:12:25 +02:00
Ondrej Zajicek (work)
5a9169e152 Merge branch 'master' into int-new 2017-05-18 14:28:03 +02:00
Ondrej Zajicek (work)
78e4dac993 Fix some forgotten warnings 2017-05-18 14:26:57 +02:00
Ondrej Zajicek (work)
d19617f06b Merge remote-tracking branch 'origin/int-new' into int-new 2017-05-17 14:50:00 +02:00
Jan Moskyto Matejka
05d47bd53e Linpool: default allocation size 2017-05-16 15:34:57 +02:00
Ondrej Zajicek (work)
1c5b4c5d5b Merge branch 'master' into int-new 2017-05-16 14:56:01 +02:00
Ondrej Zajicek (work)
b845ea097c Remove autoconf macros for time_t and alignment
Replaced by constant compile-time expressions. CPU_STRUCT_ALIGN is not
really correct, but is consistent with the old behavior.
2017-05-16 13:05:00 +02:00
Ondrej Zajicek (work)
e40542ef3a Minor autoconf cleanup and documentation update 2017-05-16 12:59:22 +02:00
Ondrej Zajicek (work)
c253ec3a9c Some more autoconf cleanups
Replace integer type width detection with C99 fixed-width types.
Also remove some unused or obsolete code.

Thanks to Ruben Kerkhof for the patchset.
2017-05-16 12:59:22 +02:00
Ondrej Zajicek (work)
fd1f355b7b Merge branch 'master' into int-new 2017-05-09 17:37:38 +02:00
Ondrej Zajicek (work)
71652572e3 Minor autoconf cleanup and documentation update 2017-05-09 16:46:41 +02:00
Ondrej Zajicek (work)
525a88d879 Merge branch 'master' into int-new 2017-05-09 14:48:21 +02:00
Ondrej Zajicek (work)
5d6dc93043 Some more autoconf cleanups
Replace integer type width detection with C99 fixed-width types.
Also remove some unused or obsolete code.

Thanks to Ruben Kerkhof for the patchset.
2017-05-09 13:45:26 +02:00
Ondrej Zajicek (work)
95639d9577 Device: Fix option 'primary' 2017-05-03 12:56:17 +02:00
Ondrej Zajicek (work)
92a85089b8 NEWS and version update 2017-04-29 21:49:13 +02:00
Ondrej Zajicek (work)
b644a490f0 BSD: Fix address scan on OpenBSD 2017-04-29 18:37:51 +02:00
Ondrej Zajicek (work)
1d21306785 Minor fixes 2017-04-29 01:24:30 +02:00
Jan Moskyto Matejka
97e48b6a18 Adding also our copy of struct rtvia. 2017-04-12 16:04:22 +02:00
Jan Moskyto Matejka
54635f435a Include local lwtunnel.h unless found in system 2017-04-12 16:04:22 +02:00
Ondrej Zajicek (work)
bff21441dd Netlink: Change default kernel metric to 32
This avoids collisions with non-BIRD routes in kernel tables.
2017-03-29 16:10:00 +02:00
Ondrej Zajicek (work)
ed6100441e Netlink: Better handling of an error case 2017-03-29 15:55:39 +02:00
Ondrej Zajicek (work)
7074be22f1 Netlink: Fix device route delete 2017-03-28 18:27:08 +02:00
Ondrej Zajicek (work)
d1b8fe93f0 Netlink: Fix bug in RTA_PRIORITY handling 2017-03-28 16:05:40 +02:00
Ondrej Zajicek (work)
7a855725f2 Some autoconf cleanups
The patch allows to use autoreconf, replaces some long obsolete
constructs and does some other minor cleanups. Also, the file
configure.in is renamed to configure.ac, as the old name has been
deprecated for a long time.

Thanks to Ruben Kerkhof for the patchset.
2017-03-14 13:53:52 +01:00
Jan Moskyto Matejka
c609d03986 Merge branch 'int-new' into nexthop-merged 2017-02-22 11:58:04 +01:00
Ondrej Zajicek (work)
62e64905b7 Several minor fixes 2017-02-20 02:26:45 +01:00
Ondrej Zajicek (work)
c259669fa3 Merge branch 'master' into int-new 2017-02-08 14:34:48 +01:00
Ondrej Zajicek (work)
f6e6c3b5a5 Fix IP_HDRINCL usage on FreeBSD 11
FreeBSD 11 changed endianity of ip_len field from host order to network
order. Also DragonFly BSD allegedly expects network order here.

Thanks to Olivier Cochard-Labbé for the patch.
2017-01-17 13:21:25 +01:00
Jan Moskyto Matejka
d14f8c3c45 Netlink: MPLS routes in kernel
Anyway, Bird is now capable to insert both MPLS routes and MPLS encap
routes into kernel.

It was (among others) needed to define platform-specific AF_MPLS to 28
as this constant has been assigned in the linux kernel.

No support for BSD now, it may be added in the future.
2016-12-22 21:38:33 +01:00
Jan Moskyto Matejka
5b208e296f Removing (struct rta)->cast. Never used. 2016-12-22 13:09:59 +01:00
Jan Moskyto Matejka
4e276a8920 Merged multipath and single-path data structures.
Dropped struct mpnh and mpnh_*()
Now struct nexthop exists, nexthop_*(), and also included struct nexthop
into struct rta.

Also converted RTD_DEVICE and RTD_ROUTER to RTD_UNICAST. If it is needed
to distinguish between these two cases, RTD_DEVICE is equivalent to
IPA_ZERO(a->nh.gw), RTD_ROUTER is then IPA_NONZERO(a->nh.gw).

From now on, we also explicitely want C99 compatible compiler. We assume
that this 20-year norm should be known almost everywhere.
2016-12-22 13:01:06 +01:00
Ondrej Zajicek (work)
017da76b72 NEWS and version update 2016-12-21 16:46:47 +01:00
Jan Moskyto Matejka
2c33da5070 Netlink: fix occasional netlink hangs on busy machines 2016-12-20 20:36:56 +01:00
Ondrej Zajicek (work)
5546aad260 NEWS and version update 2016-12-07 19:56:42 +01:00
Jan Moskyto Matejka
ad88b94bca Merge branch 'int-new-rpki-squashed' (early part) into int-new 2016-12-07 15:30:46 +01:00
Ondrej Zajicek (work)
d15b0b0a1b BGP redesign
Integrated and extensible BGP with generalized AFI handling,
support for IPv4+IPv6 AFI and unicast+multicast SAFI.
2016-12-07 14:20:52 +01:00
Jan Moskyto Matejka
af62c0f9f1 LibSSH may be switched off together with RPKI 2016-12-07 14:15:35 +01:00
Jan Moskyto Matejka
cdbe1defa4 SSH: Commented quirk based on undocumented behavior of LibSSH 2016-12-07 09:35:24 +01:00
Pavel Tvrdík
65d2a88dd2 RPKI protocol with one cache server per protocol
The RPKI protocol (RFC 6810) using the RTRLib
(http://rpki.realmv6.org/) that is integrated inside
the BIRD's code.

Implemeted transports are:
 - unprotected transport over TCP
 - secure transport over SSHv2

Example configuration of bird.conf:
  ...
  roa4 table r4;
  roa6 table r6;

  protocol rpki {
    debug all;

    # Import both IPv4 and IPv6 ROAs
    roa4 { table r4; };
    roa6 { table r6; };

    # Set cache server (validator) address,
    # overwrite default port 323
    remote "rpki-validator.realmv6.org" port 8282;

    # Overwrite default time intervals
    retry   10;         # Default 600 seconds
    refresh 60;         # Default 3600 seconds
    expire 600;         # Default 7200 seconds
  }

  protocol rpki {
    debug all;

    # Import only IPv4 routes
    roa4 { table r4; };

    # Set cache server address to localhost,
    # use default ports tcp => 323 or ssh => 22
    remote 127.0.0.1;

    # Use SSH transport instead of unprotected transport over TCP
    ssh encryption {
      bird private key "/home/birdgeek/.ssh/id_rsa";
      remote public key "/home/birdgeek/.ssh/known_hosts";
      user "birdgeek";
    };
  }
  ...
2016-12-07 09:35:24 +01:00
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