Comments
Patch
@@ -133,6 +133,19 @@ static bool xttarpit_honeypot(struct tcphdr *oth, struct tcphdr *tcph,
return true;
}
+static bool xttarpit_reset(struct tcphdr *oth, struct tcphdr *tcph)
+{
+
+ tcph->window = 0;
+ tcph->ack = false;
+ tcph->syn = false;
+ tcph->rst = true;
+ tcph->seq = oth->ack_seq;
+ tcph->ack_seq = oth->seq;
+
+ return true;
+}
+
static void tarpit_tcp(struct sk_buff *oldskb, unsigned int hook,
unsigned int mode)
{
@@ -205,12 +218,8 @@ static void tarpit_tcp(struct sk_buff *oldskb, unsigned int hook,
if (!xttarpit_honeypot(oth, tcph, payload))
return;
} else if (mode == XTTARPIT_RESET) {
- tcph->window = 0;
- tcph->ack = false;
- tcph->syn = false;
- tcph->rst = true;
- tcph->seq = oth->ack_seq;
- tcph->ack_seq = oth->seq;
+ if (!xttarpit_reset(oth, tcph))
+ return;
}
/* Adjust TCP checksum */
Moves XTTARPIT_RESET into its own function. Signed-off-by: Josh Hunt <johunt@akamai.com> --- extensions/xt_TARPIT.c | 21 +++++++++++++++------ 1 files changed, 15 insertions(+), 6 deletions(-)