Commit Graph

2704 Commits

Author SHA1 Message Date
Miika Karanki
98503c6d0c sd-bus: Fix standard method argument names
The argument names of methods under org.freedesktop.DBus.Properties and
org.freedesktop.DBus.Introspectable interfaces are specifies in D-Bus
specification[1]. They are:

  org.freedesktop.DBus.Introspectable.Introspect (out STRING xml_data)
  org.freedesktop.DBus.Properties.Get (in STRING interface_name,
                                       in STRING property_name,
                                       out VARIANT value);
  org.freedesktop.DBus.Properties.Set (in STRING interface_name,
                                       in STRING property_name,
                                       in VARIANT value);
  org.freedesktop.DBus.Properties.GetAll (in STRING interface_name,
                                          out DICT<STRING,VARIANT> props);

sd-bus is using different argument names in the introspection document.
Usually this is not a problem but in case something tries to map the
argument names based on the introspection document to the position of
the arguments in the method call, then using names different than the
ones specified in the D-Bus specification is confusing.

So fix the names to match the D-Bus specification.

[1] https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-introspectable
2021-11-23 19:46:56 +01:00
Daan De Meyer
f910926715 Merge pull request #21452 from vcaputo/mmap-cache-fd
mmap-cache: simplify MMapFileDescriptor-centric function signatures
2021-11-22 10:35:34 +01:00
Vito Caputo
c3bd54bf4f mmap-cache: s/mmap_cache/mmap_cache_fd_/ where apropos
Mostly mechanical renaming of mmap-cache functions that now
operate exclusively on the MMapFileDescriptor.
2021-11-19 13:43:00 -08:00
Vito Caputo
1da2c4ceeb mmap-cache: simplify API around MMapFileDescriptor
MMapFileDescriptor carries a reference to its originating
MMapCache, there's no value in supplying the
MMapFileDescriptor-centric functions a separate MMapCache.

A future commit will rename these functions to consistently use
an mmap_cache_fd_* prefix for improved clarity.
2021-11-19 13:39:00 -08:00
Daan De Meyer
368a14b67b journal: Add verify_hash_table()
The existing verify_hash_table() function is renamed to
verify_data_hash_table() since it only verifies the data hash table.

The verify information is also made a little more detailed by splitting
one of the checks in two.
2021-11-19 17:12:29 +00:00
Daan De Meyer
363b2b9aaf journal: Add journal_file_object_to_string() 2021-11-19 17:12:27 +00:00
Daan De Meyer
b92d1eba31 journal: Simplify definition of HEADER_INCOMPATIBLE_SUPPORTED 2021-11-19 17:06:57 +00:00
Daan De Meyer
d164ac771e journal: Use more structured initialization 2021-11-19 17:06:57 +00:00
Daan De Meyer
86e68f3814 journal: Use size_t instead of unsigned for array sizes 2021-11-19 17:06:55 +00:00
Daan De Meyer
8a799bed4c journal: Skip corrupt Data objects in sd_journal_get_data()
Similar to the change we made for sd_journal_enumerate_data(), let's
skip corrupt entry items and data objects in sd_journal_get_data().
2021-11-18 21:43:17 +00:00
Daan De Meyer
847c7ee8c3 journal: Use separate variable for Data object in sd_journal_get_data()
A little cleanup to make the next change easier. We're not moving to a
new Entry object in the for loop so there's no danger of changing the
Entry object window.
2021-11-18 21:43:17 +00:00
Daan De Meyer
5a94a2bf2b journal: Skip over corrupt entry items in enumerate_data()
Similar to sd_journal_next(), if trying to access an entry item
offset's data results in EBADMSG, skip to the next entry item so
we handle corruption better.

Fixes #21407
2021-11-18 21:43:15 +00:00
Lennart Poettering
7c248223eb tree-wide: use new RET_NERRNO() helper at various places 2021-11-16 08:04:09 +01:00
Yu Watanabe
7777024dab Merge pull request #21344 from yuwata/network-ignore-carrier-loss-timespan
network: make IgnoreCarrierLoss= also take a timespan
2021-11-16 10:27:01 +09:00
Luca Boccassi
e2f8c1124d Merge pull request #21277 from yuwata/permanent-hw-addr
network, udev: several improvement of permanent hardware address handling
2021-11-15 10:57:30 +00:00
Yu Watanabe
52c3bc708f event-util: introduce event_reset_time_relative() 2021-11-14 10:32:06 +09:00
Luca Boccassi
0a040e6419 sd-event: one more assert when turning off an event source
CID#1465866
2021-11-13 19:12:11 +00:00
Yu Watanabe
1de88f3048 udev/net: read hardware address from netlink message 2021-11-13 08:53:33 +09:00
Yu Watanabe
5bfee718d2 sd-netlink: introduce sd_rtnl_message_nexthop_get_flags() 2021-11-13 08:16:06 +09:00
Yu Watanabe
45b1299a1e sd-netlink: clear previous flags or state by _set_flags() or _set_state()
Otherwise, there is no way to reset the previous value.
2021-11-13 08:16:06 +09:00
Luca Boccassi
c3c50474d2 tree-wide: don't ignore return code from sd_event_source_set_enabled()
CID#1465793
CID#1465794
CID#1465795
2021-11-12 22:13:24 +01:00
Emily Gonyer
be7148ebed Change gendered terms to be gender-neutral (#21325)
Some typos are also fixed.
2021-11-12 16:09:56 +01:00
Michal Sekletar
fd69f22475 sd-event: introduce callback invoked when event source ratelimit expires 2021-11-11 17:02:56 +01:00
Lennart Poettering
126c02a8fd Merge pull request #21304 from poettering/chain-ssh-auth-keys
userdbctl: add support for chaining other ssh-authorized-keys commands from userdbctl
2021-11-11 14:35:48 +01:00
Lennart Poettering
4ef15008cc escape: add flags argument to quote_command_line()
That way, we can reuse the call at one more place (see later patch).
2021-11-11 10:05:46 +01:00
Yu Watanabe
c990101f23 sd-netlink: fix type of NDA_LLADDR attribute 2021-11-11 12:49:42 +09:00
Yu Watanabe
e2b777f821 sd-id128: use /proc/device-tree 2021-11-11 04:42:50 +09:00
Lennart Poettering
035daf73fb test: add test case for self-destroy inotify handler 2021-11-09 13:13:25 +01:00
Lennart Poettering
e67d738a87 sd-event: add sd_event_add_inotify_fd() call
sd_event_add_inotify_fd() is like sd_event_add_inotify(), but takes an
fd to an inode instead of a path, and is hence a ton nicer.
2021-11-09 13:02:13 +01:00
Lennart Poettering
53baf2efa4 sd-event: don't destroy inotify data structures from inotify event handler
This fixes a bad memory access when we destroy an inotify source handler
from the handler itself, and thus destroy the associated inotify_data
structures.

Fixes: #20177
2021-11-09 12:53:04 +01:00
Lennart Poettering
4f538d7b22 tree-wide: use sd_event_source_disable_unref() where we can 2021-11-09 12:52:53 +01:00
Zbigniew Jędrzejewski-Szmek
ed8ba68f3b Merge pull request #21272 from yuwata/netif-util-split
netif-util: move several functions from network-util.c to netif-util.c
2021-11-09 10:01:07 +01:00
Yu Watanabe
fb076d5f6c sd-netlink: add more attributes for CAKE 2021-11-09 10:58:44 +09:00
Yu Watanabe
b5cc5591fa netif-util: move several functions from network-util.[ch] to shared/netif-util.[ch]
These functions are not relevant to sd-network, and only used by
networkd, networkctl, and udevd.
2021-11-09 08:24:10 +09:00
Yu Watanabe
f09d20256a arphrd-util: rename arphrd-list.[ch] -> arphrd-util.[ch] 2021-11-09 08:24:10 +09:00
Christian Brauner
a6d1760024 build: preserve correct mode when generating files via jinja2
When using "capture : true" in custom_target()s the mode of the source
file is not preserved when the generated file is not installed and so
needs to be tweaked manually. Switch from output capture to creating the
target file and copy the permissions from the input file.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-11-08 12:06:48 +00:00
Lennart Poettering
aedec452b9 tree-wide: always use TAKE_FD() when calling rearrange_stdio()
rearrange_stdio() invalidates specified fds even on failure, which means
we should always invalidate the fds we pass in no matter what. Let's
make this explicit by using TAKE_FD() for that everywhere.

Note that in many places we such invalidation doesnt get us much
behaviour-wise, since we don't use the variables anymore later. But
TAKE_FD() in a way is also documentation, it encodes explicitly that the
fds are invalidated here, so I think it's a good thing to always make
this explicit here.
2021-11-03 23:05:26 +00:00
Lennart Poettering
8f03de5323 tree-wide: port various places to use TAKE_PID() 2021-11-03 16:36:09 +01:00
Yu Watanabe
231c7645ca Merge pull request #21041 from yuwata/network-bpf-neighbor
network: introduce BPF to reject netlink messages about non-static neighbor
2021-10-20 13:30:32 +09:00
Yu Watanabe
dc317a9aed sd-netlink: introduce sd_netlink_attach_filter() 2021-10-19 20:41:09 +09:00
Lennart Poettering
aabb252577 Merge pull request #20905 from medhefgo/boot-cleanup
sd-boot: Code cleanups
2021-10-19 10:23:12 +02:00
Zbigniew Jędrzejewski-Szmek
33539ffe59 Merge pull request #20988 from DaanDeMeyer/rotate-reason
journal: Improve rotation logging
2021-10-19 09:53:31 +02:00
Yu Watanabe
0522729e19 tree-wide: use AF_NETLINK instead of PF_NETLINK 2021-10-18 22:46:37 +02:00
Daan De Meyer
012181eaef journal: Add two more log messages to journal_file_rotate_suggested()
This ensures every reason for rotation has an associated log message.
2021-10-18 16:48:06 +01:00
Daan De Meyer
c8e6e1f10d journal: Add log level argument to journal_file_rotate_suggested()
When journald is rotating a file, we'd like to log the reason at
LOG_INFO or higher instead of LOG_DEBUG. For journalctl --header,
logging the reason at a level higher than LOG_DEBUG doesn't really
make sense. To accomodate both use cases, make the log level used
by journal_file_rotate_suggested() configurable.
2021-10-18 15:26:06 +02:00
Jan Janssen
a36a0d1540 macro: Move ALIGN_TO to macro-fundamental.h and introduce CONST_ALIGN_TO 2021-10-17 11:56:05 +02:00
Zbigniew Jędrzejewski-Szmek
6b292fa17b Merge pull request #20996 from yuwata/udevadm-trigger-debug
test: show debug and verbose message
2021-10-15 09:44:59 +02:00
Lennart Poettering
2f82562bad alloc-util: add strdupa_safe() + strndupa_safe() and use it everywhere
Let's define two helpers strdupa_safe() + strndupa_safe() which do the
same as their non-safe counterparts, except that they abort if called
with allocations larger than ALLOCA_MAX.

This should ensure that all our alloca() based allocations are subject
to this limit.

afaics glibc offers three alloca() based APIs: alloca() itself,
strndupa() + strdupa(). With this we have now replacements for all of
them, that take the limit into account.
2021-10-14 15:57:52 +02:00
Lennart Poettering
5222651ecc journal: drop unnecessary +1 in newa() expression
newa() does this internally anyway, no need to do this explicitly.
2021-10-14 15:57:52 +02:00
Lennart Poettering
698cec65c4 tree-wide: port all calls to alloca() to alloca_safe() 2021-10-14 15:57:52 +02:00