projects
/
cascardo
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-nvram
[cascardo/linux.git]
/
net
/
netfilter
/
xt_tcpudp.c
diff --git
a/net/netfilter/xt_tcpudp.c
b/net/netfilter/xt_tcpudp.c
index
4fa3b66
..
1ebdc49
100644
(file)
--- a/
net/netfilter/xt_tcpudp.c
+++ b/
net/netfilter/xt_tcpudp.c
@@
-42,7
+42,8
@@
tcp_find_option(u_int8_t option,
bool *hotdrop)
{
/* tcp.doff is only 4 bits, ie. max 15 * 4 bytes */
bool *hotdrop)
{
/* tcp.doff is only 4 bits, ie. max 15 * 4 bytes */
- u_int8_t _opt[60 - sizeof(struct tcphdr)], *op;
+ const u_int8_t *op;
+ u_int8_t _opt[60 - sizeof(struct tcphdr)];
unsigned int i;
duprintf("tcp_match: finding option\n");
unsigned int i;
duprintf("tcp_match: finding option\n");
@@
-67,24
+68,22
@@
tcp_find_option(u_int8_t option,
return invert;
}
return invert;
}
-static bool
-tcp_mt(const struct sk_buff *skb, const struct net_device *in,
- const struct net_device *out, const struct xt_match *match,
- const void *matchinfo, int offset, unsigned int protoff, bool *hotdrop)
+static bool tcp_mt(const struct sk_buff *skb, const struct xt_match_param *par)
{
{
- struct tcphdr _tcph, *th;
- const struct xt_tcp *tcpinfo = matchinfo;
+ const struct tcphdr *th;
+ struct tcphdr _tcph;
+ const struct xt_tcp *tcpinfo = par->matchinfo;
- if (
offset
) {
+ if (
par->fragoff != 0
) {
/* To quote Alan:
Don't allow a fragment of TCP 8 bytes in. Nobody normal
causes this. Its a cracker trying to break in by doing a
flag overwrite to pass the direction checks.
*/
/* To quote Alan:
Don't allow a fragment of TCP 8 bytes in. Nobody normal
causes this. Its a cracker trying to break in by doing a
flag overwrite to pass the direction checks.
*/
- if (
offset
== 1) {
+ if (
par->fragoff
== 1) {
duprintf("Dropping evil TCP offset=1 frag.\n");
duprintf("Dropping evil TCP offset=1 frag.\n");
- *hotdrop = true;
+ *
par->
hotdrop = true;
}
/* Must not be a fragment. */
return false;
}
/* Must not be a fragment. */
return false;
@@
-92,12
+91,12
@@
tcp_mt(const struct sk_buff *skb, const struct net_device *in,
#define FWINVTCP(bool, invflg) ((bool) ^ !!(tcpinfo->invflags & (invflg)))
#define FWINVTCP(bool, invflg) ((bool) ^ !!(tcpinfo->invflags & (invflg)))
- th = skb_header_pointer(skb, p
rot
off, sizeof(_tcph), &_tcph);
+ th = skb_header_pointer(skb, p
ar->th
off, sizeof(_tcph), &_tcph);
if (th == NULL) {
/* We've been asked to examine this packet, and we
can't. Hence, no choice but to drop. */
duprintf("Dropping evil TCP offset=0 tinygram.\n");
if (th == NULL) {
/* We've been asked to examine this packet, and we
can't. Hence, no choice but to drop. */
duprintf("Dropping evil TCP offset=0 tinygram.\n");
- *hotdrop = true;
+ *
par->
hotdrop = true;
return false;
}
return false;
}
@@
-115,48
+114,42
@@
tcp_mt(const struct sk_buff *skb, const struct net_device *in,
return false;
if (tcpinfo->option) {
if (th->doff * 4 < sizeof(_tcph)) {
return false;
if (tcpinfo->option) {
if (th->doff * 4 < sizeof(_tcph)) {
- *hotdrop = true;
+ *
par->
hotdrop = true;
return false;
}
return false;
}
- if (!tcp_find_option(tcpinfo->option, skb, p
rot
off,
+ if (!tcp_find_option(tcpinfo->option, skb, p
ar->th
off,
th->doff*4 - sizeof(_tcph),
tcpinfo->invflags & XT_TCP_INV_OPTION,
th->doff*4 - sizeof(_tcph),
tcpinfo->invflags & XT_TCP_INV_OPTION,
- hotdrop))
+
par->
hotdrop))
return false;
}
return true;
}
return false;
}
return true;
}
-/* Called when user tries to insert an entry of this type. */
-static bool
-tcp_mt_check(const char *tablename, const void *info,
- const struct xt_match *match, void *matchinfo,
- unsigned int hook_mask)
+static bool tcp_mt_check(const struct xt_mtchk_param *par)
{
{
- const struct xt_tcp *tcpinfo = matchinfo;
+ const struct xt_tcp *tcpinfo =
par->
matchinfo;
/* Must specify no unknown invflags */
return !(tcpinfo->invflags & ~XT_TCP_INV_MASK);
}
/* Must specify no unknown invflags */
return !(tcpinfo->invflags & ~XT_TCP_INV_MASK);
}
-static bool
-udp_mt(const struct sk_buff *skb, const struct net_device *in,
- const struct net_device *out, const struct xt_match *match,
- const void *matchinfo, int offset, unsigned int protoff, bool *hotdrop)
+static bool udp_mt(const struct sk_buff *skb, const struct xt_match_param *par)
{
{
- struct udphdr _udph, *uh;
- const struct xt_udp *udpinfo = matchinfo;
+ const struct udphdr *uh;
+ struct udphdr _udph;
+ const struct xt_udp *udpinfo = par->matchinfo;
/* Must not be a fragment. */
/* Must not be a fragment. */
- if (
offset
)
+ if (
par->fragoff != 0
)
return false;
return false;
- uh = skb_header_pointer(skb, p
rot
off, sizeof(_udph), &_udph);
+ uh = skb_header_pointer(skb, p
ar->th
off, sizeof(_udph), &_udph);
if (uh == NULL) {
/* We've been asked to examine this packet, and we
can't. Hence, no choice but to drop. */
duprintf("Dropping evil UDP tinygram.\n");
if (uh == NULL) {
/* We've been asked to examine this packet, and we
can't. Hence, no choice but to drop. */
duprintf("Dropping evil UDP tinygram.\n");
- *hotdrop = true;
+ *
par->
hotdrop = true;
return false;
}
return false;
}
@@
-168,13
+161,9
@@
udp_mt(const struct sk_buff *skb, const struct net_device *in,
!!(udpinfo->invflags & XT_UDP_INV_DSTPT));
}
!!(udpinfo->invflags & XT_UDP_INV_DSTPT));
}
-/* Called when user tries to insert an entry of this type. */
-static bool
-udp_mt_check(const char *tablename, const void *info,
- const struct xt_match *match, void *matchinfo,
- unsigned int hook_mask)
+static bool udp_mt_check(const struct xt_mtchk_param *par)
{
{
- const struct xt_udp *udpinfo = matchinfo;
+ const struct xt_udp *udpinfo =
par->
matchinfo;
/* Must specify no unknown invflags */
return !(udpinfo->invflags & ~XT_UDP_INV_MASK);
/* Must specify no unknown invflags */
return !(udpinfo->invflags & ~XT_UDP_INV_MASK);
@@
-183,7
+172,7
@@
udp_mt_check(const char *tablename, const void *info,
static struct xt_match tcpudp_mt_reg[] __read_mostly = {
{
.name = "tcp",
static struct xt_match tcpudp_mt_reg[] __read_mostly = {
{
.name = "tcp",
- .family =
AF_INET
,
+ .family =
NFPROTO_IPV4
,
.checkentry = tcp_mt_check,
.match = tcp_mt,
.matchsize = sizeof(struct xt_tcp),
.checkentry = tcp_mt_check,
.match = tcp_mt,
.matchsize = sizeof(struct xt_tcp),
@@
-192,7
+181,7
@@
static struct xt_match tcpudp_mt_reg[] __read_mostly = {
},
{
.name = "tcp",
},
{
.name = "tcp",
- .family =
AF_INET
6,
+ .family =
NFPROTO_IPV
6,
.checkentry = tcp_mt_check,
.match = tcp_mt,
.matchsize = sizeof(struct xt_tcp),
.checkentry = tcp_mt_check,
.match = tcp_mt,
.matchsize = sizeof(struct xt_tcp),
@@
-201,7
+190,7
@@
static struct xt_match tcpudp_mt_reg[] __read_mostly = {
},
{
.name = "udp",
},
{
.name = "udp",
- .family =
AF_INET
,
+ .family =
NFPROTO_IPV4
,
.checkentry = udp_mt_check,
.match = udp_mt,
.matchsize = sizeof(struct xt_udp),
.checkentry = udp_mt_check,
.match = udp_mt,
.matchsize = sizeof(struct xt_udp),
@@
-210,7
+199,7
@@
static struct xt_match tcpudp_mt_reg[] __read_mostly = {
},
{
.name = "udp",
},
{
.name = "udp",
- .family =
AF_INET
6,
+ .family =
NFPROTO_IPV
6,
.checkentry = udp_mt_check,
.match = udp_mt,
.matchsize = sizeof(struct xt_udp),
.checkentry = udp_mt_check,
.match = udp_mt,
.matchsize = sizeof(struct xt_udp),
@@
-219,7
+208,7
@@
static struct xt_match tcpudp_mt_reg[] __read_mostly = {
},
{
.name = "udplite",
},
{
.name = "udplite",
- .family =
AF_INET
,
+ .family =
NFPROTO_IPV4
,
.checkentry = udp_mt_check,
.match = udp_mt,
.matchsize = sizeof(struct xt_udp),
.checkentry = udp_mt_check,
.match = udp_mt,
.matchsize = sizeof(struct xt_udp),
@@
-228,7
+217,7
@@
static struct xt_match tcpudp_mt_reg[] __read_mostly = {
},
{
.name = "udplite",
},
{
.name = "udplite",
- .family =
AF_INET
6,
+ .family =
NFPROTO_IPV
6,
.checkentry = udp_mt_check,
.match = udp_mt,
.matchsize = sizeof(struct xt_udp),
.checkentry = udp_mt_check,
.match = udp_mt,
.matchsize = sizeof(struct xt_udp),