~arges/ubuntu/quantal/iptables/fix-lp982961

« back to all changes in this revision

Viewing changes to debian/patches/0001-libxt_recent-Add-support-for-reap-option.patch

  • Committer: Package Import Robot
  • Author(s): Jamie Strandboge
  • Date: 2012-07-20 15:45:01 UTC
  • mfrom: (2.1.22 sid)
  • Revision ID: package-import@ubuntu.com-20120720154501-9p499tpv3uuh3s4n
Tags: 1.4.12-2ubuntu1
* Merge from Debian unstable. Remaining changes:
  - 9000-howtos.patch: add howtos/ and install them
  - 9001-Fixed-FTBS-by-copying-linux-types.h-from-linux-3.2.patch: Fix FTBS
    against linux 3.2 headers
  - 9002-libxt_recent-Add-support-for-reap-option.patch: add --reap support.
    Merge in changes from 1.4.12-1ubuntu4 into this patch
  - debian/control: Build-Depends on linuxdoc-tools
  - debian/iptables.install: install NAT and packetfilter howtos into
    /usr/share/doc
  - debian/iptables-dev.install: install netfilter howto into /usr/share/doc
  - debian/iptables-dev.doc-base.netfilter-extensions,
    debian/iptables-dev.doc-base.netfilter-hacking,
    debian/iptables.doc-base.nat, debian/iptables.doc-base.packet-filter: add
    howtos
* Drop libipq support since it has been obsoleted in 3.5 and later kernels.
  Per upstream, users of libipq should transition to nfnetlink_queue (from
  libnfnetlink0) instead. (LP: #1020598)
  - debian/control: remove reference to libipq
  - debian/rules: compile with --disable-libipq
  - debian/iptables.lintian-overrides: remove reference to libipq0
  - debian/iptables-dev.install: remove usr/share/man/man3 only used with
    libipq manpages
  - dropped 9001-build-libipq_pic.la.patch, no longer required
* 9003-lp1020490.patch: fix --ctproto 0 output (LP: #1020490)
* 9004-argv-is-null.patch: ip(6)tables-restore: make sure argv is NULL
  terminated
* debian/patches/9005-lp1027252-fixrestore.patch: fix iptables-restore with
  gcc-4.7 and -O1 or higher (LP: #1027252)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From 79ddbf202a06e6f018e087a328c2ca91e65a8463 Mon Sep 17 00:00:00 2001
2
 
From: Tim Gardner <tim.gardner@canonical.com>
3
 
Date: Wed, 30 Nov 2011 08:16:53 -0700
4
 
Subject: [PATCH] libxt_recent: Add support for --reap option
5
 
 
6
 
Support for the reap option was merged in the kernel as of 2.6.35.
7
 
 
8
 
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
9
 
Cc: Jan Engelhardt <jengelh@medozas.de>
10
 
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
11
 
---
12
 
 extensions/libxt_recent.c   |   17 ++++++++++++++++-
13
 
 extensions/libxt_recent.man |    5 +++++
14
 
 2 files changed, 21 insertions(+), 1 deletions(-)
15
 
 
16
 
diff --git a/extensions/libxt_recent.c b/extensions/libxt_recent.c
17
 
index 1e1a111..c7dce4e 100644
18
 
--- a/extensions/libxt_recent.c
19
 
+++ b/extensions/libxt_recent.c
20
 
@@ -10,6 +10,7 @@ enum {
21
 
        O_UPDATE,
22
 
        O_REMOVE,
23
 
        O_SECONDS,
24
 
+       O_REAP,
25
 
        O_HITCOUNT,
26
 
        O_RTTL,
27
 
        O_NAME,
28
 
@@ -19,6 +20,7 @@ enum {
29
 
        F_RCHECK = 1 << O_RCHECK,
30
 
        F_UPDATE = 1 << O_UPDATE,
31
 
        F_REMOVE = 1 << O_REMOVE,
32
 
+       F_SECONDS = 1 << O_SECONDS,
33
 
        F_ANY_OP = F_SET | F_RCHECK | F_UPDATE | F_REMOVE,
34
 
 };
35
 
 
36
 
@@ -33,7 +35,9 @@ static const struct xt_option_entry recent_opts[] = {
37
 
        {.name = "remove", .id = O_REMOVE, .type = XTTYPE_NONE,
38
 
         .excl = F_ANY_OP, .flags = XTOPT_INVERT},
39
 
        {.name = "seconds", .id = O_SECONDS, .type = XTTYPE_UINT32,
40
 
-        .flags = XTOPT_PUT, XTOPT_POINTER(s, seconds)},
41
 
+        .flags = XTOPT_PUT, XTOPT_POINTER(s, seconds), .min = 1},
42
 
+       {.name = "reap", .id = O_REAP, .type = XTTYPE_NONE,
43
 
+        .also = F_SECONDS },
44
 
        {.name = "hitcount", .id = O_HITCOUNT, .type = XTTYPE_UINT32,
45
 
         .flags = XTOPT_PUT, XTOPT_POINTER(s, hit_count)},
46
 
        {.name = "rttl", .id = O_RTTL, .type = XTTYPE_NONE,
47
 
@@ -57,6 +61,8 @@ static void recent_help(void)
48
 
 "    --seconds seconds           For check and update commands above.\n"
49
 
 "                                Specifies that the match will only occur if source address last seen within\n"
50
 
 "                                the last 'seconds' seconds.\n"
51
 
+"    --reap                      Purge entries older then 'seconds'.\n"
52
 
+"                                Can only be used in conjunction with the seconds option.\n"
53
 
 "    --hitcount hits             For check and update commands above.\n"
54
 
 "                                Specifies that the match will only occur if source address seen hits times.\n"
55
 
 "                                May be used in conjunction with the seconds option.\n"
56
 
@@ -117,11 +123,16 @@ static void recent_parse(struct xt_option_call *cb)
57
 
        case O_RDEST:
58
 
                info->side = XT_RECENT_DEST;
59
 
                break;
60
 
+       case O_REAP:
61
 
+               info->check_set |= XT_RECENT_REAP;
62
 
+               break;
63
 
        }
64
 
 }
65
 
 
66
 
 static void recent_check(struct xt_fcheck_call *cb)
67
 
 {
68
 
+       struct xt_recent_mtinfo *info = cb->data;
69
 
+
70
 
        if (!(cb->xflags & F_ANY_OP))
71
 
                xtables_error(PARAMETER_PROBLEM,
72
 
                        "recent: you must specify one of `--set', `--rcheck' "
73
 
@@ -146,6 +157,8 @@ static void recent_print(const void *ip, const struct xt_entry_match *match,
74
 
        if (info->check_set & XT_RECENT_REMOVE)
75
 
                printf(" REMOVE");
76
 
        if(info->seconds) printf(" seconds: %d", info->seconds);
77
 
+       if (info->check_set & XT_RECENT_REAP)
78
 
+               printf(" reap");
79
 
        if(info->hit_count) printf(" hit_count: %d", info->hit_count);
80
 
        if (info->check_set & XT_RECENT_TTL)
81
 
                printf(" TTL-Match");
82
 
@@ -172,6 +185,8 @@ static void recent_save(const void *ip, const struct xt_entry_match *match)
83
 
        if (info->check_set & XT_RECENT_REMOVE)
84
 
                printf(" --remove");
85
 
        if(info->seconds) printf(" --seconds %d", info->seconds);
86
 
+       if (info->check_set & XT_RECENT_REAP)
87
 
+               printf(" --reap");
88
 
        if(info->hit_count) printf(" --hitcount %d", info->hit_count);
89
 
        if (info->check_set & XT_RECENT_TTL)
90
 
                printf(" --rttl");
91
 
diff --git a/extensions/libxt_recent.man b/extensions/libxt_recent.man
92
 
index 0392c2c..8043df4 100644
93
 
--- a/extensions/libxt_recent.man
94
 
+++ b/extensions/libxt_recent.man
95
 
@@ -41,6 +41,11 @@ This option must be used in conjunction with one of \fB\-\-rcheck\fP or
96
 
 \fB\-\-update\fP. When used, this will narrow the match to only happen when the
97
 
 address is in the list and was seen within the last given number of seconds.
98
 
 .TP
99
 
+\fB\-\-reap\fP
100
 
+This option can only be used in conjunction with \fB\-\-seconds\fP.
101
 
+When used, this will cause entries older than the last given number of seconds
102
 
+to be purged.
103
 
+.TP
104
 
 \fB\-\-hitcount\fP \fIhits\fP
105
 
 This option must be used in conjunction with one of \fB\-\-rcheck\fP or
106
 
 \fB\-\-update\fP. When used, this will narrow the match to only happen when the
107
 
1.7.0.4
108