Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 56983
b: refs/heads/master
c: 25b86e0
h: refs/heads/master
i:
  56981: 7443bd4
  56979: 032336d
  56975: 4363463
v: v3
  • Loading branch information
Patrick McHardy authored and David S. Miller committed May 24, 2007
1 parent abddb53 commit 863c7dd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5fe26f53fe9e2ba5dca2835a4ca69d0ba7b5f707
refs/heads/master: 25b86e05467a2bf936b78695ef49039e3bbd1e0c
3 changes: 1 addition & 2 deletions trunk/include/linux/netfilter/nf_conntrack_ftp.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ extern unsigned int (*nf_nat_ftp_hook)(struct sk_buff **pskb,
enum nf_ct_ftp_type type,
unsigned int matchoff,
unsigned int matchlen,
struct nf_conntrack_expect *exp,
u32 *seq);
struct nf_conntrack_expect *exp);
#endif /* __KERNEL__ */

#endif /* _NF_CONNTRACK_FTP_H */
20 changes: 6 additions & 14 deletions trunk/net/ipv4/netfilter/nf_nat_ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ mangle_rfc959_packet(struct sk_buff **pskb,
unsigned int matchoff,
unsigned int matchlen,
struct nf_conn *ct,
enum ip_conntrack_info ctinfo,
u32 *seq)
enum ip_conntrack_info ctinfo)
{
char buffer[sizeof("nnn,nnn,nnn,nnn,nnn,nnn")];

Expand All @@ -50,7 +49,6 @@ mangle_rfc959_packet(struct sk_buff **pskb,

DEBUGP("calling nf_nat_mangle_tcp_packet\n");

*seq += strlen(buffer) - matchlen;
return nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff,
matchlen, buffer, strlen(buffer));
}
Expand All @@ -63,16 +61,14 @@ mangle_eprt_packet(struct sk_buff **pskb,
unsigned int matchoff,
unsigned int matchlen,
struct nf_conn *ct,
enum ip_conntrack_info ctinfo,
u32 *seq)
enum ip_conntrack_info ctinfo)
{
char buffer[sizeof("|1|255.255.255.255|65535|")];

sprintf(buffer, "|1|%u.%u.%u.%u|%u|", NIPQUAD(newip), port);

DEBUGP("calling nf_nat_mangle_tcp_packet\n");

*seq += strlen(buffer) - matchlen;
return nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff,
matchlen, buffer, strlen(buffer));
}
Expand All @@ -85,23 +81,21 @@ mangle_epsv_packet(struct sk_buff **pskb,
unsigned int matchoff,
unsigned int matchlen,
struct nf_conn *ct,
enum ip_conntrack_info ctinfo,
u32 *seq)
enum ip_conntrack_info ctinfo)
{
char buffer[sizeof("|||65535|")];

sprintf(buffer, "|||%u|", port);

DEBUGP("calling nf_nat_mangle_tcp_packet\n");

*seq += strlen(buffer) - matchlen;
return nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff,
matchlen, buffer, strlen(buffer));
}

static int (*mangle[])(struct sk_buff **, __be32, u_int16_t,
unsigned int, unsigned int, struct nf_conn *,
enum ip_conntrack_info, u32 *seq)
enum ip_conntrack_info)
= {
[NF_CT_FTP_PORT] = mangle_rfc959_packet,
[NF_CT_FTP_PASV] = mangle_rfc959_packet,
Expand All @@ -116,8 +110,7 @@ static unsigned int nf_nat_ftp(struct sk_buff **pskb,
enum nf_ct_ftp_type type,
unsigned int matchoff,
unsigned int matchlen,
struct nf_conntrack_expect *exp,
u32 *seq)
struct nf_conntrack_expect *exp)
{
__be32 newip;
u_int16_t port;
Expand Down Expand Up @@ -145,8 +138,7 @@ static unsigned int nf_nat_ftp(struct sk_buff **pskb,
if (port == 0)
return NF_DROP;

if (!mangle[type](pskb, newip, port, matchoff, matchlen, ct, ctinfo,
seq)) {
if (!mangle[type](pskb, newip, port, matchoff, matchlen, ct, ctinfo)) {
nf_conntrack_unexpect_related(exp);
return NF_DROP;
}
Expand Down
5 changes: 2 additions & 3 deletions trunk/net/netfilter/nf_conntrack_ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ unsigned int (*nf_nat_ftp_hook)(struct sk_buff **pskb,
enum nf_ct_ftp_type type,
unsigned int matchoff,
unsigned int matchlen,
struct nf_conntrack_expect *exp,
u32 *seq);
struct nf_conntrack_expect *exp);
EXPORT_SYMBOL_GPL(nf_nat_ftp_hook);

#if 0
Expand Down Expand Up @@ -521,7 +520,7 @@ static int help(struct sk_buff **pskb,
nf_nat_ftp = rcu_dereference(nf_nat_ftp_hook);
if (nf_nat_ftp && ct->status & IPS_NAT_MASK)
ret = nf_nat_ftp(pskb, ctinfo, search[dir][i].ftptype,
matchoff, matchlen, exp, &seq);
matchoff, matchlen, exp);
else {
/* Can't expect this? Best to drop packet now. */
if (nf_conntrack_expect_related(exp) != 0)
Expand Down

0 comments on commit 863c7dd

Please sign in to comment.