Commit Graph
36268 Commits
Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 993eeea0ef Merge pull request #21501 from medhefgo/test
test: Use TEST macro
2021-11-26 12:23:18 +01:00
Zbigniew Jędrzejewski-Szmek 66a8eddd6d Merge pull request #21360 from yuwata/network-json
network: json: add more information
2021-11-26 11:04:52 +01:00
Vito Caputo 7580b0d869 mmap-cache: embed MMapCache.contexts[]
Code simplification; no idea why the Context structs were being
heap-allocated piecemeal.  There aren't many and they're small,
and made even smaller with this commit.

This also gets rid of the Context.cache backreference by just
accompanying the Context* with MMapCache* to the few private
Context* operations, resolving the context ID to a Context* at
the single public entrypoint: mmap_cache_fd_get(), which asserts
on the value being within bounds.  The Context.id member and
checks are also removed, as there's far less opportunity for
these things to become inconsistent now.

Of course this drops all context_{add,free}() related code,
making for a tasty diffstat.
2021-11-26 08:35:58 +09:00
Daan De Meyer 5ec9fbae64 journal: Deduplicate entry items before they are stored in the entry object
If the iovec contains the same data more than once, we'll end up with
duplicate offsets in the items array. Let's make sure we remove any
duplicates before we store the items in an entry object.
2021-11-25 23:38:09 +01:00
Luca Boccassi 485c9e19e7 Merge pull request #21253 from poettering/homed-auto-grow-shrink
homed: automatic grow/shrink of LUKS home dirs
2021-11-25 22:14:17 +00:00
Vito Caputo b82aca89a5 mmap-cache: LIST_REMOVE() *after* w->unused_prev
The LIST_REMOVE() macro always assigns NULL to w->unused_prev,
meaning every time this window was in last_unused, the remainder
of the unused list was lost to the ether.

Turns out there's been a memory leak in journald after all, this
code has been there since at least 2013...
2021-11-25 21:39:38 +01:00
Zbigniew Jędrzejewski-Szmek f1da1e7b5f Merge pull request #21522 from yuwata/home-fix-memleak
home: fix memleak
2021-11-25 20:22:23 +01:00
Zbigniew Jędrzejewski-Szmek 55a044dece Merge pull request #21517 from yuwata/network-long-hw-addr
network: make MACAddress= can take longer address
2021-11-25 20:21:38 +01:00
Yu Watanabe 5213507113 network,udev: make .network and .link file can match with hardware address longer or shorter than ETH_ALEN 2021-11-25 20:14:46 +01:00
Daan De Meyer b41b682bd6 journal: Remove entry seqnum revert logic
This actually causes mismatches between the header tail entry seqnum
and the last entry seqnum since when we revert the header seqnum, we
don't remove the entry object we added. If adding the entry object
itself fails, we don't need to revert the seqnum since it's never
incremented so let's remove this logic alltogether.
2021-11-25 20:02:32 +01:00
Lennart Poettering 6d6d4459ab homectl: add new "homectl rebalance" command
Let's add an explicit, synchronous command to request immediate rebalancing and
wait for it.
2021-11-25 18:28:44 +01:00
Lennart Poettering 4950591627 homed: add explicit API for requesting rebalancing too 2021-11-25 18:28:44 +01:00
Lennart Poettering d357b80d33 homed: add automatic grow/shrink ("rebalancing") 2021-11-25 18:28:44 +01:00
Lennart Poettering 21505c937c homectl: expose new rebalanceWeight JSON use record field 2021-11-25 18:28:44 +01:00
Lennart Poettering 9aa3e5ebdf user-record: add rebalanceWeight field 2021-11-25 18:28:44 +01:00
Lennart Poettering c42234abf2 homed: support LogControl1 D-Bus API too, and make use of it
All our D-Bus services support the LogControl1 API, but homed didn't so
far. Fix that, and make use of it in the test case, to make debugging it
easier.
2021-11-25 18:18:42 +01:00
Lennart Poettering 7ff048a718 Merge pull request #21487 from DaanDeMeyer/dissect-image-other-arch
Allow dissect_image() to dissect images from architectures other than the native one
2021-11-25 17:36:57 +01:00
Yu Watanabe 5601a9b910 homework: fix memleak
Fixes #21521.
2021-11-26 00:14:32 +09:00
Yu Watanabe 47398ea705 homework: drop unnecessary initialization 2021-11-26 00:09:30 +09:00
Jan Janssen c462e63eea test: Use TEST macro in more cases
This converts to TEST macro in less trivial cases. This is mostly
due to having an intro or outro before/after the actual tests.

Some notable changes:
 - add a "test" to make sure the hashmap and ordered_hashmap tests
   from different compilation units are actually run in test-hashmap.c
 - make root arg a global var in test-install-root.c
 - slightly rework an EFI specific test in test-proc-cmdline.c
 - usage of saved_argv/saved_argc in test-process-util.c
 - splitting test-rlimit-util.c into several tests
 - moving the hwdb open check into intro in test-sd-hwdb.c
 - condense several "tests" into one in test-udev-util.c
2021-11-25 15:03:10 +01:00
Jan Janssen 4f7452a8eb test: Use TEST macro
This converts to TEST macro where it is trivial.

Some additional notable changes:
 - simplify HAVE_LIBIDN #ifdef in test-dns-domain.c
 - use saved_argc/saved_argv in test-copy.c, test-path-util.c,
   test-tmpfiles.c and test-unit-file.c
2021-11-25 15:03:06 +01:00
Jan Janssen 4d5ad9d951 test-time-util: Properly restore TZ variable
The test fails to call tzset() after unsetting TZ variable, which
could break other tests. Also, let's be nicer and actually restore
the TZ to its original value.
2021-11-25 14:56:33 +01:00
Jan Janssen a40b728e11 test: Slightly rework DEFINE_TEST_MAIN macros
- A lot of tests want a different log level
- Provides saved_argc/saved_argv to tests
- Separate intro/outro is more flexible
2021-11-25 14:56:33 +01:00
Yu Watanabe da7c995b67 network: json: add more link information 2021-11-25 22:35:35 +09:00
Yu Watanabe 7ae55b78e6 network: introduce link_flags_to_string_alloc() and kernel_operstate_to_string() 2021-11-25 22:35:35 +09:00
Yu Watanabe 7edbe5fe40 network: json: append routing policy rule information 2021-11-25 22:35:35 +09:00
Yu Watanabe 965153054a network: routing policy rule: introduce fr_act_type_full_to_string() 2021-11-25 22:35:35 +09:00
Yu Watanabe 6e66b981d5 network: json: append neighbor information 2021-11-25 22:35:35 +09:00
Yu Watanabe 972f17c8f6 network: json: append nexthop information 2021-11-25 22:35:35 +09:00
Yu Watanabe a92f3a1015 network: json: append route information 2021-11-25 22:35:35 +09:00
Yu Watanabe 5ee3ab4d3a network: json: append address information 2021-11-25 22:35:35 +09:00
Yu Watanabe 385f2512d5 network: json: split manager_build_json() into two 2021-11-25 22:35:35 +09:00
Yu Watanabe 165e719948 network: json: make {network,device}_build_json() accept NULL 2021-11-25 22:35:35 +09:00
Yu Watanabe cfb7e06b1e network: json: use new building json macros 2021-11-25 22:35:35 +09:00
Yu Watanabe 42ceb47456 network: address: expose address_flags_to_string_alloc() 2021-11-25 22:35:35 +09:00
Yu Watanabe 7314084aa4 json: introduce several macros for building json object 2021-11-25 22:35:30 +09:00
Yu Watanabe f9930401d5 in-addr-util: introduce FAMILY_ADDRESS_SIZE_SAFE() macro 2021-11-25 22:34:29 +09:00
Daan De Meyer 9df247da28 journal: Add more information to --verify error messages 2021-11-25 14:22:56 +01:00
Lennart Poettering 0cdf6b14a5 json: add new JSON_BUILD_CONST_STRING() macro
This macro is like JSON_BUILD_STRING() but uses our json library's
ability to use literal strings directly as JsonVariant objects.

The changes all our codebase to use this new macro whenever we build
JSON objects from literal strings.

(I tried to make this automatic, i.e. to detect in JSON_BUILD_STRING()
whether something is a literal string nicely and thus do this stuff
automatically, but I couldn't find a way.)

This should reduce memory usage of our JSON code a bit. Constant strings
we use very often will now be shared and mapped directly from the ELF
image.
2021-11-25 14:22:31 +01:00
Lennart Poettering e2c7efd329 json: don't assert() if we add a NULL element via json_variant_set_field()
The rest of our JSON code tries hard to magically convert NULL inputs
into "null" JSON objects, let's make sure this also works with
json_variant_set_field().
2021-11-25 14:21:54 +01:00
Yu Watanabe a8840714f3 network: make MACAddress= takes hardware address with its length is INFINIBAND_ALEN
Also, the multicast and local bits in the specified MAC address for
ethernet are adjusted.
2021-11-25 22:03:19 +09:00
Yu Watanabe 37593b7c48 netif-util: introduce net_verify_hardware_address() 2021-11-25 21:07:32 +09:00
Lennart Poettering 4dc07c3a9a repart,homed: split out disk cleanup macros into generic header 2021-11-25 12:10:34 +01:00
Lennart Poettering 55cb63bf6e list: add LIST_POP() helper that pops the first item off a linked list 2021-11-25 12:10:03 +01:00
Yu Watanabe c8e16339f1 Merge pull request #21503 from poettering/ioprio-fix
work around linux 5.15 ioprio API breakage
2021-11-25 14:23:02 +09:00
Yu Watanabe 030e2a7734 Merge pull request #21506 from poettering/homed-uidmap-fixes
homed uidmap (and other) fixes
2021-11-25 13:37:46 +09:00
Yu Watanabe a83161d08b Merge pull request #21508 from poettering/conn-count-fix
pid1: fix connection counting
2021-11-25 13:33:13 +09:00
Dominique Martinet 7a8288f6ed build: fix build without seccomp
- execute.c: bpf functions were in the middle of an #if HAVE_SECCOMP
  block for no reason
- test-fd-util.c: make seccomp-util.h includable without depending on
  <seccomp.h>, and make is_seccomp_available() hardcoded to returning
  false in this case.
  Also fix a stray DEFINED() -- HAVE_SECCOMP is defined as 0, so normal
  #if should be used like everywhere else.
2021-11-25 13:22:32 +09:00
Lennart Poettering 000b61b980 socket: various modernizations 2021-11-25 00:05:03 +01:00
Lennart Poettering 3fabebf45e socket: always pass socket, fd and SocketPeer ownership to service together
Per-connection socket instances we currently maintain three fields
related to the socket: a reference to the Socket unit, the connection fd,
and a reference to the SocketPeer object that counts socket peers.

Let's synchronize their lifetime, i.e. always set them all three
together or unset them together, so that their reference counters stay
synchronous.

THis will in particuar ensure that we'll drop the SocketPeer reference
whenever we leave an active state of the service unit, i.e. at the same
time we close the fd for it.

Fixes: #20685
2021-11-25 00:05:03 +01:00