Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nl80211 support (initialization and linux_set_channel) #1004

Closed
aircrack-ng opened this issue Mar 10, 2018 · 22 comments

Comments

Projects
None yet
1 participant
@aircrack-ng
Copy link
Owner

commented Mar 10, 2018

Reported by impulse32 on 23 Apr 2012 23:36 UTC

Initializes netlinks and uses it to set the channel in linux. Depends on libnl. Compile with "make libnl=true".

@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Attachment by impulse32 on 7 May 2012 23:08 UTC

Uploaded file nl80211_linux_set_channel.diff

@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Modified by impulse32 on 23 Apr 2012 23:36 UTC

@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Comment by clopez on 23 Apr 2012 23:36 UTC

I didn't have tested this patch personally, but looks like a must-have improvement for v1.2

Currently the code uses ioctls to do this stuff and this way of doing things is completely deprecated. See the kernel page about this:

The way to go with the Linux kernel is to rely on libnl instead of doing ioctls. So I think we must have this patch applied on v1.2 because the kernel maintainers can completely drop the support for wext in the following years and giving the release rate of aircrack-ng perhaps 1.3 is too far to add this fix.

Just my 2 cents.

Regards!

@aircrack-ng aircrack-ng added this to the 1.2 milestone Mar 10, 2018

@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Comment by misterx on 23 Apr 2012 23:36 UTC

It doesn't seem to compile correctly on Debian Squeeze (libnl 2.0 detected):

...
make[Entering directory `/home/misterx/aircrack-ng-svn/src/osdep'
gcc   -D_FILE_OFFSET_BITS=64 -D_REVISION=2200  -DCONFIG_LIBNL -fPIC -I..    -c -o osdep.o osdep.c
gcc   -D_FILE_OFFSET_BITS=64 -D_REVISION=2200  -DCONFIG_LIBNL -fPIC -I..    -c -o network.o network.c
gcc   -D_FILE_OFFSET_BITS=64 -D_REVISION=2200  -DCONFIG_LIBNL -fPIC -I..    -c -o file.o file.c
gcc   -D_FILE_OFFSET_BITS=64 -D_REVISION=2200  -DCONFIG_LIBNL -fPIC -I..    -c -o linux.o linux.c
linux.c:286: error: conflicting types for nl_socket_alloc
/usr/include/netlink/socket.h:22: note: previous declaration of nl_socket_alloc was here
linux.c: In function nl_socket_alloc:
linux.c:288: warning: return makes pointer from integer without a cast
linux.c: At top level:
linux.c:291: error: conflicting types for nl_socket_free
/usr/include/netlink/socket.h:24: note: previous declaration of nl_socket_free was here
linux.c: In function __genl_ctrl_alloc_cache:
linux.c:298: warning: passing argument 1 of genl_ctrl_alloc_cache from incompatible pointer type
/usr/include/netlink/genl/ctrl.h:25: note: expected struct nl_sock * but argument is of type struct nl_handle *
linux.c:298: error: too few arguments to function genl_ctrl_alloc_cache
linux.c: In function linux_nl80211_init:
linux.c:317: warning: passing argument 1 of genl_connect from incompatible pointer type
/usr/include/netlink/genl/genl.h:23: note: expected struct nl_sock * but argument is of type struct nl_handle *
linux.c: In function linux_set_channel_nl80211:
linux.c:1023: warning: passing argument 1 of nl_send_auto_complete from incompatible pointer type
/usr/include/netlink/netlink.h:53: note: expected struct nl_sock * but argument is of type struct nl_handle *
make[3](3]:): *** [Error 1
make[3](linux.o]): Leaving directory `/home/misterx/aircrack-ng-svn/src/osdep'
make[*** [all](2]:) Error 2
make[Leaving directory `/home/misterx/aircrack-ng-svn/src/osdep'
make[1](2]:): *** [Error 2
make[1](osdep/libosdep.a]): Leaving directory `/home/misterx/aircrack-ng-svn/src'
make: *** [all] Error 2
@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Comment by misterx on 23 Apr 2012 23:36 UTC

libnl 3.0 doesn't seem to work either.

@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Comment by misterx on 23 Apr 2012 23:36 UTC

Using libnl 3:

...
make[Entering directory `/usr/src/aircrack-ng/src/osdep'
gcc -I/usr/include/libnl3   -D_FILE_OFFSET_BITS=64 -D_REVISION=2200  -DCONFIG_LIBNL -DCONFIG_LIBNL -Wno-unused-but-set-variable -Wno-array-bounds -fPIC -I..    -c -o osdep.o osdep.c
gcc -I/usr/include/libnl3   -D_FILE_OFFSET_BITS=64 -D_REVISION=2200  -DCONFIG_LIBNL -DCONFIG_LIBNL -Wno-unused-but-set-variable -Wno-array-bounds -fPIC -I..    -c -o network.o network.c
gcc -I/usr/include/libnl3   -D_FILE_OFFSET_BITS=64 -D_REVISION=2200  -DCONFIG_LIBNL -DCONFIG_LIBNL -Wno-unused-but-set-variable -Wno-array-bounds -fPIC -I..    -c -o file.o file.c
gcc -I/usr/include/libnl3   -D_FILE_OFFSET_BITS=64 -D_REVISION=2200  -DCONFIG_LIBNL -DCONFIG_LIBNL -Wno-unused-but-set-variable -Wno-array-bounds -fPIC -I..    -c -o linux.o linux.c
linux.c:286:33: error: conflicting types for nl_socket_alloc
/usr/include/libnl3/netlink/socket.h:22:25: note: previous declaration of nl_socket_alloc was here
linux.c: In function nl_socket_alloc:
linux.c:288:5: warning: return makes pointer from integer without a cast
linux.c: At top level:
linux.c:291:20: error: conflicting types for nl_socket_free
/usr/include/libnl3/netlink/socket.h:24:14: note: previous declaration of nl_socket_free was here
linux.c: In function __genl_ctrl_alloc_cache:
linux.c:298:12: warning: passing argument 1 of genl_ctrl_alloc_cache from incompatible pointer type
/usr/include/libnl3/netlink/genl/ctrl.h:25:14: note: expected struct nl_sock * but argument is of type struct nl_handle *
linux.c:298:12: error: too few arguments to function genl_ctrl_alloc_cache
/usr/include/libnl3/netlink/genl/ctrl.h:25:14: note: declared here
linux.c: In function linux_nl80211_init:
linux.c:317:5: warning: passing argument 1 of genl_connect from incompatible pointer type
/usr/include/libnl3/netlink/genl/genl.h:23:13: note: expected struct nl_sock * but argument is of type struct nl_handle *
linux.c: In function linux_set_channel_nl80211:
linux.c:1023:5: warning: passing argument 1 of nl_send_auto_complete from incompatible pointer type
/usr/include/libnl3/netlink/netlink.h:62:14: note: expected struct nl_sock * but argument is of type struct nl_handle *
At top level:
cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"
make[3](3]:): *** [Error 1
make[3](linux.o]): Leaving directory `/usr/src/aircrack-ng/src/osdep'
make[*** [all](2]:) Error 2
make[Leaving directory `/usr/src/aircrack-ng/src/osdep'
make[1](2]:): *** [Error 2
make[1](osdep/libosdep.a]): Leaving directory `/usr/src/aircrack-ng/src'
make: *** [all] Error 2
@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Comment by clopez on 23 Apr 2012 23:36 UTC

We shouldn't ship this without supporting at least libnl-3

Hi,

aircrack-ng has a Build-Depends on libnl-dev.
libnl1 has been superseded by libnl3 [1], so I'd like to proceed with
the removal of libnl1.

It seems aircrack-ng does not actually require libnl-dev for a
successful build and an this build dependency can be simply dropped.

Cheers,
Michael

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=688158

@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Comment by impulse32 on 23 Apr 2012 23:36 UTC

I added a new patch that works with libnl 1 and 3.

@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Attachment by impulse32 on 24 Sep 2012 15:10 UTC

Uploaded file nl80211_linux_set_channel-libnl3.diff

libnl3 support. Might work with libnl1

@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Attachment by misterx on 6 Oct 2012 23:11 UTC

Uploaded file nl80211_linux_set_channel-libnl3_v2.diff

libnl3 support. Compiles with libnl1. Also prevent using libnl flag on cygwin.

@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Attachment by misterx on 6 Oct 2012 23:20 UTC

Uploaded file nl80211_linux_set_channel-libnl3_v3.diff

Same as v2 but removed the change to Makefile (line deletion).

@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Comment by misterx on 23 Apr 2012 23:36 UTC

Committed a slightly modified version of the latest patch (Added info in INSTALLING file): 268ff0c

@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Comment by Jano on 23 Apr 2012 23:36 UTC

Compiling with the option libnl=true give me these results.

== Tested on Ubuntu 10.04 ==

jano:~$ dpkg -l | grep libnl
ii  libnl-dev                                                1.1-5build1                                       development library and headers for libnl
ii  libnl1                                                   1.1-5build1
                                   library for dealing with netlink sockets

== Tested on Ubuntu 12.04 ==

jano:~/aircrack-ng$ dpkg -l | grep libnl
ii  libnl-3-200                            3.2.3-2ubuntu2                          library for dealing with netlink sockets
ii  libnl-dev                              1.1-7                                   development library and headers for libnl
ii  libnl-genl-3-200                       3.2.3-2ubuntu2                          library for dealing with netlink sockets - generic netlink
ii  libnl-route-3-200                      3.2.3-2ubuntu2                          library for dealing with netlink sockets - route interface
ii  libnl1                                 1.1-7                                   library for dealing with netlink sockets
jano:~/aircrack-ng$
  • For details see the attached files.

Bye Jano

@aircrack-ng aircrack-ng reopened this Mar 10, 2018

@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Attachment by Jano on 13 Oct 2012 11:57 UTC

Uploaded file nl80211_support_errors_ubuntu-lucid.txt

nl80211 support errors on Ubuntu Lucid

@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Attachment by Jano on 13 Oct 2012 11:58 UTC

Uploaded file nl80211_support_errors_ubuntu-precise.txt

nl80211 support errors on Ubuntu Precise

@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Comment by misterx on 23 Apr 2012 23:36 UTC

Ubuntu lucid just gives an error when printing info on the screen and it's probably something set in the user preferences or an alias and it doesn't prevent compiling, so that's ok.

For Ubuntu Precise, 12.04, the solution is to install libnl-3-dev. What's weird is that it compiles fine on Debian with libnl1 but fails on Ubuntu.
I'll add a check for Ubuntu 12.04 and tell the user to install libnl-3-dev but that's a pretty ugly hack.

@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Comment by misterx on 23 Apr 2012 23:36 UTC

It also happens on Ubuntu Quantal (12.10). I'll check libnl docs to see if I can fix that (for ppl who insist on staying on v1).

@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Comment by Zero Chaos on 23 Apr 2012 23:36 UTC

fixed in 9f8ba40

@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Comment by Jano on 23 Apr 2012 23:36 UTC

  • New advertisement/warning present on latest version with only libnl-3.
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=2259  -I/usr/local/include -DHAVE_SQLITE -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3   -Wno-unused-but-set-variable -Wno-array-bounds -fPIC -I..    -c -o linux.o linux.c
linux.c: In function error_handler:
linux.c:360:46: warning: unused parameter nla [In function test_callback:
linux.c:369:42: warning: unused parameter msg [-Wunused-parameter](-Wunused-parameter]
linux.c:)
linux.c:369:53: warning: unused parameter arg [In function linux_set_channel_nl80211:
linux.c:1005:5: warning: implicit declaration of function if_nametoindex [-Wimplicit-function-declaration](-Wunused-parameter]
linux.c:)
linux.c:1006:5: warning: implicit declaration of function ieee80211_channel_to_frequency [warning: unused variable wrq [-Wunused-variable](-Wimplicit-function-declaration]
linux.c:930:18:)
linux.c: At top level:
linux.c:360:12: warning: error_handler defined but not used [warning: test_callback defined but not used [-Wunused-function](-Wunused-function]
linux.c:369:13:)
linux.c:1042:12: warning: linux_set_channel defined but not used [warning: linux_close defined but not used [-Wunused-function](-Wunused-function]
linux.c:2048:13:)
linux.c: In function do_linux_open:
linux.c:186:14: warning: iwpriv may be used uninitialized in this function [-Wuninitialized]
linux.c:1606:11: note: iwpriv was declared here
jano:~$ lsb_release -ds && echo $DESKTOP_SESSION && uname -m
Ubuntu 12.04.2 LTS

x86_64
jano:~$ aircrack-ng --hel | head -n 5
  Aircrack-ng 1.1 aircrack-ng/aircrack-ng@7a9e87c99a5113d651c94b4aade890420fcc4e9c - (C) 2006-2010 Thomas d'Otreppe

For complete details, see attachment.

Jano

@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Attachment by Jano on 15 Mar 2013 19:55 UTC

Uploaded file nl80211_support_errors_ubuntu-precise-2.txt

nl80211 support errors on Ubuntu Precise with only libnl-3

@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Modified by Jano on 23 Apr 2012 23:36 UTC

@aircrack-ng aircrack-ng reopened this Mar 10, 2018

@aircrack-ng

This comment has been minimized.

Copy link
Owner Author

commented Mar 10, 2018

Modified by misterx on 23 Apr 2012 23:36 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.