Commit graph

233 commits

Author SHA1 Message Date
Pavel Tvrdik 8e433d6a52 Prog Doc: Complete several missing parameters 2016-05-12 15:49:44 +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 4bdf1881dc Channelize: rt_notify arg conversion table -> channel 2016-04-07 10:08:23 +02:00
Pavel Tvrdík 1bb3ecb2a5 Fix closing flushed channel
Fix reading from freed memory.
  Free at: channel_set_state(c, CS_DOWN)
  Read at: WALK_LIST2_DELSAFE(c, n, x, tab->channels, table_node)

==00:00:00:00.261 24718==
==00:00:09:31.755 24718== Invalid read of size 8
==00:00:09:31.755 24718==    at 0x4061BA: rt_prune_table (rt-table.c:1688)
==00:00:09:31.755 24718==    by 0x405D5E: rt_event (rt-table.c:1559)
==00:00:09:31.755 24718==    by 0x45D089: ev_run (event.c:85)
==00:00:09:31.755 24718==    by 0x45D158: ev_run_list (event.c:142)
==00:00:09:31.755 24718==    by 0x462814: io_loop (io.c:2412)
==00:00:09:31.755 24718==    by 0x468712: main (main.c:833)
==00:00:09:31.755 24718==  Address 0x5601538 is 136 bytes inside a block of size 304 free'd
==00:00:09:31.755 24718==    at 0x4C29D2A: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==00:00:09:31.755 24718==    by 0x46FF3E: rfree (resource.c:166)
==00:00:09:31.755 24718==    by 0x470309: mb_free (resource.c:415)
==00:00:09:31.755 24718==    by 0x406A6B: rt_unlock_table (rt-table.c:1921)
==00:00:09:31.755 24718==    by 0x40DAE3: channel_do_down (proto.c:297)
==00:00:09:31.755 24718==    by 0x40DD46: channel_set_state (proto.c:359)
==00:00:09:31.755 24718==    by 0x4061AD: rt_prune_table (rt-table.c:1692)
==00:00:09:31.755 24718==    by 0x405D5E: rt_event (rt-table.c:1559)
==00:00:09:31.755 24718==    by 0x45D089: ev_run (event.c:85)
==00:00:09:31.755 24718==    by 0x45D158: ev_run_list (event.c:142)
==00:00:09:31.755 24718==    by 0x462814: io_loop (io.c:2412)
==00:00:09:31.755 24718==    by 0x468712: main (main.c:833)
==00:00:09:31.755 24718==  Block was alloc'd at
==00:00:09:31.755 24718==    at 0x4C28C10: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==00:00:09:31.755 24718==    by 0x470FBC: bird_xmalloc (xmalloc.c:29)
==00:00:09:31.755 24718==    by 0x4701E6: mb_alloc (resource.c:339)
==00:00:09:31.755 24718==    by 0x406C29: rt_commit (rt-table.c:1977)
==00:00:09:31.755 24718==    by 0x45C36D: config_do_commit (conf.c:269)
==00:00:09:31.755 24718==    by 0x45C545: config_commit (conf.c:361)
==00:00:09:31.755 24718==    by 0x4686F9: main (main.c:822)
==00:00:09:31.755 24718==
2016-02-08 16:08:50 +01:00
Ondrej Zajicek (work) f4a60a9bc4 Channels - explicit links between protocols and tables
The patch adds support for channels, structures connecting protocols and
tables and handling most interactions between them. The documentation is
missing yet.
2016-02-01 10:28:50 +01:00
Pavel Tvrdík 0264ccf6f4 Rewrite roa_check() for integrated BIRD
Thanks to Ondrej Zajicek for his support with writing this code.
2016-01-20 16:46:58 +01:00
Pavel Tvrdík b9f5692186 Fix check in net_route() in debug mode 2016-01-07 18:24:14 +01:00
Pavel Tvrdík de9b87f558 Add NET ROA4/6 structures 2016-01-07 18:21:31 +01:00
Ondrej Zajicek (work) 04632fd77f Follow-up work on integration 2015-12-24 15:56:04 +01:00
Ondrej Zajicek (work) 600998fcb1 Modify FIB_WALK() and FIB_ITERATE() to work with new FIB code
Returned user data pointers have offset relative to fib_node.
2015-12-21 20:28:44 +01:00
Jan Moskyto Matejka 7fd4143ead Integrated address print lengths
Minor changes by Ondrej Santiago Zajicek
2015-12-20 13:47:39 +01:00
Jan Moskyto Matejka 5e173e9f63 Stop perusing f_prefix for non-prefix-set uses
Multiple changes by Ondrej Santiago Zajicek
2015-12-19 23:49:47 +01:00
Jan Moskyto Matejka d7661fbe9d Removed BITS_PER_IP_ADDRESS, MAX_PREFIX_LENGTH, BIRD_AF
Explicit setting of AF_INET(6|) in IP socket creation. BFD set to listen
on v6, without setting the V6ONLY flag to catch both v4 and v6 traffic.

Squashing and minor changes by Ondrej Santiago Zajicek
2015-12-19 15:57:09 +01:00
Ondrej Zajicek (work) 04ae8ddaa1 Merge branch 'master' into int-new 2015-11-25 14:24:35 +01:00
Ondrej Zajicek (work) 90f78507f4 Merge branch 'master' into rip-new 2015-11-24 15:21:11 +01:00
Ondrej Zajicek (work) 86b4e17001 Nest: Fixes bug in missing cleanup during table removal
When a table is removed during reconfiguration, a reference was not
cleared in the old configuration, which breaks undo.
2015-11-09 01:01:12 +01:00
Ondrej Zajicek (work) 9b9a7143c4 Conf: Fixes bug in symbol lookup during reconfiguration
Symbol lookup by cf_find_symbol() not only did the lookup but also added
new void symbols allocated from cfg_mem linpool, which gets broken when
lookups are done outside of config parsing, which may lead to crashes
during reconfiguration.

The patch separates lookup-only cf_find_symbol() and config-modifying
cf_get_symbol(), while the later is called only during parsing. Also
new_config and cfg_mem global variables are NULLed outside of parsing.
2015-11-09 00:42:02 +01:00
Ondrej Zajicek (work) fe9f1a6ded Initial commit on integrated BIRD
New data types net_addr and variants (in lib/net.h) describing
network addresses (prefix/pxlen). Modifications of FIB structures
to handle these data types and changing everything to use these
data types instead of prefix/pxlen pairs where possible.

The commit is WiP, some protocols are not yet updated (BGP, Kernel),
and the code contains some temporary scaffolding.

Comments are welcome.
2015-11-05 12:48:52 +01: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 8d9eef1771 BGP multipath support
Kernel option 'merge paths' allows to merge routes exported to kernel
protocol (currently BGP and static routes) to multipath routes.
2015-06-08 02:24:08 +02:00
Ondrej Zajicek db027a41d4 Fixes subtle bug in temporary attribute handling
In some cases, export filter accessed attributes of a different route.
2015-06-08 02:24:08 +02:00
Ondrej Zajicek ca34698ca6 Fixes bug in pipe feeding when filtered routes are kept in table 2015-06-08 02:24:08 +02:00
Pavel Tvrdík ae80a2de95 unsigned [int] -> uint 2015-06-08 02:24:08 +02:00
Ondrej Zajicek d0e23d42de Simplify flushing process
Related to changes from previous patch.
2015-05-17 00:56:34 +02:00
Ondrej Zajicek 86f567e13c Fix minor issue in pipe route propagation
In some circumstances during reconfiguration, routes propagated by pipes
to other tables may hang there even after the primary routes are removed.

There is already a workaround for this issue in the code which removes
these stale routes by flush process when source protocols are shut down.

This patch is a cleaner fix and allows to simplify the flush process
2015-05-16 20:17:59 +02:00
Ondrej Zajicek 51762a45b3 Allows user data attached to f_trie_node structure.
Thanks to Alexander Chernikov for the patch.
2015-02-21 14:05:20 +01:00
Ondrej Zajicek 0da562a7cb Fixes error message in 'show route' cmd.
Message 'Network not in table' was not reported if a network node without
any routes was found in a routing table.
2014-11-08 23:52:42 +01:00
Ondrej Zajicek 7aa809016e Implements show route noexport option.
Shows routes that would be exported to the protocol but are rejected by
the export filter.
2014-10-02 12:52:50 +02:00
Ondrej Zajicek 1123e70740 Implements token bucket filter for rate limiting. 2014-10-02 12:52:50 +02:00
Ondrej Zajicek c865cae3eb Fixes 'show route export' w.r.t. protocols with different RA_* types. 2014-04-28 17:31:03 +02:00
Ondrej Zajicek 6eda3f135f Documentation (and minor fixes) for BGP graceful restart. 2014-03-23 01:35:33 +01:00
Ondrej Zajicek 0c791f873a BGP graceful restart support.
Also significant core protocol state changes needed for that,
global graceful restart recovery state and kernel proto support
for recovery.
2014-03-20 14:07:12 +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 548c329cde Adds rate limiting to some log messages. 2013-11-22 01:21:15 +01:00
Ondrej Zajicek 9135c1f0ca Fixes bug in protocol flushing and rtable pruning.
When route was propagated to another rtable through a pipe and then the
pipe was reconfigured softly in such a way that any subsequent route
updates are filtered, then the source protocol shutdown didn't clean up
the route in the second rtable which caused stale routes and potential
crashes.
2013-07-24 14:11:12 +02:00
Ondrej Zajicek fad04c750c Fixes problems with kernel routes multiple routing tables.
Temporary dummy routes created by a kernel protocol during routing table
scan get mixed with real routes propagated from another kernel protocol
through a pipe.
2013-06-13 11:27:14 +02:00
Ondrej Filip e667622a35 Default rounting table for 'show route export/preexport/protocol' is the one related to a respective protocol. 2013-02-25 10:39:46 +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 b662290f40 Separate import and receive limits.
They have different behavior w.r.t. filtered routes that are kept.
2013-01-10 13:07:33 +01:00
Ondrej Zajicek 7057752924 Fixes route tracing w.r.t. kept filtered routes. 2012-11-16 13:29:16 +01:00
Ondrej Zajicek 1555095795 Changes 'rejected' to 'filtered' in one of the last patches. 2012-11-15 01:29:01 +01:00
Ondrej Zajicek cf98be7b67 Allows rejected routes to be kept and examined.
When 'import keep rejected' protocol option is activated, routes
rejected by the import filter are kept in the routing table, but they
are hidden and not propagated to other protocols. It is possible to
examine them using 'show route rejected'.
2012-11-10 14:26:13 +01:00
Ondrej Zajicek 094d2bdb79 Implements ADD-PATH extension for BGP.
Allows to send and receive multiple routes for one network by one BGP
session. Also contains necessary core changes to support this (routing
tables accepting several routes for one network from one protocol).
It needs some more cleanup before merging to the master branch.
2012-08-14 16:46:43 +02:00
Ondrej Zajicek 36415e4b1d Allows to redefine master table. 2012-07-20 19:56:57 +02:00
Ondrej Zajicek abced4a914 Merge branch 'rt-accepted'
Conflicts:

	nest/config.Y
	nest/rt-table.c
	proto/bgp/bgp.c
2012-07-16 14:44:45 +02:00
Ondrej Zajicek 26822d8fe1 Finalize RA_ACCEPTED handling. 2012-07-16 01:33:02 +02:00
Ondrej Zajicek 47c447c42e Minor cleanups. 2012-05-11 12:10:21 +02:00
Ondrej Zajicek b7f3df7905 Fixes a bug in RA_ACCEPTED handling. 2012-05-11 12:01:27 +02:00
Ondrej Zajicek ab758e4fb2 Some fixes in route export limits. 2012-04-28 12:59:40 +02:00
Ondrej Zajicek d494df63ac Some minor fixes. 2012-04-27 00:04:51 +02:00
Ondrej Zajicek d9b77cc281 Implements generalized export limits.
And also fixes some minor bugs in limits.
2012-04-24 23:39:57 +02:00
Ondrej Zajicek 7d0a31deed Fixes in generalized import limits. 2012-04-21 21:05:36 +02:00
Ondrej Zajicek ebecb6f6a1 Implements generalized import hooks.
Thanks to Alexander V. Chernikov for the original patch.
2012-04-15 15:28:29 +02:00
Ondrej Zajicek 00a09f3c36 Implement RA_ACCEPTED mode of route propagation. 2012-04-15 15:07:58 +02:00
Ondrej Zajicek bf2abe2f51 Merge branch 'soon'
Conflicts:

	nest/proto.c
	nest/rt-table.c
2012-03-30 11:04:12 +02:00
Ondrej Zajicek fb829de690 Fixes responsiveness for protocol shutdown.
When a protocol went down, all its routes were flushed in one step, that
may block BIRD for too much time. The patch fixes that by limiting
maximum number of routes flushed in one step.
2012-03-28 18:40:04 +02:00
Ondrej Zajicek c0adf7e9fc Better support for multitable protocols.
The nest-protocol interaction is changed to better handle multitable
protocols. Multitable protocols now declare that by 'multitable' field,
which tells nest that a protocol handles things related to proto-rtable
interaction (table locking, announce hook adding, reconfiguration of
filters) itself.

Filters and stats are moved to announce hooks, a protocol could have
different filters and stats to different tables.

The patch is based on one from Alexander V. Chernikov, thanks.
2012-03-15 12:13:04 +01:00
Ondrej Zajicek be4cd99a36 Implements deterministic MED handling.
Thanks to Alexander V. Chernikov for many suggestions.
2011-12-22 13:20:29 +01:00
Ondrej Zajicek 32f95476a8 Signal problems with route installation to kernel tables. 2011-10-06 22:48:49 +02:00
Ondrej Zajicek 5e9bdac28e Fixes a bug with setting preference during show route cmd.
If show route cmd was used with a filter that changed preference,
BIRD crashed.
2011-05-21 22:48:08 +02:00
Ondrej Filip b7c4898106 Compilation was failing without OSPF or RIP protocol - FIXED. 2011-05-05 14:14:20 +02:00
Ondrej Zajicek ab16497189 Fixes a nasty bug in OSPF.
Sending malformed network prefixes in LSAs causes OSPF to crash
just after the LSA is propagated to the other routers.
2011-03-29 01:41:46 +02:00
Ondrej Zajicek 7e95c05d88 Core multipath support. 2010-12-07 23:33:55 +01:00
Ondrej Zajicek 4ca93a5067 Fixes a one byte buffer overflow. 2010-09-08 12:08:38 +02:00
Ondrej Zajicek 2c9033afd5 Do not allow interdependent recursive routes. 2010-08-03 08:26:47 +02:00
Ondrej Zajicek ba5e5940aa Adds igp_metric attribute. 2010-08-02 13:11:53 +02:00
Ondrej Zajicek d1e146f2f8 Implements IGP metric comparison for BGP routes. 2010-07-31 01:04:32 +02:00
Ondrej Zajicek 1b180121a9 Use link-local addresses in recursive next hops for IPv6 BGP. 2010-07-28 11:45:35 +02:00
Ondrej Zajicek c477f48916 Hostcache should use trie to filter relevant route changes. 2010-07-27 18:20:12 +02:00
Ondrej Zajicek f2b76f2c45 For hostentry cache, replace FIB with a hash table using (IP, dep table) as a key. 2010-07-26 16:39:27 +02:00
Ondrej Zajicek 852b7062e3 Fixes a buffer overflow in TX code of IPv6 BGP. 2010-07-22 15:09:35 +02:00
Ondrej Zajicek cfe34a316e Implements hostcache and recursive next hops.
Hostcache is a structure for monitoring changes in a routing table that
is used for routes with dynamic/recursive next hops. This is needed for
proper iBGP next hop handling.
2010-07-05 17:50:19 +02:00
Ondrej Zajicek acb60628f5 Implements command that shows memory usage. 2010-06-02 22:20:40 +02:00
Ondrej Zajicek c429d4a4ba Restrict export of device routes to the kernel protocol.
In usual configuration, such export is already restricted
with the aid of the direct protocol but there are some
races that can circumvent it. This makes it harder to
break kernel device routes. Also adds an option to
disable this restriction.
2010-04-04 15:41:31 +02:00
Ondrej Zajicek 4d9a0d1f02 Update lastmod in 'ignored' case only for RIP routes. 2010-03-24 10:42:25 +01:00
Ondrej Zajicek ff2857b03d Many changes in (mainly) kernel syncers.
- BSD kernel syncer is now self-conscious and can learn alien routes
- important bugfix in BSD kernel syncer (crash after protocol restart)
- many minor changes and bugfixes in kernel syncers and neighbor cache
- direct protocol does not generate host and link local routes
- min_scope check is removed, all routes have SCOPE_UNIVERSE by default
- also fixes some remaining compiler warnings
2010-02-26 10:55:58 +01:00
Ondrej Zajicek e81b440f68 Fix configure to enable warnings and fix most of them. 2010-02-21 14:34:53 +01:00
Ondrej Zajicek dca75fd7c2 Removes phantom protocol from the pipe design.
It seems that by adding one pipe-specific exception to route
announcement code and by adding one argument to rt_notify() callback i
could completely eliminate the need for the phantom protocol instance
and therefore make the code more straightforward. It will also fix some
minor bugs (like ignoring debug flag changes from the command line).
2010-02-13 12:26:26 +01:00
Ondrej Zajicek 9db74169be Fixes protocol statistics for pipes. 2010-02-13 10:44:46 +01:00
Ondrej Zajicek c83876265e Fixes a tricky bug in the pipe protocol.
When uncofiguring the pipe and the peer table, the peer table was
unlocked when pipe protocol state changed to down/flushing and not to
down/hungry. This leads to the removal of the peer table before
the routes from the pipe were flushed.

The fix leads to adding some pipe-specific hacks to the nest,
but this seems inevitable.
2010-02-11 22:27:06 +01:00
Ondrej Zajicek 5a56f27cd0 Adds asterisk to the primary route in 'show route' cmd.
And also fixes a minor bug.
2010-02-08 12:42:09 +01:00
Ondrej Zajicek c37e78510f Makes date/time formats configurable. 2010-02-03 00:19:24 +01:00
Ondrej Zajicek 8a7fb8858f Finishes 'route reload' feature. 2009-12-14 01:32:37 +01:00
Ondrej Zajicek 11361a1015 Implements route re-feed.
This can be used to re-feed routes to protocol after soft change in
export filters.
2009-12-02 22:19:47 +01:00
Ondrej Zajicek 11787b8473 Fixes some problems in pipes.
For transparent pipes, loop detection works correctly now.
Pipes are now more symmetric - in both directions filtering
is done in do_rte_announce().
2009-12-02 17:26:16 +01:00
Ondrej Zajicek e8b29bdc8d Fixes one missing log message. 2009-12-02 14:33:34 +01:00
Ondrej Zajicek bf47fe4b2e Implements BGP route refresh. 2009-11-26 20:47:59 +01:00
Ondrej Zajicek 069bfcb53c Fixes serious bug in core related to route filtering.
If protocol announces a route, route is accepted by import filter to
routing table, and later it announces replacement of that route that is
rejected by import filter, old route remains in routing table.
2009-11-24 17:15:20 +01:00
Ondrej Zajicek c0973621bc Fixes another bug in rte_recalculate().
Previous bugfix revealed another hidden bug here.
2009-08-11 15:49:56 +02:00
Ondrej Zajicek 024e633c16 Fixes bug that caused losing of some routes.
When update changes preferred route in such a way that
it ceased to be preferred, the new route was linked
to wrong place and lost.
2009-08-11 10:54:50 +02:00
Ondrej Zajicek 925fe2d3de Implements route statistics and fixes some minor bugs. 2009-06-04 01:22:56 +02:00
Ondrej Zajicek c07c65d6d0 Escaped debbuging message removed. 2009-06-01 23:18:45 +02:00
Ondrej Zajicek f98e291579 The pipe cleanup. 2009-06-01 14:07:13 +02:00
Ondrej Zajicek 23ac9e9a9e Changes pipes to transfer all routes between routing table, not just optimal routes. 2009-05-31 15:24:27 +02:00
Ondrej Zajicek ea2ae6dd0a Change import/preimport to export/preexport to be consistent with filters. 2009-05-22 17:12:15 +02:00
Ondrej Filip 4d176e1450 'show route protocol <p>' added to CLI. 2009-05-11 02:01:11 +02:00
Ondrej Zajicek 40b65f947a Fixes bug in pipe route filtering.
Routes comming through pipe from primary to secondary table were
filtered by both EXPORT and IMPORT filters, but they should be
only filtered by EXPORT filters.
2009-03-25 19:05:52 +01:00
Ondrej Zajicek 258d0ad4ca Fixes feeding of new protocol, only preferred routes are announced. 2008-11-14 23:03:15 +01:00
Ondrej Filip 10af3676ea Grrr, committing too fast.
#include "alloca.h" -> #include "lib/alloca.h"
2004-05-31 17:16:47 +00:00
Ondrej Filip 0e6eef620d Use #include "alloca.h" 2004-05-31 17:07:05 +00:00