1From 9e357fb4fc00ab9c303e314b85b9ae3836141f81 Mon Sep 17 00:00:00 2001 2From: Petr Vorel <petr.vorel@gmail.com> 3Date: Wed, 29 Sep 2021 19:56:29 +0200 4Subject: [PATCH] lapi/if_addr.h: Define IFA_FLAGS 5 6and use it in icmp_rate_limit01.c. 7 8This fixes error on toolchains with very old kernel headers, e.g. 9Buildroot sourcery-arm: 10 11icmp_rate_limit01.c:82:3: error: 'IFA_F_NOPREFIXROUTE' undeclared (first use in this function) 12 IFA_F_NOPREFIXROUTE); 13 14Fixed because IFA_F_NOPREFIXROUTE was added in 3.14 and the oldest 15system we still support is Cent0S 7 with 3.10 kernel. 16 17NOTE: Cent0S 7 is obviously heavily patched thus it contains 18IFA_F_NOPREFIXROUTE and therefore CI build didn't catch this error. 19 20Signed-off-by: Petr Vorel <petr.vorel@gmail.com> 21[ upstream status: https://lore.kernel.org/ltp/20210930183058.5240-4-petr.vorel@gmail.com/T/#u ] 22--- 23 include/lapi/if_addr.h | 3 +++ 24 testcases/cve/icmp_rate_limit01.c | 3 ++- 25 2 files changed, 5 insertions(+), 1 deletion(-) 26 27diff --git a/include/lapi/if_addr.h b/include/lapi/if_addr.h 28index 4e50a0a4e..0f7e44784 100644 29--- a/include/lapi/if_addr.h 30+++ b/include/lapi/if_addr.h 31@@ -12,5 +12,8 @@ 32 # define IFA_FLAGS 8 33 #endif 34 35+#ifndef IFA_F_NOPREFIXROUTE 36+# define IFA_F_NOPREFIXROUTE 0x200 37+#endif 38 39 #endif /* LAPI_IF_ADDR_H__ */ 40diff --git a/testcases/cve/icmp_rate_limit01.c b/testcases/cve/icmp_rate_limit01.c 41index b3a237b30..3ada32675 100644 42--- a/testcases/cve/icmp_rate_limit01.c 43+++ b/testcases/cve/icmp_rate_limit01.c 44@@ -27,11 +27,12 @@ 45 #include <sys/socket.h> 46 #include <netinet/in.h> 47 #include <arpa/inet.h> 48-#include <linux/if_addr.h> 49 #include <linux/errqueue.h> 50 51 #include <sched.h> 52 #include <limits.h> 53+ 54+#include "lapi/if_addr.h" 55 #include "tst_test.h" 56 #include "tst_netdevice.h" 57 58-- 592.33.0 60 61