diff options
| author | Rusty Russell <rusty@rustcorp.com.au> | 2005-01-25 05:18:13 -0800 |
|---|---|---|
| committer | David S. Miller <davem@nuts.davemloft.net> | 2005-01-25 05:18:13 -0800 |
| commit | 046ee63094893679880fd1023aaaaf8e946e3aaa (patch) | |
| tree | c77303199ad4264cb41b3d3e0437fb266498f3b1 | |
| parent | 234a7aee107415c4dba0ecc0cb4af0818caf0724 (diff) | |
[NETFILTER]: IRC Zero Port Fix
Ian Kumlien reported that new NAT code started sending out DCC
requests with 0 as the IP address. That prompted me to write a simple
IRC test case, which both illustrated the bug, and found another one
in that the wrong expectation was being set up when NAT occurred.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | net/ipv4/netfilter/ip_conntrack_irc.c | 7 | ||||
| -rw-r--r-- | net/ipv4/netfilter/ip_nat_irc.c | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/net/ipv4/netfilter/ip_conntrack_irc.c b/net/ipv4/netfilter/ip_conntrack_irc.c index 54ef2dab5de0..33cc7348b6ee 100644 --- a/net/ipv4/netfilter/ip_conntrack_irc.c +++ b/net/ipv4/netfilter/ip_conntrack_irc.c @@ -209,9 +209,14 @@ static int help(struct sk_buff **pskb, DEBUGP("tcph->seq = %u\n", th->seq); seq = ntohl(th->seq) + (addr_beg_p - ib_ptr); + /* 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 = ((struct ip_conntrack_tuple) { { 0, { 0 } }, - { ct->tuplehash[dir].tuple.src.ip, { .tcp = { htons(dcc_port) } }, + { ct->tuplehash[!dir].tuple.dst.ip, + { .tcp = { htons(dcc_port) } }, IPPROTO_TCP }}); exp->mask = ((struct ip_conntrack_tuple) { { 0, { 0 } }, diff --git a/net/ipv4/netfilter/ip_nat_irc.c b/net/ipv4/netfilter/ip_nat_irc.c index 7c2c3762888e..e618b6c7e301 100644 --- a/net/ipv4/netfilter/ip_nat_irc.c +++ b/net/ipv4/netfilter/ip_nat_irc.c @@ -83,7 +83,10 @@ static unsigned int help(struct sk_buff **pskb, * 0x01, \n: terminators */ - sprintf(buffer, "%u %u", ntohl(exp->tuple.src.ip), port); + /* AAA = "us", ie. where server normally talks to. */ + sprintf(buffer, "%u %u", + ntohl(exp->master->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip), + port); DEBUGP("ip_nat_irc: Inserting '%s' == %u.%u.%u.%u, port %u\n", buffer, NIPQUAD(exp->tuple.src.ip), port); |
