[packages] hping3: fix build failure on avr32 (closes: #7006)
[openwrt/svn-archive/archive.git] / net / hping3 / patches / 101-endianness.patch
1 --- a/hping2.h
2 +++ b/hping2.h
3 @@ -13,6 +13,7 @@
4 #ifndef _HPING2_H
5 #define _HPING2_H
6
7 +#include <endian.h>
8 #include <sys/types.h>
9 #include <sys/socket.h>
10 #include <netinet/in.h>
11 @@ -248,10 +249,10 @@
12 * IP header
13 */
14 struct myiphdr {
15 -#if defined(__LITTLE_ENDIAN_BITFIELD)
16 +#if __BYTE_ORDER == __LITTLE_ENDIAN
17 __u8 ihl:4,
18 version:4;
19 -#elif defined (__BIG_ENDIAN_BITFIELD)
20 +#elif __BYTE_ORDER == __BIG_ENDIAN
21 __u8 version:4,
22 ihl:4;
23 #else
24 @@ -287,10 +288,10 @@ struct mytcphdr {
25 __u16 th_dport; /* destination port */
26 __u32 th_seq; /* sequence number */
27 __u32 th_ack; /* acknowledgement number */
28 -#if defined (__LITTLE_ENDIAN_BITFIELD)
29 +#if __BYTE_ORDER == __LITTLE_ENDIAN
30 __u8 th_x2:4, /* (unused) */
31 th_off:4; /* data offset */
32 -#elif defined (__BIG_ENDIAN_BITFIELD)
33 +#elif __BYTE_ORDER == __BIG_ENDIAN
34 __u8 th_off:4, /* data offset */
35 th_x2:4; /* (unused) */
36 #else
37 --- a/bytesex.h
38 +++ b/bytesex.h
39 @@ -9,9 +9,12 @@
40
41 #if defined(__i386__) \
42 || defined(__alpha__) \
43 + || (defined(__arm__) && (defined(ARMEL) || defined(__ARMEL__))) \
44 || (defined(__mips__) && (defined(MIPSEL) || defined (__MIPSEL__)))
45 #define BYTE_ORDER_LITTLE_ENDIAN
46 -#elif defined(__mc68000__) \
47 +#elif defined(__mc68000__) \
48 + || (defined(__arm__) && (defined(ARMEB) || defined(__ARMEB__))) \
49 + || defined (__avr32__) \
50 || defined (__sparc__) \
51 || defined (__sparc) \
52 || defined (__PPC__) \