Blame SOURCES/0057-rtnl_rule-decode-fib_rule_uid_range-without-use-of-l.patch

86f512
From 23f0dc01aec74e21eca3bf1fd532a0ef853db7b4 Mon Sep 17 00:00:00 2001
86f512
From: Eugene Syromyatnikov <evgsyr@gmail.com>
86f512
Date: Thu, 10 Oct 2019 10:27:40 +0200
86f512
Subject: [PATCH 57/76] rtnl_rule: decode fib_rule_uid_range without use of
86f512
 <linux/fib_rules.h>
86f512
86f512
* rtnl_rule.c (decode_fib_rule_uid_range): Define struct type for
86f512
fib_rule_uid_range explicitly.
86f512
(decode_fib_rule_uid_range) [!HAVE_STRUCT_FIB_RULE_UID_RANGE]: Remove.
86f512
* xlat/fib_rule_flags.in: Add fallback definitions.
86f512
86f512
References: https://bugzilla.redhat.com/show_bug.cgi?id=1758201
86f512
---
86f512
 rtnl_rule.c            |  9 ++++-----
86f512
 xlat/fib_rule_flags.in | 12 ++++++------
86f512
 2 files changed, 10 insertions(+), 11 deletions(-)
86f512
86f512
Index: strace-5.1/rtnl_rule.c
86f512
===================================================================
86f512
--- strace-5.1.orig/rtnl_rule.c	2018-12-10 01:00:00.000000000 +0100
86f512
+++ strace-5.1/rtnl_rule.c	2020-01-29 12:32:57.315224088 +0100
86f512
@@ -42,8 +42,10 @@
86f512
 			  const unsigned int len,
86f512
 			  const void *const opaque_data)
86f512
 {
86f512
-#ifdef HAVE_STRUCT_FIB_RULE_UID_RANGE
86f512
-	struct fib_rule_uid_range range;
86f512
+	struct /* fib_rule_uid_range */ {
86f512
+		uint32_t start;
86f512
+		uint32_t end;
86f512
+	} range;
86f512
 
86f512
 	if (len < sizeof(range))
86f512
 		return false;
86f512
@@ -54,9 +56,6 @@
86f512
 	}
86f512
 
86f512
 	return true;
86f512
-#else
86f512
-	return false;
86f512
-#endif
86f512
 }
86f512
 
86f512
 static bool
86f512
Index: strace-5.1/xlat/fib_rule_flags.in
86f512
===================================================================
86f512
--- strace-5.1.orig/xlat/fib_rule_flags.in	2017-08-14 03:06:59.000000000 +0200
86f512
+++ strace-5.1/xlat/fib_rule_flags.in	2020-01-29 12:32:57.316224079 +0100
86f512
@@ -1,6 +1,6 @@
86f512
-FIB_RULE_PERMANENT
86f512
-FIB_RULE_INVERT
86f512
-FIB_RULE_UNRESOLVED
86f512
-FIB_RULE_IIF_DETACHED
86f512
-FIB_RULE_OIF_DETACHED
86f512
-FIB_RULE_FIND_SADDR
86f512
+FIB_RULE_PERMANENT	0x00000001
86f512
+FIB_RULE_INVERT		0x00000002
86f512
+FIB_RULE_UNRESOLVED	0x00000004
86f512
+FIB_RULE_IIF_DETACHED	0x00000008
86f512
+FIB_RULE_OIF_DETACHED	0x00000010
86f512
+FIB_RULE_FIND_SADDR	0x00010000
86f512
Index: strace-5.1/xlat/fib_rule_flags.h
86f512
===================================================================
86f512
--- strace-5.1.orig/xlat/fib_rule_flags.h	2019-05-22 15:08:30.000000000 +0200
86f512
+++ strace-5.1/xlat/fib_rule_flags.h	2020-01-29 12:33:16.856044719 +0100
86f512
@@ -3,35 +3,65 @@
86f512
 #include "gcc_compat.h"
86f512
 #include "static_assert.h"
86f512
 
86f512
-
86f512
-#ifndef XLAT_MACROS_ONLY
86f512
-
86f512
-# ifdef IN_MPERS
86f512
-
86f512
-#  error static const struct xlat fib_rule_flags in mpers mode
86f512
-
86f512
-# else
86f512
-
86f512
-static
86f512
-const struct xlat fib_rule_flags[] = {
86f512
 #if defined(FIB_RULE_PERMANENT) || (defined(HAVE_DECL_FIB_RULE_PERMANENT) && HAVE_DECL_FIB_RULE_PERMANENT)
86f512
-  XLAT(FIB_RULE_PERMANENT),
86f512
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+static_assert((FIB_RULE_PERMANENT) == (0x00000001), "FIB_RULE_PERMANENT != 0x00000001");
86f512
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+#else
86f512
+# define FIB_RULE_PERMANENT 0x00000001
86f512
 #endif
86f512
 #if defined(FIB_RULE_INVERT) || (defined(HAVE_DECL_FIB_RULE_INVERT) && HAVE_DECL_FIB_RULE_INVERT)
86f512
-  XLAT(FIB_RULE_INVERT),
86f512
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+static_assert((FIB_RULE_INVERT) == (0x00000002), "FIB_RULE_INVERT != 0x00000002");
86f512
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+#else
86f512
+# define FIB_RULE_INVERT 0x00000002
86f512
 #endif
86f512
 #if defined(FIB_RULE_UNRESOLVED) || (defined(HAVE_DECL_FIB_RULE_UNRESOLVED) && HAVE_DECL_FIB_RULE_UNRESOLVED)
86f512
-  XLAT(FIB_RULE_UNRESOLVED),
86f512
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+static_assert((FIB_RULE_UNRESOLVED) == (0x00000004), "FIB_RULE_UNRESOLVED != 0x00000004");
86f512
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+#else
86f512
+# define FIB_RULE_UNRESOLVED 0x00000004
86f512
 #endif
86f512
 #if defined(FIB_RULE_IIF_DETACHED) || (defined(HAVE_DECL_FIB_RULE_IIF_DETACHED) && HAVE_DECL_FIB_RULE_IIF_DETACHED)
86f512
-  XLAT(FIB_RULE_IIF_DETACHED),
86f512
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+static_assert((FIB_RULE_IIF_DETACHED) == (0x00000008), "FIB_RULE_IIF_DETACHED != 0x00000008");
86f512
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+#else
86f512
+# define FIB_RULE_IIF_DETACHED 0x00000008
86f512
 #endif
86f512
 #if defined(FIB_RULE_OIF_DETACHED) || (defined(HAVE_DECL_FIB_RULE_OIF_DETACHED) && HAVE_DECL_FIB_RULE_OIF_DETACHED)
86f512
-  XLAT(FIB_RULE_OIF_DETACHED),
86f512
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+static_assert((FIB_RULE_OIF_DETACHED) == (0x00000010), "FIB_RULE_OIF_DETACHED != 0x00000010");
86f512
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+#else
86f512
+# define FIB_RULE_OIF_DETACHED 0x00000010
86f512
 #endif
86f512
 #if defined(FIB_RULE_FIND_SADDR) || (defined(HAVE_DECL_FIB_RULE_FIND_SADDR) && HAVE_DECL_FIB_RULE_FIND_SADDR)
86f512
-  XLAT(FIB_RULE_FIND_SADDR),
86f512
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+static_assert((FIB_RULE_FIND_SADDR) == (0x00010000), "FIB_RULE_FIND_SADDR != 0x00010000");
86f512
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+#else
86f512
+# define FIB_RULE_FIND_SADDR 0x00010000
86f512
 #endif
86f512
+
86f512
+#ifndef XLAT_MACROS_ONLY
86f512
+
86f512
+# ifdef IN_MPERS
86f512
+
86f512
+#  error static const struct xlat fib_rule_flags in mpers mode
86f512
+
86f512
+# else
86f512
+
86f512
+static
86f512
+const struct xlat fib_rule_flags[] = {
86f512
+ XLAT(FIB_RULE_PERMANENT),
86f512
+ XLAT(FIB_RULE_INVERT),
86f512
+ XLAT(FIB_RULE_UNRESOLVED),
86f512
+ XLAT(FIB_RULE_IIF_DETACHED),
86f512
+ XLAT(FIB_RULE_OIF_DETACHED),
86f512
+ XLAT(FIB_RULE_FIND_SADDR),
86f512
  XLAT_END
86f512
 };
86f512