Summary: | ASTERISK-04728: tos tag broken in iax.conf | ||
Reporter: | unknown | Labels: | |
Date Opened: | 2005-07-29 07:36:43 | Date Closed: | 2008-01-15 15:44:12.000-0600 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Core/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) iax2-tos.patch ( 1) iaxtosfix.patch ( 2) new-iax2-tos.patch | |
Description: | Latest CVS Head (29th July 2005) a tcpdump shows a IAX packet as having a tos value of 0x00 even though the iax.conf file says a value of tos=lowdelay or any other value. With Asterisk Stable 1.0.9 tos values work fine. | ||
Comments: | By: Roy Sigurd Karlsbakk (rkarlsba) 2005-08-09 07:04:34 that one fixes it disclaimer on file By: Vahan Yerkanian (vahan) 2005-08-09 08:08:29 just patched my cvs-head with your patch, here is the relevant output from asterisk -cvvvvvvvvv (with tos=lowdelay in iax.conf) == Parsing '/raid/etc/asterisk/iax.conf': Found == Using TOS bits 0 == Binding IAX2 to '195.250.77.70:4569' and with tos=0x18 == Parsing '/raid/etc/asterisk/iax.conf': Found == Using TOS bits 0 == Binding IAX2 to '195.250.77.70:4569' and with tos=184 == Parsing '/raid/etc/asterisk/iax.conf': Found == Using TOS bits 0 == Binding IAX2 to '195.250.77.70:4569' By: Roy Sigurd Karlsbakk (rkarlsba) 2005-08-09 08:11:19 doublechecked with tcpdump here as well works for me (tm) By: Vahan Yerkanian (vahan) 2005-08-09 08:14:24 my iax.conf ----------- tos=0x18 my tcpdump ---------- 18:16:01.241685 IP (tos 0x0, ttl 64, id 61550, offset 0, flags [none], length: 60) sip.arminco.com.4569 > host-195-250-86-3.customer.arminco.com.4569: [bad udp cksum 298!] UDP, length: 32 By: Vahan Yerkanian (vahan) 2005-08-09 08:28:57 restarted the patched asterisk (sip.arminco.com), still no go. Here is the debug from iax conversation with unpatched asterisk (both tos=0x18) 18:29:52.360201 IP (tos 0x0, ttl 64, id 16012, offset 0, flags [none], length: 60) sip.arminco.com.4569 > host-195-250-86-3.customer.arminco.com.4569: [bad udp cksum 6cf3!] UDP, length: 32 18:29:52.360681 IP (tos 0x0, ttl 59, id 20777, offset 0, flags [none], length: 60) host-195-250-86-3.customer.arminco.com.4569 > sip.arminco.com.4569: [udp sum ok] UDP, length: 32 18:29:52.380207 IP (tos 0x0, ttl 64, id 16015, offset 0, flags [none], length: 60) sip.arminco.com.4569 > host-195-250-86-3.customer.arminco.com.4569: [bad udp cksum 9d88!] UDP, length: 32 18:29:52.382672 IP (tos 0x0, ttl 59, id 20778, offset 0, flags [none], length: 60) host-195-250-86-3.customer.arminco.com.4569 > sip.arminco.com.4569: [udp sum ok] UDP, length: 32 By: Roy Sigurd Karlsbakk (rkarlsba) 2005-08-09 08:37:53 can you please doublecheck that the patch is applied? also check if you get a warning for the tos= in iax.conf if tos is set to an invalid value, chan_iax2 prints a warning about this. i doublechecked here, and it works with both asterisk reporting and tcpdump == Registered channel type 'IAX2' (Inter Asterisk eXchange Driver (Ver 2)) == Using TOS bits 17 By: Vahan Yerkanian (vahan) 2005-08-09 09:05:40 this is the output from patch -u on the cvs-head tree updated with gmake update just before the patching process. Hmm... Looks like a unified diff to me... The text leading up to this was: -------------------------- |Index: channels/chan_iax2.c |=================================================================== |RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v |retrieving revision 1.325 |diff -u -r1.325 chan_iax2.c |--- channels/chan_iax2.c 4 Aug 2005 17:33:21 -0000 1.325 |+++ channels/chan_iax2.c 9 Aug 2005 12:02:42 -0000 -------------------------- Patching file chan_iax2.c using Plan A... Hunk #1 succeeded at 8529 (offset -2 lines). done By: Vahan Yerkanian (vahan) 2005-08-09 09:13:33 aha, found the cause. if you use bindaddr in iax.conf to specify an ip address to bind to, tos value is ignored. iax.conf -------- bindaddr=195.250.77.70 tos=0x18 debug -------- == Parsing '/raid/etc/asterisk/iax.conf': Found == Using TOS bits 0 == Binding IAX2 to '195.250.77.70:4569' == Registered channel type 'IAX2' (Inter Asterisk eXchange Driver (Ver 2)) == IAX Ready and Listening As soon as I commented it tos got set: iax.conf -------- ;bindaddr=195.250.77.70 tos=0x18 debug -------- == Parsing '/raid/etc/asterisk/iax.conf': Found == Registered channel type 'IAX2' (Inter Asterisk eXchange Driver (Ver 2)) == Using TOS bits 24 == Binding IAX2 to default address 0.0.0.0:4569 == IAX Ready and Listening By: Russell Bryant (russell) 2005-08-09 09:48:33 I bet if you put your tos option about the bindaddr option, it will work. The problem is that when you set the bindaddr option, it calls ast_netsock_bind with a tos value of 0, because that option hasn't been loaded yet. By: Roy Sigurd Karlsbakk (rkarlsba) 2005-08-09 09:59:40 The last patch fixes that IMHO, it's not quite optimal to start creating sockets while reading the config...... By: Vahan Yerkanian (vahan) 2005-08-09 10:05:02 Dead on, putting tos before bindaddr sets the tos bits correctly. Wouldn't it be wiser to parse the whole conf file before proceeding with the init? Still, I see udp checksum errors on tcpdump after applying this patch. By: Russell Bryant (russell) 2005-08-09 10:14:48 Heyyyyyyy. You uploaded a patch while I was writing mine! :) Anyway, my patch ensures that the 'tos' option is loaded before the 'bindaddr' option and should fix your problem. By: Vahan Yerkanian (vahan) 2005-08-09 10:19:26 new-iax2-tos.patch tested, works ok both ways. Thanks guys I hope to see this committed to CVS-HEAD asap. By: Russell Bryant (russell) 2005-08-09 10:28:44 I have uploaded a new patch which changes the format string in sscanf to properly support hex, decimal, and octal. By: Russell Bryant (russell) 2005-08-09 10:32:02 oh yeah, disclaimer is on file. :) By: Vahan Yerkanian (vahan) 2005-08-09 10:42:19 iaxtosfix.patch does the job too, confirmed :) By: Mark Spencer (markster) 2005-08-09 12:37:56 Fixed in CVS head. By: Digium Subversion (svnbot) 2008-01-15 15:44:12.000-0600 Repository: asterisk Revision: 6315 U trunk/acl.c U trunk/channels/chan_iax2.c U trunk/channels/chan_sip.c U trunk/include/asterisk/acl.h ------------------------------------------------------------------------ r6315 | markster | 2008-01-15 15:44:11 -0600 (Tue, 15 Jan 2008) | 2 lines Centralize and fix tos for IAX (bug ASTERISK-4728 inspired) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=6315 |