mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-21 20:14:56 +02:00
Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
85cab10371 | ||
![]() |
61d8425cb6 | ||
![]() |
d49b6244c1 | ||
![]() |
10c2b97786 | ||
![]() |
9ed364ed36 | ||
![]() |
b95e5f6417 | ||
![]() |
4afebf88eb | ||
![]() |
d523158e92 | ||
![]() |
1fd1787a1c | ||
![]() |
fbbca68790 | ||
![]() |
4cdfd49637 | ||
![]() |
31c01cf107 | ||
![]() |
879e964f60 | ||
![]() |
019c9de291 | ||
![]() |
af370f81f0 | ||
![]() |
4aad07bdc4 | ||
![]() |
7a3f874753 | ||
![]() |
f77a8e2eda |
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
AC_INIT([xtables-addons], [1.7])
|
AC_INIT([xtables-addons], [1.8])
|
||||||
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
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* "TEE" target extension for iptables
|
* "TEE" target extension for iptables
|
||||||
* Copyright © Sebastian Claßen <sebastian.classen [at] freenet.ag>, 2007
|
* Copyright © Sebastian Claßen <sebastian.classen [at] freenet.ag>, 2007
|
||||||
* Jan Engelhardt <jengelh [at] medozas de>, 2007 - 2008
|
* Jan Engelhardt <jengelh [at] medozas de>, 2007 - 2009
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License; either
|
* modify it under the terms of the GNU General Public License; either
|
||||||
@@ -70,6 +70,35 @@ static int tee_tg_parse(int c, char **argv, int invert, unsigned int *flags,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int tee_tg6_parse(int c, char **argv, int invert, unsigned int *flags,
|
||||||
|
const void *entry, struct xt_entry_target **target)
|
||||||
|
{
|
||||||
|
struct xt_tee_tginfo *info = (void *)(*target)->data;
|
||||||
|
const struct in6_addr *ia;
|
||||||
|
|
||||||
|
switch (c) {
|
||||||
|
case 'g':
|
||||||
|
if (*flags & FLAG_GATEWAY)
|
||||||
|
exit_error(PARAMETER_PROBLEM,
|
||||||
|
"Cannot specify --gw more than once");
|
||||||
|
|
||||||
|
if (check_inverse(optarg, &invert, NULL, 0))
|
||||||
|
exit_error(PARAMETER_PROBLEM,
|
||||||
|
"Unexpected \"!\" after --gateway");
|
||||||
|
|
||||||
|
ia = numeric_to_ip6addr(optarg);
|
||||||
|
if (ia == NULL)
|
||||||
|
exit_error(PARAMETER_PROBLEM,
|
||||||
|
"Invalid IP address %s", optarg);
|
||||||
|
|
||||||
|
memcpy(&info->gw, ia, sizeof(*ia));
|
||||||
|
*flags |= FLAG_GATEWAY;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static void tee_tg_check(unsigned int flags)
|
static void tee_tg_check(unsigned int flags)
|
||||||
{
|
{
|
||||||
if (flags == 0)
|
if (flags == 0)
|
||||||
@@ -83,9 +112,20 @@ static void tee_tg_print(const void *ip, const struct xt_entry_target *target,
|
|||||||
const struct xt_tee_tginfo *info = (const void *)target->data;
|
const struct xt_tee_tginfo *info = (const void *)target->data;
|
||||||
|
|
||||||
if (numeric)
|
if (numeric)
|
||||||
printf("TEE gw:%s ", ipaddr_to_anyname(&info->gw.in));
|
|
||||||
else
|
|
||||||
printf("TEE gw:%s ", ipaddr_to_numeric(&info->gw.in));
|
printf("TEE gw:%s ", ipaddr_to_numeric(&info->gw.in));
|
||||||
|
else
|
||||||
|
printf("TEE gw:%s ", ipaddr_to_anyname(&info->gw.in));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void tee_tg6_print(const void *ip, const struct xt_entry_target *target,
|
||||||
|
int numeric)
|
||||||
|
{
|
||||||
|
const struct xt_tee_tginfo *info = (const void *)target->data;
|
||||||
|
|
||||||
|
if (numeric)
|
||||||
|
printf("TEE gw:%s ", ip6addr_to_numeric(&info->gw.in6));
|
||||||
|
else
|
||||||
|
printf("TEE gw:%s ", ip6addr_to_anyname(&info->gw.in6));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tee_tg_save(const void *ip, const struct xt_entry_target *target)
|
static void tee_tg_save(const void *ip, const struct xt_entry_target *target)
|
||||||
@@ -95,9 +135,18 @@ static void tee_tg_save(const void *ip, const struct xt_entry_target *target)
|
|||||||
printf("--gateway %s ", ipaddr_to_numeric(&info->gw.in));
|
printf("--gateway %s ", ipaddr_to_numeric(&info->gw.in));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void tee_tg6_save(const void *ip, const struct xt_entry_target *target)
|
||||||
|
{
|
||||||
|
const struct xt_tee_tginfo *info = (const void *)target->data;
|
||||||
|
|
||||||
|
printf("--gateway %s ", ip6addr_to_numeric(&info->gw.in6));
|
||||||
|
}
|
||||||
|
|
||||||
static struct xtables_target tee_tg_reg = {
|
static struct xtables_target tee_tg_reg = {
|
||||||
.name = "TEE",
|
.name = "TEE",
|
||||||
.version = XTABLES_VERSION,
|
.version = XTABLES_VERSION,
|
||||||
|
.revision = 0,
|
||||||
|
.family = PF_INET,
|
||||||
.size = XT_ALIGN(sizeof(struct xt_tee_tginfo)),
|
.size = XT_ALIGN(sizeof(struct xt_tee_tginfo)),
|
||||||
.userspacesize = XT_ALIGN(sizeof(struct xt_tee_tginfo)),
|
.userspacesize = XT_ALIGN(sizeof(struct xt_tee_tginfo)),
|
||||||
.help = tee_tg_help,
|
.help = tee_tg_help,
|
||||||
@@ -108,7 +157,23 @@ static struct xtables_target tee_tg_reg = {
|
|||||||
.extra_opts = tee_tg_opts,
|
.extra_opts = tee_tg_opts,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct xtables_target tee_tg6_reg = {
|
||||||
|
.name = "TEE",
|
||||||
|
.version = XTABLES_VERSION,
|
||||||
|
.revision = 0,
|
||||||
|
.family = PF_INET6,
|
||||||
|
.size = XT_ALIGN(sizeof(struct xt_tee_tginfo)),
|
||||||
|
.userspacesize = XT_ALIGN(sizeof(struct xt_tee_tginfo)),
|
||||||
|
.help = tee_tg_help,
|
||||||
|
.parse = tee_tg6_parse,
|
||||||
|
.final_check = tee_tg_check,
|
||||||
|
.print = tee_tg6_print,
|
||||||
|
.save = tee_tg6_save,
|
||||||
|
.extra_opts = tee_tg_opts,
|
||||||
|
};
|
||||||
|
|
||||||
static __attribute__((constructor)) void tee_tg_ldr(void)
|
static __attribute__((constructor)) void tee_tg_ldr(void)
|
||||||
{
|
{
|
||||||
xtables_register_target(&tee_tg_reg);
|
xtables_register_target(&tee_tg_reg);
|
||||||
|
xtables_register_target(&tee_tg6_reg);
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
static void ipp2p_mt_help(void)
|
static void ipp2p_mt_help(void)
|
||||||
{
|
{
|
||||||
printf(
|
printf(
|
||||||
"IPP2P v%s options:\n"
|
"ipp2p v%s match options:\n"
|
||||||
" --edk [tcp,udp] All known eDonkey/eMule/Overnet packets\n"
|
" --edk [tcp,udp] All known eDonkey/eMule/Overnet packets\n"
|
||||||
" --dc [tcp] All known Direct Connect packets\n"
|
" --dc [tcp] All known Direct Connect packets\n"
|
||||||
" --kazaa [tcp,udp] All known KaZaA packets\n"
|
" --kazaa [tcp,udp] All known KaZaA packets\n"
|
||||||
@@ -32,19 +32,10 @@ static void ipp2p_mt_help(void)
|
|||||||
" --winmx [tcp] All known WinMX\n"
|
" --winmx [tcp] All known WinMX\n"
|
||||||
" --soul [tcp] All known SoulSeek\n"
|
" --soul [tcp] All known SoulSeek\n"
|
||||||
" --ares [tcp] All known Ares\n\n"
|
" --ares [tcp] All known Ares\n\n"
|
||||||
"EXPERIMENTAL protocols (please send feedback to: ipp2p@ipp2p.org) :\n"
|
"EXPERIMENTAL protocols:\n"
|
||||||
" --mute [tcp] All known Mute packets\n"
|
" --mute [tcp] All known Mute packets\n"
|
||||||
" --waste [tcp] All known Waste packets\n"
|
" --waste [tcp] All known Waste packets\n"
|
||||||
" --xdcc [tcp] All known XDCC packets (only xdcc login)\n\n"
|
" --xdcc [tcp] All known XDCC packets (only xdcc login)\n\n"
|
||||||
"DEBUG SUPPPORT, use only if you know why\n"
|
|
||||||
" --debug Generate kernel debug output, THIS WILL SLOW DOWN THE FILTER\n"
|
|
||||||
"\nIPP2P was intended for TCP only. Due to increasing usage of UDP we needed to change this.\n"
|
|
||||||
"You can now use -p udp to search UDP packets only or without -p switch to search UDP and TCP packets.\n"
|
|
||||||
"\nSee README included with this package for more details or visit http://www.ipp2p.org\n"
|
|
||||||
"\nExamples:\n"
|
|
||||||
" iptables -A FORWARD -m ipp2p --ipp2p -j MARK --set-mark 0x01\n"
|
|
||||||
" iptables -A FORWARD -p udp -m ipp2p --kazaa --bit -j DROP\n"
|
|
||||||
" iptables -A FORWARD -p tcp -m ipp2p --edk --soul -j DROP\n\n"
|
|
||||||
, IPP2P_VERSION);
|
, IPP2P_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
This module matches certain packets in P2P flows. It is not
|
This module matches certain packets in P2P flows. It is not
|
||||||
designed to match all packets belonging to a P2P connection -
|
designed to match all packets belonging to a P2P connection -
|
||||||
use IPP2P together with CONNMARK for this purpose. Also visit
|
use IPP2P together with CONNMARK for this purpose.
|
||||||
http://www.ipp2p.org for detailed information.
|
.PP
|
||||||
|
|
||||||
Use it together with -p tcp or -p udp to search these protocols
|
Use it together with -p tcp or -p udp to search these protocols
|
||||||
only or without -p switch to search packets of both protocols.
|
only or without -p switch to search packets of both protocols.
|
||||||
|
.PP
|
||||||
IPP2P provides the following options:
|
IPP2P provides the following options, of which one or more may be specified
|
||||||
|
on the command line:
|
||||||
.TP
|
.TP
|
||||||
.B "--edk "
|
.B "--edk "
|
||||||
Matches as many eDonkey/eMule packets as possible.
|
Matches as many eDonkey/eMule packets as possible.
|
||||||
@@ -38,3 +38,11 @@ Matches Ares and AresLite packets. Use together with -j DROP only.
|
|||||||
.B "--debug "
|
.B "--debug "
|
||||||
Prints some information about each hit into kernel logfile. May
|
Prints some information about each hit into kernel logfile. May
|
||||||
produce huge logfiles so beware!
|
produce huge logfiles so beware!
|
||||||
|
.PP
|
||||||
|
Note that ipp2p may not (and often, does not) identify all packets that are
|
||||||
|
exchanged as a result of running filesharing programs.
|
||||||
|
.PP
|
||||||
|
There is more information on http://ipp2p.org/ , but it has not been updated
|
||||||
|
since September 2006, and the syntax there is different from the ipp2p.c
|
||||||
|
provided in Xtables-addons; most importantly, the --ipp2p flag was removed due
|
||||||
|
to its ambiguity to match "all known" protocols.
|
||||||
|
@@ -20,7 +20,11 @@ connection was torn down after completion of the 3-way handshake.
|
|||||||
\fB--grscan\fR
|
\fB--grscan\fR
|
||||||
Match if data in the connection only flew in the direction of the remote side,
|
Match if data in the connection only flew in the direction of the remote side,
|
||||||
e.g. if the connection was terminated after a locally running daemon sent its
|
e.g. if the connection was terminated after a locally running daemon sent its
|
||||||
identification. (e.g. openssh)
|
identification. (E.g. openssh, smtp, ftpd.) This may falsely trigger on
|
||||||
|
warranted single-direction data flows, usually bulk data transfers such as
|
||||||
|
FTP DATA connections or IRC DCC. Grab Scan Detection should only be used on
|
||||||
|
ports where a protocol runs that is guaranteed to do a bidirectional exchange
|
||||||
|
of bytes.
|
||||||
.PP
|
.PP
|
||||||
NOTE: Some clients (Windows XP for example) may do what looks like a SYN scan,
|
NOTE: Some clients (Windows XP for example) may do what looks like a SYN scan,
|
||||||
so be advised to carefully use xt_portscan in conjunction with blocking rules,
|
so be advised to carefully use xt_portscan in conjunction with blocking rules,
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* "TEE" target extension for Xtables
|
* "TEE" target extension for Xtables
|
||||||
* Copyright © Sebastian Claßen <sebastian.classen [at] freenet de>, 2007
|
* Copyright © Sebastian Claßen <sebastian.classen [at] freenet de>, 2007
|
||||||
* Jan Engelhardt <jengelh [at] medozas de>, 2007
|
* Jan Engelhardt <jengelh [at] medozas de>, 2007 - 2008
|
||||||
*
|
*
|
||||||
* based on ipt_ROUTE.c from Cédric de Launois
|
* based on ipt_ROUTE.c from Cédric de Launois
|
||||||
* <delaunois [at] info ucl ac be>
|
* <delaunois [at] info ucl ac be>
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
#include <net/checksum.h>
|
#include <net/checksum.h>
|
||||||
#include <net/icmp.h>
|
#include <net/icmp.h>
|
||||||
#include <net/ip.h>
|
#include <net/ip.h>
|
||||||
|
#include <net/ip6_route.h>
|
||||||
#include <net/route.h>
|
#include <net/route.h>
|
||||||
#include <linux/netfilter/x_tables.h>
|
#include <linux/netfilter/x_tables.h>
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ static struct nf_conn tee_track;
|
|||||||
#include "compat_xtables.h"
|
#include "compat_xtables.h"
|
||||||
#include "xt_TEE.h"
|
#include "xt_TEE.h"
|
||||||
|
|
||||||
static const union nf_inet_addr zero_address;
|
static const union nf_inet_addr tee_zero_address;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try to route the packet according to the routing keys specified in
|
* Try to route the packet according to the routing keys specified in
|
||||||
@@ -47,21 +48,16 @@ static const union nf_inet_addr zero_address;
|
|||||||
* true - if the packet was succesfully routed to the
|
* true - if the packet was succesfully routed to the
|
||||||
* destination desired
|
* destination desired
|
||||||
*/
|
*/
|
||||||
static bool tee_routing(struct sk_buff *skb,
|
static bool
|
||||||
const struct xt_tee_tginfo *info)
|
tee_tg_route4(struct sk_buff *skb, const struct xt_tee_tginfo *info)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct rtable *rt;
|
struct rtable *rt;
|
||||||
struct iphdr *iph = ip_hdr(skb);
|
struct flowi fl;
|
||||||
struct flowi fl = {
|
|
||||||
.nl_u = {
|
memset(&fl, 0, sizeof(fl));
|
||||||
.ip4_u = {
|
fl.nl_u.ip4_u.daddr = info->gw.ip;
|
||||||
.daddr = info->gw.ip,
|
fl.nl_u.ip4_u.scope = RT_SCOPE_UNIVERSE;
|
||||||
.tos = RT_TOS(iph->tos),
|
|
||||||
.scope = RT_SCOPE_UNIVERSE,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Trying to route the packet using the standard routing table. */
|
/* Trying to route the packet using the standard routing table. */
|
||||||
err = ip_route_output_key(&init_net, &rt, &fl);
|
err = ip_route_output_key(&init_net, &rt, &fl);
|
||||||
@@ -72,22 +68,14 @@ static bool tee_routing(struct sk_buff *skb,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Drop old route. */
|
|
||||||
dst_release(skb->dst);
|
dst_release(skb->dst);
|
||||||
skb->dst = NULL;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Success if no oif specified or if the oif correspond to the
|
|
||||||
* one desired.
|
|
||||||
* [SC]: always the case, because we have no oif.
|
|
||||||
*/
|
|
||||||
skb->dst = &rt->u.dst;
|
skb->dst = &rt->u.dst;
|
||||||
skb->dev = skb->dst->dev;
|
skb->dev = skb->dst->dev;
|
||||||
skb->protocol = htons(ETH_P_IP);
|
skb->protocol = htons(ETH_P_IP);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool dev_hh_avail(const struct net_device *dev)
|
static inline bool dev_hh_avail(const struct net_device *dev)
|
||||||
{
|
{
|
||||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23)
|
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23)
|
||||||
return dev->hard_header != NULL;
|
return dev->hard_header != NULL;
|
||||||
@@ -103,14 +91,14 @@ static bool dev_hh_avail(const struct net_device *dev)
|
|||||||
* POST: the packet is sent with the link layer header pushed
|
* POST: the packet is sent with the link layer header pushed
|
||||||
* the packet is destroyed
|
* the packet is destroyed
|
||||||
*/
|
*/
|
||||||
static void tee_ip_direct_send(struct sk_buff *skb)
|
static void tee_tg_send(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
const struct dst_entry *dst = skb->dst;
|
const struct dst_entry *dst = skb->dst;
|
||||||
const struct net_device *dev = dst->dev;
|
const struct net_device *dev = dst->dev;
|
||||||
unsigned int hh_len = LL_RESERVED_SPACE(dev);
|
unsigned int hh_len = LL_RESERVED_SPACE(dev);
|
||||||
|
|
||||||
/* Be paranoid, rather than too clever. */
|
/* Be paranoid, rather than too clever. */
|
||||||
if (unlikely(skb_headroom(skb) < hh_len) && dev_hh_avail(dev)) {
|
if (unlikely(skb_headroom(skb) < hh_len && dev_hh_avail(dev))) {
|
||||||
struct sk_buff *skb2;
|
struct sk_buff *skb2;
|
||||||
|
|
||||||
skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev));
|
skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev));
|
||||||
@@ -142,7 +130,7 @@ static void tee_ip_direct_send(struct sk_buff *skb)
|
|||||||
* packets when we see they already have that ->nfct.
|
* packets when we see they already have that ->nfct.
|
||||||
*/
|
*/
|
||||||
static unsigned int
|
static unsigned int
|
||||||
tee_tg(struct sk_buff **pskb, const struct xt_target_param *par)
|
tee_tg4(struct sk_buff **pskb, const struct xt_target_param *par)
|
||||||
{
|
{
|
||||||
const struct xt_tee_tginfo *info = par->targinfo;
|
const struct xt_tee_tginfo *info = par->targinfo;
|
||||||
struct sk_buff *skb = *pskb;
|
struct sk_buff *skb = *pskb;
|
||||||
@@ -200,8 +188,78 @@ tee_tg(struct sk_buff **pskb, const struct xt_target_param *par)
|
|||||||
nf_conntrack_get(skb->nfct);
|
nf_conntrack_get(skb->nfct);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (tee_routing(skb, info))
|
/*
|
||||||
tee_ip_direct_send(skb);
|
* Normally, we would just use ip_local_out. Because iph->check is
|
||||||
|
* already correct, we could take a shortcut and call dst_output
|
||||||
|
* [forwards to ip_output] directly. ip_output however will invoke
|
||||||
|
* Netfilter hooks and cause reentrancy. So we skip that too and go
|
||||||
|
* directly to ip_finish_output. Since we should not do XFRM, control
|
||||||
|
* passes to ip_finish_output2. That function is not exported, so it is
|
||||||
|
* copied here as tee_ip_direct_send.
|
||||||
|
*
|
||||||
|
* We do no XFRM on the cloned packet on purpose! The choice of
|
||||||
|
* iptables match options will control whether the raw packet or the
|
||||||
|
* transformed version is cloned.
|
||||||
|
*
|
||||||
|
* Also on purpose, no fragmentation is done, to preserve the
|
||||||
|
* packet as best as possible.
|
||||||
|
*/
|
||||||
|
if (tee_tg_route4(skb, info))
|
||||||
|
tee_tg_send(skb);
|
||||||
|
|
||||||
|
return XT_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
tee_tg_route6(struct sk_buff *skb, const struct xt_tee_tginfo *info)
|
||||||
|
{
|
||||||
|
struct dst_entry *dst;
|
||||||
|
struct flowi fl;
|
||||||
|
|
||||||
|
memset(&fl, 0, sizeof(fl));
|
||||||
|
fl.nl_u.ip6_u.daddr = info->gw.in6;
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 25)
|
||||||
|
dst = ip6_route_output(NULL, &fl);
|
||||||
|
#else
|
||||||
|
dst = ip6_route_output(dev_net(skb->dev), NULL, &fl);
|
||||||
|
#endif
|
||||||
|
if (dst == NULL) {
|
||||||
|
if (net_ratelimit())
|
||||||
|
printk(KERN_ERR "ip6_route_output failed for tee\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
dst_release(skb->dst);
|
||||||
|
skb->dst = dst;
|
||||||
|
skb->dev = skb->dst->dev;
|
||||||
|
skb->protocol = htons(ETH_P_IPV6);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned int
|
||||||
|
tee_tg6(struct sk_buff **pskb, const struct xt_target_param *par)
|
||||||
|
{
|
||||||
|
const struct xt_tee_tginfo *info = par->targinfo;
|
||||||
|
struct sk_buff *skb = *pskb;
|
||||||
|
|
||||||
|
/* Try silence. */
|
||||||
|
#ifdef WITH_CONNTRACK
|
||||||
|
if (skb->nfct == &tee_track.ct_general)
|
||||||
|
return NF_DROP;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ((skb = skb_copy(skb, GFP_ATOMIC)) == NULL)
|
||||||
|
return XT_CONTINUE;
|
||||||
|
|
||||||
|
#ifdef WITH_CONNTRACK
|
||||||
|
nf_conntrack_put(skb->nfct);
|
||||||
|
skb->nfct = &tee_track.ct_general;
|
||||||
|
skb->nfctinfo = IP_CT_NEW;
|
||||||
|
nf_conntrack_get(skb->nfct);
|
||||||
|
#endif
|
||||||
|
if (tee_tg_route6(skb, info))
|
||||||
|
tee_tg_send(skb);
|
||||||
|
|
||||||
return XT_CONTINUE;
|
return XT_CONTINUE;
|
||||||
}
|
}
|
||||||
@@ -211,18 +269,31 @@ static bool tee_tg_check(const struct xt_tgchk_param *par)
|
|||||||
const struct xt_tee_tginfo *info = par->targinfo;
|
const struct xt_tee_tginfo *info = par->targinfo;
|
||||||
|
|
||||||
/* 0.0.0.0 and :: not allowed */
|
/* 0.0.0.0 and :: not allowed */
|
||||||
return memcmp(&info->gw, &zero_address, sizeof(zero_address)) != 0;
|
return memcmp(&info->gw, &tee_zero_address,
|
||||||
|
sizeof(tee_zero_address)) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct xt_target tee_tg_reg __read_mostly = {
|
static struct xt_target tee_tg_reg[] __read_mostly = {
|
||||||
|
{
|
||||||
.name = "TEE",
|
.name = "TEE",
|
||||||
.revision = 0,
|
.revision = 0,
|
||||||
.family = NFPROTO_IPV4,
|
.family = NFPROTO_IPV4,
|
||||||
.table = "mangle",
|
.table = "mangle",
|
||||||
.target = tee_tg,
|
.target = tee_tg4,
|
||||||
.targetsize = sizeof(struct xt_tee_tginfo),
|
.targetsize = sizeof(struct xt_tee_tginfo),
|
||||||
.checkentry = tee_tg_check,
|
.checkentry = tee_tg_check,
|
||||||
.me = THIS_MODULE,
|
.me = THIS_MODULE,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "TEE",
|
||||||
|
.revision = 0,
|
||||||
|
.family = NFPROTO_IPV6,
|
||||||
|
.table = "mangle",
|
||||||
|
.target = tee_tg6,
|
||||||
|
.targetsize = sizeof(struct xt_tee_tginfo),
|
||||||
|
.checkentry = tee_tg_check,
|
||||||
|
.me = THIS_MODULE,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int __init tee_tg_init(void)
|
static int __init tee_tg_init(void)
|
||||||
@@ -241,19 +312,20 @@ static int __init tee_tg_init(void)
|
|||||||
tee_track.status |= IPS_NAT_DONE_MASK;
|
tee_track.status |= IPS_NAT_DONE_MASK;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return xt_register_target(&tee_tg_reg);
|
return xt_register_targets(tee_tg_reg, ARRAY_SIZE(tee_tg_reg));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit tee_tg_exit(void)
|
static void __exit tee_tg_exit(void)
|
||||||
{
|
{
|
||||||
xt_unregister_target(&tee_tg_reg);
|
xt_unregister_targets(tee_tg_reg, ARRAY_SIZE(tee_tg_reg));
|
||||||
/* [SC]: shoud not we cleanup tee_track here? */
|
/* [SC]: shoud not we cleanup tee_track here? */
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(tee_tg_init);
|
module_init(tee_tg_init);
|
||||||
module_exit(tee_tg_exit);
|
module_exit(tee_tg_exit);
|
||||||
MODULE_AUTHOR("Sebastian Claßen <sebastian.classen@freenet.ag>");
|
MODULE_AUTHOR("Sebastian Claßen <sebastian.classen@freenet.ag>");
|
||||||
MODULE_AUTHOR("Jan Engelhardt <jengelh@computergmbh.de>");
|
MODULE_AUTHOR("Jan Engelhardt <jengelh@medozas.de>");
|
||||||
MODULE_DESCRIPTION("Xtables: Reroute packet copy");
|
MODULE_DESCRIPTION("Xtables: Reroute packet copy");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
MODULE_ALIAS("ipt_TEE");
|
MODULE_ALIAS("ipt_TEE");
|
||||||
|
MODULE_ALIAS("ip6t_TEE");
|
||||||
|
@@ -603,8 +603,13 @@ search_all_kazaa(const unsigned char *payload, const unsigned int plen)
|
|||||||
{
|
{
|
||||||
uint16_t c, end, rem;
|
uint16_t c, end, rem;
|
||||||
|
|
||||||
if (plen >= 5) {
|
if (plen < 5)
|
||||||
printk(KERN_WARNING KBUILD_MODNAME ": %s: plen (%u) < 5\n",
|
/* too short for anything we test for - early bailout */
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (plen >= 65535) {
|
||||||
|
/* Something seems _really_ fishy */
|
||||||
|
printk(KERN_WARNING KBUILD_MODNAME ": %s: plen (%u) >= 65535\n",
|
||||||
__func__, plen);
|
__func__, plen);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -618,6 +623,10 @@ search_all_kazaa(const unsigned char *payload, const unsigned int plen)
|
|||||||
if (memcmp(payload, "GET /", 5) != 0)
|
if (memcmp(payload, "GET /", 5) != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (plen < 18)
|
||||||
|
/* The next tests would not succeed anyhow. */
|
||||||
|
return 0;
|
||||||
|
|
||||||
end = plen - 18;
|
end = plen - 18;
|
||||||
rem = plen - 5;
|
rem = plen - 5;
|
||||||
for (c = 5; c < end; ++c, --rem) {
|
for (c = 5; c < end; ++c, --rem) {
|
||||||
@@ -828,7 +837,7 @@ ipp2p_mt(const struct sk_buff *skb, const struct xt_match_param *par)
|
|||||||
switch (ip->protocol) {
|
switch (ip->protocol) {
|
||||||
case IPPROTO_TCP: /* what to do with a TCP packet */
|
case IPPROTO_TCP: /* what to do with a TCP packet */
|
||||||
{
|
{
|
||||||
const struct tcphdr *tcph = tcp_hdr(skb);
|
const struct tcphdr *tcph = (const void *)ip + ip_hdrlen(skb);
|
||||||
|
|
||||||
if (tcph->fin) return 0; /* if FIN bit is set bail out */
|
if (tcph->fin) return 0; /* if FIN bit is set bail out */
|
||||||
if (tcph->syn) return 0; /* if SYN bit is set bail out */
|
if (tcph->syn) return 0; /* if SYN bit is set bail out */
|
||||||
@@ -855,7 +864,7 @@ ipp2p_mt(const struct sk_buff *skb, const struct xt_match_param *par)
|
|||||||
|
|
||||||
case IPPROTO_UDP: /* what to do with an UDP packet */
|
case IPPROTO_UDP: /* what to do with an UDP packet */
|
||||||
{
|
{
|
||||||
const struct udphdr *udph = udp_hdr(skb);
|
const struct udphdr *udph = (const void *)ip + ip_hdrlen(skb);
|
||||||
|
|
||||||
while (udp_list[i].command) {
|
while (udp_list[i].command) {
|
||||||
if ((info->cmd & udp_list[i].command) == udp_list[i].command &&
|
if ((info->cmd & udp_list[i].command) == udp_list[i].command &&
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
.TH xtables\-addons 8 "v1.7 (2008\-12\-25)" "" "v1.7 (2008\-12\-25)"
|
.TH xtables\-addons 8 "v1.8 (2009\-01\-10)" "" "v1.8 (2009\-01\-10)"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
Xtables\-addons - additional extensions for iptables, ip6tables, etc.
|
Xtables\-addons - additional extensions for iptables, ip6tables, etc.
|
||||||
.SH TARGETS
|
.SH TARGETS
|
||||||
|
Reference in New Issue
Block a user