about summary refs log tree commit diff
path: root/src/platform/nm-platform.h
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2020-06-29 22:16:54 +0200
committerMichael Biebl <biebl@debian.org>2020-06-29 22:16:54 +0200
commit238d328f69e0f4b838f361d7ddac1d6134bfd631 (patch)
tree411ff73bb36d725e3a337d2fddbccc7b074622e0 /src/platform/nm-platform.h
parente8d426c51e83b8465f9be527fd014f51443f829d (diff)
parent10ae7d8cd706062742d0cdb1803d49909aef9e06 (diff)
Update upstream source from tag 'upstream/1.25.91'
Update to upstream version '1.25.91'
with Debian dir 82448cadc1dd251ffbe44b7c339cadeb55eb776b
Diffstat (limited to 'src/platform/nm-platform.h')
-rw-r--r--src/platform/nm-platform.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index aa3551a6..3e6ef84c 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -468,6 +468,13 @@ typedef union {
 	 * table. Use nm_platform_route_table_coerce()/nm_platform_route_table_uncoerce(). */ \
 	guint32 table_coerced; \
 	\
+	/* rtm_type.
+	 *
+	 * This is not the original type, if type_coerced is 0 then
+	 * it means RTN_UNSPEC otherwise the type value is preserved.
+	 * */ \
+	guint8 type_coerced; \
+	\
 	/*end*/
 
 typedef struct {
@@ -1285,6 +1292,39 @@ _nm_platform_uint8_inv (guint8 scope)
 	return (guint8) ~scope;
 }
 
+/**
+ * nm_platform_route_type_coerce:
+ * @table: the route type, in its original value.
+ *
+ * Returns: returns the coerced type, that can be stored in
+ *   NMPlatformIPRoute.type_coerced.
+ */
+static inline guint8
+nm_platform_route_type_coerce (guint8 type)
+{
+	switch (type) {
+	case 0 /* RTN_UNSPEC */:
+		return 1;
+	case 1 /* RTN_UNICAST */:
+		return 0;
+	default:
+		return type;
+	}
+}
+
+/**
+ * nm_platform_route_type_uncoerce:
+ * @table: the type table, in its coerced value
+ *
+ * Returns: reverts the coerced type in NMPlatformIPRoute.type_coerced
+ *   to the original value as kernel understands it.
+ */
+static inline guint8
+nm_platform_route_type_uncoerce (guint8 type_coerced)
+{
+	return nm_platform_route_type_coerce (type_coerced);
+}
+
 gboolean nm_platform_get_use_udev (NMPlatform *self);
 gboolean nm_platform_get_log_with_ptr (NMPlatform *self);