summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Fedoryshchenko <denys.f@collabora.com>2025-11-26 16:54:51 +0200
committerGitHub <noreply@github.com>2025-11-26 16:54:51 +0200
commit224c734b8ab64694319c81625e022af623b51ba0 (patch)
treec081ca8feaa96f21bbb6135dac5b610c67ff74c6
parent48d9bf6d26087a6e23f1e4419b18009efc0e98b7 (diff)
parent886395621c2a3ed302fc01468270da425b58f840 (diff)
downloadaccel-ppp-224c734b8ab64694319c81625e022af623b51ba0.tar.gz
accel-ppp-224c734b8ab64694319c81625e022af623b51ba0.zip
Merge pull request #263 from nuclearcat/raise-cmake-version
Raised cmake_minimum_required to 3.5
-rw-r--r--CMakeLists.txt2
-rw-r--r--README2
-rw-r--r--drivers/ipoe/CMakeLists.txt24
-rw-r--r--drivers/ipoe/ipoe.c16
4 files changed, 40 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9a3ff73b..b2b98ea0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.6)
+cmake_minimum_required(VERSION 3.5)
if (CMAKE_BINARY_DIR STREQUAL CMAKE_HOME_DIRECTORY)
message(FATAL_ERROR "Building in source directory is forbidden. Please make separated build directory.")
diff --git a/README b/README
index 4977d647..fe871188 100644
--- a/README
+++ b/README
@@ -31,7 +31,7 @@ Requirment
----------
1. modern linux distribution
2. kernel-2.6.25 or later
-4. cmake-2.6 or later
+4. cmake-3.5 or later
5. libnl-2.0 or probably later (required for builtin shaper)
6. libcrypto-0.9.8 or probably later (openssl-0.9.8)
7. libpcre2
diff --git a/drivers/ipoe/CMakeLists.txt b/drivers/ipoe/CMakeLists.txt
index e221a7ec..d0d6902c 100644
--- a/drivers/ipoe/CMakeLists.txt
+++ b/drivers/ipoe/CMakeLists.txt
@@ -3,11 +3,35 @@ if (NOT DEFINED KDIR)
set(KDIR "/usr/src/linux")
endif (NOT DEFINED KDIR)
+# Try to figure out the kernel release once so we can show it before building.
+execute_process(
+ COMMAND make -s -C ${KDIR} kernelrelease
+ RESULT_VARIABLE IPOE_KERNEL_RELEASE_RESULT
+ OUTPUT_VARIABLE IPOE_KERNEL_RELEASE
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_QUIET
+)
+
+if (NOT IPOE_KERNEL_RELEASE_RESULT STREQUAL "0" OR IPOE_KERNEL_RELEASE STREQUAL "")
+ find_program(UNAME_EXECUTABLE uname)
+
+ if (UNAME_EXECUTABLE)
+ execute_process(
+ COMMAND ${UNAME_EXECUTABLE} -r
+ OUTPUT_VARIABLE IPOE_KERNEL_RELEASE
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ else()
+ set(IPOE_KERNEL_RELEASE "unknown")
+ endif()
+endif()
+
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/driver/ipoe.ko
COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/driver
COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/driver
COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/* ${CMAKE_CURRENT_BINARY_DIR}/driver
COMMAND ln -sf ${CMAKE_BINARY_DIR}/version.h ${CMAKE_CURRENT_BINARY_DIR}/driver
+ COMMAND ${CMAKE_COMMAND} -E echo "[ 99%] Generating driver/ipoe.ko for kernel ${IPOE_KERNEL_RELEASE}"
COMMAND make -C ${KDIR} M=${CMAKE_CURRENT_BINARY_DIR}/driver modules
DEPENDS ipoe.c ipoe.h
)
diff --git a/drivers/ipoe/ipoe.c b/drivers/ipoe/ipoe.c
index 14b6416a..4050011f 100644
--- a/drivers/ipoe/ipoe.c
+++ b/drivers/ipoe/ipoe.c
@@ -26,6 +26,9 @@
#include <net/ip.h>
#include <net/icmp.h>
#include <net/flow.h>
+#ifdef flowi4_dscp
+#include <net/inet_dscp.h>
+#endif
#include <net/xfrm.h>
#include <net/net_namespace.h>
#include <net/netns/generic.h>
@@ -58,6 +61,15 @@
#define RHEL_MAJOR 0
#endif
+static inline void ipoe_flowi4_set_tos(struct flowi4 *fl4, __u8 dsfield)
+{
+#ifdef flowi4_dscp
+ fl4->flowi4_dscp = inet_dsfield_to_dscp(dsfield);
+#else
+ fl4->flowi4_tos = dsfield;
+#endif
+}
+
struct ipoe_stats {
struct u64_stats_sync sync;
u64 packets;
@@ -263,7 +275,7 @@ static int check_nat_required(struct sk_buff *skb, struct net_device *link)
memset(&fl4, 0, sizeof(fl4));
fl4.daddr = iph->daddr;
- fl4.flowi4_tos = RT_TOS(0);
+ ipoe_flowi4_set_tos(&fl4, RT_TOS(0));
fl4.flowi4_scope = RT_SCOPE_UNIVERSE;
rt = ip_route_output_key(net, &fl4);
if (IS_ERR(rt))
@@ -771,7 +783,7 @@ static struct ipoe_session *ipoe_lookup_rt4(struct sk_buff *skb, __be32 addr, st
memset(&fl4, 0, sizeof(fl4));
fl4.daddr = addr;
- fl4.flowi4_tos = RT_TOS(0);
+ ipoe_flowi4_set_tos(&fl4, RT_TOS(0));
fl4.flowi4_scope = RT_SCOPE_UNIVERSE;
rt = ip_route_output_key(net, &fl4);
if (IS_ERR(rt))