← Back to team overview

rohc team mailing list archive

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

 

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

    Status: Open => Solved

FWX confirmed that the question is solved:
Hello,

 I propose to rename s6_addrXXX definitions in src/common/ipv6.h to su6_addrXXX, so that, there no conflict with definitions in linux include file /netinet/in.h
 Then, I propose to use these new definitions in src/common/ip.h file

Here is the patch :

=== modified file 'src/common/ip.h'
--- src/common/ip.h	2012-09-16 14:13:44 +0000
+++ src/common/ip.h	2012-10-31 10:29:29 +0000
@@ -203,7 +203,7 @@
 
 /// The data to print an IPv6 address in (struct ipv6_addr *) format
 #define IPV6_ADDR_IN6(x) \
-	IPV6_ADDR_RAW((x)->s6_addr)
+	IPV6_ADDR_RAW((x)->su6_addr)
 
 /// The data to print an IPv6 address in raw format
 #define IPV6_ADDR_RAW(x) \
@@ -212,10 +212,10 @@
 
 /// Compare two IPv6 addresses in (struct ipv6_addr *) format
 #define IPV6_ADDR_CMP(x, y) \
-	((x)->s6_addr32[0] == (y)->s6_addr32[0] && \
-	 (x)->s6_addr32[1] == (y)->s6_addr32[1] && \
-	 (x)->s6_addr32[2] == (y)->s6_addr32[2] && \
-	 (x)->s6_addr32[3] == (y)->s6_addr32[3])
+	((x)->su6_addr32[0] == (y)->su6_addr32[0] && \
+	 (x)->su6_addr32[1] == (y)->su6_addr32[1] && \
+	 (x)->su6_addr32[2] == (y)->su6_addr32[2] && \
+	 (x)->su6_addr32[3] == (y)->su6_addr32[3])
 
 
 /*

=== modified file 'src/common/protocols/ipv6.h'
--- src/common/protocols/ipv6.h	2012-09-16 14:13:44 +0000
+++ src/common/protocols/ipv6.h	2012-10-31 10:29:51 +0000
@@ -44,9 +44,9 @@
 		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
+#define su6_addr		__in6_u.__u6_addr8
+#define su6_addr16		__in6_u.__u6_addr16
+#define su6_addr32		__in6_u.__u6_addr32
 };

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