Commit Graph
4373 Commits
Author SHA1 Message Date
Jan Janssen bbec46c817 meson: Use files() for fuzzers
Not having to provide the full path in the source tree is much
nicer and the produced lists can also be used anywhere in the source
tree.
2022-01-11 14:15:54 +01:00
Jan Janssen e1eeebbb11 meson: Use files() for tests
Not having to provide the full path in the source tree is much
nicer and the produced lists can also be used anywhere in the source
tree.
2022-01-11 14:15:54 +01:00
Zbigniew Jędrzejewski-Szmek 3bcb5dc1a5 network: move logging from route_set_netlink_message() to the callers
Overall size change for the whole series:
$ size build/systemd-networkd{.0,}
   text	   data	    bss	    dec	    hex	filename
1878634	 394016	     36	2272686	 22adae	build/systemd-networkd.0
1755066	 394080	     36	2149182	 20cb3e	build/systemd-networkd

i.e. 121 kb.
2022-01-05 11:58:13 +01:00
Zbigniew Jędrzejewski-Szmek 7bd36e490f network: move logging from routing_policy_rule_set_netlink_message() to the callers 2022-01-05 11:45:16 +01:00
Zbigniew Jędrzejewski-Szmek 907e277fdd network: move logging from qdisc_configure()/tclass_configure() to the caller 2022-01-05 11:45:16 +01:00
Zbigniew Jędrzejewski-Szmek bd187da8c4 network: simplify logging in request_process_bridge_fdb() 2022-01-05 11:45:16 +01:00
Zbigniew Jędrzejewski-Szmek 16924f54af network: move logging from tc .fill_message to the callers
Structured initialization is used a bit more.

There were two kinds of log messages: about failed size calculations and
about failed appends to the message. I "downgraded" the first type to log_debug,
and moved the latter to the caller. This way there should be at most one high-priority
message.

I also changed sizeof(<type>) to sizeof(var) — there is less chance of select-and-paste
error in the second form.
2022-01-05 11:45:16 +01:00
Zbigniew Jędrzejewski-Szmek 0d75a90bb6 network: split out neighbor_configure_message(), simplify logging 2022-01-05 11:45:16 +01: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 bb2f88ff7b network: split out link_configure_fill_message(), simplify logging 2022-01-05 11:43:36 +01:00
Zbigniew Jędrzejewski-Szmek 9a93dabc40 network: move logging from can_set_netlink_message() to the caller 2022-01-05 11:43:36 +01:00
Zbigniew Jędrzejewski-Szmek 2a3cca04c4 network: de-duplicate logging in bridge_vlan_append_info() and the caller
The remaining message is changed, because the user would most likely not
understand that "append VLANs" is just talking about the netlink message.
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 80bfc3b901 network: ndisc: ignore route prefix to ::/0
Fixes #21912.
2021-12-28 21:00:49 +00:00
Luca Boccassi 4ac8526215 Merge pull request #21892 from yuwata/network-vxlan-automatic-local-address-selection
network: vxlan: automatic local address selection
2021-12-26 17:27:41 +00:00
Yu Watanabe 3e7bf8535f tree-wide: fix typo 2021-12-25 18:32:22 +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 402b81ffd8 Merge pull request #21737 from yuwata/network-wait-dsa-master-up
network: wait for DSA master up
2021-12-25 15:05:36 +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
Yu Watanabe 42e7ce69e4 network: route: update expiration timer in link_request_route() 2021-12-18 10:09:07 +09:00
Yu Watanabe d0f17cfda6 network: route: do not drop unreachable route on reconfiguring downstream interface
Previously, when a downstream is reconfigured, the unreachable route
was removed as there is no corresponding static config in .network
files.
2021-12-18 10:09:07 +09:00
Yu Watanabe 277521a1ac network: dhcp-pd: fix condition in dhcp_pd_prefix_lost() 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 14dd873b88 network: dhcp4: pass IPServiceType=none to dhcp client
Follow-up for b55093ce88.
2021-12-18 08:35:42 +09:00
Yu Watanabe 21feba0a5c network: dhcp: logs received 6rd option
Addresses https://github.com/systemd/systemd/pull/21625#issuecomment-996109051.
2021-12-17 09:47:11 +00:00
Yu Watanabe d9338387d9 Merge pull request #21786 from keszybz/dirent-work
Make FOREACH_DIRENT and FOREACH_DIRENT_ALL declare the iterator variables
2021-12-17 04:07:35 +09:00
Yu Watanabe b1d9c504d3 network: wait until the DSA master interface becomes up
This is for the DSA subsystem, which have several stacked interfaces
on the master interface. To bring up a stacked interface, it is necessary
that the master is already up. See
https://github.com/systemd/systemd/issues/7478#issuecomment-348508263.

Note this is not necessary for newer kernels which includes
https://github.com/torvalds/linux/commit/9d5ef190e5615a7b63af89f88c4106a5bc127974.

Fixes #7478.
2021-12-17 02:00:25 +09:00
Yu Watanabe 8a20a8438f network: route: link_drop_foreign_routes() must be called only for managed interfaces 2021-12-17 00:14:30 +09:00
Yu Watanabe f974f17ae7 networkd: check the existence of the route 2021-12-17 00:13:42 +09:00
Yu Watanabe a71c5c44f7 network: address: minor optimization for link_drop_foreign_addresses()
link_address_is_dynamic() is costful in general. Call it only when
KeepConfiguration= is set.

Note, it is not necessary to check link->network in the loop, as we have
the assertion for that in the beginning of the function.
2021-12-16 22:43:18 +09:00
Yu Watanabe 9e86dba94b network: drop IPv6LL addresses manually configured in .network file 2021-12-16 22:43:18 +09:00
Zbigniew Jędrzejewski-Szmek 03f7ddf0bf meson: stop building out convenience libraries by default
The meson default for static_library() are:
build_by_default=true, install=false. We never interact with the
static libraries, and we only care about them as a stepping-stone towards
the installable executables or libraries. Thus let's only build them if
they are a dependency of something else we are building.

While at it, let's drop install:false, since this appears to be the default.

This change would have fixed the issue with lib_import_common failing
to build too: we wouldn't attempt to build it.

In practice this changes very little, because we generally only declare static
libraries where there's something in the default target that will make use of
them. But it seems to be a better pattern to set build_by_default to false.
2021-12-16 11:01:08 +01:00
Zbigniew Jędrzejewski-Szmek 67cb0d4725 Merge pull request #21766 from yuwata/network-generator-name-policy
network-generator: support setting NamePolicy=
2021-12-16 09:34:01 +01:00
Yu Watanabe 2b3a8e2830 network: route: update comment 2021-12-15 20:07:17 +00:00
Yu Watanabe 79463de533 test: add testcases for net.ifname-policy= kernel command line argument 2021-12-16 01:55:37 +09:00
Yu Watanabe a4c9bf2e51 network-generator: support to set NamePolicy= through kernel command line argument
Closes #16296.
2021-12-16 01:55:37 +09:00
Yu Watanabe eb3e86ae2c network-generator: support MAC address longer or shorter than ETH_ALEN 2021-12-16 01:55:37 +09:00
Yu Watanabe 372e8592c6 wait-online: also use address state even when operational state is below degraded
Closes #21706.
2021-12-14 10:32:56 +01: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