Skip to contentSkip to conversation

Fix old toolchain (< v3.14)

RFC PATCH In review Petr Vorel 3 participants 10 messages Sep 30, 2021 – Oct 6, 2021 Library code

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

v2 cover Fix old toolchain (< v3.14)

Hi,

NOTE: this fix (3rd commit) is needed obviously due very old toolchain (sourcery-arm from Buildroot). I suppose it's still used, but can anybody from Buildroot confirm this?

Kind regards,
Petr

changes v1->v2:
* fixing moving IFA_FLAGS from lapi/rtnetlink.h to lapi/if_addr.h (it was by accident done in 2 commits)
* new commit tst_netdevice.c: Drop redundant include

Petr Vorel (3):
tst_netdevice.c: Drop redundant include
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 +----
 lib/tst_netdevice.c               |  1 -
 testcases/cve/icmp_rate_limit01.c |  3 ++-
 4 files changed, 22 insertions(+), 6 deletions(-)
 create mode 100644 include/lapi/if_addr.h
Signature · 6 lines
2.33.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
author
#1 lore raw

RFC PATCH v2 1/3 tst_netdevice.c: Drop redundant include

<linux/rtnetlink.h> is already included in lapi/rtnetlink.h.

---
 lib/tst_netdevice.c | 1 -
 1 file changed, 1 deletion(-)
lib/tst_netdevice.c +0 -1
index ba9a55b70..4a0442932 100644
@@ -4,7 +4,6 @@
  */
 
 #include <asm/types.h>
-#include <linux/netlink.h>
 #include <linux/veth.h>
 #include <sys/socket.h>
 #include <net/if.h>
Signature · 5 lines
2.33.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Acked-by on v2 1/3
#2 lore raw

Re: [LTP] [RFC PATCH v2 1/3] tst_netdevice.c: Drop redundant include

Hi!

Quoted 1 line

<linux/rtnetlink.h> is already included in lapi/rtnetlink.h.

^
which includes <linux/netlink.h>

I suppose that you have tested this in CI and that it works fine. If that is so:

Quoted 20 lines
---
 lib/tst_netdevice.c | 1 -
 1 file changed, 1 deletion(-)
lib/tst_netdevice.c +0 -1
index ba9a55b70..4a0442932 100644
@@ -4,7 +4,6 @@
  */
 
 #include <asm/types.h>
-#include <linux/netlink.h>
 #include <linux/veth.h>
 #include <sys/socket.h>
 #include <net/if.h>
Signature · 1 line
2.33.0
Signature · 5 lines
Cyril Hrubis
[email protected]

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

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

In reply to Petr Vorel

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   | 16 ++++++++++++++++
 include/lapi/rtnetlink.h |  5 +----
 2 files changed, 17 insertions(+), 4 deletions(-)
 create mode 100644 include/lapi/if_addr.h
include/lapi/if_addr.h new file +16 -0
new file mode 100644
index 000000000..4e50a0a4e
@@ -0,0 +1,16 @@
+// 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_FLAGS
+# define IFA_FLAGS 8
+#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
#5 lore raw

RFC PATCH v2 3/3 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            | 3 +++
 testcases/cve/icmp_rate_limit01.c | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)
include/lapi/if_addr.h +3 -0
index 4e50a0a4e..0f7e44784 100644
@@ -12,5 +12,8 @@
 # define IFA_FLAGS 8
 #endif
 
+#ifndef IFA_F_NOPREFIXROUTE
+# define IFA_F_NOPREFIXROUTE	0x200
+#endif
 
 #endif /* LAPI_IF_ADDR_H__ */
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 · 6 lines
2.33.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Reviewed-by on v2 3/3
#6 lore raw

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

Hi,
commit message for this patch should be "Define IFA_F_NOPREFIXROUTE" but that can be fixed during merge. Apart from that, the whole patchset looks good.

Quoted 52 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            | 3 +++
 testcases/cve/icmp_rate_limit01.c | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)
include/lapi/if_addr.h +3 -0
index 4e50a0a4e..0f7e44784 100644
@@ -12,5 +12,8 @@
 # define IFA_FLAGS 8
 #endif
 
+#ifndef IFA_F_NOPREFIXROUTE
+# define IFA_F_NOPREFIXROUTE	0x200
+#endif
 
 #endif /* LAPI_IF_ADDR_H__ */
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
#7 lore raw

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

Hi Martin,

Quoted 4 lines

Hi,
commit message for this patch should be "Define IFA_F_NOPREFIXROUTE" but that can be fixed during merge. Apart from that, the whole patchset looks good.

Ah, keep doing silly errors, thanks for catching this!

Quoted 1 line

Thanks!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#9 lore raw

Re: [Buildroot] [RFC PATCH v2 3/3] lapi/if_addr.h: Define IFA_FLAGS

Hi Cyril,

Quoted 2 lines

Hi!
Looks good, as long as it passed CI:

Sure, I tested it not only for affected buildroot, but for LTP CI.

Thus fixed commit message and merged.
Thanks a lot both for review.

Kind regards,
Petr
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot