Skip to content

Commit 0efe125

Browse files
dglummakynes
authored andcommitted
netfilter: nf_conntrack_irc: Fix forged IP logic
Ensure the match happens in the right direction, previously the destination used was the server, not the NAT host, as the comment shows the code intended. Additionally nf_nat_irc uses port 0 as a signal and there's no valid way it can appear in a DCC message, so consider port 0 also forged. Fixes: 869f37d ("[NETFILTER]: nf_conntrack/nf_nat: add IRC helper port") Signed-off-by: David Leadbeater <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 77972a3 commit 0efe125

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

net/netfilter/nf_conntrack_irc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,9 @@ static int help(struct sk_buff *skb, unsigned int protoff,
194194

195195
/* dcc_ip can be the internal OR external (NAT'ed) IP */
196196
tuple = &ct->tuplehash[dir].tuple;
197-
if (tuple->src.u3.ip != dcc_ip &&
198-
tuple->dst.u3.ip != dcc_ip) {
197+
if ((tuple->src.u3.ip != dcc_ip &&
198+
ct->tuplehash[!dir].tuple.dst.u3.ip != dcc_ip) ||
199+
dcc_port == 0) {
199200
net_warn_ratelimited("Forged DCC command from %pI4: %pI4:%u\n",
200201
&tuple->src.u3.ip,
201202
&dcc_ip, dcc_port);

0 commit comments

Comments
 (0)