From 3ea0269f50befda0b73f09f22d3125dba46a5689 Mon Sep 17 00:00:00 2001
From: Arseney300 <Arseney300@gmail.com>
Date: Wed, 6 Apr 2022 02:13:46 +0700
Subject: [PATCH] Added linux version checking in flowlabel.h The current
 version of src/flowlabel.h is just a copy of linux/in6.h because it conflicts
 with "netinet/in.h". But after linux >=v3.7 (adding uapi) this conflict was
 removed and this copy became useless. I've added a Linux version check. This
 fix is very useful for eg mp-tcp linux where iperf can build successfully.

---
 src/flowlabel.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/flowlabel.h b/src/flowlabel.h
index df0a434..b245a38 100644
--- a/src/flowlabel.h
+++ b/src/flowlabel.h
@@ -29,15 +29,18 @@
 
 
 #include <linux/types.h>
+#include <linux/version.h>
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
+#include <linux/in6.h>
+#else
+#ifndef __ANDROID__
 /*                                                                                                                                                                             
    It is just a stripped copy of the Linux kernel header "linux/in6.h" 
    "Flow label" things are still not defined in "netinet/in*.h" headers,
    but we cannot use "linux/in6.h" immediately because it currently
-   conflicts with "netinet/in.h" .
+   conflicts with "netinet/in.h" . (in kernel versions < 3.7.0)
 */
-
-#ifndef __ANDROID__
 struct in6_flowlabel_req
 {
     struct in6_addr flr_dst;
@@ -68,6 +71,7 @@ struct in6_flowlabel_req
 #define IPV6_FLOWINFO_FLOWLABEL 0x000fffff
 #define IPV6_FLOWINFO_PRIORITY  0x0ff00000
 
+#endif
 #define IPV6_FLOWLABEL_MGR      32
 #define IPV6_FLOWINFO_SEND      33
 
-- 
2.34.1