🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27504

Re: [PATCH netfilter-next] netfilter: nf_conntrack_sip: tear down expectations on CANCEL

#27504
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 21:11
156 lines
14055 bytes
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
Technical Details
Message-ID: <179650511304.3148.816369446918339593@kernel.org>
Path: mbox-mo1.pugleaf.net!news-ams.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378129-linux-kernel-netdev=dewy.ru
References: <20261201205747.478614-1-florian.fainelli@broadcom.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-ams.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378129-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH netfilter-next] netfilter: nf_conntrack_sip: tear down
 expectations on CANCEL
Date: Sat, 05 Dec 2026 21:11:53 +0000
Organization: Usenet Network
Message-ID: <179650511304.3148.816369446918339593@kernel.org>
References: <20261201205747.478614-1-florian.fainelli@broadcom.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3121401"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:sOGdMYjBCUgsJAC1QeUkRyAMzxE= sha256:WNGCi8lUz4wRJOITV0VNPirfr7+LNlIk4pR74Dk/2Uw=
	sha1:bJJWHr4HDOQVjiJ3lxpqjmGQb00= sha256:6+zbvx7FYyXBwIyX+qVFFuNjlefJSvJp+dzYHfgkb88=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 33C71117EA0; Sun,  6 Dec 2026 00:12:18 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.539
X-Spam-Status: No, score=-3.539 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id NTEBSfko80wc;
	Sun,  6 Dec 2026 00:12:10 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-378129-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 0DAF2117DDD; Sun,  6 Dec 2026 00:11:59 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 06A232B13B; Sat,  5 Dec 2026 21:11:56 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796505115;
	b=1q+c5NX7Wr5tB7ONkQoMMGBMskfpAcpfKu5HYJDY5kxiqwHE+hHyp6VWDNU+2o0baQii
	 ZDywWhPh2eXaE/4fH2ADbAPEbbxJwcemTgizgTZXTpKRx2j2MyIEosuFv9GT6GLeTdW+l
	 1NaJSjwTPPXuMljn6+VhNXZ3Dnu3AzkNk5h4nWj5Z51nthtqwFj4nbWcHnH2WUbB4VerZ
	 0wOVeLdH0HeugatOdL/riDI7ep4qskhMSGCfypZRex15rOLhTquOguiBNikeHUWn6w80N
	 BPn8xUARa3US9dr6Yp4ivs2P/kUkcGKOxn0TQtm5GcQjbxr1/sC7BaJta5M8O3iKNhg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796505115;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=AJrA9X7ExcYJ5hBqvV9HQXMNHlmv5wI5Zeum7bsbNkI=;
	b=DY/uc85Uw8FMNva/KCKO+ZHYNjf+n9MqOQ3nUfrH2AMVaYwuIDDZmQGMMrFqeVhnqAIQ
	 tAxcwxZ82sZ91fRVVBotztGhg/aOjFxHBmc5hq6FNPNLVHq92CGCq4YaPo3CB/Iu0XMpG
	 V6hSlVtRGeR5+L9zW13aYEd5JIHLOyeQgplqWGBATHb2kRkkSadZTXlqwB18YStWqWNne
	 H9LdL85ipGlhdlgjvH6WgTq5ePbEq1KeOvxheReBjVXYOy+QAVvlHxjaYPFwICcTlGs0w
	 KRVLYK/viLNm4UmLMLfQIMQzDDTMnfc8hIP5JUC5aLj6eYzTL4mv0gfV9M+JrqKs8Ew==
X-ARC-Authentication-Results: i=2; 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=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 45F3D606A339;
	Sat,  5 Dec 2026 21:11:55 +0000 (UTC)
X-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
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-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==
X-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==
X-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
X-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)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B2231F0092B;
	Sat,  5 Dec 2026 21:11:53 +0000 (UTC)
X-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==
X-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
X-In-Reply-To: <20261201205747.478614-1-florian.fainelli@broadcom.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list