I would like to connect my linux board to an access point (i.e mobile phone) by using wpa_supplicant.
My mobile phone ap is configured with WPA (AES) security.
I modified the wpa_supplicant.conf as follow :
ctrl_interface=DIR=/var/run/wpa_supplicant
network={
ssid="HTC"
psk="mypasswd"
scan_ssid=1
proto=WPA2
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
priority=5
}
I set to up the mlan0 and launch wpa_supplicant as follow
root#root:~# wpa_supplicant -i mlan0 -c /etc/wpa_supplicant.conf
Successfully initialized wpa_supplicant
root#root:~# rfkill: Cannot open RFKILL control device
[ 2113.867283] IPv6: ADDRCONF(NETDEV_UP): mlan0: link is not ready
[ 2113.999385] wlan: mlan0 START SCAN
mlan0: CTRL-EVENT-SCAN-STARTED
[ 2116.924881] wlan: SCAN COMPLETED: scanned AP count=9
mlan0: Trying to associate with 84:7a:88:50:b0:a7 (SSID='HTC' freq=2437 MHz)
[ 2116.954134] ASSOC_RESP: Association Failed, status code = 17, error = 0x411, a_id = 0x0
[ 2116.962280] IOCTL failed: 9a8db800 id=0x20000, sub_id=0x20001 action=1, status_code=0x4110011
mlan0: CTRL-EVENT-ASSOC-REJECT status_code=1
[ 2117.073403] wlan: mlan0 START SCAN
mlan0: CTRL-EVENT-SCAN-STARTED
...
But connection is never established.
Just from looking at the wpa_supplicant output, it is clear that there are no problems with your interfaces mlan/wlan or your IP, as suggested by other responders.
Just to explain the output:
[ 2113.999385] wlan: mlan0 START SCAN
mlan0: CTRL-EVENT-SCAN-STARTED
[ 2116.924881] wlan: SCAN COMPLETED: scanned AP count=9
mlan0: Trying to associate with 84:7a:88:50:b0:a7 (SSID='HTC' freq=2437 MHz)
The above means that:
wpa_supplicant launched successfully.
wpa_supplicant started a wireless scan of nearby BSS's (Basic Service Set).
wpa_supplicant found 9 nearby BSS's, one of them is 'HTC'.
wpa_supplicant started an association sequence with 'HTC' on 2437 Mhz frequency i.e. channel 6.
So, what went wrong???
[ 2116.954134] ASSOC_RESP: Association Failed, status code = 17, error = 0x411, a_id = 0x0
You got error code 17 - Association denied because AP is unable to handle additional associated stations. Will happen if you run out of AIDs on the AP(Access Point).
One of the bellow is probably true:
Your AP is a Hotspot with limited number of stations or you are using an inferior AP that doesn't support enough stations.
You tried to connect to very busy Access Point
So, my solutions are:
Try to configure your AP to enable larger number of stations.
Try to connect to different network to see if the problem reproduces.
If your AP configurations are OK and it is not very busy (low number of associated stations), this might be indicative of a problem. You won't be able to connect any new station. I'd suggest AP reboot.
try to give static IP to your board on the same subnet as your phone having.
rfkill: Cannot open RFKILL control device
I got the same error message when
forgot to plug in the WiFi dongle
the interface specified in -i flag does not exist.
(And maybe it's not "mlan0", it's "wlan0"?)
In the second case, try to modify your command from
wpa_supplicant -i mlan0 -c /etc/wpa_supplicant.conf
to
wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf
Related
i'm using mariadb c-connector with prepare, bind and execute. it works usualy. but one case end up in "corrupted unsorted chunks" and core dumping when freeing bind buffer. i suggest the whole malloc organisation is messed up after calling mysql_stmt_execute(). my test's MysqlDynamic.c show:
the problem only is connected to x509cert variable bound by bnd[9]
freeing memory only fails if bnd[9].is_null = 0, if is_null execute end normally
freeing memory (using FreeStmt()) after bind and before execute end normally
print of bnd[9].buffer before execute show (void*) is connected to the correct string buffer
same behavior for setting bnd[9].buffer_length to STMT_INDICATOR_NTS or strlen()
other similar bindings (picture, bnd[10]) do not lead to corrupted memory and core dump.
i defined a c structure test for test data in my test program MysqlDynamic.c which is bound in MYSQL_BIND structure.
bindings for x509cert (string buffer) see bindInsTest():
bnd[9].buffer_type = MYSQL_TYPE_STRING;
bnd[9].buffer_length = STMT_INDICATOR_NTS;
bnd[9].is_null = ¶->x509certI;
bnd[9].buffer = (void*) para->x509cert;
please get the details out of source file MysqlDynamic.c. please adapt defines in the source to your environment, verify content, and run it. you will find compile info in source code. MysqlDynymic -c will create the table. MysqlDynamic -i will insert 3 records each run. And 'MysqlDynamic -d` drop the the table again.
MysqlDynamic -vc show:
session set autocommit to <0>
connection id: 175
mariadb server ver:<100408>, client ver:<100408>
connected on localhost to db test by testA
>> if program get stuck - table is locked
table t_test created
mysql connection closed
pgm ended normaly
MysqlDynamic -i show
ins2: BufPara <92> name<master> stamp<> epoch<1651313806000>
cert is cert<(nil)> buf<(nil)> null<1>
picure is pic<0x5596a0f0c220> buf<0x5596a0f0c220> null<0> length<172>
ins1: BufPara <91> name<> stamp<2020-04-30> epoch<1650707701123>
cert is cert<0x5596a0f181d0> buf<0x5596a0f181d0> null<0>
picure is pic<(nil)> buf<(nil)> null<1> length<0>
ins0: BufPara <90> name<gugus> stamp<1988-10-12T18:43:36> epoch<922337203685477580>
cert is cert<(nil)> buf<(nil)> null<1>
picure is pic<(nil)> buf<(nil)> null<1> length<0>
free(): corrupted unsorted chunks
Aborted (core dumped)
checking t_test table content show all records are inserted as expected.
you can disable loading of x509cert and/or picture by commenting out the defines line 57/58. the program than end normally. you also can comment out line 208. the buffers are then indicated as NULL.
Questions:
is there a generic coding mistake in the program causing this behavior?
can you run the program in your environment without core dumping? i'm currently using version 10.04.08.
any improvment in code will be welcome.
I am still new in Octave with some experience in Python and I was requested to do a test in a stimulus application in order to find if there are errors in the code (not developed by me) and try to fix them and run the application. The issue in the code is at the time to open the screen as follows the implementation (these ones where I commented (%) are what already did before, and these ones below the comments are my correction) the code is large with 825 lines:
%% Get subject name from the user
prompt = {'Enter Subject Number:','Enter Subject Name:','Enter Todays Date:','Left or Right:'};
dlgtitle = 'Information Input';
%dims = [1 50];
dims = [1 50;1 50;1 50;1 50];
opts = 'on';
answer = inputdlg(prompt,dlgtitle,dims);
%waitfor(answer);
waitfor(dims);
%% TO Excel
% Get the name of the file that the user wants to save.
%startingFolder = userpath;
startingFolder = 'C:\Users\Vtr\Downloads\Final-task-981203\Final-task-981203\Task-981203';
defaultFileName = fullfile(startingFolder, '*.xlsx');
[baseFileName, folder] = uiputfile(defaultFileName, 'Specify a filename ');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
% Combine the folder and base file name into the full file name.
fullFileName = fullfile(folder, baseFileName);
%% LOAD text initial setting
%% Create 1st screen : (Loading and Wait)text screen
% Open an on screen window - purple screen
[window, windowRect] = PsychImaging('OpenWindow', screenNumber, [0.5 0.5 1]);
% Set up alpha-blending for smooth (anti-aliased) lines
Screen('BlendFunction', window, 'GL_SRC_ALPHA', 'GL_ONE_MINUS_SRC_ALPHA');
After that, in the first part is created a form to insert subject nº, subject name, today's date and left or right, and after that to specify a filename. Made these two parts it appears a purple screen with the mouse's cursor rotating non-stop and if I try to click with the mouse an error alert box "octave-gui.exe has stopped working" appears on. I already tried to run this code on my Virtualbox-VM (Ubuntu 16.04 LTS), firstly, it notifies that my screen is being tested and calibrated and after, it appears another error screen on the terminal:
PTB-INFO: OS support status: Linux 4.15.0-55-generic Supported.
PTB-INFO: Type 'PsychtoolboxVersion' for more detailed version information.
PTB-INFO: Most parts of the Psychtoolbox distribution are licensed to you under terms of the MIT License, with
PTB-INFO: some restrictions. See file 'License.txt' in the Psychtoolbox root folder for the exact licensing conditions.
PTB-WARNING: FAILED to enable synchronization to vertical retrace!
PTB-WARNING: FAILED to enable synchronization to vertical retrace (System ignored setting [Req 1 != Actual 0])!
PTB-INFO: Failed to enable realtime-scheduling [Operation not permitted]!
PTB-INFO: You need to run Matlab or Octave with root-privileges, or run the script PsychLinuxConfiguration once for this to work.
PTB-INFO: See /usr/share/doc/psychtoolbox-3-common/README.Debian to make this work.
PTB-WARNING: Couldn't even collect one single valid flip interval sample! Sanity range checks failed!
PTB-WARNING: Could be a system bug or a temporary timing problem. Retrying the procedure might help if
PTB-WARNING: the latter is the culprit.
WARNING: VBL Calibration run No. 1 failed. Retrying...
PTB-INFO: Failed to enable realtime-scheduling [Operation not permitted]!
PTB-INFO: You need to run Matlab or Octave with root-privileges, or run the script PsychLinuxConfiguration once for this to work.
PTB-INFO: See /usr/share/doc/psychtoolbox-3-common/README.Debian to make this work.
PTB-WARNING: Couldn't even collect one single valid flip interval sample! Sanity range checks failed!
PTB-WARNING: Could be a system bug or a temporary timing problem. Retrying the procedure might help if
PTB-WARNING: the latter is the culprit.
WARNING: VBL Calibration run No. 2 failed. Retrying...
WARNING: Will enable VBL busy wait-workaround before trying final VBL Calibration run No. 3.
WARNING: This will hopefully work-around graphics driver bugs of the GPU sync-to-retrace mechanism. Cross your fingers!
PTB-INFO: Failed to enable realtime-scheduling [Operation not permitted]!
PTB-INFO: You need to run Matlab or Octave with root-privileges, or run the script PsychLinuxConfiguration once for this to work.
PTB-INFO: See /usr/share/doc/psychtoolbox-3-common/README.Debian to make this work.
PTB-WARNING: Couldn't even collect one single valid flip interval sample! Sanity range checks failed!
PTB-WARNING: Could be a system bug or a temporary timing problem. Retrying the procedure might help if
PTB-WARNING: the latter is the culprit.
PTB-INFO: OpenGL-Renderer is VMware, Inc. :: SVGA3D; build: RELEASE; LLVM; :: 2.1 Mesa 18.0.5
PTB-INFO: VBL startline = 664 , VBL Endline = -1
PTB-INFO: Beamposition queries unsupported or defective on this system. Using basic timestamping as fallback.
PTB-INFO: Timestamps returned by Screen('Flip') will be therefore less robust and accurate.
PTB-INFO: Measured monitor refresh interval from VBLsync = 0.000000 ms [inf Hz]. (0 valid samples taken, stddev=10000000.000000 ms.)
PTB-INFO: Reported monitor refresh interval from operating system = 16.667222 ms [59.998001 Hz].
PTB-INFO: Small deviations between reported values are normal and no reason to worry.
WARNING: Couldn't compute a reliable estimate of monitor refresh interval! The trouble with VBL syncing?!?
WARNING: Mismatch between measured monitor refresh interval and interval reported by the operating system.
This indicates massive problems with VBL sync.
----- ! PTB - ERROR: SYNCHRONIZATION FAILURE ! -----
One or more internal checks (see Warnings above) indicate that synchronization
of Psychtoolbox to the vertical retrace (VBL) is not working on your setup.
This will seriously impair proper stimulus presentation and stimulus presentation timing!
Please read 'help SyncTrouble' for information about how to solve or work-around the problem.
You can force Psychtoolbox to continue, despite the severe problems, by adding the command
Screen('Preference', 'SkipSyncTests', 1); at the top of your script, if you really know what you are doing.
error: Screen: See error message printed above.
error: Called from
PsychImaging at line 2240 column 26
Naderi_test_task_v_main_1203_v_2 at line 110 column 20
I would like to know if the issue is in my computer configurations that don't support Psychtoolbox resources or any configuration that I need to change.
I expected QEmu’s -nodefaults to prevent the creation of default devices, but either I don’t use it correctly or it does not work as I expected.
I get this message, using the stripped down command line below, with QEmu 3.0.
The message:
qemu-system-i386: warning: multiple floppy disk controllers
with iobase=0x3f0 have been found
the one being picked for CMOS setup might not reflect your intent
Additional message in the VM’s terminal:
could not read the boot disk
The command line:
qemu-system-i386 \
-machine type=isapc,usb=no \
-nodefaults \
-device isa-vga \
-blockdev driver=file,node-name=fda-img,filename=fda.img \
-blockdev driver=raw,node-name=fda,file=fda-img \
-device isa-fdc,driveA=fda,fdtypeA=144,fdtypeB=none,bootindexA=0
I tried removing -machine type=isapc, but it changed nothing.
This is so, although the documentation says this:
-nodefaults
Don’t create default devices. Normally, QEMU sets the default devices
like serial port, parallel port, virtual console, monitor device, VGA
adapter, floppy and CD-ROM drive and others. The -nodefaults option will
disable all those default devices.
I tried to add a --verbose option to the command line, with the hope it will request a dump of the full configuration QEmu creates, but such an option unfortunately does not exist.
My naive feeling is that it’s broken, but I must also consider I may be missing something … (hence this naive question).
— Update for more details —
Although there is no way to dump the created machine from the commande line, I found there is a info qtree in the monitor, which dumps the devices tree. Below, what it says:
[…]
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)
dma = 2 (0x2)
driveA = ""
driveB = ""
check_media_rate = true
fdtypeA = "144"
fdtypeB = "none"
fallback = "288"
isa irq 6
bus: floppy-bus.1
type floppy-bus
dev: floppy, id ""
unit = 0 (0x0)
drive = "fda"
logical_block_size = 512 (0x200)
physical_block_size = 512 (0x200)
min_io_size = 0 (0x0)
opt_io_size = 0 (0x0)
discard_granularity = 4294967295 (0xffffffff)
write-cache = "auto"
share-rw = false
drive-type = "144"
[…]
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)
dma = 2 (0x2)
driveA = ""
driveB = ""
check_media_rate = true
fdtypeA = "auto"
fdtypeB = "auto"
fallback = "288"
isa irq 6
bus: floppy-bus.0
type floppy-bus
[…]
It creates two floppy controllers, ignoring -nodefaults. Am I still missing something?
Also, surprisingly, for the first controller, which is the one I create, driveA and driveB are empty strings while driveA is assigned in the command line.
I finally believe the documentation is unclear and that’s rather -machine none which does not create any device. However, doing so, there is no way to add a bus which would be required to attach any device. I guess in this particular case, the isapc cannot be created without some device and it must be used as‑is, as a starting point. Then, the backends are to be attached without creating the frontends (if the wording is correct).
Here is an example command line snippet:
[…]
-blockdev driver=file,node-name=fda-img,filename=dos-6-22/Dos622-1.img \
-blockdev driver=raw,node-name=fda,file=fda-img \
-global isa-fdc.driveA=fda \
[…]
Note the -global isa-fdc.driveA=fda, which the important part in this snippet ; this is how the backend is attached to the forcefully created frontend.
Update:
Devices created by -machine <model> seems to be a special case not taken into account by -nodefaults ; this is what the actual documentation forget to mention.
Update 2:
Submitted as a documentation bug, here: https://bugs.launchpad.net/qemu/+bug/1799768
In my local envoriment I can find load all my fixtures.
But on my staging server, one of the fixtures just ends with "Killed"
I grep'ed through my whole project for the word "Killed" but did not find it anywhere.
php bin/console doctrine:fixures:load --fixtures src/ReviewBundle/DataFixtures/ORM/LoadRatingTypes.php -vvv
Careful, database will be purged. Do you want to continue y/N ?y
> purging database
> loading ReviewBundle\DataFixtures\ORM\LoadRatingTypes
Killed
I tail my dev.log file and all I got was
[2016-03-17 15:26:54] doctrine.DEBUG: "START TRANSACTION" [] []
[2016-03-17 15:26:54] doctrine.DEBUG: DELETE FROM cms_block [] []
[2016-03-17 15:26:54] doctrine.DEBUG: DELETE FROM cms_page [] []
[2016-03-17 15:26:54] doctrine.DEBUG: DELETE FROM rating_type [] []
My php log is empty
My mysql.log and mysql.err log is empty.
I have no idea where I should look
"Killed" often happens when PHP runs out of memory, and shuts down your fixture process. This happens mainly when your PHP script tries to load too many entities. Are you trying to load a massive number of fixtures?
There are workarounds to avoid memory overflows in your fixtures scripts. I answered a pretty similar question some weeks ago, you should have a look at it.
If you still have problems after implementing these modifications, you could also increase PHP memory limit.
We're using CentOS and would like to ban several Asian countries from accessing the entire server. Almost every IP we check which has tried to hack into our server is allocated to an Asian country (Russia, China, Pakistan, etc.)
We have an IP to country MySQL database we can efficiently query and would like to try something like:
-A INPUT -p tcp -m tcp --dport 80 -j /path/to/perlscript.pl
The script would need the IP passed in as an argument, then it would return either an ACCEPT or DROP target?
Thanks for the answers, here's my follow up.
Do you know if it is possible though? Having a rule point to a script which returns a target? (ACCPET/DROP)
Not entirely sure how ipset works, will have to experiment I guess, but it looks like it creates a single rule. How would it handle Russia for example, which has over 6000 ranges assigned to it? And we want to add probably 20 - 40 countries in total, so we could end up needing to add in excess of 100,000 ranges. Wouldn't the overhead of a single MySQL query be less taxing?
SELECT country FROM ip_countries WHERE $VAR{ip} >= range1 && $VAR{ip} <= range2
The database we use is freely available here : http://software77.net/geo-ip/
It represents IPs in the database by converting the IP to a number using this formula :
$VAR{numberedIP} = $octs[3] + ($octs[2] * 256) + ($octs[1] * 256 * 256) + ($octs[0] * 256 * 256 * 256);
It will store the start of the range in the "range1" column, and the end of the range in the "range2" column.
So you can see how we'd look up an IP using the above query. Literally takes less than a hundredth of a second to get a result and it's quite accurate. We have one website on a dedicated server, quite low traffic. But as with all servers I have ever checked, this one is hit daily by hackers' robots, checking email accounts, FTP accounts etc. And just about every web server I've ever worked on is compromised sooner or later. In our case, 99.99% of traffic from Asian countries has criminal intent attached to it.
We'd like this to run via iptables so that all ports are covered, not just HTTP for example by using directives in say .htaccess.
Do you think ipset would still be faster and more efficient?
It would be far too slow to launch perl for every matching packet. The right tool for this sort of thing is ipset, and there is much more information and documentation available on the ipset man page.
In CentOS you can install it with yum. Naturally, all of these commands and the script need to run as root:
# yum install ipset
Next install the kernel modules (you'll want this to happen at boot as well):
# modprobe -v ipset ip_set_hash_netport
And then use a script like the following to populate an ipset and block IP's from its ranges using iptables:
#!/usr/bin/env perl
use strict;
use warnings;
use DBI;
my $dbh = DBI->connect('... your DSN ...',...);
# I have no knowledge of your schema, but if you can pull the
# address range in the form: AA.BB.CC.DD/NN
my $ranges = $dbh->selectcol_arrayref(
q{SELECT cidr FROM your_table WHERE country_code IN ('CN',...)});
`ipset create geoblock hash:netport`;
for (#$ranges) {
# to match on port 80:
`ipset add geoblock $_,80`;
}
`iptables -I INPUT -m set --set geoblock src -j DROP`;
If you would like to block all ports rather than just 80, use the ip_set_hash_net module instead of ip_set_hash_netport, change hash:netport to hash:net, and remove ,80 from the ipset command.