Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 6 additions & 4 deletions compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ union nf_inet_addr {
# define BEFORE2632(x,y)
# endif

# if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
# define ctl_table struct ctl_table
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lacks support for < 3.17

--- a/compat.h
+++ b/compat.h
@@ -80,10 +80,16 @@ union nf_inet_addr {
 #  define s_ctl_table const struct ctl_table
 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
 #  define s_ctl_table struct ctl_table
+# else
+#  define s_ctl_table ctl_table
 # endif
 
-# if !defined(HAVE_GRSECURITY_H) && LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
-#  define ctl_table_no_const struct ctl_table
+# ifndef HAVE_GRSECURITY_H
+#  if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
+#   define ctl_table_no_const struct ctl_table
+#  else
+#   define ctl_table_no_const ctl_table
+#  endif
 # endif
 #endif
 

# if LINUX_VERSION_CODE >= KERNEL_VERSION(6,11,0)
# define s_ctl_table const struct ctl_table
# elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
# define s_ctl_table struct ctl_table
# endif

# ifndef HAVE_GRSECURITY_H
# define ctl_table_no_const ctl_table
# if !defined(HAVE_GRSECURITY_H) && LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
# define ctl_table_no_const struct ctl_table
# endif
#endif

Expand Down
24 changes: 13 additions & 11 deletions ipt_NETFLOW.c
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ static int switch_promisc(int newpromisc)

#ifdef CONFIG_SYSCTL
/* sysctl /proc/sys/net/netflow */
static int hsize_procctl(ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
static int hsize_procctl(s_ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
void __user *buffer, size_t *lenp, loff_t *fpos)
{
int ret, hsize;
Expand All @@ -1539,7 +1539,7 @@ static int hsize_procctl(ctl_table *ctl, int write, BEFORE2632(struct file *filp
return ret;
}

static int sndbuf_procctl(ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
static int sndbuf_procctl(s_ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
void __user *buffer, size_t *lenp, loff_t *fpos)
{
int ret;
Expand Down Expand Up @@ -1574,7 +1574,7 @@ static int sndbuf_procctl(ctl_table *ctl, int write, BEFORE2632(struct file *fil
}

static void free_templates(void);
static int destination_procctl(ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
static int destination_procctl(s_ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
void __user *buffer, size_t *lenp, loff_t *fpos)
{
int ret;
Expand All @@ -1591,7 +1591,7 @@ static int destination_procctl(ctl_table *ctl, int write, BEFORE2632(struct file
}

#ifdef ENABLE_AGGR
static int aggregation_procctl(ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
static int aggregation_procctl(s_ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
void __user *buffer, size_t *lenp, loff_t *fpos)
{
int ret;
Expand All @@ -1606,7 +1606,7 @@ static int aggregation_procctl(ctl_table *ctl, int write, BEFORE2632(struct file
#endif

#ifdef ENABLE_PROMISC
static int promisc_procctl(ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
static int promisc_procctl(s_ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
void __user *buffer, size_t *lenp, loff_t *fpos)
{
int newpromisc = promisc;
Expand All @@ -1623,7 +1623,7 @@ static int promisc_procctl(ctl_table *ctl, int write, BEFORE2632(struct file *fi

#ifdef ENABLE_SAMPLER
static int parse_sampler(char *ptr);
static int sampler_procctl(ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
static int sampler_procctl(s_ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
void __user *buffer, size_t *lenp, loff_t *fpos)
{
int ret;
Expand Down Expand Up @@ -1656,7 +1656,7 @@ static int sampler_procctl(ctl_table *ctl, int write, BEFORE2632(struct file *fi

#ifdef SNMP_RULES
static int add_snmp_rules(char *ptr);
static int snmp_procctl(ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
static int snmp_procctl(s_ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
void __user *buffer, size_t *lenp, loff_t *fpos)
{
int ret;
Expand All @@ -1681,7 +1681,7 @@ static void clear_ipt_netflow_stat(void)
}
}

static int flush_procctl(ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
static int flush_procctl(s_ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
void __user *buffer, size_t *lenp, loff_t *fpos)
{
int ret;
Expand Down Expand Up @@ -1710,7 +1710,7 @@ static int flush_procctl(ctl_table *ctl, int write, BEFORE2632(struct file *filp
return ret;
}

static int protocol_procctl(ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
static int protocol_procctl(s_ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
void __user *buffer, size_t *lenp, loff_t *fpos)
{
int ret;
Expand Down Expand Up @@ -1743,7 +1743,7 @@ static int protocol_procctl(ctl_table *ctl, int write, BEFORE2632(struct file *f
#ifdef CONFIG_NF_NAT_NEEDED
static void register_ct_events(void);
static void unregister_ct_events(void);
static int natevents_procctl(ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
static int natevents_procctl(s_ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
void __user *buffer, size_t *lenp, loff_t *fpos)
{
int ret;
Expand Down Expand Up @@ -1780,7 +1780,7 @@ static void ctl_table_renumber(ctl_table *table)
#define _CTL_NAME(x)
#define ctl_table_renumber(x)
#endif
static ctl_table netflow_sysctl_table[] = {
static ctl_table_no_const netflow_sysctl_table[] = {
{
.procname = "active_timeout",
.mode = 0644,
Expand Down Expand Up @@ -1908,7 +1908,9 @@ static ctl_table netflow_sysctl_table[] = {
.proc_handler = &natevents_procctl,
},
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
{ }
#endif
};

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
Expand Down