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
6 (_vap)->iv_ic->ic_roaming == IEEE80211_ROAMING_AUTO)
12 pre_announced_chanswitch(struct net_device *dev, u_int32_t channel, u_int32_t tbtt);
14 @@ -2616,6 +2618,12 @@
16 ic->ic_flags_ext &= ~IEEE80211_FEXT_MARKDFS;
18 + case IEEE80211_PARAM_KARMA:
24 #ifdef ATH_REVERSE_ENGINEERING
25 case IEEE80211_PARAM_DUMPREGS:
26 ieee80211_dump_registers(dev, info, w, extra);
31 + case IEEE80211_PARAM_KARMA:
32 + param[0] = karma_enable;
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" },
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
54 #include <net80211/ieee80211_var.h>
56 +extern int karma_enable;
58 #ifdef IEEE80211_DEBUG
60 * Decide if a received management frame should be
64 #ifdef IEEE80211_DEBUG
66 ieee80211_ssid_mismatch(struct ieee80211vap *vap, const char *tag,
67 u_int8_t mac[IEEE80211_ADDR_LEN], u_int8_t *ssid)
70 ieee80211_print_essid(ssid + 2, ssid[1]);
74 #define IEEE80211_VERIFY_SSID(_ni, _ssid) do { \
75 if ((_ssid)[1] != 0 && \
76 ((_ssid)[1] != (_ni)->ni_esslen || \
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
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");
92 + // KARMA: Print the probe response if in adhoc mode
94 + if (vap->iv_opmode == IEEE80211_M_IBSS) {
95 + printf ("KARMA: Probe response for [");
96 + ieee80211_print_essid(ssid + 2, ssid[1]);
100 IEEE80211_SEND_MGMT(ni,
101 IEEE80211_FC0_SUBTYPE_PROBE_RESP, 0);
103 @@ -3229,7 +3239,9 @@
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
110 + IEEE80211_VERIFY_SSID(vap->iv_bss, ssid);
112 if (ni == vap->iv_bss) {
113 IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_ANY, wh->i_addr2,
114 @@ -3408,6 +3420,15 @@
116 /* Send TGf L2UF frame on behalf of newly associated station */
117 ieee80211_deliver_l2uf(ni);
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]);
127 ieee80211_node_join(ni, resp);
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
135 #include <net80211/ieee80211_monitor.h>
136 #include <net80211/if_athproto.h>
138 +extern int karma_enable;
140 #ifdef IEEE80211_DEBUG
142 * Decide if an outbound management frame should be
143 @@ -1876,10 +1878,17 @@
144 *(__le16 *)frm = htole16(capinfo);
148 - frm = ieee80211_add_ssid(frm, vap->iv_bss->ni_essid,
149 - vap->iv_bss->ni_esslen);
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]);
159 + frm = ieee80211_add_ssid(frm, vap->iv_bss->ni_essid,
160 + vap->iv_bss->ni_esslen);
162 /* supported rates */
163 frm = ieee80211_add_rates(frm, &ni->ni_rates);
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
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 */
176 #define SIOCG80211STATS (SIOCDEVPRIVATE+2)