]> git.ipfire.org Git - thirdparty/xtables-addons.git/commitdiff
TARPIT: move XTTARPIT_RESET to its own function
authorJosh Hunt <johunt@akamai.com>
Sun, 8 Jul 2012 18:11:22 +0000 (11:11 -0700)
committerJan Engelhardt <jengelh@inai.de>
Sun, 8 Jul 2012 18:51:46 +0000 (20:51 +0200)
Moves XTTARPIT_RESET into its own function.

Signed-off-by: Josh Hunt <johunt@akamai.com>
extensions/xt_TARPIT.c

index 93e5540fc1b1f032258a4f0f8f261640cf20e86d..2499af20e0088aa1dcb09e51fb09af990375d0ba 100644 (file)
@@ -132,6 +132,16 @@ static bool xttarpit_honeypot(struct tcphdr *tcph, const struct tcphdr *oth,
        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,
     unsigned int mode)
 {
@@ -205,12 +215,7 @@ static void tarpit_tcp(struct sk_buff *oldskb, unsigned int hook,
                if (!xttarpit_honeypot(tcph, oth, 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;
+               xttarpit_reset(tcph, oth);
        }
 
        /* Adjust TCP checksum */