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
Status:  Ready For Test Privacy:  Public
Assigned to:  erk Open/Closed:  Open
Release:  * 0.8.2 Fixed Release:  * NextRelease
* Mandatory Fields

Add a New Comment Rich Markup

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:
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
and the companion "test prog"

you may try to run
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:  


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 :


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 ?


MARTINSONS <martinsons>


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

Attach Files:

No files currently attached


Depends on the following items: None found

   patch dependencies.


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

    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.


    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.13-b921.
    Corresponding source code