From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796505114; b=YM7i2xEml6k7ERazZSdEiSPrzsRB92/AqQuZPTKUoBcxKzP4aGoLcB/UklXaSxOTpCF3 QwDbINOCEXq0XvIxWvanPQntfpOkGYJ+IQX/0opqHsv05fALktJUCs8+0Sju/XdBu6SeP 63m6fZDJYY2sFnOoK49br9iviOK+ujGQUAzXu1JZ72N9lJV3yixVn8ci+qeQZ389NE487 K+NJkZoZEh6TvCi+j+oXzEG6VbnjX9cGL8zWHoQPPdLRv/9lGBqEvllOXOYfUjbmeIUtr ASss+qjBivPWB8WDB9QzOt6UBJW+GrRo/3gTnmUTar5hXrJifBtXcx2hoLarQlxl+9A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796505114; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=AJrA9X7ExcYJ5hBqvV9HQXMNHlmv5wI5Zeum7bsbNkI=; b=AiXCLQff1xMOxvz87aDqTkxNmeEGWAum+BXFdpEQ9McAcoKx6HNa6TseTniWs9C5A1sK EkdptnJMzR9YNjWPGbaKPtLxs2qlydJSQZD8xYZQbHOwCLspTuQwLQWY2MvoF22zlj/Hl AD4JkNy1IjyzTxkq/eMYzE/Z3GFVlYJHws9lHSSKrfHpxue58YGhdqcva9VQzvRCDWBfO OvU5wXmCcPrjTbzATvqLhFSHKk41H4jSXAVZIj6vGTChr2Q+evefMATbTDGtcWuslCHq1 a3PDtPTNnahXse4ZIQLGiw5vPD0R2uP9nw2lLowaPF0A3oA6mQBbrupMnI+9wJF/1mA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=J6cph938; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61D5B606A31F; Sat, 5 Dec 2026 21:11:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=J6cph938 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B2231F0092B; Sat, 5 Dec 2026 21:11:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796505114; bh=AJrA9X7ExcYJ5hBqvV9HQXMNHlmv5wI5Zeum7bsbNkI=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=J6cph938Lrz72GVk9cix0Z5jQtNo+ghmzMPLgyw9gwzsDy5wQQS+Z3RDfN01XZWzB YQU+CtcJRrbcSUX9sFT7zcAK6ADdE4zXVtFLoEdSsc9cEAXjbln9pCHLBoQ7pwsGvq J8F5HAv8J6eM72IsH8DiQI/N9DfXex6TbArCSdjD5RYExU9PNmwCLZRC1318kUgzD+ rtNl1et/26amy1eSbYw6kX0DSP+/r1QigyEv0uFNQSdEdiOf2Y6o/4rbi4T19vZF1f z2SKaGZWlvMVUSqLowoIf1V/uZTgdaLIQyzUTs/OIq7uKuhoazYlWrG5+l5v35+ehY JQ4gFWIYfjqGQ== Subject: Re: [PATCH netfilter-next] netfilter: nf_conntrack_sip: tear down expectations on CANCEL From: netdev-bot+sashiko@kernel.org To: florian.fainelli@broadcom.com Cc: netdev@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, anand.gore@broadcom.com, pablo@netfilter.org, kadlec@netfilter.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-kernel@vger.kernel.org Date: Sat, 05 Dec 2026 21:11:53 +0000 Message-ID: <179650511304.3148.816369446918339593@kernel.org> In-Reply-To: <20261201205747.478614-1-florian.fainelli@broadcom.com> References: <20261201205747.478614-1-florian.fainelli@broadcom.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 2 · Low: 1 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] The new CANCEL entry in sip_handlers[] (net/netfilter/nf_conntrack_sip.c:1519) routes every CANCEL request to… - [Medium] The commit message misstates RFC 3261 and suggests a bug the code does not have. - [Low] Before the patch, no sip_handlers[] entry matched a "CANCEL " request line, so process_sip_request() left the loop and returned… -- netfilter: nf_conntrack_sip: tear down expectations on CANCEL This patch adds a CANCEL entry to sip_handlers[] that sends CANCEL requests to process_bye_request(). The goal is to release the RTP/RTCP expectations created for an INVITE transaction that is being cancelled. > RFC 3261 requires a CANCEL request to terminate the pending INVITE > transaction it targets the same way a BYE would for an established > dialog, including releasing any RTP/RTCP expectations created for it. [Severity: Medium] Is this description of RFC 3261 accurate? Under section 9.2, a CANCEL only asks the UAS to stop a request that is still pending. It has no effect once a final response has been sent. When it does take effect, the UAS answers the INVITE with 487 Request Terminated. That 487 (CSeq N INVITE) already goes through process_sip_response()->process_invite_response(): net/netfilter/nf_conntrack_sip.c:process_invite_response() { ... if ((code >= 100 && code <= 199) || (code >= 200 && code <= 299)) return process_sdp(skb, protoff, dataoff, dptr, datalen, cseq); else if (ct_sip_info->invite_cseq == cseq) flush_expectations(ct, true); ... } So the expectations for a cancelled INVITE already seem to be released without this patch. The message also says the expectations "created for it" are released. However, flush_expectations() removes every media expectation on the master conntrack. Is there a concrete case that the 487 path misses? Without one, and without a Fixes: tag, it is hard to tell what bug is being fixed. The message also leaves out the one behaviour change: expectations are now flushed when the CANCEL arrives, even if the CANCEL ends up having no effect. > diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c > index b05dc8858d094..1e649bd2c0d8f 100644 > --- a/net/netfilter/nf_conntrack_sip.c > +++ b/net/netfilter/nf_conntrack_sip.c > @@ -1516,6 +1516,7 @@ static const struct sip_handler sip_handlers[] = { > SIP_HANDLER("ACK", process_sdp, NULL), > SIP_HANDLER("PRACK", process_sdp, process_prack_response), > SIP_HANDLER("BYE", process_bye_request, NULL), > + SIP_HANDLER("CANCEL", process_bye_request, NULL), [Severity: Medium] Can this remove the media expectations of a call that is established or about to be? process_bye_request() ignores its cseq argument and always flushes: net/netfilter/nf_conntrack_sip.c:process_bye_request() { ... flush_expectations(ct, true); return NF_ACCEPT; } flush_expectations() then unlinks every non-signalling expectation on the master conntrack. That includes RTP/RTCP/T.38 expectations that nf_nat_sip set up for SDP it rewrote. Nothing checks that the CANCEL targets the INVITE this conntrack is tracking. RFC 3261 section 9.1 says the CANCEL's CSeq number equals the cancelled request's. process_invite_request() stores that number in ct_sip_info->invite_cseq. Nothing checks that the INVITE is still pending, either. The response paths are process_invite_response(), process_update_response() and process_prack_response(). Each of them flushes only when ct_sip_info->invite_cseq == cseq. The 487 sent after a successful CANCEL already passes that check. So the new flush only changes behaviour when the CANCEL should have no effect: - A CANCEL that crosses a 200 OK. The 200 OK's SDP has already created the answer expectations through process_invite_response()->process_sdp(), and the CANCEL then removes them. - A conntrack that carries several dialogs, such as a 5060<->5060 proxy/PBX trunk. A CANCEL for one transaction, for example the losing branch of a forked INVITE, removes expectations that another dialog's 2xx SDP answer created afterwards. - A stale or retransmitted CANCEL, or one whose CSeq does not match invite_cseq. In those cases, RTP/RTCP that hasn't started yet is no longer RELATED or DNAT-translated to the ports in the SDP. The result is one-way audio or no audio. Would comparing cseq against ct_sip_info->invite_cseq, as the response paths do, match the stated intent? Or could this rely on the existing 487 path instead? [Severity: Low] Before this patch, no sip_handlers[] entry matched a "CANCEL " request line, so process_sip_request() returned NF_ACCEPT without parsing CSeq. With this entry, CANCEL now goes through the CSeq checks: net/netfilter/nf_conntrack_sip.c:process_sip_request() { ... if (ct_sip_get_header(ct, *dptr, 0, *datalen, SIP_HDR_CSEQ, &matchoff, &matchlen) <= 0) { nf_ct_helper_log(skb, ct, "cannot parse cseq"); return NF_DROP; } cseq = sip_strtouint(*dptr + matchoff, *datalen - matchoff, (char **)&end); if (*dptr + matchoff == end) { nf_ct_helper_log(skb, ct, "cannot get cseq"); return NF_DROP; } ... } A CANCEL with a missing or non-numeric CSeq is now dropped instead of passed through. Only CANCELs that break RFC 3261 are affected, and other handled methods already get the same drop policy. Should the commit message mention this change? -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201205747.478614-1-florian.fainelli%40broadcom.com