[rds-devel] rds-stress endianness issue.

Pradeep pradeep at cup.hp.com
Wed May 7 09:57:23 PDT 2008


On 5/7/2008 9:11 AM, Olaf Kirch wrote:
> Hi Pradeep,
>
> On Wednesday 07 May 2008 17:36:38 Pradeep wrote:
>   
>> It looks like rds-stress is passing some of the options in host endian
>> byte order - send_addr, receive_addr and starting_port. Shouldn't these be
>> converted to network byte order before sending to the peer?
>>     
>
> This has been fixed in OFED 1.3.1. Can you please try to use the version
> of rds-stress from the OFED daily build?
>
>   

This is the version I'm looking at:
http://www.openfabrics.org/git/?p=ofed_1_3/rds-tools.git;a=snapshot;h=251a8ea2c46d684b782474ad9a09c083d025730e

Please let me know if there is a newer version.

Here is the code that assigns send_addr:

opts.send_addr = parse_addr(optarg);

static uint32_t parse_addr(char *ptr)
{
    uint32_t addr;
        struct hostent *hent;

        hent = gethostbyname(ptr);
        if (hent &&
            hent->h_addrtype == AF_INET && hent->h_length == sizeof(addr)) {
        memcpy(&addr, hent->h_addr, sizeof(addr));
        return ntohl(addr);
    }

    die("invalid host name or dotted quad '%s'\n", ptr);
}

parse_addr() converts the IP address to host byte order and that is directly
passed to the peer - the encode_options() doesn't convert it back to network
byte order.

Correct me if I'm wrong.

Thanks,
Pradeep



More information about the rds-devel mailing list