[asterisk-bugs] [JIRA] (ASTERISK-26955) pjsip: SIP Packets with Via "received=" Containing IPv6 Address Delimited by "[]" Rejected

Linus Holzmann (JIRA) noreply at issues.asterisk.org
Wed Jan 15 21:46:25 CST 2020


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

Linus Holzmann edited comment on ASTERISK-26955 at 1/15/20 9:45 PM:
--------------------------------------------------------------------

@sean bright

i got the brackets IPv6 Address in via line from a server:
{{{noformat}
Sipwise NGCP Proxy 7.X


[2020-01-16 04:07:30] ERROR[2031] pjproject: sip_transport. Error processing 693 bytes packet from TCP 2001:4090:4008::173:5060 : PJSIP syntax error exception when parsing 'Via' header on line 2 col 142:
SIP/2.0 401 Unauthorized
Via: SIP/2.0/TCP [XXXX:XXXX:XXXX:X:XXXX:XXXX:XXXX:XXXX]:5060;rport=51521;branch=a7kD0bBPj6952067c-3811-11ea-bd57-33d5de08ee68;alias;received=[XXXX:XXXX:XXXX:X:XXXX:XXXX:XXXX:XXXX]
From: <sip:XXXXXXXXXXXXXXX at ipv6.sip.easybell.de>;tag=7a12e788-3811-11ea-9289-2728c0f90438
To: <sip:XXXXXXXXXXXXXXX at ipv6.sip.easybell.de>;tag=88a048cc381111ea82ebfbb25023fbb6.7855
Call-ID: 5fdcace6-3811-11ea-80e5-cb1a04e79ebd
CSeq: 2952 REGISTER
P-NGCP-Auth-IP: 192.168.251.44
P-NGCP-Auth-UA: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
WWW-Authenticate: Digest realm="sip.easybell.de", nonce="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
Server: Sipwise NGCP Proxy 7.X
Content-Length: 0

{noformat}}}


was (Author: siphony):
@sean bright

i got the brackets IPv6 Address in via line from a server:
{{
Sipwise NGCP Proxy 7.X


[2020-01-16 04:07:30] ERROR[2031] pjproject: sip_transport. Error processing 693 bytes packet from TCP 2001:4090:4008::173:5060 : PJSIP syntax error exception when parsing 'Via' header on line 2 col 142:
SIP/2.0 401 Unauthorized
Via: SIP/2.0/TCP [XXXX:XXXX:XXXX:X:XXXX:XXXX:XXXX:XXXX]:5060;rport=51521;branch=a7kD0bBPj6952067c-3811-11ea-bd57-33d5de08ee68;alias;received=[XXXX:XXXX:XXXX:X:XXXX:XXXX:XXXX:XXXX]
From: <sip:XXXXXXXXXXXXXXX at ipv6.sip.easybell.de>;tag=7a12e788-3811-11ea-9289-2728c0f90438
To: <sip:XXXXXXXXXXXXXXX at ipv6.sip.easybell.de>;tag=88a048cc381111ea82ebfbb25023fbb6.7855
Call-ID: 5fdcace6-3811-11ea-80e5-cb1a04e79ebd
CSeq: 2952 REGISTER
P-NGCP-Auth-IP: 192.168.251.44
P-NGCP-Auth-UA: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
WWW-Authenticate: Digest realm="sip.easybell.de", nonce="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
Server: Sipwise NGCP Proxy 7.X
Content-Length: 0

}}

> pjsip: SIP Packets with Via "received=" Containing IPv6 Address Delimited by "[]" Rejected
> ------------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-26955
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-26955
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: pjproject/pjsip
>    Affects Versions: 14.3.0
>         Environment: using Asterisk on Debian 8.7, built with
> ./configure --with-pjproject-bundled
>            Reporter: Peter Sokolov
>            Assignee: Unassigned
>            Severity: Minor
>
> When using PJSIP and a SIP packet containing Via "received" with an IPv6 address delimited by "[" and "]" is received, PJSIP drops such a packet complaining about the "[" and "]". No calls can be established.
> Via: SIP/2.0/UDP [2001:db8::9:1];received=[2001:db8::9:255];branch=z9hG4bKas3-111
> RFC5118 sais that even though this is not a valid request based on a strict interpretation of the grammar in [RFC3261], robust implementations must nonetheless be able to parse the topmost Via header field and continue processing the request. I assume that Asterisk should be treated as a robust implementation.
> Channel SIP has no problems with SIP packets containing Via received= with the IPv6 address in brackets.
> Here is the relevant part of the log. Nothing comes after that. Just like the packet had not been received at all:
> {noformat}
> [Feb  4 23:21:19] ERROR[26339]: pjproject:0 <?>:        sip_transport. Error processing 503 bytes packet from UDP 2a00:130:1093:2:d7ff:fe39:b8d7:123:5060 : PJSIP syntax error exception when parsing 'Via' header on line 2 col 119:
> SIP/2.0 100 Trying
> Via: SIP/2.0/UDP [2a00:123:c17:1c3f::5]:5060;rport=5060;branch=z9hG4bKPjb636b737-5c82-4238-b5ba-0d98dbe86f27;received=[2a00:123:c17:1c3f::5]
> From: "Phone 202" <sip:202@[2a00:123:c17:1c3f::5]>;tag=98eb3897-57dd-45c8-a9f2-4909c812f0a9
> To: <sip:203@[2a00:130:1093:2:d7ff:fe39:b8d7:123];uniq=C09040DC74C0F2A9D6039136CB478>
> Call-ID: d82b4318-108b-4b46-8ec9-b4e4e2200a98
> CSeq: 1012 INVITE
> User-Agent: AVM FRITZ!Box 7330 107.06.50 (Apr  1 2016)
> Content-Length: 0
> {noformat}
> In the file src/asterisk/third-party/pjproject/source/pjsip/src/pjsip/sipparser.c no brackets are included in pconst.pjsip_VIA_PARAM_SPEC and pconst.pjsip_VIA_PARAM_SPEC_ESC. Adding both brackets to both of them using pj_cis_add_str, Asterisk starts accepting SIP packets that include Via: lines as the one mentioned above, however I do not know whether that is a correct solution.



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



More information about the asterisk-bugs mailing list