summaryrefslogtreecommitdiff
path: root/src/basic
AgeCommit message (Collapse)Author
2016-01-13basic: add ascii_strcasecmp_nn() callLennart Poettering
In contrast to ascii_strcasecmp_nn() it takes two character buffers with their individual length. It will then compare the buffers up the smaller size of the two buffers, and finally the length themselves.
2016-01-13basic: add new ascii_strcasecmp_n() callLennart Poettering
2016-01-12tree-wide: use xsprintf() where applicableDaniel Mack
Also add a coccinelle receipt to help with such transitions.
2016-01-12capabilities: added support for ambient capabilities.Ismo Puustinen
This patch adds support for ambient capabilities in service files. The idea with ambient capabilities is that the execed processes can run with non-root user and get some inherited capabilities, without having any need to add the capabilities to the executable file. You need at least Linux 4.3 to use ambient capabilities. SecureBit keep-caps is automatically added when you use ambient capabilities and wish to change the user. An example system service file might look like this: [Unit] Description=Service for testing caps [Service] ExecStart=/usr/bin/sleep 10000 User=nobody AmbientCapabilities=CAP_NET_ADMIN CAP_NET_RAW After starting the service it has these capabilities: CapInh: 0000000000003000 CapPrm: 0000000000003000 CapEff: 0000000000003000 CapBnd: 0000003fffffffff CapAmb: 0000000000003000
2016-01-12capabilities: keep bounding set in non-inverted format.Ismo Puustinen
Change the capability bounding set parser and logic so that the bounding set is kept as a positive set internally. This means that the set reflects those capabilities that we want to keep instead of drop.
2016-01-11resolved: when we get a TCP connection failure, try againLennart Poettering
Previously, when we couldn't connect to a DNS server via TCP we'd abort the whole transaction using a "connection-failure" state. This change removes that, and counts failed connections as "lost packet" events, so that we switch back to the UDP protocol again.
2016-01-11shared: make sure foo.bar and foobar result in different domain name hashesLennart Poettering
This also introduces a new macro siphash24_compress_byte() which is useful to add a single byte into the hash stream, and ports one user over to it.
2016-01-11basic: split hash functions into their own header filesLennart Poettering
The hash operations are not really that specific to hashmaps, hence split them into a .c module of their own.
2016-01-11basic: introduce generic ascii_strlower_n() call and make use of it everywhereLennart Poettering
2016-01-11macro.h: provide a switch-case statement generator for IN_SETDaniel Mack
Rather than walking a list of valid values one-by-one, generate a switch-case statement for the IN_SET() macro. This allows the compiler to further optimize its code output, possibly by generating jump tables. This effectively decreases the binary size slightly. The implementation is based on macro overloading depending on the number of arguments. h/t to the following post: https://stackoverflow.com/questions/11761703/overloading-macro-on-number-of-arguments
2016-01-05basic: add string table macros for "extended boolean" enumsLennart Poettering
In a couple of cases we maintain configuration settings that know an on and off state, like a boolean, plus some additional states. We generally parse them as booleans first, and if that fails check for specific additional values. This adds a generalized set of macros for parsing such settings, and ports one use in resolved and another in networkd over to it.
2016-01-03Merge pull request #2245 from ssahani/socket1Lennart Poettering
core: socket options fix SCTP_NODELAY
2016-01-02basic: modernize conf-files.c a bitLennart Poettering
2015-12-31core: socket options fix SCTP_NODELAYSusant Sahani
SCTP_NODELAY is diffrent to TCP_NODELAY. Apply proper options in case of SCTP.
2015-12-26bitmap: don't do bitwise XOR on booleansLennart Poettering
It's weird doing bitwise operations on booleans. Let's use the boolean XOR (i.e. "!=") instead of the bitweise XOR (i.e. "^") on them.
2015-12-26util-lib: make sure more bitmap calls can deal with NULL objects fineLennart Poettering
2015-12-15basic: ENABLE_DEBUG_HASHMAP needs <pthread.h>Henrik Kaare Poulsen
this is a follow-up for commit 11c3a36649e5e5e77db499c92f3
2015-12-10Use /proc/net/sockstat6 to detect IPv6 supportJorgen Schaefer
The file /sys/module/ipv6 does not exist in all container implementations (e.g. Virtuozzo). Using /proc/net/sockstat6 detects IPv6 support reliably in these environments, too. This file does not exist when the kernel is not compiled with IPv6 support, or if IPv6 support is disabled, so simply checking for existence should be a suitable check. Fixes #2059
2015-12-07basic: add RB-Tree implementationDavid Herrmann
This adds an self-standing RB-Tree implementation to src/basic/. This will be needed for NSEC RR lookups, since we need "close lookups", which hashmaps (not even ordered-hashmaps) can give us in reasonable time.
2015-12-03journal: unbreak sd_journal_sendvZbigniew Jędrzejewski-Szmek
Borked since commit 3ee897d6c2401effbc82f5eef35fce405781d6c8 Author: Lennart Poettering <lennart@poettering.net> Date: Wed Sep 23 01:00:04 2015 +0200 tree-wide: port more code to use send_one_fd() and receive_one_fd() because here our fd is not connected and we need to specify the address.
2015-12-02tests: turn check if manager cannot be intialized into macroZbigniew Jędrzejewski-Szmek
We need to check the same thing in multiple tests. Use a shared macro to make it easier to update the list of errnos. Change the errno code for "unitialized cgroup fs" for ENOMEDIUM. Exec format error looks like something more serious. This fixes test-execute invocation in mock.
2015-12-01basic/virt: add missing includes to compile on ppc64Zbigniew Jędrzejewski-Szmek
2015-12-01basic: re-sort includesThomas Hindoe Paaboel Andersen
My previous patch to only include what we use accidentially placed the added inlcudes in non-sorted order.
2015-11-30basic: include only what we useThomas Hindoe Paaboel Andersen
This is a cleaned up result of running iwyu but without forward declarations on src/basic.
2015-11-27selinux: split up mac_selinux_have() from mac_selinux_use()Lennart Poettering
Let's distuingish the cases where our code takes an active role in selinux management, or just passively reports whatever selinux properties are set. mac_selinux_have() now checks whether selinux is around for the passive stuff, and mac_selinux_use() for the active stuff. The latter checks the former, plus also checks UID == 0, under the assumption that only when we run priviliged selinux management really makes sense. Fixes: #1941
2015-11-27util-lib: move nss-util.h from shared/ to basic/Lennart Poettering
The header file defines some helpers for GLIBC NSS and doesn't include anything else but glibc headers, hence there's little reason to keep it in shared/. See: #2008
2015-11-27resolved: fix typo in in_addr_is_localhost()Mantas Mikulėnas
2015-11-27resolved: never cache RRs originating from localhostLennart Poettering
After all, this is likely a local DNS forwarder that caches anyway, hence there's no point in caching twice. Fixes #2038.
2015-11-25util-lib: add ordered_set_ensure_allocated()Lennart Poettering
ordered_set_ensure_allocated() does for an OrderedSet, what set_ensure_allicated() does for a Set.
2015-11-24basic: fix build on architectures with small longHelmut Grohne
The x32 architecture has a small "long" type which is not enough to hold struct statfs.f_type.
2015-11-23escape: add cescape_length() call as generalization of cescape()Lennart Poettering
2015-11-23virt: add comment about order in virtualization detectionChristian Hesse
2015-11-23virt: detect dmi before cpuidChristian Hesse
Virtualbox should be detected as 'oracle'. This used to work but broke with commit: commit 75f86906c52735c98dc0aa7e24b773edb42ee814 Author: Lennart Poettering <lennart@poettering.net> Date: Mon Sep 7 13:42:47 2015 +0200 basic: rework virtualization detection API We swap detection for dmi and cpuid, this fixes Virtualbox with KVM. Hopefully it does not break anything else.
2015-11-19Merge pull request #1947 from phomes/sort-includes2Lennart Poettering
tree-wide: sort includes in *.h
2015-11-19Merge pull request #1931 from bengal/dhcp-fqdn-v2Tom Gundersen
libsystemd-network: add support for "Client FQDN" DHCP option (v2)
2015-11-18tree-wide: sort includes in *.hThomas Hindoe Paaboel Andersen
This is a continuation of the previous include sort patch, which only sorted for .c files.
2015-11-17calendarspec: sub-second support, v3Hristo Venev
2015-11-17hostname-util: fix code commentBeniamino Galvani
2015-11-17siphash: minor coding style fixes and modernizationsLennart Poettering
Only cosmetics really, doesn't change any actual logic.
2015-11-17siphash: fix another alignment issueLennart Poettering
2015-11-17tree-wide: make macros for converting fds to pointers and back generic and ↵Lennart Poettering
use them everywhere
2015-11-17tree-wide: use right cast macros for UIDs, GIDs and PIDsLennart Poettering
2015-11-17Merge pull request #1923 from zonque/siphashLennart Poettering
siphash24: let siphash24_finalize() and siphash24() return the result…
2015-11-16siphash24: let siphash24_finalize() and siphash24() return the result directlyDaniel Mack
Rather than passing a pointer to return the result, return it directly from the function calls. Also, return the result in native endianess, and let the callers care about the conversion. For hash tables and bloom filters, we don't care, but in order to keep MAC addresses and DHCP client IDs stable, we explicitly convert to LE.
2015-11-16tree-wide: sort includesThomas Hindoe Paaboel Andersen
Sort the includes accoding to the new coding style.
2015-11-16Merge pull request #1916 from zonque/alignTom Gundersen
siphash: alignment
2015-11-16Merge pull request #1915 from poettering/btrfs-root-subvolDavid Herrmann
tmpfiles: create subvolumes for "v", "q", and "Q" only if / is a subv…
2015-11-16tmpfiles: create subvolumes for "v", "q", and "Q" only if / is a subvolumeLennart Poettering
It's not a good idea to create subvolumes for parts of the OS tree (such as /home, or /var) if the root directory is not a subvolume too. We shouldn't assume control of "heavier" objects such as subvolumes, if the originating object (the root directory) is a "light-weight" object, i.e. a plain directory. Effectively this means that chroot() environments that are run on a plain directory do not have to deal with problems around systemd creating subvolumes that cannot be removed with a simple "rm" anymore. However, if the chroot manager creates a proper subvolume for such an environment it will also get further subvolumes placed in there, under the assumption that the manager understands the concept of subvolumes in that case.
2015-11-16siphash24: change result argument to uint64_tMartin Pitt
Change the "out" parameter from uint8_t[8] to uint64_t. On architectures which enforce pointer alignment this fixes crashes when we previously cast an unaligned array to uint64_t*, and on others this should at least improve performance as the compiler now aligns these properly. This also simplifies the code in most cases by getting rid of typecasts. The only place which we can't change is struct duid's en.id, as that is _packed_ and public API, so we can't enforce alignment of the "id" field and have to use memcpy instead.
2015-11-16siphash24: fix memory alignmentDaniel Mack
Use unaligned_read_le64() to access input buffer when reading complete 64-bit words. This should fix memory traps on platforms with strict aliasing.