[Home]

Summary:ASTERISK-16773: [patch] tos_sip and tos_audio doesn't work on IPV6
Reporter:james.chiang (jamesnet)Labels:
Date Opened:2010-10-06 02:48:49Date Closed:2010-10-18 11:03:25
Priority:BlockerRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/IPv6
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) console.txt
( 1) console1014.txt
( 2) ipv6_tov4_dscp.cap
( 3) issues_18099_v1.diff
( 4) issues_18099_v2.diff
( 5) issues_18099_v3.diff
( 6) tos.cap
Description:I have tried to configure tos_sip and tos_audio in sip.conf and it's work on IPV4 but doesn't work on IPV6

tos_sip=cs3              
tos_audio=ef
Comments:By: David Vossel (dvossel) 2010-10-12 16:16:16

TOS is not in IPv6.

By: David Vossel (dvossel) 2010-10-12 17:35:00

..but TCLASS is and it works the same way.  I'll fix this.

By: james.chiang (jamesnet) 2010-10-12 20:11:26

Yup, it's works the same way "DSCP", thank your help.

By: David Vossel (dvossel) 2010-10-13 11:53:03

I uploaded a patch.  Please test it and report your results.

By: james.chiang (jamesnet) 2010-10-14 01:03:07

I have tested the patch that you provide, The result is failure attached debug from console(console1014.txt) for your reference.

By: David Vossel (dvossel) 2010-10-14 12:30:18

Ah, I did not choose a good method for determining whether the socket was ipv6 or ipv4.  I uploaded a new patch.

By: David Vossel (dvossel) 2010-10-14 17:04:04

I was able to test this patch and it worked for me.

By: Digium Subversion (svnbot) 2010-10-14 17:09:33

Repository: asterisk
Revision: 291829

U   branches/1.8/main/netsock2.c

------------------------------------------------------------------------
r291829 | dvossel | 2010-10-14 17:09:32 -0500 (Thu, 14 Oct 2010) | 8 lines

Set TCLASS field of IPv6 header when sip qos options are set.

(closes issue ASTERISK-16773)
Reported by: jamesnet
Patches:
     issues_18099_v2.diff uploaded by dvossel (license 671)
Tested by: dvossel, jamesnet

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=291829

By: Digium Subversion (svnbot) 2010-10-14 17:10:21

Repository: asterisk
Revision: 291830

_U  trunk/
U   trunk/main/netsock2.c

------------------------------------------------------------------------
r291830 | dvossel | 2010-10-14 17:10:20 -0500 (Thu, 14 Oct 2010) | 15 lines

Merged revisions 291829 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
 r291829 | dvossel | 2010-10-14 17:09:32 -0500 (Thu, 14 Oct 2010) | 8 lines
 
 Set TCLASS field of IPv6 header when sip qos options are set.
 
 (closes issue ASTERISK-16773)
 Reported by: jamesnet
 Patches:
       issues_18099_v2.diff uploaded by dvossel (license 671)
 Tested by: dvossel, jamesnet
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=291830

By: james.chiang (jamesnet) 2010-10-14 20:42:03

Win IPV6 lost IPV4.
I have tested the patch2.
IPV6 (set TC success) <- asterisk -> IPV4(set TOS failure)
IPV4(set TOS failure) <- asterisk -> IPV4(set TOS failure)

I try to add ast_log and it always into "IPV6 set DSCP", even IPV4 to IPV4.

if (!ast_getsockname(sockfd, &addr) && ast_sockaddr_is_ipv6(&addr)) {
proto_type = IPPROTO_IPV6;
dscp_field = IPV6_TCLASS;
       ast_log(LOG_WARNING, "IPV6 set DSCP.\n");
}



By: David Vossel (dvossel) 2010-10-15 11:46:14

umm that is odd. I tested this with both as well.  I will investigate this further.  Thanks for your feedback!

By: David Vossel (dvossel) 2010-10-15 15:58:25

jamesnet, What are you doing to determine this is failing?

Using your patch if I set bindaddr=0.0.0.0:5060 I never see your log warning, and when I set bindaddr=:: and issue a sip reload I do see it.  This indicates to me that the correct field is being set for each address family.  I also verified that the correct bits are set using wireshark by inspecting outbound sip packets. Are you doing anything differently than I am?

By: james.chiang (jamesnet) 2010-10-15 23:06:14

my sip.conf set bindaddr=[::]5048.

I also try to configure bindaddr=0.0.0.0 then test IPV4 with IPV4. and it's work perfectly. and when i set binaddr=:: and issue sip reload then test IPV4 with IPV4 and IPV6 with IPV4 the result is IPV6 set dscp only.

attached IPV6 to IPV4 sip packets captured(binaddr=::) by wireshark for your reference.

By: David Vossel (dvossel) 2010-10-18 10:58:22

Okay, I believe I have it all worked out now.  Sorry this has taken so many iterations for such a simple fix.  I uploaded a new patch that should resolve the issue.  I was not taking into account that a socket bound to any address, [::], might receive stuff over IPv4 as well as IPv6.

Thanks for the help!

By: Digium Subversion (svnbot) 2010-10-18 11:02:18

Repository: asterisk
Revision: 292085

U   branches/1.8/main/netsock2.c

------------------------------------------------------------------------
r292085 | dvossel | 2010-10-18 11:02:17 -0500 (Mon, 18 Oct 2010) | 7 lines

Fixes qos settings for sockets bound to any IPv6 or IPv4 address.

(closes issue ASTERISK-16773)
Reported by: jamesnet
Patches:
     issues_18099_v3.diff uploaded by dvossel (license 671

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=292085

By: Digium Subversion (svnbot) 2010-10-18 11:03:24

Repository: asterisk
Revision: 292086

_U  trunk/
U   trunk/main/netsock2.c

------------------------------------------------------------------------
r292086 | dvossel | 2010-10-18 11:03:24 -0500 (Mon, 18 Oct 2010) | 14 lines

Merged revisions 292085 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
 r292085 | dvossel | 2010-10-18 11:02:17 -0500 (Mon, 18 Oct 2010) | 7 lines
 
 Fixes qos settings for sockets bound to any IPv6 or IPv4 address.
 
 (closes issue ASTERISK-16773)
 Reported by: jamesnet
 Patches:
       issues_18099_v3.diff uploaded by dvossel (license 671
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=292086