br101 / libuwifi Goto Github PK
View Code? Open in Web Editor NEWUserspace Wifi Library
License: GNU Lesser General Public License v3.0
Userspace Wifi Library
License: GNU Lesser General Public License v3.0
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?
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?
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.
A very minor issue: The LICENSE
files in ccan/
's subdirectories are actually symlinks to a directory that should contain the different license files, e.g. ccan/container_of/LICENSE -> ../../licenses/CC0
. That licenses
dir and its contents are missing however. I assume that using horst
's should do the trick, https://github.com/br101/horst/tree/master/licenses
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 #error
s 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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.