Commit Graph
3668 Commits
Author SHA1 Message Date
Yu Watanabe 0ebab55f4f network: dhcp4: also support semi-static routes with Gateway=_dhcp4 when UseGateway=no or UseRoutes=no
This makes the default gateway is read from classless static routes or
router option even if UseGateway=no or UseRoutes=no, and will be used
when configuring semi-static routes such that specified with Gateway=_dhcp4.

This also changes the behavior of RoutesToDNS= or RoutesToNTP=.
Previously, the DNS or NTP servers are not in the same network, then the
routes to the servers were not configured when UseGateway=no or
UseRoutes=no. With this commit, the default gateway in classless static
routes or router option will used to connecting the servers even if
UseGateway=no or UseRoutes=no.

Fixes #20208.
2021-07-15 04:17:09 +09:00
Yu Watanabe 77976a6877 network: further unification of MUD url parsers
Follow-up for 89fa9a6b7b.
2021-07-14 17:41:00 +01:00
Yu Watanabe e18f21e349 Merge pull request #20109 from keszybz/timestamp-macros
Add macros that define scratch buffer internally for timestamp/timespan formatting
2021-07-14 16:14:08 +09:00
Yu Watanabe 54d1fdb244 network: update interface name stored in various network engines 2021-07-14 00:40:47 +01:00
Yu Watanabe 176b8be10f network: check the received interface name is actually new
For some reasons I do not know, on interface renaming, kernel once send
netlink message with old interface name, and then send with new name.
If eth0 is renamed, and then new interface appears as eth0, then the
message with the old name 'eth0' makes the interface enters failed
state.

To ignore such invalid(?) rename event messages, let's confirm the
received interface name.

Fixes #20203.
2021-07-13 19:20:31 +09:00
Yu Watanabe 11046cea14 network: also check addresses when determine a gateway address is reachable or not
Fixes #20201.
2021-07-12 16:35:48 +09:00
Zbigniew Jędrzejewski-Szmek 89fa9a6b7b networkd: add shared parser for mud urls
The same buggy code was triplicated…
2021-07-09 15:13:12 +02:00
Zbigniew Jędrzejewski-Szmek e437538f35 tree-wide: make cunescape*() functions return ssize_t
Strictly speaking, we are returning the size of a memory chunk of
arbitrary size, so ssize_t is more appropriate than int.
2021-07-09 15:07:40 +02:00
Zbigniew Jędrzejewski-Szmek ae732f6e2d networkd: minor refactoring 2021-07-09 11:11:25 +02:00
Zbigniew Jędrzejewski-Szmek 7dc7ab311b networkd: replace one trivial asprintf with xsprintf 2021-07-09 11:11:25 +02:00
Zbigniew Jędrzejewski-Szmek 46e23f9a8d tree-wide: add FORMAT_BYTES_FULL() 2021-07-09 11:11:25 +02:00
Zbigniew Jędrzejewski-Szmek 5291f26d4a tree-wide: add FORMAT_TIMESPAN() 2021-07-09 11:03:36 +02:00
Yu Watanabe 8ca29d97f2 wait-online: fix typo 2021-07-07 11:06:11 +02:00
Yu Watanabe 899034ba81 network: fix overflow issue in address lifetime calculation
Fixes another issue reported in #20050. See
https://github.com/systemd/systemd/issues/20050#issuecomment-872967337.
2021-07-02 22:26:07 +09:00
Yu Watanabe e95ec7cd1e network: drop old dhcp6 addresses or routes after new ones are configured
Fixes the issue similar to #20050 but for DHCP6.
2021-07-02 20:59:38 +09:00
Yu Watanabe fe139e8ef9 network: drop old ndisc configurations after new ones are configured
Previously, `ndisc_remove_old_one()` checked `ndisc_{addresses,routes}_configured`
flags, but they are not unset when all addresses or routes are already
assigned.
After the request queue is implemented, the address or route requests
are not processed within the same event of ndisc handler is called, but
will processed later when they are ready. So, calling `ndisc_remove_old()`
in the event of ndisc handler will remove all addresses and routes
previously assigned even they are requested to be updated.

This makes `ndisc_remove_old()` do nothing when there exist some
requests to configure addresses and routes, thus previously assigned
addresses and routes are kept until all requests are processed.

Fixes #20050.
2021-07-02 20:59:38 +09:00
Yu Watanabe 790736e42e network: fix log message 2021-07-02 20:59:32 +09:00
Lennart Poettering 01cf6bacd9 wait-online: improve timeout log message
The time-out when waiting to reach the online state is a pretty
regularly seen error, let's print an explicit log message for it. The
previous "Event loop failed: timed out" message is a bit too low-level I
think for regular users (as event loops are a developer's concept, not a
user's, really).

Note that outputting low-level error messages is generally actually OK I
think — for unexpected errors, but this timeout is a pretty expected one,
directly configurable by the user, hence output something friendly.
2021-07-02 13:56:59 +02:00
Yu Watanabe e2bacccd06 network: fix segfault in link_update_hardware_address()
This fixes a bug introduced by fe321d457c.

When we want to update a value (in the case of this commit, it is a hardware
address) which is used as a hashmap key, we need to do the following steps:
1. remove the old hashmap entry,
2. update the value,
3. create a new hashmap entry with the new value.
2021-07-01 16:24:07 +09:00
Yu Watanabe cd3a828c62 network: ipv4acd: update log message
C.f. https://github.com/systemd/systemd/pull/19980#discussion_r661784168
2021-07-01 16:24:07 +09:00
Yu Watanabe d7ab6ef098 network: introduce callback fucntions to check the sender MAC address for IPv4ACD and IPv4LL
Fixes #12145.
2021-07-01 00:49:03 +09:00
Yu Watanabe 76a86ffdbe network: ipv4acd: first probe address and then assign it
Previously, if IPv4 ACD is enabled on an address, then we first
assign the address, and start sd-ipv4acd daemon for the address.
This is not only RFC incompliant, but also the address is always
dropped, as the daemon always considers the address is conflicted.

This commit makes networkd first starts sd-ipv4acd daemon to probe
the address, and then the address is configured if no conflict is
detected.

Fixes #17235.
2021-07-01 00:49:03 +09:00
Yu Watanabe 475ec3346f network: make request_drop() accept NULL 2021-07-01 00:49:03 +09:00
Yu Watanabe c0c04a4b22 network: acquire address on request configure rather than on configure
A preparation for later commits.
2021-07-01 00:49:03 +09:00
Yu Watanabe 9155da08ee network: rename dhcp_lease_lost() -> dhcp4_lease_lost() and expose it
A preparation for later commits.
2021-07-01 00:49:02 +09:00
Yu Watanabe d5e3b3eb8c network: address: do not send tentative flag
Currently, networkd does not set tentative flag on create, and kernel
ignore the flag on remove. So, this commit does not change any current
behaviour. This is just a preparation for later commits.
2021-07-01 00:49:02 +09:00
Yu Watanabe 8c29f484d5 network: introduce link_request_static_address() 2021-07-01 00:49:02 +09:00
Yu Watanabe 99b466693e network: introduce address_dup() and replace address_copy() with it 2021-07-01 00:49:02 +09:00
Yu Watanabe f8d6397ac2 network: ipv4ll: reset MAC address without stopping sd-ipv4ll engine 2021-07-01 00:49:02 +09:00
Yu Watanabe a1e35fca46 network: ipv4ll: refuse to configure IPv4LL address on interface where the length of the hardware address is not ETH_ALEN
Currently, sd-ipv4acd assumes hardware address is ETH_ALEN.
2021-07-01 00:49:02 +09:00
Yu Watanabe 89d8ed9932 network: ipv4ll: make link enter failed state on failure of restarting ipv4ll engine 2021-07-01 00:49:02 +09:00
Yu Watanabe fe321d457c network: introduce link_get_by_hw_addr() 2021-07-01 00:49:02 +09:00
Yu Watanabe 6eab614db8 network: rename Manager::links -> Manager::links_by_index
This also renames link_get() -> link_get_by_index().
2021-07-01 00:49:02 +09:00
Yu Watanabe 387f695526 tree-wide: "a" -> "an" 2021-06-30 23:33:00 +09:00
Yu Watanabe 3b955af56f networkctl: drop unused member in struct VxLanInfo 2021-06-26 08:39:25 +09:00
Dan Streetman 003015af5a networkctl: add field 'Required For Online' 2021-06-24 08:32:21 -04:00
Dan Streetman 7c644a6966 network: default RequiredForOnline=false if ActivactionPolicy= not set to up
If ActivationPolicy= is set to down, always-down, or manual, then any
matching link will delay boot (due to delaying network-online.target).

If RequiredForOnline= wasn't explicitly set, then default it to false
if ActivationPolicy= is down or manual. If ActivationPolicy=always-down,
then force RequiredForOnline=no.
2021-06-24 08:32:21 -04:00
Hristo Venev 2e8a32afbc networkd: Permit all-zero RoutingPolicyRule prefixes
For example this `From` address range is no longer ignored:

    [RoutingPolicyRule]
    From=0.0.0.0/8
2021-06-22 20:19:12 +09:00
Yu Watanabe 1cf4ed142d network: always enable IPv4 ACD for statically configured IPv4LL address 2021-06-16 13:19:26 +09:00
Yu Watanabe bd5146c67e network: IFA_F_NODAD flag is only for IPv6 addresses 2021-06-16 08:33:54 +09:00
Yu Watanabe 9b682672e4 network: use void* to correctly store SetLinkOperation in Request
Previously, when `link_request_queue()` is called in link_request_set_link(),
`SetLinkOperation` is casted with INT_TO_PTR(), and the value is assigned to
`void *object`. However the value was read directly through the member
`SetLinkOperation set_link_operation` of the union which `object`
beloging to. Thus, read value was always 0 on big-endian systems.

Fixes configuring link issue on s390x systems.
2021-06-15 20:58:20 +02:00
Yu Watanabe 7802194ac0 tree-wide: add missing whitespace at the end of comments 2021-06-15 14:09:29 +09:00
Yu Watanabe 9868493e17 Merge pull request #19913 from yuwata/network-fix-counter
network: add missing increment of Link::set_flags_messages
2021-06-15 10:51:24 +09:00
Yu Watanabe 2502e7befe Merge pull request #19905 from yuwata/network-set-mac-try-again
network: try to bring down interface before setting MAC address
2021-06-15 05:35:45 +09:00
Yu Watanabe 710fa1b3fb network: update wlan information when IFF_LOWER_UP flag is gained
Fixes the issue mentioned at
https://github.com/systemd/systemd/issues/19832#issuecomment-860269320.
2021-06-15 05:14:22 +09:00
Yu Watanabe 7f80fa12c2 network: add brief comment about reconfiguring interfaces
This also renames link_reconfigure_internal() -> link_reconfigure_impl().
2021-06-15 05:12:25 +09:00
Yu Watanabe ecb3deccdc network: do not partially update wlan information on failure 2021-06-15 04:32:31 +09:00
Yu Watanabe 7149bde4ba network: add missing increment of Link::set_flags_messages
link_up_or_down() will decrement the counter when the subsequent
RTM_GETLINK netlink method is finished. So, we need to increment
the counter here.

Fixes the issue mentioned at
https://github.com/systemd/systemd/issues/19832#issuecomment-860255692.
2021-06-15 03:58:59 +09:00
Luca Boccassi 2fbb5df8e9 Merge pull request #19898 from yuwata/network-multipath-route-without-interface-name
network: set link ifindex when multi-path routes specified without interface name
2021-06-14 14:27:50 +01:00
Luca Boccassi feaf43158a Merge pull request #19894 from yuwata/network-fix-configure-without-carrier
network: always check dynamic address assignments before entering con…
2021-06-14 14:23:09 +01:00