add kismet bugfix for linux 2.4 (from dragorn)
[openwrt/svn-archive/archive.git] / net / kismet / patches / 100-200701r1b_iwfreq_24_kernel.diff
1 diff -ur kismet-2007-01-R1b/config.h.in temp/config.h.in
2 --- kismet-2007-01-R1b/config.h.in 2006-10-13 16:50:32.000000000 -0400
3 +++ temp/config.h.in 2007-01-17 10:02:43.000000000 -0500
4 @@ -60,6 +60,9 @@
5 /* Libz compression lib */
6 #undef HAVE_LIBZ
7
8 +/* Linux wireless iwfreq.flag */
9 +#undef HAVE_LINUX_IWFREQFLAG
10 +
11 /* Linux netlink socket capture present */
12 #undef HAVE_LINUX_NETLINK
13
14 diff -ur kismet-2007-01-R1b/configure temp/configure
15 --- kismet-2007-01-R1b/configure 2006-12-27 09:32:52.000000000 -0500
16 +++ temp/configure 2007-01-17 10:02:43.000000000 -0500
17 @@ -7795,6 +7795,92 @@
18
19 fi
20
21 + iwfreqflag=no
22 + { echo "$as_me:$LINENO: checking can we use iw_freq.flags" >&5
23 +echo $ECHO_N "checking can we use iw_freq.flags... $ECHO_C" >&6; }
24 + cat >conftest.$ac_ext <<_ACEOF
25 +/* confdefs.h. */
26 +_ACEOF
27 +cat confdefs.h >>conftest.$ac_ext
28 +cat >>conftest.$ac_ext <<_ACEOF
29 +/* end confdefs.h. */
30 +
31 + #include <stdio.h>
32 + #include <sys/types.h>
33 + #include <netinet/in.h>
34 + #include <asm/types.h>
35 + #include <linux/if.h>
36 + #include <linux/wireless.h>
37 +
38 +int
39 +main ()
40 +{
41 +
42 + struct iwreq wrq;
43 + wrq.u.freq.flags = IW_FREQ_FIXED;
44 +
45 + ;
46 + return 0;
47 +}
48 +_ACEOF
49 +rm -f conftest.$ac_objext conftest$ac_exeext
50 +if { (ac_try="$ac_link"
51 +case "(($ac_try" in
52 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
53 + *) ac_try_echo=$ac_try;;
54 +esac
55 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
56 + (eval "$ac_link") 2>conftest.er1
57 + ac_status=$?
58 + grep -v '^ *+' conftest.er1 >conftest.err
59 + rm -f conftest.er1
60 + cat conftest.err >&5
61 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
62 + (exit $ac_status); } &&
63 + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
64 + { (case "(($ac_try" in
65 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
66 + *) ac_try_echo=$ac_try;;
67 +esac
68 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
69 + (eval "$ac_try") 2>&5
70 + ac_status=$?
71 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
72 + (exit $ac_status); }; } &&
73 + { ac_try='test -s conftest$ac_exeext'
74 + { (case "(($ac_try" in
75 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
76 + *) ac_try_echo=$ac_try;;
77 +esac
78 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
79 + (eval "$ac_try") 2>&5
80 + ac_status=$?
81 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
82 + (exit $ac_status); }; }; then
83 + iwfreqflag=yes
84 +else
85 + echo "$as_me: failed program was:" >&5
86 +sed 's/^/| /' conftest.$ac_ext >&5
87 +
88 + iwfreqflag=no
89 +fi
90 +
91 +rm -f core conftest.err conftest.$ac_objext \
92 + conftest$ac_exeext conftest.$ac_ext
93 +
94 + if test "$iwfreqflag" = "no"; then
95 + { echo "$as_me:$LINENO: result: no" >&5
96 +echo "${ECHO_T}no" >&6; }
97 + else
98 + { echo "$as_me:$LINENO: result: yes" >&5
99 +echo "${ECHO_T}yes" >&6; }
100 +
101 +cat >>confdefs.h <<\_ACEOF
102 +#define HAVE_LINUX_IWFREQFLAG 1
103 +_ACEOF
104 +
105 + fi
106 +
107 fi
108 fi
109
110 diff -ur kismet-2007-01-R1b/configure.in temp/configure.in
111 --- kismet-2007-01-R1b/configure.in 2006-12-27 09:32:52.000000000 -0500
112 +++ temp/configure.in 2007-01-17 10:02:43.000000000 -0500
113 @@ -438,6 +438,27 @@
114 AC_DEFINE(HAVE_LINUX_WIRELESS22, 1, [Linux wireless extentions v22 or better present])
115 fi
116
117 + iwfreqflag=no
118 + AC_MSG_CHECKING(can we use iw_freq.flags)
119 + AC_LINK_IFELSE([AC_LANG_PROGRAM([[
120 + #include <stdio.h>
121 + #include <sys/types.h>
122 + #include <netinet/in.h>
123 + #include <asm/types.h>
124 + #include <linux/if.h>
125 + #include <linux/wireless.h>
126 + ]], [[
127 + struct iwreq wrq;
128 + wrq.u.freq.flags = IW_FREQ_FIXED;
129 + ]])],[iwfreqflag=yes],[iwfreqflag=no])
130 +
131 + if test "$iwfreqflag" = "no"; then
132 + AC_MSG_RESULT(no)
133 + else
134 + AC_MSG_RESULT(yes)
135 + AC_DEFINE(HAVE_LINUX_IWFREQFLAG, 1, [Linux wireless iwfreq.flag])
136 + fi
137 +
138 fi
139 fi
140
141 diff -ur kismet-2007-01-R1b/iwcontrol.cc temp/iwcontrol.cc
142 --- kismet-2007-01-R1b/iwcontrol.cc 2006-11-17 11:13:23.000000000 -0500
143 +++ temp/iwcontrol.cc 2007-01-17 10:02:43.000000000 -0500
144 @@ -519,7 +519,9 @@
145 memset(&wrq, 0, sizeof(struct iwreq));
146
147 strncpy(wrq.ifr_name, in_dev, IFNAMSIZ);
148 +#ifdef HAVE_LINUX_IWFREQFLAG
149 wrq.u.freq.flags = IW_FREQ_FIXED;
150 +#endif
151 IwFloat2Freq(in_ch, &wrq.u.freq);
152
153 // Try twice with a tiny delay, some cards (madwifi) need a second chance...