0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-09-20 04:15:19 +00:00
Commit Graph

178 Commits

Author SHA1 Message Date
Ondrej Zajicek
05476c4d04 IPv4/IPv6 integrated socket code. 2014-05-18 11:42:26 +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
0aeac9cb7f Merge commit 'origin/bfd' 2013-11-22 02:48:44 +01:00
Ondrej Zajicek
8931425d02 Fixes problem with RIP on multiple ifaces on BSD.
RIP sockets for multiple ifaces collided, because we cannot bind to
a specific iface on BSD. Workarounded by SO_REUSEPORT.

Thanks to Eugene M. Zheganin for the bugreport.
2013-11-22 02:12:21 +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
0e175f9f0f Fixes some BFD bugs and makes logging thread-safe. 2013-10-05 20:12:28 +02:00
Ondrej Zajicek
6a8d3f1c1f BFD work in progress.
Now it compiles and mostly works.
2013-09-16 23:57:40 +02:00
Ondrej Zajicek
bf139664aa Initial BFD commit, work in progress. 2013-09-10 12:09:36 +02:00
Ondrej Zajicek
a0b176e3b2 Fixes header file name.
Thanks to Fritz Grimpen for the patch.
2013-07-24 14:20:46 +02:00
Ondrej Zajicek
354496ace8 Some fixes for TTL security. 2013-07-11 13:50:44 +02:00
Ondrej Zajicek
70e212f913 Implements TTL security for OSPF and RIP.
Interfaces for OSPF and RIP could be configured to use (and request)
TTL 255 for traffic to direct neighbors.

Thanks to Simon Dickhoven for the original patch for RIPng.
2013-06-25 15:39:44 +02:00
Ondrej Zajicek
ef4a50be10 Better packet priority and traffic class handling.
Implements support for IPv6 traffic class, sets higher priority for OSPF
and RIP outgoing packets by default and allows to configure ToS/DS/TClass
IP header field and the local priority of outgoing packets.
2013-06-24 16:37:30 +02:00
Ondrej Zajicek
a92cf57dd6 Implements undo command and optional timeout for configuration
Several new configure command variants:

configure undo - undo last reconfiguration
configure timeout - configure with scheduled undo if not confirmed in timeout
configure confirm - confirm last configuration
configure check - just parse and validate config file
2012-12-26 12:40:48 +01:00
Ondrej Zajicek
c4b76d7b19 Rename sk_new() to avoid name collision with OpenSSL. 2012-07-18 19:35:30 +02:00
Ondrej Zajicek
f1aceff59b Cleanup in sysdep KRT code, part 2.
Remove support for historic Linux kernels,
merge krt-iface, krt-set and krt-scan stub headers.
2012-04-30 22:25:24 +02:00
Ondrej Zajicek
d7f469c15c Some minor fixes. 2012-01-09 02:41:13 +01:00
Ondrej Zajicek
eb1451a3a0 Better support for link-local addresses in IO code. 2012-01-08 15:27:04 +01:00
Ondrej Zajicek
b1b1943360 The generalized TTL security mechanism (RFC 5082) support.
Thanks to Alexander V. Chernikov for the patch.
2011-08-16 23:13:05 +02:00
Ondrej Zajicek
d0e9b36d30 Added header file. 2011-03-23 17:15:11 +01:00
Ondrej Zajicek
93e868c730 Implements Router Advertisement protocol. 2011-03-13 11:33:50 +01:00
Ondrej Zajicek
f428631cd6 Ignore warning when BGP peer is unreachable. 2010-08-03 01:12:43 +02:00
Ondrej Zajicek
9be9a26413 Implements proper multihop BGP.
Also does some incompatible changes to config file syntax,
like removing 'via IP' from multihop option.
2010-07-12 17:39:39 +02:00
Ondrej Zajicek
acb60628f5 Implements command that shows memory usage. 2010-06-02 22:20:40 +02:00
Ondrej Zajicek
002b642318 Fixes bug on Linux 2.4.x - kernel sync does not work until restart of kernel protocol.
Which was, actually, a bug in timers - on older kernel, monotonic timer
is missing and the other implementation started with now == 0, which
collides with usage 0 as a special value in timer->expires field.
2010-05-21 12:00:53 +02:00
Ondrej Zajicek
475977242a Handle EPIPE as a common connection close event. 2010-05-14 16:54:39 +02:00
Ondrej Zajicek
607d991424 Fixes build on newer Linux systems. 2010-04-14 15:35:08 +02:00
Ondrej Zajicek
dcc6049444 Fixes IPv6 build on older systems. 2010-04-14 14:46:21 +02:00
Ondrej Zajicek
646b24d932 Minor changes. 2010-04-08 17:45:50 +02:00
Ondrej Zajicek
46a82e9c2c Fixes missing header. 2010-04-03 10:45:21 +02:00
Ondrej Zajicek
e7b09e4ab9 Use SO_BINDTODEVICE also in Linux/IPv6. 2010-04-02 16:11:46 +02:00
Ondrej Zajicek
bed417288e Minor fixes to previous patches. 2010-04-02 11:31:20 +02:00
Ondrej Zajicek
eb0f129fce Merge branch 'socket2' into new 2010-03-26 18:53:31 +01:00
Ondrej Zajicek
97e46d28ff Adds check for no protocol and some minor CLI fixes.
- Adds check to deny config file with no specified protocol to prevent
  loading of empty config file.
- Moves CLI init before config parse to receive immediate error message
  when cannot open control socket.
- Fixes socket name path check and other error handling in CLI init.
2010-03-17 12:19:22 +01:00
Ondrej Zajicek
54305181f6 Merge branch 'new' into socket2 2010-03-11 18:55:59 +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
2af25a971a Fixes a crash caused by missing error hook on BGP listening socket.
Error happened when too many BGP connections arrived in one moment
(ECONNABORTED).
2010-02-11 11:12:58 +01:00
Ondrej Zajicek
353729f513 Temporary OSPF commit - socket changes. 2010-02-11 10:23:35 +01:00
Ondrej Zajicek
c37e78510f Makes date/time formats configurable. 2010-02-03 00:19:24 +01:00
Ondrej Zajicek
861f223a53 BSD compatibility fix. 2010-01-06 23:20:43 +01:00
Ondrej Zajicek
cf31112f0d Implements MRTdump feature. 2010-01-03 12:17:52 +01:00
Ondrej Zajicek
4ac7c8341c Use IPv6 checksums in OSPFv3. 2009-11-09 23:22:53 +01:00
Ondrej Zajicek
3f22fa9e74 Merge branch 'dev' into ospf3 2009-11-09 22:54:39 +01:00
Ondrej Zajicek
ea89da381f Workaround for stupid callback scheduler.
There is no reak callback scheduler and previous behavior causes
bad things during hard congestion (like BGP hold timeouts).

Smart callback scheduler is still missing, but main loop was
changed such that it first processes all tx callbacks (which
are fast enough) (but max 4* per socket) + rx callbacks for CLI,
and in the second phase it processes one rx callback per
socket up to four sockets (as rx callback can be slow when
there are too many protocols, because route redistribution
is done synchronously inside rx callback). If there is event
callback ready, second phase is skipped in 90% of iterations
(to speed up CLI during congestion).
2009-10-11 18:56:16 +02:00
Ondrej Zajicek
daeeb8e982 Clear memory allocated by ralloc().
This also fixes bug that timer->recurrent was not cleared
in tm_new() and unexpected recurrence of startup timer
in BGP confused state machine and caused crash.
2009-09-04 11:24:08 +02:00
Ondrej Zajicek
f9c799a00e Temporary OSPFv3 development commit (changing multicast support). 2009-09-04 11:06:51 +02:00
Ondrej Zajicek
061ab802a6 Temporary OSPFv3 development commit 2009-08-27 18:25:46 +02:00
Ondrej Zajicek
2d785e8d6a Fixes bug on TCP passive socket binding on BSD.
BGP on BSD was bound to random port. I am surprised that
nobody noticed it already.
2009-06-26 13:33:41 +02:00
Ondrej Zajicek
1876e18d32 Minor bugfix. 2009-06-25 15:44:43 +02:00
Ondrej Zajicek
4323099da9 Fixes bug in scheduling of callback by main loop.
If other side of a socket is sending data faster than
BIRD is processing, BIRD does not schedule any other
callbacks (events, timers, rx/tx callbacks).
2009-06-20 00:59:32 +02:00
Ondrej Zajicek
789772ed45 Implements option that changes BGP listening socket parametres. 2009-06-18 19:20:07 +02:00
Ondrej Filip
2b70f0742e Linux specific TCP-MD5 handling moved to sysdep/linux/sysio.h
FreeBSD coded added. BSD cannot set BGP passwords itself.
This has to be done by external command.
2009-05-04 18:17:46 +02:00
Ondrej Zajicek
35164c5017 rx_hook may be cleaned in some callback so we check it before
executing sk_read().
2008-12-12 17:48:03 +01:00
Ondrej Zajicek
fd91ae3325 Fix problem with local time changes. 2008-11-05 22:36:49 +01:00
Ondrej Zajicek
1389f3699f Fixes bugs in IPv6 code caused by recent commits. 2008-11-05 21:39:04 +01:00
Ondrej Zajicek
a39b165e45 Multihop BGP was completely broken, because listening socket has always
ttl 1.
2008-11-01 16:58:40 +01:00
Ondrej Zajicek
a98fbf0f12 Merge branch 'dev' into out 2008-10-27 00:20:22 +01:00
Ondrej Zajicek
68fa95cfec Check of socket name length 2008-10-26 23:55:38 +01:00
Ondrej Zajicek
d51aa28190 Implementation of MD5 authentication of BGP sessions. 2008-10-26 22:42:39 +01:00
Ondrej Filip
97c6fa02e0 Previous patch reverted. :-( 2008-08-25 12:06:20 +00:00
Ondrej Filip
030e3a79cb Buffer overflow fix. 2008-08-25 11:57:46 +00:00
Ondrej Filip
c025b85273 Real write is only in sk_maybe_write. Previous change partially reverted.
Thank you MJ.
2005-02-14 23:15:04 +00:00
Ondrej Filip
7c49f71559 Added s->err_hook wrapper that empties socket. 2005-02-14 21:28:51 +00:00
Ondrej Filip
0d3effcf8c Time added in password management. 2005-02-12 22:27:55 +00:00
Ondrej Filip
09e4117cc1 sk_write bugfix for BSD. 2004-06-18 12:54:53 +00:00
Ondrej Filip
41c8976e29 Test old instance of BIRD. 2004-06-06 17:05:25 +00:00
Martin Mares
4da25acb0a Cleaned up sk_reallocate() and friends.
Also, removed the `if (s)' test, because I believe that as the whole
socket interface doesn't accent NULL pointers, sk_reallocate() shouldn't
be the only exception.
2004-06-05 08:56:43 +00:00
Ondrej Filip
e7ef86a58c OSPF is ready for changing MTU. 2004-06-04 18:51:29 +00:00
Ondrej Filip
7d72aadb8a CONFIG_SKIP_MC_BIND added.
BSD hates it, Linux needs it.
2004-06-03 08:18:14 +00:00
Ondrej Filip
b613b9928b #ifdef CONFIG_UNIX_DONTROUTE added. 2004-06-01 10:32:02 +00:00
Martin Mares
38a608c55a Rewritten the I/O loop. All socket operations are now safe, meaning that
you can delete the socket from anywhere in the hooks and nothing should break.
Also, the receive/transmit buffers are now regular xmalloc()'ed buffers,
not separate resources which would need shuffling around between pools.

sk_close() is gone, use rfree() instead.
2004-05-31 21:48:19 +00:00
Ondrej Filip
b1a1fabac7 *BSD port added. (Tested on FreeBSD and NetBSD) 2004-05-31 13:25:00 +00:00
Martin Mares
01b776e117 Fixed <time.h> vs. <sys/time.h> problems. 2001-03-06 13:40:39 +00:00
Martin Mares
0b3bf4b1d8 Use SUN_LEN() for length of UNIX domain addresses. This should fix problems
with connection to clients on libc5 machines.
2000-06-09 07:30:22 +00:00
Martin Mares
58f7d004fd Fixes to the progdoc. 2000-06-07 13:25:53 +00:00
Martin Mares
2e9b24211a Spelling fixes to progdoc. 2000-06-07 12:29:08 +00:00
Martin Mares
525fa2c1f0 Documented sockets, events and timers. 2000-06-05 12:19:12 +00:00
Martin Mares
10304bed43 Split random number functions off io.c, so that they can be documented
separately.
2000-06-05 11:46:40 +00:00
Martin Mares
b594ad2386 tm_format_reltime() works with both past and future timestamps. 2000-06-01 15:13:23 +00:00
Martin Mares
c304392e65 Some less socket error messages. 2000-05-08 12:37:39 +00:00
Martin Mares
9cbf43eb8a Don't report refused connections. 2000-05-08 12:09:10 +00:00
Martin Mares
93a786cb03 Removed a lot of unused variables.
Please try compiling your code with --enable-warnings to see them. (The
unused parameter warnings are usually bogus, the unused variable ones
are very useful, but gcc is unable to control them separately.)
2000-05-04 20:30:36 +00:00
Martin Mares
f75e3bbc01 Fixed a couple of nasty CLI bugs which were triggered on long or multi-part
outputs. It took a whole evening to hunt them down, but now the CLI seems
to work fine.

Now I run three BGP connections with several thousand routes!
2000-04-27 22:35:08 +00:00
Martin Mares
e1ddd99377 Changed handling of incoming connections, so that we can send data
from the send hook without worrying about existence of socket buffers.

Also, don't forget to copy peer addresses.
2000-04-26 13:26:11 +00:00
Martin Mares
0cadd5f531 Removed several FIXME's. 2000-04-26 12:33:37 +00:00
Martin Mares
00c0c18aea Allow sk_close(NULL). 2000-04-25 23:07:47 +00:00
Martin Mares
f380aa60fa IPv6 compiles with glibc 2.1. 2000-04-20 23:05:41 +00:00
Martin Mares
a37410cbdd Use bsprintf() instead of sprintf(). 2000-03-31 23:33:03 +00:00
Martin Mares
221135d6bf Include "lib/string.h" instead of <string.h>. It should give us bzero()
and other non-portable functions on all systems.
2000-03-31 23:30:21 +00:00
Martin Mares
320f417357 Defined sk_close() which closes the socket safely even if called from
socket hook. Replaces the SK_DELETED hack.

Squashed a couple of bugs in handling of TCP sockets.
2000-03-30 10:43:37 +00:00
Martin Mares
1cf716f075 Handle EINPROGRESS properly.
Set IP_DONTROUTE sockopt only if sk->ttl == 1.
2000-03-20 21:49:21 +00:00
Martin Mares
f098e072be Fixed a bunch of FIXME's by removing them :) 2000-03-12 22:53:05 +00:00
Martin Mares
7a88832e78 Added tm_format_datetime(). 2000-03-12 22:43:13 +00:00
Martin Mares
a2867cd957 Better order of includes.
set_inaddr() moved to sysio.h.
1999-12-16 13:14:02 +00:00
Martin Mares
67ece6df42 Tried to clean up multicast handling. Now we don't try to guess
multicast abilities depending on definedness of symbols and use hard-wired
system-dependent configuration defines instead.

Please test whereever you can.
1999-12-16 13:06:13 +00:00
Martin Mares
30bc402ebb Temporary work-arounds for multicast problems. Needs further investigation. 1999-12-08 15:12:54 +00:00
Martin Mares
f78056fb2c Allow logging to stderr as well. 1999-12-06 13:51:04 +00:00
Martin Mares
a9c986f981 Added tracked_fopen() which is a fopen registered in resource database.
Will be used for log files.
1999-12-06 13:43:47 +00:00
Martin Mares
afa8937ac8 Added tm_format_reltime() for formatting of relative time quantities. 1999-12-01 11:59:00 +00:00
Martin Mares
487d1afa52 Moved TIME_INFINITY to timer.h, so that it's publicly available. 1999-11-30 14:01:39 +00:00