Sakari,

Perhaps I should read all my mail before answering. :-)

Your brute force fix doesn't work on Linux because struct sockaddr isn't large 
enough to contain a struct sockaddr_in6.

I suspect the problem is really that IOS is being obsessive about the length 
arguments for bind and/or getsockname.

Please try the attached patch.  It starts in CreateSocket where you started and 
replaces to the end.

John

-----Original Message-----
From: Poussa, Sakari 
Sent: Wednesday, August 05, 2015 3:30 AM
To: Poussa, Sakari; Light, John J; iotivity-dev at lists.iotivity.org
Subject: Re: [dev] Help requested verifying C SDK samples

Hi,

I investigated a bit more.

The ocserver (on Mac) is failing to bind (Invalid argument) in CACreateSocket 
(caipserver.c).

The brute force fix was to :

    //struct sockaddr_storage sa = { family };
    struct sockaddr sa = { family };

With this fix, the ocserver binds correctly to the address/port. So the issue 
is the incorrect use of sockaddr_storage on OSX which I guess is related to the 
IPv6 and CA integration.


Sakari



On 8/5/15, 10:43, "iotivity-dev-bounces at lists.iotivity.org on behalf of 
Poussa, Sakari" <iotivity-dev-bounces at lists.iotivity.org on behalf of 
sakari.poussa at intel.com> wrote:

>Hi John,
>
>I have few items to report about the C SDK samples. I am mainly on Mac 
>but comparing the results also on Linux (Ubuntu).
>
>  *   The C SDK samples do not work on master or 0.9.2-RC3 (on Mac). The
>issue seems to be the ocserver does not start to listen the sockets.
>  *   These used to work at least on
>(809b1b1e9be15724a6d756b403328a95894e639f) master on Jul 4. On that 
>version I can see that the ocserver start to listen the sockets
>
>ocserver  81531 spoussa    3u  IPv4 0x4ddee3f17b4c4495      0t0  UDP
>10.237.68.32:6298
>
>ocserver  81531 spoussa    4u  IPv4 0x4ddee3f17b4483dd      0t0  UDP
>224.0.1.187:5683
>
>  *   However, on master/RC3 I don?t see the ocserver on that (lsof)
>listing.
>
>All of the above works on Linux. I have not applied your changeset 
>(1963). Do you suspect that to fix my issues?
>
>Any glues what broke the C SDK samples on Mac?
>
>Thanks, Sakari
>
>
>From: 
><iotivity-dev-bounces at lists.iotivity.org<mailto:iotivity-dev-bounces at li
>sts .iotivity.org>> on behalf of "Light, John J"
><john.j.light at intel.com<mailto:john.j.light at intel.com>>
>Date: Monday, August 3, 2015 at 23:31
>To: 
>"iotivity-dev at lists.iotivity.org<mailto:iotivity-dev at lists.iotivity.org>"
><iotivity-dev at lists.iotivity.org<mailto:iotivity-dev at lists.iotivity.org
>>>
>Subject: [dev] Help requested verifying C SDK samples
>
>A major reason IPv6 capability is declared experimental is that the 
>using it requires application changes when using the C API.  The 
>primary C API examples and tests are located in
>
>resource/csdk/stack/samples/linux/SimpleClientServer
>resource/csdk/stack/samples/linux/secure
>
>They built as part of the IP plumbing patch, and they work fine with 
>the new plumbing and adapter, as long as only IPv4 is allowed.  
>However, the stack is designed to run in Dual-Stack mode, which give 
>preference to IPv6, so the samples didn?t work.
>
>I ported the samples to handle IPv6 (Change 1963), and they seem to 
>work now, but the samples have lots of options and it?s not always 
>clear whether they are working.
>
>I am asking for help from knowledgeable individuals to further test the 
>samples.  I assume Sachin or someone on the large security team will 
>test the secure version (second line), and I am looking for people 
>familiar with occlient, occlientbasicops, occlientcoll, and 
>occlientslow to test them.
>
>I made no changes to the server samples (they just work, I think).
>
>Applying Change 1963 will give you the new samples as well as enable 
>Dual-Stack (IPv6 and IPv4) operation.
>
>Thank you in advance for your assistance.  Please report problems as 
>comments to Change 1963.
>
>John Light
>Intel OTC OIC Development
>
>_______________________________________________
>iotivity-dev mailing list
>iotivity-dev at lists.iotivity.org
>https://lists.iotivity.org/mailman/listinfo/iotivity-dev

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: createsocket.txt
URL: 
<http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20150805/c94a6234/attachment.txt>

Reply via email to