Commit Graph

3160 Commits

Author SHA1 Message Date
Yu Watanabe f7d0ea5b6f network: refuse to set 0 for rx or tx queue
Man page says that the valid value is 1-4096.
2021-01-09 00:05:45 +09:00
Yu Watanabe 386e89083f network: read RTAX_ADVMSS in received route message 2021-01-08 23:56:13 +09:00
Yu Watanabe 78ebbf0286 network: add missing TAKE_PTR() 2021-01-08 23:25:20 +09:00
Susant Sahani 007cac09a2 network: route - add support to configure tcp advmss 2021-01-08 14:06:13 +00:00
Susant Sahani 0a9fb9bad8 network: Allow to set device's receive queues and transmit queues 2021-01-05 12:46:28 +09:00
Yu Watanabe a75466ed19 network: drop fib rules configured with Family=both 2020-12-30 03:19:07 +09:00
Yu Watanabe 49de8d5ced network: set RoutingPolicyRule::family based on Family= setting 2020-12-30 03:19:07 +09:00
Yu Watanabe c1934a8f2f network: always re-configure rules even if already exist
routing_policy_rule_get() in link_set_routing_policy_rules() does not
work when [RoutingPolicyRule] section does not have From= or To=.
2020-12-30 03:19:03 +09:00
Yu Watanabe 57fe5a42f0 network: drop unnecessary checks
By the previous commit, the checks are not necessary any more.
2020-12-30 03:17:42 +09:00
Yu Watanabe fdce9324c7 network: fix possible memory leak
When set_put() returns 0, then already stored rule will be unref()ed
from Manager.
2020-12-30 02:11:36 +09:00
Yu Watanabe 3141c81736 network: constify several arguments 2020-12-30 02:03:48 +09:00
Yu Watanabe a9d240f4bf network: do not serialize/deserialize routing policy rules
We already handle foreign routing policy rules correctly by the previous
commit. So, the serialization/deserialization of rules are not necessary
anymore.
2020-12-29 16:13:54 +09:00
Yu Watanabe 0b81225e57 network: drop unnecessary routing policy rules
networkd already drop foreign address, routes, and nexthops on startup,
except those created by kernel. However, previously, routing policy
rules were not. The logic of serialization/deserialization of rules only
works for rules created by previous invocation of networkd, and does not
work for one created by other tools like `ip rule`.

This makes networkd drop foreign routing policy rules except created by
kernel on startup. Also, remove rules created by networkd when the
corresponding links are dropped or networkd is stopping.
2020-12-29 16:13:54 +09:00
Yu Watanabe e737dce544 network: treat rule which has l3mdev flag as created by kernel 2020-12-29 16:13:39 +09:00
Yu Watanabe 569eeb0c05 network: adjust protocol of rules sent from kernel when kernel does not support FRA_PROTOCOL
Otherwise, each configured rule is treated as foreign.
2020-12-29 16:03:26 +09:00
Yu Watanabe 1e5fd3216a network: set FRA_PROTOCOL to RTPROT_STATIC by default 2020-12-29 16:03:26 +09:00
Yu Watanabe 75d2641190 network: introduce RouterAllowList= and RouterDenyList= in [IPv6AcceptRA] 2020-12-24 17:16:15 +09:00
Susant Sahani de6b6ff84c networkd: add support for prefix allow-list and route allow-list 2020-12-24 17:16:13 +09:00
Yu Watanabe 3f0af4a5f9 network: rename DenyList= -> PrefixDenyList= 2020-12-24 17:15:44 +09:00
Yu Watanabe 19e334bd15 network: make RouteDenyList= filter route prefix rather than gateway address
DenyList= filters provided prefixes, not router address.
So, RouteDenyLisy= should so for consistency.

Fixes 16c89e649d.
2020-12-24 17:15:44 +09:00
Yu Watanabe 1cd5267e81 network: fix condition for checking the provided gateway is assigned to link
Fix bug introduced by 221019166f.
2020-12-24 17:15:44 +09:00
Yu Watanabe 8c86196b52 network: drop redundant TAKE_PTR()
Follow-up for 16c89e649d.
2020-12-24 17:15:14 +09:00
Florian Klink d3ccb1b4ba network: fix IPv6PrivacyExtensions=kernel handling
When set to "kernel", systemd is not supposed to touch that sysctl.

5e0534f1c1, part of
https://github.com/systemd/systemd/pull/17240 forgot to handle that
case.

Fixes https://github.com/systemd/systemd/issues/18003
2020-12-24 08:54:20 +09:00
Florian Klink 7eeaf72b88 network: fix typo
IPv6 privacy extensions are plural, not singular.
2020-12-23 12:56:45 +01:00
Devon Pringle 16c89e649d networkd: add RouteDenyList
Allow configuration for IPv6 discovered routes to be ignored instead of
adding them as a route. This can be used to block unwanted routes, for
example, you may wish to not receive some set of routes on an interface
if they are causing issues.
2020-12-18 21:44:32 +09:00
Yu Watanabe 517fdd61ed network: move variable declaration 2020-12-18 13:00:57 +09:00
Susant Sahani d7d1d18fd2
network: Allow to configure unreachable/blackhole RoutingPolicyRule (#17984) 2020-12-18 12:21:15 +09:00
Lennart Poettering a8af734e75
Merge pull request #17026 from fw-strlen/nft_16
add networkd/nspawn nftables backend
2020-12-16 19:18:22 +01:00
Devon Pringle 221019166f networkd: handle ignoring ll gateway being link ll
In the event where network discovery gets a route with the gateway being
the interfaces local link address, networkd will fail the interface.

systemd-networkd[44319]: br_lan: Configuring route: dst: fdcd:41a4:5559:ec03::/64, src: n/a, gw: fe80::e4da:7eff:fe77:5c5e, prefsrc: n/a, scope: global, table: main, proto: ra, type: unicast
systemd-networkd[44319]: br_lan: Could not set NDisc route or address: Gateway can not be a local address. Invalid argument
systemd-networkd[44319]: br_lan: Failed
systemd-networkd[44319]: br_lan: State changed: configuring -> failed

This patch, instead of allowing the interface to fail, will instead log
the event and skip setting the route.
2020-12-16 17:56:01 +01:00
Yu Watanabe ecfbbf098c
Merge pull request #17859 from keszybz/hostnamed-export-hostname-origin-and-simplify-logic
Export hostname origin and simplify logic in hostamed
2020-12-17 00:55:49 +09:00
Susant Sahani b43dfb6e6e sd-netlink: routing policy rule port to fib_rule_hdr 2020-12-17 00:17:32 +09:00
Zbigniew Jędrzejewski-Szmek e2054217d5 Move hostname setup logic to new shared/hostname-setup.[ch]
No functional change, just moving a bunch of things around. Before
we needed a rather complicated setup to test hostname_setup(), because
the code was in src/core/. When things are moved to src/shared/
we can just test it as any function.

The test is still "unsafe" because hostname_setup() may modify the
hostname.
2020-12-16 11:02:15 +01:00
Yu Watanabe a7c52e1ee1
Merge pull request #17968 from yuwata/purge-libudev
udev: do not link with libudev
2020-12-16 12:07:46 +09:00
Florian Westphal 761cf19d7b firewall-util: introduce context structure
for planned nft backend we have three choices:

- open/close a new nfnetlink socket for every operation
- keep a nfnetlink socket open internally
- expose a opaque fw_ctx and stash all internal data here.

Originally I opted for the 2nd option, but during review it was
suggested to avoid static storage duration because of perceived
problems with threaded applications.

This adds fw_ctx and new/free functions, then converts the existing api
and nspawn and networkd to use it.
2020-12-16 00:35:56 +01:00
Susant Sahani 937e305e93 network: Allow to configure interface promiscuous mode 2020-12-15 20:25:08 +00:00
Yu Watanabe e4b127e2cc meson: do not link with libudev 2020-12-16 02:31:44 +09:00
Lennart Poettering 52ef5dd798 hostname-util: flagsify hostname_is_valid(), drop machine_name_is_valid()
Let's clean up hostname_is_valid() a bit: let's turn the second boolean
argument into a more explanatory flags field, and add a flag that
accepts the special name ".host" as valid. This is useful for the
container logic, where the special hostname ".host" refers to the "root
container", i.e. the host system itself, and can be specified at various
places.

let's also get rid of machine_name_is_valid(). It was just an alias,
which is confusing and even more so now that we have the flags param.
2020-12-15 17:59:48 +01:00
Luca Boccassi e3284031ae
Merge pull request #17960 from yuwata/network-log-routing-policy-rule
network: introduce log_routing_policy_rule()
2020-12-14 22:22:51 +00:00
Luca Boccassi e1f3685750
Merge pull request #17959 from yuwata/network-log-address
network: introduce log_address_debug()
2020-12-14 22:21:50 +00:00
Yu Watanabe c18c53c36e network: use netlink_message_read_in_addr_union() where applicable 2020-12-14 23:32:25 +09:00
Yu Watanabe ea81208f03 network: introduce log_routing_policy_rule_debug() 2020-12-14 23:32:20 +09:00
Yu Watanabe 40424f1ad9 network: introduce routing_policy_rule_equal() 2020-12-14 23:30:16 +09:00
Yu Watanabe 18f2ee3310 network: make routing_policy_rule_remove() take Manager instead of Link
As routing policy rules are managed by Manager.
2020-12-14 23:30:16 +09:00
Yu Watanabe 1db01a3339 network: make address_drop() accept NULL 2020-12-14 23:28:11 +09:00
Yu Watanabe 24f50382af network: introduce log_address_debug() 2020-12-14 23:28:07 +09:00
Yu Watanabe 4055ec9323 network: merge manager_drop_routes() and manager_drop_foreign_routes() 2020-12-14 23:26:49 +09:00
Yu Watanabe 167a5561cd network: introduce log_route_debug() 2020-12-14 23:26:45 +09:00
Yu Watanabe ad6df71759 network: use netlink_message_read_in_addr_union() where applicable 2020-12-14 23:25:09 +09:00
Luca Boccassi 213b8ebe43
Merge pull request #17921 from yuwata/network-drop-assertion-17920
network: drop assertions to check link state in netlink callback handlers
2020-12-11 22:53:33 +00:00
Zbigniew Jędrzejewski-Szmek f8dd40779a
network: adjust comments
Co-authored-by: Carlo Teubner <435950+c4rlo@users.noreply.github.com>
2020-12-11 11:39:16 +01:00