mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-21 20:14:56 +02:00
Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b4b0ab9ef4 | ||
![]() |
b20e02869e | ||
![]() |
ebd603b8fb | ||
![]() |
1945c545dd | ||
![]() |
7952a7d253 | ||
![]() |
c82da14d2b | ||
![]() |
9f1af79901 | ||
![]() |
50c4ee1a5e | ||
![]() |
351b040f4a | ||
![]() |
6ed735a810 | ||
![]() |
d643fc4b6c | ||
![]() |
0fe32e7443 |
@@ -47,7 +47,7 @@ all: ${targets}
|
|||||||
install: ${targets}
|
install: ${targets}
|
||||||
@for i in ${subdirs_list}; do ${MAKE} -C $$i $@; done;
|
@for i in ${subdirs_list}; do ${MAKE} -C $$i $@; done;
|
||||||
install -dm0755 "${DESTDIR}/${xtlibdir}";
|
install -dm0755 "${DESTDIR}/${xtlibdir}";
|
||||||
install -pm0755 $^ "${DESTDIR}/${xtlibdir}";
|
@for i in $^; do install -pm0755 $$i "${DESTDIR}/${xtlibdir}"; done;
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@for i in ${subdirs_list}; do ${MAKE} -C $$i $@; done;
|
@for i in ${subdirs_list}; do ${MAKE} -C $$i $@; done;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
AC_INIT([xtables-addons], [1.20])
|
AC_INIT([xtables-addons], [1.22])
|
||||||
AC_CONFIG_HEADERS([config.h])
|
AC_CONFIG_HEADERS([config.h])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
|
@@ -3,6 +3,20 @@ HEAD
|
|||||||
====
|
====
|
||||||
|
|
||||||
|
|
||||||
|
Xtables-addons 1.22 (January 22 2009)
|
||||||
|
=====================================
|
||||||
|
- compat_xtables: support for 2.6.33 skb_iif changes
|
||||||
|
- geoip: for FHS compliance use /usr/share/xt_geoip instead of /var/geoip
|
||||||
|
- ipset: enable build of ip_set_setlist.ko
|
||||||
|
- quota2: add the --no-change mode
|
||||||
|
|
||||||
|
|
||||||
|
Xtables-addons 1.21 (December 09 2009)
|
||||||
|
======================================
|
||||||
|
- ACCOUNT: avoid collision with arp_tables setsockopt numbers
|
||||||
|
- doc: fix option mismatch --gw/--gateway in libxt_TEE.man
|
||||||
|
|
||||||
|
|
||||||
Xtables-addons 1.20 (November 19 2009)
|
Xtables-addons 1.20 (November 19 2009)
|
||||||
======================================
|
======================================
|
||||||
- ipp2p: add more boundary checks
|
- ipp2p: add more boundary checks
|
||||||
|
@@ -15,8 +15,13 @@
|
|||||||
* Socket option interface shared between kernel (xt_ACCOUNT) and userspace
|
* Socket option interface shared between kernel (xt_ACCOUNT) and userspace
|
||||||
* library (libxt_ACCOUNT_cl). Hopefully we are unique at least within our
|
* library (libxt_ACCOUNT_cl). Hopefully we are unique at least within our
|
||||||
* kernel & xtables-addons space.
|
* kernel & xtables-addons space.
|
||||||
|
*
|
||||||
|
* Turned out often enough we are not.
|
||||||
|
* 64-67 used by ip_tables, ip6_tables
|
||||||
|
* 96-100 used by arp_tables
|
||||||
|
* 128-131 used by ebtables
|
||||||
*/
|
*/
|
||||||
#define SO_ACCOUNT_BASE_CTL 90
|
#define SO_ACCOUNT_BASE_CTL 70
|
||||||
|
|
||||||
#define IPT_SO_SET_ACCOUNT_HANDLE_FREE (SO_ACCOUNT_BASE_CTL + 1)
|
#define IPT_SO_SET_ACCOUNT_HANDLE_FREE (SO_ACCOUNT_BASE_CTL + 1)
|
||||||
#define IPT_SO_SET_ACCOUNT_HANDLE_FREE_ALL (SO_ACCOUNT_BASE_CTL + 2)
|
#define IPT_SO_SET_ACCOUNT_HANDLE_FREE_ALL (SO_ACCOUNT_BASE_CTL + 2)
|
||||||
|
@@ -25,9 +25,12 @@ static inline struct rtable *skb_rtable(const struct sk_buff *skb)
|
|||||||
# define skb_ifindex(skb) \
|
# define skb_ifindex(skb) \
|
||||||
(((skb)->input_dev != NULL) ? (skb)->input_dev->ifindex : 0)
|
(((skb)->input_dev != NULL) ? (skb)->input_dev->ifindex : 0)
|
||||||
# define skb_nfmark(skb) (((struct sk_buff *)(skb))->nfmark)
|
# define skb_nfmark(skb) (((struct sk_buff *)(skb))->nfmark)
|
||||||
#else
|
#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 32)
|
||||||
# define skb_ifindex(skb) (skb)->iif
|
# define skb_ifindex(skb) (skb)->iif
|
||||||
# define skb_nfmark(skb) (((struct sk_buff *)(skb))->mark)
|
# define skb_nfmark(skb) (((struct sk_buff *)(skb))->mark)
|
||||||
|
#else
|
||||||
|
# define skb_ifindex(skb) (skb)->skb_iif
|
||||||
|
# define skb_nfmark(skb) (((struct sk_buff *)(skb))->mark)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_NETWORK_SECMARK
|
#ifdef CONFIG_NETWORK_SECMARK
|
||||||
|
@@ -3,4 +3,4 @@
|
|||||||
obj-m += ipt_set.o ipt_SET.o
|
obj-m += ipt_set.o ipt_SET.o
|
||||||
obj-m += ip_set.o ip_set_ipmap.o ip_set_portmap.o ip_set_macipmap.o
|
obj-m += ip_set.o ip_set_ipmap.o ip_set_portmap.o ip_set_macipmap.o
|
||||||
obj-m += ip_set_iphash.o ip_set_nethash.o ip_set_ipporthash.o
|
obj-m += ip_set_iphash.o ip_set_nethash.o ip_set_ipporthash.o
|
||||||
obj-m += ip_set_iptree.o ip_set_iptreemap.o
|
obj-m += ip_set_iptree.o ip_set_iptreemap.o ip_set_setlist.o
|
||||||
|
@@ -51,7 +51,7 @@ static int tee_tg_parse(int c, char **argv, int invert, unsigned int *flags,
|
|||||||
case 'g':
|
case 'g':
|
||||||
if (*flags & FLAG_GATEWAY)
|
if (*flags & FLAG_GATEWAY)
|
||||||
xtables_error(PARAMETER_PROBLEM,
|
xtables_error(PARAMETER_PROBLEM,
|
||||||
"Cannot specify --gw more than once");
|
"Cannot specify --gateway more than once");
|
||||||
|
|
||||||
ia = xtables_numeric_to_ipaddr(optarg);
|
ia = xtables_numeric_to_ipaddr(optarg);
|
||||||
if (ia == NULL)
|
if (ia == NULL)
|
||||||
@@ -76,7 +76,7 @@ static int tee_tg6_parse(int c, char **argv, int invert, unsigned int *flags,
|
|||||||
case 'g':
|
case 'g':
|
||||||
if (*flags & FLAG_GATEWAY)
|
if (*flags & FLAG_GATEWAY)
|
||||||
xtables_error(PARAMETER_PROBLEM,
|
xtables_error(PARAMETER_PROBLEM,
|
||||||
"Cannot specify --gw more than once");
|
"Cannot specify --gateway more than once");
|
||||||
|
|
||||||
ia = xtables_numeric_to_ip6addr(optarg);
|
ia = xtables_numeric_to_ip6addr(optarg);
|
||||||
if (ia == NULL)
|
if (ia == NULL)
|
||||||
|
@@ -3,6 +3,10 @@ machine on the \fBlocal\fP network segment. In other words, the nexthop
|
|||||||
must be the target, or you will have to configure the nexthop to forward it
|
must be the target, or you will have to configure the nexthop to forward it
|
||||||
further if so desired.
|
further if so desired.
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-gw\fP \fIipaddr\fP
|
\fB\-\-gateway\fP \fIipaddr\fP
|
||||||
Send the cloned packet to the host reachable at the given IP address.
|
Send the cloned packet to the host reachable at the given IP address.
|
||||||
Use of 0.0.0.0 (for IPv4 packets) or :: (IPv6) is invalid.
|
Use of 0.0.0.0 (for IPv4 packets) or :: (IPv6) is invalid.
|
||||||
|
.PP
|
||||||
|
To forward all incoming traffic on eth0 to an Network Layer logging box:
|
||||||
|
.PP
|
||||||
|
\-t mangle \-A PREROUTING \-i eth0 \-j TEE \-\-gateway 2001:db8::1
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <xtables.h>
|
#include <xtables.h>
|
||||||
#include "xt_geoip.h"
|
#include "xt_geoip.h"
|
||||||
#define GEOIP_DB_DIR "/var/geoip"
|
#define GEOIP_DB_DIR "/usr/share/xt_geoip"
|
||||||
|
|
||||||
static void geoip_help(void)
|
static void geoip_help(void)
|
||||||
{
|
{
|
||||||
|
@@ -7,10 +7,11 @@ Match packet coming from (one of) the specified country(ies)
|
|||||||
Match packet going to (one of) the specified country(ies)
|
Match packet going to (one of) the specified country(ies)
|
||||||
.TP
|
.TP
|
||||||
NOTE:
|
NOTE:
|
||||||
The country is inputed by its ISO3166 code.
|
The country is inputed by its ISO-3166 code.
|
||||||
.P
|
.PP
|
||||||
The extra files you will need is the binary database files. They are generated
|
The extra files you will need is the binary database files. They are generated
|
||||||
from a country-subnet database with the geoip_csv_iv0.pl tool, available at
|
from a country-subnet database with the geoip_csv_iv0.pl tool, available at
|
||||||
http://jengelh.hopto.org/files/geoip/ . The files MUST be moved to /var/geoip/
|
http://jengelh.hopto.org/files/geoip/ . The files MUST be moved to
|
||||||
|
/usr/share/xt_geoip/
|
||||||
as the shared library is statically looking for this pathname (e.g.
|
as the shared library is statically looking for this pathname (e.g.
|
||||||
/var/geoip/LE/de.iv0).
|
/usr/share/xt_geoip/LE/de.iv0).
|
||||||
|
@@ -21,10 +21,12 @@ enum {
|
|||||||
FL_NAME = 1 << 1,
|
FL_NAME = 1 << 1,
|
||||||
FL_GROW = 1 << 2,
|
FL_GROW = 1 << 2,
|
||||||
FL_PACKET = 1 << 3,
|
FL_PACKET = 1 << 3,
|
||||||
|
FL_NO_CHANGE = 1 << 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct option quota_mt2_opts[] = {
|
static const struct option quota_mt2_opts[] = {
|
||||||
{.name = "grow", .has_arg = false, .val = 'g'},
|
{.name = "grow", .has_arg = false, .val = 'g'},
|
||||||
|
{.name = "no-change", .has_arg = false, .val = 'c'},
|
||||||
{.name = "name", .has_arg = true, .val = 'n'},
|
{.name = "name", .has_arg = true, .val = 'n'},
|
||||||
{.name = "quota", .has_arg = true, .val = 'q'},
|
{.name = "quota", .has_arg = true, .val = 'q'},
|
||||||
{.name = "packets", .has_arg = false, .val = 'p'},
|
{.name = "packets", .has_arg = false, .val = 'p'},
|
||||||
@@ -36,6 +38,7 @@ static void quota_mt2_help(void)
|
|||||||
printf(
|
printf(
|
||||||
"quota match options:\n"
|
"quota match options:\n"
|
||||||
" --grow provide an increasing counter\n"
|
" --grow provide an increasing counter\n"
|
||||||
|
" --no-change never change counter/quota value for matching packets\n"
|
||||||
" --name name name for the file in sysfs\n"
|
" --name name name for the file in sysfs\n"
|
||||||
"[!] --quota quota initial quota (bytes or packets)\n"
|
"[!] --quota quota initial quota (bytes or packets)\n"
|
||||||
" --packets count packets instead of bytes\n"
|
" --packets count packets instead of bytes\n"
|
||||||
@@ -56,6 +59,12 @@ quota_mt2_parse(int c, char **argv, int invert, unsigned int *flags,
|
|||||||
info->flags |= XT_QUOTA_GROW;
|
info->flags |= XT_QUOTA_GROW;
|
||||||
*flags |= FL_GROW;
|
*flags |= FL_GROW;
|
||||||
return true;
|
return true;
|
||||||
|
case 'c': /* no-change */
|
||||||
|
xtables_param_act(XTF_ONLY_ONCE, "quota", "--no-change", *flags & FL_NO_CHANGE);
|
||||||
|
xtables_param_act(XTF_NO_INVERT, "quota", "--no-change", invert);
|
||||||
|
info->flags |= XT_QUOTA_NO_CHANGE;
|
||||||
|
*flags |= FL_NO_CHANGE;
|
||||||
|
return true;
|
||||||
case 'n':
|
case 'n':
|
||||||
/* zero termination done on behalf of the kernel module */
|
/* zero termination done on behalf of the kernel module */
|
||||||
xtables_param_act(XTF_ONLY_ONCE, "quota", "--name", *flags & FL_NAME);
|
xtables_param_act(XTF_ONLY_ONCE, "quota", "--name", *flags & FL_NAME);
|
||||||
@@ -92,6 +101,8 @@ quota_mt2_save(const void *ip, const struct xt_entry_match *match)
|
|||||||
printf("! ");
|
printf("! ");
|
||||||
if (q->flags & XT_QUOTA_GROW)
|
if (q->flags & XT_QUOTA_GROW)
|
||||||
printf("--grow ");
|
printf("--grow ");
|
||||||
|
if (q->flags & XT_QUOTA_NO_CHANGE)
|
||||||
|
printf("--no-change ");
|
||||||
if (q->flags & XT_QUOTA_PACKET)
|
if (q->flags & XT_QUOTA_PACKET)
|
||||||
printf("--packets ");
|
printf("--packets ");
|
||||||
if (*q->name != '\0')
|
if (*q->name != '\0')
|
||||||
@@ -117,6 +128,8 @@ static void quota_mt2_print(const void *ip, const struct xt_entry_match *match,
|
|||||||
printf("packets ");
|
printf("packets ");
|
||||||
else
|
else
|
||||||
printf("bytes ");
|
printf("bytes ");
|
||||||
|
if (q->flags & XT_QUOTA_NO_CHANGE)
|
||||||
|
printf("(no-change mode) ");
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct xtables_match quota_mt2_reg = {
|
static struct xtables_match quota_mt2_reg = {
|
||||||
|
@@ -10,6 +10,12 @@ the match will return false, just like the original "quota" match. In growing
|
|||||||
\fB\-\-grow\fP
|
\fB\-\-grow\fP
|
||||||
Count upwards instead of downwards.
|
Count upwards instead of downwards.
|
||||||
.TP
|
.TP
|
||||||
|
\fB\-\-no\-change\fP
|
||||||
|
Makes it so the counter or quota amount is never changed by packets matching
|
||||||
|
this rule. This is only really useful in "quota" mode, as it will allow you to
|
||||||
|
use complex prerouting rules in association with the quota system, without
|
||||||
|
counting a packet twice.
|
||||||
|
.TP
|
||||||
\fB\-\-name\fP \fIname\fP
|
\fB\-\-name\fP \fIname\fP
|
||||||
Assign the counter a specific name. This option must be present, as an empty
|
Assign the counter a specific name. This option must be present, as an empty
|
||||||
name is not allowed. Names starting with a dot or names containing a slash are
|
name is not allowed. Names starting with a dot or names containing a slash are
|
||||||
|
@@ -175,7 +175,8 @@ tee_tg4(struct sk_buff **pskb, const struct xt_target_param *par)
|
|||||||
/*
|
/*
|
||||||
* Copy the skb, and route the copy. Will later return %XT_CONTINUE for
|
* Copy the skb, and route the copy. Will later return %XT_CONTINUE for
|
||||||
* the original skb, which should continue on its way as if nothing has
|
* the original skb, which should continue on its way as if nothing has
|
||||||
* happened. The copy should be independently delivered to the TEE --gw.
|
* happened. The copy should be independently delivered to the TEE
|
||||||
|
* --gateway.
|
||||||
*/
|
*/
|
||||||
skb = skb_copy(skb, GFP_ATOMIC);
|
skb = skb_copy(skb, GFP_ATOMIC);
|
||||||
if (skb == NULL) {
|
if (skb == NULL) {
|
||||||
|
@@ -5,4 +5,5 @@ config NETFILTER_XT_MATCH_QUOTA2
|
|||||||
This option adds the "quota2" match which is an advanced form of
|
This option adds the "quota2" match which is an advanced form of
|
||||||
xt_quota that also allows counting upwards, and where the counter can
|
xt_quota that also allows counting upwards, and where the counter can
|
||||||
be set through procfs. This allows for simple interfacing of
|
be set through procfs. This allows for simple interfacing of
|
||||||
accounting information.
|
accounting information. It also allows for a test mode without changing
|
||||||
|
the quota value.
|
||||||
|
@@ -199,11 +199,18 @@ quota_mt2(const struct sk_buff *skb, const struct xt_match_param *par)
|
|||||||
|
|
||||||
spin_lock_bh(&e->lock);
|
spin_lock_bh(&e->lock);
|
||||||
if (q->flags & XT_QUOTA_GROW) {
|
if (q->flags & XT_QUOTA_GROW) {
|
||||||
|
/*
|
||||||
|
* While no_change is pointless in "grow" mode, we will
|
||||||
|
* implement it here simply to have a consistent behavior.
|
||||||
|
*/
|
||||||
|
if (!(q->flags & XT_QUOTA_NO_CHANGE)) {
|
||||||
e->quota += (q->flags & XT_QUOTA_PACKET) ? 1 : skb->len;
|
e->quota += (q->flags & XT_QUOTA_PACKET) ? 1 : skb->len;
|
||||||
q->quota = e->quota;
|
q->quota = e->quota;
|
||||||
|
}
|
||||||
ret = true;
|
ret = true;
|
||||||
} else {
|
} else {
|
||||||
if (e->quota >= skb->len) {
|
if (e->quota >= skb->len) {
|
||||||
|
if (!(q->flags & XT_QUOTA_NO_CHANGE))
|
||||||
e->quota -= (q->flags & XT_QUOTA_PACKET) ? 1 : skb->len;
|
e->quota -= (q->flags & XT_QUOTA_PACKET) ? 1 : skb->len;
|
||||||
ret = !ret;
|
ret = !ret;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -5,7 +5,8 @@ enum xt_quota_flags {
|
|||||||
XT_QUOTA_INVERT = 1 << 0,
|
XT_QUOTA_INVERT = 1 << 0,
|
||||||
XT_QUOTA_GROW = 1 << 1,
|
XT_QUOTA_GROW = 1 << 1,
|
||||||
XT_QUOTA_PACKET = 1 << 2,
|
XT_QUOTA_PACKET = 1 << 2,
|
||||||
XT_QUOTA_MASK = 0x7,
|
XT_QUOTA_NO_CHANGE = 1 << 3,
|
||||||
|
XT_QUOTA_MASK = 0x0F,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct xt_quota_counter;
|
struct xt_quota_counter;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
.TH xtables-addons 8 "v1.20 (2009-11-19)" "" "v1.20 (2009-11-19)"
|
.TH xtables-addons 8 "v1.22 (2010-01-22)" "" "v1.22 (2010-11-22)"
|
||||||
.SH Name
|
.SH Name
|
||||||
Xtables-addons \(em additional extensions for iptables, ip6tables, etc.
|
Xtables-addons \(em additional extensions for iptables, ip6tables, etc.
|
||||||
.SH Targets
|
.SH Targets
|
||||||
|
Reference in New Issue
Block a user