Looks like a bug to me.

From: iotivity-dev-bounces at lists.iotivity.org 
[mailto:[email protected]] On Behalf Of Arpit Agarwal
Sent: Monday, November 28, 2016 8:31 PM
To: iotivity-dev at lists.iotivity.org
Cc: Amogha D Shanbhag <amogha.ds at samsung.com>
Subject: [dev] Improper code in CAReceiveMessage function ?


Hi,

I was just going through the iotivity source code in caipserver.c file. I have 
doubt regarding

possibility of improper code.



In the following code in CAReceiveMessage function:

    if (flags & CA_IPV6)
    {
        namelen = sizeof (struct sockaddr_in6);
        level = IPPROTO_IPV6;
        type = IPV6_PKTINFO;
        len = sizeof (struct in6_pktinfo);
    }
    else
    {
        namelen = sizeof (struct sockaddr_in);
        level = IPPROTO_IP;
        type = IP_PKTINFO;
        len = sizeof (struct in6_pktinfo);
    }



May I know why the len is set to sizeof (struct in6_pktinfo) in case of IPv4 
packet? Is it intentional with a purpose?

Shouldn't it be set to sizeof (struct in_pktinfo) ? It will be helpful if 
someone can clear my doubt.





Thanks & Regards,

Arpit Agarwal

Senior Software Engineer, SRIB

Email: arpit.ag at samsung.com<mailto:arpit.ag at samsung.com>





[cid:image001.gif at 01D249C4.B9F4EDE0]

[http://ext.samsung.net/mail/ext/v1/external/status/update?userid=arpit.ag&do=bWFpbElEPTIwMTYxMTI5MDQzMTExZXBjbXM1cDJlNGZiYjcyMGEyNTgyOTUzODYzYjdlNzExZjY4YzY0MyZyZWNpcGllbnRBZGRyZXNzPWlvdGl2aXR5LWRldkBsaXN0cy5pb3Rpdml0eS5vcmc_]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20161129/c01f1b59/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 13402 bytes
Desc: image001.gif
URL: 
<http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20161129/c01f1b59/attachment.gif>

Reply via email to