Commit Graph
5720 Commits
Author SHA1 Message Date
Yu Watanabe 5bd37b352c network/state-file: coding style fixlet
Follow-up for 168ad243cc.
2025-07-23 22:24:19 +09:00
Yu Watanabe 5489a9c409 network/state-file: ignore any errors in sd_dhcp6_lease_get_dnr()
Follow-up for 168ad243cc.

For consistency with other places.
2025-07-23 22:24:19 +09:00
Yu Watanabe 2924a6c927 network/json: ignore -ENODATA and any failures from sd_dhcp_lease_get_sip()
Addresses https://github.com/systemd/systemd/pull/38269#discussion_r2225375899.

Follow-up for 238c427aa9.
2025-07-23 22:24:19 +09:00
Mike Yuan a6da6c9050 networkctl-config-file: validate args are valid filenames
... as opposed to full paths

Fixes #38288
2025-07-23 22:11:42 +09:00
Zbigniew Jędrzejewski-Szmek dcccbe049c tree-wide: several fixlets for log message and comment (#38263) 2025-07-23 10:17:33 +02:00
haxibami 238c427aa9 network/dhcp6: add SIP server support 2025-07-22 17:05:13 +09:00
Yu Watanabe 7f6086d530 tree-wide: do not use %m with SYNTHETIC_ERRNO() 2025-07-22 03:05:54 +09:00
Yu Watanabe 5918ba9c69 tree-wide: fix log messages: "Failed VERB" -> "Failed to VERB" 2025-07-22 03:05:33 +09:00
Linus Heckemann 94e5d8b0e0 netdev-util: allow finding addresses from dhcp-pd 2025-07-16 16:17:19 +02:00
Linus Heckemann 4d6c0a55e1 netdev-util: don't repeat AF check for each address type 2025-07-14 13:56:28 +02:00
DaanDeMeyer f4df5902d8 bpf: Use hyphens in directory names instead of underscores 2025-07-13 12:45:37 +02:00
DaanDeMeyer 47f761fda6 basic: Use hyphens in missing header names instead of underscores 2025-07-13 12:41:14 +02:00
Yu Watanabe 52d6032b4a network/radv: allow to send Router Advertisement from e.g. Tun interface
Sending router advertisement requires an IPv6LL address and
IFF_MULTICAST flag. The length of the hardware address is irrelevant.

Closes #38170.
2025-07-11 20:53:04 +09:00
Yu Watanabe 291b6feedd network: split link_may_have_ipv6ll() into two
This renames and splits link_may_have_ipv6ll() into
link_ipv6ll_enabled_harder() and link_multicast_enabled(),
as they are completely irrelevant to each other.

Also, this makes link_ipv6ll_enabled_harder() work non-Wireguard
interfaces.
2025-07-11 20:53:04 +09:00
Yu Watanabe 78738adf88 network/bridge-vlan: allow to configure bridge vlan on stacked bridge master interface
Fixes #38157.
2025-07-11 08:59:28 +02:00
Daan De Meyer b0ea79c5b5 network: Add varlink socket unit 2025-07-03 11:22:34 +02:00
Yu Watanabe 4f18ff2e29 tree-wide: include unistd.h where necessary
We use symbols provided by unistd.h without including it. E.g.
open(), close(), read(), write(), access(), symlink(), unlink(), rmdir(),
fsync(), syncfs(), lseek(), ftruncate(), fchown(), dup2(), pipe2(),
getuid(), getgid(), gettid(), getppid(), pipe2(), execv(), _exit(),
environ, STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO, F_OK, and their
friends and variants, so on.

Currently, unistd.h is indirectly included mainly in the following two paths:
- through missing_syscall.h, which is planned to covert to .c file.
- through signal.h -> bits/sigstksz.h, which is new since glibc-2.34.
  Note, signal.h is included by sd-eevent.h. So, many source files
  indirectly include unistd.h if newer glibc is used.

Currently, our baseline on glibc is 2.31. We need to support glibc older
than 2.34, but unfortunately, we do not have any CI environments with
such old glibc. CIFuzz uses glibc-2.31, but it builds only fuzzers, and
many files are even not compiled.
2025-06-30 09:19:15 +02:00
Zbigniew Jędrzejewski-Szmek 7d247d3cb8 meson: drop explicit custom_target names
[1] says:
> Since 0.60.0 the name argument is optional and defaults to the basename of
> the first output
We specify >= 0.62 as the supported version, so drop the duplicate name in all cases
where it is the same as outputs[0], i.e. almost all cases.

[1] https://mesonbuild.com/Reference-manual_functions.html#custom_target
2025-06-28 17:14:50 +02:00
Lennart Poettering 5584632f40 cpu-set-util: fix null pointer dereference and several cleanups (#37900)
Fixes CID#1611618.
2025-06-27 14:59:25 +02:00
Lennart Poettering 51cc3825d1 tree-wide: use sd_bus_message_send() instead of sd_bus_send() wherever possible
Also, add a coccinelle script that patches this automatically.
2025-06-24 23:23:40 +09:00
Yu Watanabe 4ae1589249 tree-wide: reindent arguments of conf parsers
Also fixes 'const char* unit' -> 'const char *unit'.
2025-06-24 00:20:20 +09:00
Yu Watanabe 4c4fe8cd71 network/dhcp6: consider the DHCPv6 protocol as finished when conflict addresses exist
Replaces #37891.
2025-06-23 19:01:39 +09:00
Yu Watanabe 03f0658460 network/dhcp6: refactoring for verify_dhcp6_address()
No functional change. Preparation for later changes.
2025-06-23 19:00:33 +09:00
Yu Watanabe f0a05209f9 network: also include information about LLDP sender in reply for Describe() method
Addresses https://github.com/systemd/systemd/pull/37845#issuecomment-2973257825.
2025-06-18 01:51:19 +09:00
Yu Watanabe 2da3957b63 network/lldp-tx: also emit VLAN ID 2025-06-18 00:53:24 +09:00
Lennart Poettering f2a365b982 network/dhcp-server: improvements for saving/loading leases (#37835) 2025-06-17 14:31:22 +02:00
Yu Watanabe fe94aa316d network/tunnel: make sit and ipip tunnel support Mode= setting
Closing #37377.
2025-06-16 17:01:20 +09:00
Yu Watanabe 8424a70caf network/tunnel: rename Ip6TnlMode to TunnelMode
This also makes ip6tnl can be created without specifying Mode= setting,
as the kernel accepts new-link netlink message without the
IFLA_IPTUN_PROTO attribute.

No effective functional change, just refactoring and preparation for
later change.
2025-06-16 16:58:38 +09:00
Yu Watanabe a145343b90 network/dhcp-server: save and load leases in runtime directory when PersistLeases=runtime
With 9ccc369ff3, PersistLeases= is
disabled on the host side virtual interfaces for containers.

However, even it is not necessary to save the leases for containers
on a persistent storage, still we should save them on somewhere.
Otherwise, leases will be lost when networkd on the host is restarted
or the host side interface is reconfigured.

This introduce PersistLeases=runtime to save and load leases on runtime
storage.
2025-06-14 03:41:20 +09:00
Yu Watanabe 2c154c54e1 network: use dns_name_hash_ops_free to manage domains 2025-06-14 00:17:14 +09:00
Yu Watanabe 6ffc16dfd9 network: use the same hash ops used when allocated
Fixes #37830.
2025-06-13 23:46:29 +09:00
Ryan Blue 13ce5d4632 network/can: properly handle CAN.RestartSec=0
Previously, 0 was ignored and restart-ms wouldn't get added to the
netlink message. Instead, set the attribute unconditionally.
2025-06-13 23:37:36 +09:00
Yu Watanabe 1f87275736 network/dhcp4: release previously acquired DHCP lease when BOOTP will be enabled 2025-06-13 14:15:04 +09:00
Colin FosterandAvram Dorfman 0dbb5139a7 network/dhcp4: add ability to use BOOTP
Add the following network option to enable BOOTP:

[DHCPv4]
Bootp=yes

This will allow a two message request / reply sequence that doesn't
require DHCP message types.

Co-authored-by: Avram Dorfman <dorfman@est.org>
2025-06-13 14:15:04 +09:00
Yu Watanabe 78f8d5ed71 network: also check ID_NET_MANAGED_BY property on reconfigure
Previously, the property was checked only when an uevent is received,
so even if an interface has ID_NET_MANAGED_BY property, the interface
will be configured by networkd when reconfiguration is triggered e.g.
when interface state is changed.

Follow-up for ba87a61d05.
Fixes #36997.
2025-06-12 14:24:50 +09:00
Yu Watanabe 050d6599ed network: use up_or_down() at several more places 2025-06-11 17:16:08 +01:00
Lennart Poettering 113006a1f3 tree-wide: basename -> path_extract_filename (#34906) 2025-06-06 15:53:28 +02:00
Yu Watanabe f2a8cc943d sd-lldp-rx: add VLAN ID parsing (#37725)
While the `port_vlan_id` field was already present in the
`sd_lldp_neighbor`, it wasn't currently parsed from the LLDP packet.
Added support for that as well as a small parsing test.

Closes #28354.
2025-06-06 19:12:48 +09:00
A. Wilcox 6b783209a8 tree-wide: basename -> path_extract_filename 2025-06-06 19:06:48 +09:00
Lorenzo Arena 496b21ab8e sd-lldp-rx: add VLAN ID parsing
Closes #28354.
2025-06-06 09:35:11 +02:00
Yu Watanabe b24e4f34cc network: skip loading /etc/shadow
We only require UID/GID, hence not necessary to load information from shadow.
2025-06-04 21:50:12 +09:00
Alexandjinyaoguo 1a596054a0 network: fix a potential divide-by-zero (#37705)
In function `tc_init`, hz is parsed from the content of file
`"/proc/net/psched"` and can be 0.
In function `hierarchy_token_bucket_class_verify`, hz is directly used
as a divisor in
`htb->buffer = htb->rate / hz + htb->mtu;` without any check. This adds a check on hz before using it as a divisor.

Co-authored-by: jinyaoguo <guo846@purdue.edu>
2025-06-03 07:47:49 +09:00
Zbigniew Jędrzejewski-Szmek 42ba99748d various: do not include file names directly in error messages
git grep -l 'Failed to open /'|xargs sed -r -i 's|"Failed to open (/[^ ]+): %m"|"Failed to open %s: %m", "\1"|g'
git grep -l $'Failed to open \'/'|xargs sed -r -i $'s|"Failed to open \'(/[^ ]+)\': %m"|"Failed to open %s: %m", "\\1"|g'
git grep -l "Failed to open /"|xargs sed -r -i $'s|"Failed to open (/[^ ]+), ignoring: %m"|"Failed to open %s, ignoring: %m", "\\1"|g'
+ some manual fixups.
2025-06-02 11:10:38 +02:00
Yu Watanabe 7dde00ca57 network/link: update state file when master ifindex is changed
If master ifindex is non-zero, then the carrier state and operational
state of the interface may be the enslaved state.
As the operational state is saved in link state file, and read by
wait-online, we need to update the state file when the master ifindex is
changed.
2025-05-28 04:38:56 +09:00
Yu Watanabe f44b20b7b6 network/link: ENODATA from reading IFLA_MASTER when an interface has no master
When an interface leaved from the master interface, then reading
IFLA_MASTER attribute causes ENODATA. When the interface was previously
enslaved to another interface, we need to remove reference to the
interface from the previous master interface.

This is especially important when
```
ip link set dev eth0 nomaster
```
is called.

Fixes a bug introduced by 0d411b7f8f (v249).
Fixes #37629.
2025-05-28 04:38:56 +09:00
Daan De Meyer 0ee78fc96e tree-wide: Clean up more includes 2025-05-26 11:16:40 +02:00
Daan De Meyer 1e35e81b2c tree-wide: Clean up includes
Preparation for cleaning up includes in src/shared.
2025-05-22 21:10:15 +02:00
Daan De Meyer baa3fadfb7 network: Clean up includes
Split out of #37344.
2025-05-22 02:15:43 +09:00
Daan De Meyer 9f74f56f36 test-tables: Pass enum type to test_table() as well
clang-include-cleaner has a hard time figuring out unused includes
with all the macro string concatentation we're doing in test_table().
Let's help it out a little by also passing the enum type into test_table().

While technically not needed, this makes the tests a bit more self-descriptive
and not really much more verbose so it feels like a good chance regardless,
even if the primary purpose is to help clang-include-cleaner figure out
used and unused includes.
2025-05-21 13:24:42 +02:00
Daan De Meyer 6196e414a5 tree-wide: Ensure source file names are unique
Let's ensure all of our source file names are unique without having
to take the directory into account.

This allows us to create meson targets or unit tests identified by the
the name of the source file they operate on without having to include
the full path of the source file in the target or test name to avoid
conflicts.
2025-05-20 10:29:59 +02:00