Commit graph

719 commits

Author SHA1 Message Date
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) 7d95c44572 OSPF: Fix ECMP external merging
The variable nfa is not cleaned before each loop iteration and can have
a wrong value of nfa.nhs_reuse from the previous step.

Thanks to Bernardo Figueiredo for the bugreport and analysis.
2016-12-15 15:37:27 +01:00
Ondrej Zajicek (work) 9e7d3a7810 OSPF: Fix net-summary origination combined with stubnet option
Stubnet nodes in OSPF FIB were removed during rt_sync(), but the pointer
remained in top_hash_entry.nf, so net-summary LSA origination was
confused, reported 'LSA ID collision' and net-summary LSAs were not
originated properly.

Thanks to Naveen Chowdary Yerramneni for bugreport and analysis.
2016-12-13 17:34:42 +01:00
Ondrej Zajicek (work) c8cafc8ebb Minor code cleanups 2016-11-08 17:46:29 +01:00
Ondrej Zajicek (work) 29239ba2bb OSPF: Use message authentication interface
Based on former commit from Pavel Tvrdik
2016-11-02 17:53:22 +01:00
Ondrej Zajicek (work) de2a27e255 Add generic message authentication interface
Add generic interface for generating and verifying MACs (message
authentication codes). Replace multiple HMAC implementation with
a generic one.
2016-11-02 16:23:53 +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
Pavel Tvrdik 8e433d6a52 Prog Doc: Complete several missing parameters 2016-05-12 15:49:44 +02:00
Ondrej Zajicek (work) 39a6b19d6d OSPF: Fix bogus LSA ID collisions between received and originated LSAs
After restart, LSAs locally originated by the previous instance are
received from neighbors. They are installed to LSA db and flushed. If
export of a route triggers origination of a new external LSA before flush
of the received one is complete, the check in ospf_originate_lsa() causes
origination to fail (because en->nf is NULL for the old LSA and non-NULL
for the new LSA). The patch fixes this by updating the en->nf for LSAs
being flushed (as is already done for empty ones). Generally, en->nf
field deserves some better description in the code.

Thanks to Jigar Mehta for analyzing the problem.
2016-03-23 02:21:42 +01:00
Ondrej Zajicek (work) a459f4df16 OSPF: Fix reading from freed memory
Thanks to Pavel Tvrdik for noticing it.
2016-03-23 02:21:42 +01:00
Ondrej Zajicek (work) e3f506f9b5 OSPF: Multicast ability is irrelevant for stub interfaces 2016-02-25 18:23:39 +01:00
Pavel Tvrdík 33b4f40acc MD5: Mormalize naming style 2015-11-24 16:01:48 +01:00
Ondrej Zajicek (work) 8eb8e546dc Merge branch 'master' into rip-new 2015-10-17 14:44:34 +02:00
Ondrej Zajicek (work) 8465dccb06 Major RIP redesign
The new RIP implementation fixes plenty of old bugs and also adds support
for many new features: ECMP support, link state support, BFD support,
configurable split horizon and more. Most options are now per-interface.
2015-10-05 13:18:10 +02:00
Ondrej Zajicek b5e76398de OSPF: Fixes some issues with link detection
Thanks to Bernardo Figueiredo and Israel G. Lugo for the bugreport.
2015-08-19 11:16:23 +02:00
Ondrej Zajicek 1321e12ac4 Static: Allows to specify attributes for static routes
The patch adds suport for specifying route attributes together with
static routes, e.g.:

 route 10.1.1.0/24 via 10.0.0.1 { krt_advmss = 1200; ospf_metric1 = 100; };
2015-07-20 17:11:10 +02:00
Ondrej Zajicek d217ba5111 Moving of mulipath merging code from OSPF to nest 2015-06-08 02:24:08 +02:00
Pavel Tvrdík e348ef01b4 unsgined char -> byte 2015-06-08 02:24:08 +02:00
Ondrej Filip 398f922531 Typo fix by Hans van Kranenburg 2015-06-01 10:41:17 +02:00
Ondrej Zajicek 77edab6409 OSPF: Redesign LSA checksumming
New LSA checksumming code separates generic Fletcher-16 and OSPF-specific
code and avoids back and forth endianity conversions, making it much more
readable and also several times faster.
2015-05-01 14:40:56 +02:00
Ondrej Zajicek 30d09eb96e OSPF: Fixes validation of LSA checksums
Prior to this patch, BIRD validates the OSPF LSA checksum by calculating
a new checksum and comparing it with the checksum in the header. Due to
the specifics of the Fletcher checksum used in OSPF, this is not
necessarily correct as the checkbytes in the header may be calculated via
a different means and end up with a different value that is nonetheless
still correct.

The documented means of validating the checksum as specified in RFC 905
B.4 is to calculate c0 and c1 from the unchanged contents of the packet,
which must result in a zero value to be considered valid.

Thanks to Chris Boot for the patch.
2015-04-28 13:45:44 +02:00
Ondrej Zajicek ef3cac669c OSPF: Fixes handling of external routes with immediate gw
The bug caused that received external LSAs with locally reachable
next hops were ignored. I wonder why nobody noticed it sooner.
2015-04-18 13:26:45 +02:00
Ondrej Zajicek 304ac2e861 Minor fixes 2015-04-12 10:47:17 +02: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 ac9dc669d8 Bugfix in latest OSPF changes. 2014-11-03 20:35:25 +01:00
Ondrej Zajicek cd3b700393 Bugfix to OSPF reconfiguration. 2014-11-03 14:53:59 +01:00
Ondrej Zajicek 6f8bbaa10b Fininshing integrated OSPF. 2014-11-03 10:42:55 +01:00
Ondrej Zajicek 88a183c6c9 Integrated IP functions. 2014-10-24 11:11:43 +02:00
Ondrej Zajicek f8fefde318 Refactoring of OSPF messages. 2014-10-24 11:07:38 +02:00
Ondrej Zajicek 178a197afb OSPF instance id option and documentation update. 2014-07-21 21:50:56 +02:00
Ondrej Zajicek 742029eb78 Whitespace cleanup in OSPF. 2014-07-19 17:28:38 +02:00
Ondrej Zajicek a7a7372aa7 Temporary integrated OSPF commit. 2014-07-18 18:24:12 +02:00
Ondrej Zajicek 70945cb645 Temporary integrated OSPF commit. 2014-06-26 11:58:57 +02:00
Ondrej Zajicek 05476c4d04 IPv4/IPv6 integrated socket code. 2014-05-18 11:42:26 +02:00
Ondrej Zajicek 145368f547 Extends multipath support for OSPF.
Fixes cases where the same network or external route are propagated by
several OSPF routes and some other corner cases in next hop construction
and ECMP. Allows to specify whether external routes should be merged.

Thanks to Peter Christensen for the original patch.
2014-04-23 13:54:28 +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 10c2e1e012 Fixes crash when state of disabled OSPF protocol is queried.
Thanks to Ondrej Caletka for the bugreport.
2014-02-06 17:54:25 +01:00
Ondrej Zajicek cba9cbf1bd Silence this annoying warning. 2014-02-06 17:51:16 +01: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 283c7dfada Merge branch 'master' into add-path 2013-11-25 18:42:47 +01:00
Ondrej Zajicek c72aca41e5 OSPF ifaces on loopback should be stub. 2013-11-24 22:12:51 +01:00
Ondrej Zajicek 736e143fa5 Merge branch 'master' into add-path
Conflicts:

	filter/filter.c
	nest/proto.c
	nest/rt-table.c
	proto/bgp/bgp.h
	proto/bgp/config.Y
2013-11-23 11:50:34 +01:00
Ondrej Zajicek 77e43c8b72 Minor fixes. 2013-11-22 22:49:04 +01:00
Ondrej Zajicek 1fba34a7a1 Adds check for buffer size in OSPF LSA flood. 2013-11-22 18:45:57 +01:00
Ondrej Zajicek 0aeac9cb7f Merge commit 'origin/bfd' 2013-11-22 02:48:44 +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 33be3ba713 Accepts a change of OSPFv3 neighbor's IP address.
Thanks to Pierre Pfister for the patch.
2013-10-21 15:06:09 +02:00
Ondrej Zajicek 4df2019ebf Fixes build issues without BGP.
Thanks to Sergey Popovich for the patch.
2013-09-26 17:36:30 +02:00
Ondrej Zajicek 6a8d3f1c1f BFD work in progress.
Now it compiles and mostly works.
2013-09-16 23:57:40 +02:00
Ondrej Filip e550a37206 Fixes problem with OSPF neighbor router ID change. Thanx to Alexander V. Chernikov 2013-09-13 18:55:02 +02:00