Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -746,9 +746,10 @@ unsigned long long strtoul(const char *cp, char **endp, unsigned int base)
return result;
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0)) \
|| ((LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,220)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5,11,0)))
/*
* find_module() is unexported in v5.12:
* find_module() is unexported in v5.12 (backported to 5.10.220):
* 089049f6c9956 ("module: unexport find_module and module_mutex")
* and module_mutex is replaced with RCU in
* a006050575745 ("module: use RCU to synchronize find_module")
Expand All @@ -773,13 +774,14 @@ struct module *find_module(const char *name)

/* Copy from 294f69e662d1 ("compiler_attributes.h: Add 'fallthrough' pseudo
* keyword for switch/case use") */
#ifndef fallthrough
# if defined __has_attribute && __has_attribute(__fallthrough__)
#if !defined(fallthrough) && defined(__has_attribute)
# if __has_attribute(__fallthrough__)
# define fallthrough __attribute__((__fallthrough__))
# else
# define fallthrough do {} while (0) /* fallthrough */
# endif
#endif
#ifndef fallthrough
# define fallthrough do {} while (0) /* fallthrough */
#endif

#ifndef HAVE_NF_CT_EVENT_NOTIFIER_CT_EVENT
/*
Expand Down
5 changes: 3 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ PATH=$PATH:/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/sbin
case "$1" in
--from-dkms-conf*)
KDKMS=`echo "$1" | sed 's/[^=]*.//'`
KDIR="$KDKMS"
# restore options from existing Makefile, if present
if [ -e Makefile ]; then
set -- `sed -n 's/^CARGS = \(.*\)/\1/p' Makefile`
Expand Down Expand Up @@ -348,7 +349,7 @@ do
--disable-snmp-a*) SKIPSNMP=1 ;;
--disable-net-snmp*) SKIPSNMP=1 ;;
--disable-dkms*) SKIPDKMS=1 ;;
--from-dkms-conf*) ;;
--from-dkms-conf*) SKIPDKMS=1 ;;
--make) echo called from make; CARGS=`echo $CARGS | sed s/--make//g` ;;
-Werror) KOPTS="$KOPTS -Werror" ;;
--help|-h) show_help ;;
Expand Down Expand Up @@ -614,7 +615,7 @@ dkms_check() {
echo Yes.
DKMSINSTALL=dinstall
test "$FROMDKMSCONF" && return
if dkms status | grep ^ipt-netflow, >/dev/null; then
if dkms status ipt-netflow | grep ^ipt-netflow/ >/dev/null; then
echo "! You are already have module installed via DKMS"
echo "! it will be uninstalled on 'make install' and"
echo "! current version of module installed afterwards."
Expand Down
4 changes: 4 additions & 0 deletions dkms.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ PACKAGE_NAME="ipt-netflow"
pushd `dirname $BASH_SOURCE`
PACKAGE_VERSION=`./version.sh`
popd

# skb_reset_mac_len() was introduced in v3.0-rc3
BUILD_EXCLUSIVE_KERNEL_MIN="3"

BUILT_MODULE_NAME[0]=ipt_NETFLOW
DEST_MODULE_LOCATION[0]=/kernel/extra
STRIP[0]=no
Expand Down
9 changes: 7 additions & 2 deletions gen_compat_def
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ kbuild_test_symbol() {
echo -n "Test function $* " >&2
kbuild_test_compile ${1^^} $1 ${2-} <<-EOF
#include <linux/module.h>
${2:+#include <$2>}
${3:-${2:+#include <$2>}}
MODULE_LICENSE("GPL");
void *test = $1;
EOF
Expand Down Expand Up @@ -121,7 +121,12 @@ kbuild_test_symbol nf_bridge_info_get linux/netfilter_bridge.h
# Stumbled on 5.9
kbuild_test_struct vlan_dev_priv linux/if_vlan.h
# Kernel version check broken by centos8
kbuild_test_symbol put_unaligned_be24 asm/unaligned.h
kbuild_test_symbol put_unaligned_be24 '???/unaligned.h' '#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,12,0)
#include <linux/unaligned.h>
#else
#include <asm/unaligned.h>
#endif'
# totalram_pages changed from atomic to inline function.
kbuild_test_symbol totalram_pages linux/mm.h
kbuild_test_ref totalram_pages linux/mm.h
Expand Down
7 changes: 7 additions & 0 deletions ipt_NETFLOW.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,17 @@
# include <net/netfilter/nf_conntrack_core.h>
#endif
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,12,0)
#include <linux/unaligned.h>
#else
#include <asm/unaligned.h>
#endif
#ifdef HAVE_LLIST
/* llist.h is officially defined since linux 3.1,
* but centos6 have it backported on its 2.6.32.el6 */
# include <linux/llist.h>
#endif
#include <linux/ratelimit.h>
#include "compat.h"
#include "ipt_NETFLOW.h"
#include "murmur3.h"
Expand Down Expand Up @@ -4881,6 +4886,8 @@ static void parse_l2_header(const struct sk_buff *skb, struct ipt_netflow_tuple
&& !(vlan->flags & VLAN_FLAG_REORDER_HDR)
# if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)
&& !netif_is_macvlan_port(vlan_dev)
# endif
# if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0)
&& !netif_is_bridge_port(vlan_dev)
# endif
))
Expand Down