summaryrefslogtreecommitdiff
path: root/src/network
Commit message (Collapse)AuthorAgeFilesLines
* conf-parser: Add root argument to config_parse_many()Daan De Meyer2023-05-122-3/+3
|
* network/tc: rename settings in log messages tooMike Yuan2023-05-101-3/+3
| | | | Follow-up for c03ef420fa7157b8d4881636fe72596a06e08bb6
* network-generator: shorten code a bitYu Watanabe2023-04-281-25/+11
|
* Merge pull request #26944 from ↵Zbigniew Jędrzejewski-Szmek2023-04-261-12/+43
|\ | | | | | | | | aafeijoo-suse/systemd-network-generator-initrd-fix network-generator: do not parse kernel command line more than once
| * network-generator: rewrite unit if it already exists and its content changedAntonio Alvarez Feijoo2023-04-101-12/+43
| | | | | | | | | | | | | | | | | | When the `systemd-network-generator` is included in the initrd and runs from there first, the next times it runs after switching to real root it thinks there is a duplicate entry on the kernel command line. This patch rewrites the unit file if the content has changed, instead of displaying an error message.
* | tree-wide: replace __alignof__() with alignof()Yu Watanabe2023-04-141-1/+1
| | | | | | | | Addresses https://github.com/systemd/systemd/pull/27254#discussion_r1165267046.
* | src: changed usage of basename() to path_extract_filename().OMOJOLA JOSHUA DAMILOLA2023-04-041-3/+6
| | | | | | | | TODO.
* | networkctl: use sd_bus_get_propertyMike Yuan2023-04-011-11/+1
| |
* | networkctl: style improvementsMike Yuan2023-04-011-26/+28
| |
* | networkctl: use FOREACH_ARRAY moreMike Yuan2023-04-011-31/+27
| |
* | networkctl: acquire bus only when necessaryMike Yuan2023-04-011-62/+84
|/
* conf: replace config_parse_many_nulstr() with config_parse_config_file()Franck Bui2023-03-141-11/+8
| | | | | | | | | | | | | | | | | All daemons use a similar scheme to read their main config files and theirs drop-ins. The main config files are always stored in /etc/systemd directory and it's easy enough to construct the name of the drop-in directories based on the name of the main config file. Hence the new helper does that internally, which allows to reduce and simplify the args passed previously to config_parse_many_nulstr(). Besides the overall code simplification it results: 16 files changed, 87 insertions(+), 159 deletions(-) it allows to identify clearly the locations in the code where configuration files are parsed.
* network: ipv4acd: update MAC address on change (#26753)Brett Holman2023-03-141-1/+1
| | | | | Commit 76a86ffdbee2dd9ef0f2b5338e14eb6ba7671456 added function ipv4acd_update_mac() but invoked ipv4ll_update_mac(), which doesn't align with debug or commit messages.
* meson: Introduce userspace depJan Janssen2023-03-101-0/+1
| | | | This will help in a later commit to separate userspace from EFI builds.
* network: geneve: add InheritInnerProtocol flagJosef Miegl2023-03-063-0/+9
|
* Include <threads.h> if possible to get thread_local definitionCristian Rodríguez2023-03-061-0/+1
| | | | | | | | | | | | IN C23, thread_local is a reserved keyword and we shall therefore do nothing to redefine it. glibc has it defined for older standard version with the right conditions. v2 by Yu Watanabe: Move the definition to missing_threads.h like the way we define e.g. missing syscalls or missing definitions, and include it by the users. Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
* networkd: hook up SIGRTMIN+18 and memory pressureLennart Poettering2023-03-011-0/+6
|
* meson: Use dicts for fuzzer definitionsJan Janssen2023-02-211-13/+14
|
* meson: Use dicts for test definitionsJan Janssen2023-02-211-32/+35
| | | | | | | Although this slightly more verbose it makes it much easier to reason about. The code that produces the tests heavily benefits from this. Test lists are also now sorted by test name.
* tree-wide: fix typo and comment style updateYu Watanabe2023-02-151-2/+2
|
* network: dhcp-server: do not create DHCPServer object when the DHCP server ↵Yu Watanabe2023-02-011-1/+2
| | | | | | | | is running in relaying mode Follow-up for c95df5879eeb2cec8bc8eec2cfa7e741e1d9469f. Fixes #26196.
* network/dhcp4: accept local subnet routes from DHCPTuetuopay2023-01-311-8/+11
| | | | | | | | | | | | | | | RFC3442 specifies option 121 (Classless Static Routes) that allow a DHCP server to push arbitrary routes to a client. It has a Local Subnet Routes section expliciting the behavior of routes with a null (0.0.0.0) gateway. Such routes are to be installed on the interface with a Link scope, to mark them as directly available on the link without any gateway. Networkd currently drops those routes, which is against the RFC, as Linux has proper support for such routes. Fixes: 7f20627 ("network: dhcp4: ignore gateway in static routes if destination is link-local or in the same network")
* meson: Do not include headers in source listsJan Janssen2023-01-241-101/+1
| | | | | | Meson+ninja+compiler do this for us and are better at it. https://mesonbuild.com/FAQ.html#do-i-need-to-add-my-headers-to-the-sources-list-like-in-autotools
* Merge pull request #26105 from ↵Luca Boccassi2023-01-192-8/+7
|\ | | | | | | | | yuwata/network-config-parse-address-make-prefix-length-full network: make config_parse_address() assume full prefix length
| * network: assume prefix length is full address sizeYu Watanabe2023-01-192-8/+7
| | | | | | | | | | | | | | | | | | | | | | The commit 0f707207b9fc04d45ad176930cfefc77c0068545 enables strong warning about missing prefix length in Address= setting. The change was done in v241, and was about 4 years ago. Let's drop the legacy assumption and make the parser consistent with 'ip address' command. C.f. #11307. Closes #26102.
* | network: do not enter failed state when received an invalid RAYu Watanabe2023-01-191-10/+11
|/ | | | Fixes the issue reported at https://github.com/systemd/systemd/issues/25891#issuecomment-1368509262.
* send dhcpv6 release when stoppingchris2023-01-174-0/+9
|
* network: fix memleakYu Watanabe2023-01-162-2/+10
| | | | | | Fixes a bug introduced by af2aea8bb64b0dc42ecbe5549216eb567681a803. Fixes #25883 and #25891.
* network: introduce QuickAck= for [DHCPv4] and [IPv6AcceptRA]Yu Watanabe2023-01-164-0/+10
| | | | Closes #25906.
* network: Show network and link file dropins in networkctl statusDaan De Meyer2023-01-125-6/+72
| | | | Fixes #24428
* network: fix race between RTM_NEWLINK and NL82011_CMD_NEW_INTERFACEAlvin Šipraga2023-01-124-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a new wireless network interface is created by the kernel, it emits both RTM_NEWLINK and NL80211_CMD_NEW_INTERFACE. These events can arrive in either order and networkd must behave correctly in both cases. The typical case is that RTM_NEWLINK is handled first, in which case networkd creates a Link object and starts tracking it. When the NL80211_CMD_NEW_INTERFACE message is handled, networkd then populates the Link object with relevant wireless properties such as wireless interface type (managed, AP, etc.). In the event that the order is reversed however, networkd will fail to populate these wireless properties because at the time of processing the nl80211 message, the link is considered unknown. In that case, a debug message is emitted: systemd-networkd[467]: nl80211: received new_interface(7) message for link '109' we don't know about, ignoring. This is problematic because after the subsequent RTM_NEWLINK message, networkd will have an incomplete view of the link. In particular, if a .network configuration matches on some of the missing wireless properties, such as WLANInterfaceType=, then it will never match. The above race can be reproduced by using the mac80211_hwsim driver. Suppose that there exists a .network configuration: [Match] WLANInterfaceType=ap ... Now loop the creation/destruction of such an AP interface: while true do iw dev wlan0 interface add uap0 type __ap iw dev uap0 del done The above debug message from networkd will then be observed very quickly. And in that event, the .network file will fail to match. To address the above race, have the nl80211 message handler store the interface index in a set in case a Link object is not found on NL80211_CMD_NEW_INTERFACE. The handler for RTM_NEWLINK can then query this set, and explicitly request the wireless properties from nl80211 upon the creation of the Link object.
* optionally set socket priority on DHCPv4 raw socketchris2023-01-124-0/+46
|
* Merge pull request #26014 from yuwata/network-l2tp-fixesLuca Boccassi2023-01-111-5/+5
|\ | | | | network: L2TP fixlets
| * network/l2tp: parse address or address type from correct stringYu Watanabe2023-01-111-3/+3
| | | | | | | | | | | | Fixes a bug introduced by 8b49ee2dcda04f8147650f7d9fb93662caf3ea2e. Fixes #26011.
| * network/l2tp: fix error code in log messageYu Watanabe2023-01-111-2/+2
| |
* | networkd: implement Type=notify-reload protocolLennart Poettering2023-01-104-19/+46
|/
* wait-online: exit with success when all interfaces are ready or unmanagedYu Watanabe2022-12-221-57/+50
| | | | | | | | | | | | | | | | | Previously, when neither '--any' nor '--interface' options specified, at least one of the interfaces must be in configured state. This patch makes wait-online exit with success even if all interfaces are in unmanaged state. This may break backward compatibility in a rare situation. But in most cases, this typically not change anything, as at least one interface is managed by networkd.service when it is enabled. This is mostly for making wait-online gracefully handle the case that networkd.service and wait-online.service are enabled by mistake. In such situation, all interfaces are typically not managed. Fixes #25813.
* tree-wide: use -EBADF for fd initializationZbigniew Jędrzejewski-Szmek2022-12-193-6/+6
| | | | | | | | | | | | | | | | -1 was used everywhere, but -EBADF or -EBADFD started being used in various places. Let's make things consistent in the new style. Note that there are two candidates: EBADF 9 Bad file descriptor EBADFD 77 File descriptor in bad state Since we're initializating the fd, we're just assigning a value that means "no fd yet", so it's just a bad file descriptor, and the first errno fits better. If instead we had a valid file descriptor that became invalid because of some operation or state change, the other errno would fit better. In some places, initialization is dropped if unnecessary.
* network: wifi: check SSID when AP interfaces go upAlvin Šipraga2022-12-163-1/+45
| | | | | | | | | | | | | | | | | | | | When an AP goes up, the kernel may emit a netlink event indicating that the interface has gained carrier. In that event, we should check if the SSID has changed before attempting to reconfigure. Not doing so means that the link->ssid member is not updated, leading to a potential mismatch if some of the .network configurations match on SSID=. There are however scenarios where the above heuristic is not enough. Specifically, if the interface carrier state flip-flops within a short enough interval, the internal throttling of netlink events inside the kernel may suppress intermediate linkdown+linkup events (cf. Linux net/core/link_watch.c). So there is no linkup event to react on. To improve on the latter scenario, it is proposed to make newer kernels emit an NL80211_CMD_START_AP multicast event when an AP goes up. This event will not be dropped by link_watch. systemd-networkd can then react to such events as well, and optionally reconfigure the link if the SSID has changed. This will only work with newer kernels though.
* network: manage addresses in the way the kernel doesYu Watanabe2022-12-074-34/+73
| | | | | | | | | | | | | This effectively reverts 5d0030310c134a016321ad8cf0b4ede8b1800d84. With the commit 5d0030310c134a016321ad8cf0b4ede8b1800d84, networkd manages addresses with the detailed hash and compare functions. But that causes networkd cannot detect address update by the kernel or an external tool. See issue https://github.com/systemd/systemd/issues/481#issuecomment-1328132401. With this commit, networkd (again) manages addresses in the way that the kernel does. Hence, we can correctly detect address update.
* Merge pull request #25628 from zhangjian3032/dev/fix-set-bond-mac-failedYu Watanabe2022-12-072-0/+24
|\ | | | | network: Fix set bond device MAC address failed
| * network: Fix set bond device MAC address failedJian Zhang2022-12-052-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue: When device is in bond mode and booting up, there is a probability of set bond MAC address failed due to `Device or resource busy` error. In systemd-networkd, set MAC address steps are: 1. Try to set MAC address to device. 2. If failed with `Device or resource busy`, then `Down` the device. 3. Try to set MAC address to device again. Currently, Even down the bond device, the bond device is still return `Device or resource busy` error. So the MAC address set failed. The root cause is that this not enough to down the bond device. We need to down all the slaves of the bond device. About this descprition, we could use those commands to check: ```shell We have two network devices: eth0, bond1, eth0 is slave of bond1. They are all up. 1. Down bond1, and set MAC address to bond1. ~# ip link set bond1 down ~# ip link set bond1 address 00:11:22:33:44:55 ip: SIOCSIFHWADDR: Device or resource busy 2. Down eth0, and set MAC address to bond1. ~# ip link set eth0 down ~# ip link set bond1 address 00:11:22:33:44:55 Set okay. ``` Fix: When setting the mac for the second time, if the device kind is bond, then we need to down the slave devices of bond device. Tested: Verified in a long time test( reboot cycles ). Fixes: #25627 Signed-off-by: Jian Zhang <zhangjian.3032@bytedance.com>
* | network: drop REMOVING flag when a netlink message is sent to kernelYu Watanabe2022-12-061-1/+2
|/ | | | | | | | | | | | | | | | When an interface goes to down, the kernel drops several routes automatically, and at the same time networkd requests to remove them, but the kernel sometimes does not respond the requests. Hence, the routes cannot drop the REMOVING flag, and networkd will never try to configure other routes which depend on the previously removed routes even if they are already reconfigured. With this patch, when networkd sends a request to configure a route (or any other network settings), REMOVING flag for the route is dropped without waiting for the reply about the previous remove request, as we can expect it will appear even if it is already removed or under removing. Fixes #24999.
* network: unset Link.ndisc_configured only when a new address or route is ↵Yu Watanabe2022-12-011-6/+18
| | | | | | | | | | | | | | | | | requested This fixes an issue introduced by af2aea8bb64b0dc42ecbe5549216eb567681a803. When an outdated address or route is passed to link_request_address()/route(), then they return 0 and the address or route will not be assigned. Such situation can happen when we receive RA with zero lifetime. In that case, we should not unset Link.ndisc_configured flag, otherwise even no new address nor route will assigned, the interface will enter to the configuring state, and unnecessary DBus property change is emit and the state file will be updated. That makes resolved or timesyncd triggered to reconfigure the interface. Fixes #25456.
* network: address: use ASSERT_PTR()Yu Watanabe2022-11-301-15/+5
|
* network: address: always update link state when an address is removedYu Watanabe2022-11-301-7/+2
| | | | The removed address might be in the tentative state.
* network: add missing assertionYu Watanabe2022-11-301-0/+1
|
* network: drop invalid and unused flagYu Watanabe2022-11-291-1/+0
| | | | | Route.flags can only take RTNH_F_ONLINK, and other flags are silently dropped.
* network: fix indentationYu Watanabe2022-11-291-1/+1
|
* network: wifi: try to reconfigure when connectedYu Watanabe2022-11-223-1/+14
| | | | | | | | | | Sometimes, RTM_NEWLINK message with carrier is received earlier than NL80211_CMD_CONNECT. To make SSID= or other WiFi related settings in [Match] section work, let's try to reconfigure the interface. Fixes a bug introduced by 96f5f9ef9a1ba5146d3357c1548fb675d3bd5b68. Fixes #25384.