aboutsummaryrefslogtreecommitdiffstats
path: root/main/igmpproxy/0001-Use-standard-unsigned-integer-types.patch
blob: 40ada6f7ce385dee82d0a736b0fea1d937461468 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
From ed3dff27f360239910310be6706fd54572398992 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Mon, 3 Mar 2014 12:11:26 +0000
Subject: [PATCH] Use standard unsigned integer types

Use the stanard unsigned integer types instead of the non-standard
u_char, u_short and u_int.

This fixes build with musl libc.

(cherry picked from commit b914bcf882c6189be7a0ce6fceb34422372c3606)

Conflicts:
	src/igmp.c
---
 src/igmp.c         |  4 ++--
 src/kern.c         |  4 ++--
 src/lib.c          | 10 +++++-----
 src/os-dragonfly.h |  4 ++--
 src/os-freebsd.h   |  4 ++--
 src/os-linux.h     |  4 ++--
 src/os-netbsd.h    |  4 ++--
 src/os-openbsd.h   |  4 ++--
 8 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/igmp.c b/src/igmp.c
index a0cd27d..92f37e7 100644
--- a/src/igmp.c
+++ b/src/igmp.c
@@ -79,7 +79,7 @@ void initIgmp() {
 /**
 *   Finds the textual name of the supplied IGMP request.
 */
-char *igmpPacketKind(u_int type, u_int code) {
+char *igmpPacketKind(unsigned int type, unsigned int code) {
     static char unknown[20];
 
     switch (type) {
@@ -226,7 +226,7 @@ void buildIgmp(uint32_t src, uint32_t dst, int type, int code, uint32_t group, i
     igmp->igmp_code         = code;
     igmp->igmp_group.s_addr = group;
     igmp->igmp_cksum        = 0;
-    igmp->igmp_cksum        = inetChksum((u_short *)igmp,
+    igmp->igmp_cksum        = inetChksum((unsigned short *)igmp,
                                          IGMP_MINLEN + datalen);
 }
 
diff --git a/src/kern.c b/src/kern.c
index 2055636..12c613f 100644
--- a/src/kern.c
+++ b/src/kern.c
@@ -82,7 +82,7 @@ void k_hdr_include(int hdrincl) {
 
 void k_set_ttl(int t) {
 #ifndef RAW_OUTPUT_IS_RAW
-    u_char ttl;
+    unsigned char ttl;
 
     ttl = t;
     if (setsockopt(MRouterFD, IPPROTO_IP, IP_MULTICAST_TTL,
@@ -94,7 +94,7 @@ void k_set_ttl(int t) {
 
 
 void k_set_loop(int l) {
-    u_char loop;
+    unsigned char loop;
 
     loop = l;
     if (setsockopt(MRouterFD, IPPROTO_IP, IP_MULTICAST_LOOP,
diff --git a/src/lib.c b/src/lib.c
index 70a730a..0eed9ce 100644
--- a/src/lib.c
+++ b/src/lib.c
@@ -61,9 +61,9 @@ char *fmtInAdr( char *St, struct in_addr InAdr ) {
  * Convert an IP address in u_long (network) format into a printable string.
  */
 char *inetFmt(uint32_t addr, char *s) {
-    register u_char *a;
+    register unsigned char *a;
 
-    a = (u_char *)&addr;
+    a = (unsigned char *)&addr;
     sprintf(s, "%u.%u.%u.%u", a[0], a[1], a[2], a[3]);
     return(s);
 }
@@ -74,15 +74,15 @@ char *inetFmt(uint32_t addr, char *s) {
  * string including the netmask as a number of bits.
  */
 char *inetFmts(uint32_t addr, uint32_t mask, char *s) {
-    register u_char *a, *m;
+    register unsigned char *a, *m;
     int bits;
 
     if ((addr == 0) && (mask == 0)) {
         sprintf(s, "default");
         return(s);
     }
-    a = (u_char *)&addr;
-    m = (u_char *)&mask;
+    a = (unsigned char *)&addr;
+    m = (unsigned char *)&mask;
     bits = 33 - ffs(ntohl(mask));
 
     if (m[3] != 0) sprintf(s, "%u.%u.%u.%u/%d", a[0], a[1], a[2], a[3],
diff --git a/src/os-dragonfly.h b/src/os-dragonfly.h
index 735401c..189dfb2 100644
--- a/src/os-dragonfly.h
+++ b/src/os-dragonfly.h
@@ -3,12 +3,12 @@
 #include <netinet/ip.h>
 #include <netinet/igmp.h>
 
-static inline u_short ip_data_len(const struct ip *ip)
+static inline unsigned short ip_data_len(const struct ip *ip)
 {
 	return ip->ip_len;
 }
 
-static inline void ip_set_len(struct ip *ip, u_short len)
+static inline void ip_set_len(struct ip *ip, unsigned short len)
 {
 	ip->ip_len = len;
 }
diff --git a/src/os-freebsd.h b/src/os-freebsd.h
index ca01cc5..60b897c 100644
--- a/src/os-freebsd.h
+++ b/src/os-freebsd.h
@@ -12,12 +12,12 @@
 #define IGMP_V2_LEAVE_GROUP IGMP_HOST_LEAVE_MESSAGE
 #endif
 
-static inline u_short ip_data_len(const struct ip *ip)
+static inline unsigned short ip_data_len(const struct ip *ip)
 {
 	return ip->ip_len;
 }
 
-static inline void ip_set_len(struct ip *ip, u_short len)
+static inline void ip_set_len(struct ip *ip, unsigned short len)
 {
 	ip->ip_len = len;
 }
diff --git a/src/os-linux.h b/src/os-linux.h
index 7504b1f..6cdcdc7 100644
--- a/src/os-linux.h
+++ b/src/os-linux.h
@@ -4,12 +4,12 @@
 #include <netinet/ip.h>
 #include <netinet/igmp.h>
 
-static inline u_short ip_data_len(const struct ip *ip)
+static inline unsigned short ip_data_len(const struct ip *ip)
 {
 	return ntohs(ip->ip_len) - (ip->ip_hl << 2);
 }
 
-static inline void ip_set_len(struct ip *ip, u_short len)
+static inline void ip_set_len(struct ip *ip, unsigned short len)
 {
 	ip->ip_len = htons(len);
 }
diff --git a/src/os-netbsd.h b/src/os-netbsd.h
index 17bd5fa..22f74e5 100644
--- a/src/os-netbsd.h
+++ b/src/os-netbsd.h
@@ -8,12 +8,12 @@
 #define IGMP_V2_MEMBERSHIP_REPORT IGMP_v2_HOST_MEMBERSHIP_REPORT
 #define IGMP_V2_LEAVE_GROUP IGMP_HOST_LEAVE_MESSAGE
 
-static inline u_short ip_data_len(const struct ip *ip)
+static inline unsigned short ip_data_len(const struct ip *ip)
 {
 	return ip->ip_len;
 }
 
-static inline void ip_set_len(struct ip *ip, u_short len)
+static inline void ip_set_len(struct ip *ip, unsigned short len)
 {
 	ip->ip_len = len;
 }
diff --git a/src/os-openbsd.h b/src/os-openbsd.h
index 873e5fb..75ddf80 100644
--- a/src/os-openbsd.h
+++ b/src/os-openbsd.h
@@ -10,12 +10,12 @@
 
 #define INADDR_ALLRTRS_GROUP INADDR_ALLROUTERS_GROUP
 
-static inline u_short ip_data_len(const struct ip *ip)
+static inline unsigned short ip_data_len(const struct ip *ip)
 {
 	return ntohs(ip->ip_len) - (ip->ip_hl << 2);
 }
 
-static inline void ip_set_len(struct ip *ip, u_short len)
+static inline void ip_set_len(struct ip *ip, unsigned short len)
 {
 	ip->ip_len = htons(len);
 }
-- 
1.9.0