Commit Graph
430 Commits
Author SHA1 Message Date
Yu Watanabe 6eb35be8e0 network: bridge: fix endian of vlan protocol
Fixes #22469.
2022-02-10 17:47:17 +09:00
Luca Boccassi 0b0ad494a0 Merge pull request #22458 from poettering/parse-safe-string
some safety tweaks to conf-parser.[ch]
2022-02-09 16:59:14 +00:00
Lennart Poettering a99a85242c tree-wide: use config_parse_safe_string() at various places 2022-02-09 10:17:33 +01:00
Yu Watanabe 89346ac6f6 network: coding style fixes 2022-02-09 14:35:25 +09:00
Yu Watanabe 1ae308abb5 network: tunnel: support external mode
Closes #22352.
2022-02-03 11:12:01 +09:00
Yu Watanabe acd8abb7f9 network: tunnel: reorder setting ip6tnl attributes
Just for improving readability.
2022-02-03 11:10:15 +09:00
Yu Watanabe a07e07cd9c network: tunnel: reduce indentation in config_parse_encap_limit() 2022-02-03 11:10:15 +09:00
Yu Watanabe 59c8bef008 network: tunnel: reduce indentation in config_parse_ipv6_flowlabel() 2022-02-03 11:10:15 +09:00
Yu Watanabe 396dfe0a14 network: tunnel: use "data" field to assign result 2022-02-03 11:10:15 +09:00
Yu Watanabe fd11005951 network: xfrm: refuse zero interface ID
Since kernel 5.17-rc1, 5.16.3, and 5.15.17 (more specifically,
https://github.com/torvalds/linux/commit/8dce43919566f06e865f7e8949f5c10d8c2493f5)
the kernel refuses to create an xfrm interface with zero ID.
2022-02-01 13:15:11 +09:00
Yu Watanabe 307fe3cdf2 network: rename NetworkConfigSection -> ConfigSection
And move it and relevant functions to conf-parser.[ch].
2022-01-19 14:57:59 +09:00
Yu Watanabe e135559d80 network: wireguard: also accept negative boolean values to disable adding routes
RouteTable=off was introduced to provide consistency with wg-quick
command. This makes the RouteTable= settings accepts other negative
boolean values.
2022-01-16 19:25:28 +09:00
Yu Watanabe cfe1237f38 network: wireguard: do not add routes to AllowedIPs= by default
As setting such routes may break existing setups.

Closes #21964.
2022-01-16 19:18:23 +09:00
Zbigniew Jędrzejewski-Szmek f2b78e0e91 network: split out dhcp4_pd_create_6rd_tunnel_message(), simplify logging 2022-01-05 11:45:16 +01:00
Zbigniew Jędrzejewski-Szmek 51762897c6 network: adjust log message about MACsec associations 2022-01-05 11:45:11 +01:00
Zbigniew Jędrzejewski-Szmek 9e369704a8 network: simplify logging in macsec netdev code 2022-01-05 11:43:36 +01:00
Zbigniew Jędrzejewski-Szmek b471fc9456 network: simplify logging in l2tp_create_session() and l2tp_create_tunnel()
All the detailed logging is replaced by a simple "Failed to create netlink message",
which should be enough for the user in the unlikely case that this ever fails.
2022-01-05 11:43:36 +01:00
Zbigniew Jędrzejewski-Szmek eff692502b network: move logging from ipoib_set_netlink_message() to the caller 2022-01-05 11:43:28 +01:00
Zbigniew Jędrzejewski-Szmek 2f64865b0e network: split out netdev_fill_fou_tunnel_message(), simplify logging 2022-01-05 11:41:29 +01:00
Zbigniew Jędrzejewski-Szmek 0c50cb50bd network: split out netdev_create_message(), simplify logging 2022-01-05 11:41:29 +01:00
Zbigniew Jędrzejewski-Szmek 81f01be0b8 network: replace more detailed netlink append messages
Some refactoring was needed here to avoid duplicate messages.
Some select-and-paste errors were fixed on the way.

systemd-networkd is thinner by 8k.
2022-01-05 11:41:29 +01:00
Zbigniew Jędrzejewski-Szmek d15cba9647 network: use SYNTHETIC_ERRNO in one more place 2022-01-05 11:41:29 +01:00
Zbigniew Jędrzejewski-Szmek 5b80ecea55 network: replace detailed netlink append messages with a single generic message
This commit is the first in the series, and they generally follow the same
idea: we had very detailed logging for message append operations which would
only fail either with some type error or intrinsic limit (and then they would
fail everywhere, so this would be noticed during development or in CI), or they
would fail with ENOMEM, in which case the exact location is not very interesting
since this is not repeatable.

I am in general in favour of detailed logging messages, because it helps with
diagnosis of errors, but I think case is an exception. Despite not being very
useful, those messages required a lot of effort, because they were customized
for each and every append operation. In fact some of the messages contained copy
errors. The text of the messages (since they are generally unique) also added up
to a considerable size.

This removes the log messages after each sd_netlink_message_append_*() in
fill_message_create() with a single line in netdev_create(). As described
above, we are just appending fields to a message, so those calls would almost
never fail.

A forgotten 'return' was added in one place.

$ size build/systemd-networkd{.0,}
   text	   data	    bss	    dec	    hex	filename
1878634	 394016	     36	2272686	 22adae	build/systemd-networkd.0
1842450	 394080	     36	2236566	 222096	build/systemd-networkd

… so we save 30k too.
2022-01-05 11:36:04 +01:00
Yu Watanabe af670fc635 network: wireguard: warn about invalid allowed IP addresses
But handle them gracefully. Otherwise, when the route to the address is
being configured, kernel refuse the route.

Note that kernel's wireguard module handle e.g. 192.168.10.3/24 as
192.168.10.0/24.

Fixes #21929.
2021-12-31 02:31:09 +09:00
Yu Watanabe b886649c95 network: vxlan: support to select an address assigned on underlying interface as local address 2021-12-25 15:32:06 +09:00
Yu Watanabe 7726526cc6 Merge pull request #21648 from yuwata/network-tunnel-local-automatic-address-selection
network: tunnel: automatic local address selection
2021-12-25 15:05:13 +09:00
Yu Watanabe fe87807eaa network: dhcp-pd: do not stack 6rd sit tunnel 2021-12-18 10:09:07 +09:00
Frantisek Sumsal c0a2e0cc24 network: a couple of tweaks suggested by Coccinelle 2021-12-18 08:36:07 +09:00
Yu Watanabe 2be25d7557 network: tunnel: support to set an address assigned on underlying interface as local address
Closes #18732.
2021-12-12 13:42:45 +09:00
Yu Watanabe 6d1b59cec4 network/netdev: introduce link_get_local_address()
It will be used in later commits.
2021-12-12 13:41:48 +09:00
Yu Watanabe 562729d744 network/netdev: introduce .is_ready_to_create() entry in netdev vtable 2021-12-12 13:41:39 +09:00
Zbigniew Jędrzejewski-Szmek dc79ae23fb Merge pull request #21664 from yuwata/network-tunnel-cleanups
network: several cleanups for tunnel device
2021-12-11 17:17:40 +01:00
Yu Watanabe bb916f350a network: call link_check_ready() when all stacked netdevs are created
Follow-up for 879377cad5.

Otherwise, the underlying interface may stuck in configuring state.
2021-12-08 18:40:13 +09:00
Yu Watanabe a88f3913cf network: tunnel: unify init functions for tunnels 2021-12-08 01:54:01 +09:00
Yu Watanabe fbe0139f1a network: tunnel: introduce TUNNEL() helper function 2021-12-08 01:54:01 +09:00
Yu Watanabe 9e29133085 network: tunnel: create tunnels with AssignToLoopback=yes independently of .network file 2021-12-08 01:54:01 +09:00
Yu Watanabe e49bad0179 network: dhcp-pd: add 6rd support
Closes #19152.
2021-12-07 20:33:16 +09:00
Yu Watanabe 543240f593 network/netdev: drop spurious state from the condition to create stacked netdevs
Stacked netdevs are requested when the underlying interface is in
configuring state.
2021-12-07 15:58:25 +09:00
Yu Watanabe f7144e7b0f network/netdev: create stacked netdevs after all set-link operations are finished
E.g. setting MAC address must be done before creating VLAN interface.
2021-12-07 15:58:25 +09:00
Yu Watanabe 45aa0e841b network,udev: do not adjust local assignment bit of specified MAC address
People often assigns the MAC address of the enslaved interface to e.g.
bridge interface. So, the local assignment bit should not be adjusted.

Fixes #21649.
2021-12-07 15:01:04 +09:00
Frantisek Sumsal c73f413d8d tree-wide: check for NULLs in more places
Fixes issues pointed out by the `cpp/inconsistent-null-check` LGTM
query.
2021-12-06 08:50:53 +09:00
Yu Watanabe 72e65e6ffd network: add support to configure IPoIB interfaces 2021-12-05 00:18:58 +09:00
Yu Watanabe b90d0f83b2 network/netdev: add support to create IPoIB subinterface 2021-12-04 15:06:58 +09:00
Yu Watanabe a8ee2b8e1f network/netdev: generate persistent MAC address when creating netdev interface
Preparation for later commits.
2021-12-04 15:05:32 +09:00
Yu Watanabe 38ef464e41 network/wireguard: search valid address of the endpoint from all struct addrinfo entries 2021-12-02 08:39:37 +09:00
Yu Watanabe 8bf7e3b61c network/wireguard: cleanups for resolving endpoints
This makes
- drop peers_with_unresolved_endpoint and peers_with_failed_endpoint,
- drop destroy handler for sd_resolve_query, and manage each query by peer,
- add random fluctuation to the timeout for retry handler,
- retry timer event source is now managed by peer,
- use sd_event_source_disable_unref().
2021-12-02 08:39:32 +09:00
Yu Watanabe 4a897d29f1 network/wireguard: do not resolve Endpoint= if an IP address is specified
Also verify the domain name and port.
2021-12-02 08:36:22 +09:00
Yu Watanabe e908434458 network: wireguard: automatically configure routes to addresses specified in AllowedIPs=
Closes #14176.
2021-12-01 04:00:11 +09:00
Yu Watanabe 9e11bd58fb network/wireguard: drop unnecessary .in6 specifier
This should not change any behavior, as the size of the IPv4 address is
smaller than IPv6.
2021-12-01 03:56:00 +09:00
Yu Watanabe 5b8bdd20c6 network/netdev: generate persistent MAC address for batadv and bridge
This mostly reverts 489f01f806 and
deb2cfa4c6.

As now MACAddress=none is supported. So, users can still disable MAC
address assignment.
2021-11-28 12:04:55 +09:00