Skip to contentSkip to conversation

Fix old toolchain (< v3.14)

RFC PATCH Superseded Petr Vorel 2 participants 5 messages Sep 29, 2021 – Sep 30, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

cover Fix old toolchain (< v3.14)

Petr Vorel (2):
lapi: Create if_addr.h and reuse it in rtnetlink.h lapi/if_addr.h: Define IFA_FLAGS

 include/lapi/if_addr.h            | 19 +++++++++++++++++++
 include/lapi/rtnetlink.h          |  5 +----
 testcases/cve/icmp_rate_limit01.c |  3 ++-
 3 files changed, 22 insertions(+), 5 deletions(-)
 create mode 100644 include/lapi/if_addr.h
Signature · 5 lines
2.33.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#1 lore raw

RFC PATCH 1/2 lapi: Create if_addr.h and reuse it in rtnetlink.h

There will be fix in next commit for missing IFA_F_NOPREFIXROUTE which requires creating lapi/if_addr.h. Thus move IFA_FLAGS to lapi/if_addr.h, as it belongs there and reuse lapi/if_addr.h in lapi/rtnetlink.h just like <linux/rtnetlink.h> includes <linux/if_addr.h>.

---
 include/lapi/if_addr.h   | 15 +++++++++++++++
 include/lapi/rtnetlink.h |  5 +----
 2 files changed, 16 insertions(+), 4 deletions(-)
 create mode 100644 include/lapi/if_addr.h
include/lapi/if_addr.h new file +15 -0
new file mode 100644
index 000000000..07e6a7c9b
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2021 Petr Vorel <[email protected]>
+ */
+
+#ifndef LAPI_IF_ADDR_H__
+#define LAPI_IF_ADDR_H__
+
+#include <linux/if_addr.h>
+
+#ifndef IFA_F_NOPREFIXROUTE
+# define IFA_F_NOPREFIXROUTE	0x200
+#endif
+
+#endif /* LAPI_IF_ADDR_H__ */
include/lapi/rtnetlink.h +1 -4
index 04e9ad51a..089bf1a0d 100644
@@ -5,9 +5,6 @@
 # define LAPI_RTNETLINK_H__
 
 #include <linux/rtnetlink.h>
-
-#ifndef IFA_FLAGS
-# define IFA_FLAGS 8
-#endif
+#include "lapi/if_addr.h"
 
 #endif	/* LAPI_RTNETLINK_H__ */
Signature · 5 lines
2.33.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#2 lore raw

RFC PATCH 2/2 lapi/if_addr.h: Define IFA_FLAGS

In reply to Petr Vorel

and use it in icmp_rate_limit01.c.

This fixes error on toolchains with very old kernel headers, e.g. Buildroot sourcery-arm:

icmp_rate_limit01.c:82:3: error: 'IFA_F_NOPREFIXROUTE' undeclared (first use in this function)
IFA_F_NOPREFIXROUTE);

Fixed because IFA_F_NOPREFIXROUTE was added in 3.14 and the oldest system we still support is Cent0S 7 with 3.10 kernel.

NOTE: Cent0S 7 is obviously heavily patched thus it contains IFA_F_NOPREFIXROUTE and therefore CI build didn't catch this error.

---
 include/lapi/if_addr.h            | 4 ++++
 testcases/cve/icmp_rate_limit01.c | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)
include/lapi/if_addr.h +4 -0
index 07e6a7c9b..0f7e44784 100644
@@ -8,6 +8,10 @@
 
 #include <linux/if_addr.h>
 
+#ifndef IFA_FLAGS
+# define IFA_FLAGS 8
+#endif
+
 #ifndef IFA_F_NOPREFIXROUTE
 # define IFA_F_NOPREFIXROUTE	0x200
 #endif
testcases/cve/icmp_rate_limit01.c +2 -1
index b3a237b30..3ada32675 100644
@@ -27,11 +27,12 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include <linux/if_addr.h>
 #include <linux/errqueue.h>
 
 #include <sched.h>
 #include <limits.h>
+
+#include "lapi/if_addr.h"
 #include "tst_test.h"
 #include "tst_netdevice.h"
 
Signature · 5 lines
2.33.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

Re: [LTP] [RFC PATCH 2/2] lapi/if_addr.h: Define IFA_FLAGS

Hi,

Quoted 25 lines · Petr Vorel

and use it in icmp_rate_limit01.c.

This fixes error on toolchains with very old kernel headers, e.g. Buildroot sourcery-arm:

icmp_rate_limit01.c:82:3: error: 'IFA_F_NOPREFIXROUTE' undeclared (first use in this function)
IFA_F_NOPREFIXROUTE);

Fixed because IFA_F_NOPREFIXROUTE was added in 3.14 and the oldest system we still support is Cent0S 7 with 3.10 kernel.

NOTE: Cent0S 7 is obviously heavily patched thus it contains IFA_F_NOPREFIXROUTE and therefore CI build didn't catch this error.

---
 include/lapi/if_addr.h            | 4 ++++
 testcases/cve/icmp_rate_limit01.c | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)
include/lapi/if_addr.h +0 -0
index 07e6a7c9b..0f7e44784 100644

include/lapi/if_addr.h line 13

Quoted 6 lines
include/lapi/if_addr.h +3 -0
@@ -8,6 +8,10 @@
 
 #include <linux/if_addr.h>
 
+#ifndef IFA_FLAGS
+# define IFA_FLAGS 8
+#endif

I don't understand why the move of IFA_FLAGS from lapi/rtnetlink.h to lapi/if_addr.h is split into two separate patches. IFA_FLAGS is required for compiling tst_netdevice.c so this patchset is not very bisect-friendly.

Quoted 23 lines
include/lapi/if_addr.h +1 -0
+
 #ifndef IFA_F_NOPREFIXROUTE
 # define IFA_F_NOPREFIXROUTE	0x200
 #endif
testcases/cve/icmp_rate_limit01.c +2 -1
index b3a237b30..3ada32675 100644
@@ -27,11 +27,12 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include <linux/if_addr.h>
 #include <linux/errqueue.h>
 
 #include <sched.h>
 #include <limits.h>
+
+#include "lapi/if_addr.h"
 #include "tst_test.h"
 #include "tst_netdevice.h"
 
Signature · 10 lines
Martin Doucha   [email protected]
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#4 lore raw

Re: [LTP] [RFC PATCH 2/2] lapi/if_addr.h: Define IFA_FLAGS

Hi Martin
,

Quoted 5 lines
Quoted 4 lines

+++ b/include/lapi/if_addr.h

include/lapi/if_addr.h +0 -0
@@ -8,6 +8,10 @@
 
 #include <linux/if_addr.h>
Quoted 7 lines

include/lapi/if_addr.h line 13

Quoted 3 lines
include/lapi/if_addr.h +3 -0
+#ifndef IFA_FLAGS
+# define IFA_FLAGS 8
+#endif

I don't understand why the move of IFA_FLAGS from lapi/rtnetlink.h to lapi/if_addr.h is split into two separate patches. IFA_FLAGS is required for compiling tst_netdevice.c so this patchset is not very bisect-friendly.

Ah, good catch, thank you. Silly error I mixed up IFA_F_NOPREFIXROUTE and IFA_FLAGS => v2.

Kind regards,
Petr

Quoted 4 lines
Quoted 4 lines
include/lapi/if_addr.h +1 -0
+
 #ifndef IFA_F_NOPREFIXROUTE
 # define IFA_F_NOPREFIXROUTE	0x200
 #endif
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp