]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/iputils-glibckernheaders.patch
pakfire: use correct tree on x86_64.
[ipfire-2.x.git] / src / patches / iputils-glibckernheaders.patch
CommitLineData
fd3e7da0
MT
1diff -ru iputils/include-glibc/netinet/in.h iputils-clean/include-glibc/netinet/in.h
2--- iputils/include-glibc/netinet/in.h 2000-06-18 14:57:25.000000000 -0400
3+++ iputils-clean/include-glibc/netinet/in.h 2003-09-03 11:21:55.000000000 -0400
4@@ -8,4 +8,45 @@
5
6 #define SOL_IP 0
7
8-#endif /* netinet/in.h */
9+/* Functions to convert between host and network byte order.
10+
11+ Please note that these functions normally take `unsigned long int' or
12+ `unsigned short int' values as arguments and also return them. But
13+ this was a short-sighted decision since on different systems the types
14+ may have different representations but the values are always the same. */
15+
16+extern u_int32_t ntohl (u_int32_t __netlong) __THROW __attribute__ ((__const__));
17+extern u_int16_t ntohs (u_int16_t __netshort)
18+ __THROW __attribute__ ((__const__));
19+extern u_int32_t htonl (u_int32_t __hostlong)
20+ __THROW __attribute__ ((__const__));
21+extern u_int16_t htons (u_int16_t __hostshort)
22+ __THROW __attribute__ ((__const__));
23+
24+#include <endian.h>
25+
26+/* Get machine dependent optimized versions of byte swapping functions. */
27+#include <bits/byteswap.h>
28+
29+#ifdef __OPTIMIZE__
30+/* We can optimize calls to the conversion functions. Either nothing has
31+ to be done or we are using directly the byte-swapping functions which
32+ often can be inlined. */
33+# if __BYTE_ORDER == __BIG_ENDIAN
34+/* The host byte order is the same as network byte order,
35+ so these functions are all just identity. */
36+# define ntohl(x) (x)
37+# define ntohs(x) (x)
38+# define htonl(x) (x)
39+# define htons(x) (x)
40+# else
41+# if __BYTE_ORDER == __LITTLE_ENDIAN
42+# define ntohl(x) __bswap_32 (x)
43+# define ntohs(x) __bswap_16 (x)
44+# define htonl(x) __bswap_32 (x)
45+# define htons(x) __bswap_16 (x)
46+# endif
47+# endif
48+#endif
49+
50+#endif /* netinet/in.h */
51diff -ru iputils/ping6.c iputils-clean/ping6.c
52--- iputils/ping6.c 2003-09-03 11:22:46.000000000 -0400
53+++ iputils-clean/ping6.c 2003-09-03 11:15:42.000000000 -0400
54@@ -879,7 +879,7 @@
55 once = 1;
56
57 /* Patch bpflet for current identifier. */
58- insns[1] = (struct sock_filter)BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __constant_htons(ident), 0, 1);
59+ insns[1] = (struct sock_filter)BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, htons(ident), 0, 1);
60
61 if (setsockopt(icmp_sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)))
62 perror("WARNING: failed to install socket filter\n");
63diff -ru iputils/ping.c iputils-clean/ping.c
64--- iputils/ping.c 2003-09-03 11:22:46.000000000 -0400
65+++ iputils-clean/ping.c 2003-09-03 11:15:26.000000000 -0400
66@@ -1196,7 +1196,7 @@
67 once = 1;
68
69 /* Patch bpflet for current identifier. */
70- insns[2] = (struct sock_filter)BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __constant_htons(ident), 0, 1);
71+ insns[2] = (struct sock_filter)BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, htons(ident), 0, 1);
72
73 if (setsockopt(icmp_sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)))
74 perror("WARNING: failed to install socket filter\n");