packages/chaosvpn: fix build, remove redundant vars
[openwrt/svn-archive/archive.git] / net / babel / patches / 001-buggy-packed.patch
1 Fri Sep 24 16:25:40 CEST 2010 Juliusz Chroboczek <jch@pps.jussieu.fr>
2 * Don't use __attribute__((packed)), it is buggy.
3 diff -rN -u old-babeld/util.h new-babeld/util.h
4 --- old-babeld/util.h 2010-10-08 15:41:20.000000000 +0200
5 +++ new-babeld/util.h 2010-10-08 15:41:20.000000000 +0200
6 @@ -20,7 +20,15 @@
7 THE SOFTWARE.
8 */
9
10 -#if defined __GNUC__
11 +#if defined(i386) || defined(__mc68020__) || defined(__x86_64__)
12 +#define DO_NTOHS(_d, _s) do { _d = ntohs(*(unsigned short*)(_s)); } while(0)
13 +#define DO_NTOHL(_d, _s) do { _d = ntohl(*(unsigned*)(_s)); } while(0)
14 +#define DO_HTONS(_d, _s) do { *(unsigned short*)(_d) = htons(_s); } while(0)
15 +#define DO_HTONL(_d, _s) do { *(unsigned*)(_d) = htonl(_s); } while(0)
16 +/* Some versions of gcc seem to be buggy, and ignore the packed attribute.
17 + Disable this code until the issue is clarified. */
18 +/* #elif defined __GNUC__*/
19 +#elif 0
20 struct __us { unsigned short x __attribute__((packed)); };
21 #define DO_NTOHS(_d, _s) \
22 do { _d = ntohs(((const struct __us*)(_s))->x); } while(0)