Re: [sr-dev] [kamailio/kamailio] IPv6 parse_uri error (#1136)

2017-06-22 Thread Donald Carr
Ok, if you are saying your configuration fix would correctly work to check the 
address type at run-time, then I guess it would work. Otherwise, it would be 
all IPv6 or all IPv4. 

The fix you added that adds the brackets automatically at run-time for $siz is 
the best way actually, as then you do not need cryptic configuration files.

So, in any case, thanks very much for adding the new function that 
automatically adds the brackets when needed.

If I have permission from Verizon, I might like to contribute in the future. I 
can see a need to immediately parse the incoming messages and immediately 
reject any message with any part not formed correctly, rather than passing bad 
things through the code and crashing later. Also, would be good to switch to 
not use the old depricated system calls for networking (avoids dangerous 
mucking with the IP address structures and also avoid case switches for IPv4 vs 
IPv6). The new calls reduce the specific code for IPv4 vs IPv6 to an absolute 
minimum. I would  also use the system calls to convert IP address to string 
instead of the hand written ones, etc. 

Don.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1136#issuecomment-310512913___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] IPv6 parse_uri error (#1136)

2017-06-22 Thread Daniel-Constantin Mierla
I have installations with IPv6 since 2002 and they work. I don't get what you 
mean by "all existing installations will start working with IPv6 when they 
upgrade".

And as I said, I use bare IPv6 in a lot of database tables that I query with 
sqlops or do HTTP API requests to external systems that expect standard IPv6 
format.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1136#issuecomment-310499942___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] IPv6 parse_uri error (#1136)

2017-06-22 Thread Donald Carr
Ok, sorry, I posted about the same time. We will use your fix using "siz"  as 
the function name. Not sure there is any place you need it without brackets . . 
.  Thanks.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1136#issuecomment-310499408___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] IPv6 parse_uri error (#1136)

2017-06-22 Thread Donald Carr
My opinion is it is better to just change the existing code, and all existing 
installations will start working with IPv6 when they upgrade. It is also much 
simpler.

However, the following has been tested and also works to add a $ function that 
returns a correct IP string for IPv6:

The following would need to be added to the table in modules/pv/pv.c 
{{"sibr", (sizeof("sibr")-1)}, /* */
PVT_OTHER, pv_get_srcip_bracket, 0,
0, 0, 0, 0},

Then a new function in modules/pv/pv.c 
/* The following fundtion gets the source IP with brackets for IPv6  */
int pv_get_srcip_bracket(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res)
{
str s;
if(msg==NULL)
return -1;

s.s = ip_addr2strz(>rcv.src_ip);
s.len = strlen(s.s);
return pv_get_strval(msg, param, res, );
}

Finally, a change to the config file line:
   append_hf("Path: 
\r\n")



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1136#issuecomment-310497694___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] IPv6 parse_uri error (#1136)

2017-06-22 Thread Daniel-Constantin Mierla
The $si is one of the oldest variables, being in this form from beginning. Not 
sure about others, but I use it in many API requests or sqlops queries. 
Moreover, the definition of an IPv6 address is without brackets. The brackets 
are in the grammar of an address or URI. The $si won't change, I can bet is 
going to break a lot of configs. I added $siz to master branch that should 
return the ipv6 address in between brackets.

I am closing this one being a config issue, not a code problem. If you still 
think there is not enough space in the static buffer, open a new issue pointing 
in the code where you think the problem is.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1136#issuecomment-310495178___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] IPv6 parse_uri error (#1136)

2017-06-22 Thread Daniel-Constantin Mierla
Btw, where is the issue with the null termination, the buffers seem to be 
defined with `max_address_len + 1`? Can you point in the source code (file path 
and line)?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1136#issuecomment-310288369___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] IPv6 parse_uri error (#1136)

2017-06-21 Thread David Wang
@miconda Thank you so much for your advice! We will try your suggestion.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1136#issuecomment-310254309___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] IPv6 parse_uri error (#1136)

2017-06-21 Thread doncarr
@linuxmaniac, @miconda, I work with @davidxbwang 

I found the issue in modules/pv/pv_core.c. Function pv_get_srcip(). We should 
substitute the function ip_addr2strz() for ip_addr2a(). ip_addr2strz() 
correctly inserts the [] in the string when the address is IPv6. Also, I 
noticed that both of these functions use a static buffer that is one character 
too small. Since they put a null terminator, if you have a maximum size IPv6 
address (no leading zeros) you will overwrite the end of the buffer. 

We tested the fix, and, it appears to not affect other parts of the code that 
might not expect the brackets [] added.  

Below the fix is shown with the old line commented out.

int pv_get_srcip(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res)
{
str s;
if(msg==NULL)
return -1;
 
//s.s = ip_addr2a(>rcv.src_ip);
s.s = ip_addr2strz(>rcv.src_ip);
s.len = strlen(s.s);
return pv_get_strval(msg, param, res, );
}
 
Don.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1136#issuecomment-310208571___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] IPv6 parse_uri error (#1136)

2017-06-17 Thread David Wang
@linuxmaniac Thank you. I corrected a format issue in my previous post. How to 
select "markdown format"?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1136#issuecomment-309224390___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] IPv6 parse_uri error (#1136)

2017-06-16 Thread Victor Seva
@davidxbwang please use markdown format when pasting.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1136#issuecomment-309082579___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] IPv6 parse_uri error (#1136)

2017-06-14 Thread David Wang
It seems like this issue is introduced by PCSCF when Soft Phone registers. The 
SIP Register from PCSCF to ICSCF is as below:

REGISTER sip:ims.mnc001.mcc001.3gppnetwork.org SIP/2.0
Via: SIP/2.0/UDP 
[FC00:1235:1:0:0:0:0:45];branch=z9hG4bK9fc5.213ad03f122aa3a2b0840eae36a852ba.1
Via: SIP/2.0/UDP 
[fc00:1235:3:1::]:5060;rport=5060;received=FC00:1235:3:1:0:0:0:0;branch=z9hG4bK2107430722
From: ;tag=60956342
To: 
Call-ID: 2069996946
CSeq: 1 REGISTER
Contact: 

Max-Forwards: 69
User-Agent: Linphone/3.6.1 (eXosip2/4.1.0)
Expires: 3600
Content-Length: 0
Path: 

Supported: path
Require: path
P-Visited-Network-ID: ims.mnc001.mcc001.3gppnetwork.org

The SIP Register from Soft Phone is fine:

REGISTER sip:ims.mnc001.mcc001.3gppnetwork.org SIP/2.0
Via: SIP/2.0/UDP [fc00:1235:3:1::]:5060;branch=z9hG4bK2107430722
From: ;tag=60956342
To: 
Call-ID: 2069996946
CSeq: 1 REGISTER
Contact: 
Max-Forwards: 70
User-Agent: Linphone/3.6.1 (eXosip2/4.1.0)
Expires: 3600
Content-Length: 0


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1136#issuecomment-308493913___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] IPv6 parse_uri error (#1136)

2017-06-06 Thread David Wang
Attached is wireshark log. Thank you!

[ipv6 Jitsi parse 
error.pcapng.zip](https://github.com/kamailio/kamailio/files/1055707/ipv6.Jitsi.parse.error.pcapng.zip)



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1136#issuecomment-306537122___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] IPv6 parse_uri error (#1136)

2017-06-06 Thread David Wang
Thank you, miconda. We don't set r-uri value in pcscf.cfg, icscf.cfg or 
scscf.cfg. I will show more details below using the logs with Jitsi. I will 
omit SDP to save space.

1. When PCSCF received the Sip Invite from caller, the Sip headers look fine:

INVITE sip:b...@ims.mnc001.mcc001.3gppnetwork.org SIP/2.0
Call-ID: 0b23b2ee62c061ae9f3cc1569b7824b3@0:0:0:0:0:0:0:0
CSeq: 1 INVITE
From: "alice" ;tag=94b2833a
To: 
Via: SIP/2.0/UDP 
[fc00:1234:3:1:0:0:0:0]:5060;branch=z9hG4bK-393032-567b1c47371a83386f685807100ab5bd
Max-Forwards: 70
Contact: "alice" 

User-Agent: Jitsi2.10.5550Linux
Content-Type: application/sdp
Content-Length: 910

2. Then PCSCF sent it to SCSCF:

INVITE sip:b...@ims.mnc001.mcc001.3gppnetwork.org SIP/2.0
Route: 
Record-Route: 

Call-ID: 0b23b2ee62c061ae9f3cc1569b7824b3@0:0:0:0:0:0:0:0
CSeq: 1 INVITE
From: "alice" ;tag=94b2833a
To: 
Via: SIP/2.0/UDP 
[FC00:1234:1:0:0:0:0:45];branch=z9hG4bK0d1b.9247221bd3cd63299ff9b3e1486a94e0.0
Via: SIP/2.0/UDP 
[fc00:1234:3:1:0:0:0:0]:5060;rport=5060;branch=z9hG4bK-393032-567b1c47371a83386f685807100ab5bd
Max-Forwards: 69
Contact: "alice" 

User-Agent: Jitsi2.10.5550Linux
Content-Type: application/sdp
Content-Length: 910
P-Asserted-Identity: 
X-RTP: mo

3. The SCSCF sent to ICSCF:

INVITE sip:b...@ims.mnc001.mcc001.3gppnetwork.org SIP/2.0
Record-Route: 
Record-Route: 

Call-ID: 0b23b2ee62c061ae9f3cc1569b7824b3@0:0:0:0:0:0:0:0
CSeq: 1 INVITE
From: "alice" ;tag=94b2833a
To: 
Via: SIP/2.0/UDP 
[FC00:1234:1:0:0:0:0:47];branch=z9hG4bK0d1b.3b5263a0a9b70cdde23243c3423be371.0
Via: SIP/2.0/UDP 
[FC00:1234:1:0:0:0:0:45];branch=z9hG4bK0d1b.9247221bd3cd63299ff9b3e1486a94e0.0
Via: SIP/2.0/UDP 
[fc00:1234:3:1:0:0:0:0]:5060;rport=5060;branch=z9hG4bK-393032-567b1c47371a83386f685807100ab5bd
Max-Forwards: 68
Contact: "alice" 

User-Agent: Jitsi2.10.5550Linux
Content-Type: application/sdp
Content-Length: 910
X-RTP: mo
P-Asserted-Identity: 

4. Then ICSCF sent it to SCSCF:

INVITE sip:b...@ims.mnc001.mcc001.3gppnetwork.org SIP/2.0
Route: 
Record-Route: 
Record-Route: 

Call-ID: 0b23b2ee62c061ae9f3cc1569b7824b3@0:0:0:0:0:0:0:0
CSeq: 1 INVITE
From: "alice" ;tag=94b2833a
To: 
Via: SIP/2.0/UDP 
[FC00:1234:1:0:0:0:0:46];branch=z9hG4bK0d1b.acefb88ca4d295d2bd315467f0670d7f.1
Via: SIP/2.0/UDP 
[FC00:1234:1:0:0:0:0:47];branch=z9hG4bK0d1b.3b5263a0a9b70cdde23243c3423be371.0
Via: SIP/2.0/UDP 
[FC00:1234:1:0:0:0:0:45];branch=z9hG4bK0d1b.9247221bd3cd63299ff9b3e1486a94e0.0
Via: SIP/2.0/UDP 
[fc00:1234:3:1:0:0:0:0]:5060;rport=5060;branch=z9hG4bK-393032-567b1c47371a83386f685807100ab5bd
Max-Forwards: 67
Contact: "alice" 

User-Agent: Jitsi2.10.5550Linux
Content-Type: application/sdp
Content-Length: 910
X-RTP: mo
P-Asserted-Identity: 

5. Then SCSCF sent it to the PCSCF of the callee:

INVITE 
sip:bob@[fc00:1234:3:2:0:0:0:0]:5060;transport=udp;registering_acc=ims_mnc001_mcc001_3gppnetwork_org
 SIP/2.0
Record-Route: 
Route: 

Record-Route: 
Record-Route: 

Call-ID: 0b23b2ee62c061ae9f3cc1569b7824b3@0:0:0:0:0:0:0:0
CSeq: 1 INVITE
From: "alice" ;tag=94b2833a
To: 
Via: SIP/2.0/UDP 
[FC00:1234:1:0:0:0:0:47];branch=z9hG4bK0d1b.da418b33c49aee4296db5cf6393c2c36.0
Via: SIP/2.0/UDP 
[FC00:1234:1:0:0:0:0:46];branch=z9hG4bK0d1b.acefb88ca4d295d2bd315467f0670d7f.1
Via: SIP/2.0/UDP