Commit graph

27 commits

Author SHA1 Message Date
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) 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) 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 637ed49868 radv: Fix RFC reference in comments 2017-08-09 11:59:36 +02: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 2bbc308321 Store protocol config size inside protocol structure
Make proto_config_new() use this info instead of supplied size.

Thanks to Alexander V. Chernikov for the patch.
2015-02-21 21:08:23 +01:00
Ondrej Zajicek 88a183c6c9 Integrated IP functions. 2014-10-24 11:11:43 +02:00
Ondrej Zajicek 751482899c Implements default router preference (RFC 4191) for RAdv.
Thanks to Baptiste Jonglez for the patch.
2014-07-07 22:56:21 +02:00
Ondrej Zajicek 05476c4d04 IPv4/IPv6 integrated socket code. 2014-05-18 11:42:26 +02:00
Ondrej Zajicek d7c0628591 Check validity of interface definitions.
Thanks to Aleksey Berezin for the bugreport.
2014-03-31 01:52:28 +02:00
Ondrej Zajicek 48e5f32db6 Many changes in I/O and OSPF sockets and packet handling.
I/O:
 - BSD: specify src addr on IP sockets by IP_HDRINCL
 - BSD: specify src addr on UDP sockets by IP_SENDSRCADDR
 - Linux: specify src addr on IP/UDP sockets by IP_PKTINFO
 - IPv6: specify src addr on IP/UDP sockets by IPV6_PKTINFO
 - Alternative SKF_BIND flag for binding to IP address
 - Allows IP/UDP sockets without tx_hook, on these
   sockets a packet is discarded when TX queue is full
 - Use consistently SOL_ for socket layer values.

OSPF:
 - Packet src addr is always explicitly set
 - Support for secondary addresses in BSD
 - Dynamic RX/TX buffers
 - Fixes some minor buffer overruns
 - Interface option 'tx length'
 - Names for vlink pseudoifaces (vlinkX)
 - Vlinks use separate socket for TX
 - Vlinks do not use fixed associated iface
 - Fixes TTL for direct unicast packets
 - Fixes DONTROUTE for OSPF sockets
 - Use ifa->ifname instead of ifa->iface->name
2014-02-06 17:46:01 +01:00
Ondrej Zajicek 41f8bf57c4 Changes identifiers to avoid use of reserved ones. 2013-11-22 21:59:43 +01:00
Ondrej Zajicek 1ec522538f BFD protocol, ready for release.
Supports OSPF and BGP and also statically configured sessions.
2013-11-19 22:33:48 +01:00
Ondrej Zajicek e1afee2799 Fixes socket error hook for radv protocol. 2013-07-24 14:19:37 +02:00
Ondrej Filip 155134f396 A few semicolons added to decrease a number of warnings. 2013-02-10 19:04:08 +01:00
Ondrej Zajicek 36da2857bc Implements router advertisements activated by received routes.
The RAdv protocol could be configured to change its behavior based on
availability of routes, e.g., do not announce router lifetime when a
default route is not available.
2013-02-08 23:58:27 +01:00
Ondrej Zajicek fc06fb6244 Implements RDNSS and DNSSL support for RAdv. 2012-07-07 14:26:42 +02:00
Ondrej Zajicek 2779d50a24 Fixes RAdv proto w.r.t. templates.
Thanks Alexander V. Chernikov for this.
2011-11-17 21:12:23 +01:00
Ondrej Zajicek a7f23f581f Implements protocol templates.
Based on the patch from Alexander V. Chernikov.
Extended to support almost all protocols.
Uses 'protocol bgp NAME from TEMPLATE { ... }' syntax.
2011-11-07 00:31:23 +01:00
Ondrej Zajicek d8b5a786d2 IPV6_CHECKSUM should not be used on ICMPv6 sockets. 2011-06-25 11:35:54 +02:00
Ondrej Zajicek 93e868c730 Implements Router Advertisement protocol. 2011-03-13 11:33:50 +01:00