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
Susant Sahani
d7d1d18fd2
network: Allow to configure unreachable/blackhole RoutingPolicyRule ( #17984 )
2020-12-18 12:21:15 +09:00
Susant Sahani
b43dfb6e6e
sd-netlink: routing policy rule port to fib_rule_hdr
2020-12-17 00:17:32 +09: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
bd4733da64
network: do not configure static configs more than once simultaneously
2020-12-11 14:39:46 +09:00
Yu Watanabe
db9ecf0501
license: LGPL-2.1+ -> LGPL-2.1-or-later
2020-11-09 13:23:58 +09:00
Yu Watanabe
13ffa39f8e
network: rename network_verify_xxx() -> network_drop_invalid_xxx()
...
As 'verify' implies a boolean result.
2020-10-07 03:22:03 +09:00
Yu Watanabe
d08ed5a1fd
network: specify all known attributes when removing routing policy rules
...
Otherwise, routing_policy_rule_remove() may removes unintended rule.
2020-10-07 02:36:29 +09:00
Yu Watanabe
5a82104bf3
network: add missing "else"
2020-10-07 02:36:29 +09:00
Yu Watanabe
6f3337277f
network: drop unused element
2020-10-07 02:36:29 +09:00
Yu Watanabe
50a3682f1e
network: introduce network_verify_routing_policy_rules()
2020-10-07 02:36:29 +09:00
Yu Watanabe
f1828a222a
network: make routing_policy_rule_new() static
2020-10-07 02:36:29 +09:00
Yu Watanabe
51a0dc4a15
network: move manager_rtnl_process_rule() to networkd-routing-policy-rule.[ch]
2020-10-07 02:36:29 +09:00
Yu Watanabe
ca183bf8fd
network: drop list of static routing policy rules
...
[RoutingPolicyRule] sections are managed by both LIST and Hashmap.
Let's drop list.
2020-10-07 02:36:29 +09:00
Yu Watanabe
02e9f4e536
network: do not duplicate rule if Family=both
2020-10-07 02:36:29 +09:00
Yu Watanabe
b0815fa499
network: make routing_policy_rule_free() returns NULL
2020-10-07 02:36:29 +09:00
Yu Watanabe
816ef8d1da
network: add more logs on loading routing policy rules failure
...
And reduce scope of variables.
2020-10-07 02:36:24 +09:00
Yu Watanabe
eb3445ce93
network: reduce scope of variables
2020-10-06 00:51:01 +09:00
Yu Watanabe
ddc9df3183
network: drop routing_policy_rule_make_local()
...
Its error handling was bogus...
2020-10-06 00:51:01 +09:00
Yu Watanabe
7532b88808
network: make several functions static
2020-10-06 00:51:01 +09:00
Yu Watanabe
c0ec474675
network: move link_request_set_routing_policy()
2020-10-06 00:51:01 +09:00
Yu Watanabe
17d2b2e4ef
network: replace FRA_IFNAME -> FRA_IIFNAME
...
No functional change, as FRA_IFNAME is an alias of FRA_IIFNAME.
2020-09-10 18:57:07 +09:00
Yu Watanabe
bd1000b4a0
network: fix the default mask for FirewallMark=
...
And always send FRA_FWMASK if FirewallMark= is set.
C.f. b8964ed9fa
Partially fixes #16784 .
2020-09-10 18:56:18 +09:00
Yu Watanabe
c2d6fcb147
network: do not assign return value if the parse_fwmark_fwmask() fails
...
This also removes redundant logs, and makes input string not copied if
it does not contain '/'.
2020-09-10 18:19:03 +09:00
Yu Watanabe
d85b0d69f1
network: add debug log for removing routing policy rules
2020-09-10 18:19:03 +09:00
Yu Watanabe
755dbda355
network: also logs priority of routing policy rules
2020-09-10 18:18:59 +09:00
Zbigniew Jędrzejewski-Szmek
90e74a66e6
tree-wide: define iterator inside of the macro
2020-09-08 12:14:05 +02:00
Yu Watanabe
5c72a6d5d3
network: logs about unknown key
2020-09-04 08:48:08 +09:00
Yu Watanabe
f405179d65
network: honor already specified family when parsing from= or to= in serialized rule
2020-09-04 08:48:08 +09:00
Yu Watanabe
9d6282d120
network: do not reallocate buffer
2020-09-04 08:48:04 +09:00
Yu Watanabe
d0ac05613b
network: serialize InvertRule= in [RoutingPolicyRule]
2020-09-04 08:47:22 +09:00
Yu Watanabe
1680b11df4
network: add whitespace after family= and priority= in serialized routing policy rule
...
This also makes priority= serialized only when its value is non-zero.
2020-09-04 08:44:19 +09:00
Yu Watanabe
3c94b20dd3
network: downgrade error level when the error is ignored
2020-09-04 08:44:14 +09:00
Yu Watanabe
7e60a37d04
network: move routing_policy_rule_read_full_file()
2020-09-04 08:42:01 +09:00
Yu Watanabe
8eec0b9da5
network: set key destructor in several hash_ops
2020-07-29 02:05:05 +09:00
Yu Watanabe
f281fc1e95
tree-wide: use siphash24_compress_string() where it is applicable
2020-07-22 19:55:14 +09:00
Yu Watanabe
d96edb2c6e
network: downgrade log level in conf parsers
2020-07-17 00:40:09 +09:00
Zbigniew Jędrzejewski-Szmek
0da425df65
networkd: use capitalized "IP" and "TOS" in messages
2020-07-07 12:06:26 +02:00
Zbigniew Jędrzejewski-Szmek
de7fef4b6e
tree-wide: use set_ensure_put()
...
Patch contains a coccinelle script, but it only works in some cases. Many
parts were converted by hand.
Note: I did not fix errors in return value handing. This will be done separate
to keep the patch comprehensible. No functional change is intended in this
patch.
2020-06-22 16:32:37 +02:00
Naïm Favier
53e1ba280f
network: add SuppressPrefixLength option to RoutingPolicyRule ( #14736 )
...
Closes #14724 .
2020-02-03 08:25:48 +09:00
Yu Watanabe
ea471a4695
network: support UID based routing policy
...
Closes #14666 .
2020-02-02 22:43:38 +09:00