summaryrefslogtreecommitdiff
path: root/src/platform/nmp-rules-manager.h
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-03-11 11:37:40 +0100
committerThomas Haller <thaller@redhat.com>2019-03-13 09:47:37 +0100
commitb8398b9e7948caefbdc93d5bff208e8caf308a80 (patch)
tree533efa26027205223a62e0561f5b06926bd3f15b /src/platform/nmp-rules-manager.h
parent5ae2431b0f9e8dc2fbba5c9783852735a8db7c27 (diff)
downloadNetworkManager-b8398b9e7948caefbdc93d5bff208e8caf308a80.tar.gz
platform: add NMPRulesManager for syncing routing rulesth/routing-rule-pt1
Routing rules are unlike addresses or routes not tied to an interface. NetworkManager thinks in terms of connection profiles. That works well for addresses and routes, as one profile configures addresses and routes for one device. For example, when activating a profile on a device, the configuration does not interfere with the addresses/routes of other devices. That is not the case for routing rules, which are global, netns-wide entities. When one connection profile specifies rules, then this per-device configuration must be merged with the global configuration. And when a device disconnects later, the rules must be removed. Add a new NMPRulesManager API to track/untrack routing rules. Devices can register/add there the routing rules they require. And the sync method will apply the configuration. This is be implemented on top of NMPlatform's caching API.
Diffstat (limited to 'src/platform/nmp-rules-manager.h')
-rw-r--r--src/platform/nmp-rules-manager.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/platform/nmp-rules-manager.h b/src/platform/nmp-rules-manager.h
new file mode 100644
index 0000000000..491df31d4a
--- /dev/null
+++ b/src/platform/nmp-rules-manager.h
@@ -0,0 +1,61 @@
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __NMP_RULES_MANAGER_H__
+#define __NMP_RULES_MANAGER_H__
+
+#include "nm-platform.h"
+
+/*****************************************************************************/
+
+typedef struct _NMPRulesManager NMPRulesManager;
+
+NMPRulesManager *nmp_rules_manager_new (NMPlatform *platform,
+ gboolean track_default);
+
+void nmp_rules_manager_ref (NMPRulesManager *self);
+void nmp_rules_manager_unref (NMPRulesManager *self);
+
+#define nm_auto_unref_rules_manager nm_auto (_nmp_rules_manager_unref)
+NM_AUTO_DEFINE_FCN0 (NMPRulesManager *, _nmp_rules_manager_unref, nmp_rules_manager_unref)
+
+void nmp_rules_manager_track (NMPRulesManager *self,
+ const NMPlatformRoutingRule *routing_rule,
+ gint32 priority,
+ gconstpointer user_tag);
+
+void nmp_rules_manager_track_default (NMPRulesManager *self,
+ int addr_family,
+ int priority,
+ gconstpointer user_tag);
+
+void nmp_rules_manager_untrack (NMPRulesManager *self,
+ const NMPlatformRoutingRule *routing_rule,
+ gconstpointer user_tag);
+
+void nmp_rules_manager_set_dirty (NMPRulesManager *self,
+ gconstpointer user_tag);
+
+void nmp_rules_manager_untrack_all (NMPRulesManager *self,
+ gconstpointer user_tag,
+ gboolean all /* or only dirty */);
+
+void nmp_rules_manager_sync (NMPRulesManager *self);
+
+/*****************************************************************************/
+
+#endif /* __NMP_RULES_MANAGER_H__ */