[Home]

Summary:ASTERISK-28696: PJSIP exception when parsing 'Via' header
Reporter:Linus Holzmann (siphony)Labels:
Date Opened:2020-01-15 18:20:03.000-0600Date Closed:2020-01-15 19:20:57.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:Channels/chan_pjsip
Versions:16.2.1 Frequency of
Occurrence
Constant
Related
Issues:
duplicatesASTERISK-26955 pjsip: SIP Packets with Via "received=" Containing IPv6 Address Delimited by "[]" Rejected
Environment:Asterisk 16.2.1~dfsg-1+deb10u1 Linux raspberrypi 4.19.75-v8+ #1270 SMP PREEMPT Tue Sep 24 18:59:17 BST 2019 aarch64 GNU/LinuxAttachments:
Description:On a register attemp, the server response throws a exception in the parsing of IPv6 opening bracket of "received=[" line.
effectively turning Registration Status Rejected.
same configuration works fine on IPv4 (dual stack sip server)

[2020-01-16 00:26:19] ERROR[2031] pjproject: sip_transport. Error processing 682 bytes packet from TCP ffff:ffff:ffff::fff:5060 : PJSIP syntax error exception when parsing 'Via' header on line 2 col 142:
SIP/2.0 401 Unauthorized
Via: SIP/2.0/TCP [ffff:ffff:ffff:f:ffff:ffff:ffff:ffff]:5060;rport=42469;branch=z1hG4bKPj324aeb17-bce0-4d10-778f-274e41430b5b;alias;received=[ffff:ffff:ffff:f:ffff:ffff:ffff:ffff]
From: ....
Comments:By: Asterisk Team (asteriskteam) 2020-01-15 18:20:03.817-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

By: Sean Bright (seanbright) 2020-01-15 19:14:18.884-0600

This is technically specification compliant behavior - from [RFC 3261 section 25.1|https://tools.ietf.org/html/rfc3261#section-25.1]:

{noformat}
via-received      =  "received" EQUAL (IPv4address / IPv6address)
{noformat}

and:

{noformat}
IPv6reference  =  "[" IPv6address "]"
IPv6address    =  hexpart [ ":" IPv4address ]
{noformat}

So the value of the {{received}} parameter is expected to be an {{IPv6address}} (no brackets), rather than an {{IPv6reference}} (with brackets). That being said, [RFC 5118 section 4.5|https://tools.ietf.org/html/rfc5118#section-4.5] says:

{noformat}
While it would be beneficial if the same non-terminal
("IPv6reference") was used for both the "sent-by" and "via-received"
production rules, there has not been a consensus in the working group
to that effect.  Thus, the best that can be suggested is that
implementations must follow the Robustness Principle [RFC1122] and be
liberal in accepting a "received" parameter with or without the
delimiting "[" and "]" tokens.  When sending a request,
implementations must not put the delimiting "[" and "]" tokens.
{noformat}

So pjsip should probably be more lenient when parsing.

By: Sean Bright (seanbright) 2020-01-15 19:20:57.648-0600

Duplicate of ASTERISK-26955