Commit Graph
3645 Commits
Author SHA1 Message Date
Yu Watanabe b07131facf sd-device-enumerator: FOREACH_DEVICE_PROPERTY() does not provide NULL value
Hence, when sd_device_enumerator_add_match_property() called with NULL
for value, then the filter always unmatches with the device.
2022-08-09 01:17:03 +09:00
Yu Watanabe 585f2035b3 sd-device-enumerator,monitor: fix sysattr match
Previously, if sd_device_enumerator_add_match_sysattr() is called for
the same sysattr with different values, then no device passed the filter.

Now, the accepted values (or patterns) are stored in strv, and if the
sysattr value of a device matches with the strv, then the device passes
the filter.
2022-08-09 01:17:00 +09:00
Yu Watanabe ebf404a4d0 sd-netlink: rename NLType and friends
In sd-netlink, we use 'type' for naming many variables with different type,
and worst of all, function like `type_get_type()` exists. That makes the
code hard to understood.

Let's rename
- NLType -> NLAPolicy
- NLTypeSystem -> NLAPolicySet
- NLTypeSystemUnion -> NLAPolicySetUnion
- type_get_type() -> policy_get_type()
- type_get_type_system() -> policy_get_policy_set(), and so on.

This also changes the type of attribute taken by e.g.
`sd_netlink_message_append_string()` from `unsigned short` -> `uint16_t`
to make the variable size clearer.
2022-08-06 03:53:51 +09:00
Yu Watanabe 1ab7e2b587 Merge pull request #23340 from yuwata/network-check-sr-iov-pf-state
network: check SR-IOV PF state
2022-08-06 03:18:30 +09:00
David Rheinsberg 347f48246f bus: use inline trace argument for ANONYMOUS auth
Rather than using a separate DATA round to transmit the trace-string of
the ANONYMOUS authentication scheme, transmit it inline as argument.
This requires a refactor of the client-side SASL parser, as we now have
a different set of replies depending on the mode used.

This fixes an issue where libdbus-1 does not query for trace-strings if
not transmit inline as AUTH-ANONYMOUS argument. It is unclear from the
wording of the spec whether this is a violation by libdbus-1. However,
we can work around it by simply changing our mode of transmittal.
2022-08-05 16:39:55 +01:00
Yu Watanabe 68a52f5973 sd-device: introduce sd_device_new_child() 2022-08-05 21:49:23 +09:00
igo95862 b283d50240 Fix ObjectManager interface emitted for non-manager objects 2022-07-25 23:54:54 +03:00
igo95862 19b581466a test-bus-objects: Test interfaces added/removed signal interfaces
`org.freedesktop.DBus.ObjectManager` should only be emitted if
object in question has ObjectManager attached.
2022-07-25 23:53:18 +03:00
igo95862 2ccd0828fc Fix GetManagedObjects returning ObjectManager interface for non-manager objects 2022-07-25 23:37:00 +03:00
igo95862 724e13b346 test-bus-objects: Test GetManagedObjects interfaces are correct
Objects without ObjectManager should not have
`org.freedesktop.DBus.ObjectManager` interface.

Object with ObjectManager should do.

Also added ASSERT_SE_NONNEG and ASSERT_NONNEG macros.
2022-07-25 23:29:17 +03:00
Yu Watanabe 978642b633 Merge pull request #24020 from yuwata/network-rfkill
network: fix wlan interface handling when its RF is killed
2022-07-24 13:01:50 +09:00
Yu Watanabe 573bb24df7 sd-netlink: introduce sd_nfnl_{send,call}_batch()
This also introduces sd_nfnl_message_new() which can be also used for
non-nftables subsystems.
2022-07-24 00:16:21 +09:00
Yu Watanabe 04d2003718 sd-netlink: do not compare pointer with 0 2022-07-24 00:05:32 +09:00
Yu Watanabe df7371708e sd-netlink: merge sd_nfnl_nft_message_{new,del}_setelems_begin()
And this makes the new merged function `sd_nfnl_nft_message_new_setelems()`
not open container, as containers should be opened and closed in the
same function in general. Otherwise, it is hard to understand which
level we are in the nested attribute tree.
2022-07-24 00:05:09 +09:00
Yu Watanabe 9d884ac36d sd-netlink: drop unused sd_nfnl_nft_message_del_table() 2022-07-23 23:52:42 +09:00
Yu Watanabe 2c08455eed sd-netlink: introduce sd_netlink_message_append_container_data() 2022-07-23 23:52:42 +09:00
Yu Watanabe 64f090a61a sd-netlink: several cleanups for netfilter
- rename family -> nfproto, and other arguments,
- check specified nfproto,
- change type of several function arguments that specify data length,
- add several assertions,
- drop unnecessary headers.
2022-07-23 23:52:42 +09:00
Yu Watanabe 8547260579 tree-wide: drop unnecessary inclusion of netlink-util.h 2022-07-23 23:31:23 +09:00
Yu Watanabe 13c026ca83 sd-netlink: move rtnl_message_type_is_*() to netlink-message-rtnl.c 2022-07-23 23:31:23 +09:00
Yu Watanabe d6985e76f2 sd-device: introduce device_unref_and_replace() 2022-07-23 08:16:38 +09:00
Yu Watanabe 5eb83e9000 sd-device: introduce device_clear_sysattr_cache() 2022-07-23 08:11:36 +09:00
Yu Watanabe 2829fca249 sd-device: introduce device_get_sysattr_bool() 2022-07-23 08:11:36 +09:00
Lennart Poettering 4a0cb5474e Merge pull request #23963 from matoro/main
Replace __sync intrinsics with __atomic
2022-07-21 00:10:01 +02:00
Yu Watanabe c798e1dfee Merge pull request #24035 from yuwata/sd-event-cleanup
sd-event: tiny cleanups
2022-07-16 05:11:00 +09:00
Daan De Meyer 5edf875b92 coredump: Try to write journald coredump metadata to the journal
Currently, if journald coredumps, the coredump is written to
/var/lib/systemd/coredump but the coredump metadata is not written
to  the journal meaning we can't find out about the coredump's
existence via the journal. This means that coredumpctl can't be
used to work with journald coredumps, as well as any other tools
that rely on journald to know about coredumps.

To solve the issue, let's have systemd-coredump try to write
systemd-journald coredump metadata to the journal. We have to be
careful though, since if journald coredumps, there's no active
reader on the receive end of the journal socket, so we have to make
sure we don't deadlock trying to write to the socket. To avoid the
deadlock, we put the socket in nonblocking mode before trying to
write to it.
2022-07-15 19:27:00 +01:00
Yu Watanabe c8e9d15cbf sd-event: introduce PROTECT_EVENT() macro 2022-07-16 00:42:39 +09:00
Yu Watanabe 76d04c3a34 sd-event: drop redundant code
The function `source_io_unregister()` will be anyway called in
`source_disconnect()`.
2022-07-16 00:38:37 +09:00
matoro 60c040f6a7 journal: replace __sync intrinsics with __atomic 2022-07-14 17:39:26 -04:00
Yu Watanabe 3f0dbb0f0c sd-bus: do not pass NULL when received message with invalid type
Fixes #24003.
2022-07-14 10:08:27 +02:00
Zbigniew Jędrzejewski-Szmek 44571ce98e Merge pull request #23817 from yuwata/sd-device-send-udev-database-version
sd-device: send udev database version
2022-07-13 13:10:40 +02:00
Yu Watanabe 12799947e2 Merge pull request #23972 from yuwata/sd-device
sd-device: do not return -ENOENT by sd_device_get_is_initialized()
2022-07-11 22:44:56 +02:00
Topi Miettinen 3295d0d896 sd-netlink: add sizes for some IP and Ethernet addresses
Add sizes for some uses of NETLINK_TYPE_IN_ADDR and NETLINK_TYPE_ETHER_ADDR
types.
2022-07-11 18:37:38 +00:00
Yu Watanabe 4eb5f1db44 sd-device: shorten code a bit 2022-07-11 15:27:21 +02:00
Yu Watanabe 591c186f2f sd-device: make sd_device_get_is_initialized() not return -ENOENT 2022-07-11 14:08:52 +02:00
Yu Watanabe 4bc4040bc0 sd-device: send udev database version
Otherwise, sd-device object received through sd-device-monitor does not
show current tags.

Fixes #23799.
2022-07-09 04:53:36 +09:00
Yu Watanabe 793ab3e9dd sd-device: make device_get_properties_{nulstr,strv}() take NULL for result value
In most cases, it is not necessary to call them without retrieving
result. But, most of other getter functions for sd-device can take NULL.
Let's follow the way for consistency.
2022-07-09 04:14:44 +09:00
Yu Watanabe cff31876da sd-device: change type of properties nulstr from uint8_t* to char* 2022-07-09 04:12:42 +09:00
Daan De Meyer 977ad21b5b journal: Make sd_journal_previous/next() return 0 at HEAD/TAIL
Currently, both these functions don't return 0 if we're at HEAD/TAIL
and move in the corresponding direction. Let's fix that.

Replaces #23480
2022-07-05 22:13:40 +02:00
Lennart Poettering a87af99ef1 Merge pull request #23855 from keszybz/drop-list-is-empty
basic/list: drop LIST_IS_EMPTY
2022-07-05 17:29:53 +02:00
Lennart Poettering ff25d3385d tree-wide: add global ascii_isdigit() + ascii_isalpha()
We now have a local implementation in string-util-fundamental.c, but
it's useful at a lot of other places, hence let's give it a more
expressive name and share it across the tree.

Follow-up for: 8d9156660d
2022-07-05 14:25:07 +02:00
Lennart Poettering 82c3a0b74c sd-id128: don't allow chars > f in valid id128 values 2022-07-05 14:23:11 +02:00
Zbigniew Jędrzejewski-Szmek 7b3b2e5ad6 Merge pull request #23865 from keszybz/drop-memcpy-call
sd-id128: avoid an unnecessary function call in inline helper
2022-07-02 16:59:32 +02:00
Zbigniew Jędrzejewski-Szmek ed828563a5 sd-event: rename field to indicate that it's a list 2022-07-02 12:46:19 +02:00
Zbigniew Jędrzejewski-Szmek 0601b95877 sd-event: rename field to indicate that it's a list 2022-07-02 12:46:19 +02:00
Zbigniew Jędrzejewski-Szmek 3f3548f8d2 sd-event: align table 2022-07-02 12:46:19 +02:00
Zbigniew Jędrzejewski-Szmek 64903d18df basic/list: drop LIST_IS_EMPTY
This was a trivial wrapper that didn't provide any added value. With more
complicated structures like strvs, hashmaps, sets, and arrays, it is possible
to have an empty container. But in case of a list, the list is empty only when
the head is missing.

Also, we generally want the positive condition, so we replace many
if (!LIST_IS_EMPTY(x)) with just if (x).
2022-07-02 12:46:16 +02:00
Zbigniew Jędrzejewski-Szmek 55ce4e1bcb sd-journal: silence bogus gcc warning
In function 'sd_id128_equal',
    inlined from 'journal_file_verify' at ../src/libsystemd/sd-journal/journal-verify.c:1047:29:
../src/systemd/sd-id128.h:119:43: error: 'entry_boot_id.qwords[0]' may be used uninitialized [-Werror=maybe-uninitialized]
  119 |         return a.qwords[0] == b.qwords[0] && a.qwords[1] == b.qwords[1];
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/libsystemd/sd-journal/journal-verify.c: In function 'journal_file_verify':
../src/libsystemd/sd-journal/journal-verify.c:823:20: note: 'entry_boot_id.qwords[0]' was declared here
  823 |         sd_id128_t entry_boot_id;
      |                    ^~~~~~~~~~~~~
cc1: all warnings being treated as errors

entry_boot_id is only used when entry_monotonic_set has been set, and that's
only done in one place where entry_boot_id is also initalized.
2022-07-01 13:42:46 +02:00
Zbigniew Jędrzejewski-Szmek 28e7e9347d basic/socket-util: rename fd_inc_rcvbuf → fd_increase_rxbuf
See previous commit for justification.
2022-06-30 11:02:13 +02:00
Zbigniew Jędrzejewski-Szmek 78cca583fe sd-netlink: rename sd_netlink_inc_rcvbuf → sd_netlink_increase_rxbuf
We have RxBufferSize= and TxBufferSize= in .link files. Let's use the same
abbreviation here. OTOH, "inc" could be short for "increment" or "increase",
let's avoid that.
2022-06-30 11:02:13 +02:00
Zbigniew Jędrzejewski-Szmek 2c4ccaefc2 sd-bus: indentation 2022-06-30 11:02:13 +02:00