Re: [Sip] RFC 3261 - 16.10 (CANCEL processing in a Proxy)

Iñaki Baz Castillo <ibc@aliax.net> Tue, 19 April 2011 15:23 UTC

Return-Path: <ibc@aliax.net>
X-Original-To: sip@ietfc.amsl.com
Delivered-To: sip@ietfc.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfc.amsl.com (Postfix) with ESMTP id EC2BDE0786 for <sip@ietfc.amsl.com>; Tue, 19 Apr 2011 08:23:23 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.394
X-Spam-Level:
X-Spam-Status: No, score=-2.394 tagged_above=-999 required=5 tests=[AWL=0.283, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, MIME_8BIT_HEADER=0.3, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([208.66.40.236]) by localhost (ietfc.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jS0SMAVCUXZq for <sip@ietfc.amsl.com>; Tue, 19 Apr 2011 08:23:23 -0700 (PDT)
Received: from mail-qy0-f172.google.com (mail-qy0-f172.google.com [209.85.216.172]) by ietfc.amsl.com (Postfix) with ESMTP id 2C321E0758 for <sip@ietf.org>; Tue, 19 Apr 2011 08:23:04 -0700 (PDT)
Received: by qyk29 with SMTP id 29so1666368qyk.10 for <sip@ietf.org>; Tue, 19 Apr 2011 08:23:03 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.229.71.205 with SMTP id i13mr4425521qcj.279.1303226583642; Tue, 19 Apr 2011 08:23:03 -0700 (PDT)
Received: by 10.229.75.7 with HTTP; Tue, 19 Apr 2011 08:23:03 -0700 (PDT)
In-Reply-To: <4DADA292.6060906@bell-labs.com>
References: <BANLkTi=mob149EFPTffkCUa+j-2dd=9k7A@mail.gmail.com> <4DADA292.6060906@bell-labs.com>
Date: Tue, 19 Apr 2011 17:23:03 +0200
Message-ID: <BANLkTindAUS=ArC0C12Xd8UzYUrFEJpoGw@mail.gmail.com>
From: Iñaki Baz Castillo <ibc@aliax.net>
To: "Vijay K. Gurbani" <vkg@bell-labs.com>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Cc: sip@ietf.org
Subject: Re: [Sip] RFC 3261 - 16.10 (CANCEL processing in a Proxy)
X-BeenThere: sip@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Session Initiation Protocol <sip.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/sip>, <mailto:sip-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/sip>
List-Post: <mailto:sip@ietf.org>
List-Help: <mailto:sip-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/sip>, <mailto:sip-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 19 Apr 2011 15:23:24 -0000

2011/4/19 Vijay K. Gurbani <vkg@bell-labs.com>:
> Consider what happens if a stateful proxy proxies an INVITE downstream
> and then promptly crashes.  It is duly chastised and quickly brought up
> again, and it now sees a CANCEL to the INVITE it had previously proxied
> downstream before crashing (assume that all the transaction state was
> wiped out when the proxy crashed).
>
> What should it do now?  If it issues a locally generated 481, it allows
> the downstream server that received the INVITE to continue processing
> it.  If it sends the CANCEL statelessly, it may hit the same downstream
> server and cease processing.
>
> Regardless of the behaviour of the proxy, things will still tend to
> work out okay since by the old SIP mantra, each transaction completes
> independently of others.  So, regardless of whether the proxy generates
> a 481 (CANCEL) or sends the CANCEL downstream allowing the downstream
> server to generate a final response (say 2xx-class) for the CANCEL,
> the state machinery of the upstream UAC remains idempotent with respect
> to a reply.  That is, the 481 or 2xx for the CANCEL closes the pending
> CANCEL transaction at the UAC, and it now waits for a final response
> for the INVITE it send out earlier.
>
> All this said, I believe that most SIP servers that operate statefully
> simply send out a 481 on a CANCEL they cannot match to a pending
> transaction.


Thanks Vijay. What you say makes lot of sense, however handling a
CANCEL after crashing is not the only problem in a proxy:

Your text assumes that the proxy doesn't store the transaction
state/data in a permanent backend so it can not recover it after
rebooting (sure this is true in 99% of the existing implementations).
So imagine that, after rebooting in the middle of a INVITE transaction
in proceeding state, the UAS sends a final response to the UAC:

According to RFC 6026 (which updates RFC 3261):

      When a response is received by an element, it first tries to
      locate a client transaction (Section 17.1.3) matching the
      response.  If a transaction is found, the response is handed to
      the client transaction.  If none is found, the element MUST NOT
      forward the response.

So the response wouldn't arrive to the UAC (which would also produce
several issues, similar as if the CANCEL sent by the UAC is not
forwarded to the UAS).


This is, originally RFC 3261 seems to handle the case in which a proxy
is rebooted (CANCEL forwarded stateless, responses statelessly
forwarded based on second Via...) but then RFC 6026 arrives an changes
it (basically to avoid DoS attacks, the same attack that can occur if
a proxy routes statelessly CANCEL's not matching a transaction). So it
seems it is not very clear which philosophy to follow, do you agree?
:)


Best regards.


-- 
Iñaki Baz Castillo
<ibc@aliax.net>