refreshed madwifi patches
[openwrt.git] / package / madwifi / patches / 320-karma.patch
1 Index: madwifi-ng-r2568-20070710/net80211/ieee80211_wireless.c
2 ===================================================================
3 --- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_wireless.c 2007-10-20 20:52:09.000000000 +0200
4 +++ madwifi-ng-r2568-20070710/net80211/ieee80211_wireless.c 2007-10-20 20:52:10.000000000 +0200
5 @@ -72,6 +72,8 @@
6 (_vap)->iv_ic->ic_roaming == IEEE80211_ROAMING_AUTO)
7 #define RESCAN 1
8
9 +int karma_enable;
10 +
11 static void
12 pre_announced_chanswitch(struct net_device *dev, u_int32_t channel, u_int32_t tbtt);
13
14 @@ -2616,6 +2618,12 @@
15 else
16 ic->ic_flags_ext &= ~IEEE80211_FEXT_MARKDFS;
17 break;
18 + case IEEE80211_PARAM_KARMA:
19 + if (value)
20 + karma_enable = 1;
21 + else
22 + karma_enable = 0;
23 + break;
24 #ifdef ATH_REVERSE_ENGINEERING
25 case IEEE80211_PARAM_DUMPREGS:
26 ieee80211_dump_registers(dev, info, w, extra);
27 @@ -2914,6 +2922,9 @@
28 else
29 param[0] = 0;
30 break;
31 + case IEEE80211_PARAM_KARMA:
32 + param[0] = karma_enable;
33 + break;
34 default:
35 return -EOPNOTSUPP;
36 }
37 @@ -5271,6 +5282,10 @@
38 { IEEE80211_IOCTL_WRITEREG,
39 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "writereg" },
40 #endif /* #ifdef ATH_REVERSE_ENGINEERING */
41 + { IEEE80211_PARAM_KARMA,
42 + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "karma" },
43 + { IEEE80211_PARAM_KARMA, 0,
44 + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_karma" },
45 };
46
47 #define set_handler(x,f) [x - SIOCIWFIRST] = (iw_handler) f
48 Index: madwifi-ng-r2568-20070710/net80211/ieee80211_input.c
49 ===================================================================
50 --- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_input.c 2007-10-20 20:52:09.000000000 +0200
51 +++ madwifi-ng-r2568-20070710/net80211/ieee80211_input.c 2007-10-20 20:52:10.000000000 +0200
52 @@ -59,6 +59,8 @@
53
54 #include <net80211/ieee80211_var.h>
55
56 +extern int karma_enable;
57 +
58 #ifdef IEEE80211_DEBUG
59 /*
60 * Decide if a received management frame should be
61 @@ -1625,7 +1627,6 @@
62 } while (0)
63
64 #ifdef IEEE80211_DEBUG
65 -static void
66 ieee80211_ssid_mismatch(struct ieee80211vap *vap, const char *tag,
67 u_int8_t mac[IEEE80211_ADDR_LEN], u_int8_t *ssid)
68 {
69 @@ -1634,7 +1635,6 @@
70 ieee80211_print_essid(ssid + 2, ssid[1]);
71 printf("\n");
72 }
73 -
74 #define IEEE80211_VERIFY_SSID(_ni, _ssid) do { \
75 if ((_ssid)[1] != 0 && \
76 ((_ssid)[1] != (_ni)->ni_esslen || \
77 @@ -2993,7 +2993,9 @@
78 return;
79 IEEE80211_VERIFY_ELEMENT(rates, IEEE80211_RATE_MAXSIZE);
80 IEEE80211_VERIFY_ELEMENT(ssid, IEEE80211_NWID_LEN);
81 - IEEE80211_VERIFY_SSID(vap->iv_bss, ssid);
82 + // KARMA: Don't verify SSID on Probe Requests
83 + if (!karma_enable)
84 + IEEE80211_VERIFY_SSID(vap->iv_bss, ssid);
85 if ((vap->iv_flags & IEEE80211_F_HIDESSID) && ssid[1] == 0) {
86 IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
87 wh, ieee80211_mgt_subtype_name[subtype >>
88 @@ -3041,6 +3043,14 @@
89 IEEE80211_FC0_SUBTYPE_SHIFT],
90 "%s", "recv'd rate set invalid");
91 } else {
92 + // KARMA: Print the probe response if in adhoc mode
93 + if (karma_enable) {
94 + if (vap->iv_opmode == IEEE80211_M_IBSS) {
95 + printf ("KARMA: Probe response for [");
96 + ieee80211_print_essid(ssid + 2, ssid[1]);
97 + printf ("]\n");
98 + }
99 + }
100 IEEE80211_SEND_MGMT(ni,
101 IEEE80211_FC0_SUBTYPE_PROBE_RESP, 0);
102 }
103 @@ -3229,7 +3239,9 @@
104 return;
105 IEEE80211_VERIFY_ELEMENT(rates, IEEE80211_RATE_MAXSIZE);
106 IEEE80211_VERIFY_ELEMENT(ssid, IEEE80211_NWID_LEN);
107 - IEEE80211_VERIFY_SSID(vap->iv_bss, ssid);
108 + // KARMA: Don't verify SSID on Association Requests
109 + if (!karma_enable)
110 + IEEE80211_VERIFY_SSID(vap->iv_bss, ssid);
111
112 if (ni == vap->iv_bss) {
113 IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_ANY, wh->i_addr2,
114 @@ -3408,6 +3420,15 @@
115
116 /* Send TGf L2UF frame on behalf of newly associated station */
117 ieee80211_deliver_l2uf(ni);
118 +
119 + // KARMA: Log SSID that client thinks they are associating to
120 + if (karma_enable) {
121 + printf("KARMA: Node [%s] associating to ssid [",
122 + ether_sprintf(wh->i_addr2));
123 + ieee80211_print_essid(ssid + 2, ssid[1]);
124 + printf("]\n");
125 + }
126 +
127 ieee80211_node_join(ni, resp);
128 #ifdef ATH_SUPERG_XR
129 if (ni->ni_prev_vap &&
130 Index: madwifi-ng-r2568-20070710/net80211/ieee80211_output.c
131 ===================================================================
132 --- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_output.c 2007-10-20 20:52:09.000000000 +0200
133 +++ madwifi-ng-r2568-20070710/net80211/ieee80211_output.c 2007-10-20 20:52:10.000000000 +0200
134 @@ -57,6 +57,8 @@
135 #include <net80211/ieee80211_monitor.h>
136 #include <net80211/if_athproto.h>
137
138 +extern int karma_enable;
139 +
140 #ifdef IEEE80211_DEBUG
141 /*
142 * Decide if an outbound management frame should be
143 @@ -1876,10 +1878,17 @@
144 *(__le16 *)frm = htole16(capinfo);
145 frm += 2;
146
147 - /* ssid */
148 - frm = ieee80211_add_ssid(frm, vap->iv_bss->ni_essid,
149 - vap->iv_bss->ni_esslen);
150 -
151 + // KARMA: If argument is specified, on PROBE_RESP, it is
152 + // the SSID to use in the response which is the same SSID
153 + // has the client sent).
154 + if (arg && karma_enable) {
155 + u_int8_t* ssid = (u_int8_t*)arg;
156 + frm = ieee80211_add_ssid(frm, ssid + 2, ssid[1]);
157 + } else {
158 + /* ssid */
159 + frm = ieee80211_add_ssid(frm, vap->iv_bss->ni_essid,
160 + vap->iv_bss->ni_esslen);
161 + }
162 /* supported rates */
163 frm = ieee80211_add_rates(frm, &ni->ni_rates);
164
165 Index: madwifi-ng-r2568-20070710/net80211/ieee80211_ioctl.h
166 ===================================================================
167 --- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_ioctl.h 2007-10-20 20:51:36.000000000 +0200
168 +++ madwifi-ng-r2568-20070710/net80211/ieee80211_ioctl.h 2007-10-20 20:52:10.000000000 +0200
169 @@ -603,6 +603,7 @@
170 IEEE80211_PARAM_DROPUNENC_EAPOL = 60, /* drop unencrypted eapol frames */
171 IEEE80211_PARAM_SHPREAMBLE = 61, /* Short Preamble */
172 IEEE80211_PARAM_DUMPREGS = 62, /* Pretty printed dump of Atheros hardware registers */
173 + IEEE80211_PARAM_KARMA = 63, /* Enable Karma */
174 };
175
176 #define SIOCG80211STATS (SIOCDEVPRIVATE+2)
This page took 0.048293 seconds and 5 git commands to generate.