Re: [PATCH net-next v3 1/4] netfilter: conntrack: add shared port and uint parsers for helpers

From: Rahul

Date: Sun May 24 2026 - 07:25:19 EST


On Sun, May 03, 2026, Pablo Neira Ayuso wrote:
> You will need a "real name" here.
> In nf.git, there is a new function sip_strtouint() that can possibly
> be moved to nf_conntrack_helper.c.

Apologies — my name is Rahul. v4 will use "Rahul <rc@xxxxxxxxx>"
throughout.

I looked at 8cf6809cddcb ("netfilter: nf_conntrack_sip: don't use
simple_strtoul"). Florian's patch adds two local helpers:

- sip_strtouint(): generic bounded uint parser, used for expires,
cseq, clen, code, and port in process_sdp().
- sip_parse_port(): port-specific wrapper around sip_strtouint(),
used in epaddr_len(), ct_sip_parse_request(), and
ct_sip_parse_header_uri().

My v3 patch 4 already converts ct_sip_parse_request() and
ct_sip_parse_header_uri() to use nf_ct_helper_parse_port(), which
overlaps with what sip_parse_port() does.

Would it make sense to:

1. Align nf_ct_helper_parse_uint() with sip_strtouint()'s design
(same endp-on-error semantics, UINT_MAX cap) and export it.

2. In patch 4, drop sip_strtouint() from nf_conntrack_sip.c and
replace all its call sites with nf_ct_helper_parse_uint(), and
replace sip_parse_port() with nf_ct_helper_parse_port()?

That would consolidate both local helpers into the shared core and
avoid the overlap. I am happy to send a v4 along those lines if that
is the direction you prefer.

Thanks,
Rahul