Sophie

Sophie

distrib > Mageia > 3 > x86_64 > media > core-release-src > by-pkgid > c563ce17ec3049f20e3d5200eeecb4a5 > files > 2

aircrack-ng-1.1-5.mga3.src.rpm

diff -Naur --exclude '*~' --exclude '*.orig' --exclude '*.rej' aircrack-ng-1.1/src/aireplay-ng.c aircrack-ng-1.1-ignore-channel-1-error/src/aireplay-ng.c
--- aircrack-ng-1.1/src/aireplay-ng.c	2010-04-02 06:33:28.000000000 +0200
+++ aircrack-ng-1.1-ignore-channel-1-error/src/aireplay-ng.c	2011-12-30 16:37:07.636926177 +0100
@@ -200,7 +200,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"
@@ -268,6 +270,7 @@
     int bittest;
 
     int nodetect;
+    int ignore_negative_one;
     int rtc;
 }
 opt;
@@ -715,6 +718,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);
@@ -723,7 +733,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;
@@ -5765,6 +5775,7 @@
             {"help",        0, 0, 'H'},
             {"fast",        0, 0, 'F'},
             {"bittest",     0, 0, 'B'},
+            {"ignore-negative-one", 0, &opt.ignore_negative_one, 1},
             {0,             0, 0,  0 }
         };