bugTransport Sample Protocol - Bugs: bug #24797, Endian problem with ip adress ?

 
 

bug #24797: Endian problem with ip adress ?

Submitter:  MARTINSONS <martinsons>
Submitted:  Mon 10 Nov 2008 10:08:15 AM UTC
   
 
Category:  Core Severity:  3 - Normal
Priority:  5 - Normal Status:  Ready For Test
Privacy:  Public Assigned to:  erk
Open/Closed:  Open Release:  * 0.8.2
Fixed Release:  * NextRelease
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Mon 10 Nov 2008 02:37:45 PM UTC, comment #2: 

Working on a patch.

Eric NOULARD <erk>
Group administrator
Mon 10 Nov 2008 10:35:17 AM UTC, comment #1: 

from tsp_stream_sender.c:330-331:

myu.addr = (uint32_t)ntohl(*((uint32_t*)myhost->h_addr_list[0]));
    sprintf(host,"%d.%d.%d.%d",myu.parts[3], myu.parts[2], myu.parts[1], myu.parts[0]);


the "numeric" handling of hostname is somehow not so old:
https://savannah. ... u.org/bugs/?14783
https://savannah. ... u.org/bugs/?14770
so some use may not experience the bug because
they try to connect to the server with numeric @IP and
not with "hostname" (RTEMS case :-).


However you may be right ntohl seems to be the culprit.
We should ALWAYS use network byte order (and not host)
in order to build the appropriate string @IP address.
However, I have no big endian host at hand :=)

Would you be able to test and provide a patch for this?
It should concern both
tsp_stream_sender.c
tsp_server.c
and the companion "test prog"
src/util/libutil/tsp_check_host_and_ip.c

you may try to run
tsp_check_host_and_ip
on each host in order to check the appropriate way
to do it.




Eric NOULARD <erk>
Group administrator
Mon 10 Nov 2008 10:08:15 AM UTC, original submission:  


 Hello,

During my test between Linux (i686) and Solaris (Sparc V9), i noticed that there is no connection between the two machines.Apparently it will be an endianness problem because the tracks tells me that the server (on solaris) send a reversed IP to the consumer.I've changed the order for the byte in IP adress (tsp_server and tsp_stream_sender), in this function :

sprintf(host,
%d.%d.%d.%d,myu.parts[3],myu.parts[2],myu.parts[1],myu.parts[0]);

and it works well.I've read somethings for RTEMS where Yves tells he doubt there is an endian problem in TSP....

So endian problem or not ?

Fred.

MARTINSONS <martinsons>

 

Attached Files

This item currently has no attached files.

(Note: upload size limit is set to 4.0MiB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

Digest:
   patch dependencies.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by erk (Posted a comment)
  • -email is unavailable- added by martinsons (Submitted the item)
  •  

    Votes

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

    History

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-11-12 erk StatusIn Progress Ready For Test
        Fixed ReleaseUnknown NextRelease
    2008-11-10 erk StatusNone In Progress
        Assigned toNone erk
        Fixed Release0.8.3 Unknown
    2008-11-10 erk Dependencies- patch #6667 is dependent

    Back to the top

    Powered by Savane 3.16-a7ba.
    Corresponding source code