summaryrefslogtreecommitdiff
path: root/net-wireless/aircrack-ng/files/ignore-channel-1-error.patch
blob: 6189af13fa302aabc468c042fa9f186e5013bb18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Adapted for version 1.1 by Zero_Chaos based on original

From: Paul Fertser <fercerpav@gmail.com>
Date: Wed, 12 Jan 2011 00:27:07 +0300
Subject: [PATCH] aireplay-ng: add an option to ignore channel -1 error

Allow the user to ignore the channel match check when the host kernel is
not providing channel for the used interface. Required with unpatched
cfg80211 kernels.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>

diff -Naur aircrack-ng-1.1-orig/src/aireplay-ng.c aircrack-ng-1.1/src/aireplay-ng.c
--- aircrack-ng-1.1-orig/src/aireplay-ng.c	2011-01-11 19:45:09.000000000 -0500
+++ aircrack-ng-1.1/src/aireplay-ng.c	2011-01-11 19:44:34.000000000 -0500
@@ -205,7 +205,9 @@
 "\n"
 "  Miscellaneous options:\n"
 "\n"
-"      -R        : disable /dev/rtc usage\n"
+"      -R                     : disable /dev/rtc usage\n"
+"      --ignore-negative-one  : if the interface's channel can't be determined,\n"
+"                               ignore the mismatch, needed for unpatched cfg80211\n"
 "\n"
 "  Attack modes (numbers can still be used):\n"
 "\n"
@@ -274,6 +276,7 @@
     int bittest;
 
     int nodetect;
+    int ignore_negative_one;
     int rtc;
 
     int reassoc;
@@ -723,6 +726,13 @@
 
     iface_chan = wi_get_channel(wi);
 
+    if(iface_chan == -1 && !opt.ignore_negative_one)
+    {
+        PCT; printf("Couldn't determine current channel for %s, you should either force the operation with --ignore-negative-one or apply a kernel patch\n",
+                wi_get_ifname(wi));
+        return -1;
+    }
+
     if(bssid != NULL)
     {
         ap_chan = wait_for_beacon(bssid, capa, essid);
@@ -731,7 +741,7 @@
             PCT; printf("No such BSSID available.\n");
             return -1;
         }
-        if(ap_chan != iface_chan)
+        if((ap_chan != iface_chan) && (iface_chan != -1 || !opt.ignore_negative_one))
         {
             PCT; printf("%s is on channel %d, but the AP uses channel %d\n", wi_get_ifname(wi), iface_chan, ap_chan);
             return -1;
@@ -6318,6 +6328,7 @@
             {"fast",        0, 0, 'F'},
             {"bittest",     0, 0, 'B'},
             {"migmode",     0, 0, 'W'},
+            {"ignore-negative-one", 0, &opt.ignore_negative_one, 1},
             {0,             0, 0,  0 }
         };