summaryrefslogtreecommitdiff
path: root/src/network
Commit message (Collapse)AuthorAgeFilesLines
...
* network: drop unnecessary prototypeYu Watanabe2022-11-221-1/+0
| | | | Follow-up for a39a9ac8065c29330207838b70fe388bde2bc254.
* network: tc-cake: add support to specify ACK filterYu Watanabe2022-11-193-0/+78
|
* network: tc-cake: add support to specify RTTYu Watanabe2022-11-173-1/+67
|
* Merge pull request #25291 from keszybz/util-cleanupYu Watanabe2022-11-0917-10/+11
|\ | | | | Split/rename util.c+h and def.h
| * Rename def.h to constants.hZbigniew Jędrzejewski-Szmek2022-11-082-2/+2
| | | | | | | | | | | | The name "def.h" originates from before the rule of "no needless abbreviations" was established. Let's rename the file to clarify that it contains a collection of various semi-related constants.
| * basic: rename util.h to logarithm.hZbigniew Jędrzejewski-Szmek2022-11-0812-8/+5
| | | | | | | | | | util.h is now about logarithms only, so we can rename it. Many files included util.h for no apparent reason… Those includes are dropped.
| * basic: move version() to build.h+cZbigniew Jędrzejewski-Szmek2022-11-083-0/+3
| |
| * basic: create new basic/initrd-util.[ch] for initrd-related functionsZbigniew Jędrzejewski-Szmek2022-11-081-0/+1
| | | | | | | | | | | | | | | | | | I changed imports of util.h to initrd-util.h, or added an import of initrd-util.h, to keep compilation working. It turns out that many files didn't import util.h directly. When viewing the patch, don't be confused by git rename detection logic: a new .c file is added and two functions moved into it.
* | networkd-ipv4acd.c: Use net/if.h for getting IFF_LOOPBACK definitionKhem Raj2022-11-091-1/+2
|/ | | | | | | This helps in avoiding compiling errors on musl. Definition of IFF_LOOPBACK is the reason for including linux/if_arp.h, this however could be obtained from net/if.h glibc header equally and makes it portable as well.
* Merge pull request #25192 from yuwata/wait-online-altnameLuca Boccassi2022-11-014-19/+114
|\ | | | | wait-online: support alternative interface names
| * network: update commentYu Watanabe2022-11-011-1/+1
| |
| * wait-online: support alternative namesYu Watanabe2022-11-013-4/+68
| |
| * wait-online: check received interface nameYu Watanabe2022-11-011-0/+13
| |
| * wait-online: split out link_update_name()Yu Watanabe2022-11-011-14/+30
| | | | | | | | | | No functional changes, just refactoring and preparation for later commits.
| * wait-online: ignore one more error in callback functionYu Watanabe2022-11-011-3/+5
| |
* | network: forcibly reconfigure all interfaces after sleepYu Watanabe2022-11-012-65/+11
|/ | | | | | | Previously, interfaces are partially reconfigured in a spurious way. Let's use the same way as `networkctl reconfigure`. Hopefully fixes #14987 and #24997.
* Merge pull request #25143 from yuwata/network-reconfigure-interface-when-renamedLuca Boccassi2022-10-312-46/+84
|\ | | | | network: reconfigure interface when renamed
| * network: try to reconfigure when some information is updatedYu Watanabe2022-10-311-25/+36
| | | | | | | | | | | | | | | | When at least one of the name, MAC address, udev properties, and so on for an interface is updated, try to find a matching .network file, and reconfigure if a new .network file is assigned. Fixes #24975.
| * network: simplify the logic of reading driver and permanent HW addressYu Watanabe2022-10-312-11/+41
| | | | | | | | | | | | | | | | No functional changes, just refactoring and preparation for later commits. Note, `link->dev` should always exist when link state is initialized or later.
| * network: allow to (automatically) reconfigure failed interfaceYu Watanabe2022-10-281-1/+1
| | | | | | | | | | | | | | | | We have already allowed to reconfigure failed interface manually, but not allowed to do automatically, e.g. on carrier gain. This makes that failed interfaces also reconfigured automatically. Note, the condition is inversed to shorten the condition.
| * network: drop redundant conditionYu Watanabe2022-10-281-9/+6
| | | | | | | | | | The function `link_reconfigure_impl()` has the same condition at the beginning.
* | network: skip to reassign master ifindex if already setYu Watanabe2022-10-311-0/+8
| | | | | | | | | | | | | | Otherwise, the slave interface may go down, especially when the master is bond. Fixes #25067.
* | Merge pull request #25142 from ↵Luca Boccassi2022-10-313-0/+20
|\ \ | | | | | | | | | | | | yuwata/network-fix-race-in-device-renaming-vs-dhcp network,dhcp: fix theoretical race in device renaming
| * | network: attach device to DHCP clientsYu Watanabe2022-10-263-0/+20
| | | | | | | | | | | | The attached sd_device object will be used later.
* | | Merge pull request #25166 from yuwata/network-router-preferenceLuca Boccassi2022-10-316-17/+103
|\ \ \ | | | | | | | | network: adjust route metric based on router preference
| * | | network: adjust route priority based on preferenceYu Watanabe2022-10-286-17/+103
| | |/ | |/| | | | | | | | | | | | | | | | | | | Even if different preference is specified, the kernel merges multiple routes with the same preference. This is problematic when a network has multiple routers. Fixes #25138.
* | | Merge pull request #25164 from yuwata/network-route-table-0Luca Boccassi2022-10-284-5/+6
|\ \ \ | | | | | | | | network: fix handling of route table 0
| * | | network: make RouteTable= also accept route table nameYu Watanabe2022-10-281-1/+2
| | | |
| * | | network: allow 0 for table numberYu Watanabe2022-10-281-2/+2
| | | | | | | | | | | | | | | | Fixes #25089.
| * | | network: Table= also accepts table nameYu Watanabe2022-10-282-2/+2
| |/ /
* | | network: drop duplicated period in log messageYu Watanabe2022-10-281-1/+1
|/ /
* | wait-online: ignore -ENODATA from sd_network_link_get_required_for_online()Yu Watanabe2022-10-271-6/+7
|/ | | | | | | Follow-up for 778e3da95ef16302956087e6f10ccf7d42499aec. These settings are saved only when a .network file is assigned to the interface. Let's silence noisy logs for unmanaged interfaces.
* tree-wide: replace "plural(s)" by "plurals"Zbigniew Jędrzejewski-Szmek2022-10-171-2/+2
| | | | | | | | (s) is just ugly with a vibe of DOS. In most cases just using the normal plural form is more natural and gramatically correct. There are some log_debug() statements left, and texts in foreign licenses or headers. Those are not touched on purpose.
* Merge pull request #24933 from keszybz/erradicate-strerrorLuca Boccassi2022-10-111-1/+1
|\ | | | | Erradicate strerror
| * tree-wide: drop () around the first argument of a ternary opZbigniew Jędrzejewski-Szmek2022-10-111-1/+1
| | | | | | | | https://github.com/systemd/systemd/pull/24933#discussion_r991242789
* | network: free timer event source for NDisc when link is freedYu Watanabe2022-10-071-2/+6
| | | | | | | | | | Though, it should be already freed already freed in link_stop_engines() -> ndisc_stop(). Just for safety.
* | network: drop unnecessary call of ndisc_vacuum()Yu Watanabe2022-10-073-25/+0
| | | | | | | | | | | | | | | | | | | | | | | | After the commit 773024685b37170395a11716f8e4ad99d3580455, DNS servers or domains are dropped when their lifefime become zero. Hence, it is not necessary to try to them when writing state file. Of course, because of the accuracy of the timer event source or priority of event sources, a possibility is introduced that a DNS server or domain with zero lifetime is stored in the state file. However, such entry will be dropped soon when the timer event source is triggered. Hence, that should not cause any real issues.
* | network: ndisc: do not accept too many DNS servers or domainsYu Watanabe2022-10-041-13/+16
| | | | | | | | | | If there exists multiple routers, then the previous logic may introduce too many DNS servers or domains.
* | network: ndisc: drop addresses and friends when RA with zero lifetime is ↵Yu Watanabe2022-10-043-24/+30
| | | | | | | | | | | | | | | | | | | | | | | | received Routers may send options with zero lifetime if previously announced information is outdated. Hence, if we receive such messages, then we need to drop relevant addresses or friends. See e.g. https://www.rfc-editor.org/rfc/rfc4861#section-12. Follow-up for 2ccada8dc4a3571468a335808fd6fe49b8c6c6dd.
* | network: make sec_to_usec() map 0sec -> 0usecYu Watanabe2022-10-041-4/+7
| | | | | | | | | | | | | | | | | | | | Zero lifetime in RA is special, and we should not assign possibly very short lifetime addresses or friends. This should not change anything at least now, preparation for later commits. Note, DHCPv4 and v6 code also uses it, but sd-dhcp-client and sd-dhcp6-client already filtered messages with zero lifetime. Hence, the change should not affect DHCP code.
* | network: ndisc: also introduce timer event source to drop outdated settingsYu Watanabe2022-10-044-1/+80
| | | | | | | | | | Otherwise, settings based on previously received RA messages will never removed without receiving a new RA message.
* | network: ndisc: drop outdated settings before processing RA messageYu Watanabe2022-10-041-12/+71
| | | | | | | | | | | | | | Otherwise, e.g. if a router is replaced, then the previously received settings may never dropped. Follow-up for 2ccada8dc4a3571468a335808fd6fe49b8c6c6dd.
* | network: ndisc: address_get() returns 0 on successYu Watanabe2022-10-041-1/+1
| | | | | | | | | | After the commit 3b6a3bdebfb555754fdc6ee507e3f6964de7b61c, address_get() does not return 1.
* | network: introduce {address,route}_remove_and_drop()Yu Watanabe2022-10-044-0/+29
| | | | | | | | Preparation for later commits.
* | network: ndisc: ignore prefix option with link-local prefixYu Watanabe2022-10-041-0/+8
| | | | | | | | See https://www.rfc-editor.org/rfc/rfc4861#section-4.6.2.
* | network: ndisc: read prefix earlierYu Watanabe2022-10-041-4/+6
|/ | | | No functional changes.
* network: fix use-after-freeYu Watanabe2022-10-031-0/+2
| | | | | | | | If the lifetime of the route is already expired, do not try to configure it. Fixes a use-after-free, as the Request object is already freed, thus, we cannot use Route or Link stored in Request object.
* network: don't forget old RAs when a new one arrivesThomas Hebb2022-10-039-130/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IPv6 Neighbor Discovery lets us autoconfigure a link's IPv6 addresses, routes, DNS servers, and DNS search domains by listening for Router Advertisement (RA) packets broadcast by one or more routers on the link. Each RA can contain zero or more "options," each describing one piece of configuration (e.g. a single route). Currently, when we receive an RA from a router, we delete any addresses, routes, etc. that originated from that router's previous RAs unless they're also present as options in the new RA. That behavior is a violation of RFC 4861[1]. In Section 9, the RFC states that Senders MAY send a subset of options in different packets. ... Thus, a receiver MUST NOT associate any action with the absence of an option in a particular packet. This protocol specifies that receivers should only act on the expiration of timers and on the information that is received in the packets. Several other passages in the RFC reiterate this. Section 6.2.3: A router MAY choose not to include some or all options when sending unsolicited Router Advertisements. Section 6.3.4: Hosts accept the union of all received information; the receipt of a Router Advertisement MUST NOT invalidate all information received in a previous advertisement or from another source. At least one consumer router in production today, the Google Nest Wifi, often sends RAs that omit its global IPv6 prefix. When current versions of systemd-networkd receive those RAs, they immediately delete the interface's global IPv6 address, which breaks IPv6 connectivity. Fix the issue by removing the invalidation logic entirely. It's not needed at all, since we already invalidate addresses, routes, and DNS configuration when the interface goes down or their lifetimes expire. This fix does have the side effect of preventing changes to the .network file (e.g. denylisted prefixes, whether to add routes from RAs) from taking effect as soon as a new RA arrives. Instead, a full interface reconfiguration is needed. But triggering those changes on RA receipt was already rather arbitrary and out of the administrator's control, so I think this change is fine. commit 69203fba700e ("network: ndisc: remove old addresses and routes after at least one SLAAC address becomes ready") introduced this behavior. commit 50550722e3ba fixed it partially, by preventing one router's RAs from invalidating another router's configuration. [1] https://www.rfc-editor.org/rfc/rfc4861 Fixes: 69203fba700e ("network: ndisc: remove old addresses and routes after at least one SLAAC address becomes ready")
* Merge pull request #24805 from yuwata/sd-networkLennart Poettering2022-09-272-27/+16
|\ | | | | sd-network: several cleanups
| * sd-network: drop fallback valuesYu Watanabe2022-09-271-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This drops spurious lines in `networkctl status` for unmanaged interfaces. Before: ``` $ networkctl status --lines 0 lo ● 1: lo Link File: n/a Network File: n/a Type: loopback State: carrier (unmanaged) Online state: unknown HW Address: 00:00:00:00:00:00 MTU: 65536 QDisc: noqueue IPv6 Address Generation Mode: eui64 Queue Length (Tx/Rx): 1/1 Address: 127.0.0.1 ::1 Activation Policy: up Required For Online: yes ``` After: ``` $ networkctl status --lines 0 lo ● 1: lo Link File: n/a Network File: n/a State: carrier (unmanaged) Online state: unknown Type: loopback Hardware Address: 00:00:00:00:00:00 MTU: 65536 QDisc: noqueue IPv6 Address Generation Mode: eui64 Number of Queues (Tx/Rx): 1/1 Address: 127.0.0.1 ::1 ``` That is, the lines for Activation Policy and Required For Online are dropped.