Commit graph

1403 commits

Author SHA1 Message Date
Ondrej Zajicek (work) caa9d03d65 Babel: Fix handling of missing IPv4 next hops
In case of missing IPv4 next hop, we should skip such routes
on transmit and ignore such routes on receive.

Thanks to Julian Schuh for the bugreport and Toke Hoiland-Jorgensen
for the original patch.
2018-06-13 15:22:29 +02:00
Ondrej Zajicek (work) 9c9050ff12 BGP: Handle missing NEXT_HOP attribute properly
RFC 7606 specifies handle-as-withdraw instead of session reset.
2018-06-13 14:47:37 +02:00
Jan Maria Matejka 13c0be19d3 Nest: Removing separate tmpa from route propagation
This is a fundamental change of an original (1999) concept of route
processing inside BIRD. During import/export, there was a temporary
ea_list created which was to be used instead of the another one inside
the route itself.

This led to some confusion, quirks, and strange filter code that handled
extended route attributes. Dropping it now.

The protocol interface has changed in an uniform way -- the
`struct ea_list *attrs` argument has been removed from store_tmp_attrs(),
import_control(), rt_notify() and get_route_info().
2018-05-30 17:08:49 +02:00
Ondrej Zajicek (work) 18b4f2082c OSPF: Fix invalid NSSA RFC references 2018-05-29 14:23:14 +02:00
Jan Maria Matejka ee7e2ffd26 Protocol: Introducing an enum protocol_class
This supersedes the EAP_* constants.
2018-05-29 12:35:06 +02:00
Ondrej Zajicek (work) feae132e0f Do not initialize route metrics in import_control hook
During route export, the receiving protocol often initialized route
metrics to default value in its import_control hook before export filter
was executed. This is inconsistent with the expectation that an export
filter would process the same route as one in the routing table and it
breaks setting these metrics before (e.g. for static routes directly in
static protocol).

The patch removes the initialization of route metrics in import_control
hook, the default values are already handled in rt_notify hook called
after export filters.

The patch also changed the behavior of OSPF to keep metrics when a route
is reannounced between OSPF instances (to be consistent with other
protocols) and the behavior when both ospf_metric1 and ospf_metric2
are specified (to have more expected behavior).
2018-05-24 14:51:05 +02:00
Ondrej Zajicek (work) 70fab17837 Babel: Add option to randomize router ID
When a Babel node restarts, it loses its sequence number, which can cause
its routes to be rejected by peers until the state is cleared out by other
nodes in the network (which can take on the order of minutes).

There are two ways to fix this: Having stable storage to keep the sequence
number across restarts, or picking a different router ID each time.

This implements the latter, by introducing a new option that will cause
BIRD to randomize a high 32 bits of router ID every time it starts up.
This avoids the problem at the cost of not having stable router IDs in
the network.

Thanks to Toke Hoiland-Jorgensen for the patch.
2018-05-03 16:55:11 +02:00
Ondrej Zajicek (work) 23b079043b Babel: Fix type of route entry router ID
The router ID being assigned to routes was a uint, which discards the
upper 32 bits. This also has the nice side effect of echoing the wrong
router ID back to other routers.

Thanks to Toke Hoiland-Jorgensen for the patch.
2018-05-03 16:02:29 +02:00
Ondrej Zajicek (work) 4727d1db9d OSPF: Support of authentication trailer for OSPFv3
Implement RFC 7166, crypthographic authentication for OSPFv3
analogous to authentication used for OSPFv2.
2018-04-25 15:54:53 +02:00
Ondrej Zajicek (work) f3a8cf050e BGP: Fix extended next hop handling
For IPv4 with extended next hop, we use MP-BGP format and therefore no
independent NEXT_HOP attribute.

Thanks to Arvin Gan for the bugreport.
2018-04-12 16:55:56 +02:00
Ondrej Zajicek (work) d0f47327f8 Merge branch 'master' into int-new 2018-03-07 17:41:49 +01:00
Ondrej Zajicek (work) 2d6d4b8053 Babel: Fix build with restricted protocol set
All keywords used in Babel config have to be declared locally.

Thanks to Leo Vandewoestijne for the bugreport.
2018-03-07 17:35:24 +01:00
Ondrej Zajicek (work) 5ce7adfcf9 Babel: Fix accidental bitwise or assignment
Fix an accidental bitwise or assignment that was supposed to be a
comparison.

Thanks to Toke Hoiland-Jorgensen for the patch.
2018-02-13 16:42:03 +01:00
Ondrej Zajicek (work) 185a0a51f8 Babel: Add source-specific routing support
This patch adds support for source-specific routing to the Babel protocol.
It changes the protocol to support both NET_IP6 and NET_IP6_SADR channels
for IPv6 addresses. If only a NET_IP6 channel is configured,
source-specific updates are ignored. Otherwise, non-source-specific
routes are simply treated as source-specific routes with SADR prefix 0.

Thanks to Toke Hoiland-Jorgensen for the original patch.
Minor changes by Ondrej Santiago Zajicek.
2018-02-13 16:40:14 +01:00
Ondrej Zajicek (work) 75d98b6013 Merge branch 'master' into int-new 2018-01-23 18:29:32 +01:00
Jan Maria Matejka 8adaf730c0 Pipe: show export state 2018-01-23 13:52:17 +01:00
Jan Maria Matejka c591810d46 Pipe: fixed template bug
When pipe inherited from template, every channel config was lost.
2018-01-23 13:52:01 +01:00
Ondrej Zajicek (work) 63472779ad BGP: Implement 'disable after cease' option
The option allows to specify that some cease subcodes should
disable the protocol when received.
2018-01-16 19:17:04 +01:00
Ondrej Zajicek (work) 3831b61966 BGP: Require explicit import and export policies for EBGP channels
To comply with RFC 8212 requirements.
2018-01-16 04:14:49 +01:00
Ondrej Zajicek (work) 2e507a7457 Use non-fatal asserts even for regular build 2018-01-10 16:17:37 +01:00
Ondrej Zajicek (work) 72163bd5f3 Nest: Allow modification of channels inherited from templates
Multiple definitions of same channels are forbidden, but inherited
channel can be redefined. In such case channel options are merged.
2018-01-09 18:42:22 +01:00
Ondrej Zajicek (work) d493d0f180 BGP: Fix unknown attribute handling 2018-01-02 16:57:45 +01:00
Ondrej Zajicek (work) e62cd03307 BGP: Fix graceful restart timer
Should use remote value, not local value.
2018-01-02 14:30:08 +01:00
Ondrej Zajicek (work) e87a95d97d Minor fixes for debug mode 2017-12-16 16:31:43 +01:00
Ondrej Zajicek (work) 8396094156 Minor cleanups 2017-12-14 22:15:01 +01:00
Ondrej Zajicek (work) d807ea087f BGP: Fix non-transitive ext communities 2017-12-13 15:57:44 +01:00
Ondrej Zajicek (work) a32a7b58ce Lib: Fix macro/keyword collisions
Old code breaks with some versions of bison
2017-12-10 13:16:31 +01:00
Ondrej Zajicek (work) 7fc55925be Several minor fixes 2017-12-10 00:55:34 +01:00
Ondrej Zajicek (work) dea9886454 BGP: Link check just for single-hop 2017-12-08 17:04:59 +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) 49c7ef3b21 BGP: Fix IPv6 MPLS/VPN multicast SAFI 2017-12-08 14:00:36 +01:00
Ondrej Zajicek (work) ccee67ca3b BGP: Autoconfigure BGP next hops from preferred addresses 2017-12-08 02:26:17 +01:00
Ondrej Zajicek (work) 830ba75e6d Merge commit '1e8721e2aeccfbc3f533e8b8abc07582cee77e9a' into int-new 2017-12-07 21:54:47 +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) 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) 3b3b0910ff Babel: More changes and bugfixes
Several changes and bugfixes in Babel, namely:

- Exported route parameters stored directly in route table entry
- Exported non-babel routes no longer stored in per-entry route list
- Route update, selection and retraction simplified and fixed
- Route feasibility is evalualated per update and stored with route
- Unreachable route handling fixed, based on hold interval
- Added 'show babel routes' command

Overall, it fixes some issues with proper propagation of triggered
updates, making Babel convergence after topology change almost
instant.
2017-12-07 13:53:42 +01:00
Ondrej Zajicek (work) dbf1ed263c Babel: Fix handling of seqno requests
Old behavior has several deficiencies compared to standard behavior
(no triggered updates for replies, no retransmissions, ...).
2017-12-07 13:53:42 +01:00
Ondrej Zajicek (work) 672fb78e12 Babel: Fix handling of IPv4 retractions
Babel TLV parsing code rejected IPv4 retractions without next-hop,
although next-hop is needed just for regular updates.
2017-12-07 13:53:42 +01:00
Ondrej Zajicek (work) 268dc7c8b3 Babel: Remove babel_proto ptr from babel_entry 2017-12-07 13:53:42 +01:00
Ondrej Zajicek (work) 738a57b69b Babel: Fix hello timeout for short hello intervals 2017-12-07 13:53:42 +01:00
Ondrej Zajicek (work) b47eaefe12 Babel: Revamp cost computation and run route selection when cost change
Also fix several minor bugs and add 'limit' option for k-out-of-j
link sensing strategy. Change default from 8-of-16 to 12-of-16.
Change IHU expiry factor from 1.5 to 3.5 (as in RFC 6126).
2017-12-07 13:53:42 +01:00
Ondrej Zajicek (work) f00221fadb Babel: Fix unicast seqno requests 2017-12-07 13:53:42 +01:00
Ondrej Zajicek (work) 38f4721092 Babel: Avoid batch seqno updates 2017-12-07 13:53:42 +01:00
Ondrej Zajicek (work) 5ee69d11f2 Babel: Fix Hello and IHU expiration 2017-12-07 13:53:42 +01:00
Ondrej Zajicek (work) 8b58f565e4 Babel: Update to new timers 2017-12-07 13:53:42 +01:00
Ondrej Zajicek (work) cc881bd155 BGP: Update to new timers 2017-12-07 13:53:42 +01:00
Ondrej Zajicek (work) b32d557a6e OSPF: Update to new timers
Note that recurrent timers are currently limited to ~1 hour.
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) 92cc1e7457 RIP: Update to new timers 2017-12-07 13:53:42 +01:00
Ondrej Zajicek (work) c521b3ac32 RAdv: Update to new timers 2017-12-07 13:53:42 +01:00
Ondrej Zajicek (work) d59c1a2958 RPKI: Update to new timers 2017-12-07 13:52:21 +01:00
Ondrej Zajicek (work) d3fa9e84e9 Timers: Show sub-second times in some protocol outputs 2017-12-07 13:49:27 +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) 534215a18f Timers: Split microsecond timers from BFD code to lib 2017-12-07 13:46:53 +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) 1e8721e2ae Babel: Parse flags in Hello TLV
RFC6126bis introduces a flags field for the Hello TLV, and adds a unicast flag
that is used to signify that a hello was sent as unicast. This adds parsing of
the flags field and ignores such unicast hellos, which preserves compatibility
until we can add a proper implementation of the unicast hello mechanism.

Thanks to Toke Hoiland-Jorgensen for the patch.
2017-11-28 19:33:33 +01:00
Jan Maria Matejka 4ae3ee1200 Babel: Interface address irrelevant for interface pattern matching. 2017-10-17 16:52:18 +02:00
Ondrej Zajicek (work) 2d7fb19c3c OSPF: Add option to disable OSPFv3-AF 2017-10-10 16:10:02 +02:00
Ondrej Zajicek (work) 2549300b54 OSPF: Fix minor issue in TTL check
The TTL check must be done after instance ID dispatch to avoid warnings
when a physical iface is shared by multiple instances and some use TTL
security and some not.
2017-10-10 16:10:02 +02:00
Ondrej Zajicek (work) f097f7659c OSPF: Fix next hop calculation for PtP links in IPv4 OSPFv3-AF
In such case, next hop has to be taken from Link-LSA like in broadcast
case, not from neighbor source address like in other PtP cases.

Also add some checks, comments and code cleanup.
2017-10-10 16:10:02 +02:00
Ondrej Zajicek (work) d3f4f92b0e OSPF: Support of address families in OSPFv3
OSPFv3-AF can handle multiple topologies of diferent address families
(IPv4, IPv6, both unicast and multicast) using separate instances
distinguished by instance ID ranges.
2017-10-10 16:10:02 +02:00
Ondrej Zajicek (work) 7c0bab3a39 RAdv: Change specific route options to be per-interface
And change default values of specific route options to be consistent with
values of default router options.
2017-10-06 12:24:37 +02:00
Michal 'vorner' Vaner 2a95e63343 RAdv: Support for more specific routes (RFC 4191)
The patch implements Default Router Preferences and More-Specific Routes
(RFC 4191) for RAdv protocol, allowing to announce router preference and
more specific routes in router advertisements. Routes can be exported to
RAdv like to regular routing protocols.

Some cleanups, bugfixes and other changes done by Ondrej Zajicek.
2017-10-04 16:27:02 +02:00
Ondrej Zajicek (work) cd1d99611e BGP: Shutdown communication (RFC 8203)
The patch implements BGP Administrative Shutdown Communication (RFC 8203)
allowing BGP operators to pass messages related to BGP session
administrative shutdown/restart. It handles both transmit and receive of
shutdown messages. Messages are logged and may be displayed by show
protocol all command.

Thanks to Job Snijders for the basic patch.
2017-09-19 19:57:52 +02:00
Ondrej Zajicek (work) f2dd602fef Backport some minor changes from int-new 2017-09-12 16:33:29 +02:00
Ondrej Zajicek (work) 9f4908fe78 Nest: VRF support for neighbor cache and olock code
Actually much simpler than expected.
2017-09-12 15:49:36 +02: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) 08b6a617e8 RAdv: Some style nitpicks 2017-08-30 16:34:15 +02:00
Michal 'vorner' Vaner ec7d6a506e RAdv: Configure how long a dead prefix is advertised 2017-08-30 16:34:15 +02:00
Michal 'vorner' Vaner e2d2b3ef21 RAdv: Buffer prefixes awhile after they disappear
Keep a cache of all the relevant prefixes we send out. When a prefix
appears, insert it into the cache. If it dies, keep it there for a
while, marked as dead.

Send out the dead prefixes with zero lifetime.
2017-08-30 16:34:15 +02:00
Michal 'vorner' Vaner 3ac5d1ce4c RAdv: Extract prefix option preparation
Put the prefix option preparation into a separate function. We're going
to reuse that bit of code.
2017-08-30 16:34:15 +02:00
Ondrej Zajicek (work) 69f7399247 Merge branch 'master' into int-new 2017-08-09 12:46:27 +02:00
Ondrej Zajicek (work) b3fae3a817 RAdv: Fix typo 2017-08-09 12:41:44 +02:00
Michal 'vorner' Vaner 1f182675c8 RAdv: Style updates
Adapt the naming conventions to be a bit closer to the other protocols.

proto_radv -> radv_proto
struct radv_proto *ra -> struct radv_proto *p
struct proto *p -> struct proto *P
2017-08-09 12:38:20 +02:00
Michal 'vorner' Vaner 5a41eed26d RAdv: Style updates
Adapt the naming conventions to be a bit closer to the other protocols.

proto_radv -> radv_proto
struct radv_proto *ra -> struct radv_proto *p
struct proto *p -> struct proto *P
2017-08-09 12:22:15 +02:00
Michal 'vorner' Vaner 637ed49868 radv: Fix RFC reference in comments 2017-08-09 11:59:36 +02:00
Michal 'vorner' Vaner afd9845e26
radv: Fix RFC reference in comments 2017-08-04 10:52:57 +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) 5220cb63e3 Babel: Fix pointer arithmetic in subtlv parsing
The subtlv parsing code was doing byte-based arithmetic with non-void pointers,
causing it to read beyond the end of the packet.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2017-06-14 12:34:43 +02:00
Ondrej Zajicek (work) 145ebfa1df Babel: Parse sub-TLVs and skip TLVs with mandatory sub-TLV
RFC6126bis formally introduces sub-TLVs to the Babel protocol, including
mandatory sub-TLVs. This adds support for parsing sub-TLVs to the Babel
protocol and skips TLVs that contain mandatory sub-TLVs, as per the spec.

For details, see section 4.4 of
https://tools.ietf.org/html/draft-ietf-babel-rfc6126bis-02

Thanks to Toke Høiland-Jørgensen <toke@toke.dk> for the patch.
2017-06-09 14:33:06 +02:00
Ondrej Zajicek (work) b3c6273efa Babel: Implement IPv6 prefix compression on outgoing updates
Previously, the Babel protocol would never use prefix compression on outgoing
updates (but would parse it on incoming ones). This adds compression of IPv6
addresses of outgoing updates.

The compression only works to the extent that the FIB is walked in lexicographic
order; i.e. a prefix is only compressed if it shares bytes with the previous
prefix in the same packet.

Thanks to Toke Høiland-Jørgensen <toke@toke.dk> for the patch.
2017-06-09 13:00:20 +02:00
Ondrej Zajicek (work) 4324025f98 Babel: Add support for dual-stack IPv4/IPv6 operation
This adds support for dual-stack v4/v6 operation to the Babel protocol.
Routing messages will be exchanged over IPv6, but IPv4 routes can be
carried in the messages being exchanged. This matches how the reference
Babel implementation (babeld) works.

The nexthop address for v4 can be configured per interface, and will
default to the first available IPv4 address on the given interface. For
symmetry, a configuration option to configure the IPv6 nexthop address
is also added.

Thanks to Toke Høiland-Jørgensen <toke@toke.dk> for the patch.
2017-06-08 12:18:16 +02:00
Ondrej Zajicek (work) 6aaaa63519 Change parser to handle numbers as unsigned
Lexer always parsed numbers as unsigned, but parser handled them as
signed and grammar contained many unnecessary checks for negativity.
2017-05-23 17:40:19 +02:00
Ondrej Zajicek (work) 734e9fb8a9 Minor cleanups and fixes 2017-05-23 13:12:25 +02:00
Jan Moskyto Matejka 05d47bd53e Linpool: default allocation size 2017-05-16 15:34:57 +02:00
Ondrej Zajicek (work) 1d21306785 Minor fixes 2017-04-29 01:24:30 +02:00
Ondrej Zajicek (work) e919601aaf Merge master into int-new 2017-04-28 11:19:12 +02:00
Ondrej Zajicek (work) 4278abfe27 Check validity of dest w.r.t. net_type
Allow to define static roa/flow routes without dest.
2017-04-18 13:56:40 +02:00
Ondrej Zajicek (work) 711d617dc1 BGP: Add support for SAFI 129 (VPN multicast)
Which, in contrast to SAFI 128, does not use MPLS labels.
2017-04-12 16:04:22 +02:00
Ondrej Zajicek (work) ffb38dfb8b Static: Support for dual-AF IGP tables
When recursive routes with hybrid next hops (e.g. IPv6 route with IPv4 next
hop) are allowed, we need both IPv4 and IPv6 IGP tables.
2017-04-12 16:04:22 +02:00
Ondrej Zajicek (work) 6fe11c9941 BGP: Simplify igp table options 2017-03-29 15:31:04 +02:00
Ondrej Zajicek (work) c49e4a6565 BGP: Update list of supported standards 2017-03-29 13:48:23 +02:00
Ondrej Zajicek (work) ef57b70fa5 BGP: Support for routes with mixed-AF next hops
Covers IPv4/VPNv4 routes with IPv6 next hop (RFC 5549), IPv6 routes with
IPv4 next hop (RFC 4798) and VPNv6 routes with IPv4 next hop (RFC 4659).
Unfortunately it also makes next hop hooks more messy.

Each BGP channel now could have two IGP tables, one for IPv4 next hops,
the other for IPv6 next hops.
2017-03-26 19:20:15 +02:00
Ondrej Zajicek (work) 01111fc42c BGP: Bugfix in VPN NLRI encoding 2017-03-23 14:10:42 +01:00
Ondrej Zajicek (work) 1e37e35c3e BGP: Support for MPLS labels and VPN SAFI
Basic support for SAFI 4 and 128 (MPLS labeled IP and VPN) for IPv4 and
IPv6. Should work for route reflector, but does not properly handle
originating routes with next hop self.

Based on patches from Jan Matejka.
2017-03-22 18:16:49 +01:00
Jan Moskyto Matejka ead7b8f498 Merge branch 'nexthop-merged' into int-new 2017-03-22 14:54:00 +01:00
Jan Moskyto Matejka 3c74416465 Nexthop: Fixed recursive route mpls label merging 2017-03-17 15:48:32 +01:00