Commit Graph
4561 Commits
Author SHA1 Message Date
Luca Boccassi ef32125c65 Merge pull request #28387 from yuwata/network-route-table-name
network: cleanups for route table name
2023-07-14 22:57:31 +01:00
Yu Watanabe e8e91a81ee network: refuse to override predefined route table name 2023-07-15 02:56:25 +09:00
Yu Watanabe f4defbdc5d network: do not append table number in TableString field in json output
The json output already contains table number, hence, it is not
necessary to include number in the string.
2023-07-15 02:56:20 +09:00
Daan De Meyer 6d4f612c70 Merge pull request #28376 from yuwata/json_append
Use json_append() and json_variant_append_array()
2023-07-14 10:07:48 +02:00
Yu Watanabe dc32de3924 network: check lifetime of address and route before configure
Otherwise, we may configure a route that depends on the existence
of an address or another route, and may fail when lifetime of one
of them are already zero.

Hopefully fixes #28358.
2023-07-14 10:01:20 +02:00
Yu Watanabe 8d3c5b39b9 network: use json_append() and json_variant_append_array() 2023-07-13 17:06:47 +09:00
Susant Sahani fc4a7f13bb ndisc: honour MTU for onlink prefix
Fixes #26520
2023-07-13 09:45:38 +09:00
Daan De Meyer ee9d31a608 json: free array in json_variant_unref_many()
This allows using it with CLEANUP_ARRAY(). For the 2 call sites
where we don't need to free the array, we do a regular for loop
calling json_variant_unref() instead.
2023-07-12 20:05:20 +02:00
Daan De Meyer a1af83728f device-util: Declare iterator variables inline 2023-07-12 20:05:18 +02:00
Daan De Meyer 5fc97a5fde Merge pull request #28334 from DaanDeMeyer/network-generator
Network generator fixes
2023-07-10 15:49:42 +02:00
Daan De Meyer c9d85c2206 network-generator: Add missing umask(0022) 2023-07-10 12:30:35 +02:00
Daan De Meyer 8b24bcdfa8 network-generator: Add missing log_setup() 2023-07-10 12:30:15 +02:00
Yu Watanabe d0009d9290 network: make address_get() work for null address
When a static null address is requested, e.g. Address=0.0.0.0/24,
then the corresponding Address object owned by Network object has
null address, and previously it did not match any addresses already
assigne to the interface.

Let's search matching Address object when originally it is requested as
the null address.

Then, the address configured with requested as a null address will be
kept on reconfigure.

Fixes #26113.
2023-07-07 19:11:37 +09:00
Yu Watanabe 9684a8ded0 network: always copy input address for link_request_address()
Then, the code becomes much simpler.
This also adds several missing log messages.

No functional change, just refactoring.
2023-07-07 19:11:37 +09:00
Yu Watanabe 0b8b30f6bb network: also use address_kernel_{hash,compare}_func() for managing address requests
Request may refer Address object owned by Link, but its broadcast
address or label may be updated by address_equalify(), hence these
fields cannot be used in the hash and compare functions.
2023-07-07 19:11:37 +09:00
Yu Watanabe 14044a4114 network: log broadcast address and address label 2023-07-07 19:11:37 +09:00
Yu Watanabe 0acc647010 network: ignore Broadcast= setting when the address is null
When an address is requested with null address, then broadcast should be
determined after an address aquired that will be assigned to the
interface.
2023-07-07 19:11:37 +09:00
Yu Watanabe 9a45125ae7 network: split-out address_section_adjust_broadcast()
No functional change, just refactoring.
2023-07-07 19:11:33 +09:00
Yu Watanabe d859cf15eb Merge pull request #28286 from yuwata/network-dhcp4-classless-static-routes
network,dhcp4: do not ignore gateway in classless static routes option
2023-07-07 10:12:06 +09:00
Yu Watanabe 75a9122678 network,ndisc: use ndisc_captive_portal_free() at one more place
Fixes another memleak introduced by 64de00c49f.
Fixes #28283.
2023-07-07 09:18:25 +09:00
Yu Watanabe 77451f654a network/dhcp4: do not ignore the gateway even if the destination is in the same network
Fixes #28280.
2023-07-07 06:56:30 +09:00
Yu Watanabe 535134bc51 network,ndisc: use correct free function for captive portal
Fixes memleak introduced by 64de00c49f.
Fixes #28277.
2023-07-06 20:30:22 +01:00
Yu Watanabe efa5521be8 network/json: introduce PreferredLifetimeUSec and ValidLifetimeUSec 2023-07-06 11:41:49 +02:00
Yu Watanabe 52ee8ecf07 networkctl: urlify captive portal entry 2023-07-06 14:55:58 +09:00
Yu Watanabe 2c5bca1734 network/ndisc: downgrade log level
The failures may be critical for per-link operation, but not critical
for the service.
2023-07-06 14:55:58 +09:00
Yu Watanabe 64de00c49f network: handle captive portal with multiple routers
Before this patch, if a network has multiple routers and one of them
provides a captive portal, then the portal was overwritten or cleared
when another RA from another router is received.

This makes captive portals managed in the similar way as DNS servers or
DNS domains. So now captive portal can safely handled even if a network
has multiple routers.
2023-07-06 14:55:58 +09:00
Yu Watanabe 04eaf63c66 network: update comment 2023-07-06 14:55:58 +09:00
Yu Watanabe 6341ea5467 network: introduce link_get_captive_portal()
Then, downgrade log level of the message about mis-match of captive
portals in different protocols.
2023-07-06 14:55:46 +09:00
Yu Watanabe c470513eea Merge pull request #28232 from rpigott/ndisc-captive-portal-mfree
ndisc: clear ndisc captive portal value on bogus zero-len option
2023-07-04 01:27:20 +09:00
Ronan Pigott 8231286faf ndisc: reject malformed captive portal URI with EBADMSG
This allows the correct, gracious, error handling to follow up in the
ndisc handler. Otherwise, an internal error is assumed and the interface
disabled.

Fixes: 9747955d2d ("ndisc: parse RFC8910 captive portal ipv6ra option")
2023-07-03 03:07:57 -07:00
Ronan Pigott 16290f50e9 ndisc: clear ndisc captive portal value on bogus zero-len option
This value was freed but erroneously never cleared, leading to
use-after-free.

Fixes: 9747955d2d ("ndisc: parse RFC8910 captive portal ipv6ra option")
2023-07-03 01:10:41 -07:00
Yu Watanabe 6e8477edd3 network: delay to configure address until it is removed on reconfigure
When we request an address that already exists and is under removing,
we need to wait for the address being removed. Otherwise, configuration
of a route whose preferred source is the address will fail.

Fixes #28009.
Replaces #28088.
2023-07-03 16:06:17 +09:00
Yu Watanabe b088c3d3fc network: constify several functions 2023-07-03 16:06:17 +09:00
Yu Watanabe 86c2a76e09 Merge pull request #28132 from rpigott/dhcp-captive-portal
Implement RFC8910: captive portal dhcp options
2023-07-03 14:51:56 +09:00
Ronan Pigott e469d2a2ed networkctl: show captive portal configuration in link status 2023-07-02 01:13:43 -07:00
Ronan Pigott 8628267f31 networkd: include captive portal information in link json description 2023-07-02 01:13:43 -07:00
Ronan Pigott d74c4ce103 network: Introduce UseCaptivePortal IPv6RA option
Accepts a boolean. When enabled retains captive portal configuration
advertised by the router.
2023-07-02 01:13:43 -07:00
Ronan Pigott a75feb554b network: Introduce UseCaptivePortal DHCPv6 option
Acepts a boolean. When enabled requests and retains captive portal
configuration from the DHCPv6 server.
2023-07-02 01:13:43 -07:00
Ronan Pigott edb88a7201 network: Introduce UseCaptivePortal DHCPv4 option
Accepts a boolean. When enabled, UseCaptivePortal will request and
retain the captive portal configuration from the DHCP server.
2023-07-02 01:13:43 -07:00
Ronan Pigott 9747955d2d ndisc: parse RFC8910 captive portal ipv6ra option 2023-07-02 01:13:29 -07:00
Yu Watanabe 932ef6ecd4 network: add global setting for IPv6PrivacyExtensions=
Closes #28186.
2023-06-29 21:40:47 +09:00
Yu Watanabe 7cab78503a network: introduce IPV6_PRIVACY_EXTENSIONS_KERNEL enum value
No functional change. Preparation for using the _INVALID value in later
commit.
2023-06-29 21:40:47 +09:00
Yuxiang Zhu b67e8a4e3e network: Add IgnoreDdontFragment= option for Fragmentation control (#28131)
From `ip-link(8)`:
> [no]ignore-df - enables/disables IPv4 DF
                      suppression on this tunnel.  Normally datagrams
                      that exceed the MTU will be fragmented; the
                      presence of the DF flag inhibits this, resulting
                      instead in an ICMP Unreachable (Fragmentation
                      Required) message.  Enabling this attribute causes
                      the DF flag to be ignored.

If this option is enabled for a GRE/GRETAP tunnel, the `DF` flag in the outer IP header
will not inherit the inner IP header's `DF` flag.

This is useful to transfer packets that exceed the MTU of the underlay
network.
2023-06-29 12:11:52 +02:00
Henrik Holst cf4dbd84ac network: make degraded-carrier bond/bridge as routable (#27776)
This makes a bond or bridge interface in the degraded-carrier state but has a routable address
handled as routable operational state.

If the carrier is degraded but the address state is routable then the operational state should be
seen as routable and not degraded because that may be the case for bonds if some of the links are down,
but when that happens the bond as whole is still routable.

This also makes operational state to degraded if address state is degraded even if the link state is
degraded-carrier.

Fixes #22713.
2023-06-15 13:32:10 +09:00
Yu Watanabe 041d8ad857 Merge pull request #27796 from yuwata/memstream-util
util: introduce memstream-util
2023-06-01 12:07:17 +09:00
Rene Hollander 930133d5df networkd/dhcpserver: Save and expose the client hostname sent when requesting a DHCP lease.
DHCP clients often send their own hostname in option 12. It can be useful
to store it with the lease so it can be shown to a human to easily identify
which lease belongs to which device.

RFC: https://www.rfc-editor.org/rfc/rfc2132#section-3.14
2023-06-01 06:51:45 +09:00
Yu Watanabe 2485b7e2b8 tree-wide: use memstream-util 2023-06-01 06:48:47 +09:00
Yu Watanabe 322bda8241 Merge pull request #27826 from yuwata/network-link-ready-without-ndisc-when-has-static-address
network: do not request dynamic addressing protocols finished when at…
2023-06-01 06:29:55 +09:00
Yu Watanabe 2f96a29c2c wait-online: request that at least one managed online interface exists
Fixes a regression caused by ab3aed4a03.

I thought the commit does not cause any severe regression. However,
drivers for network interfaces may be loaded later. So, we should wait
if no network interface is found.

Fixes #27822.
2023-05-31 22:12:03 +02:00
Yu Watanabe 9e7d91ed97 network: do not request dynamic addressing protocols finished when at least one static address is configured
The setting IPv6AcceptRA= is defaults to yes, hence, even if a .network
file for an interface has static IP address configuration, it may takes
few seconds for the interface being configured state, as NDisc for the
interface needs to be finished. That makes wait-online.service
needlessly slow. Typically, such delay is not necessary for statically
configured networks.

Let's make the required condition slightly relaxed; if a .network file
has static IP address configurations, then let's make the matching
interface enter the 'configured' state soon after the static addresses
configured on the interface.

Note, this does not change the default for IPv6AcceptRA=, hence, NDisc
still runs on interfaces by default. So, addresses, routes, DNS servers,
and so on based on RA will be assigned on interfaces later.

Strictly speaking, this breaks backward compatibility, but the previous
behavior is not clearly documented. If a user requested both static
IPv4 address and IPv6 SLAAC address configured before an interface being
entered to the 'configured' state, then '--ipv6' for wait-online can be
used. So, the behavior change should not cause severe regression.

Closes #27779.
2023-05-30 17:39:11 +09:00