[Home]

Summary:ASTERISK-17314: Casting alignment problem in send_client causes bad seq to be generated on ARM platform
Reporter:Jon Joshua (jjoshua)Labels:
Date Opened:2011-01-28 22:10:04.000-0600Date Closed:2011-10-08 09:57:25
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Channels/chan_unistim
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:In send_client(), a char array is cast as a short array.  If the char array starts on an odd byte, the short array cast will not be aligned properly and setting the seq into the array will not be the expected result.

This happens on the ARM platform.

****** ADDITIONAL INFORMATION ******

channels/chan_unistim.c
send_client()

If data starts on an odd byte, sdata[1] will point to bytes 2 and 3 of data instead of bytes 3 and 4 as expected:

       unsigned short *sdata = (unsigned short *) data;
       sdata[1] = ntohs(++(pte->seq_server));


This is one possible solution:

       unsigned short seq = ntohs(++pte->seq_server);
       memcpy((void *)data + sizeof(unsigned short), (void *)&seq, sizeof(unsigned short));


Comments:By: Jon Joshua (jjoshua) 2011-01-28 22:13:33.000-0600

The problem manifests itself when you lift the handset of the phone.

Request received
Handset off hook
Sending select output packet output=c0 volume=1 mute=0
Sending led_update (18)
Sending favorite pos 0 with status 0x24
Sending led_update (8)
Sending led_update (10)
Sending select output packet output=c0 volume=1 mute=0
Sending led_update (18)
Sending favorite pos 0 with status 0x24
Sending led_update (8)
Sending led_update (10)
Sending select output packet output=c0 volume=1 mute=0
Sending led_update (18)
Sending favorite pos 0 with status 0x24
Sending led_update (8)
Sending led_update (10)
No country defined, using US tone
Sending Stream Based Tone Frequency Component List Download 350 440
Sending Stream Based Tone On
Sending text at pos 0, inverse flag 5
Sending text at pos 32, inverse flag 5
Sending status text
Sending text at pos 64, inverse flag 5
Sending set blink
Sending set cursor position
Sending favorite pos 0 with status 0x2a
Sending icon pos 0 with status 0x00
Sending led_update (0)
Retransmit slot ASTERISK-20 (seq=#0x3ebb), last ack was #0x003d
Retransmit slot ASTERISK-21 (seq=#0x3fbb), last ack was #0x003d
Retransmit slot ASTERISK-22 (seq=#0x0040), last ack was #0x003d
Retransmit slot ASTERISK-23 (seq=#0x41bb), last ack was #0x003d
Retransmit slot ASTERISK-24 (seq=#0x42bb), last ack was #0x003d
Retransmit slot ASTERISK-20 (seq=#0x3ebb), last ack was #0x003d
Retransmit slot ASTERISK-21 (seq=#0x3fbb), last ack was #0x003d
Retransmit slot ASTERISK-22 (seq=#0x0040), last ack was #0x003d
Retransmit slot ASTERISK-23 (seq=#0x41bb), last ack was #0x003d
Retransmit slot ASTERISK-24 (seq=#0x42bb), last ack was #0x003d
Retransmit slot ASTERISK-20 (seq=#0x3ebb), last ack was #0x003d
Retransmit slot ASTERISK-21 (seq=#0x3fbb), last ack was #0x003d
Retransmit slot ASTERISK-22 (seq=#0x0040), last ack was #0x003d
Retransmit slot ASTERISK-23 (seq=#0x41bb), last ack was #0x003d
Retransmit slot ASTERISK-24 (seq=#0x42bb), last ack was #0x003d
Retransmit slot ASTERISK-20 (seq=#0x3ebb), last ack was #0x003d
Retransmit slot ASTERISK-21 (seq=#0x3fbb), last ack was #0x003d
Retransmit slot ASTERISK-22 (seq=#0x0040), last ack was #0x003d
Retransmit slot ASTERISK-23 (seq=#0x41bb), last ack was #0x003d
Retransmit slot ASTERISK-24 (seq=#0x42bb), last ack was #0x003d
Retransmit slot ASTERISK-20 (seq=#0x3ebb), last ack was #0x003d
Retransmit slot ASTERISK-21 (seq=#0x3fbb), last ack was #0x003d
Retransmit slot ASTERISK-22 (seq=#0x0040), last ack was #0x003d
Retransmit slot ASTERISK-23 (seq=#0x41bb), last ack was #0x003d
Retransmit slot ASTERISK-24 (seq=#0x42bb), last ack was #0x003d
Retransmit slot ASTERISK-20 (seq=#0x3ebb), last ack was #0x003d
Retransmit slot ASTERISK-21 (seq=#0x3fbb), last ack was #0x003d
Retransmit slot ASTERISK-22 (seq=#0x0040), last ack was #0x003d
Retransmit slot ASTERISK-23 (seq=#0x41bb), last ack was #0x003d
Retransmit slot ASTERISK-24 (seq=#0x42bb), last ack was #0x003d
Retransmit slot ASTERISK-20 (seq=#0x3ebb), last ack was #0x003d
Retransmit slot ASTERISK-21 (seq=#0x3fbb), last ack was #0x003d
Retransmit slot ASTERISK-22 (seq=#0x0040), last ack was #0x003d
Retransmit slot ASTERISK-23 (seq=#0x41bb), last ack was #0x003d
Retransmit slot ASTERISK-24 (seq=#0x42bb), last ack was #0x003d
Too many retransmit - freeing client
close_client session 0x43a020 device 0x79b618 lines 0x79b8d8 sub 0x79b108
Trying to unregister extension '106' context 'default'

By: Leif Madsen (lmadsen) 2011-01-31 15:13:12.000-0600

I'm acknowledging this issue, but I will state that chan_unistim has very low support, and thus will likely be resolved quicker if you can find a community developer who has interest in this module.

By: niurkin sil (niurkinfa) 2013-12-04 09:00:09.380-0600

Hello, iḿ using elastix and have the same problem, too many retransmission, but i dont see any chan_unistim.c file. could you please help me.

Thanks