Skip to content

Commit 451c9ce

Browse files
dglgregkh
authored andcommitted
netfilter: nf_conntrack_irc: Fix forged IP logic
[ Upstream commit 0efe125 ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 1ce55ec commit 451c9ce

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
@@ -188,8 +188,9 @@ static int help(struct sk_buff *skb, unsigned int protoff,
188188

189189
/* dcc_ip can be the internal OR external (NAT'ed) IP */
190190
tuple = &ct->tuplehash[dir].tuple;
191-
if (tuple->src.u3.ip != dcc_ip &&
192-
tuple->dst.u3.ip != dcc_ip) {
191+
if ((tuple->src.u3.ip != dcc_ip &&
192+
ct->tuplehash[!dir].tuple.dst.u3.ip != dcc_ip) ||
193+
dcc_port == 0) {
193194
net_warn_ratelimited("Forged DCC command from %pI4: %pI4:%u\n",
194195
&tuple->src.u3.ip,
195196
&dcc_ip, dcc_port);

0 commit comments

Comments
 (0)