8000 dcwifi: Add Dual Channel Wi-Fi component packages by csonsino · Pull Request #9972 · openwrt/packages · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

dcwifi: Add Dual Channel Wi-Fi component packages #9972

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

Merged
merged 1 commit into from
Oct 2, 2019

Conversation

csonsino
Copy link
Contributor

Add initial support for Dual Channel Wi-Fi.

Included Components:
dcstad: Dual Channel Wi-Fi Station Daemon
dcwapd: Dual Channel Wi-Fi Access Point Daemon
libdcwproto: Dual Channel Wi-Fi Protocol Library
libdcwsocket: Dual Channel Wi-Fi Socket Library
macremapper: MAC Address Remapper Linux Kernel Module
mrmctl: Userland tool to get/set remap rules

Signed-off-by: Carey Sonsino careys@edgewaterwireless.com

Maintainer: me / @csonsino
Compile tested: Atheros AR7xxx/AR9xxx - Atheros AR7161 rev 2, Netgear WNDR3800, OpenWrt master
Run tested: Atheros AR7xxx/AR9xxx - Atheros AR7161 rev 2, Netgear WNDR3800, Configured the Dual Channel Wi-Fi daemon, connected a Raspberry Pi client, and verified functionality.

Description:
These packages provide Wi-Fi packet routing over multiple connections/interfaces. More info here.

@csonsino csonsino changed the title Add Dual Channel Wi-Fi component packages dcwifi: Add Dual Channel Wi-Fi component packages Sep 12, 2019
@csonsino
Copy link
Contributor Author

I'm currently working on a tutorial describing how to configure Dual Channel Wi-Fi on the AP, set up a Raspberry Pi client (with a secondary USB Wi-Fi adapter), and verify functionality. I'm hoping to have a draft early next week and will add a comment with a pointer when it's ready.

@csonsino
Copy link
Contributor Author

Note that there is a related PR into the LuCI repo, which adds a LuCI configuration page for the AP daemon. It's not required, but it definitely helps with the UCI configuration.

@csonsino csonsino force-pushed the feature_dcwifi branch 2 times, most recently from 21e2b4a to a1263e2 Compare September 12, 2019 20:56
@csonsino csonsino force-pushed the feature_dcwifi branch 2 times, most recently from 01c7fcb to 159b5f0 Compare September 17, 2019 14:45
@csonsino
Copy link
Contributor Author

I think that the buildpr failure is caused by the uClibc++ 002-quote-fix.patch and should be resolved when that patch is removed.

@neheb
Copy link
Contributor
neheb commented Sep 17, 2019

Try to follow this template for Makefiles: #9399 (comment)

@neheb
Copy link
Contributor
neheb commented Sep 17, 2019

Something else that's really weird is that I replaced NULL with nullptr in the code. It still compiled, which is totally bogus. nullptr is not specified in uClibc++.

@neheb
Copy link
Contributor
neheb commented Sep 18, 2019

Another issue: libdcwproto is using bzero, which is a function deprecated in POSIX 2008. memset should be used.

Patch:

--- a/src/dcwproto.c
+++ b/src/dcwproto.c
@@ -20,12 +20,8 @@



-#ifdef WIN32
-#define bzero(ptr, size) memset(ptr, 0, size)
-#else
 #include <config.h>
 #include <strings.h>
-#endif
 #include <dcwproto.h>

 #include <string.h>
@@ -95,7 +91,7 @@ dcwmsg_marshal_sta_ack(struct dcwmsg_sta_ack * const output, const unsigned char

     /* copy in the data ssid string bytes */
     if (buf_len < copy_size) return 0;
-    bzero(output->bonded_data_channels[i].ssid, sizeof(output->bonded_data_channels[i].ssid));
+    memset(output->bonded_data_channels[i].ssid, 0, sizeof(output->bonded_data_channels[i].ssid));
     memcpy(output->bonded_data_channels[i].ssid, buf, copy_size);
     buf_len -= copy_size;
     buf += copy_size;
@@ -134,7 +130,7 @@ dcwmsg_marshal_ap_accept_sta(struct dcwmsg_ap_accept_sta * const output, const u

     /* copy in the data ssid string bytes */
     if (buf_len < copy_size) return 0;
-    bzero(output->data_ssids[i], sizeof(output->data_ssids[i]));
+    memset(output->data_ssids[i], 0, sizeof(output->data_ssids[i]));
     memcpy(output->data_ssids[i], buf, copy_size);
     buf_len -= copy_size;
     buf += copy_size;

@csonsino
Copy link
Contributor Author

I created an issue and opened a PR to fix libdcwproto in it's repo. For now (the v1.0.0 release), that patch is in the OpenWrt package.

@csonsino
Copy link
Contributor Author

dcwifi_tutorial-v01.pdf

Here's a draft of a tutorial on setting up a functional Dual Channel Wi-Fi system (OpenWrt AP with a Raspberry Pi client). The linebreaks on the commands got a bit messed up during the pdf conversion, but I'm working on getting the content posted on the Edgewater Wireless website.

@neheb
Copy link
Contributor
neheb commented Sep 19, 2019

I got some size optimizations for you:

--- a/net/dcwifi/dcstad/Makefile
+++ b/net/dcwifi/dcstad/Makefile
@@ -38,6 +38,9 @@ define Package/dcstad/description
 Implementation of the Dual-Channel WiFi client daemon
 endef
 
+TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
+TARGET_LDFLAGS += -Wl,--gc-sections
+
 define Package/dcstad/install
 	$(INSTALL_DIR) $(1)/bin
 	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/dcstad $(1)/bin/
diff --git a/net/dcwifi/dcwapd/Makefile b/net/dcwifi/dcwapd/Makefile
index b6e91b3a5..d3a2ff26f 100644
--- a/net/dcwifi/dcwapd/Makefile
+++ b/net/dcwifi/dcwapd/Makefile
@@ -43,8 +43,8 @@ CONFIGURE_ARGS += \
 	--enable-platform=linuxjsonstatic \
 	--enable-shared
 
-TARGET_CXXFLAGS += -std=c++98
-TARGET_LDFLAGS += -ldcwproto -ldcwsocket -lmrmfilterparser -luci
+TARGET_CXXFLAGS += -std=c++11 -ffunction-sections -fdata-sections -flto
+TARGET_LDFLAGS += -ldcwproto -ldcwsocket -lmrmfilterparser -luci -Wl,--gc-sections,--as-needed
 
 define Build/InstallDev
 	$(INSTALL_DIR) $(1)/usr/lib
--- a/net/dcwifi/libdcwproto/Makefile
+++ b/net/dcwifi/libdcwproto/Makefile
@@ -37,6 +37,9 @@ define Package/libdcwproto/description
   Platform-independent C library for marshaling and serializing DCW messages
 endef
 
+TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
+TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
+
 define Build/InstallDev
 	$(INSTALL_DIR) $(1)/usr/include
 	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
diff --git a/net/dcwifi/libdcwsocket/Makefile b/net/dcwifi/libdcwsocket/Makefile
index 0ec2d73ac..ff21bce7a 100644
--- a/net/dcwifi/libdcwsocket/Makefile
+++ b/net/dcwifi/libdcwsocket/Makefile
@@ -37,6 +37,9 @@ define Package/libdcwsocket/description
   User-land C library for sending and receiving DCW "EtherType"d messages
 endef
 
+TARGET_CFLAGS += -std=c89 -ffunction-sections -fdata-sections -flto
+TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
+
 define Build/InstallDev
 	$(INSTALL_DIR) $(1)/usr/include
 	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
diff --git a/net/dcwifi/mrmctl/Makefile b/net/dcwifi/mrmctl/Makefile
index 85e8783c2..3441d08cf 100644
--- a/net/dcwifi/mrmctl/Makefile
+++ b/net/dcwifi/mrmctl/Makefile
@@ -42,6 +42,9 @@ CONFIGURE_PATH:=userland
 CONFIGURE_ARGS += \
 	--enable-shared
 
+TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
+TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
+
 define Build/InstallDev
 	$(INSTALL_DIR) $(1)/usr/include
 	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/

edit: I should note that some of these will fail compilation like this. bzero needs to be dealt with.

@diizzyy
Copy link
Contributor
diizzyy commented Sep 19, 2019

A much better approach would not be hardsetting these but using environment...

@csonsino
Copy link
Contributor Author

Oh boy. I didn't realize that bzero is used in most of these packages. Will see if I can hunt them all down.

@csonsino
Copy link
Contributor Author

I added patches to remove all of the bzero calls, but I still couldn't get your size optimizations patch to compile.

When we're satisfied that the source for all of the components is in good enough shape, I'll cut new releases, update the Makefiles, and remove the patches.

@csonsino
Copy link
Contributor Author

A much better approach would not be hardsetting these but using environment...

I'm not exactly sure where you mean to set these in the environment. In the component source configure.ac?

@neheb
Copy link
Contributor
neheb commented Sep 20, 2019

I remember adding POSIX_C_SOURCE defines to a few places. I'll have to dig it up.

jow- pushed a commit to openwrt/openwrt that referenced this pull request Sep 20, 2019
This patch was originally added to fix compilation with v4l2rtspserver.
Turns out it was v4l2rtspserver that was broken, not uClibc++. This now
causes issues with a different package where the arguments are being
split.

Note that with this patch, shellcheck throws an error:

SC2068: Double quote array expansions to avoid re-splitting elements.

More: openwrt/packages#9972 (comment)

Signed-off-by: Rosen Penev <rosenp@gmail.com>
jollaman999 pushed a commit to jollaman999/openwrt that referenced this pull request Sep 21, 2019
This patch was originally added to fix compilation with v4l2rtspserver.
Turns out it was v4l2rtspserver that was broken, not uClibc++. This now
causes issues with a different package where the arguments are being
split.

Note that with this patch, shellcheck throws an error:

SC2068: Double quote array expansions to avoid re-splitting elements.

More: openwrt/packages#9972 (comment)

Signed-off-by: Rosen Penev <rosenp@gmail.com>
jow- pushed a commit to openwrt/openwrt that referenced this pull request Sep 21, 2019
This patch was originally added to fix compilation with v4l2rtspserver.
Turns out it was v4l2rtspserver that was broken, not uClibc++. This now
causes issues with a different package where the arguments are being
split.

Note that with this patch, shellcheck throws an error:

SC2068: Double quote array expansions to avoid re-splitting elements.

More: openwrt/packages#9972 (comment)

Signed-off-by: Rosen Penev <rosenp@gmail.com>
(cherry picked from commit 977a8fc)
fengmushu pushed a commit to fengmushu/openwrt that referenced this pull request Sep 29, 2019
This patch was originally added to fix compilation with v4l2rtspserver.
Turns out it was v4l2rtspserver that was broken, not uClibc++. This now
causes issues with a different package where the arguments are being
split.

Note that with this patch, shellcheck throws an error:

SC2068: Double quote array expansions to avoid re-splitting elements.

More: openwrt/packages#9972 (comment)

Signed-off-by: Rosen Penev <rosenp@gmail.com>
dcstad: Dual Channel Wi-Fi Station Daemon
dcwapd: Dual Channel Wi-Fi Access Point Daemon
libdcwproto: Dual Channel Wi-Fi Protocol Library
libdcwsocket: Dual Channel Wi-Fi Socket Library
macremapper: MAC Address Remapper Linux Kernel Module
mrmctl: Userland tool to get/set remap rules

Signed-off-by: Carey Sonsino <careys@edgewaterwireless.com>
Signed-off-by: Carey Sonsino <csonsino@gmail.com>

Much help from @neheb
@neheb
Copy link
Contributor
neheb commented Oct 2, 2019

Looks fine now. Merging.

@neheb neheb merged commit 938ecc6 into openwrt:master Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0