mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-06 20:55:13 +02:00
TARPIT: move XTTARPIT_RESET to its own function
Moves XTTARPIT_RESET into its own function. Signed-off-by: Josh Hunt <johunt@akamai.com>
This commit is contained in:

committed by
Jan Engelhardt

parent
a9f383daf8
commit
48fbc6783e
@@ -132,6 +132,16 @@ static bool xttarpit_honeypot(struct tcphdr *tcph, const struct tcphdr *oth,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void xttarpit_reset(struct tcphdr *tcph, const struct tcphdr *oth)
|
||||||
|
{
|
||||||
|
tcph->window = 0;
|
||||||
|
tcph->ack = false;
|
||||||
|
tcph->syn = false;
|
||||||
|
tcph->rst = true;
|
||||||
|
tcph->seq = oth->ack_seq;
|
||||||
|
tcph->ack_seq = oth->seq;
|
||||||
|
}
|
||||||
|
|
||||||
static void tarpit_tcp(struct sk_buff *oldskb, unsigned int hook,
|
static void tarpit_tcp(struct sk_buff *oldskb, unsigned int hook,
|
||||||
unsigned int mode)
|
unsigned int mode)
|
||||||
{
|
{
|
||||||
@@ -205,12 +215,7 @@ static void tarpit_tcp(struct sk_buff *oldskb, unsigned int hook,
|
|||||||
if (!xttarpit_honeypot(tcph, oth, payload))
|
if (!xttarpit_honeypot(tcph, oth, payload))
|
||||||
return;
|
return;
|
||||||
} else if (mode == XTTARPIT_RESET) {
|
} else if (mode == XTTARPIT_RESET) {
|
||||||
tcph->window = 0;
|
xttarpit_reset(tcph, oth);
|
||||||
tcph->ack = false;
|
|
||||||
tcph->syn = false;
|
|
||||||
tcph->rst = true;
|
|
||||||
tcph->seq = oth->ack_seq;
|
|
||||||
tcph->ack_seq = oth->seq;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Adjust TCP checksum */
|
/* Adjust TCP checksum */
|
||||||
|
Reference in New Issue
Block a user