From: Patrick McHardy <kaber@trash.net>
To: netfilter-devel@lists.netfilter.org
Cc: Patrick McHardy <kaber@trash.net>
Subject: [NETFILTER 06/20]: nf_conntrack_ftp: use nf_ct_expect_init
Date: Fri, 29 Jun 2007 02:45:05 +0200 (MEST) [thread overview]
Message-ID: <20070629004403.25566.13429.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20070629004354.25566.59266.sendpatchset@localhost.localdomain>
[NETFILTER]: nf_conntrack_ftp: use nf_ct_expect_init
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
commit 0e695813c65bdcb288476afc5c2875ed3ebb3060
tree 149f4ad7b114e8f9f404efd6f71404bd67e8013b
parent 2919009f4300baa6593e729d1267bb4442dea224
author Patrick McHardy <kaber@trash.net> Fri, 29 Jun 2007 02:04:26 +0200
committer Patrick McHardy <kaber@trash.net> Fri, 29 Jun 2007 02:04:26 +0200
net/netfilter/nf_conntrack_ftp.c | 36 ++++++------------------------------
1 files changed, 6 insertions(+), 30 deletions(-)
diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c
index 5efe65d..9ad1519 100644
--- a/net/netfilter/nf_conntrack_ftp.c
+++ b/net/netfilter/nf_conntrack_ftp.c
@@ -364,6 +364,7 @@ static int help(struct sk_buff **pskb,
unsigned int matchlen, matchoff;
struct nf_ct_ftp_master *ct_ftp_info = &nfct_help(ct)->help.ct_ftp_info;
struct nf_conntrack_expect *exp;
+ union nf_conntrack_address *daddr;
struct nf_conntrack_man cmd = {};
unsigned int i;
int found = 0, ends_in_nl;
@@ -454,7 +455,7 @@ static int help(struct sk_buff **pskb,
/* We refer to the reverse direction ("!dir") tuples here,
* because we're expecting something in the other direction.
* Doesn't matter unless NAT is happening. */
- exp->tuple.dst.u3 = ct->tuplehash[!dir].tuple.dst.u3;
+ daddr = &ct->tuplehash[!dir].tuple.dst.u3;
/* Update the ftp info */
if ((cmd.l3num == ct->tuplehash[dir].tuple.src.l3num) &&
@@ -483,37 +484,12 @@ static int help(struct sk_buff **pskb,
ret = NF_ACCEPT;
goto out_put_expect;
}
- memcpy(&exp->tuple.dst.u3, &cmd.u3.all,
- sizeof(exp->tuple.dst.u3));
+ daddr = &cmd.u3;
}
- exp->tuple.src.u3 = ct->tuplehash[!dir].tuple.src.u3;
- exp->tuple.src.l3num = cmd.l3num;
- exp->tuple.src.u.tcp.port = 0;
- exp->tuple.dst.u.tcp.port = cmd.u.tcp.port;
- exp->tuple.dst.protonum = IPPROTO_TCP;
-
- exp->mask = (struct nf_conntrack_tuple)
- { .src = { .l3num = 0xFFFF,
- .u = { .tcp = { 0 }},
- },
- .dst = { .protonum = 0xFF,
- .u = { .tcp = { __constant_htons(0xFFFF) }},
- },
- };
- if (cmd.l3num == PF_INET) {
- exp->mask.src.u3.ip = htonl(0xFFFFFFFF);
- exp->mask.dst.u3.ip = htonl(0xFFFFFFFF);
- } else {
- memset(exp->mask.src.u3.ip6, 0xFF,
- sizeof(exp->mask.src.u3.ip6));
- memset(exp->mask.dst.u3.ip6, 0xFF,
- sizeof(exp->mask.src.u3.ip6));
- }
-
- exp->expectfn = NULL;
- exp->helper = NULL;
- exp->flags = 0;
+ nf_ct_expect_init(exp, cmd.l3num,
+ &ct->tuplehash[!dir].tuple.src.u3, daddr,
+ IPPROTO_TCP, NULL, &cmd.u.tcp.port);
/* Now, NAT might want to mangle the packet, and register the
* (possibly changed) expectation itself. */
next prev parent reply other threads:[~2007-06-29 0:45 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-29 0:44 [NETFILTER 00/20]: Pending netfilter patches Patrick McHardy
2007-06-29 0:44 ` [NETFILTER 01/20]: nf_conntrack: use hlists for conntrack hash Patrick McHardy
2007-06-29 0:44 ` [NETFILTER 02/20]: nf_conntrack: remove 'ignore_conntrack' argument from nf_conntrack_find_get Patrick McHardy
2007-06-29 0:45 ` [NETFILTER 03/20]: nf_conntrack: export hash allocation/destruction functions Patrick McHardy
2007-06-29 0:45 ` [NETFILTER 04/20]: nf_nat: use hlists for bysource hash Patrick McHardy
2007-06-29 0:45 ` [NETFILTER 05/20]: nf_conntrack_expect: function naming unification Patrick McHardy
2007-06-29 0:45 ` Patrick McHardy [this message]
2007-06-29 0:45 ` [NETFILTER 07/20]: nf_conntrack: reduce masks to a subset of tuples Patrick McHardy
2007-06-29 0:45 ` [NETFILTER 08/20]: nf_conntrack_expect: avoid useless list walking Patrick McHardy
2007-06-29 0:45 ` [NETFILTER 09/20]: nf_conntrack_netlink: sync expectation dumping with conntrack table dumping Patrick McHardy
2007-06-29 0:45 ` [NETFILTER 10/20]: nf_conntrack: move expectaton related init code to nf_conntrack_expect.c Patrick McHardy
2007-06-29 0:45 ` [NETFILTER 11/20]: nf_conntrack: use hashtable for expectations Patrick McHardy
2007-06-29 0:45 ` [NETFILTER 12/20]: nf_conntrack_expect: convert proc functions to hash Patrick McHardy
2007-06-29 0:45 ` [NETFILTER 13/20]: nf_conntrack_helper/nf_conntrack_netlink: convert to expectation hash Patrick McHardy
2007-06-29 0:45 ` [NETFILTER 14/20]: nf_conntrack_expect: maintain per conntrack expectation list Patrick McHardy
2007-06-29 0:45 ` [NETFILTER 15/20]: nf_conntrack_helper: use hashtable for conntrack helpers Patrick McHardy
2007-06-29 0:45 ` [NETFILTER 16/20]: nf_conntrack: mark helpers __read_mostly Patrick McHardy
2007-06-29 0:45 ` [NETFILTER 17/20]: nf_conntrack: early_drop improvement Patrick McHardy
2007-06-29 0:45 ` [NETFILTER 18/20]: ipt_SAME: add to feature-removal-schedule Patrick McHardy
2007-06-29 0:45 ` [NETFILTER 19/20]: ipt_CLUSTERIP: add compat code Patrick McHardy
2007-06-29 0:45 ` [NETFILTER 20/20]: nf_conntrack_h323: turn some printks into DEBUGPs Patrick McHardy
2007-06-29 7:43 ` Jan Engelhardt
2007-06-29 10:08 ` Patrick McHardy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070629004403.25566.13429.sendpatchset@localhost.localdomain \
--to=kaber@trash.net \
--cc=netfilter-devel@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.