add /etc/firewall.user to be backed up becuase it is an example in /etc/config/firewall
[openwrt.git] / package / madwifi / patches-testing / 102-multicall_binary.patch
1 --- a/tools/80211debug.c
2 +++ b/tools/80211debug.c
3 @@ -48,6 +48,7 @@
4 #include <ctype.h>
5 #include <getopt.h>
6 #include <err.h>
7 +#include "do_multi.h"
8
9 #undef ARRAY_SIZE
10 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
11 @@ -185,7 +186,7 @@
12 #endif /* __linux__ */
13
14 int
15 -main(int argc, char *argv[])
16 +CMD(a80211debug)(int argc, char *argv[])
17 {
18 const char *ifname = "ath0";
19 const char *cp, *tp;
20 --- a/tools/80211stats.c
21 +++ b/tools/80211stats.c
22 @@ -59,6 +59,7 @@
23 #include "net80211/ieee80211.h"
24 #include "net80211/ieee80211_crypto.h"
25 #include "net80211/ieee80211_ioctl.h"
26 +#include "do_multi.h"
27
28 #ifndef SIOCG80211STATS
29 #define SIOCG80211STATS (SIOCDEVPRIVATE + 2)
30 @@ -241,7 +242,7 @@
31 }
32
33 int
34 -main(int argc, char *argv[])
35 +CMD(a80211stats)(int argc, char *argv[])
36 {
37 int c, len;
38 struct ieee80211req_sta_info *si;
39 --- a/tools/athchans.c
40 +++ b/tools/athchans.c
41 @@ -58,6 +58,7 @@
42 #include "net80211/ieee80211.h"
43 #include "net80211/ieee80211_crypto.h"
44 #include "net80211/ieee80211_ioctl.h"
45 +#include "do_multi.h"
46
47 static int s = -1;
48 static const char *progname;
49 @@ -140,8 +141,9 @@
50 }
51
52 #define MAXCHAN ((int)(sizeof(struct ieee80211req_chanlist) * NBBY))
53 +
54 int
55 -main(int argc, char *argv[])
56 +CMD(athchans)(int argc, char *argv[])
57 {
58 const char *ifname = "wifi0";
59 struct ieee80211req_chanlist chanlist;
60 --- a/tools/athctrl.c
61 +++ b/tools/athctrl.c
62 @@ -52,6 +52,7 @@
63 #include <err.h>
64
65 #include <net/if.h>
66 +#include "do_multi.h"
67
68 static int
69 setsysctrl(const char *dev, const char *control , u_long value)
70 @@ -88,7 +89,7 @@
71 }
72
73 int
74 -main(int argc, char *argv[])
75 +CMD(athctrl)(int argc, char *argv[])
76 {
77 char device[IFNAMSIZ + 1];
78 int distance = -1;
79 --- a/tools/athdebug.c
80 +++ b/tools/athdebug.c
81 @@ -51,6 +51,7 @@
82 #include <ctype.h>
83 #include <getopt.h>
84 #include <err.h>
85 +#include "do_multi.h"
86
87 #undef ARRAY_SIZE
88 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
89 @@ -194,7 +195,7 @@
90 #endif /* __linux__ */
91
92 int
93 -main(int argc, char *argv[])
94 +CMD(athdebug)(int argc, char *argv[])
95 {
96 #ifdef __linux__
97 const char *ifname = "wifi0";
98 --- a/tools/athkey.c
99 +++ b/tools/athkey.c
100 @@ -58,6 +58,7 @@
101 #include "net80211/ieee80211.h"
102 #include "net80211/ieee80211_crypto.h"
103 #include "net80211/ieee80211_ioctl.h"
104 +#include "do_multi.h"
105
106 static int s = -1;
107 static const char *progname;
108 @@ -213,8 +214,7 @@
109 exit(-1);
110 }
111
112 -int
113 -main(int argc, char *argv[])
114 +int CMD(athkey)(int argc, char *argv[])
115 {
116 const char *ifname = "wifi0";
117 struct ieee80211req_key setkey;
118 --- a/tools/athstats.c
119 +++ b/tools/athstats.c
120 @@ -65,6 +65,7 @@
121
122 #undef ARRAY_SIZE
123 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
124 +#include "do_multi.h"
125
126 static const struct {
127 u_int phyerr;
128 @@ -228,7 +229,7 @@
129 }
130
131 int
132 -main(int argc, char *argv[])
133 +CMD(athstats)(int argc, char *argv[])
134 {
135 #ifdef __linux__
136 const char *ifname = "wifi0";
137 --- /dev/null
138 +++ b/tools/do_multi.c
139 @@ -0,0 +1,36 @@
140 +#include <string.h>
141 +#include "do_multi.h"
142 +
143 +int
144 +main(int argc, char *argv[])
145 +{
146 + char *progname;
147 + int ret = 0;
148 +
149 + progname = basename(argv[0]);
150 +
151 + if(strcmp(progname, "80211debug") == 0)
152 + ret = a80211debug_init(argc, argv);
153 + if(strcmp(progname, "80211stats") == 0)
154 + ret = a80211stats_init(argc, argv);
155 + if(strcmp(progname, "athchans") == 0)
156 + ret = athchans_init(argc, argv);
157 + if(strcmp(progname, "athctrl") == 0)
158 + ret = athctrl_init(argc, argv);
159 + if(strcmp(progname, "athdebug") == 0)
160 + ret = athdebug_init(argc, argv);
161 + if(strcmp(progname, "athkey") == 0)
162 + ret = athkey_init(argc, argv);
163 + if(strcmp(progname, "athstats") == 0)
164 + ret = athstats_init(argc, argv);
165 + if(strcmp(progname, "wlanconfig") == 0)
166 + ret = wlanconfig_init(argc, argv);
167 + if(strcmp(progname, "wpakey") == 0)
168 + ret = wpakey_init(argc, argv);
169 + if(strcmp(progname, "athchans") == 0)
170 + ret = athchans_init(argc, argv);
171 + if(strcmp(progname, "ath_info") == 0)
172 + ret = athinfo_init(argc, argv);
173 +
174 + return ret;
175 +}
176 --- /dev/null
177 +++ b/tools/do_multi.h
178 @@ -0,0 +1,15 @@
179 +#ifdef DO_MULTI
180 +int a80211debug_init(int argc, char *argv[]);
181 +int a80211stats_init(int argc, char *argv[]);
182 +int athchans_init(int argc, char *argv[]);
183 +int athctrl_init(int argc, char *argv[]);
184 +int athdebug_init(int argc, char *argv[]);
185 +int athkey_init(int argc, char *argv[]);
186 +int athstats_init(int argc, char *argv[]);
187 +int wlanconfig_init(int argc, char *argv[]);
188 +int athinfo_init(int argc, char *argv[]);
189 +
190 +#define CMD(name) name##_init
191 +#else
192 +#define CMD(name) main
193 +#endif
194 --- a/tools/Makefile
195 +++ b/tools/Makefile
196 @@ -50,42 +50,43 @@
197 PROGRAMS = athstats 80211stats athkey athchans athctrl \
198 athdebug 80211debug wlanconfig wpakey
199
200 +OBJS = $(patsubst %,%.o,$(PROGRAMS)) ath_info/ath_info.o
201 SUBDIRS = ath_info
202
203 -INCS = -I. -I$(HAL) -I$(TOP) -I$(ATH_HAL)
204 +INCS = -I. -I$(HAL) -I$(TOP) -I$(ATH_HAL) -I$(TOP)/ath
205 CFLAGS = -g -O2 -Wall
206 ALL_CFLAGS = $(CFLAGS) $(INCS)
207 LDFLAGS =
208
209 -all: all-subdirs $(PROGRAMS)
210 +all: all-subdirs compile
211
212 all-subdirs:
213 for d in $(SUBDIRS); do \
214 $(MAKE) -C $$d || exit 1; \
215 done
216
217 -athstats: athstats.c
218 - $(CC) -o athstats $(ALL_CFLAGS) -I$(TOP)/ath $(LDFLAGS) athstats.c
219 -80211stats: 80211stats.c
220 - $(CC) -o 80211stats $(ALL_CFLAGS) $(LDFLAGS) 80211stats.c
221 -athkey: athkey.c
222 - $(CC) -o athkey $(ALL_CFLAGS) $(LDFLAGS) athkey.c
223 -athchans: athchans.c
224 - $(CC) -o athchans $(ALL_CFLAGS) $(LDFLAGS) athchans.c
225 -athctrl: athctrl.c
226 - $(CC) -o athctrl $(ALL_CFLAGS) $(LDFLAGS) athctrl.c
227 -athdebug: athdebug.c
228 - $(CC) -o athdebug $(ALL_CFLAGS) $(LDFLAGS) athdebug.c
229 -wlanconfig: wlanconfig.c
230 - $(CC) -o wlanconfig $(ALL_CFLAGS) $(LDFLAGS) wlanconfig.c
231 -80211debug: 80211debug.c
232 - $(CC) -o 80211debug $(ALL_CFLAGS) $(LDFLAGS) 80211debug.c
233 -wpakey: wpakey.c
234 - $(CC) -o wpakey $(ALL_CFLAGS) $(LDFLAGS) wpakey.c
235 +%.o: %.c
236 + ${CC} $(ALL_CFLAGS) -c -o $@ $<
237 +
238 +ifneq ($(DO_MULTI),)
239 +ALL_CFLAGS += -DDO_MULTI=1
240 +madwifi_multi: $(OBJS) do_multi.o
241 + $(CC) $(LDFLAGS) -o $@ $^
242 +
243 +compile: madwifi_multi
244 + for i in $(PROGRAMS); do \
245 + ln -sf madwifi_multi $$i; \
246 + done
247 +else
248 +$(PROGRAMS):
249 + $(CC) $(ALL_CFLAGS) -o $@ $@.c
250 +
251 +compile: $(PROGRAMS)
252 +endif
253
254 install: all
255 install -d $(DESTDIR)$(BINDIR)
256 - for i in $(PROGRAMS); do \
257 + for i in $(PROGRAMS) $(if $(DO_MULTI),madwifi_multi); do \
258 install $$i $(DESTDIR)$(BINDIR)/$$i; \
259 $(STRIP) $(DESTDIR)$(BINDIR)/$$i; \
260 done
261 @@ -97,7 +98,7 @@
262 done
263
264 uninstall:
265 - for i in $(PROGRAMS); do \
266 + for i in $(PROGRAMS) $(if $(DO_MULTI),madwifi_multi); do \
267 rm -f $(DESTDIR)$(BINDIR)/$$i; \
268 done
269 for i in $(PROGRAMS:=.8); do \
270 @@ -108,7 +109,7 @@
271 done
272
273 clean:
274 - rm -f $(PROGRAMS) core a.out
275 + rm -f $(if $(DO_MULTI), madwifi_multi) $(PROGRAMS) core a.out *.o
276 for d in $(SUBDIRS); do \
277 $(MAKE) -C $$d clean; \
278 done
279 --- a/tools/wlanconfig.c
280 +++ b/tools/wlanconfig.c
281 @@ -61,6 +61,7 @@
282 #include "net80211/ieee80211.h"
283 #include "net80211/ieee80211_crypto.h"
284 #include "net80211/ieee80211_ioctl.h"
285 +#include "do_multi.h"
286
287 /*
288 * These are taken from ieee80211_node.h
289 @@ -100,7 +101,7 @@
290 static int verbose = 0;
291
292 int
293 -main(int argc, char *argv[])
294 +CMD(wlanconfig)(int argc, char *argv[])
295 {
296 const char *ifname, *cmd;
297 unsigned char bnounit = 0;
298 --- a/tools/ath_info/Makefile
299 +++ b/tools/ath_info/Makefile
300 @@ -17,11 +17,18 @@
301
302 all: $(PROGRAMS)
303
304 +
305 +ifneq ($(DO_MULTI),)
306 +ath_info: ath_info.o
307 + rm -f $@
308 + ln -s ../madwifi_multi $@
309 +else
310 ath_info: ath_info.o
311 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
312 +endif
313
314 .c.o:
315 - $(CC) $(CFLAGS) -c $<
316 + $(CC) $(CFLAGS) $(if $(DO_MULTI),-DDO_MULTI=1 -I..) -c $<
317
318 clean:
319 rm -f *.o $(PROGRAMS)
320 --- a/tools/ath_info/ath_info.c
321 +++ b/tools/ath_info/ath_info.c
322 @@ -28,6 +28,7 @@
323 #include <sys/mman.h>
324 #include <endian.h>
325 #include <byteswap.h>
326 +#include "do_multi.h"
327
328 #undef ARRAY_SIZE
329 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
330 @@ -1982,7 +1983,8 @@
331 printf("\n");
332 }
333
334 -int main(int argc, char *argv[])
335 +int
336 +CMD(athinfo)(int argc, char *argv[])
337 {
338 unsigned long long dev_addr;
339 u_int16_t srev, phy_rev_5ghz, phy_rev_2ghz, ee_magic;
340 --- a/tools/wpakey.c
341 +++ b/tools/wpakey.c
342 @@ -25,6 +25,7 @@
343
344 #include <unistd.h>
345 #include <sys/ioctl.h>
346 +#include "do_multi.h"
347
348 #define MACS "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"
349 #define MACP(mac) (mac)[0], (mac)[1], (mac)[2], (mac)[3], (mac)[4], (mac)[5]
350 @@ -234,7 +235,8 @@
351 "", dev);
352 }
353
354 -int main(int argc, char** argv) {
355 +int
356 +CMD(wpakey)(int argc, char** argv) {
357 int keyidx = 0;
358 uint8_t mac[6];
359 int cipher = IEEE80211_CIPHER_AES_CCM;
This page took 0.067715 seconds and 5 git commands to generate.