• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Low Power RF & Wireless Connectivity » SimpleLink™ Wi-Fi® » Bugreport CC3000HostDriver v10: netapp_ipconfig() reports incorrect SSID and MAC
Share
Low Power RF & Wireless Connectivity
  • Forums
  • Announcements
  • Files
  • E2E Wiki
Options
  • Subscribe via RSS

Bugreport CC3000HostDriver v10: netapp_ipconfig() reports incorrect SSID and MAC

Bugreport CC3000HostDriver v10: netapp_ipconfig() reports incorrect SSID and MAC

  • Johannes Overmann
    Posted by Johannes Overmann
    on Aug 13 2012 10:30 AM
    Intellectual495 points

    Hi,

    the CC3000HostDriver v10 (the one matching the v1.7 Firmware) reports incorrect SSID and MAC fields for the netapp_ipconfig() calls. These are incorrectly decoded from the transmission buffers. Both are decoded as a uin32_t (4 bytes) while the MAC address is ann array of 6 bytes and the SSID is an array of 32 bytes. Replacing the STREAM_TO_UINT32() lines with memcpy() in event_handler.c:309 fixes the problem

    (Please let me know if there is a better place for bug reports.)

    Cheers,

    Johannes

    CC3000 event handler netapp_ipconfig bug
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Alon Srednizki
    Posted by Alon Srednizki
    on Aug 21 2012 17:38 PM
    Expert3285 points

    Hi Johannes,

    That is correct, we will fix it.

    Thanks,
    Alon.S

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Peter Bigot
    Posted by Peter Bigot
    on Oct 02 2012 08:39 AM
    Expert1380 points

    FWIW, while memcpy fixes the corruption issue it appears the incoming MAC address has been byte-reversed as though it were a network address that needed to be converted from network byte order to little-endian.  Never seen that done before.  Would be nice if the correct byte order would be used by the value returned through this function.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Pedro5084
    Posted by Pedro5084
    on Oct 02 2012 15:39 PM
    Intellectual2390 points

    Hi Peter, 

    Another option to memcpy is to add STREAM_TO_UINT32 and increase the offset, that will keep the little endianness. Below code is from the case HCI_NETAPP_IPCONFIG in the hci_event_handler( ) function (evnt_handler.c):

    STREAM_TO_UINT32((char *)pucReceivedParams,NETAPP_IPCONFIG_MAC_OFFSET,*(unsigned long *)pRetParams);

    pRetParams = ((char *)pRetParams) + 4;
    STREAM_TO_UINT8((char *)pucReceivedParams,NETAPP_IPCONFIG_MAC_OFFSET+4,*(unsigned long *)pRetParams);
    pRetParams = ((char *)pRetParams) + 2;


    STREAM_TO_UINT32((char *)pucReceivedParams,NETAPP_IPCONFIG_SSID_OFFSET,*(unsigned long *)pRetParams);
    pRetParams = ((char *)pRetParams) + 4;
    STREAM_TO_UINT32((char *)pucReceivedParams,NETAPP_IPCONFIG_SSID_OFFSET+4,*(unsigned long *)pRetParams);
    pRetParams = ((char *)pRetParams) + 4;
    STREAM_TO_UINT32((char *)pucReceivedParams,NETAPP_IPCONFIG_SSID_OFFSET+8,*(unsigned long *)pRetParams);
    pRetParams = ((char *)pRetParams) + 4;
    STREAM_TO_UINT32((char *)pucReceivedParams,NETAPP_IPCONFIG_SSID_OFFSET+12,*(unsigned long *)pRetParams);
    pRetParams = ((char *)pRetParams) + 4;
    STREAM_TO_UINT32((char *)pucReceivedParams,NETAPP_IPCONFIG_SSID_OFFSET+16,*(unsigned long *)pRetParams);
    pRetParams = ((char *)pRetParams) + 4;
    STREAM_TO_UINT32((char *)pucReceivedParams,NETAPP_IPCONFIG_SSID_OFFSET+20,*(unsigned long *)pRetParams);
    pRetParams = ((char *)pRetParams) + 4;
    STREAM_TO_UINT32((char *)pucReceivedParams,NETAPP_IPCONFIG_SSID_OFFSET+24,*(unsigned long *)pRetParams);
    pRetParams = ((char *)pRetParams) + 4;
    STREAM_TO_UINT32((char *)pucReceivedParams,NETAPP_IPCONFIG_SSID_OFFSET+28,*(unsigned long *)pRetParams);

    Pedro

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Peter Bigot
    Posted by Peter Bigot
    on Oct 02 2012 16:43 PM
    Expert1380 points

    Pedro5084
    Hi Peter, 

    Another option to memcpy is to add STREAM_TO_UINT32 and increase the offset, that will keep the little endianness.

    Why would we want to do that?  Neither the MAC address nor the SSID should ever have their byte order changed.

    Pedro5084
    Below code is from the case HCI_NETAPP_IPCONFIG in the hci_event_handler( ) function (evnt_handler.c):

    Is that the change you've made to the driver source?  I suggest looking at the call at NETAPP_IPCONFIG_MAC_OFFSET+4, which is wrong in at least two, arguably three, ways.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Pedro5084
    Posted by Pedro5084
    on Oct 05 2012 16:41 PM
    Intellectual2390 points

    Hi Peter, 

    I think I misunderstood your comment: 

    Peter Bigot
     while memcpy fixes the corruption issue it appears the incoming MAC address has been byte-reversed as though it were a network address that needed to be converted from network byte order to little-endian. :

    From a MAC address of 00:37:6D:74:FB:5B the SPI buffer shows the MAC as 0x5B 0xFB 0x74 0x6D 0x37 0x00, where 0x00 is my most significant byte, so this will be little endianness, right? Do you see a different byte order? Is it at the spi buffer level or the returned MAC array? 

    Pedro

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Peter Bigot
    Posted by Peter Bigot
    on Oct 05 2012 17:16 PM
    Expert1380 points

    What you describe is the behavior I see.  An argument can be made (though not, IMO, for a network API; see below) that there is value in converting 32-bit IPv4 addresses and 16-bit IP ports from network byte order to host byte order to simplify certain masking operations and value comparisons.  This does not apply to MAC addresses, since 48-bit integer types are not common and network programmers are used to extracting OUIs and other data from MAC addresses in their transmission order representation.  It is similarly a mistake to re-order the bytes within IPv6 addresses.

    The SPI order had already been reversed from transmission order, and the sentence you quoted was meant to say this should not have been done.  The 6-byte MAC address should be kept in transmission order at all times.  If you can't fix whatever's reversing it then the order should be corrected before the value is returned to the user, which means you can't use memcpy.

    The SSID in turn is in most cases an ASCII string like "linksys"; surely there's no argument that big-endian/little-endian has any significance here?  No bytes should be re-ordered, so memcpy is the correct approach.

    Personally I would prefer to see ALL multi-byte integers used in network addresses (IPv4, IPv6, ports) kept in network byte order (big-endian), especially when stored in byte arrays as they are in SimpleLink data structures.  The only time it could be worth converting them to host byte order is when they're manipulated as integer values of type uint32_t (for IPv4 addresses) or uint16_t (for INET domain ports).  Even there I think the confusion that results from having to guess which order is being used warrants making any conversion to and from host byte order the responsibility of the user code.  This is what ntohs/htons and ntohl/htonl are for.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Pedro5084
    Posted by Pedro5084
    on Oct 08 2012 19:08 PM
    Intellectual2390 points

    Hi Peter,

    Thanks for your comments, it looks reasonable to me, will pass them to our team. 

    Pedro 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use