NetworkManager/src
Thomas Haller f41b4cacd4 platform: support weakly tracked routing rules in NMPRulesManager
Policy routing rules are global, and unlike routes not tied to an interface by ifindex.
That means, while we take full control over all routes of an interface during a sync,
we need to consider that multiple parties can contribute to the global set of rules.
That might be muliple connection profiles providing the same rule, or rules that are added
externally by the user. NMPRulesManager mediates for that.

This is done by NMPRulesManager "tracking" rules.

Rules that are not tracked by NMPRulesManager are completely ignored (and
considered externally added).

When tracking a rule, the caller provides a track-priority. If multiple
parties track a rule, then the highest (absolute value of the) priority
wins.

If the highest track-priority is positive, NMPRulesManager will add the rule if
it's not present.

When the highest track-priority is negative, then NMPRulesManager will remove the
rule if it's present (enforce its absence).

The complicated part is, when a rule that was previously tracked becomes no
longer tracked. In that case, we need to restore the previous state.

If NetworkManager added the rule earlier, then untracking the rule
NMPRulesManager will remove the rule again (restore its previous absent
state).

By default, if NetworkManager had a negative tracking-priority and removed the
rule earlier (enforced it to be absent), then when the rule becomes no
longer tracked, NetworkManager will not restore the rule.
Consider: the user adds a rule externally, and then activates a profile that
enforces the absence of the rule (causing NetworkManager to remove it).
When deactivating the profile, by default NetworkManager will not
restore such a rule! It's unclear whether that is a good idea, but it's
also unclear why the rule is there and whether NetworkManager should
really restore it.

Add weakly tracked rules to account for that. A tracking-priority of
zero indicates such weakly tracked rules. The only difference between an untracked
rule and a weakly tracked rule is, that when NetworkManager earlier removed the
rule (due to a negative tracking-priority), it *will* restore weakly
tracked rules when the rules becomes no longer (negatively) tracked.
And it attmpts to do that only once.

Likewise, if the rule is weakly tracked and already exists when
NMPRulesManager starts posively tracking the rule, then it would not
remove again, when no longer positively tracking it.
2019-04-13 18:22:58 +02:00
..
devices device: fix memory leak 2019-04-12 11:19:58 +02:00
dhcp dhcp: cleanup nm_dhcp_dhclient_create_config() 2019-04-10 15:05:57 +02:00
dns dns: use GDBusConnection instead of GDBusProxy in "nm-dns-systemd-resolved.c" 2019-04-09 20:40:18 +02:00
dnsmasq all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
initrd license: re-license initrd-generator and ibft reader as LGPL 2019-02-22 21:06:00 +01:00
ndisc build/meson: increase timeouts for some tests 2019-02-23 07:20:49 +01:00
platform platform: support weakly tracked routing rules in NMPRulesManager 2019-04-13 18:22:58 +02:00
ppp all: replace strerror() calls with nm_strerror_native() 2019-02-12 08:50:28 +01:00
settings ifcfg-rh: refactor parsing bond options 2019-04-12 11:10:18 +02:00
supplicant supplicant: fix setting pmf when the supplicant doesn't advertise support 2019-02-26 18:31:24 +01:00
systemd systemd: merge branch systemd into master 2019-04-12 07:33:52 +02:00
tests libnm,shared: bzero secrets on failure in nm_utils_base64secret_decode() 2019-04-12 07:39:50 +02:00
vpn core: use nm_connection_get_setting_ip_config() helper 2019-03-05 09:53:21 +01:00
main-utils.c all: replace strerror() calls with nm_strerror_native() 2019-02-12 08:50:28 +01:00
main-utils.h all: cleanup includes in header files 2016-08-17 19:51:17 +02:00
main.c all: replace g_strerror() calls with nm_strerror_native() 2019-02-12 08:50:28 +01:00
meson.build platform: add NMPRulesManager for syncing routing rules 2019-03-13 09:47:37 +01:00
NetworkManagerUtils.c core: add handling of IP routing rules to NMDevice 2019-03-27 16:23:30 +01:00
NetworkManagerUtils.h core: add handling of IP routing rules to NMDevice 2019-03-27 16:23:30 +01:00
nm-act-request.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-act-request.h core: pass hints as strv to nm_act_request_get_secrets() 2019-02-05 08:34:23 +01:00
nm-active-connection.c all/trivial: rename NM_UTILS_LOOKUP_STR() to have "_A" suffix 2019-01-15 09:52:01 +01:00
nm-active-connection.h core: improve and fix keeping connection active based on "connection.permissions" 2018-12-09 14:47:32 +01:00
nm-audit-manager.c all: replace strerror() calls with nm_strerror_native() 2019-02-12 08:50:28 +01:00
nm-audit-manager.h checkpoint: allow resetting the rollback timeout via D-Bus 2018-04-04 14:02:13 +02:00
nm-auth-manager.c auth-manager: use the correct function to deallocate a GError 2018-05-02 14:55:01 +02:00
nm-auth-manager.h auth-manager: add helper function nm_auth_call_result_eval() 2018-04-13 09:09:46 +02:00
nm-auth-subject.c dbus: cache GetConnectionUnixProcessID and GetConnectionUnixUser 2019-04-09 20:40:18 +02:00
nm-auth-subject.h all: remove consecutive empty lines 2018-04-30 16:24:52 +02:00
nm-auth-utils.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-auth-utils.h core: add nm_auth_is_subject_in_acl_set_error() helper 2018-04-18 07:55:15 +02:00
nm-checkpoint-manager.c settings: use delegation instead of inheritance for NMSettingsConnection and NMConnection 2018-08-28 22:27:55 +02:00
nm-checkpoint-manager.h checkpoint: allow resetting the rollback timeout via D-Bus 2018-04-04 14:02:13 +02:00
nm-checkpoint.c checkpoint: hold a reference to the NMManager object 2019-04-10 10:43:09 +02:00
nm-checkpoint.h checkpoint: allow resetting the rollback timeout via D-Bus 2018-04-04 14:02:13 +02:00
nm-config-data.c all: cache errno in local variable before using it 2019-02-12 08:50:28 +01:00
nm-config-data.h core: add checks on connection default properties 2018-12-01 15:16:48 +01:00
nm-config.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-config.h build: check that the list of supported config options is up to date 2018-12-01 15:16:48 +01:00
nm-connectivity.c connectivity: fix build with --disable-concheck 2019-04-10 21:22:22 +02:00
nm-connectivity.h libnm: add nm_connectivity_state_cmp() helper 2018-12-11 09:23:47 +01:00
nm-core-utils.c utils: obey modprobe blacklist 2019-03-07 15:49:40 +01:00
nm-core-utils.h policy: treat WireGuard devices as VPN for DNS 2019-02-14 08:00:29 +01:00
nm-dbus-manager.c dbus: cache GetConnectionUnixProcessID and GetConnectionUnixUser 2019-04-09 20:40:18 +02:00
nm-dbus-manager.h dbus: cache GetConnectionUnixProcessID and GetConnectionUnixUser 2019-04-09 20:40:18 +02:00
nm-dbus-object.c core/dbus: stop NMDBusManager and reject future method calls 2018-04-24 10:25:26 +02:00
nm-dbus-object.h core/dbus: stop NMDBusManager and reject future method calls 2018-04-24 10:25:26 +02:00
nm-dbus-utils.c dbus-utils: don't return paths if they are in the process of being unexported 2019-03-22 16:14:12 +01:00
nm-dbus-utils.h core/dbus: stop NMDBusManager and reject future method calls 2018-04-24 10:25:26 +02:00
nm-dcb.c dcb: cleanup do_helper() in "nm-dcb.c" 2019-04-10 15:05:57 +02:00
nm-dcb.h all: cleanup includes in header files 2016-08-17 19:51:17 +02:00
nm-dhcp4-config.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-dhcp4-config.h core: refactor private data in "src" 2016-10-04 09:50:56 +02:00
nm-dhcp6-config.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-dhcp6-config.h core: refactor private data in "src" 2016-10-04 09:50:56 +02:00
nm-dispatcher.c all: replace strerror() calls with nm_strerror_native() 2019-02-12 08:50:28 +01:00
nm-dispatcher.h all: remove consecutive empty lines 2018-04-30 16:24:52 +02:00
nm-firewall-manager.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-firewall-manager.h firewall: merge "started" signal and "available" property 2017-04-21 09:09:01 +02:00
nm-hostname-manager.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-hostname-manager.h hostname: cache hostname-manager's hostname property 2017-05-12 17:29:33 +02:00
nm-iface-helper.c all: replace strerror() calls with nm_strerror_native() 2019-02-12 08:50:28 +01:00
nm-ip4-config.c libnm,core: enable "onlink" flags also for IPv6 routes 2019-04-10 09:02:35 +02:00
nm-ip4-config.h core: allow ignoring addresses when intersecting ip configs 2019-03-09 15:30:22 +01:00
nm-ip6-config.c core: allow ignoring addresses when intersecting ip configs 2019-03-09 15:30:22 +01:00
nm-ip6-config.h core: allow ignoring addresses when intersecting ip configs 2019-03-09 15:30:22 +01:00
nm-keep-alive.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-keep-alive.h keep-alive: drop unused nm_keep_alive_set_forced() 2018-12-09 14:47:31 +01:00
nm-logging.c all: replace g_strsplit_set() by nm_utils_strsplit_set*() 2019-04-10 15:05:57 +02:00
nm-logging.h logging: make nm-logging thread-safe 2019-02-05 08:18:08 +01:00
nm-manager.c core: don't realize unmanaged software devices 2019-04-12 10:34:20 +02:00
nm-manager.h core: improve and fix keeping connection active based on "connection.permissions" 2018-12-09 14:47:32 +01:00
nm-netns.c platform: support weakly tracked routing rules in NMPRulesManager 2019-04-13 18:22:58 +02:00
nm-netns.h platform: add NMPRulesManager for syncing routing rules 2019-03-13 09:47:37 +01:00
nm-pacrunner-manager.c all: don't use static buffer for nm_utils_inet*_ntop() 2018-12-19 09:23:08 +01:00
nm-pacrunner-manager.h proxy: introduce call-id for clearing pacmanager configuration 2017-04-23 18:12:09 +02:00
nm-policy.c policy: fix memory leak 2019-04-12 11:19:58 +02:00
nm-policy.h policy: track best active connections rather than best devices 2018-07-09 14:56:59 +02:00
nm-proxy-config.c proxy: reorder parts in nm-proxy-config.c and nm-pacrunner-manager.c 2016-10-04 11:58:32 +02:00
nm-proxy-config.h proxy: remove unnecessary APIs 2016-10-04 11:44:44 +02:00
nm-rfkill-manager.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-rfkill-manager.h core: refactor private data in "src" 2016-10-04 09:50:56 +02:00
nm-session-monitor.c all: replace strerror() calls with nm_strerror_native() 2019-02-12 08:50:28 +01:00
nm-session-monitor.h core: refactor private data in "src" 2016-10-04 09:50:56 +02:00
nm-sleep-monitor.c all: drop unnecessary includes of <errno.h> and <string.h> 2019-02-12 08:50:28 +01:00
nm-sleep-monitor.h core: refactor private data in "src" 2016-10-04 09:50:56 +02:00
nm-test-utils-core.h build: avoid header conflict for <linux/if.h> and <net/if.h> with "nm-platform.h" 2018-11-12 16:02:35 +01:00
nm-types.h platform: add support for routing-rule objects and cache them in platform 2019-03-13 09:03:59 +01:00
org.freedesktop.NetworkManager.conf wifi-p2p: rename Wi-Fi P2P 2019-02-01 17:02:57 +01:00