Yu Watanabe
ff51134c93
network: make request_process_address() and friends take Link and corresponding object
...
This also renames e.g. request_process_address() -> address_process_request().
Also, this drops type checks such as `assert(req->type == REQUEST_TYPE_ADDRESS)`,
as in the later commits, the function of processing request, e.g.
`address_process_request()`, will be assigned to the Request object when
it is created. And the request type will be used to distinguish and to
avoid deduplicating requests which do not have any assigned objects,
like REQUEST_TYPE_DHCP4_CLIENT. Hence, the type checks in process functions
are mostly not necessary and redundant.
This is mostly cleanups and preparation for later commits, and should
not change any behavior.
2022-03-11 14:16:41 +09:00
Yu Watanabe
54ff39f7ae
network: make address_configure() and friends take Request object
...
This should not change any behavior.
Just a preparation for a later commit which introduces
request_call_netlink_async().
2022-03-11 10:40:59 +09:00
Yu Watanabe
3f87eaa5d8
conf-parser: merge config_parse_string() and config_parse_safe_string()
...
This also makes unsafe strings escaped when logged. Otherwise,
journalctl may not show the log message unless '--all' is specified.
2022-03-10 14:43:43 +09:00
Yu Watanabe
3d24b0ddd8
network: netdev: drop unused creation type NETDEV_CREATE_AFTER_CONFIGURED
2022-02-27 09:36:48 +09:00
Yu Watanabe
0c91c7a241
network: l2tp: change create type to independent
...
L2TP tunnel does not have underlying interface. Let's change its type to
independent.
2022-02-27 09:36:48 +09:00
Yu Watanabe
8b49ee2dcd
network: l2tp: make Local= optionally take interface name
2022-02-27 09:36:48 +09:00
Yu Watanabe
97b2bc3506
network: netdev: drop NETDEV_CREATE_MASTER
...
As there is no deference between NETDEV_CREATE_MASTER and
NETDEV_CREATE_INDEPENDENT.
2022-02-26 15:01:50 +09:00
Yu Watanabe
eae0d010f7
network: netdev: use netdev_is_stacked() at one more place
2022-02-26 15:01:50 +09:00
Yu Watanabe
490c00a369
network: netdev: make link_get_local_address() refuse non-ready links and addresses
2022-02-26 14:59:56 +09:00
Yu Watanabe
b93ce59e51
network: drop unused flag and counter
2022-02-26 05:49:52 +09:00
Yu Watanabe
b4d6ae63ba
network: split netdev_create() into two
2022-02-26 05:49:52 +09:00
Yu Watanabe
9aa2585e2f
network: assign corresponding NetDev object to Link
2022-02-26 05:49:52 +09:00
Yu Watanabe
c2b19b8f70
network/netdev: drop unused argument
2022-02-26 05:49:52 +09:00
Yu Watanabe
fef805b9fa
network/netdev: do not assign value on failure
2022-02-26 05:49:52 +09:00
Yu Watanabe
047b9991a4
network: create stacked netdevs after the underlying link is activated
...
Otherwise, the activation policy for the netdevs are ignored.
Fixes #22593 .
2022-02-24 08:37:26 +09:00
Yu Watanabe
dedf2d0054
network: add support to create wlan virtual interface
...
Closes #18977 .
2022-02-15 23:24:55 +09:00
Yu Watanabe
1d4312d5f9
network: netdev: add flag to skip kind check
...
It will be used in later commit.
2022-02-15 16:06:43 +09:00
Yu Watanabe
5d4a925af0
network: netdev: use request queue to create independent netdevs
2022-02-15 16:06:37 +09:00
Yu Watanabe
efa7b8adde
network: netdev: increment reference counter on request
...
Otherwise, it may be freed on reload.
2022-02-15 15:54:02 +09:00
Yu Watanabe
d708bc6e4f
network: netdev: make netdev_is_ready_to_create() return negative errno on fatal error
2022-02-15 15:54:02 +09:00
Yu Watanabe
709055dabb
network: rename REQUEST_TYPE_STACKED_NETDEV -> REQUEST_TYPE_NETDEV_STACKED
2022-02-15 15:54:02 +09:00
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