Commit Graph
100 Commits
Author SHA1 Message Date
Yu Watanabe 7a10e25a41 Merge pull request #30908 from poettering/nsid
networkd: expose netns "nsid" together with inode id
2024-01-13 06:54:32 +09:00
Yu Watanabe be89a76a46 network/ndisc: do not try to set too large value for ICMP ratelimting
Follow-up for 6197db53ba.

When we set too large value, the kernel just refuse it. So, this does
not change the net behavior.

Prompted by https://github.com/systemd/systemd/pull/30490#discussion_r1449477125.
2024-01-12 14:38:30 +00:00
Yu Watanabe 967cd1712c Merge pull request #30867 from dtardon/udev-conf-dropins
Allow dropins for udev.conf
2024-01-12 06:37:23 +09:00
Yu Watanabe fa552ea1b1 Merge pull request #30893 from yuwata/add-trailing-NUL
json,netlink: add trailing NUL byte when we read binary data
2024-01-12 06:36:46 +09:00
Yu Watanabe 70c24d0d9f sd-netlink: add trailing NUL byte for safety in sd_netlink_message_read_data()
Then, drop sd_netlink_message_read_data_suffix0().
2024-01-12 04:48:26 +09:00
Yu Watanabe 1f179b37f2 json: add trailing NUL byte in json_dispatch_byte_array_iovec()
For safety.

Addresses https://github.com/systemd/systemd/pull/30879#discussion_r1448518226.
2024-01-12 04:44:51 +09:00
Yu Watanabe 41c5937f02 Merge pull request #30887 from poettering/id128-no-legend
id128: add --no-pager, --no-legend, --json=/-j switches to systemd-id128 tool
2024-01-12 03:46:48 +09:00
Yu Watanabe bc02f03561 network: fix Name= -> OriginalName= in the default .link files
Follow-up for 658169e6d3.
2024-01-11 12:20:10 +00:00
Yu Watanabe 0705e05c3d sd-dhcp-client-id: introduce json_dispatch_client_id() 2024-01-11 17:03:25 +09:00
Yu Watanabe 72278e62d9 json: introduce json_dispatch_byte_array_iovec() and json_dispatch_in_addr() 2024-01-11 17:03:25 +09:00
Yu Watanabe cf9b425749 sd-dhcp-client-id/duid: do not trigger assertion when invalid size is passed
The data may be from user input or file. We usually use assertion for
programming error. Hence, using assert is not a good choise there.

Preparation for later commits.
2024-01-11 17:03:25 +09:00
Yu Watanabe 28815fdac4 test-resolved-dummy-server: several modernization
- use sd-event,
- use DEFINE_MAIN_FUNCTION(),
- use log_setup().
2024-01-11 02:13:32 +09:00
Yu Watanabe a068e06da6 resolve: notify DNSSEC failure, EDE code, and EDE message 2024-01-11 02:10:32 +09:00
Yu Watanabe d9f9b8ce8a resolve: make manager_monitor_send() take DnsQuery* 2024-01-11 02:10:32 +09:00
Yu Watanabe 37baa00fe0 resolve: also read EDE code and message from cached packet 2024-01-11 02:10:32 +09:00
Yu Watanabe a72cf22d06 resolve: introduce DNSSEC_UPSTREAM_FAILURE
and include EDE code and message in the error messages.

This replaces 9ca133e97a, and implements
originally suggested at
https://github.com/systemd/systemd/pull/30513#discussion_r1433823737
2024-01-11 02:10:32 +09:00
Yu Watanabe 0c61995d80 resolvectl: use JSON_ALLOW_EXTENSIONS
Follow-up for f0e4244b2f.
2024-01-11 02:10:32 +09:00
Yu Watanabe 41398e8793 resolve: several follow-ups for 9ca133e97a.
- add missing initialization for DnsQuery.answer_ede_rcode,

- clear EDE code and message in dns_transaction_reset_answer(),
  otherwise the previous EDE code or message may be mistakenly reused
  on restart. This fixes memory leak of DnsTransaction.answer_ede_msg.

- also clear EDE code and message in dns_query_reset_answer(),
  otherwise ede message is leaked if dns_query_accept() is called
  multiple times for the same DnsQuery.

Follow-up for 9ca133e97a.

Fixes #30752.
2024-01-11 02:10:11 +09:00
Yu Watanabe 9540f8e216 test-network: add test case for MACAddress=none in .netdev and MACAddressPolicy=none in .link
Prompted by #30813.
2024-01-10 12:07:23 +01:00
Yu Watanabe 9ae51762d7 resolve: drop DNS_TRANSACTION_UPSTREAM_DNSSEC_FAILURE
This partially reverts commit 9ca133e97a.

Not only there is no reason to introduce a new transaction failure state,
but also the commit introduces several severe issues.

Fixes #30776, #30779.
2024-01-10 13:14:14 +09:00
Yu Watanabe c08fd7beca resolve: several follow-ups for ac6844460c
- fix indentation,
- drop incorrect comment, dns_packet_ede_rcode() can handle unknown EDE rcode.
- 0 is a valid EDE rcode,
- DnsTransaction.answer_ede_msg may be NULL, so needs to use strempty()
  on logging,
- drop redundant ede_rcode temporary variable.

Follow-up for ac6844460c.
2024-01-10 13:13:11 +09:00
Yu Watanabe 71682ac6bb resolve: cleanup dns_packet_ede_rcode()
This makes the following:
- make dns_packet_ede_rcode() return -EINVAL when EDE code not found.
  Otherwise, the caller may be confused that the packet has an unknown
  error code.
- make the function escape EDE message only when non-utf8 message is received.
- the message handling logic is applied even if the error code is unknown, as
  there is no reason that we escape EDE message only when an known error code
  is received.
- reduce scope of variables,
- drop redundant 'else',
- append full stop to the log messages,
- drop redundant log message in the caller,
- split out error in the function and returned EDE error code.

Follow-up for ac6844460c.
2024-01-10 13:06:02 +09:00
Yu Watanabe a92ea352a5 resolve: update rcode table and align enum definitions 2024-01-10 10:23:14 +09:00
Yu Watanabe eabc38daa8 TODO: drop implemented feature 2024-01-10 04:33:55 +09:00
Yu Watanabe d26319be92 test: add test for [Link] Property= and friends 2024-01-10 04:33:55 +09:00
Yu Watanabe 046286e863 udev/net: introduce [Link] Property=, ImportProperty=, and UnsetProperty= settings
The applied order is equivalent to Environment=, PassEnvironment=, and
UnsetEnvironment= for [Service] or so.
2024-01-10 04:33:51 +09:00
Yu Watanabe 513ca8b6f0 udev: split out check that udev property can be updated 2024-01-10 04:27:41 +09:00
Yu Watanabe 3e00171dcd udev/net: split out udev property assignment logic
No functional change, just refactoring.
2024-01-10 04:27:41 +09:00
Yu Watanabe 0c3af33e19 udev/net: do not set unapplied .link file name to ID_NET_LINK_FILE
Instead, import already assigned value from the udev database.
Then, return the builtin earlier.
2024-01-10 04:27:41 +09:00
Yu Watanabe ac36406277 udev-builtin-path_id: drop redundant debugging logs
The function udev_builtin_add_property() internally logs the failure.
2024-01-10 04:27:26 +09:00
Yu Watanabe 50a0379d5d udev/builtin: introduce udev_builtin_import_property() helper function
This is not used in this commit, but will be used later commits.
2024-01-10 04:11:08 +09:00
Yu Watanabe 12b1e04073 man: fix indentation 2024-01-10 03:50:32 +09:00
Yu Watanabe 9b0688f491 virt: add Google Compute Engine support
See https://cloud.google.com/run/docs/container-contract#sandbox
2024-01-10 03:08:31 +09:00
Yu Watanabe 10b8bb5495 man: drop unexpected dot 2024-01-09 10:52:18 +09:00
Yu Watanabe 35716eed55 Merge pull request #30837 from poettering/varlink-over-ssh
varlink: add "ssh:" transport for talking to remote servers
2024-01-09 10:14:03 +09:00
Yu Watanabe e701439998 virt: fix detection of avx2 and friends
To get the CPUID with EAX=7, we need explicitly set 0 to ECX.

From Intel® Architecture Instruction Set Extensions Programming
Reference and Related Specifications,
===
Leaf 07H output depends on the initial value in ECX.
If ECX contains an invalid sub leaf index, EAX/EBX/ECX/EDX return 0
===

Fixes #30822.
2024-01-08 16:04:17 +01:00
Yu Watanabe 96f1f03c03 Merge pull request #30815 from yuwata/resolve-ixfr
resolve: NSCOUNT of DNS query may not be zero
2024-01-08 08:49:15 +09:00
Yu Watanabe ba1749f6a5 resolve: NSCOUNT of DNS query may not be zero
This also separates check for DNS and LLMNR, as the existing comments
are for LLMNR, not DNS. And this moves the comment for mDNS.

Fixes the issue reported at
https://github.com/systemd/systemd/pull/30809#issuecomment-1880102804.
2024-01-08 02:09:07 +09:00
Yu Watanabe 9aa3c07947 network/route-metric: invalidate [Route] section if an invalid string is specified
Follow-up for 18c4c5d84f.
2024-01-07 14:04:00 +09:00
Yu Watanabe 5e124de7e6 network/route-metric: use DEFINE_CONFIG_PARSE_ROUTE_METRIC() macro more 2024-01-07 14:04:00 +09:00
Yu Watanabe be6c9d562d network/route-metric: introduce DEFINE_CONFIG_PARSE_ROUTE_METRIC() macro
Then, define config_parse_route_metric_mtu() and _tcp_window() through
the macro.
2024-01-07 14:04:00 +09:00
Yu Watanabe ebf4fa1e82 network/route-metric: manage uint32_t RTAX_XYZ attributes in the same way
Except for RTAX_CC_ALGO, all RTAX_XYZ attributes take uint32_t and
the kernel's default value is zero. So, let's unify handling of the
attributes.

This should not change any effective behavior. Just refactoring.
2024-01-07 14:04:00 +09:00
Yu Watanabe d32a520b09 network/route-metric: introduce RouteMetric
Then, split out route metric handling from networkd-route.c to
networkd-route-metric.c.

No functional change, just refactoring and preparation for later
commits.
2024-01-07 14:04:00 +09:00
Yu Watanabe 0417d1d0e8 Merge pull request #30803 from yuwata/network-route-parser-trivial-cleanups
network/route: trivial cleanups for conf parsers
2024-01-07 05:26:06 +09:00
Yu Watanabe 74e95e3a81 network/link: always join to the main interface when we receive IFLA_MASTER attribute
Otherwise, e.g. when we enumerate a bridge port first, then the bridge
main interface, then the port cannot be managed by the main interface.

Fixes #30682.
2024-01-07 05:25:55 +09:00
Yu Watanabe 5c64017aa8 network/route-metric: unify error messages 2024-01-07 01:39:58 +09:00
Yu Watanabe e2126e235e network/route-metric: pass attribute type to conf parsers
The passed attribute type will be used later.

This also
- rename conf parsers,
- sort gperf entries by the attr type.

No functional change, just refactoring and preparation for later commits.
2024-01-07 01:39:58 +09:00
Yu Watanabe df8767fc8d network/route: move several conf parsers to networkd-route-metric.c and networkd-route-nexthop.c
This also split config_parse_route_boolean() into two:
for GatewayOnline= and boolean route metrics.

No functional change, just refactoring and preparation for later commits.
2024-01-07 01:39:58 +09:00
Yu Watanabe f48e52bda8 network/route: rename n -> route in conf parsers 2024-01-07 01:39:58 +09:00
Yu Watanabe d2bec2426f network/route: do not invalidate [Route] section when an empty string is assigned to MultiPathRoute= 2024-01-07 01:39:58 +09:00
Yu Watanabe 6b07675d81 test-network: do not call networkctl if networkd is in failed state
Otherwise, networkd may be restarted by DBus and we may get wrong
results.
2024-01-06 14:48:18 +09:00
Yu Watanabe 10d670a3c1 test-network: introduce networkctl() and friends 2024-01-06 14:48:15 +09:00
Yu Watanabe 032fd10de8 test-network: use read_networkd_log() at one more place 2024-01-06 12:46:00 +09:00
Yu Watanabe bd581438a1 test-network: sync journal before read
Otherwise, test cases that check journal entries, e.g. test_unit_file()
may fail.
2024-01-06 12:45:59 +09:00
Yu Watanabe b82b4d258e Merge pull request #30794 from poettering/parse-vsock-better
socket-util: add more careful parsers for AF_VSOCK cid/port
2024-01-06 11:16:19 +09:00
Yu Watanabe 7ba3e44651 udevadm: allow to override the default log level by environment variable
Previously, there was no way to override the log level for test and
test-builtin commands. Let's re-parse environment after setting the log
level to debug. Then, we can control the log level through environment
variable.
2024-01-06 08:30:58 +09:00
Yu Watanabe 976309db6a Merge pull request #30796 from mrc0mmand/journalctl-namespaces
journalctl: provide shell completion for --namespace=
2024-01-06 08:30:31 +09:00
Yu Watanabe 0d1706b5fa Merge pull request #30775 from yuwata/network-nexthop-is-ready
network: introduce nexthop_is_ready() helper function and use it
2024-01-06 08:27:35 +09:00
Yu Watanabe 92a39246ad Merge pull request #30790 from poettering/null-creds-allow-with-tpm
creds: allow using NULL encryption if explicitly requested even if TPM is available, and add a comprehensive credential encryption/decrpytion test
2024-01-06 04:26:38 +09:00
Yu Watanabe ff4240fc22 test: wait for verbose-success.service finished
Otherwise, the command 'echo' may not be invoked yet.

Follow-up for 25aa35d465.
2024-01-05 13:08:10 +01:00
Yu Watanabe 2ec0e95eb7 test-network: add test for removal of nexthops that we do not receive reply from the kernel 2024-01-05 19:18:58 +09:00
Yu Watanabe 9a988d16fb network/nexthop: also remove nexthop on cancelling request
Otherwise, the nexthop may arrive after we call
link_drop_foreign_address() or so on reconfiguring interface.
2024-01-05 19:17:59 +09:00
Yu Watanabe c902fa08c3 network/neighbor: also remove neighbor on cancelling request
Otherwise, the neighbor may arrive after we call
link_drop_foreign_address() or so on reconfiguring interface.
2024-01-05 19:17:59 +09:00
Yu Watanabe 4303e9806b network/address: also remove address on cancelling request
Otherwise, the address may arrive after we call
link_drop_foreign_address() or so on reconfiguring interface.
2024-01-05 19:17:59 +09:00
Yu Watanabe 115a09004e test: fix typo
Follow-up for 995bf013a1.
2024-01-05 19:08:12 +09:00
Yu Watanabe c270e41f5e man: fix typo
Follow-up for 7d93e4af80.
2024-01-05 19:08:12 +09:00
Yu Watanabe 20a0aeb039 vpick: fix typo
Follow-up for 76511c1bd3.
2024-01-05 19:08:12 +09:00
Yu Watanabe d61df11fcd login: noone -> no one
Follow-up for 59afe07c21.
2024-01-05 19:08:12 +09:00
Yu Watanabe e75c24c450 core/dbus-manager: fix typo
Follow-up for 84c01612de.
2024-01-05 19:08:12 +09:00
Yu Watanabe 9e44842a9a string-util: fix typo
Follow-up for 63566c6b6f.
2024-01-05 19:08:12 +09:00
Yu Watanabe 56a89426f6 TODO: fix typo
Follow-up for 97c493f214.
2024-01-05 19:08:12 +09:00
Yu Watanabe 2743854540 network: do not make the implied default have the first priority
Follow-up for b732606950 and
6706ce2fd2.

If Network.ignore_carrier_loss_set flag is set, then the timeout value
is always used, hence the logic implemented by
b732606950 never worked.
2024-01-05 18:04:18 +09:00
Yu Watanabe b87ffa9b5a network/route: use nexthop_is_ready() 2024-01-05 05:33:49 +09:00
Yu Watanabe ccc55b5ec5 network/nexthop: wait for requests for group members being processed
This also split out the check as nexthop_is_ready().
2024-01-05 05:33:49 +09:00
Yu Watanabe 338fb16ad5 network/nexthop: refuse id == 0 earlier
All requested nexthop has a non-zero ID.
2024-01-05 05:33:49 +09:00
Yu Watanabe 78265b5b4a test-network: add test case about replacing nexthop 2024-01-05 04:00:16 +09:00
Yu Watanabe 9362f7d5b5 test-network: merge three tests for neighbor
To speed up tests.
2024-01-05 04:00:16 +09:00
Yu Watanabe dc60ac2960 test-network: show monotonic timestamp and drop hopstname from logs 2024-01-05 04:00:16 +09:00
Yu Watanabe 4f6b801b0d network/queue: stop processing requests when a new request is queued
Otherwise, the loop triggers assertion:
```
Assertion 'e->p.b.key == i->next_key' failed at src/basic/hashmap.c:614, function hashmap_iterate_in_insertion_order(). Aborting.
```
2024-01-05 01:37:42 +09:00
Yu Watanabe 981278e144 network/queue: do not check if a request is ready multiple times in a single event
Some checks are slightly heavy, and there may be huge number of
interfaces. So, prcessing whole queue multiple times in a single event
may decrease the performance. Let's process the queued requests once per
event.
2024-01-05 01:37:42 +09:00
Yu Watanabe 4855d82348 Merge pull request #30739 from poettering/pam-util-many
pam-util: add pam_get_item_many() to shorten some code
2024-01-04 23:28:34 +09:00
Yu Watanabe 7903567cb7 Merge pull request #30610 from YHNdnzj/logind-serialize-pidref
logind: serialize session leader pidfd to fdstore
2024-01-04 23:25:18 +09:00
Yu Watanabe 18c4c5d84f network/route: make the route section invalid when an invalid MTUBytes= is specified
We usually set the invalid flag for a section if a setting in the section has
an invalid value. Let's also do the same thing for MTUBytes= in [Route].
2024-01-04 23:18:28 +09:00
Yu Watanabe f475584ebf network/netdev: call done() per netdev kind before freeing netdev name or so
Otherwise, log_netdev_xyz() does not provide netdev name if it is called
in done(). It is hard to debug.

This should not change any effective behavior, at least with the current
implementation of done() per netdev kind.
2024-01-04 20:34:14 +08:00
Yu Watanabe 82a1597778 Merge pull request #28797 from Werkov/eff_limits
Add MemoryMaxEffective=, MemoryHighEffective= and TasksMaxEff…  …ective= properties
2024-01-04 05:38:06 +09:00
Yu Watanabe f3f6c65618 Merge pull request #30710 from YHNdnzj/logind-ret-gather
logind-session: modernization
2024-01-04 05:25:41 +09:00
Yu Watanabe 124c712692 Merge pull request #30532 from yuwata/udev-extend-timeout-kill-worker
udev: extend timeout to prevent kill worker
2024-01-04 05:21:50 +09:00
Yu Watanabe ea7a35ed68 sd-dhcp-server: do not forget previously assigned addresses on pool change
Currently, networkd does not change pool size dynamically, so this
should not change behavior. But if networkd does that, then forgetting
leases causes that an address still used by a client may be assigned to
another host.
2024-01-04 05:10:47 +09:00
Yu Watanabe 0596f5939f sd-dhcp-server: check address conflict more carefully
- Even if we found a matching static lease, check if there is no
  conflicting lease.
- Accept an address request that is different from the previous one.
- Also return NAK if the server address is requested.
2024-01-04 05:10:47 +09:00
Yu Watanabe cb0ba4b41b sd-dhcp-server: verify address of static lease before use 2024-01-04 05:10:47 +09:00
Yu Watanabe 59ac53a690 network/nexthop: introduce ref/unref functions for NextHop object 2024-01-04 04:58:36 +09:00
Yu Watanabe 2a75f23b0d network/neighbor: introduce ref/unref function for Neighbor object 2024-01-04 04:58:36 +09:00
Yu Watanabe ebd9690647 network/address: introduce ref/unref functions for Address object
Then, Address object can live if it is detached from the owner (Link or
Network object).
2024-01-04 04:58:36 +09:00
Yu Watanabe b46d1694c4 conf-parser: expose config_section_{hash,compare}_func()
They will be used in later commits.
2024-01-04 04:58:36 +09:00
Yu Watanabe aea57b1415 Merge pull request #28836 from msekletar/aux-scope
core/manager: add dbus API to create auxiliary scope from running service
2024-01-04 04:52:39 +09:00
Yu Watanabe 04d4086c22 resolve/mdns: do not append goodby packet entries to known answers section
When we receive a goodby packet about a host, and we have a cache entry about
the host, we do not immediately remove the cache entry, but update it with TTL 1.
See RFC 6762 section 10.1 and 3755027c2c.

If we receive a request soon after the goodby packet, previously the
entry was included in the known answers section of the reply. But such
information should not be appended.

Follow-up for 3755027c2c.
2024-01-03 13:16:43 +01:00
Yu Watanabe dd8ab4a206 sd-dhcp-server: rename DHCPLease -> sd_dhcp_server_lease
Then, move basic functions for the object to sd-dhcp-server-lease.[ch].

No effective funcional changes.
2024-01-03 15:20:31 +09:00
Yu Watanabe 95c48613f4 sd-dhcp-server: use sd_dhcp_client_id 2024-01-03 15:20:31 +09:00
Yu Watanabe 12fb1fc5dd Merge pull request #30702 from yuwata/sd-dhcp-client-id
dhcp: introduce sd_dhcp_client_id and relevant functions
2024-01-03 15:10:46 +09:00
Yu Watanabe 778823fd52 backlight: supprt ID_LEDS_CLAMP udev property for leds subsystem devices
Closes #30507.
2024-01-03 09:30:41 +09:00