[asterisk-bugs] [JIRA] (ASTERISK-28696) PJSIP exception when parsing 'Via' header

Sean Bright (JIRA) noreply at issues.asterisk.org
Wed Jan 15 19:14:26 CST 2020


    [ https://issues.asterisk.org/jira/browse/ASTERISK-28696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=249414#comment-249414 ] 

Sean Bright commented on ASTERISK-28696:
----------------------------------------

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.

> PJSIP exception when parsing 'Via' header
> -----------------------------------------
>
>                 Key: ASTERISK-28696
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-28696
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Channels/chan_pjsip
>    Affects Versions: 16.2.1
>         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/Linux
>            Reporter: Linus Holzmann
>
> 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: ....



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list