mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-07 21:25:12 +02:00
build: remove support for Linux 2.6.23
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
#ifndef XTA_COMPAT_RAWPOST_H
|
||||
#define XTA_COMPAT_RAWPOST_H 1
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
|
||||
typedef struct sk_buff sk_buff_t;
|
||||
#else
|
||||
typedef struct sk_buff *sk_buff_t;
|
||||
#endif
|
||||
|
||||
#endif /* XTA_COMPAT_RAWPOST_H */
|
||||
|
@@ -213,16 +213,10 @@ void xtnu_unregister_matches(struct xtnu_match *nt, unsigned int num)
|
||||
EXPORT_SYMBOL_GPL(xtnu_unregister_matches);
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23)
|
||||
static unsigned int xtnu_target_run(struct sk_buff **pskb,
|
||||
const struct net_device *in, const struct net_device *out,
|
||||
unsigned int hooknum, const struct xt_target *ct, const void *targinfo)
|
||||
#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
|
||||
static unsigned int xtnu_target_run(struct sk_buff *skb,
|
||||
const struct net_device *in, const struct net_device *out,
|
||||
unsigned int hooknum, const struct xt_target *ct, const void *targinfo)
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
|
||||
{
|
||||
struct xtnu_target *nt = xtcompat_nutarget(ct);
|
||||
struct xt_action_param local_par;
|
||||
@@ -235,11 +229,7 @@ static unsigned int xtnu_target_run(struct sk_buff *skb,
|
||||
local_par.family = NFPROTO_UNSPEC;
|
||||
|
||||
if (nt != NULL && nt->target != NULL)
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23)
|
||||
return nt->target(pskb, &local_par);
|
||||
#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
|
||||
return nt->target(&skb, &local_par);
|
||||
#endif
|
||||
return XT_CONTINUE;
|
||||
}
|
||||
#endif
|
||||
@@ -425,21 +415,13 @@ EXPORT_SYMBOL_GPL(xtnu_request_find_match);
|
||||
|
||||
int xtnu_ip_route_me_harder(struct sk_buff **pskb, unsigned int addr_type)
|
||||
{
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23)
|
||||
return ip_route_me_harder(pskb, addr_type);
|
||||
#else
|
||||
return ip_route_me_harder(*pskb, addr_type);
|
||||
#endif
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(xtnu_ip_route_me_harder);
|
||||
|
||||
int xtnu_skb_make_writable(struct sk_buff **pskb, unsigned int len)
|
||||
{
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23)
|
||||
return skb_make_writable(pskb, len);
|
||||
#else
|
||||
return skb_make_writable(*pskb, len);
|
||||
#endif
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(xtnu_skb_make_writable);
|
||||
|
||||
@@ -465,28 +447,6 @@ int xtnu_ip_local_out(struct sk_buff *skb)
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(xtnu_ip_local_out);
|
||||
#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23)
|
||||
static int __xtnu_ip_local_out(struct sk_buff **pskb)
|
||||
{
|
||||
struct iphdr *iph = ip_hdr(*pskb);
|
||||
|
||||
iph->tot_len = htons((*pskb)->len);
|
||||
ip_send_check(iph);
|
||||
return nf_hook(PF_INET, NF_IP_LOCAL_OUT, pskb, NULL,
|
||||
(*pskb)->dst->dev, dst_output);
|
||||
}
|
||||
|
||||
int xtnu_ip_local_out(struct sk_buff *skb)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = __xtnu_ip_local_out(&skb);
|
||||
if (likely(err == 1))
|
||||
err = dst_output(skb);
|
||||
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(xtnu_ip_local_out);
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 24)
|
||||
|
@@ -8,8 +8,8 @@
|
||||
|
||||
#define DEBUGP Use__pr_debug__instead
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)
|
||||
# warning Kernels below 2.6.23 not supported.
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
|
||||
# warning Kernels below 2.6.24 not supported.
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
|
||||
@@ -32,15 +32,6 @@
|
||||
# include "compat_nfinetaddr.h"
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23)
|
||||
# define init_net xtnu_ip_route_output_key /* yes */
|
||||
# define init_net__loopback_dev (&loopback_dev)
|
||||
# define init_net__proc_net proc_net
|
||||
#else
|
||||
# define init_net__loopback_dev init_net.loopback_dev
|
||||
# define init_net__proc_net init_net.proc_net
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 34)
|
||||
# define xt_match xtnu_match
|
||||
# define xt_register_match xtnu_register_match
|
||||
|
@@ -776,9 +776,7 @@ has_secret(const unsigned char *secret, unsigned int secret_len, uint32_t ipsrc,
|
||||
|
||||
epoch_min = get_seconds() / 60;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
|
||||
sg_init_table(sg, ARRAY_SIZE(sg));
|
||||
#endif
|
||||
sg_set_buf(&sg[0], &ipsrc, sizeof(ipsrc));
|
||||
sg_set_buf(&sg[1], &epoch_min, sizeof(epoch_min));
|
||||
|
||||
@@ -1150,7 +1148,7 @@ static int __init xt_pknock_mt_init(void)
|
||||
crypto.desc.tfm = crypto.tfm;
|
||||
crypto.desc.flags = 0;
|
||||
|
||||
pde = proc_mkdir("xt_pknock", init_net__proc_net);
|
||||
pde = proc_mkdir("xt_pknock", init_net.proc_net);
|
||||
if (pde == NULL) {
|
||||
printk(KERN_ERR PKNOCK "proc_mkdir() error in _init().\n");
|
||||
return -ENXIO;
|
||||
@@ -1160,7 +1158,7 @@ static int __init xt_pknock_mt_init(void)
|
||||
|
||||
static void __exit xt_pknock_mt_exit(void)
|
||||
{
|
||||
remove_proc_entry("xt_pknock", init_net__proc_net);
|
||||
remove_proc_entry("xt_pknock", init_net.proc_net);
|
||||
xt_unregister_match(&xt_pknock_mt_reg);
|
||||
kfree(rule_hashtable);
|
||||
if (crypto.tfm != NULL)
|
||||
|
@@ -90,9 +90,7 @@ xt_chaos_total(struct sk_buff *skb, const struct xt_action_param *par)
|
||||
return;
|
||||
|
||||
destiny = (info->variant == XTCHAOS_TARPIT) ? xt_tarpit : xt_delude;
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23)
|
||||
destiny->target(&skb, par->in, par->out, par->hooknum, destiny, NULL);
|
||||
#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
|
||||
destiny->target(skb, par->in, par->out, par->hooknum, destiny, NULL);
|
||||
#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 34)
|
||||
{
|
||||
@@ -136,10 +134,7 @@ chaos_tg(struct sk_buff **pskb, const struct xt_action_param *par)
|
||||
const struct iphdr *iph = ip_hdr(skb);
|
||||
|
||||
if ((unsigned int)net_random() <= reject_percentage) {
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23)
|
||||
return xt_reject->target(pskb, par->in, par->out, par->hooknum,
|
||||
xt_reject, &reject_params);
|
||||
#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
|
||||
return xt_reject->target(skb, par->in, par->out, par->hooknum,
|
||||
xt_reject, &reject_params);
|
||||
#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 34)
|
||||
|
@@ -119,9 +119,7 @@ static unsigned int sysrq_tg(const void *pdata, uint16_t len)
|
||||
ret = crypto_hash_init(&desc);
|
||||
if (ret != 0)
|
||||
goto hash_fail;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
|
||||
sg_init_table(sg, 2);
|
||||
#endif
|
||||
sg_set_buf(&sg[0], data, n);
|
||||
i = strlen(sysrq_digest_password);
|
||||
sg_set_buf(&sg[1], sysrq_digest_password, i);
|
||||
|
@@ -67,11 +67,7 @@ tee_tg_route4(struct sk_buff *skb, const struct xt_tee_tginfo *info)
|
||||
|
||||
static inline bool dev_hh_avail(const struct net_device *dev)
|
||||
{
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23)
|
||||
return dev->hard_header != NULL;
|
||||
#else
|
||||
return dev->header_ops != NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -211,13 +211,13 @@ static int __init condition_mt_init(void)
|
||||
int ret;
|
||||
|
||||
mutex_init(&proc_lock);
|
||||
proc_net_condition = proc_mkdir(dir_name, init_net__proc_net);
|
||||
proc_net_condition = proc_mkdir(dir_name, init_net.proc_net);
|
||||
if (proc_net_condition == NULL)
|
||||
return -EACCES;
|
||||
|
||||
ret = xt_register_matches(condition_mt_reg, ARRAY_SIZE(condition_mt_reg));
|
||||
if (ret < 0) {
|
||||
remove_proc_entry(dir_name, init_net__proc_net);
|
||||
remove_proc_entry(dir_name, init_net.proc_net);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ static int __init condition_mt_init(void)
|
||||
static void __exit condition_mt_exit(void)
|
||||
{
|
||||
xt_unregister_matches(condition_mt_reg, ARRAY_SIZE(condition_mt_reg));
|
||||
remove_proc_entry(dir_name, init_net__proc_net);
|
||||
remove_proc_entry(dir_name, init_net.proc_net);
|
||||
}
|
||||
|
||||
module_init(condition_mt_init);
|
||||
|
@@ -48,11 +48,7 @@ static const struct net_device *iface_get(const struct xt_iface_mtinfo *info,
|
||||
return par->in;
|
||||
else if (info->flags & XT_IFACE_DEV_OUT)
|
||||
return par->out;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
|
||||
return *put = dev_get_by_name(&init_net, info->ifname);
|
||||
#else
|
||||
return *put = dev_get_by_name(info->ifname);
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool iface_flagtest(unsigned int devflags, unsigned int flags,
|
||||
|
@@ -204,7 +204,7 @@ lscan_mt(const struct sk_buff *skb, struct xt_action_param *par)
|
||||
unsigned int n;
|
||||
|
||||
n = lscan_mt_full(ctdata->mark & connmark_mask, ctstate,
|
||||
par->in == init_net__loopback_dev, tcph,
|
||||
par->in == init_net.loopback_dev, tcph,
|
||||
skb->len - par->thoff - 4 * tcph->doff);
|
||||
|
||||
ctdata->mark = (ctdata->mark & ~connmark_mask) | n;
|
||||
|
@@ -250,20 +250,20 @@ static int __init quota_mt2_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
proc_xt_quota = proc_mkdir("xt_quota", init_net__proc_net);
|
||||
proc_xt_quota = proc_mkdir("xt_quota", init_net.proc_net);
|
||||
if (proc_xt_quota == NULL)
|
||||
return -EACCES;
|
||||
|
||||
ret = xt_register_matches(quota_mt2_reg, ARRAY_SIZE(quota_mt2_reg));
|
||||
if (ret < 0)
|
||||
remove_proc_entry("xt_quota", init_net__proc_net);
|
||||
remove_proc_entry("xt_quota", init_net.proc_net);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void __exit quota_mt2_exit(void)
|
||||
{
|
||||
xt_unregister_matches(quota_mt2_reg, ARRAY_SIZE(quota_mt2_reg));
|
||||
remove_proc_entry("xt_quota", init_net__proc_net);
|
||||
remove_proc_entry("xt_quota", init_net.proc_net);
|
||||
}
|
||||
|
||||
module_init(quota_mt2_init);
|
||||
|
Reference in New Issue
Block a user