netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] conntrackd: helpers/rpc: Don't add expectation table entry for portmap port
@ 2024-04-25 12:13 pda Pfeil Daniel
  2024-06-19  7:48 ` AW: " pda Pfeil Daniel
  2024-06-19 11:03 ` Pablo Neira Ayuso
  0 siblings, 2 replies; 6+ messages in thread
From: pda Pfeil Daniel @ 2024-04-25 12:13 UTC (permalink / raw)
  To: netfilter-devel@vger.kernel.org

After an RPC call to portmap using the portmap program number (100000),
subsequent RPC calls are not handled correctly by connection tracking.
This results in client connections to ports specified in RPC replies
failing to operate.

This issue arises because after an RPC call to portmap using the
program number 100000, conntrackd adds an expectation table entry
for the portmap port (typically 111). Due to this expectation table
entry, subsequent RPC call connections are treated as sibling
connections. Due to kernel restrictions, the connection helper for
sibling connections cannot be changed. This is enforced in the kernel's
handling in "net/netfilter/nf_conntrack_netlink.c", within the
"ctnetlink_change_helper" function, after the comment:
/* don't change helper of sibling connections */.
Due to this kernel restriction, the private RPC data (struct rpc_info)
sent from conntrackd to kernel-space is discarded by the kernel.

To resolve this, the proposed change is to eliminate the creation of
an expectation table entry for the portmap port. The portmap port has
to be opened via an iptables/nftables rule anyway, so adding an
expectation table entry for the portmap port is unnecessary.

Why do our existing clients make RPC calls using the portmap program
number? They use these calls for cyclic keepalive messages to verify
that the link between the client and server is operational.

Signed-Off-By: Daniel Pfeil <pda@keba.com>
---
 src/helpers/rpc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/helpers/rpc.c b/src/helpers/rpc.c
index 732e9ba..d8e4903 100644
--- a/src/helpers/rpc.c
+++ b/src/helpers/rpc.c
@@ -399,6 +399,11 @@ rpc_helper_cb(struct pkt_buff *pkt, uint32_t protoff,
 				 xid, rpc_info->xid);
 			goto out;
 		}
+		/* Ignore portmap program number */
+		if (rpc_info->pm_prog == PMAPPROG) {
+			pr_debug("RPC REPL: ignore portmap program number %lu\n", PMAPPROG);
+			goto out;
+		}
 		if (rpc_reply(data, offset, datalen, rpc_info, &port_ptr) < 0)
 			goto out;
 
-- 
2.30.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-06-19 13:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-25 12:13 [PATCH] conntrackd: helpers/rpc: Don't add expectation table entry for portmap port pda Pfeil Daniel
2024-06-19  7:48 ` AW: " pda Pfeil Daniel
2024-06-19 11:03 ` Pablo Neira Ayuso
2024-06-19 11:08   ` Pablo Neira Ayuso
2024-06-19 11:29     ` AW: " pda Pfeil Daniel
2024-06-19 13:08       ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).