Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame^] | 1 | From 9e357fb4fc00ab9c303e314b85b9ae3836141f81 Mon Sep 17 00:00:00 2001 |
| 2 | From: Petr Vorel <petr.vorel@gmail.com> |
| 3 | Date: Wed, 29 Sep 2021 19:56:29 +0200 |
| 4 | Subject: [PATCH] lapi/if_addr.h: Define IFA_F_NOPREFIXROUTE |
| 5 | |
| 6 | and use it in icmp_rate_limit01.c. |
| 7 | |
| 8 | This fixes error on toolchains with very old kernel headers, e.g. |
| 9 | Buildroot sourcery-arm: |
| 10 | |
| 11 | icmp_rate_limit01.c:82:3: error: 'IFA_F_NOPREFIXROUTE' undeclared (first use in this function) |
| 12 | IFA_F_NOPREFIXROUTE); |
| 13 | |
| 14 | Fixed because IFA_F_NOPREFIXROUTE was added in 3.14 and the oldest |
| 15 | system we still support is Cent0S 7 with 3.10 kernel. |
| 16 | |
| 17 | NOTE: Cent0S 7 is obviously heavily patched thus it contains |
| 18 | IFA_F_NOPREFIXROUTE and therefore CI build didn't catch this error. |
| 19 | |
| 20 | Signed-off-by: Petr Vorel <petr.vorel@gmail.com> |
| 21 | Upstream-Status: Submitted [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 | |
| 27 | diff --git a/include/lapi/if_addr.h b/include/lapi/if_addr.h |
| 28 | index 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__ */ |
| 40 | diff --git a/testcases/cve/icmp_rate_limit01.c b/testcases/cve/icmp_rate_limit01.c |
| 41 | index 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 | -- |
| 59 | 2.33.0 |
| 60 | |