Commit graph

33 commits

Author SHA1 Message Date
Maria Matejka 9d03c3f56c Memory pages are not munmapped, instead we just madvise()
Memory unmapping causes slow address space fragmentation, leading in
extreme cases to failing to allocate pages at all. Removing this problem
by keeping all the pages allocated to us, yet calling madvise() to let
kernel dispose of them.

This adds a little complexity and overhead as we have to keep the
pointers to the free pages, therefore to hold e.g. 1 GB of 4K pages with
8B pointers, we have to store 2 MB of data.
2022-11-02 12:56:54 +01:00
Ondrej Zajicek 534d0a4b44 KRT: Scan routing tables separetely on linux to avoid congestion
Remove compile-time sysdep option CONFIG_ALL_TABLES_AT_ONCE, replace it
with runtime ability to run either separate table scans or shared scan.

On Linux, use separate table scans by default when the netlink socket
option NETLINK_GET_STRICT_CHK is available, but retreat to shared scan
when it fails.

Running separate table scans has advantages where some routing tables are
managed independently, e.g. when multiple routing daemons are running on
the same machine, as kernel routing table modification performance is
significantly reduced when the table is modified while it is being
scanned.

Thanks Daniel Gröber for the original patch and Toke Høiland-Jørgensen
for suggestions.
2022-07-24 02:15:20 +02:00
Ondrej Zajicek (work) 318acb0f6c BSD: Use MSG_DONTROUTE for unicast packets on FreeBSD
BSD systems cannot use SO_DONTROUTE, because it does not work properly
with multicast packets (perhaps it tries to find iface based on multicast
group address). But we can use MSG_DONTROUTE sendmsg() flag for unicast
packets. Works on FreeBSD, is ignored on OpenBSD and is broken on NetBSD
(i guess due to integrated routing table and ARP table).
2018-07-28 16:54:06 +02:00
Ondrej Zajicek (work) be17805c0b Add support for source-specific IPv6 routes to BIRD core
This patch adds support for source-specific IPv6 routes to BIRD core.
This is based on Dean Luga's original patch, with the review comments
addressed. SADR support is added to network address parsing in confbase.Y
and to the kernel protocol on Linux.

Currently there is no way to mix source-specific and non-source-specific
routes (i.e., SADR tables cannot be connected to non-SADR tables).

Thanks to Toke Hoiland-Jorgensen for the original patch.
Minor changes by Ondrej Santiago Zajicek.
2018-02-13 16:39:07 +01:00
Jan Moskyto Matejka d14f8c3c45 Netlink: MPLS routes in kernel
Anyway, Bird is now capable to insert both MPLS routes and MPLS encap
routes into kernel.

It was (among others) needed to define platform-specific AF_MPLS to 28
as this constant has been assigned in the linux kernel.

No support for BSD now, it may be added in the future.
2016-12-22 21:38:33 +01:00
Jan Moskyto Matejka 7152e5efbb Build system reworked to one global Makefile with includes and no nesting
Also removed the lib-dir merging with sysdep. Updated #include's
accordingly.

Fixed make doc on recent Debian together with moving generated doc into
objdir.

Moved Makefile.in into root dir

Retired all.o and birdlib.a
Linking the final binaries directly from all the .o files.
2016-05-10 14:07:34 +02:00
Ondrej Zajicek (work) d549b83fc2 Delete ipv6 option from configure 2015-12-20 19:47:36 +01:00
Ondrej Zajicek c5ff44a703 KRT: Fixes learning of preferred kernel routes.
When a new route was imported from kernel and chosen as preferred, then
the old best route was propagated as a withdraw to the kernel protocol.
Under some circumstances such withdraw propagated to the BSD kernel could
remove the new alien route and thus reverting the import.
2015-04-25 20:43:43 +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 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 c01a94663c Implements multiple routing table support for FreeBSD and OpenBSD.
Inspired by the patch from Alexander V. Chernikov.
2013-07-07 12:11:42 +02:00
Ondrej Zajicek 95616c8202 Cleanup in sysdep KRT code, part 4.
Adding some files that was accidentally removed
(instead of moved) in cleanup part 2.
2012-05-04 16:38:25 +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 1bc2695744 Allows run with restricted privileges.
Adds option -u and -g to specify user and group.
When different user (than root) is specified,
linux capabilities CAP_NET_* are kept.
2011-05-10 02:42:17 +02:00
Ondrej Zajicek af157fa3db Disable multiple OSPF pseudointerfaces on BSD. 2010-03-26 14:48:01 +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 Filip 85305e5d8f typo in README 2004-06-04 17:32:38 +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
Ondrej Filip b1a1fabac7 *BSD port added. (Tested on FreeBSD and NetBSD) 2004-05-31 13:25:00 +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 dce267832a Basic support for IPv6. The system-dependent part doesn't work yet,
but the core routines are there and seem to be working.

   o  lib/ipv6.[ch] written
   o  Lexical analyser recognizes IPv6 addresses and when in IPv6
      mode, treats pure IPv4 addresses as router IDs.
   o  Router ID must be configured manually on IPv6 systems.
   o  Added SCOPE_ORGANIZATION for org-scoped IPv6 multicasts.
   o  Fixed few places where ipa_(hton|ntoh) was called as a function
      returning converted address.
1999-08-03 19:36:06 +00:00
Martin Mares 7de45ba4a0 Kernel route syncer supports multiple tables.
The changes are just too extensive for lazy me to list them
there, but see the comment at the top of sysdep/unix/krt.c.
The code got a bit more ifdeffy than I'd like, though.

Also fixed a bunch of FIXME's and added a couple of others. :)
1999-08-03 19:33:22 +00:00
Martin Mares 4b0d57e531 Added CONFIG_MULTIPLE_TABLES whereever appropriate. 1999-05-21 14:29:44 +00:00
Martin Mares 08e2d6259a Removed TOS support. This simplifies many things a lot. 1999-04-12 18:01:07 +00:00
Martin Mares 73c7bed168 Defined CONFIG_SELF_CONSCIOUS whenever the kernel scanner is able
to distinguish between our own routes and alien ones.
1999-04-03 13:00:52 +00:00
Martin Mares 1127ac6ec7 Cleaned up system configuration files -- removed few obsolete parameters,
documented the remaining ones (sysdep/cf/README).

Available configurations:

   o  linux-20: Old Linux interface via /proc/net/route (selected by default
		on pre-2.1 kernels).
   o  linux-21: Old Linux interface, but device routes handled by the
		kernel (selected by default for 2.1 and newer kernels).
   o  linux-22: Linux with Netlink (I play with it a lot yet, so it isn't
		a default).
   o  linux-ipv6: Prototype config for IPv6 on Linux. Not functional yet.
1999-03-27 22:51:05 +00:00
Martin Mares 2d14045224 Rewrote the kernel syncer. The old layering was horrible.
The new kernel syncer is cleanly split between generic UNIX module
and OS dependent submodules:

  -  krt.c (the generic part)
  -  krt-iface (low-level functions for interface handling)
  -  krt-scan (low-level functions for routing table scanning)
  -  krt-set (low-level functions for setting of kernel routes)

krt-set and krt-iface are common for all BSD-like Unices, krt-scan is heavily
system dependent (most Unices require /dev/kmem parsing, Linux uses /proc),
Netlink substitues all three modules.

We expect each UNIX port supports kernel routing table scanning, kernel
interface table scanning, kernel route manipulation and possibly also
asynchronous event notifications (new route, interface state change;
not implemented yet) and build the KRT protocol on the top of these
primitive operations.
1999-03-03 19:49:56 +00:00
Martin Mares bdb95a21a4 Added skeletal version of Linux netlink interface. It doesn't work yet,
but the framework is there and I'll try finish it soon.
1999-03-01 20:17:46 +00:00
Martin Mares 49e7e5ee0b New makefiles. Includes support for out-of-source-tree builds. 1999-01-10 00:18:32 +00:00
Martin Mares 140f034105 Added CONFIG_AUTO_ROUTES (automatic device route creation) and
CONFIG_ALL_MULTICAST (all interfaces capable of multicasting, not depending
on IFF_MULTICAST flag).
1998-05-26 21:44:54 +00:00
Martin Mares 25697773b5 The library is now glued together from generic and OS-dependent parts
by the `mergedirs' script. Few more IP address manipulation functions
and some fixes.
1998-05-15 07:56:13 +00:00
Martin Mares 58ef912c6b First look at data structures. More to come tomorrow... 1998-04-22 12:58:34 +00:00