[Home]

Summary:ASTERISK-17769: [patch] sometimes ntohs in place of htons
Reporter:Walter Doekes (wdoekes)Labels:
Date Opened:2011-04-29 01:54:54Date Closed:2011-05-03 17:16:25
Priority:TrivialRegression?No
Status:Closed/CompleteComponents:General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) issue19200-1.4.x.patch
( 1) issue19200-1.6.2.x.patch
( 2) issue19200-1.8.x.patch
( 3) issue19200-trunk.patch
Description:Hi,

in a couple of places ntohs is used where htons should be used. This is not a problem, as they should both be a no-op (big endian) or both swap the bytes (little endian).

asterisk-svn$ wgrep . 'sin_port = ntohs'
./channels/chan_skinny.c: bindaddr.sin_port = ntohs(DEFAULT_SKINNY_PORT);
./channels/chan_mgcp.c: bindaddr.sin_port = ntohs(DEFAULT_MGCP_CA_PORT);
./pbx/pbx_dundi.c: sin->sin_port = ntohs(atoi(v->value));
./pbx/pbx_dundi.c: sin.sin_port = ntohs(DUNDI_PORT);

asterisk-1.6.2.x$ wgrep . 'sin_port = ntohs'
./channels/chan_skinny.c: bindaddr.sin_port = ntohs(DEFAULT_SKINNY_PORT);
./channels/chan_mgcp.c: bindaddr.sin_port = ntohs(DEFAULT_MGCP_CA_PORT);
./channels/chan_sip.c: p->ourip.sin_port = ntohs(port);
./pbx/pbx_dundi.c: sin->sin_port = ntohs(atoi(v->value));
./pbx/pbx_dundi.c: sin.sin_port = ntohs(DUNDI_PORT);


Fix: s/ntohs/htons/ in the above locations.


Regards,
Walter
Comments:By: Paul Belanger (pabelanger) 2011-04-29 12:11:17

patch?

By: Walter Doekes (wdoekes) 2011-04-29 15:38:26

there

By: Digium Subversion (svnbot) 2011-05-03 17:13:32

Repository: asterisk
Revision: 316336

U   branches/1.8/channels/chan_mgcp.c
U   branches/1.8/channels/chan_skinny.c
U   branches/1.8/pbx/pbx_dundi.c

------------------------------------------------------------------------
r316336 | russell | 2011-05-03 17:13:31 -0500 (Tue, 03 May 2011) | 8 lines

Use htons() instead of ntohs() in some places.

(closes issue ASTERISK-17769)
Reported by: wdoekes
Patches:
     issue19200-trunk.patch uploaded by wdoekes (license 717)
     issue19200-1.8.x.patch uploaded by wdoekes (license 717)

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

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

By: Digium Subversion (svnbot) 2011-05-03 17:16:24

Repository: asterisk
Revision: 316337

_U  trunk/
U   trunk/channels/chan_mgcp.c
U   trunk/channels/chan_skinny.c
U   trunk/pbx/pbx_dundi.c

------------------------------------------------------------------------
r316337 | russell | 2011-05-03 17:16:24 -0500 (Tue, 03 May 2011) | 15 lines

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

........
 r316336 | russell | 2011-05-03 17:13:31 -0500 (Tue, 03 May 2011) | 8 lines
 
 Use htons() instead of ntohs() in some places.
 
 (closes issue ASTERISK-17769)
 Reported by: wdoekes
 Patches:
       issue19200-trunk.patch uploaded by wdoekes (license 717)
       issue19200-1.8.x.patch uploaded by wdoekes (license 717)
........

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

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