← Back to team overview

rohc team mailing list archive

[Question #212737]: Redefinition of s6_addr in Linux environnement

 

New question #212737 on rohc:
https://answers.launchpad.net/rohc/+question/212737

 Hello,

 While cross-compiling the rohc-tcp branch, I encounter a problem of redefinition for s6_addrXXX :


In file src/common/protocols/ipv6.h :

/**
 * @brief The IPv6 address
 */
struct ipv6_addr
{
        union
        {
                uint8_t __u6_addr8[16];
                uint16_t __u6_addr16[8];
                uint32_t __u6_addr32[4];
        } __in6_u;
#define s6_addr         __in6_u.__u6_addr8
#define s6_addr16               __in6_u.__u6_addr16
#define s6_addr32               __in6_u.__u6_addr32
};



With last GCC, it is the same definitions in file /usr/include/netinet/in.h

/* IPv6 address */
struct in6_addr
  {
    union
      {
        uint8_t __u6_addr8[16];
#if defined __USE_MISC || defined __USE_GNU
        uint16_t __u6_addr16[8];
        uint32_t __u6_addr32[4];
#endif
      } __in6_u;
#define s6_addr                 __in6_u.__u6_addr8
#if defined __USE_MISC || defined __USE_GNU
# define s6_addr16              __in6_u.__u6_addr16
# define s6_addr32              __in6_u.__u6_addr32
#endif
  };



But with the cross-compiler for ARM (or PowerPC), it is NOT the same definitions in file /usr/include/netinet/in.h


/* IPv6 address */
struct in6_addr
  {
    union
      {
        uint8_t u6_addr8[16];
        uint16_t u6_addr16[8];
        uint32_t u6_addr32[4];
      } in6_u;
#define s6_addr                 in6_u.u6_addr8
#define s6_addr16               in6_u.u6_addr16
#define s6_addr32               in6_u.u6_addr32
  };


 Can you add test for definition of _NETINET_IN_H before define s6_addrXXX in your common/protocols/ipv6.h file ?


/**
 * @brief The IPv6 address
 */
struct ipv6_addr
{
        union
        {
                uint8_t __u6_addr8[16];
                uint16_t __u6_addr16[8];
                uint32_t __u6_addr32[4];
        } __in6_u;
#ifndef _NETINET_IN_H
#define s6_addr         __in6_u.__u6_addr8
#define s6_addr16               __in6_u.__u6_addr16
#define s6_addr32               __in6_u.__u6_addr32
#endif
};


 Thank you,

 Best regards,

            FWX.


-- 
You received this question notification because you are a member of ROHC
Team, which is an answer contact for rohc.