[package] fix hping3 compilation failure on armeb (#4933)
[packages.git] / net / hping3 / patches / 101-endianness.patch
1 --- hping3-20051105_orig/hping2.h       2004-06-04 09:22:38.000000000 +0200
2 +++ hping3-20051105/hping2.h    2009-02-26 15:42:14.000000000 +0100
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 @@
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 diff -urN hping3-20051105/bytesex.h hping3-20051105.new/bytesex.h
38 --- hping3-20051105/bytesex.h   2003-08-31 19:23:48.000000000 +0200
39 +++ hping3-20051105.new/bytesex.h       2009-04-13 15:14:52.000000000 +0200
40 @@ -9,9 +9,11 @@
41  
42  #if    defined(__i386__) \
43         || defined(__alpha__) \
44 +       || (defined(__arm__) && (defined(ARMEL) || defined(__ARMEL__)))  \
45         || (defined(__mips__) && (defined(MIPSEL) || defined (__MIPSEL__)))
46  #define BYTE_ORDER_LITTLE_ENDIAN
47 -#elif  defined(__mc68000__) \
48 +#elif defined(__mc68000__) \
49 +       || (defined(__arm__) && (defined(ARMEB) || defined(__ARMEB__))) \
50         || defined (__sparc__) \
51         || defined (__sparc) \
52         || defined (__PPC__) \