Build a karma variant of madwifi
[openwrt/svn-archive/archive.git] / package / madwifi / files / karma.patch
1 diff -urN madwifi-ng-r2568-20070710/net80211/ieee80211_input.c madwifi-ng-r2568-20070710.new/net80211/ieee80211_input.c
2 --- madwifi-ng-r2568-20070710/net80211/ieee80211_input.c 2007-10-14 12:52:10.000000000 +0200
3 +++ madwifi-ng-r2568-20070710.new/net80211/ieee80211_input.c 2007-10-14 12:57:27.000000000 +0200
4 @@ -1625,7 +1625,8 @@
5 } while (0)
6
7 #ifdef IEEE80211_DEBUG
8 -static void
9 +/* Not used by karma
10 + * static void
11 ieee80211_ssid_mismatch(struct ieee80211vap *vap, const char *tag,
12 u_int8_t mac[IEEE80211_ADDR_LEN], u_int8_t *ssid)
13 {
14 @@ -1634,7 +1635,7 @@
15 ieee80211_print_essid(ssid + 2, ssid[1]);
16 printf("\n");
17 }
18 -
19 +*/
20 #define IEEE80211_VERIFY_SSID(_ni, _ssid) do { \
21 if ((_ssid)[1] != 0 && \
22 ((_ssid)[1] != (_ni)->ni_esslen || \
23 @@ -2993,7 +2994,8 @@
24 return;
25 IEEE80211_VERIFY_ELEMENT(rates, IEEE80211_RATE_MAXSIZE);
26 IEEE80211_VERIFY_ELEMENT(ssid, IEEE80211_NWID_LEN);
27 - IEEE80211_VERIFY_SSID(vap->iv_bss, ssid);
28 + // KARMA: Don't verify SSID on Probe Requests
29 + //IEEE80211_VERIFY_SSID(vap->iv_bss, ssid);
30 if ((vap->iv_flags & IEEE80211_F_HIDESSID) && ssid[1] == 0) {
31 IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
32 wh, ieee80211_mgt_subtype_name[subtype >>
33 @@ -3041,6 +3043,12 @@
34 IEEE80211_FC0_SUBTYPE_SHIFT],
35 "%s", "recv'd rate set invalid");
36 } else {
37 + // KARMA: Print the probe response if in adhoc mode
38 + if (vap->iv_opmode == IEEE80211_M_IBSS) {
39 + printf ("KARMA: Probe response for [");
40 + ieee80211_print_essid(ssid + 2, ssid[1]);
41 + printf ("]\n");
42 + }
43 IEEE80211_SEND_MGMT(ni,
44 IEEE80211_FC0_SUBTYPE_PROBE_RESP, 0);
45 }
46 @@ -3229,7 +3237,8 @@
47 return;
48 IEEE80211_VERIFY_ELEMENT(rates, IEEE80211_RATE_MAXSIZE);
49 IEEE80211_VERIFY_ELEMENT(ssid, IEEE80211_NWID_LEN);
50 - IEEE80211_VERIFY_SSID(vap->iv_bss, ssid);
51 + // KARMA: Don't verify SSID on Association Requests
52 + //IEEE80211_VERIFY_SSID(vap->iv_bss, ssid);
53
54 if (ni == vap->iv_bss) {
55 IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_ANY, wh->i_addr2,
56 @@ -3408,6 +3417,13 @@
57
58 /* Send TGf L2UF frame on behalf of newly associated station */
59 ieee80211_deliver_l2uf(ni);
60 +
61 + // KARMA: Log SSID that client thinks they are associating to
62 + printf("KARMA: Node [%s] associating to ssid [",
63 + ether_sprintf(wh->i_addr2));
64 + ieee80211_print_essid(ssid + 2, ssid[1]);
65 + printf("]\n");
66 +
67 ieee80211_node_join(ni, resp);
68 #ifdef ATH_SUPERG_XR
69 if (ni->ni_prev_vap &&
70 diff -urN madwifi-ng-r2568-20070710/net80211/ieee80211_output.c madwifi-ng-r2568-20070710.new/net80211/ieee80211_output.c
71 --- madwifi-ng-r2568-20070710/net80211/ieee80211_output.c 2007-10-14 12:52:10.000000000 +0200
72 +++ madwifi-ng-r2568-20070710.new/net80211/ieee80211_output.c 2007-10-14 12:58:53.000000000 +0200
73 @@ -1876,10 +1876,17 @@
74 *(__le16 *)frm = htole16(capinfo);
75 frm += 2;
76
77 - /* ssid */
78 - frm = ieee80211_add_ssid(frm, vap->iv_bss->ni_essid,
79 - vap->iv_bss->ni_esslen);
80 -
81 + // KARMA: If argument is specified, on PROBE_RESP, it is
82 + // the SSID to use in the response which is the same SSID
83 + // has the client sent).
84 + if (arg) {
85 + u_int8_t* ssid = (u_int8_t*)arg;
86 + frm = ieee80211_add_ssid(frm, ssid + 2, ssid[1]);
87 + } else {
88 + /* ssid */
89 + frm = ieee80211_add_ssid(frm, vap->iv_bss->ni_essid,
90 + vap->iv_bss->ni_esslen);
91 + }
92 /* supported rates */
93 frm = ieee80211_add_rates(frm, &ni->ni_rates);
94