GithubHelp home page GithubHelp logo

br101 / libuwifi Goto Github PK

View Code? Open in Web Editor NEW
60.0 60.0 19.0 273 KB

Userspace Wifi Library

License: GNU Lesser General Public License v3.0

Makefile 1.70% C 94.86% Objective-C 3.30% CMake 0.14%
analyzer esp32 esp8266 library linux monitoring rssi wifi

libuwifi's People

Contributors

aaaaalbert avatar br101 avatar dlenski avatar sarumpaet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libuwifi's Issues

Add to openwrt packages feed?

I want to use this awesome lib in my own project. Recently, this library is not in https://git.openwrt.org/feed/packages.git.
I would add libuwifi into the official openwrt packages feed if u want?

Userspace wifi frame crafting

Hi, ESP8266 can send (almost) arbitrary packets. I am trying to implement EAP on an ESP8266, and I am looking for a library that makes it easy to craft 802.11 packets. I noticed there is no support for making packets (I think). Is making 802.11 packets in scope of this project?

OpenWrt: libubox has some struct definition of list_head

libubox defines list_head and list.h that is included in ccan which is included in libuwifi.
Currently I'm doing something like this:

 // redefine list_head because in libubox
 #define list_head horst_list_head
 #include <uwifi/node.h>
 #undef list_head

libubox is some very famous library for standard functions and list stuff in OpenWrt.

7031a29 fails to build on OS X 10.11.6

7031a29 kind of expectedly causes a few build errors on OS X, particularly multiple errors like these:

./linux/platform.h:11:2: error: "platform is not Linux"
./linux/platform.h:15:10: fatal error: 'endian.h' file not found

Assuming that the #errors about the platform not being Linux are only informative (which is likely a bad idea), we could just remove them (also a bad idea). endian.h on the other hand lives in a different directory on OS X, still easy to fix. This leaves us with

--- a/linux/platform.h
+++ b/linux/platform.h
@@ -7,12 +7,13 @@
  * Version 3. See the file COPYING for more details.
  */

-#ifndef __linux__
-#error "platform is not Linux"
-#endif
-
 #include <stdint.h>
+
+#ifndef __MACH__
 #include <endian.h>
+#else
+#include <machine/endian.h>
+#endif

 // directly included:
 //#include <stdbool.h> // bool

and

--- a/linux/inject_rtap.c
+++ b/linux/inject_rtap.c
@@ -1,5 +1,11 @@
 #include <stdint.h>
+
+#ifndef __MACH__
 #include <endian.h>
+#else
+#include <machine/endian.h>
+#endif
+
 #include <radiotap.h>

 #include "inject.h"

radiotap (while submodule'd in) also needs this patch:

--- a/platform.h
+++ b/platform.h
@@ -3,7 +3,12 @@
 #ifndef _BSD_SOURCE
 #define _BSD_SOURCE
 #endif
+
+#ifndef __MACH__
 #include <endian.h>
+#else
+#include <machine/endian.h>
+#endif

 #define le16_to_cpu            le16toh
 #define le32_to_cpu            le32toh

Starting from here, things get more interesting, and probably indicate that cross-platform and platform-specific things should be broken out, and dependencies pointed out in the build instructions. Dump:

$ make
gcc -MM -I. -I./core -I./util -I./linux -I./radiotap core/channel.c core/inject.c core/node.c core/wlan_parser.c core/wlan_util.c util/average.c util/util.c linux/inject_rtap.c linux/interface.c linux/netdev.c linux/netl80211.c linux/packet_sock.c linux/platform.c linux/raw_parser.c linux/wpa_ctrl.c radiotap/radiotap.c linux/ifctrl-nl80211.c >.objdeps.mk
linux/netl80211.c:20:10: fatal error: 'netlink/attr.h' file not found
#include <netlink/attr.h>
         ^
1 error generated.
linux/packet_sock.c:16:10: fatal error: 'netpacket/packet.h' file not found
#include <netpacket/packet.h>
         ^
1 error generated.
linux/ifctrl-nl80211.c:19:10: fatal error: 'netlink/attr.h' file not found
#include <netlink/attr.h>
         ^
1 error generated.
Package libnl-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libnl-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libnl-3.0' found
Package libnl-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libnl-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libnl-3.0' found
echo '-std=gnu99 -Wall -Wextra -I. -I./core -I./util -I./linux -I./radiotap -DDEBUG=0 -fPIC ' | cmp -s - .buildflags || echo '-std=gnu99 -Wall -Wextra -I. -I./core -I./util -I./linux -I./radiotap -DDEBUG=0 -fPIC ' > .buildflags
Package libnl-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libnl-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libnl-3.0' found
cc -std=gnu99 -Wall -Wextra -I. -I./core -I./util -I./linux -I./radiotap -DDEBUG=0 -fPIC    -c -o core/channel.o core/channel.c
Package libnl-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libnl-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libnl-3.0' found
cc -std=gnu99 -Wall -Wextra -I. -I./core -I./util -I./linux -I./radiotap -DDEBUG=0 -fPIC    -c -o core/inject.o core/inject.c
core/inject.c:26:15: warning: implicit declaration of function 'htole16' is
      invalid in C99 [-Wimplicit-function-declaration]
        header->fc = htole16(probe_response ? WLAN_FRAME_PROBE_RESP : WL...
                     ^
core/inject.c:37:13: warning: implicit declaration of function 'htole64' is
      invalid in C99 [-Wimplicit-function-declaration]
        bcn->tsf = htole64(tsf);
                   ^
2 warnings generated.
Package libnl-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libnl-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libnl-3.0' found
cc -std=gnu99 -Wall -Wextra -I. -I./core -I./util -I./linux -I./radiotap -DDEBUG=0 -fPIC    -c -o core/node.o core/node.c
Package libnl-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libnl-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libnl-3.0' found
cc -std=gnu99 -Wall -Wextra -I. -I./core -I./util -I./linux -I./radiotap -DDEBUG=0 -fPIC    -c -o core/wlan_parser.o core/wlan_parser.c
core/wlan_parser.c:115:7: warning: implicit declaration of function 'le16toh' is
      invalid in C99 [-Wimplicit-function-declaration]
        fc = le16toh(wh->fc);
             ^
core/wlan_parser.c:269:18: warning: implicit declaration of function 'le64toh'
      is invalid in C99 [-Wimplicit-function-declaration]
                        p->wlan_tsf = le64toh(bc->tsf);
                                      ^
2 warnings generated.
Package libnl-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libnl-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libnl-3.0' found
cc -std=gnu99 -Wall -Wextra -I. -I./core -I./util -I./linux -I./radiotap -DDEBUG=0 -fPIC    -c -o core/wlan_util.o core/wlan_util.c
Package libnl-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libnl-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libnl-3.0' found
cc -std=gnu99 -Wall -Wextra -I. -I./core -I./util -I./linux -I./radiotap -DDEBUG=0 -fPIC    -c -o util/average.o util/average.c
Package libnl-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libnl-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libnl-3.0' found
cc -std=gnu99 -Wall -Wextra -I. -I./core -I./util -I./linux -I./radiotap -DDEBUG=0 -fPIC    -c -o util/util.o util/util.c
Package libnl-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libnl-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libnl-3.0' found
cc -std=gnu99 -Wall -Wextra -I. -I./core -I./util -I./linux -I./radiotap -DDEBUG=0 -fPIC    -c -o linux/inject_rtap.o linux/inject_rtap.c
linux/inject_rtap.c:59:20: warning: implicit declaration of function 'htole16'
      is invalid in C99 [-Wimplicit-function-declaration]
        rtaphdr->it_len = htole16(sizeof(struct inject_radiotap_header));
                          ^
linux/inject_rtap.c:60:24: warning: implicit declaration of function 'htole32'
      is invalid in C99 [-Wimplicit-function-declaration]
        rtaphdr->it_present = htole32(INJECT_RTAP_PRESENT);
                              ^
2 warnings generated.
Package libnl-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libnl-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libnl-3.0' found
cc -std=gnu99 -Wall -Wextra -I. -I./core -I./util -I./linux -I./radiotap -DDEBUG=0 -fPIC    -c -o linux/interface.o linux/interface.c
Package libnl-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libnl-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libnl-3.0' found
cc -std=gnu99 -Wall -Wextra -I. -I./core -I./util -I./linux -I./radiotap -DDEBUG=0 -fPIC    -c -o linux/netdev.o linux/netdev.c
linux/netdev.c:33:16: error: use of undeclared identifier 'SIOCGIFHWADDR'
        if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0) {
                      ^
linux/netdev.c:40:32: error: no member named 'ifr_hwaddr' in 'struct ifreq'
        DBG_PRINT("ARPTYPE %d\n", ifr.ifr_hwaddr.sa_family);
                                  ~~~ ^
./util/util.h:81:60: note: expanded from macro 'DBG_PRINT'
#define DBG_PRINT(...) do { if (DEBUG) printlog(LOG_DEBUG, __VA_ARGS__); } whil...
                                                           ^~~~~~~~~~~
linux/netdev.c:41:13: error: no member named 'ifr_hwaddr' in 'struct ifreq'
        return ifr.ifr_hwaddr.sa_family;
               ~~~ ^
linux/netdev.c:54:16: error: use of undeclared identifier 'SIOCGIFHWADDR'
        if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0) {
                      ^
linux/netdev.c:61:18: error: no member named 'ifr_hwaddr' in 'struct ifreq'
        memcpy(mac, ifr.ifr_hwaddr.sa_data, 6);
                    ~~~ ^
/usr/include/secure/_string.h:65:33: note: expanded from macro 'memcpy'
  __builtin___memcpy_chk (dest, src, len, __darwin_obsz0 (dest))
                                ^~~
5 errors generated.
make: *** [linux/netdev.o] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.