mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-06 20:55:13 +02:00
build: resolve compile error with Linux 3.13
net_random has been removed in commit v3.14-rc1~94^2~191 and replaced by its definition, prandom_u32. prandom_u32 was only introduced in v3.8-rc1~74^2~22, so we will have an extra ifdef for 3.7 support.
This commit is contained in:
@@ -12,6 +12,10 @@
|
||||
# warning Kernels below 3.7 not supported.
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
|
||||
# define prandom_u32() random32()
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
|
||||
# if !defined(CONFIG_NF_CONNTRACK_MARK)
|
||||
# warning You have CONFIG_NF_CONNTRACK enabled, but CONFIG_NF_CONNTRACK_MARK is not (please enable).
|
||||
|
@@ -68,7 +68,7 @@ xt_chaos_total(struct sk_buff *skb, const struct xt_action_param *par)
|
||||
ret = xm_tcp->match(skb, &local_par);
|
||||
hotdrop = local_par.hotdrop;
|
||||
}
|
||||
if (!ret || hotdrop || (unsigned int)net_random() > delude_percentage)
|
||||
if (!ret || hotdrop || (unsigned int)prandom_u32() > delude_percentage)
|
||||
return;
|
||||
|
||||
destiny = (info->variant == XTCHAOS_TARPIT) ? xt_tarpit : xt_delude;
|
||||
@@ -98,7 +98,7 @@ chaos_tg(struct sk_buff *skb, const struct xt_action_param *par)
|
||||
const struct xt_chaos_tginfo *info = par->targinfo;
|
||||
const struct iphdr *iph = ip_hdr(skb);
|
||||
|
||||
if ((unsigned int)net_random() <= reject_percentage) {
|
||||
if ((unsigned int)prandom_u32() <= reject_percentage) {
|
||||
struct xt_action_param local_par;
|
||||
local_par.in = par->in;
|
||||
local_par.out = par->out;
|
||||
|
@@ -107,8 +107,8 @@ static bool xttarpit_honeypot(struct tcphdr *tcph, const struct tcphdr *oth,
|
||||
tcph->syn = true;
|
||||
tcph->ack = true;
|
||||
tcph->window = oth->window &
|
||||
((net_random() & 0x1f) - 0xf);
|
||||
tcph->seq = htonl(net_random() & ~oth->seq);
|
||||
((prandom_u32() & 0x1f) - 0xf);
|
||||
tcph->seq = htonl(prandom_u32() & ~oth->seq);
|
||||
tcph->ack_seq = htonl(ntohl(oth->seq) + oth->syn);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ static bool xttarpit_honeypot(struct tcphdr *tcph, const struct tcphdr *oth,
|
||||
tcph->syn = false;
|
||||
tcph->ack = true;
|
||||
tcph->window = oth->window &
|
||||
((net_random() & 0x1f) - 0xf);
|
||||
((prandom_u32() & 0x1f) - 0xf);
|
||||
tcph->ack_seq = payload > 100 ?
|
||||
htonl(ntohl(oth->seq) + payload) :
|
||||
oth->seq;
|
||||
|
Reference in New Issue
Block a user