contrib/ndiswrapper/ndiswrapper-1.53-linux_2.6.27.patch
2008-12-29 03:00:07 +11:00

156 lines
5.5 KiB
Diff

diff -pruN ndiswrapper-1.53.orig/driver/iw_ndis.c ndiswrapper-1.53/driver/iw_ndis.c
--- ndiswrapper-1.53.orig/driver/iw_ndis.c 2008-12-28 14:54:47.302306180 +0000
+++ ndiswrapper-1.53/driver/iw_ndis.c 2008-12-28 15:22:35.700057184 +0000
@@ -1015,7 +1015,11 @@ static int iw_get_nick(struct net_device
return 0;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+static char *ndis_translate_scan(struct iw_request_info *info, struct net_device *dev, char *event,
+#else
static char *ndis_translate_scan(struct net_device *dev, char *event,
+#endif
char *end_buf, void *item)
{
struct iw_event iwe;
@@ -1034,7 +1038,11 @@ static char *ndis_translate_scan(struct
iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
iwe.len = IW_EV_ADDR_LEN;
memcpy(iwe.u.ap_addr.sa_data, bssid->mac, ETH_ALEN);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+ event = iwe_stream_add_event(info, event, end_buf, &iwe, IW_EV_ADDR_LEN);
+#else
event = iwe_stream_add_event(event, end_buf, &iwe, IW_EV_ADDR_LEN);
+#endif
/* add essid */
memset(&iwe, 0, sizeof(iwe));
@@ -1044,13 +1052,21 @@ static char *ndis_translate_scan(struct
iwe.u.data.length = IW_ESSID_MAX_SIZE;
iwe.u.data.flags = 1;
iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+ event = iwe_stream_add_point(info, event, end_buf, &iwe, bssid->ssid.essid);
+#else
event = iwe_stream_add_point(event, end_buf, &iwe, bssid->ssid.essid);
+#endif
/* add protocol name */
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = SIOCGIWNAME;
strncpy(iwe.u.name, network_type_to_name(bssid->net_type), IFNAMSIZ);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+ event = iwe_stream_add_event(info, event, end_buf, &iwe, IW_EV_CHAR_LEN);
+#else
event = iwe_stream_add_event(event, end_buf, &iwe, IW_EV_CHAR_LEN);
+#endif
/* add mode */
memset(&iwe, 0, sizeof(iwe));
@@ -1061,7 +1077,11 @@ static char *ndis_translate_scan(struct
iwe.u.mode = IW_MODE_INFRA;
else // if (bssid->mode == Ndis802_11AutoUnknown)
iwe.u.mode = IW_MODE_AUTO;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+ event = iwe_stream_add_event(info, event, end_buf, &iwe, IW_EV_UINT_LEN);
+#else
event = iwe_stream_add_event(event, end_buf, &iwe, IW_EV_UINT_LEN);
+#endif
/* add freq */
memset(&iwe, 0, sizeof(iwe));
@@ -1076,7 +1096,11 @@ static char *ndis_translate_scan(struct
/* convert from kHz to Hz */
iwe.u.freq.e += 3;
iwe.len = IW_EV_FREQ_LEN;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+ event = iwe_stream_add_event(info, event, end_buf, &iwe, IW_EV_FREQ_LEN);
+#else
event = iwe_stream_add_event(event, end_buf, &iwe, IW_EV_FREQ_LEN);
+#endif
/* add qual */
memset(&iwe, 0, sizeof(iwe));
@@ -1090,7 +1114,11 @@ static char *ndis_translate_scan(struct
iwe.u.qual.noise = WL_NOISE;
iwe.u.qual.qual = i;
iwe.len = IW_EV_QUAL_LEN;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+ event = iwe_stream_add_event(info, event, end_buf, &iwe, IW_EV_QUAL_LEN);
+#else
event = iwe_stream_add_event(event, end_buf, &iwe, IW_EV_QUAL_LEN);
+#endif
/* add key info */
memset(&iwe, 0, sizeof(iwe));
@@ -1101,7 +1129,11 @@ static char *ndis_translate_scan(struct
iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
iwe.u.data.length = 0;
iwe.len = IW_EV_POINT_LEN;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+ event = iwe_stream_add_point(info, event, end_buf, &iwe, bssid->ssid.essid);
+#else
event = iwe_stream_add_point(event, end_buf, &iwe, bssid->ssid.essid);
+#endif
/* add rate */
memset(&iwe, 0, sizeof(iwe));
@@ -1115,7 +1147,11 @@ static char *ndis_translate_scan(struct
if (bssid->rates[i] & 0x7f) {
iwe.u.bitrate.value = ((bssid->rates[i] & 0x7f) *
500000);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+ current_val = iwe_stream_add_value(info, event, current_val,
+#else
current_val = iwe_stream_add_value(event, current_val,
+#endif
end_buf, &iwe,
IW_EV_PARAM_LEN);
}
@@ -1128,13 +1164,21 @@ static char *ndis_translate_scan(struct
iwe.cmd = IWEVCUSTOM;
sprintf(buf, "bcn_int=%d", bssid->config.beacon_period);
iwe.u.data.length = strlen(buf);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+ event = iwe_stream_add_point(info, event, end_buf, &iwe, buf);
+#else
event = iwe_stream_add_point(event, end_buf, &iwe, buf);
+#endif
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = IWEVCUSTOM;
sprintf(buf, "atim=%u", bssid->config.atim_window);
iwe.u.data.length = strlen(buf);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+ event = iwe_stream_add_point(info, event, end_buf, &iwe, buf);
+#else
event = iwe_stream_add_point(event, end_buf, &iwe, buf);
+#endif
TRACE2("%d, %u", bssid->length, (unsigned int)sizeof(*bssid));
if (bssid->length > sizeof(*bssid)) {
@@ -1155,7 +1199,11 @@ static char *ndis_translate_scan(struct
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = IWEVGENIE;
iwe.u.data.length = ielen;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+ event = iwe_stream_add_point(info, event, end_buf,
+#else
event = iwe_stream_add_point(event, end_buf,
+#endif
&iwe, iep);
}
iep += ielen;
@@ -1236,7 +1284,11 @@ static int iw_get_scan(struct net_device
TRACE2("%d", bssid_list->num_items);
cur_item = &bssid_list->bssid[0];
for (i = 0; i < bssid_list->num_items; i++) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+ event = ndis_translate_scan(info, dev, event,
+#else
event = ndis_translate_scan(dev, event,
+#endif
extra + IW_SCAN_MAX_DATA, cur_item);
cur_item = (struct ndis_wlan_bssid *)((char *)cur_item +
cur_item->length);