summaryrefslogtreecommitdiff
path: root/sysdep/unix/main.c
AgeCommit message (Collapse)Author
2022-12-10CLI: Fix for long-lived sessions during high loadsOndrej Zajicek
When there is a continuos stream of CLI commands, cli_get_command() always returns 1 (there is a new command). Anyway, the socket receive buffer was reset only when there was no command at all, leading to a strange behavior: after a while, the CLI receive buffer came to its end, then read() was called with zero size buffer, it returned 0 which was interpreted as EOF. The patch fixes that by resetting the buffer position after each command and moving remaining data at the beginning of buffer. Thanks to Maria Matejka for examining the bug and for the original bugfix.
2022-11-09Conf: Make 'configure check' command restrictedOndrej Zajicek
While it does not directly change BIRD state, it can trigger reading arbitrary files and eating significant memory.
2022-11-09Conf: Free stored old config before parsing new oneOndrej Zajicek
BIRD keeps a previous (old) configuration for the purpose of undo. The existing code frees it after a new configuration is successfully parsed during reconfiguration. That causes memory usage spikes as there are temporarily three configurations (old, current, and new). The patch changes it to free the old one before parsing the new one (as user already requested a new config). The disadvantage is that undo is not available after failed reconfiguration.
2022-07-11Merge remote-tracking branch 'origin/master' into backportMaria Matejka
2022-06-27Filter: Implement soft scopesOndrej Zajicek (work)
Soft scopes are anonymous scopes that most likely do not contain any symbol, so allocating regular scope is postponed when it is really needed.
2022-04-06Protocols have their own explicit init routinesMaria Matejka
2022-03-09Revert "Multipage allocation"Maria Matejka
This reverts commit 6cd37713781a3092f8166b2178fae35cbfec1e28.
2021-10-13Multipage allocationMaria Matejka
We can also quite simply allocate bigger blocks. Anyway, we need these blocks to be aligned to their size which needs one mmap() two times bigger and then two munmap()s returning the unaligned parts. The user can specify -B <N> on startup when <N> is the exponent of 2, setting the block size to 2^N. On most systems, N is 12, anyway if you know that your configuration is going to eat gigabytes of RAM, you are almost forced to raise your block size as you may easily get into memory fragmentation issues or you have to raise your maximum mapping count, e.g. "sysctl vm.max_map_count=(number)".
2021-10-13CLI socket accept() may also fail and should produce some message, not a ↵Maria Matejka
coredump.
2021-06-06sysdep: Add wrapper to get random bytesToke Høiland-Jørgensen
Add a wrapper function in sysdep to get random bytes, and required checks in configure.ac to select how to do it. The configure script tries, in order, getrandom(), getentropy() and reading from /dev/urandom.
2021-04-07Unix: Expand accepted ranges of iproute2 constantsOndrej Zajicek (work)
We support 32bit table and realm/flow ids, we should also accept them as constants. Thanks to Patrick Hemmer for the bugreport.
2021-02-10BGP: Add support for BGP hostname capabilityVincent Bernat
This is an implementation of draft-walton-bgp-hostname-capability-02. It is implemented since quite some time for FRR and in datacenter, this gives a nice output to avoid using IP addresses. It is disabled by default. The hostname is retrieved from uname(2) and can be overriden with "hostname" option. The domain name is never set nor displayed. Minor changes by committer.
2020-06-03Log: Do not open logfiles when parse-and-exit option is activeOndrej Zajicek (work)
This is a quick workaround for an issue where configured logfiles are opened/created during parsing of a config file even when parse-and-exit option is active. We should later refactor the logging code to avoid opening log during parsing altogether.
2020-04-09Configuration strings are constant.Maria Matejka
This is merely a const propagation. There was no problem in there.
2020-02-04Conf: Better error message when reading iproute2 configMaria Matejka
Reported by: Martin Weinelt <martin@darmstadt.freifunk.net>
2019-10-22Accept uppercase letters in iproute2 namesOndrej Zajicek
Names read from texfiles in /etc/iproute2/* are normalized by replacing non-alphanumeric chars with underscore. The patch fixes handling of uppercase letters, which were handled as non-alphanumberic. Thanks to Igor Gavrilov for the bugreport.
2019-10-09Lib: Support for 64-bit numbers in bvsnprintf()Ondrej Zajicek (work)
Use 'l' for s64/u64 instead of for long/ulong, as that is much more useful. Also make number() correct with regard to signed/unsigned typecasts.
2019-10-04Fixed undefined behavior on signals.Maria Matejka
The C11 specification allows only sig_atomic_t and _Atomic variable access. All other accesses to global variables are undefined behavior. Using int was probably OK on x86 and x86_64; yet there were some reports from other architectures (especially some MIPS) that in rare cases, after issuing SIGHUP, BIRD did strange things.
2019-08-21Sysdep: Drop supplementary groups when dropping GIDOndrej Zajicek (work)
We forgot to do that. Oops.
2019-07-03Merge branch 'master' into mq-filter-stackMaria Matejka
2019-06-30Nest: Add command to request graceful restartOndrej Zajicek (work)
When 'graceful down' command is entered, protocols are shut down with regard to graceful restart. Namely Kernel protocol does not remove routes and BGP protocol does not send notification, just closes the connection.
2019-06-12Add CLI command to test reconfiguration statusOndrej Zajicek (work)
Based on patch from Kenth Eriksson <kenth.eriksson@infinera.com>.
2019-02-20Conf: Symbol implementation converted from void pointers to unionMaria Matejka
... and consted some declarations.
2019-02-20Filter: merged filter instruction constructors, counting line size on ↵Maria Matejka
instruction construct
2019-02-20Filters: split the large filter.h file to smaller files.Maria Matejka
This should be revised, there are still ugly things in the filter API.
2019-01-04Unix: Remove removed option from helpOndrej Zajicek (work)
Also includes minor cleanup of help.
2018-12-04Unix: Change debugging optionsOndrej Zajicek (work)
The old behavior was that enabling debugging did many nontrivial changes in BIRD behavior. The patch changes it that these changes are generally independent. Compiling with --enable-debug now just enables compile-time debug macros, but do not automatically activate debug mode (-d) nor local mode (-l). Debug mode with output to file (-D) do not force foreground mode (-f), therefore there is no need for backgroud option (-b), which is removed. Also fixes a bug when the default log target in -D mode was stderr instead of given debug file.
2018-09-11Conf: Show the line:char position where the syntax error happensJan Maria Matejka
2018-08-28Main: Add -b to force background even in debug modeJan Maria Matejka
2018-08-13sysdep/unix/main.c: Remove trailing spacesPavel Tvrdik
2017-12-10Lib: Check size of netsOndrej Zajicek (work)
2017-12-07Nest: Update to new timersOndrej Zajicek (work)
2017-12-07Timers: Replace old timers with microsecond timersOndrej Zajicek (work)
The old timer interface is still kept, but implemented by new timers. The plan is to switch from the old inteface to the new interface, then clean it up.
2017-12-07Timers: Split microsecond timers from BFD code to libOndrej Zajicek (work)
2016-11-08Merge branch 'master' into int-newOndrej Zajicek (work)
2016-11-08Minor code cleanupsOndrej Zajicek (work)
2016-11-08Merge tag 'v1.6.2' into int-newOndrej Zajicek (work)
2016-11-01Build: switch on -Wextra, get rid of most of the warningsJan Moskyto Matejka
There are several unresolved -Wmissing-field-initializers on older versions of GCC than 5.1, all of them false positive.
2016-09-15Main: Improve BIRD help messagesPavel Tvrdik
2016-05-12Merge remote-tracking branch 'origin/master' into int-newOndrej Zajicek (work)
2016-05-10Merge branch 'int-new' into int-new-mergedJan Moskyto Matejka
2016-05-10Build system reworked to one global Makefile with includes and no nestingJan Moskyto Matejka
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-04-08Merge branch 'master' into int-new-channelsJan Moskyto Matejka
2016-04-07Main: Add local optionOndrej Zajicek (work)
Add option that changes default paths for config file and control socket to the current working directory.
2016-04-06IO: Replace RX priority heuristic with explicit markOndrej Zajicek (work)
In BIRD, RX has lower priority than TX with the exception of RX from control socket. The patch replaces heuristic based on socket type with explicit mark and uses it for both control socket and BGP session waiting to be established. This should avoid an issue when during heavy load, outgoing connection could connect (TX event), send open, but then failed to receive OPEN / establish in time, not sending notifications between and therefore got hold timer expired error from the neighbor immediately after it finally established the connection.
2015-12-20ROA code switchoffJan Moskyto Matejka
2015-11-09Conf: Fixes bug in symbol lookup during reconfigurationOndrej Zajicek (work)
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-06-08unsigned [int] -> uintPavel Tvrdík
2015-03-02Implement latency tracking, internal event log and watchdogOndrej Zajicek
2014-05-18IPv4/IPv6 integrated socket code.Ondrej Zajicek