Re: Conclusions from CVE-2024-3094 (libxz disaster)

2024-04-03 Thread Andre Heider

On 03/04/2024 2:11 am, Daniel Golle wrote:

... and that crazy m4 script had to be noticed. As a diff one would ask:
Why was that change necessary?


While I agree with most of your points, I couldn't disagree more with 
the "had to be noticed" part :P


I occasionally skim over treewide diffs. When I do, and there're like 
(exaggerating to illustrate my point) tens of thousand of lines of 
autohell crap in there, I skip that eye cancer part for sanity reasons.


So in that regard, the buildsystem part of this backdoor was a smart 
choice. The chances of anybody looking closely at that is tiny. You 
would need to another reason to get that masochistic. And that is what 
happened here: the bad actor dared to slow down postgresql.


This disaster exposes multiple problems. In my mind, autotools is one of 
them. But this isn't supposed to be yet another X or Y is better than 
autotools argument, my point is that the sheer amount of bundled build 
system code enlarges the attack surface by a significant degree. The 
chances of spotting the equivalent in e.g. a meson.build or 
CMakeLists.txt file are way higher.


Cheers,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] urngd: fixes compilation with glibc

2023-09-15 Thread Andre Heider

On 16/09/2023 05:55, Chukun Pan wrote:

When compiling with glibc it will result in error:
1. #warning _FORTIFY_SOURCE requires compiling with optimization (-O) 
[-Werror=cpp]
Fix this by compiling with optimization (-O2) by default.

2. jitterentropy-base.c:(.text+0x39f8): undefined reference to `pthread_join'
Fix this by always linking pthread.

Signed-off-by: Chukun Pan 
---
  CMakeLists.txt | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a1ee0c1..20f4774 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,7 +23,8 @@ ADD_EXECUTABLE(urngd
  TARGET_LINK_LIBRARIES(urngd ${ubox})
  
  # jitter RNG must not be compiled with optimizations


See that comment, there was a reason for -O0, I don't know which, but if 
that's still required setting PKG_FORTIFY_SOURCE:=0 in the package's 
Makefile would be more appropriate?



-SET_SOURCE_FILES_PROPERTIES(${JTEN_DIR}/jitterentropy-base.c PROPERTIES 
COMPILE_FLAGS -O0)
+SET_SOURCE_FILES_PROPERTIES(${JTEN_DIR}/jitterentropy-base.c PROPERTIES 
COMPILE_FLAGS -O2)
+TARGET_LINK_LIBRARIES(urngd pthread)
  
  INSTALL(TARGETS urngd RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR})
  



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] tools: meson: bump to 1.0.0

2023-02-23 Thread Andre Heider

On 24/02/2023 03:41, Rosen Penev wrote:

On Fri, Feb 17, 2023 at 2:13 AM Andre Heider  wrote:


On 17/02/2023 10:18, Koen Vandeputte wrote:

Drop upstreamed patch.

Tested by compiling the complete gstreamer package which heavily
depends on this one.

Signed-off-by: Koen Vandeputte 


Not possible unfortunately, see
https://github.com/openwrt/openwrt/pull/10543

We tried a few times to get meson to not drop support for older python
versions, but here we are...

Wow this went to my spam. Hilarious.

Ubuntu 18.04 is the earliest distribution supported to compile
OpenWrt. It's interesting that it's not compatible with ccache and
nobody has bothered to fix that. Anyway,

18.04 has python 3.7 and 3.8, making this update possible. IIRC
prereq-build.mk needs to be updated to make either 3.7 or 3.8 the new
minimum.


It looks like not per default though?
https://packages.ubuntu.com/bionic/python3

There's no python3 listed in backports, but apparently in "updates"? No 
idea how it works there, but on debian you need to explicitly choose a 
bpo package to get it installed, it won't land automatically.


Anyway, for all I care we can drop support for 3.6, I just have no idea 
if buildbot runs on at least 3.7? Last I heard it didn't, but that's 
been a while.


In any case something like 7379f8b "build: prereq: drop support for 
Python 3.5" for 3.6 should go in first.


Cheers,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] dnsmasq: bump to v2.89

2023-02-21 Thread Andre Heider
version 2.89
Fix bug introduced in 2.88 (commit fe91134b) which can result
in corruption of the DNS cache internal data structures and
logging of "cache internal error". This has only been seen
in one place in the wild, and it took considerable effort
to even generate a test case to reproduce it, but there's
no way to be sure it won't strike, and the effect is to break
the cache badly. Installations with DNSSEC enabled are more
likely to see the problem, but not running DNSSEC does not
guarantee that it won't happen. Thanks to Timo van Roermund
for reporting the bug and for his great efforts in chasing
it down.

Signed-off-by: Andre Heider 
---
 package/network/services/dnsmasq/Makefile | 4 ++--
 .../patches/100-remove-old-runtime-kernel-support.patch   | 4 ++--
 package/network/services/dnsmasq/patches/200-ubus_dns.patch   | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/package/network/services/dnsmasq/Makefile 
b/package/network/services/dnsmasq/Makefile
index 27443beed9..d8e2e29a87 100644
--- a/package/network/services/dnsmasq/Makefile
+++ b/package/network/services/dnsmasq/Makefile
@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dnsmasq
-PKG_UPSTREAM_VERSION:=2.88
+PKG_UPSTREAM_VERSION:=2.89
 PKG_VERSION:=$(subst test,~~test,$(subst rc,~rc,$(PKG_UPSTREAM_VERSION)))
 PKG_RELEASE:=$(AUTORELEASE)
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_UPSTREAM_VERSION).tar.xz
 PKG_SOURCE_URL:=https://thekelleys.org.uk/dnsmasq/
-PKG_HASH:=23544deda10340c053bea6f15a93fed6ea7f5aaa85316bfc671ffa6d22fbc1b3
+PKG_HASH:=02bd230346cf0b9d5909f5e151df168b2707103785eb616b56685855adebb609
 
 PKG_LICENSE:=GPL-2.0
 PKG_LICENSE_FILES:=COPYING
diff --git 
a/package/network/services/dnsmasq/patches/100-remove-old-runtime-kernel-support.patch
 
b/package/network/services/dnsmasq/patches/100-remove-old-runtime-kernel-support.patch
index 76065375bd..59b8d02c0e 100644
--- 
a/package/network/services/dnsmasq/patches/100-remove-old-runtime-kernel-support.patch
+++ 
b/package/network/services/dnsmasq/patches/100-remove-old-runtime-kernel-support.patch
@@ -26,7 +26,7 @@ Signed-off-by: Kevin Darbyshire-Bryant 

  
 --- a/src/dnsmasq.h
 +++ b/src/dnsmasq.h
-@@ -1247,7 +1247,7 @@ extern struct daemon {
+@@ -1248,7 +1248,7 @@ extern struct daemon {
int inotifyfd;
  #endif
  #if defined(HAVE_LINUX_NETWORK)
@@ -35,7 +35,7 @@ Signed-off-by: Kevin Darbyshire-Bryant 

  #elif defined(HAVE_BSD_NETWORK)
int dhcp_raw_fd, dhcp_icmp_fd, routefd;
  #endif
-@@ -1452,9 +1452,6 @@ int read_write(int fd, unsigned char *pa
+@@ -1453,9 +1453,6 @@ int read_write(int fd, unsigned char *pa
  void close_fds(long max_fd, int spare1, int spare2, int spare3);
  int wildcard_match(const char* wildcard, const char* match);
  int wildcard_matchn(const char* wildcard, const char* match, int num);
diff --git a/package/network/services/dnsmasq/patches/200-ubus_dns.patch 
b/package/network/services/dnsmasq/patches/200-ubus_dns.patch
index f88763f94a..8a70bb8bdf 100644
--- a/package/network/services/dnsmasq/patches/200-ubus_dns.patch
+++ b/package/network/services/dnsmasq/patches/200-ubus_dns.patch
@@ -1,6 +1,6 @@
 --- a/src/dnsmasq.h
 +++ b/src/dnsmasq.h
-@@ -1630,14 +1630,26 @@ void emit_dbus_signal(int action, struct
+@@ -1631,14 +1631,26 @@ void emit_dbus_signal(int action, struct
  
  /* ubus.c */
  #ifdef HAVE_UBUS
-- 
2.39.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] tools: meson: bump to 1.0.0

2023-02-17 Thread Andre Heider

On 17/02/2023 10:18, Koen Vandeputte wrote:

Drop upstreamed patch.

Tested by compiling the complete gstreamer package which heavily
depends on this one.

Signed-off-by: Koen Vandeputte 


Not possible unfortunately, see 
https://github.com/openwrt/openwrt/pull/10543


We tried a few times to get meson to not drop support for older python 
versions, but here we are...


Cheers,
Andre


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] wireguard-tools: remove unnecessary .mk includes

2023-02-16 Thread Andre Heider
Including kernel.mk moves the package build folder in the linux one, which
is confusing since this isn't building any kernel modules.

package-defaults.mk is already included my package.mk.

Signed-off-by: Andre Heider 
---
 package/network/utils/wireguard-tools/Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/package/network/utils/wireguard-tools/Makefile 
b/package/network/utils/wireguard-tools/Makefile
index 8218171fcd..5d52dd37e8 100644
--- a/package/network/utils/wireguard-tools/Makefile
+++ b/package/network/utils/wireguard-tools/Makefile
@@ -7,7 +7,6 @@
 # See /LICENSE for more information.
 
 include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=wireguard-tools
 
@@ -24,7 +23,6 @@ PKG_LICENSE_FILES:=COPYING
 PKG_BUILD_PARALLEL:=1
 
 include $(INCLUDE_DIR)/package.mk
-include $(INCLUDE_DIR)/package-defaults.mk
 
 MAKE_PATH:=src
 MAKE_VARS += PLATFORM=linux
-- 
2.39.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] elfutils: fix build with GCC 11

2023-02-07 Thread Andre Heider
GCC 11 doesn't know about -Wno-error=use-after-free and aborts
compilation.

Fixes: 2748c45d "elfutils: Ignore wrong use-after-free error"
Signed-off-by: Andre Heider 
---
 package/libs/elfutils/Makefile | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/package/libs/elfutils/Makefile b/package/libs/elfutils/Makefile
index 5204e0847e..e8477ead03 100644
--- a/package/libs/elfutils/Makefile
+++ b/package/libs/elfutils/Makefile
@@ -80,7 +80,15 @@ HOST_CONFIGURE_VARS += \
 CONFIGURE_VARS += \
ac_cv_search__obstack_free=yes
 
-TARGET_CFLAGS += -D_GNU_SOURCE -Wno-unused-result -Wno-format-nonliteral 
-Wno-error=use-after-free
+TARGET_CFLAGS += \
+   -D_GNU_SOURCE \
+   -Wno-unused-result \
+   -Wno-format-nonliteral
+
+ifneq ($(CONFIG_GCC_USE_VERSION_11),y)
+TARGET_CFLAGS += \
+   -Wno-error=use-after-free
+endif
 
 define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
-- 
2.39.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] urandom-seed: use seedrng for seeding the random number generator

2023-02-01 Thread Andre Heider

On 04/04/2022 21:35, Etienne Champetier wrote:

Hi Jason,

Le lun. 4 avr. 2022 à 14:39, Jason A. Donenfeld  a écrit :


Hey Etienne,

On Tue, Mar 29, 2022 at 7:21 AM Jason A. Donenfeld  wrote:


Hi Etienne,

On Tue, Mar 29, 2022 at 1:06 AM Etienne Champetier
 wrote:

Oh that's an interesting set of considerations and it's possible I
didn't understand some aspect of this. Most OSes should call seedrng
once at boot and once at shutdown.


As routers are always on devices, it's rare to have clean shutdown.
Personally, my routers boot after an upgrade or after a power loss,
so they almost never shutdown properly.


That's a good point indeed.


1) read seed into memory, delete seed from disk, write into rng &
credit if good seed, write new seed to disk; repeat at shutdown/some
other time
2) read seed into memory, write into rng w/o crediting, re-use the
same seed next boot


Before this patch we had 2 and users could opt-in to renew seed on
each boot, so closer to 1.


I guess the issue is that the implementation of (1) was somewhat
non-optimal, but not exactly catastrophic either.


Looking at random.c, I would love add_device_randomness() behavior.
Maybe it was already answered on LKML,
but why can't writes to /dev/urandom from a process with CAP_SYS_ADMIN
be mixed in right away a la add_device_randomness() without being credited ?
This would not init the RNG faster, but this would make early
/dev/urandom reads "safer".


add_device_randomness() does not mix in immediately. It goes into the
entropy pool, but that doesn't get extracted into a new key until the
next reseeding. It does get mixed in directly for crng_init=0, but not
for crng_init=1 or crng_init=2, which is a big gap. Making
/dev/urandom writes behave like that for crng_init=0 doesn't address
the crng_init=1 and crng_init=2 cases, unfortunately. The bigger
problem, though, is that some users of /dev/urandom credit the entropy
via the RNDADDTOENTCNT ioctl _afterwards_. If we mixed it directly in,
then programs with the pattern of write 4 bytes, credit 32 bits,
writes 4 bytes, credit 32 bits, etc could have those 4 written bytes
brute forced each time in what's called a "premature next". For that
reason the key is only modified when 256 bits have accumulated first.


I'm fine with writing on each boot, but as we can't rely on shutdown,
what we could do with the seeds:
1) load seed.no-credit, leave it on disk
2) mv seed.credit seed.no-credit && load seed.no-credit (and credit it)
3) read from getrandom a new seed.credit

This would allow to always keep a seed on disk, only use seed.credit once,
and actually write seed.credit.
I would get rid of the whole hashing part as all our seeds would come
from getrandom().


If possible, it's better to not leave a seed on disk after using it,
even if not credited. If that's the only entropy, it's better to
"forget" it after use, so that you can't compromise past secrets. At
the very least, if you have poor entropy, you can replace the seed
with HASH(seed), so at least it ratchets forward. Another thing to
consider is that if you _do_ credit it, that'll initialize the RNG, so
getrandom() automatically works without blocking. These two
observations have lead to seedrng's current scheme, where the sequence
is:

- load
- delete
- seed & credit, or seed & don't credit, depending
- save new seed, which may be creditable or not, depending on whether
previous things made the rng init

It sounds like maybe a modification of your suggestion might be to make this:

- load
- delete
- seed & credit, or seed & don't credit, depending
- save new seed using getrandom(0), so that it's always creditable

Would that satisfy your concerns? Or are you also trying to preserve a
mode where the filesystem doesn't need to be written to on each boot?




/var is a symlink to /tmp


Oh, then in these cleanups, we should change that /tmp/run to /var/run
just to be more "correct".




Is there a different place for it that would be good?


Maybe we can leave it in etc and just make sure to exclude it from backups


That seems like a good course of action.

If you have a firm idea of what you want this to look like, would you
like to send a series and I'll take a look?


I never heard back from you, but all the concerns you raised strike me
as kind of important. Did you intend to move forward with those? Or
should I just send a revert for this whole thing, so that you can
address it some other time?


I meant to work on it last week but had 0 time, hopefully this week
will be less busy :(
Master is not less secure than before, so let's wait a bit to revert


Any progress on this?

PS: Since the last busybox bump we even have BUSYBOX_CONFIG_SEEDRNG now.

Cheers,
Andre



Best
Etienne



Jason


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



___
openwrt-devel mailing list

Re: [PATCH iwinfo] nl80211: restore iterating over all devices in nl80211_phy2ifname()

2023-01-30 Thread Andre Heider

On 30/01/2023 23:18, Christian Marangi wrote:

On Mon, Jan 30, 2023 at 07:57:57PM +0100, Andre Heider wrote:

This reverts to the earlier behaviour, because:
* phys can be renamed, which breaks hardcoding "phy%d"
* /sys/class/ieee80211/*/device can return networks of other phys,
   since "device" is a symlink which can have multiple phys

The earlier behaviour fixes both points.

Fixes: 6194aaf0 "nl80211: simplify iterating over phy's devices"
Fixes: #11902
Signed-off-by: Andre Heider 
Tested-by: Olcay Korkmaz 


I remember we had some good stats of the timing improvement of
6194aaf05244241d2f51c471a43584f8d80b64ce. Does this reintroduce the
additional slowdown? Should we add this as a fallback if the interface
is not found using the expected way?


With a HEAD of 6194aaf, yes, quite some slowdowns were fixed. While 
6194aaf itself does iterate over less, this patch isn't a performance 
hit, maybe just above measurable.


We can't use this as a fallback, as it does the wrong thing. It assumes 
things that I though were safe to assume, but alas... :)


Cheers

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH iwinfo] nl80211: restore iterating over all devices in nl80211_phy2ifname()

2023-01-30 Thread Andre Heider
This reverts to the earlier behaviour, because:
* phys can be renamed, which breaks hardcoding "phy%d"
* /sys/class/ieee80211/*/device can return networks of other phys,
  since "device" is a symlink which can have multiple phys

The earlier behaviour fixes both points.

Fixes: 6194aaf0 "nl80211: simplify iterating over phy's devices"
Fixes: #11902
Signed-off-by: Andre Heider 
Tested-by: Olcay Korkmaz 
---
 iwinfo_nl80211.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index 5bc2f51..50bb8f0 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -825,13 +825,15 @@ static char * nl80211_phy2ifname(const char *ifname)
 
memset(nif, 0, sizeof(nif));
 
-   snprintf(buffer, sizeof(buffer),
-"/sys/class/ieee80211/phy%d/device/net", phyidx);
-
-   if ((d = opendir(buffer)) != NULL)
+   if ((d = opendir("/sys/class/net")) != NULL)
{
while ((e = readdir(d)) != NULL)
{
+   snprintf(buffer, sizeof(buffer),
+"/sys/class/net/%s/phy80211/index", e->d_name);
+   if (nl80211_readint(buffer) != phyidx)
+   continue;
+
snprintf(buffer, sizeof(buffer),
 "/sys/class/net/%s/ifindex", e->d_name);
cifidx = nl80211_readint(buffer);
-- 
2.39.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH 3/4] utils: skip comment lines when parsing devices.txt

2023-01-18 Thread Andre Heider
Just a small optimization, skip the line early if it starts with a #.

Signed-off-by: Andre Heider 
---
 iwinfo_utils.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/iwinfo_utils.c b/iwinfo_utils.c
index ecd1dff..d96cbb3 100644
--- a/iwinfo_utils.c
+++ b/iwinfo_utils.c
@@ -280,6 +280,9 @@ struct iwinfo_hardware_entry * iwinfo_hardware(struct 
iwinfo_hardware_id *id)
 
while (fgets(buf, sizeof(buf) - 1, db) != NULL)
{
+   if (buf[0] == '#')
+   continue;
+
memset(, 0, sizeof(e));
 
if (sscanf(buf, "%hx %hx %hx %hx %hd %hd \"%63[^\"]\" 
\"%63[^\"]\"",
-- 
2.39.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH 4/4] devices: add USB devices supported by the mt76 driver

2023-01-18 Thread Andre Heider
A nice and stable working mainline driver deserves first class support,
and this adds all USB devices supported by it.

The PIDs/VIDs are taken directly from the driver, in the very same order
to make future syncs easy.

The single left out entry is the unknown 148f:760a.

Signed-off-by: Andre Heider 
---
 devices.txt | 40 
 1 file changed, 40 insertions(+)

diff --git a/devices.txt b/devices.txt
index e316d60..82d8421 100644
--- a/devices.txt
+++ b/devices.txt
@@ -195,7 +195,47 @@
 
 # USB devices
 # 0x | 0x | vendor id | product id | ...
+# mt7921/usb.c
 0x 0x 0x0e8d 0x79610  0  "MediaTek" "MT7921AU"
+# mt76x2/usb.c
+0x 0x 0x0b05 0x18330  0  "ASUS" "USB-AC54"
+0x 0x 0x0b05 0x17eb0  0  "ASUS" "USB-AC55"
+0x 0x 0x0b05 0x180b0  0  "ASUS" "USB-N53 B1"
+0x 0x 0x0e8d 0x76120  0  "Aukey" "USBAC1200" /* Alfa 
AWUS036ACM */
+0x 0x 0x057c 0x85030  0  "AVM" "FRITZ!WLAN AC860"
+0x 0x 0x7392 0xb7110  0  "Edimax" "EW-7722UAC"
+0x 0x 0x0e8d 0x76320  0  "High Cloud" "HC-M7662BU1"
+0x 0x 0x2c4e 0x01030  0  "Mercury" "UD13"
+0x 0x 0x0846 0x90530  0  "Netgear" "A6210"
+0x 0x 0x045e 0x02e60  0  "Microsoft" "XBox One Wireless 
Adapter"
+0x 0x 0x045e 0x02fe0  0  "Microsoft" "XBox One Wireless 
Adapter"
+# mt76x0/usb.c
+0x 0x 0x148f 0x76100  0  "MediaTek" "MT7610U"
+0x 0x 0x13b1 0x003e0  0  "Linksys" "AE6000"
+0x 0x 0x0e8d 0x76100  0  "Sabrent" "NTWLAC"
+0x 0x 0x7392 0xa7110  0  "Edimax" "7711MAC"
+0x 0x 0x148f 0x761a0  0  "TP-Link" "TL-WDN5200"
+0x 0x 0x0b05 0x17d10  0  "ASUS" "USB-AC51"
+0x 0x 0x0b05 0x17db0  0  "ASUS" "USB-AC50"
+0x 0x 0x0df6 0x00750  0  "Sitecom" "WLA-3100"
+0x 0x 0x2019 0xab310  0  "Planex" "GW-450D"
+0x 0x 0x2001 0x3d020  0  "D-Link" "DWA-171 rev B1"
+0x 0x 0x0586 0x34250  0  "Zyxel" "NWD6505"
+0x 0x 0x07b8 0x76100  0  "AboCom" "AU7212"
+0x 0x 0x04bb 0x09510  0  "I-O DATA" "WN-AC433UK"
+0x 0x 0x057c 0x85020  0  "AVM" "FRITZ!WLAN AC430"
+0x 0x 0x293c 0x57020  0  "Comcast" "Xfinity KXW02AAA"
+0x 0x 0x20f4 0x806b0  0  "TRENDnet" "TEW-806UBH"
+0x 0x 0x7392 0xc7110  0  "Devolo" "WiFi Stick ac"
+0x 0x 0x0df6 0x00790  0  "Sitecom" "WL-356"
+0x 0x 0x2357 0x01230  0  "TP-Link" "T2UHP US v1"
+0x 0x 0x2357 0x010b0  0  "TP-Link" "T2UHP UN v1"
+0x 0x 0x2357 0x01050  0  "TP-Link" "Archer T1U"
+0x 0x 0x0e8d 0x76300  0  "MediaTek" "MT7630U"
+0x 0x 0x0e8d 0x76500  0  "MediaTek" "MT7650U"
+# mt7615/usb.c
+0x 0x 0x0e8d 0x76630  0  "MediaTek" "MT7663U"
+0x 0x 0x043e 0x310c0  0  "LG" "LGSBWAC02"
 
 # FDT compatible strings
 # "compatible" | txpower offset | frequency offset | ...
-- 
2.39.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH 1/4] devices: add MediaTek MT7628 card

2023-01-18 Thread Andre Heider
This adds the single missing compatible supported by the mt76 driver,
which is used by a bunch of ramips mt7628an devices.

Signed-off-by: Andre Heider 
---
 devices.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/devices.txt b/devices.txt
index 4da663d..e316d60 100644
--- a/devices.txt
+++ b/devices.txt
@@ -208,4 +208,5 @@
 "qcom,ipq4019-wifi" 0  0  "Qualcomm Atheros" "IPQ4019"
 "qcom,ipq8074-wifi" 0  0  "Qualcomm Atheros" "IPQ8074"
 "mediatek,mt7622-wmac"  0  0  "MediaTek" "MT7622"
+"mediatek,mt7628-wmac"  0  0  "MediaTek" "MT7628"
 "mediatek,mt7986-wmac"  0  0  "MediaTek" "MT7986"
-- 
2.39.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH 2/4] cli: describe USB devices as such

2023-01-18 Thread Andre Heider
This makes it clear if the hardware is embedded or usb/pci based.

Signed-off-by: Andre Heider 
---
 iwinfo_cli.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/iwinfo_cli.c b/iwinfo_cli.c
index f46772b..5dcee9a 100644
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -367,6 +367,10 @@ static char * print_hardware_id(const struct iwinfo_ops 
*iw, const char *ifname)
{
if (strlen(ids.compatible) > 0)
snprintf(buf, sizeof(buf), "embedded");
+   else if (ids.vendor_id == 0 && ids.device_id == 0 &&
+ids.subsystem_vendor_id != 0 && 
ids.subsystem_device_id != 0)
+   snprintf(buf, sizeof(buf), "USB %04X:%04X",
+   ids.subsystem_vendor_id, 
ids.subsystem_device_id);
else
snprintf(buf, sizeof(buf), "%04X:%04X %04X:%04X",
ids.vendor_id, ids.device_id,
-- 
2.39.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH uhttpd] ucode: respect all arguments passed to send()

2023-01-12 Thread Andre Heider

On 09/12/2022 15:16, Andre Heider wrote:

Similar to ucode's print() this now prints any given values to stdout:
uhttpd.send(a, b, c, "\n");

Signed-off-by: Andre Heider 


Friendly ping! Any takers?


---
  ucode.c | 26 ++
  1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/ucode.c b/ucode.c
index aa5d5b4..bbb9b00 100644
--- a/ucode.c
+++ b/ucode.c
@@ -115,20 +115,22 @@ uh_ucode_recv(uc_vm_t *vm, size_t nargs)
  static uc_value_t *
  uh_ucode_send(uc_vm_t *vm, size_t nargs)
  {
-   uc_value_t *val = uc_fn_arg(0);
-   ssize_t len;
+   uc_value_t *val;
+   size_t arridx;
+   ssize_t len = 0;
char *p;
  
-	if (ucv_type(val) == UC_STRING) {

-   len = write(STDOUT_FILENO, ucv_string_get(val), 
ucv_string_length(val));
-   }
-   else if (val != NULL) {
-   p = ucv_to_string(vm, val);
-   len = p ? write(STDOUT_FILENO, p, strlen(p)) : 0;
-   free(p);
-   }
-   else {
-   len = 0;
+   for (arridx = 0; arridx < nargs; arridx++) {
+   val = uc_fn_arg(arridx);
+
+   if (ucv_type(val) == UC_STRING) {
+   len += write(STDOUT_FILENO, ucv_string_get(val), 
ucv_string_length(val));
+   }
+   else if (val != NULL) {
+   p = ucv_to_string(vm, val);
+   len += p ? write(STDOUT_FILENO, p, strlen(p)) : 0;
+   free(p);
+   }
}
  
  	return ucv_int64_new(len);



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [iwinfo PATCH v2] devices: add support for declaring compatible matched devices

2023-01-09 Thread Andre Heider

On 09/01/2023 21:44, Andre Heider wrote:

On 09/01/2023 20:49, Christian Marangi wrote:

From: Jo-Philipp Wich 

Some device have embedded wifi card that are not connected with usb or
internall with pci. Such device have fake device_id and only the
vendor_id actually reflect something real but internally they don't have
any id and are just matched by the node compatible binding in DT.

We currently match this with a big if-else to match the single devices
but this can be improved and be matched directly in devices.txt

Rework this so that we can drop the big if-else and move the matching
to devices.txt

When a device is matched using compatible in iwinfo the hardware will be
flagged as embedded and won't print empty ids.

Update devices.txt by migrating all the compatible matching device from
fake id to compatible matching.

Tested-by: Christian Marangi  # ipq4019
Co-developed-by: Christian Marangi 
Signed-off-by: Jo-Philipp Wich 
Signed-off-by: Christian Marangi 
Tested-by: Robert Marko  # ipq8074


Reviewed-by: Andre Heider 


Forgot to mention, but stating the obvious:
This changes the ABI (adding new members to public structs), so a 
recompilation of all users is sufficient to avoid problems. Hence, 
please bump IWINFO_ABI_VERSION once this is merged and the package gets 
updated.


While on that topic, the few remaining patches from PR#11280 are in the 
same boat. Can we get those merged too, pretty please?


Thanks,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [iwinfo PATCH v2] devices: add support for declaring compatible matched devices

2023-01-09 Thread Andre Heider

On 09/01/2023 20:49, Christian Marangi wrote:

From: Jo-Philipp Wich 

Some device have embedded wifi card that are not connected with usb or
internall with pci. Such device have fake device_id and only the
vendor_id actually reflect something real but internally they don't have
any id and are just matched by the node compatible binding in DT.

We currently match this with a big if-else to match the single devices
but this can be improved and be matched directly in devices.txt

Rework this so that we can drop the big if-else and move the matching
to devices.txt

When a device is matched using compatible in iwinfo the hardware will be
flagged as embedded and won't print empty ids.

Update devices.txt by migrating all the compatible matching device from
fake id to compatible matching.

Tested-by: Christian Marangi  # ipq4019
Co-developed-by: Christian Marangi 
Signed-off-by: Jo-Philipp Wich 
Signed-off-by: Christian Marangi 
Tested-by: Robert Marko  # ipq8074


Reviewed-by: Andre Heider 

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [iwinfo PATCH] devices: add support for declaring compatible matched devices

2023-01-09 Thread Andre Heider

On 09/01/2023 20:17, Christian Marangi wrote:

On Mon, Jan 09, 2023 at 08:14:36PM +0100, Andre Heider wrote:

On 09/01/2023 19:58, Christian Marangi wrote:

On Mon, Jan 09, 2023 at 07:53:02PM +0100, Andre Heider wrote:

On 09/01/2023 19:46, Christian Marangi wrote:

On Mon, Jan 09, 2023 at 07:44:34PM +0100, Andre Heider wrote:

On 09/01/2023 18:28, Christian Marangi wrote:

From: Jo-Philipp Wich 

Some device have embedded wifi card that are not connected with usb or
internall with pci. Such device have fake device_id and only the
vendor_id actually reflect something real but internally they don't have
any id and are just matched by the node compatible binding in DT.


Nice cleanup! But those fake entries in devices.txt can then be removed,
right? (Assuming all of those _are_ fake and not mapped to actual pci ids)



But they are dropped. Am I missing something? Everything with compatible
doesn't have the id declared and internally they are all set to 0.


The code that maps them to ids is dropped, the id entries mapping those to
the result values are not (which is why this is so ugly ;)

For the first if() that's:

diff --git a/devices.txt b/devices.txt
index e0663b8..040766c 100644
--- a/devices.txt
+++ b/devices.txt
@@ -141,7 +141,6 @@
   0x168c 0x002a 0x0777 0xe202   12  0  "Ubiquiti" "Bullet M2"
   0x168c 0x002a 0x0777 0xe8055  0  "Ubiquiti" "Bullet M5"
   0x168c 0x002a 0x0777 0xe3450  0  "Ubiquiti" "WispStation M5" /*
ToDo: confirm offset - Wrong! */
-0x168c 0x0029 0x168c 0x91300  0  "Atheros"  "AR9130"
   0x168c 0x0029 0x168c 0xa0940  0  "Atheros"  "AR9220"
   0x168c 0x0029 0x168c 0xa0950  0  "Atheros"  "AR9223"
   0x168c 0x002a 0x168c 0xa0930  0  "Atheros"  "AR9280"


Still I'm not following... the only place we did compatible matching was
in nl80211_hardware_id_from_fdt. Stuff that was present in devices.txt
is all matched from pci id. Unless they are faked by some driver iwinfo
in theory is using provided pci id to do the match.

If that is not the case then I have no idea how iwinfo is taking the id if
the connected pci card is not providing them.

Happy to fix if you can give me better example but I wasn't aware we had
pci device with fake id. Am I missing a patch on a different place?


Drivers are not faking anything, iwinfo is.

Once upon a time it only supported pci based cards, using the four id
values. Later support for non-pci dt-compatible was hacked in. For that, it
maps those compatible strings to made up pci ids in code, and at the same
time added those fake ids to devices.txt.

Like the recent commit here:
https://git.openwrt.org/?p=project/iwinfo.git;a=commitdiff;h=5914d7113ecf77de63eb21fc233684d1a1a52ca5

This patch cleans that up, but it left out the device entries, which are
dead now.

Hope that clears it up?


OHHH ok yes!
I was aware that iwinfo was faking ids but totally forgot the entry were
still there in devices.txt

Let me send v2 with the entry dropped... Wonder if you can take an extra
check in case I miss some.


Sure.

BTW, not directly related, but mainline linux also supports something 
related to map dt wifi devices to pci ids so the desired driver binds:


$ git grep 'compatible = "pci'
...
target/linux/ath79/dts/ar7161_aruba_ap-105.dts- ath9k0: wifi@0,11 { /* 
2.4 GHz */
target/linux/ath79/dts/ar7161_aruba_ap-105.dts: compatible = 
"pci168c,0029";

...

iwinfo could evaluate those embedded pci ids to then properly match 
based on pci instead of dt-compatibles. I don't have a board using that 
feature though.


Cheers,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [iwinfo PATCH] devices: add support for declaring compatible matched devices

2023-01-09 Thread Andre Heider

On 09/01/2023 19:58, Christian Marangi wrote:

On Mon, Jan 09, 2023 at 07:53:02PM +0100, Andre Heider wrote:

On 09/01/2023 19:46, Christian Marangi wrote:

On Mon, Jan 09, 2023 at 07:44:34PM +0100, Andre Heider wrote:

On 09/01/2023 18:28, Christian Marangi wrote:

From: Jo-Philipp Wich 

Some device have embedded wifi card that are not connected with usb or
internall with pci. Such device have fake device_id and only the
vendor_id actually reflect something real but internally they don't have
any id and are just matched by the node compatible binding in DT.


Nice cleanup! But those fake entries in devices.txt can then be removed,
right? (Assuming all of those _are_ fake and not mapped to actual pci ids)



But they are dropped. Am I missing something? Everything with compatible
doesn't have the id declared and internally they are all set to 0.


The code that maps them to ids is dropped, the id entries mapping those to
the result values are not (which is why this is so ugly ;)

For the first if() that's:

diff --git a/devices.txt b/devices.txt
index e0663b8..040766c 100644
--- a/devices.txt
+++ b/devices.txt
@@ -141,7 +141,6 @@
  0x168c 0x002a 0x0777 0xe202   12  0  "Ubiquiti" "Bullet M2"
  0x168c 0x002a 0x0777 0xe8055  0  "Ubiquiti" "Bullet M5"
  0x168c 0x002a 0x0777 0xe3450  0  "Ubiquiti" "WispStation M5" /*
ToDo: confirm offset - Wrong! */
-0x168c 0x0029 0x168c 0x91300  0  "Atheros"  "AR9130"
  0x168c 0x0029 0x168c 0xa0940  0  "Atheros"  "AR9220"
  0x168c 0x0029 0x168c 0xa0950  0  "Atheros"  "AR9223"
  0x168c 0x002a 0x168c 0xa0930  0  "Atheros"  "AR9280"


Still I'm not following... the only place we did compatible matching was
in nl80211_hardware_id_from_fdt. Stuff that was present in devices.txt
is all matched from pci id. Unless they are faked by some driver iwinfo
in theory is using provided pci id to do the match.

If that is not the case then I have no idea how iwinfo is taking the id if
the connected pci card is not providing them.

Happy to fix if you can give me better example but I wasn't aware we had
pci device with fake id. Am I missing a patch on a different place?


Drivers are not faking anything, iwinfo is.

Once upon a time it only supported pci based cards, using the four id 
values. Later support for non-pci dt-compatible was hacked in. For that, 
it maps those compatible strings to made up pci ids in code, and at the 
same time added those fake ids to devices.txt.


Like the recent commit here:
https://git.openwrt.org/?p=project/iwinfo.git;a=commitdiff;h=5914d7113ecf77de63eb21fc233684d1a1a52ca5

This patch cleans that up, but it left out the device entries, which are 
dead now.


Hope that clears it up?

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [iwinfo PATCH] devices: add support for declaring compatible matched devices

2023-01-09 Thread Andre Heider

On 09/01/2023 19:46, Christian Marangi wrote:

On Mon, Jan 09, 2023 at 07:44:34PM +0100, Andre Heider wrote:

On 09/01/2023 18:28, Christian Marangi wrote:

From: Jo-Philipp Wich 

Some device have embedded wifi card that are not connected with usb or
internall with pci. Such device have fake device_id and only the
vendor_id actually reflect something real but internally they don't have
any id and are just matched by the node compatible binding in DT.


Nice cleanup! But those fake entries in devices.txt can then be removed,
right? (Assuming all of those _are_ fake and not mapped to actual pci ids)



But they are dropped. Am I missing something? Everything with compatible
doesn't have the id declared and internally they are all set to 0.


The code that maps them to ids is dropped, the id entries mapping those 
to the result values are not (which is why this is so ugly ;)


For the first if() that's:

diff --git a/devices.txt b/devices.txt
index e0663b8..040766c 100644
--- a/devices.txt
+++ b/devices.txt
@@ -141,7 +141,6 @@
 0x168c 0x002a 0x0777 0xe202   12  0  "Ubiquiti" "Bullet M2"
 0x168c 0x002a 0x0777 0xe8055  0  "Ubiquiti" "Bullet M5"
 0x168c 0x002a 0x0777 0xe3450  0  "Ubiquiti" "WispStation M5" 
/* ToDo: confirm offset - Wrong! */

-0x168c 0x0029 0x168c 0x91300  0  "Atheros"  "AR9130"
 0x168c 0x0029 0x168c 0xa0940  0  "Atheros"  "AR9220"
 0x168c 0x0029 0x168c 0xa0950  0  "Atheros"  "AR9223"
 0x168c 0x002a 0x168c 0xa0930  0  "Atheros"  "AR9280"

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [iwinfo PATCH] devices: add support for declaring compatible matched devices

2023-01-09 Thread Andre Heider

On 09/01/2023 18:28, Christian Marangi wrote:

From: Jo-Philipp Wich 

Some device have embedded wifi card that are not connected with usb or
internall with pci. Such device have fake device_id and only the
vendor_id actually reflect something real but internally they don't have
any id and are just matched by the node compatible binding in DT.


Nice cleanup! But those fake entries in devices.txt can then be removed, 
right? (Assuming all of those _are_ fake and not mapped to actual pci ids)


Cheers,
Andre


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH uhttpd] ucode: respect all arguments passed to send()

2022-12-09 Thread Andre Heider
Similar to ucode's print() this now prints any given values to stdout:
uhttpd.send(a, b, c, "\n");

Signed-off-by: Andre Heider 
---
 ucode.c | 26 ++
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/ucode.c b/ucode.c
index aa5d5b4..bbb9b00 100644
--- a/ucode.c
+++ b/ucode.c
@@ -115,20 +115,22 @@ uh_ucode_recv(uc_vm_t *vm, size_t nargs)
 static uc_value_t *
 uh_ucode_send(uc_vm_t *vm, size_t nargs)
 {
-   uc_value_t *val = uc_fn_arg(0);
-   ssize_t len;
+   uc_value_t *val;
+   size_t arridx;
+   ssize_t len = 0;
char *p;
 
-   if (ucv_type(val) == UC_STRING) {
-   len = write(STDOUT_FILENO, ucv_string_get(val), 
ucv_string_length(val));
-   }
-   else if (val != NULL) {
-   p = ucv_to_string(vm, val);
-   len = p ? write(STDOUT_FILENO, p, strlen(p)) : 0;
-   free(p);
-   }
-   else {
-   len = 0;
+   for (arridx = 0; arridx < nargs; arridx++) {
+   val = uc_fn_arg(arridx);
+
+   if (ucv_type(val) == UC_STRING) {
+   len += write(STDOUT_FILENO, ucv_string_get(val), 
ucv_string_length(val));
+   }
+   else if (val != NULL) {
+   p = ucv_to_string(vm, val);
+   len += p ? write(STDOUT_FILENO, p, strlen(p)) : 0;
+   free(p);
+   }
}
 
return ucv_int64_new(len);
-- 
2.35.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH v2 2/9] uci: maintain option position in uci_set

2022-11-26 Thread Andre Heider

On 20/11/2022 02:08, Jan Venekamp wrote:

Maintain the position of an option in the list when updating an option
in uci_set.


Nice, that's really an annoyance!

I assume this doesn't fix wiping '#' comments when saving through luci? 
That's just as annoying :)


Cheers,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] iwinfo: nl80211: fix wpa supplicant ctrl socket permissions

2022-11-18 Thread Andre Heider

I updated the patches and added a few more.

But instead of posting them here again I opened a PR:
https://github.com/openwrt/openwrt/pull/11280

Please let me know if I should post them here again instead.

Thanks,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: GitHub mirror for firmware-utils Inbox

2022-11-16 Thread Andre Heider

On 14/11/2022 12:14, Joseph Mullally wrote:

Hi all,

Can a GitHub mirror be created for
https://git.openwrt.org/project/firmware-utils.git ?


That applies to a lot more repos, basically project/*
And that may be too much maintenance effort?

Since github PRs are not merged directly anyway, but manually to the 
git.openwrt.org repos (which then get mirrored back to github), an 
alternative would be for contributors to add patches to the 
corresponding packages/*/patches folder and opening a PR to the main 
repo on github instead.


That has the advantage to use the whole CI setup. And looking at the 
amount or PRs vs patches to the mailinglist, I think it's safe to say 
the github move was a success.


This would make it easier for contributers, maybe even getting more 
patches for those projects.

On top of that, patchwork seems semi-abandoned, stuff suffers from bitrot.

Would that be acceptable?

Cheers,
Andre


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH 2/2] iwinfo: nl80211: don't use a random iface when getting phy infos

2022-11-15 Thread Andre Heider
One phy can have more than one wifi-iface. When getting just the
phy infos, don't get iface specific values of some random iface
from that phy, that's just not right and confusing.

Note:
This removes ssid, bssid, mode, quality_max and encryption
from the phy result table of e.g:
$ ubus call iwinfo info '{"device":"phy0"}'

But there're of course still present of for ifaces, e.g.:
$ ubus call iwinfo info '{"device":"wlan0"}'`

And more importantly this is unchanged:
$ ubus call luci-rpc getWirelessDevices

(Which has iface _and_ phy iwinfo tables, where the latter already
doesn't include the values removed here).

Signed-off-by: Andre Heider 
---
 iwinfo_nl80211.c | 37 +
 1 file changed, 25 insertions(+), 12 deletions(-)

diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index 77a65ed..1d59676 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -819,13 +819,12 @@ static int nl80211_get_mode_cb(struct nl_msg *msg, void 
*arg)
 
 static int nl80211_get_mode(const char *ifname, int *buf)
 {
-   char *res;
-
*buf = IWINFO_OPMODE_UNKNOWN;
 
-   res = nl80211_phy2ifname(ifname);
+   if (!nl80211_is_ifname(ifname))
+   return -1;
 
-   nl80211_request(res ? res : ifname, NL80211_CMD_GET_INTERFACE, 0,
+   nl80211_request(ifname, NL80211_CMD_GET_INTERFACE, 0,
nl80211_get_mode_cb, buf);
 
return (*buf == IWINFO_OPMODE_UNKNOWN) ? -1 : 0;
@@ -1242,14 +1241,15 @@ static int nl80211_get_ssid_bssid_cb(struct nl_msg 
*msg, void *arg)
 
 static int nl80211_get_ssid(const char *ifname, char *buf)
 {
-   char *res;
struct nl80211_ssid_bssid sb = { .ssid = (unsigned char *)buf };
 
+   if (!nl80211_is_ifname(ifname))
+   return -1;
+
/* try to find ssid from scan dump results */
-   res = nl80211_phy2ifname(ifname);
sb.ssid[0] = 0;
 
-   nl80211_request(res ? res : ifname, NL80211_CMD_GET_SCAN, NLM_F_DUMP,
+   nl80211_request(ifname, NL80211_CMD_GET_SCAN, NLM_F_DUMP,
nl80211_get_ssid_bssid_cb, );
 
/* failed, try to find from hostapd info */
@@ -1259,7 +1259,7 @@ static int nl80211_get_ssid(const char *ifname, char *buf)
 
/* failed, try to obtain Mesh ID */
if (sb.ssid[0] == 0)
-   iwinfo_ubus_query(res ? res : ifname, "mesh_id",
+   iwinfo_ubus_query(ifname, "mesh_id",
  sb.ssid, IWINFO_ESSID_MAX_SIZE + 1);
 
return (sb.ssid[0] == 0) ? -1 : 0;
@@ -1267,18 +1267,19 @@ static int nl80211_get_ssid(const char *ifname, char 
*buf)
 
 static int nl80211_get_bssid(const char *ifname, char *buf)
 {
-   char *res, bssid[sizeof("FF:FF:FF:FF:FF:FF\0")];
+   char bssid[sizeof("FF:FF:FF:FF:FF:FF\0")];
struct nl80211_ssid_bssid sb = { };
 
-   res = nl80211_phy2ifname(ifname);
+   if (!nl80211_is_ifname(ifname))
+   return -1;
 
/* try to obtain mac address via NL80211_CMD_GET_INTERFACE */
-   nl80211_request(res ? res : ifname, NL80211_CMD_GET_INTERFACE, 0,
+   nl80211_request(ifname, NL80211_CMD_GET_INTERFACE, 0,
nl80211_get_macaddr_cb, );
 
/* failed, try to find bssid from scan dump results */
if (sb.bssid[0] == 0)
-   nl80211_request(res ? res : ifname,
+   nl80211_request(ifname,
NL80211_CMD_GET_SCAN, NLM_F_DUMP,
nl80211_get_ssid_bssid_cb, );
 
@@ -1570,6 +1571,9 @@ static int nl80211_get_bitrate(const char *ifname, int 
*buf)
 {
struct nl80211_rssi_rate rr;
 
+   if (!nl80211_is_ifname(ifname))
+   return -1;
+
nl80211_fill_signal(ifname, );
 
if (rr.rate_samples)
@@ -1585,6 +1589,9 @@ static int nl80211_get_signal(const char *ifname, int 
*buf)
 {
struct nl80211_rssi_rate rr;
 
+   if (!nl80211_is_ifname(ifname))
+   return -1;
+
nl80211_fill_signal(ifname, );
 
if (rr.rssi_samples)
@@ -1674,6 +1681,9 @@ static int nl80211_get_quality(const char *ifname, int 
*buf)
 
 static int nl80211_get_quality_max(const char *ifname, int *buf)
 {
+   if (!nl80211_is_ifname(ifname))
+   return -1;
+
/* The cfg80211 wext compat layer assumes a maximum
 * quality of 70 */
*buf = 70;
@@ -1813,6 +1823,9 @@ static int nl80211_get_encryption(const char *ifname, 
char *buf)
 
struct iwinfo_crypto_entry *c = (struct iwinfo_crypto_entry *)buf;
 
+   if (!nl80211_is_ifname(ifname))
+   return -1;
+
/* WPA supplicant */
if (nl80211_wpactl_query(ifname,
"pairwise_cipher", wpa_pairwise,  sizeof(wpa_pairwise),
-- 
2.35.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH 1/2] iwinfo: nl80211: don't guess if a name is an ifname

2022-11-15 Thread Andre Heider
It's too slow to do it all over again and again, especially with e.g.
luci constantly polling.

Before:
$ time iwinfo phy0 info
real0m 0.54s
$ time iwinfo radio0 info
real0m 0.70s
$ time ubus call luci-rpc getWirelessDevices
real0m 0.67s

After:
$ time iwinfo phy0 info
real0m 0.04s
$ time iwinfo radio0 info
real0m 0.09s
$ time ubus call luci-rpc getWirelessDevices
real0m 0.17s

Signed-off-by: Andre Heider 
---
 iwinfo_nl80211.c | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index 77fddee..77a65ed 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -22,6 +22,7 @@
  * Parts of this code are derived from the Linux iw utility.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -411,6 +412,15 @@ out:
return idx;
 }
 
+static bool nl80211_is_ifname(const char *name)
+{
+   struct stat st;
+   char buffer[PATH_MAX];
+
+   snprintf(buffer, sizeof(buffer), "/sys/class/net/%s", name);
+   return !lstat(buffer, );
+}
+
 static struct nl80211_msg_conveyor * nl80211_msg(const char *ifname,
  int cmd, int flags)
 {
@@ -426,10 +436,9 @@ static struct nl80211_msg_conveyor * nl80211_msg(const 
char *ifname,
 
if (!strncmp(ifname, "mon.", 4))
ifidx = if_nametoindex([4]);
-   else
+   else if (nl80211_is_ifname(ifname))
ifidx = if_nametoindex(ifname);
-
-   if (!ifidx) {
+   else {
phyidx = nl80211_phy_idx_from_phy(ifname);
if (phyidx < 0)
phyidx = nl80211_phy_idx_from_uci(ifname);
-- 
2.35.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] iwinfo: nl80211: fix wpa supplicant ctrl socket permissions

2022-11-15 Thread Andre Heider

On 15/11/2022 15:42, Christian Marangi wrote:

On Sun, Nov 13, 2022 at 09:33:46PM +0100, Andre Heider wrote:

No data at all can currently be read from the control socket.
Set up the permission exactly like hostapd's wpa_cli utility to fix it.

Among other this fixes a mesh's encryption being shown as "None".

Signed-off-by: Andre Heider 


I wonder, can we have some tested-by tag for this? Maybe ask some user
to test this and check if it does fix the mesh encryption problem?


Maybe? ;)

Let's see, I asked about it here:
https://github.com/openwrt/openwrt/issues/10687

Regards,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH iwinfo 1/4] iwinfo: fix wrong error message

2022-11-15 Thread Andre Heider

On 13/11/2022 16:11, Andre Heider wrote:

In this case the specified backend couldn't be found.

Signed-off-by: Andre Heider 


Please ignore this one, it's wrong and the error message is correct as-is.

The other patches still stand.

Thanks,
Andre


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] iwinfo: nl80211: fix wpa supplicant ctrl socket permissions

2022-11-13 Thread Andre Heider
No data at all can currently be read from the control socket.
Set up the permission exactly like hostapd's wpa_cli utility to fix it.

Among other this fixes a mesh's encryption being shown as "None".

Signed-off-by: Andre Heider 
---
 iwinfo_nl80211.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index aa92382..77fddee 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -938,6 +938,18 @@ static int nl80211_wpactl_connect(const char *ifname, 
struct sockaddr_un *local)
sprintf(remote.sun_path, "/var/run/wpa_supplicant-%s/%s",
ifname, ifname);
 
+   /* Set client socket file permissions so that bind() creates the client
+   * socket with these permissions and there is no need to try to change
+   * them with chmod() after bind() which would have potential issues with
+   * race conditions. These permissions are needed to make sure the server
+   * side (wpa_supplicant or hostapd) can reply to the control interface
+   * messages.
+   *
+   * The lchown() calls below after bind() are also part of the needed
+   * operations to allow the response to go through. Those are using the
+   * no-deference-symlinks version to avoid races. */
+   fchmod(sock, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
+
if (fcntl(sock, F_SETFD, fcntl(sock, F_GETFD) | FD_CLOEXEC) < 0)
{
close(sock);
@@ -966,6 +978,10 @@ static int nl80211_wpactl_connect(const char *ifname, 
struct sockaddr_un *local)
return -1;
}
 
+   /* Set group even if we do not have privileges to change owner */
+   lchown(local->sun_path, -1, 101);
+   lchown(local->sun_path, 101, 101);
+
return sock;
 }
 
-- 
2.35.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH iwinfo 3/4] iwinfo: nl80211: read usb vendor and product id as subsystem ids

2022-11-13 Thread Andre Heider
USB devices can now be added to devices.txt as:
0x | 0x | vendor id | product id | ...

Signed-off-by: Andre Heider 
---
 devices.txt  | 2 ++
 iwinfo_nl80211.c | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/devices.txt b/devices.txt
index b01e4ac..8796276 100644
--- a/devices.txt
+++ b/devices.txt
@@ -200,3 +200,5 @@
 0x14e4 0xaa52 0x14e4 0xaa520  0  "Broadcom" "BCM43602"
 0x02d0 0xa9a6 0x 0x0  0  "Cypress"  "CYW43455"
 0x1ae9 0x0310 0x1ae9 0x0  0  "Wilocity" "Wil6210"
+# USB devices
+# 0x | 0x | vendor id | product id | ...
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index fcc48dd..aa92382 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -3463,7 +3463,9 @@ static int nl80211_get_hardware_id(const char *ifname, 
char *buf)
{ "vendor", >vendor_id },
{ "device", >device_id },
{ "subsystem_vendor", >subsystem_vendor_id },
-   { "subsystem_device", >subsystem_device_id }
+   { "subsystem_device", >subsystem_device_id },
+   { "../idVendor", >subsystem_vendor_id },
+   { "../idProduct", >subsystem_device_id },
};
 
memset(id, 0, sizeof(*id));
-- 
2.35.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH iwinfo 2/4] iwinfo: nl80211: skip ftd and mtd lookups for usb devices

2022-11-13 Thread Andre Heider
Determine if parent device of the phy belongs to the "usb" subsystem
and skip those expensive lookups accordingly. Those don't even make any
sense for usb devices.

With a 5.15 kernel the mtd lookup even spams dmesg with:
"mtdblock: MTD device 'factory' is NAND, please consider using UBI block
devices instead."

Before:
sys 0m 3.56s$

After:
sys 0m 0.09s

Signed-off-by: Andre Heider 
---
 iwinfo_nl80211.c | 29 +
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index ba92530..fcc48dd 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -3455,7 +3455,8 @@ static int nl80211_hardware_id_from_fdt(struct 
iwinfo_hardware_id *id, const cha
 static int nl80211_get_hardware_id(const char *ifname, char *buf)
 {
struct iwinfo_hardware_id *id = (struct iwinfo_hardware_id *)buf;
-   char *phy, num[8], path[PATH_MAX];
+   char *phy, *p, num[8], link[PATH_MAX], path[PATH_MAX];
+   bool usb = false;
int i;
 
struct { const char *path; uint16_t *dest; } lookup[] = {
@@ -3470,6 +3471,16 @@ static int nl80211_get_hardware_id(const char *ifname, 
char *buf)
/* Try to determine the phy name from the given interface */
phy = nl80211_ifname2phy(ifname);
 
+   snprintf(path, sizeof(path), "/sys/class/%s/%s/device/subsystem",
+phy ? "ieee80211" : "net",
+phy ? phy : ifname);
+
+   if (realpath(path, link)) {
+   p = strrchr(link, '/');
+   if (p)
+   usb = strcmp(p + 1, "usb") == 0;
+   }
+
for (i = 0; i < ARRAY_SIZE(lookup); i++)
{
snprintf(path, sizeof(path), "/sys/class/%s/%s/device/%s",
@@ -3480,14 +3491,16 @@ static int nl80211_get_hardware_id(const char *ifname, 
char *buf)
*lookup[i].dest = strtoul(num, NULL, 16);
}
 
-   /* Failed to obtain hardware IDs, try FDT */
-   if (id->vendor_id == 0 || id->device_id == 0)
-   if (!nl80211_hardware_id_from_fdt(id, ifname))
-   return 0;
+   if (!usb) {
+   /* Failed to obtain hardware IDs, try FDT */
+   if (id->vendor_id == 0 || id->device_id == 0)
+   if (!nl80211_hardware_id_from_fdt(id, ifname))
+   return 0;
 
-   /* Failed to obtain hardware IDs, search board config */
-   if (id->vendor_id == 0 || id->device_id == 0)
-   return iwinfo_hardware_id_from_mtd(id);
+   /* Failed to obtain hardware IDs, search board config */
+   if (id->vendor_id == 0 || id->device_id == 0)
+   return iwinfo_hardware_id_from_mtd(id);
+   }
 
return 0;
 }
-- 
2.35.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH iwinfo 1/4] iwinfo: fix wrong error message

2022-11-13 Thread Andre Heider
In this case the specified backend couldn't be found.

Signed-off-by: Andre Heider 
---
 iwinfo_cli.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/iwinfo_cli.c b/iwinfo_cli.c
index dca86cf..d8851d7 100644
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -972,7 +972,7 @@ int main(int argc, char **argv)
 
if (!iw)
{
-   fprintf(stderr, "No such wireless device: %s\n", 
argv[1]);
+   fprintf(stderr, "No such wireless backend: %s\n", 
argv[1]);
rv = 1;
}
else
-- 
2.35.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH iwinfo 4/4] devices: add usb device MediaTek MT7921AU

2022-11-13 Thread Andre Heider
Add USB PID/VID as found on e.g. Comfast CF-953AX.

Signed-off-by: Andre Heider 
---
 devices.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/devices.txt b/devices.txt
index 8796276..7674f85 100644
--- a/devices.txt
+++ b/devices.txt
@@ -202,3 +202,4 @@
 0x1ae9 0x0310 0x1ae9 0x0  0  "Wilocity" "Wil6210"
 # USB devices
 # 0x | 0x | vendor id | product id | ...
+0x 0x 0x0e8d 0x79610  0  "MediaTek" "MT7921AU"
-- 
2.35.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] mac80211: fix masking nested A-MSDU support for mesh

2022-10-21 Thread Andre Heider

On 20/10/2022 12:52, Andre Heider wrote:

CONFIG_MAC80211_MESH isn't defined for this package, rendering the patch
useless. Match protecting the access of sta_info.mesh with the very same
define declaring it.


To elaborate some more:
CPTCFG_ comes from the backports project[0] and is already used is 
multiple patches for this package:

$ git grep CPTCFG_ package/kernel/mac80211/patches

Thanks,
Andre

[0] 
https://git.kernel.org/pub/scm/linux/kernel/git/backports/backports.git/tree/devel/doc/kconfig-operation?h=v5.15.58-1#n87


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re:

2022-10-21 Thread Andre Heider

On 20/10/2022 17:44, Christian Marangi wrote:

On Thu, Oct 20, 2022 at 05:40:37PM +0200, Christian Marangi wrote:

Merged in master with commit 9f27c33e4ede180ee6d0ad359d12f4849bd342f2.

Thanks.




Sorry had to rebase... real commit is edbf9f156f85c90c899a576aff8a9f8aa506d4a5


Nice, thanks!

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] uboot-fritz4040: build FritzBox 7520 variant

2022-10-20 Thread Andre Heider

Anyone? Bueller?

On 27/09/2022 13:35, Andre Heider wrote:

Gentle Ping!

On 15/07/2022 07:59, Andre Heider wrote:

Support was added as variant of 7530 (DEVICE_ALT0_*) in:
cb6f4be1 "ipq40xx: add support for FRITZ!Box 7520"

u-boot has a distinct config for it [0], built it.

[0] https://github.com/chunkeey/FritzBox-4040-UBOOT/pull/6

Signed-off-by: Andre Heider 
---
  package/boot/uboot-fritz4040/Makefile | 7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/package/boot/uboot-fritz4040/Makefile 
b/package/boot/uboot-fritz4040/Makefile

index 3aa08081bf..e3ff69d0e4 100644
--- a/package/boot/uboot-fritz4040/Makefile
+++ b/package/boot/uboot-fritz4040/Makefile
@@ -41,6 +41,11 @@ define U-Boot/fritz4040
    BUILD_DEVICES:=avm_fritzbox-4040
  endef
+define U-Boot/fritz7520
+  NAME:=FritzBox 7520
+  BUILD_DEVICES:=avm_fritzbox-7530
+endef
+
  define U-Boot/fritz7530
    NAME:=FritzBox 7530
    BUILD_DEVICES:=avm_fritzbox-7530
@@ -72,6 +77,6 @@ define Package/u-boot/install
  $(INSTALL_BIN) $(PKG_BUILD_DIR)/upload-to-f4040.sh $(1)/
  endef
-UBOOT_TARGETS := fritz1200 fritz3000 fritz4040 fritz7530
+UBOOT_TARGETS := fritz1200 fritz3000 fritz4040 fritz7520 fritz7530
  $(eval $(call BuildPackage/U-Boot))





___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] mac80211: fix masking nested A-MSDU support for mesh

2022-10-20 Thread Andre Heider
CONFIG_MAC80211_MESH isn't defined for this package, rendering the patch
useless. Match protecting the access of sta_info.mesh with the very same
define declaring it.

Fixes 45109f69a6 "mac80211: fix compile error when mesh is disabled"
Signed-off-by: Andre Heider 
---
 .../800-mac80211-mask-nested-A-MSDU-support-for-mesh.patch  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/package/kernel/mac80211/patches/subsys/800-mac80211-mask-nested-A-MSDU-support-for-mesh.patch
 
b/package/kernel/mac80211/patches/subsys/800-mac80211-mask-nested-A-MSDU-support-for-mesh.patch
index e7da94c9cd..a17d6f6161 100644
--- 
a/package/kernel/mac80211/patches/subsys/800-mac80211-mask-nested-A-MSDU-support-for-mesh.patch
+++ 
b/package/kernel/mac80211/patches/subsys/800-mac80211-mask-nested-A-MSDU-support-for-mesh.patch
@@ -24,7 +24,7 @@ Signed-off-by: David Bauer 
  
 -  capab = u16_encode_bits(amsdu, IEEE80211_ADDBA_PARAM_AMSDU_MASK);
 +  capab = 0;
-+#ifdef CONFIG_MAC80211_MESH
++#ifdef CPTCFG_MAC80211_MESH
 +  if (!sta->mesh)
 +#endif
 +  capab = u16_encode_bits(amsdu, 
IEEE80211_ADDBA_PARAM_AMSDU_MASK);
-- 
2.35.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] uboot-fritz4040: build FritzBox 7520 variant

2022-09-27 Thread Andre Heider

Gentle Ping!

On 15/07/2022 07:59, Andre Heider wrote:

Support was added as variant of 7530 (DEVICE_ALT0_*) in:
cb6f4be1 "ipq40xx: add support for FRITZ!Box 7520"

u-boot has a distinct config for it [0], built it.

[0] https://github.com/chunkeey/FritzBox-4040-UBOOT/pull/6

Signed-off-by: Andre Heider 
---
  package/boot/uboot-fritz4040/Makefile | 7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/package/boot/uboot-fritz4040/Makefile 
b/package/boot/uboot-fritz4040/Makefile
index 3aa08081bf..e3ff69d0e4 100644
--- a/package/boot/uboot-fritz4040/Makefile
+++ b/package/boot/uboot-fritz4040/Makefile
@@ -41,6 +41,11 @@ define U-Boot/fritz4040
BUILD_DEVICES:=avm_fritzbox-4040
  endef
  
+define U-Boot/fritz7520

+  NAME:=FritzBox 7520
+  BUILD_DEVICES:=avm_fritzbox-7530
+endef
+
  define U-Boot/fritz7530
NAME:=FritzBox 7530
BUILD_DEVICES:=avm_fritzbox-7530
@@ -72,6 +77,6 @@ define Package/u-boot/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/upload-to-f4040.sh $(1)/
  endef
  
-UBOOT_TARGETS := fritz1200 fritz3000 fritz4040 fritz7530

+UBOOT_TARGETS := fritz1200 fritz3000 fritz4040 fritz7520 fritz7530
  
  $(eval $(call BuildPackage/U-Boot))



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] build: fix grep v3.8 "stray \" warning

2022-09-07 Thread Andre Heider
This fixes the reoccuring warning:
grep: warning: stray \ before /

Signed-off-by: Andre Heider 
---
 Makefile  | 2 +-
 target/sdk/files/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 3ac110367d..c1b0b0a840 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path 
to the OpenWrt dir
 
 world:
 
-DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep 
-E '\/usr' | head -n 1)
+DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep 
-E '/usr' | head -n 1)
 export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
 
 ifneq ($(OPENWRT_BUILD),1)
diff --git a/target/sdk/files/Makefile b/target/sdk/files/Makefile
index a710ca5f51..d1d97d4287 100644
--- a/target/sdk/files/Makefile
+++ b/target/sdk/files/Makefile
@@ -14,7 +14,7 @@ export TOPDIR LC_ALL LANG SDK
 
 world:
 
-DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep 
-E '\/usr' | head -n 1)
+DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep 
-E '/usr' | head -n 1)
 export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
 
 ifneq ($(OPENWRT_BUILD),1)
-- 
2.35.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] arm-trusted-firmware-mvebu: stop cluttering Image Builder

2022-08-31 Thread Andre Heider

Hi Tomasz,

On 31/08/2022 12:18, Tomasz Maciej Nowak wrote:

From: Tomasz Maciej Nowak 

All contents of staging_dir/image are included in Image Builder (IB) in
case some binary needs to be included in final image. But in case of
this package, all sources are stored there and those clutter the final
tarball of IB for no reason. Those sources are not used during image
creation and are just dead weight. To put it in perspective, the IB for
21.02.0 is 158 MiB, 22.03.0-rc6 is 366 MiB and snapshot is over 620 MiB!
To fix it, put them in package build directory, so they won't end up
included in IB tarball.


nice catch, I wasn't even aware that it affected IB.


Signed-off-by: Tomasz Maciej Nowak 


One comment below, with that this is
Reviewed-by: Andre Heider 


---
  .../boot/arm-trusted-firmware-mvebu/Makefile  | 41 +--
  1 file changed, 20 insertions(+), 21 deletions(-)

diff --git a/package/boot/arm-trusted-firmware-mvebu/Makefile 
b/package/boot/arm-trusted-firmware-mvebu/Makefile
index dba4836a6b98..8f4713eb40ef 100644
--- a/package/boot/arm-trusted-firmware-mvebu/Makefile
+++ b/package/boot/arm-trusted-firmware-mvebu/Makefile
@@ -108,12 +108,12 @@ TFA_TARGETS:= \
udpu
  
  TFA_MAKE_FLAGS += \

-   
CROSS_CM3=$(STAGING_DIR_IMAGE)/$(CM3_GCC_NAME)-$(CM3_GCC_RELEASE)-$(CM3_GCC_VERSION)/bin/arm-none-eabi-
 \
+   
CROSS_CM3=$(PKG_BUILD_DIR)/$(CM3_GCC_NAME)-$(CM3_GCC_RELEASE)-$(CM3_GCC_VERSION)/bin/arm-none-eabi-
 \
BL33=$(STAGING_DIR_IMAGE)/$(UBOOT)-u-boot.bin \
-   MV_DDR_PATH=$(STAGING_DIR_IMAGE)/$(MV_DDR_NAME) \
-   WTP=$(STAGING_DIR_IMAGE)/$(A3700_UTILS_NAME) \
-   
WTMI_IMG=$(STAGING_DIR_IMAGE)/$(MOX_BB_NAME)-$(MOX_BB_RELEASE)/wtmi_app.bin \
-   CRYPTOPP_PATH=$(STAGING_DIR_IMAGE)/$(CRYPTOPP_NAME) \
+   MV_DDR_PATH=$(PKG_BUILD_DIR)/$(MV_DDR_NAME) \
+   WTP=$(PKG_BUILD_DIR)/$(A3700_UTILS_NAME) \
+   
WTMI_IMG=$(PKG_BUILD_DIR)/$(MOX_BB_NAME)-$(MOX_BB_RELEASE)/wtmi_app.bin \
+   CRYPTOPP_PATH=$(PKG_BUILD_DIR)/$(CRYPTOPP_NAME) \
USE_COHERENT_MEM=0 \
FIP_ALIGN=0x100 \
DDR_TOPOLOGY=$(DDR_TOPOLOGY) \
@@ -190,11 +190,11 @@ endef
  
  define Build/Clean

rm -rf \
-   $(STAGING_DIR_IMAGE)/$(CRYPTOPP_NAME) \
-   $(STAGING_DIR_IMAGE)/$(A3700_UTILS_NAME) \
-   $(STAGING_DIR_IMAGE)/$(MV_DDR_NAME) \
-   $(STAGING_DIR_IMAGE)/$(MOX_BB_NAME)-$(MOX_BB_RELEASE) \
-   
$(STAGING_DIR_IMAGE)/$(CM3_GCC_NAME)-$(CM3_GCC_RELEASE)-$(CM3_GCC_VERSION)
+   $(PKG_BUILD_DIR)/$(CRYPTOPP_NAME) \
+   $(PKG_BUILD_DIR)/$(A3700_UTILS_NAME) \
+   $(PKG_BUILD_DIR)/$(MV_DDR_NAME) \
+   $(PKG_BUILD_DIR)/$(MOX_BB_NAME)-$(MOX_BB_RELEASE) \
+   
$(PKG_BUILD_DIR)/$(CM3_GCC_NAME)-$(CM3_GCC_RELEASE)-$(CM3_GCC_VERSION)
  endef


The whole custom Build/Clean target can be removed now, the default one 
will wipe PKG_BUILD_DIR for us.


  
  define Build/Prepare

@@ -207,23 +207,22 @@ define Build/Prepare
  
  	$(call Build/Prepare/Default,)
  
-	mkdir -p $(STAGING_DIR_IMAGE)

-   $(TAR) -C $(STAGING_DIR_IMAGE) -xf $(DL_DIR)/$(CRYPTOPP_SOURCE)
-   $(TAR) -C $(STAGING_DIR_IMAGE) -xf $(DL_DIR)/$(A3700_UTILS_SOURCE)
-   $(call 
PatchDir/Default,$(STAGING_DIR_IMAGE)/$(A3700_UTILS_NAME),./patches-a3700-utils)
-   $(TAR) -C $(STAGING_DIR_IMAGE) -xf $(DL_DIR)/$(MV_DDR_SOURCE)
-   $(call 
PatchDir/Default,$(STAGING_DIR_IMAGE)/$(MV_DDR_NAME),./patches-mv-ddr-marvell)
-   $(TAR) -C $(STAGING_DIR_IMAGE) -xf $(DL_DIR)/$(MOX_BB_SOURCE)
-   $(call 
PatchDir/Default,$(STAGING_DIR_IMAGE)/$(MOX_BB_NAME)-$(MOX_BB_RELEASE),./patches-mox-boot-builder)
-   $(TAR) -C $(STAGING_DIR_IMAGE) -xf $(DL_DIR)/$(CM3_GCC_SOURCE)
+   $(TAR) -C $(PKG_BUILD_DIR) -xf $(DL_DIR)/$(CRYPTOPP_SOURCE)
+   $(TAR) -C $(PKG_BUILD_DIR) -xf $(DL_DIR)/$(A3700_UTILS_SOURCE)
+   $(call 
PatchDir/Default,$(PKG_BUILD_DIR)/$(A3700_UTILS_NAME),./patches-a3700-utils)
+   $(TAR) -C $(PKG_BUILD_DIR) -xf $(DL_DIR)/$(MV_DDR_SOURCE)
+   $(call 
PatchDir/Default,$(PKG_BUILD_DIR)/$(MV_DDR_NAME),./patches-mv-ddr-marvell)
+   $(TAR) -C $(PKG_BUILD_DIR) -xf $(DL_DIR)/$(MOX_BB_SOURCE)
+   $(call 
PatchDir/Default,$(PKG_BUILD_DIR)/$(MOX_BB_NAME)-$(MOX_BB_RELEASE),./patches-mox-boot-builder)
+   $(TAR) -C $(PKG_BUILD_DIR) -xf $(DL_DIR)/$(CM3_GCC_SOURCE)
  endef
  
  define Build/Compile

+$(MAKE) \
-   
CROSS_CM3=$(STAGING_DIR_IMAGE)/$(CM3_GCC_NAME)-$(CM3_GCC_RELEASE)-$(CM3_GCC_VERSION)/bin/arm-none-eabi-
 \
+   
CROSS_CM3=$(PKG_BUILD_DIR)/$(CM3_GCC_NAME)-$(CM3_GCC_RELEASE)-$(CM3_GCC_VERSION)/bin/arm-none-eabi-
 \
WTMI_VERSION=$(MOX_BB_RELEASE) \
CRYPTOPP_PATH=$PWD/cryptopp/ \
-   -C $(STAGING_DIR_IMAGE)/$(MOX_BB_NAME)-$(MOX_BB_RELEASE

[PATCH] uboot-fritz4040: build FritzBox 7520 variant

2022-07-15 Thread Andre Heider
Support was added as variant of 7530 (DEVICE_ALT0_*) in:
cb6f4be1 "ipq40xx: add support for FRITZ!Box 7520"

u-boot has a distinct config for it [0], built it.

[0] https://github.com/chunkeey/FritzBox-4040-UBOOT/pull/6

Signed-off-by: Andre Heider 
---
 package/boot/uboot-fritz4040/Makefile | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/package/boot/uboot-fritz4040/Makefile 
b/package/boot/uboot-fritz4040/Makefile
index 3aa08081bf..e3ff69d0e4 100644
--- a/package/boot/uboot-fritz4040/Makefile
+++ b/package/boot/uboot-fritz4040/Makefile
@@ -41,6 +41,11 @@ define U-Boot/fritz4040
   BUILD_DEVICES:=avm_fritzbox-4040
 endef
 
+define U-Boot/fritz7520
+  NAME:=FritzBox 7520
+  BUILD_DEVICES:=avm_fritzbox-7530
+endef
+
 define U-Boot/fritz7530
   NAME:=FritzBox 7530
   BUILD_DEVICES:=avm_fritzbox-7530
@@ -72,6 +77,6 @@ define Package/u-boot/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/upload-to-f4040.sh $(1)/
 endef
 
-UBOOT_TARGETS := fritz1200 fritz3000 fritz4040 fritz7530
+UBOOT_TARGETS := fritz1200 fritz3000 fritz4040 fritz7520 fritz7530
 
 $(eval $(call BuildPackage/U-Boot))
-- 
2.35.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] openssl: bump to 1.1.1p

2022-06-23 Thread Andre Heider
Changes between 1.1.1o and 1.1.1p [21 Jun 2022]

  *) In addition to the c_rehash shell command injection identified in
 CVE-2022-1292, further bugs where the c_rehash script does not
 properly sanitise shell metacharacters to prevent command injection have 
been
 fixed.

 When the CVE-2022-1292 was fixed it was not discovered that there
 are other places in the script where the file names of certificates
 being hashed were possibly passed to a command executed through the shell.

 This script is distributed by some operating systems in a manner where
 it is automatically executed.  On such operating systems, an attacker
 could execute arbitrary commands with the privileges of the script.

 Use of the c_rehash script is considered obsolete and should be replaced
 by the OpenSSL rehash command line tool.
 (CVE-2022-2068)
 [Daniel Fiala, Tomáš Mráz]

  *) When OpenSSL TLS client is connecting without any supported elliptic
 curves and TLS-1.3 protocol is disabled the connection will no longer fail
 if a ciphersuite that does not use a key exchange based on elliptic
 curves can be negotiated.
 [Tomáš Mráz]

Signed-off-by: Andre Heider 
---
 package/libs/openssl/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index b496f2f9f2..ed618568a4 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openssl
 PKG_BASE:=1.1.1
-PKG_BUGFIX:=o
+PKG_BUGFIX:=p
 PKG_VERSION:=$(PKG_BASE)$(PKG_BUGFIX)
 PKG_RELEASE:=$(AUTORELEASE)
 PKG_USE_MIPS16:=0
@@ -25,7 +25,7 @@ PKG_SOURCE_URL:= \
ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/ \
ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/old/$(PKG_BASE)/
 
-PKG_HASH:=9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f
+PKG_HASH:=bf61b62aaa66c7c7639942a94de4c9ae8280c08f17d4eac2e44644d9fc8ace6f
 
 PKG_LICENSE:=OpenSSL
 PKG_LICENSE_FILES:=LICENSE
-- 
2.35.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH 1/4] uclient-fetch: --header option to pass additional raw HTTP headers

2022-06-23 Thread Andre Heider

On 22/06/2022 12:26, Sergey Ponomarev wrote:

Hi Andre and Jo-Philipp,

Please add the calloc() error handler yourself because I'm not
experienced in C and I haven't time. But for you this may be just 5
minutes.


Sure, I had a look, and while adding that wrapper isn't a problem, the 
patchset itself has an issue:


--header 'Content-type: foo/bar' doesn't work as intended because 
'Content-type: application/x-www-form-urlencoded' is still added too. So 
both headers are sent, which breaks my use case.


I may be looking at that, but I'm time constrained myself too at the moment.

Cheers,
Andre


The feature is very important from my point of view. The first version
I sent a year(s?) ago but still no progress.
If there are any problems please let me know

On Wed, 22 Jun 2022 at 08:33, Andre Heider  wrote:


Hi Sergey,

any update on this series? I'd be interested in the --header option.

Thanks,
Andre

On 10/05/2022 11:11, Jo-Philipp Wich wrote:

Hi Sergey,

a minor nitpick inline below.

On 5/9/22 11:59 PM, Sergey Ponomarev wrote:

You can add a custom HTTP header(s) to request:

  wget --header='Authorization: Bearer TOKEN' \
  --header='If-Modified-Since: Wed, 9 May 2021 12:16:00 GMT' \
  https://example.com/

Some headers like Authorization or User-Agent may be already set by --password 
or --user-agent.
We may override them but it's a protection from user itself.
To keep code concise the logic omitted.

Signed-off-by: Sergey Ponomarev 
---
[...]
+case L_HEADER:
+if (!raw_headers) {
+/* Max possible count of headers is the 
count of args (argc) - 2
+ Since the first arg is program and last 
is a URL.
+ But user may forget the URL and 
raw_headers is null terminated so allocate argc */
+raw_headers = calloc(argc, sizeof(char *));


Please handle a possible calloc() error here. Maybe consider introducing an
"xalloc()" or similar helper which wraps calloc() and invokes abort() on NULL
return.


+}
+raw_headers[raw_headers_count] = optarg;
+raw_headers_count++;
+break;
  case L_POST_DATA:
  post_data = optarg;
  break;
[...]



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel








___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH 1/3] hostapd: update to 2022-05-08

2022-06-22 Thread Andre Heider

Seemed easy enough, see attached patch, this fixes it for me.

Cheers,
AndreFrom 988fcb2a8bfcdca439040e157cd040e5f3dccc51 Mon Sep 17 00:00:00 2001
From: Andre Heider 
Date: Wed, 22 Jun 2022 13:09:07 +0200
Subject: [PATCH] hostapd: fix compilation with OPENSSL_NO_DEPRECATED

This fixes the build with OpenSSL 1.1.1:
../src/crypto/crypto_openssl.c: In function 'crypto_rsa_oaep_sha256_decrypt':
../src/crypto/crypto_openssl.c:4404:49: error: 'RSA_PKCS1_OAEP_PADDING' undeclared (first use in this function)

Signed-off-by: Andre Heider 
---
 .../hostapd/patches/991-fix-compile.patch  | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/package/network/services/hostapd/patches/991-fix-compile.patch b/package/network/services/hostapd/patches/991-fix-compile.patch
index d08efa08bd..7fd0e01af1 100644
--- a/package/network/services/hostapd/patches/991-fix-compile.patch
+++ b/package/network/services/hostapd/patches/991-fix-compile.patch
@@ -17,3 +17,21 @@
  	return 0;
  }
  
+--- a/src/crypto/crypto_openssl.c
 b/src/crypto/crypto_openssl.c
+@@ -16,6 +16,7 @@
+ #include 
+ #include 
+ #include 
++#include 
+ #include 
+ #ifdef CONFIG_ECC
+ #include 
+@@ -25,7 +26,6 @@
+ #include 
+ #include 
+ #include 
+-#include 
+ #include 
+ #include 
+ #else /* OpenSSL version >= 3.0 */
-- 
2.35.1

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH 1/3] hostapd: update to 2022-05-08

2022-06-22 Thread Andre Heider

On 12/06/2022 03:29, Stefan Lippers-Hollmann wrote:

Hi

On 2022-06-12, Stefan Lippers-Hollmann wrote:

On 2022-06-07, David Bauer wrote:

Update hostapd to Git HEAD from 2022-05-08. This allows us to take
advantage of background radar-detection ad well as BSS color collision.


I'm noticing a build failure for wpad-full-openssl since this patch
series went in, Debian/ unstable build host (x86_64), x86_64 build
target:


Looking into this further suggests OPENSSL_NO_DEPRECATED=y being the
cause of this build failure


hostapd still fails to build with OPENSSL_NO_DEPRECATED=y, can this be 
fixed or does it indeed require that setting?


Cheers,
Andre



[...]

../src/crypto/crypto_openssl.c: In function 'crypto_rsa_oaep_sha256_encrypt':
../src/crypto/crypto_openssl.c:4003:13: warning: implicit declaration of 
function 'EVP_PKEY_CTX_set_rsa_padding'; did you mean 
'EVP_PKEY_CTX_set_dh_pad'? [-Wimplicit-function-declaration]
  4003 | EVP_PKEY_CTX_set_rsa_padding(pkctx, RSA_PKCS1_OAEP_PADDING) 
<= 0 ||
   | ^~~~
   | EVP_PKEY_CTX_set_dh_pad
../src/crypto/crypto_openssl.c:4003:49: error: 'RSA_PKCS1_OAEP_PADDING' 
undeclared (first use in this function)
  4003 | EVP_PKEY_CTX_set_rsa_padding(pkctx, RSA_PKCS1_OAEP_PADDING) 
<= 0 ||
   | ^~
../src/crypto/crypto_openssl.c:4003:49: note: each undeclared identifier is 
reported only once for each function it appears in
../src/crypto/crypto_openssl.c:4004:13: warning: implicit declaration of 
function 'EVP_PKEY_CTX_set_rsa_oaep_md'; did you mean 
'EVP_PKEY_CTX_set_dh_kdf_md'? [-Wimplicit-function-declaration]
  4004 | EVP_PKEY_CTX_set_rsa_oaep_md(pkctx, EVP_sha256()) <= 0 ||
   | ^~~~
   | EVP_PKEY_CTX_set_dh_kdf_md
../src/crypto/crypto_openssl.c: In function 'crypto_rsa_oaep_sha256_decrypt':
../src/crypto/crypto_openssl.c:4040:49: error: 'RSA_PKCS1_OAEP_PADDING' 
undeclared (first use in this function)
  4040 | EVP_PKEY_CTX_set_rsa_padding(pkctx, RSA_PKCS1_OAEP_PADDING) 
<= 0 ||
   | ^~
make[4]: *** [../src/build.rules:86: 
/tmp/pkg/openwrt/build_dir/target-x86_64_musl/hostapd-wpad-full-openssl/hostapd-2022-05-08-b859b9bc/build/hostapd/src/crypto/crypto_openssl.o]
 Error 1


[...]


CONFIG_OPENSSL_NO_DEPRECATED=y
# CONFIG_OPENSSL_WITH_DEPRECATED is not set


and indeed, setting

CONFIG_OPENSSL_WITH_DEPRECATED=y
# CONFIG_OPENSSL_NO_DEPRECATED is not set

instead avoids the build failure.

Sorry for the noise.

Regards
Stefan Lippers-Hollmann

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH 1/4] uclient-fetch: --header option to pass additional raw HTTP headers

2022-06-21 Thread Andre Heider

Hi Sergey,

any update on this series? I'd be interested in the --header option.

Thanks,
Andre

On 10/05/2022 11:11, Jo-Philipp Wich wrote:

Hi Sergey,

a minor nitpick inline below.

On 5/9/22 11:59 PM, Sergey Ponomarev wrote:

You can add a custom HTTP header(s) to request:

 wget --header='Authorization: Bearer TOKEN' \
 --header='If-Modified-Since: Wed, 9 May 2021 12:16:00 GMT' \
 https://example.com/

Some headers like Authorization or User-Agent may be already set by --password 
or --user-agent.
We may override them but it's a protection from user itself.
To keep code concise the logic omitted.

Signed-off-by: Sergey Ponomarev 
---
[...]
+   case L_HEADER:
+   if (!raw_headers) {
+   /* Max possible count of headers is the 
count of args (argc) - 2
+Since the first arg is program and 
last is a URL.
+But user may forget the URL and 
raw_headers is null terminated so allocate argc */
+   raw_headers = calloc(argc, sizeof(char 
*));


Please handle a possible calloc() error here. Maybe consider introducing an
"xalloc()" or similar helper which wraps calloc() and invokes abort() on NULL
return.


+   }
+   raw_headers[raw_headers_count] = optarg;
+   raw_headers_count++;
+   break;
case L_POST_DATA:
post_data = optarg;
break;
[...]



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: libubox: How to terminate uloop orderly?

2022-05-20 Thread Andre Heider

On 17/05/2022 11:04, Koch, Alexander via openwrt-devel wrote:

So I'm wondering: what is the correct way to terminate the uloop?


It's been a while and details are vague, but this works for me:
https://github.com/openwrt/openwrt/blob/master/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c#L857-L883

ubus_init()/ubus_deinit() are called from the main thread, and the 
thread function just contains uloop_run().


Cheers,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: Best VSDL modem-router to target?

2021-12-03 Thread Andre Heider

Hi,

On 03/12/2021 05:28, Andrew Punch wrote:

Hi,

I live in a small unit, so the usual advice to have a separate VDSL modem, 
router and ATA isn't great space wise.

Is there an all-in-one VDSL modem + router + ATA that would be worth targeting?


for DSL on OpenWrt, lantiq is your only option. The default image ships 
with a DSL firmware, so it's working out of the box. But it's common for 
users to replace it for better performance, see [0].


There're a few devices which have even the ata working via asterisk, but 
if you're going asterisk you might as well forget about that analogue 
crap :P


As far as supported devices go, the BT homehub v5a is the only one with 
5ghz wifi, which is why it's still a popular device.


The next best thing seems to be the fritzbox 7530 (the older model, NOT 
the ax variant), which is more powerful device. While it's supported, 
the newer dsl chipset isn't. There's work going on to change that though 
[1].


The fritzbox 7520 (aka 1&1 homeserver) seems to be the same hardware, it 
can even be flashed to the vendor 7530 firmware. And that's rather cheap 
compared to the 7530. That'll be my choice if you don't mind using some 
not-yet-merged patches.


Cheers,
Andre

[0] 
https://forum.openwrt.org/t/lantiq-vrx200-xdsl-firmware-recommendation-thread/52937
[1] 
https://forum.openwrt.org/t/adding-support-for-vrx518-and-maybe-vrx320/55160



I am happy to purchase a spare one for anyone on the mailing list and I'm a 
software engineer who has done minor kernel fixes.

Thanks
-Andrew

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel




___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: Missing -lpthread for libssl / libcrypto (LibreSSL) when compiling U-Boot

2021-10-22 Thread Andre Heider

Hi,

I whipped up a proposal:
https://github.com/openwrt/openwrt/pull/4709

Cheers,
Andre


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: Missing -lpthread for libssl / libcrypto (LibreSSL) when compiling U-Boot

2021-10-13 Thread Andre Heider

How about the two attached patches?
That's on top of the libressl bump for u-boot.

I only built uboot-mvebu with these and didn't check if this works for 
the others.


On 13/10/2021 10:10, Rafał Miłecki wrote:

*** Introduction ***

OpenWrt compiles U-Boot with some host tools like mkimage.


*** Problem ***

   HOSTLD  tools/mkimage
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: 
/home/rmilecki/openwrt/openwrt-master-bcm4908/staging_dir/host/lib/libssl.a(ssl_init.o): 
in function `OPENSSL_init_ssl':

ssl_init.c:(.text+0x59): undefined reference to `pthread_once'
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: 
/home/rmilecki/openwrt/openwrt-master-bcm4908/staging_dir/host/lib/libcrypto.a(libcrypto_la-crypto_init.o): 
in function `OPENSSL_init_crypto':

crypto_init.c:(.text+0x51): undefined reference to `pthread_once'
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: 
/home/rmilecki/openwrt/openwrt-master-bcm4908/staging_dir/host/lib/libcrypto.a(libcrypto_la-conf_sap.o): 
in function `OpenSSL_config':

conf_sap.c:(.text+0xbc): undefined reference to `pthread_once'

It seems that OpenWrt wants to compile mkimage with statically linked
LibreSSL.

LibreSSL seems to be compiled OK:
$ grep Libs staging_dir/host/lib/pkgconfig/libcrypto.pc
Libs: -L${libdir} -lcrypto
Libs.private: -lresolv -lpthread

Related:
9bfca308268e ("uboot-mvebu: Fix build with libressl 2.7.2")


*** Manual pkg-config test ***

I'm not sure if I test it correctly but output looks OK:

$ 
PATH=/home/rmilecki/openwrt/openwrt-master-bcm4908/staging_dir/host/bin:$PATH 
./staging_dir/host/bin/pkg-config --libs libssl libcrypto

-L/lib64 -lssl -lcrypto

$ 
PATH=/home/rmilecki/openwrt/openwrt-master-bcm4908/staging_dir/host/bin:$PATH 
./staging_dir/host/bin/pkg-config --static --libs libssl libcrypto
-L/lib64 -lssl -lresolv -lpthread -lcrypto -L/lib64 -lresolv -lpthread 
-lcrypto -lresolv -lpthread



*** U-Boot code ***

In tools/Makefile it uses:

HOSTLOADLIBES_mkimage += \
 $(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo 
"-lssl -lcrypto")


Above works for most cases. Adding -pthread was rejected, see:
[U-Boot] [PATCH] Add -pthread to HOSTLOADLIBES_mkimage
https://patchwork.ozlabs.org/project/uboot/patch/befd3339-5c21-407c-85ba-86ba2bb50...@icognize.de/ 



I guess OpenWrt is special case with static linking.

First of all I'm not sure if that pkg-config shouldn't use --static. I
have no idea how to tell U-Boot we want mkimage built static.

Secondly for some reason pkg-config doesn't seem to work from U-Boot
build context. After dropping "2> /dev/null" I can see:

Package libssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libssl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libssl', required by 'virtual:world', not found
Package 'libcrypto', required by 'virtual:world', not found
Package libssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libssl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libssl', required by 'virtual:world', not found
Package 'libcrypto', required by 'virtual:world', not found
Package libssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libssl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libssl', required by 'virtual:world', not found
Package 'libcrypto', required by 'virtual:world', not found
From f7cfe8ee04803b245fc17735b0f2778c243fabe1 Mon Sep 17 00:00:00 2001
From: Andre Heider 
Date: Wed, 13 Oct 2021 14:00:53 +0200
Subject: [PATCH 1/2] libressl: update pc files to always include private
 libraries

These are required for static linking, and usually returned by
`pkg-config --static'. Since we're only building static libraries we add
them here to not have to worry about fixing all users.

Signed-off-by: Andre Heider 
---
 ...-to-always-include-private-libraries.patch | 37 +++
 1 file changed, 37 insertions(+)
 create mode 100644 tools/libressl/patches/0001-Update-pc-files-to-always-include-private-libraries.patch

diff --git a/tools/libressl/patches/0001-Update-pc-files-to-always-include-private-libraries.patch b/tools/libressl/patches/0001-Update-pc-files-to-always-include-private-libraries.patch
new file mode 100644
index 00..72f2c16b37
--- /dev/null
+++ b/tools/libressl/patches/0001-Update-pc-files-to-always-include-private-libraries.patch
@@ -0,0 +1,37 @@
+From cbbc9a9b1de6900ece3c3842e1c22d8ed250ee3f Mon Sep 17 00:00:00 2001
+From: Andre Heider 
+Date: Wed, 13 Oct 2021 13:57:17 +0200
+Subject: [PATCH] Update pc files to always include private libraries
+
+These are required for static linking, and usually returned by
+`pkg-config --static'. Since we're only building static libraries we add
+them here to not have to worry about fixing all users.
+
+Signed-off-by: Andr

Re: Missing -lpthread for libssl / libcrypto (LibreSSL) when compiling U-Boot

2021-10-13 Thread Andre Heider

Close, but:

u-boot 2021.10 seems to use OpenSSL 1.1.x APIs, and the currently used 
LibreSSL 3.3.4 doesn't include those. Updating LibreSSL with [0] plus 
this patch makes it work:


diff --git a/include/u-boot.mk b/include/u-boot.mk
index c0a1e87bf3..8c6941b88a 100644
--- a/include/u-boot.mk
+++ b/include/u-boot.mk
@@ -45,6 +45,9 @@ UBOOT_MAKE_FLAGS = \
HOSTCC="$(HOSTCC)" \
HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) -std=gnu11" \
HOSTLDFLAGS="$(HOST_LDFLAGS)" \
+   STAGING_PREFIX="$(STAGING_DIR_HOST)" \
+   PKG_CONFIG_PATH="$(STAGING_DIR_HOST)/lib/pkgconfig" \
+   PKG_CONFIG_LIBDIR="$(STAGING_DIR_HOST)/lib/pkgconfig" \
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='')

 define Build/U-Boot/Target
diff --git a/package/boot/uboot-mvebu/Makefile 
b/package/boot/uboot-mvebu/Makefile

index e9578a492b..b186d0bde9 100644
--- a/package/boot/uboot-mvebu/Makefile
+++ b/package/boot/uboot-mvebu/Makefile
@@ -53,8 +53,6 @@ UBOOT_TARGETS:= \
espressobin \
uDPU

-Build/Exports:=$(Host/Exports)
-
 define Build/Configure
# enable additional options beyond _defconfig
echo CONFIG_CMD_SETEXPR=y >> 
$(PKG_BUILD_DIR)/configs/$(UBOOT_CONFIG)_defconfig



There may be a better way to fix Host/Exports.

And package/boot/uboot-mvebu/patches/210-link-libcrypto-static.patch is 
still required.


[0] 
http://patchwork.ozlabs.org/project/openwrt/patch/20210922201852.4546-1-ros...@gmail.com/


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: Missing -lpthread for libssl / libcrypto (LibreSSL) when compiling U-Boot

2021-10-13 Thread Andre Heider

On 13/10/2021 10:30, Rafał Miłecki wrote:

On 13.10.2021 10:23, Andre Heider wrote:

On 13/10/2021 10:10, Rafał Miłecki wrote:

*** Manual pkg-config test ***

I'm not sure if I test it correctly but output looks OK:

$ 
PATH=/home/rmilecki/openwrt/openwrt-master-bcm4908/staging_dir/host/bin:$PATH 
./staging_dir/host/bin/pkg-config --libs libssl libcrypto

-L/lib64 -lssl -lcrypto


I think -L should point at ./staging_dir/host/lib or whereever the 
libraris from the libressl host package are, since we're building 
against that and not against your system open/libressl?


This may be a result of my manual pkg-config call with hacked PATH. I'm
not sure how to fully emulate OpenWrt's context for calling it. That was
meant only for a quick test of --static switch (which appears to work).

I guess if we can make:
1. pkg-config work in U-Boot building context
2. U-Boot use --static

That could fix building issue.


This appears to fix 1) a little, I think the Host/Exports are not 
applied are expected:


diff --git a/include/u-boot.mk b/include/u-boot.mk
index c0a1e87bf3..85d3fbd73c 100644
--- a/include/u-boot.mk
+++ b/include/u-boot.mk
@@ -45,6 +45,9 @@ UBOOT_MAKE_FLAGS = \
HOSTCC="$(HOSTCC)" \
HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) -std=gnu11" \
HOSTLDFLAGS="$(HOST_LDFLAGS)" \
+   STAGING_PREFIX="$(HOST_BUILD_PREFIX)" \
+ 
PKG_CONFIG_PATH="$(STAGING_DIR_HOST)/lib/pkgconfig:$(HOST_BUILD_PREFIX)/lib/pkgconfig" 
\

+   PKG_CONFIG_LIBDIR="$(HOST_BUILD_PREFIX)/lib/pkgconfig" \
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='')

 define Build/U-Boot/Target
diff --git a/package/boot/uboot-mvebu/Makefile 
b/package/boot/uboot-mvebu/Makefile

index e9578a492b..b186d0bde9 100644
--- a/package/boot/uboot-mvebu/Makefile
+++ b/package/boot/uboot-mvebu/Makefile
@@ -53,8 +53,6 @@ UBOOT_TARGETS:= \
espressobin \
uDPU

-Build/Exports:=$(Host/Exports)
-
 define Build/Configure
# enable additional options beyond _defconfig
echo CONFIG_CMD_SETEXPR=y >> 
$(PKG_BUILD_DIR)/configs/$(UBOOT_CONFIG)_defconfig



u-boot still doesn't build its tools with that, but that might be a 
different issue.


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: Missing -lpthread for libssl / libcrypto (LibreSSL) when compiling U-Boot

2021-10-13 Thread Andre Heider

Hi Rafał,

On 13/10/2021 10:10, Rafał Miłecki wrote:

*** Manual pkg-config test ***

I'm not sure if I test it correctly but output looks OK:

$ 
PATH=/home/rmilecki/openwrt/openwrt-master-bcm4908/staging_dir/host/bin:$PATH 
./staging_dir/host/bin/pkg-config --libs libssl libcrypto

-L/lib64 -lssl -lcrypto


I think -L should point at ./staging_dir/host/lib or whereever the 
libraris from the libressl host package are, since we're building 
against that and not against your system open/libressl?


Cheers,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH v3] arm-trusted-firmware-mvebu: CZ.NIC's Secure Firmware bump to v2021.09.07

2021-10-08 Thread Andre Heider

Hi Josef,

On 14/09/2021 20:42, Josef Schlehofer wrote:

On 14. 09. 21 20:21, Andre Heider wrote:

Building it requires cryptocpp though, which doesn't yet exists as
package. We don't really care about crypto since we're building just
an untrusted firmware, so I opted to revert to using the binary
instead. This is on top of the x86_64 binary toolchain too anyway.


This one:
https://github.com/BKPepe/openwrt/commit/42322bebc5804a99b60a5bb54200eeba0587076d
worked for me. But I didn't send it yet as I didn't do run-time testing
yet. I will do it soon.


any update on this?

We could update u-boot to the current release and include your patches too.

Cheers,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: kernel: add a bridge feature for filtering BPDU packets on ports

2021-09-28 Thread Andre Heider

On 28/09/2021 12:20, Andre Heider wrote:
fyi brport/proxyarp was still "0" too, which probably means that the 
netidf condition "if (up && ifname != vif->ifname)" doesn't eval to true 
as that's the only spot setting "dev->wireless_proxyarp".


That pointed me in the right direction, attached netifd patch fixes the 
issue for me. lol.From 76b389cde9de3208936c8cc4ed35cf42992a8dc7 Mon Sep 17 00:00:00 2001
From: Andre Heider 
Date: Tue, 28 Sep 2021 13:29:27 +0200
Subject: [PATCH] wireless: fix applying wireless devices attributes on hotplug
 events

Hotplug events pass their own 'ifname' copy, so we need to compare the
strings, not just the pointers.

Signed-off-by: Andre Heider 
---
 wireless.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/wireless.c b/wireless.c
index fbd42ed..4b1fb8e 100644
--- a/wireless.c
+++ b/wireless.c
@@ -328,7 +328,7 @@ static void wireless_interface_handle_link(struct wireless_interface *vif, const
 	if (!ifname)
 		ifname = vif->ifname;
 
-	if (up && ifname != vif->ifname) {
+	if (up && !strcmp(ifname, vif->ifname)) {
 		struct device *dev = device_get(ifname, 2);
 		if (dev) {
 			dev->wireless_isolate = vif->isolate;
-- 
2.33.0

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: kernel: add a bridge feature for filtering BPDU packets on ports

2021-09-28 Thread Andre Heider
Sorry for the spam, last mail for now as I found some log entries that 
might be related (HEAD=6cd54254e4bbe7ed2b71c17cb2d54ad7b0bc2991):


kern.warn kernel: [   55.820638] netlink: 'iw': attribute type 302 has 
an invalid length.
kern.warn kernel: [   56.354160] netlink: 'iw': attribute type 302 has 
an invalid length.




daemon.notice wpa_supplicant[2028]: mesh: MESH-PEER-CONNECTED $mac
kern.warn kernel: [   76.849584] [ cut here ]
kern.warn kernel: [   76.852852] WARNING: CPU: 0 PID: 5298 at 
net/core/flow_dissector.c:975 __skb_flow_dissect+0x21c/0x1894
kern.warn kernel: [   76.862457] Modules linked in: ath9k ath9k_common 
xt_connlimit pppoe ppp_async nf_conncount iptable_nat ath9k_hw 
ath10k_pci ath10k_core ath xt_state xt_nat xt_helper xt_conntrack 
xt_connmark xt_connbytes xt_REDIRECT xt_MASQUERADE xt_CT wireguard pppox 
ppp_generic pl2303 nf_nat nf_conntrack_netlink nf_conntrack mac80211 
libchacha20poly1305 libblake2s ipt_REJECT ftdi_sio cfg80211 
ath9k_pci_owl_loader xt_time xt_tcpudp xt_tcpmss xt_statistic xt_recent 
xt_multiport xt_mark xt_mac xt_limit xt_length xt_hl xt_ecn xt_dscp 
xt_comment xt_TCPMSS xt_LOG xt_HL xt_DSCP xt_CLASSIFY usbserial slhc 
sch_cake poly1305_mips nf_reject_ipv4 nf_log_ipv4 nf_log_common 
nf_defrag_ipv6 nf_defrag_ipv4 libcurve25519_generic libblake2s_generic 
iptable_raw iptable_mangle iptable_filter ipt_ECN ip_tables crc_ccitt 
compat chacha_mips sch_tbf sch_ingress sch_htb sch_hfsc em_u32 cls_u32 
cls_tcindex cls_route cls_matchall cls_fw cls_flow cls_basic act_skbedit 
act_mirred act_gact drv_dsl_cpe_api ledtrig_usbport drv_mei_cpe
kern.warn kernel: [   76.863496]  xt_set x_tables ip_set_list_set 
ip_set_hash_netportnet ip_set_hash_netport ip_set_hash_netnet 
ip_set_hash_netiface ip_set_hash_net ip_set_hash_mac 
ip_set_hash_ipportnet ip_set_hash_ipportip ip_set_hash_ipport 
ip_set_hash_ipmark ip_set_hash_ip ip_set_bitmap_port ip_set_bitmap_ipmac 
ip_set_bitmap_ip ip_set nfnetlink ifb ip6_udp_tunnel udp_tunnel br2684 
atm zram zsmalloc drv_ifxos sha256_generic libsha256 seqiv 
jitterentropy_rng drbg hmac cmac dwc2 roles ohci_platform ohci_hcd 
fsl_mph_dr_of ehci_platform ehci_fsl ehci_hcd gpio_button_hotplug
kern.warn kernel: [   76.998750] CPU: 0 PID: 5298 Comm: sh Not tainted 
5.10.64 #0
kern.warn kernel: [   77.004303] Stack : 80a28218   
 8079d544  0001 80083264
kern.warn kernel: [   77.012650] 000c   
a4d9dc81 80c0bbc4 0001 80c0bb58 a4d9dc81
kern.warn kernel: [   77.021006]   8076c9b0 
80c0ba00 efff   ffea
kern.warn kernel: [   77.029362] 0156 80c0ba08 8083 
 8083 8000  8077
kern.warn kernel: [   77.037712] 0009 8083  
 0018 0030  80a0

kern.warn kernel: [   77.046074] ...
kern.warn kernel: [   77.048506] Call Trace:
kern.warn kernel: [   77.050965] [<8000bf54>] show_stack+0x40/0x128
kern.warn kernel: [   77.055408] [<8035de84>] dump_stack+0x9c/0xcc
kern.warn kernel: [   77.059776] [<80030bd8>] __warn+0xc0/0x12c
kern.warn kernel: [   77.063841] [<80030cb4>] warn_slowpath_fmt+0x70/0xd8
kern.warn kernel: [   77.068817] [<804c7b90>] 
__skb_flow_dissect+0x21c/0x1894

kern.warn kernel: [   77.074122] [<804c9380>] __skb_get_hash+0x7c/0x128
kern.warn kernel: [   77.079043] [<82a3aa28>] 
ieee80211_schedule_txq+0x784/0xa24 [mac80211]

kern.warn kernel: [   77.085490]
kern.warn kernel: [   77.086994] ---[ end trace f966cd7c4a091c65 ]---



daemon.notice hostapd: $bgnmaster: interface state COUNTRY_UPDATE->ENABLED
daemon.notice hostapd: $bgnmaster: AP-ENABLED
daemon.notice hostapd: $nacmaster: interface state COUNTRY_UPDATE->ENABLED
daemon.notice hostapd: $nacmaster: AP-ENABLED
daemon.notice netifd: Network device '$bgnmaster' link is up
daemon.notice netifd: Network device '$guestmaster' link is up
daemon.notice netifd: Interface 'guests' is enabled
daemon.notice netifd: Interface 'guests' is setting up now
daemon.notice netifd: Interface 'guests' is now up
daemon.notice netifd: Interface 'guests' has link connectivity
kern.info kernel: [   71.979551] br-lan: port 5($nacmaster) entered 
disabled state
daemon.notice netifd: radio0 (2821): command failed: Link has been 
severed (-67)
daemon.notice netifd: radio0 (2821): command failed: Link has been 
severed (-67)

kern.info kernel: [   72.905264] br-lan: port 7(mesh) entered blocking state
kern.info kernel: [   72.909227] br-lan: port 7(mesh) entered disabled state
kern.info kernel: [   72.915258] device mesh entered promiscuous mode

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: kernel: add a bridge feature for filtering BPDU packets on ports

2021-09-28 Thread Andre Heider

On 28/09/2021 12:08, Andre Heider wrote:

On 28/09/2021 09:54, Andre Heider wrote:

[...]

But if I now switch back to what I thought was a known working 
version, it still doesn't work. So maybe it's something different 
entirely, like a race condition or order of setting up things that 
doesn't hit on every boot?


Updated again to current master without reverts. Problem exists after 
boot, and it turns out hairpin_mode wasn't set for both APs.


After:
echo "1" > /sys/class/net/$nacmaster/brport/hairpin_mode
echo "1" > /sys/class/net/$bgnmaster/brport/hairpin_mode

It starts working again!

Cheers,
Andre


fyi brport/proxyarp was still "0" too, which probably means that the 
netidf condition "if (up && ifname != vif->ifname)" doesn't eval to true 
as that's the only spot setting "dev->wireless_proxyarp".


Dunno if all that is related due to my "ifname" config?
For all "config wifi-iface" I have "option ifname" set to the same value 
as "option ssid".


Cheers,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: kernel: add a bridge feature for filtering BPDU packets on ports

2021-09-28 Thread Andre Heider

On 28/09/2021 09:54, Andre Heider wrote:

[...]

But if I now switch back to what I thought was a known working version, 
it still doesn't work. So maybe it's something different entirely, like 
a race condition or order of setting up things that doesn't hit on every 
boot?


Updated again to current master without reverts. Problem exists after 
boot, and it turns out hairpin_mode wasn't set for both APs.


After:
echo "1" > /sys/class/net/$nacmaster/brport/hairpin_mode
echo "1" > /sys/class/net/$bgnmaster/brport/hairpin_mode

It starts working again!

Cheers,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: kernel: add a bridge feature for filtering BPDU packets on ports

2021-09-28 Thread Andre Heider

On 27/09/2021 22:25, Martin Blumenstingl wrote:

On Sat, Sep 25, 2021 at 6:53 PM Martin Blumenstingl
 wrote:


Hi Andre,

On Sat, Sep 25, 2021 at 1:17 PM Andre Heider  wrote:
[...]

With these 3 reverted (on top of da5bb885 "toolchain/gcc: switch to
version 11 by default") it works again:
Revert "hostapd: let netifd set bridge port attributes for snooping"
Revert "netifd: update to the latest version"
Revert "kernel: add a bridge feature for filtering BPDU packets on ports"

thanks for investigating this!


With just the first 2 reverts it's still broken.

I can confirm that reverting all three fixes communication between
clients on the ath10k 802.11ac card on Home Hub 5A
communication between a client connected to the ath9k 802.11bgn card
and ath10k worked fine even without the revert on the Home Hub 5A.

it seems that commit 6cd54254e4bbe7ed2b71c17cb2d54ad7b0bc2991
("netifd: update to the latest version") fixed this issue for me


Thanks, but unfortunately it doesn't for me.

And it would have been surprising, since my last reverts hinted that not 
enabling bpdu is the problem, but maybe the kernel patch that introduced 
the bpdu knob.


With current master as of now (without any reverts) some clients still 
can't reach others (this time I tried one connected to the bgn master 
reaching another connected to the ap). They can still reach the router 
though and hence have internet access.


If I ping 192.168.0.100 from such a client (192.168.0.226 in this case) 
I see this on the router:

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on $bgnmaster, link-type EN10MB (Ethernet), capture size 
262144 bytes

09:02:30.369914 IP 192.168.0.226.137 > 192.168.0.1.137: UDP, length 68
09:02:30.370345 IP 192.168.0.1 > 192.168.0.226: ICMP 192.168.0.1 udp 
port 137 unreachable, length 104
09:02:30.498273 ARP, Request who-has 192.168.0.100 tell 192.168.0.226, 
length 28
09:02:31.493549 ARP, Request who-has 192.168.0.100 tell 192.168.0.226, 
length 28
09:02:32.491840 ARP, Request who-has 192.168.0.100 tell 192.168.0.226, 
length 28


Looks like a missing arp reply.

Also from the router:
$ cat /sys/class/net/*/brport/bpdu_filter
0
0
0
0
0
0
0

But if I now switch back to what I thought was a known working version, 
it still doesn't work. So maybe it's something different entirely, like 
a race condition or order of setting up things that doesn't hit on every 
boot?


Puzzled,
Andre


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: kernel: add a bridge feature for filtering BPDU packets on ports

2021-09-25 Thread Andre Heider

Hi Felix,

I think there's a problem with
a4b5bc20 "kernel: add a bridge feature for filtering BPDU packets on ports"

My lantiq/xrx200 router has 2 radios with 2 wireless networks each:
* nac
  * mesh point
  * master
* bgn
  * master
  * master (guests, isolated)

The first three are bridged with the lan ports.

Before the patch in question clients connected to the bgn master can 
reach clients connected to the nac master (like a simple ping). With the 
patch that doesn't work anymore. Only clients connected to the nac 
master can reach other clients (but weirdly that doesn't seem to apply 
to all clients, only some).


Toggling the isolated option on the guest master doesn't make a 
difference (as it seems to have a similar effect).


With these 3 reverted (on top of da5bb885 "toolchain/gcc: switch to 
version 11 by default") it works again:

Revert "hostapd: let netifd set bridge port attributes for snooping"
Revert "netifd: update to the latest version"
Revert "kernel: add a bridge feature for filtering BPDU packets on ports"

With just the first 2 reverts it's still broken.

Any idea?

Cheers,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH v3] arm-trusted-firmware-mvebu: CZ.NIC's Secure Firmware bump to v2021.09.07

2021-09-15 Thread Andre Heider

Hi Josef,

On 15/09/2021 19:11, Josef Schlehofer wrote:


On 15. 09. 21 15:21, Andre Heider wrote:

On 14/09/2021 20:42, Josef Schlehofer wrote:


On 14. 09. 21 20:21, Andre Heider wrote:

On 14/09/2021 19:59, Hauke Mehrtens wrote:

On 9/14/21 10:50 AM, sean lee wrote:

bump version and remove patches that have been applied

176d701 wtmi: Wait 1s after putting PHYs INTn pin low
2eeccfe wtmi: Change comment describing reset workaround
e8c94a5 wtmi: Count RAM size from both CS0 and CS1
995979e wtmi: Rename macro
e29eb29 wtmi: soc: Fix start_ap_workaround() for TF-A with debug
81245ed wtmi: Use constant name PLAT_MARVELL_MAILBOX_BASE
18ccb83 wtmi: Do a proper UART reset with clock change as described
in spec
15ff106 avs: Validate VDD value from OTP
3f33626 fix: clock: a3700: change pwm clock for 600/600 and 1200/750
preset
fb5e436 wtmi: uart: fix UART baudrate divisor calculation

Signed-off-by: sean lee 
---
    .../boot/arm-trusted-firmware-mvebu/Makefile  |  4 +-
    ...ix-UART-baudrate-divisor-calculation.patch | 66
---
    ...change-pwm-clock-for-600-600-and-120.patch | 48 --
    .../102-avs-Validate-VDD-value-from-OTP.patch | 52 ---
    4 files changed, 2 insertions(+), 168 deletions(-)
    delete mode 100644
package/boot/arm-trusted-firmware-mvebu/patches-mox-boot-builder/100-wtmi-uart-fix-UART-baudrate-divisor-calculation.patch


    delete mode 100644
package/boot/arm-trusted-firmware-mvebu/patches-mox-boot-builder/101-fix-clock-a3700-change-pwm-clock-for-600-600-and-120.patch


    delete mode 100644
package/boot/arm-trusted-firmware-mvebu/patches-mox-boot-builder/102-avs-Validate-VDD-value-from-OTP.patch





Hi,

This is a little bit unrelated.

Is the source code of image/a3700-utils/wtptp/linux/tbb_linux
available   somewhere? I wanted to build mvebu/cortex53 on an aarch64
host system and this file is only available for x86_64 and the
compilation fails.


Yeah, its source is bundled, and actually atf upstream recently
switched to building it instead of using the checked in binary.

TBH, it was outdated, buggy and recent changes were not included in the
bundled library as said here
https://github.com/MarvellEmbeddedProcessors/A3700-utils-marvell/commit/f014428f4bf7feafec1dcc4c37506d847718649a



Building it requires cryptocpp though, which doesn't yet exists as
package. We don't really care about crypto since we're building just
an untrusted firmware, so I opted to revert to using the binary
instead. This is on top of the x86_64 binary toolchain too anyway.


This one:
https://github.com/BKPepe/openwrt/commit/42322bebc5804a99b60a5bb54200eeba0587076d

worked for me. But I didn't send it yet as I didn't do run-time testing
yet. I will do it soon.



Hi Andre,


Maybe use a cryptocpp release tarball instead of a git clone? That'll
be faster and a smaller download.


I was thinking about it too, but I noticed that everything (=
a3700-utils, etc.) we are downloading uses git clone while looking at
the Makefile. This would be exception, so I keep it that way, but I
don't mind git clone/release tarball.


mox-boot-builder is the exception (intentionally btw, a git tree 
backfires there, as it's using submodules and the OpenWrt buildsystem 
fetches all of those), but I don't care too much about what to use for 
cryptocpp here.



And I think you also need to bump the a3700-utils version to include
the build fixes?

Yes and no. My idea was to send a single PR with two commits (cryptopp
and update a3700-utils) once I could do run-time testing on Turris MOX
either ESPRESSObin first with cryptopp and then with the update itself
to be sure that it didn't break anything else, but still. We can do it
in two steps, I mean PRs. Both approaches are OK with me.


Ok, sounds good to me!



Josef




See
package/boot/arm-trusted-firmware-mvebu/patches/001-imagetool.patch.

If you get rid of that patch and add cryptocpp/host it should build it
automatically and use that instead. But that still leaves the issue
with the binary toolchain, no?



Building flash image
/bin/sh: 1:
/home/ubuntu/openwrt/openwrt/staging_dir/target-aarch64_cortex-a53_musl/image/a3700-utils/wtptp/linux/tbb_linux:

Exec format error
make[4]: *** [plat/marvell/armada/a3k/common/a3700_common.mk:186:
/home/ubuntu/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/trusted-firmware-a-espressobin-512mb/trusted-firmware-a-2.5/build/a3700/release/flash-image.bin]

Error 2


ubuntu@instance-20210910-2105:~/openwrt/openwrt$ file
/home/ubuntu/openwrt/openwrt/staging_dir/target-aarch64_cortex-a53_musl/image/a3700-utils/wtptp/linux/tbb_linux


/home/ubuntu/openwrt/openwrt/staging_dir/target-aarch64_cortex-a53_musl/image/a3700-utils/wtptp/linux/tbb_linux:

ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically
linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux
2.6.24, BuildID[sha1]=8169eedf6eef4b1993a65a180baee3d31660c000, with
debug_info, not stripped
ubuntu@instance-20210910-2105

Re: [PATCH v3] arm-trusted-firmware-mvebu: CZ.NIC's Secure Firmware bump to v2021.09.07

2021-09-15 Thread Andre Heider

On 14/09/2021 20:42, Josef Schlehofer wrote:


On 14. 09. 21 20:21, Andre Heider wrote:

On 14/09/2021 19:59, Hauke Mehrtens wrote:

On 9/14/21 10:50 AM, sean lee wrote:

bump version and remove patches that have been applied

176d701 wtmi: Wait 1s after putting PHYs INTn pin low
2eeccfe wtmi: Change comment describing reset workaround
e8c94a5 wtmi: Count RAM size from both CS0 and CS1
995979e wtmi: Rename macro
e29eb29 wtmi: soc: Fix start_ap_workaround() for TF-A with debug
81245ed wtmi: Use constant name PLAT_MARVELL_MAILBOX_BASE
18ccb83 wtmi: Do a proper UART reset with clock change as described
in spec
15ff106 avs: Validate VDD value from OTP
3f33626 fix: clock: a3700: change pwm clock for 600/600 and 1200/750
preset
fb5e436 wtmi: uart: fix UART baudrate divisor calculation

Signed-off-by: sean lee 
---
   .../boot/arm-trusted-firmware-mvebu/Makefile  |  4 +-
   ...ix-UART-baudrate-divisor-calculation.patch | 66
---
   ...change-pwm-clock-for-600-600-and-120.patch | 48 --
   .../102-avs-Validate-VDD-value-from-OTP.patch | 52 ---
   4 files changed, 2 insertions(+), 168 deletions(-)
   delete mode 100644
package/boot/arm-trusted-firmware-mvebu/patches-mox-boot-builder/100-wtmi-uart-fix-UART-baudrate-divisor-calculation.patch

   delete mode 100644
package/boot/arm-trusted-firmware-mvebu/patches-mox-boot-builder/101-fix-clock-a3700-change-pwm-clock-for-600-600-and-120.patch

   delete mode 100644
package/boot/arm-trusted-firmware-mvebu/patches-mox-boot-builder/102-avs-Validate-VDD-value-from-OTP.patch




Hi,

This is a little bit unrelated.

Is the source code of image/a3700-utils/wtptp/linux/tbb_linux
available   somewhere? I wanted to build mvebu/cortex53 on an aarch64
host system and this file is only available for x86_64 and the
compilation fails.


Yeah, its source is bundled, and actually atf upstream recently
switched to building it instead of using the checked in binary.

TBH, it was outdated, buggy and recent changes were not included in the
bundled library as said here
https://github.com/MarvellEmbeddedProcessors/A3700-utils-marvell/commit/f014428f4bf7feafec1dcc4c37506d847718649a


Building it requires cryptocpp though, which doesn't yet exists as
package. We don't really care about crypto since we're building just
an untrusted firmware, so I opted to revert to using the binary
instead. This is on top of the x86_64 binary toolchain too anyway.


This one:
https://github.com/BKPepe/openwrt/commit/42322bebc5804a99b60a5bb54200eeba0587076d
worked for me. But I didn't send it yet as I didn't do run-time testing
yet. I will do it soon.


Maybe use a cryptocpp release tarball instead of a git clone? That'll be 
faster and a smaller download.


And I think you also need to bump the a3700-utils version to include the 
build fixes?




See package/boot/arm-trusted-firmware-mvebu/patches/001-imagetool.patch.

If you get rid of that patch and add cryptocpp/host it should build it
automatically and use that instead. But that still leaves the issue
with the binary toolchain, no?



Building flash image
/bin/sh: 1:
/home/ubuntu/openwrt/openwrt/staging_dir/target-aarch64_cortex-a53_musl/image/a3700-utils/wtptp/linux/tbb_linux:
Exec format error
make[4]: *** [plat/marvell/armada/a3k/common/a3700_common.mk:186:
/home/ubuntu/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/trusted-firmware-a-espressobin-512mb/trusted-firmware-a-2.5/build/a3700/release/flash-image.bin]
Error 2


ubuntu@instance-20210910-2105:~/openwrt/openwrt$ file
/home/ubuntu/openwrt/openwrt/staging_dir/target-aarch64_cortex-a53_musl/image/a3700-utils/wtptp/linux/tbb_linux

/home/ubuntu/openwrt/openwrt/staging_dir/target-aarch64_cortex-a53_musl/image/a3700-utils/wtptp/linux/tbb_linux:
ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically
linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux
2.6.24, BuildID[sha1]=8169eedf6eef4b1993a65a180baee3d31660c000, with
debug_info, not stripped
ubuntu@instance-20210910-2105:~/openwrt/openwrt$ uname -a
Linux instance-20210910-2105 5.11.0-1017-oracle #18~20.04.1-Ubuntu
SMP Fri Aug 27 11:09:43 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
ubuntu@instance-20210910-2105:~/openwrt/openwrt$

Hauke




___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel




___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] arm-trusted-firmware-mvebu: Add hash for aarch64 cm3-gcc

2021-09-15 Thread Andre Heider

On 15/09/2021 14:42, Hauke Mehrtens wrote:

This adds the hash also for the aarch64 toolchain in addition for the
x86_64 toolchain. This gets the build on a Linux aarch64 host one step
further.

Signed-off-by: Hauke Mehrtens 
---
  package/boot/arm-trusted-firmware-mvebu/Makefile | 4 
  1 file changed, 4 insertions(+)

diff --git a/package/boot/arm-trusted-firmware-mvebu/Makefile 
b/package/boot/arm-trusted-firmware-mvebu/Makefile
index 2369a1930a0b..ebbf1ef5b8b7 100644
--- a/package/boot/arm-trusted-firmware-mvebu/Makefile
+++ b/package/boot/arm-trusted-firmware-mvebu/Makefile
@@ -166,7 +166,11 @@ 
CM3_GCC_SOURCE=$(CM3_GCC_NAME)-$(CM3_GCC_RELEASE)-$(CM3_GCC_VERSION).tar.xz
  define Download/cm3-gcc
FILE:=$(CM3_GCC_SOURCE)

URL:=https://developer.arm.com/-/media/Files/downloads/gnu-a/$(CM3_GCC_RELEASE)/binrel
+ifeq ($(HOST_ARCH),aarch64)
+  HASH:=1a42eecafa03dc6f32b8ae49ffcd15114dc818efbd72292fa6bab58233940bb9
+else
HASH:=bf7ee185936d22d787b80c8da573f72ead5675695331fb8b590f0133ef1f6bb9
+endif
  endef
  
  define Build/Clean




Oh nice, I wasn't aware that it even gets that far ;)

I checked ARM's site, and it looks like we could also switch from the 
gnu-a to the gnu-rm toolchain, which also has mac binaries. If anyone 
cares, I don't own/use mac myself.


Cheers,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH v3] arm-trusted-firmware-mvebu: CZ.NIC's Secure Firmware bump to v2021.09.07

2021-09-14 Thread Andre Heider

On 14/09/2021 19:59, Hauke Mehrtens wrote:

On 9/14/21 10:50 AM, sean lee wrote:

bump version and remove patches that have been applied

176d701 wtmi: Wait 1s after putting PHYs INTn pin low
2eeccfe wtmi: Change comment describing reset workaround
e8c94a5 wtmi: Count RAM size from both CS0 and CS1
995979e wtmi: Rename macro
e29eb29 wtmi: soc: Fix start_ap_workaround() for TF-A with debug
81245ed wtmi: Use constant name PLAT_MARVELL_MAILBOX_BASE
18ccb83 wtmi: Do a proper UART reset with clock change as described in 
spec

15ff106 avs: Validate VDD value from OTP
3f33626 fix: clock: a3700: change pwm clock for 600/600 and 1200/750 
preset

fb5e436 wtmi: uart: fix UART baudrate divisor calculation

Signed-off-by: sean lee 
---
  .../boot/arm-trusted-firmware-mvebu/Makefile  |  4 +-
  ...ix-UART-baudrate-divisor-calculation.patch | 66 ---
  ...change-pwm-clock-for-600-600-and-120.patch | 48 --
  .../102-avs-Validate-VDD-value-from-OTP.patch | 52 ---
  4 files changed, 2 insertions(+), 168 deletions(-)
  delete mode 100644 
package/boot/arm-trusted-firmware-mvebu/patches-mox-boot-builder/100-wtmi-uart-fix-UART-baudrate-divisor-calculation.patch 

  delete mode 100644 
package/boot/arm-trusted-firmware-mvebu/patches-mox-boot-builder/101-fix-clock-a3700-change-pwm-clock-for-600-600-and-120.patch 

  delete mode 100644 
package/boot/arm-trusted-firmware-mvebu/patches-mox-boot-builder/102-avs-Validate-VDD-value-from-OTP.patch 





Hi,

This is a little bit unrelated.

Is the source code of image/a3700-utils/wtptp/linux/tbb_linux available 
  somewhere? I wanted to build mvebu/cortex53 on an aarch64 host system 
and this file is only available for x86_64 and the compilation fails.


Yeah, its source is bundled, and actually atf upstream recently switched 
to building it instead of using the checked in binary.


Building it requires cryptocpp though, which doesn't yet exists as 
package. We don't really care about crypto since we're building just an 
untrusted firmware, so I opted to revert to using the binary instead. 
This is on top of the x86_64 binary toolchain too anyway.


See package/boot/arm-trusted-firmware-mvebu/patches/001-imagetool.patch.

If you get rid of that patch and add cryptocpp/host it should build it 
automatically and use that instead. But that still leaves the issue with 
the binary toolchain, no?




Building flash image
/bin/sh: 1: 
/home/ubuntu/openwrt/openwrt/staging_dir/target-aarch64_cortex-a53_musl/image/a3700-utils/wtptp/linux/tbb_linux: 
Exec format error
make[4]: *** [plat/marvell/armada/a3k/common/a3700_common.mk:186: 
/home/ubuntu/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/trusted-firmware-a-espressobin-512mb/trusted-firmware-a-2.5/build/a3700/release/flash-image.bin] 
Error 2



ubuntu@instance-20210910-2105:~/openwrt/openwrt$ file 
/home/ubuntu/openwrt/openwrt/staging_dir/target-aarch64_cortex-a53_musl/image/a3700-utils/wtptp/linux/tbb_linux 

/home/ubuntu/openwrt/openwrt/staging_dir/target-aarch64_cortex-a53_musl/image/a3700-utils/wtptp/linux/tbb_linux: 
ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically 
linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.24, 
BuildID[sha1]=8169eedf6eef4b1993a65a180baee3d31660c000, with debug_info, 
not stripped

ubuntu@instance-20210910-2105:~/openwrt/openwrt$ uname -a
Linux instance-20210910-2105 5.11.0-1017-oracle #18~20.04.1-Ubuntu SMP 
Fri Aug 27 11:09:43 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux

ubuntu@instance-20210910-2105:~/openwrt/openwrt$

Hauke



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] arm-trusted-firmware-mvebu: CZ.NIC's Secure Firmware bump to v2021.09.07

2021-09-14 Thread Andre Heider

On 13/09/2021 10:44, sean lee wrote:

bump version and remove patches that have been applied

176d701 wtmi: Wait 1s after putting PHYs INTn pin low
2eeccfe wtmi: Change comment describing reset workaround
e8c94a5 wtmi: Count RAM size from both CS0 and CS1
995979e wtmi: Rename macro
e29eb29 wtmi: soc: Fix start_ap_workaround() for TF-A with debug
81245ed wtmi: Use constant name PLAT_MARVELL_MAILBOX_BASE
18ccb83 wtmi: Do a proper UART reset with clock change as described in spec
15ff106 avs: Validate VDD value from OTP
3f33626 fix: clock: a3700: change pwm clock for 600/600 and 1200/750 preset
fb5e436 wtmi: uart: fix UART baudrate divisor calculation

Signed-off-by: sean lee 


Nice, but the patch seems misformatted and doesn't apply.

patchwork doesn't like it too, parts fail to parse:
http://patchwork.ozlabs.org/project/openwrt/patch/meapr01mb3574e3f34ba95dc3e8802a9dc0...@meapr01mb3574.ausprd01.prod.outlook.com/

Cheers,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: Kernel 5.10: Current targets' state

2021-09-11 Thread Andre Heider

On 24/08/2021 14:50, Adrian Schmutzler wrote:

Hi,

I just created an overview of current 5.4->5.10 conversion state. Sharing it
FYI below.

Note that targets which are not converted or that nobody cares for always
have the risk of being dropped. We probably also won't ask a hundred times
like last time before doing so.


...

Kernel 5.4:

...

  omap


I just created a PR to move this platform to 5.10:
https://github.com/openwrt/openwrt/pull/4539

Cheers,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] mvebu/kernel: promote 5.10 to stable

2021-09-07 Thread Andre Heider

On 07/09/2021 23:40, Rui Salvaterra wrote:

Hi, Paul,

On Tue, 7 Sept 2021 at 22:37, Paul Spooren  wrote:


This seems to be an ongoing thing, some add it and some remove it, I'm
happy to make this consistent:

* Remove KERNEL_TESTING_PATCHVER when promoting

or

* Set KERNEL_{,TESTING}_PATCHVER to the same value until a new testing
Kernel is added

I'd prefer the former since it removes the feature flag
`testing-kernel`, therefore I'd update my patch and we should do that
for all further *Kernel promotions*. Objections?


Agreed, I also prefer the former. Should cause less confusion when
configuring, at least.


That has been solved fwiw, for the record:

commit cf6f01c0e69a31afc6c5f384405ace51e03fe481
Author: David Bauer 
Date:   Tue Jul 7 10:32:09 2020 +0200

build: conditionally enable testing-kernel feature

Only enable the testing-kernel feature for the target when the testing
kernel version does not match the stable kernel version.

This way, the option for building the testing kernel in the build 
config

menu is only exposed when there's a testing kernel available.

Signed-off-by: David Bauer 
Acked-by: Adrian Schmutzler 

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] prereq-build: require python3-distutils

2021-08-23 Thread Andre Heider

Nice, sounds good, thanks!

On 23/08/2021 23:12, Hauke Mehrtens wrote:

Hi Andre,

I will backport this to 21.02 in the next days. I want to wait if there 
are more problems showing up in master.


Hauke

On 8/23/21 10:47 PM, Andre Heider wrote:

Hi Hauke,

thanks for merging the patch!

Can we also get this cherry-picked to the 21.02 branch, please?

Jeffery makes some good points as to why here:
https://github.com/openwrt/packages/pull/16304#issuecomment-904097018

I too can see that package backports could get unnecessarily painful 
in the future without this in 21.02.


Thanks,
Andre

On 10/08/2021 12:22, Andre Heider wrote:

Debian and Ubuntu ship a python3-minimal package which does not include
the distutils module. This is not supported by upstream and can be
considered a broken python distribution.

In practice, many scripts depend on said module, and this is a 
reoccuring

pain point for building various OpenWrt packages.

Require and check for said module, enough time has been wasted on this.

A list of just the most recent issues:
https://github.com/openwrt/packages/pull/16304
https://github.com/openwrt/packages/pull/16027
https://github.com/openwrt/packages/pull/15443
https://github.com/openwrt/packages/pull/14394
https://github.com/openwrt/packages/pull/12909
https://github.com/openwrt/packages/issues/12443
https://github.com/openwrt/packages/pull/11035
https://github.com/openwrt/packages/issues/10993

Signed-off-by: Andre Heider 
---
  include/prereq-build.mk | 4 
  1 file changed, 4 insertions(+)

diff --git a/include/prereq-build.mk b/include/prereq-build.mk
index 8fbf6f22c4..922e7c544b 100644
--- a/include/prereq-build.mk
+++ b/include/prereq-build.mk
@@ -170,6 +170,10 @@ $(eval $(call SetupHostCommand,python3,Please 
install Python >= 3.6, \

  python3.6 -V 2>&1 | grep 'Python 3', \
  python3 -V 2>&1 | grep -E 'Python 3\.[6-9]\.?'))
+$(eval $(call TestHostCommand,python3-distutils, \
+    Please install the Python3 distutils module, \
+    $(STAGING_DIR_HOST)/bin/python3 -c 'import distutils'))
+
  $(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 
1.7.12.2, \
  git --exec-path | xargs -I % -- grep -q -- --recursive 
%/git-submodule))









___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] prereq-build: require python3-distutils

2021-08-23 Thread Andre Heider

Hi Hauke,

thanks for merging the patch!

Can we also get this cherry-picked to the 21.02 branch, please?

Jeffery makes some good points as to why here:
https://github.com/openwrt/packages/pull/16304#issuecomment-904097018

I too can see that package backports could get unnecessarily painful in 
the future without this in 21.02.


Thanks,
Andre

On 10/08/2021 12:22, Andre Heider wrote:

Debian and Ubuntu ship a python3-minimal package which does not include
the distutils module. This is not supported by upstream and can be
considered a broken python distribution.

In practice, many scripts depend on said module, and this is a reoccuring
pain point for building various OpenWrt packages.

Require and check for said module, enough time has been wasted on this.

A list of just the most recent issues:
https://github.com/openwrt/packages/pull/16304
https://github.com/openwrt/packages/pull/16027
https://github.com/openwrt/packages/pull/15443
https://github.com/openwrt/packages/pull/14394
https://github.com/openwrt/packages/pull/12909
https://github.com/openwrt/packages/issues/12443
https://github.com/openwrt/packages/pull/11035
https://github.com/openwrt/packages/issues/10993

Signed-off-by: Andre Heider 
---
  include/prereq-build.mk | 4 
  1 file changed, 4 insertions(+)

diff --git a/include/prereq-build.mk b/include/prereq-build.mk
index 8fbf6f22c4..922e7c544b 100644
--- a/include/prereq-build.mk
+++ b/include/prereq-build.mk
@@ -170,6 +170,10 @@ $(eval $(call SetupHostCommand,python3,Please install Python 
>= 3.6, \
python3.6 -V 2>&1 | grep 'Python 3', \
python3 -V 2>&1 | grep -E 'Python 3\.[6-9]\.?'))
  
+$(eval $(call TestHostCommand,python3-distutils, \

+   Please install the Python3 distutils module, \
+   $(STAGING_DIR_HOST)/bin/python3 -c 'import distutils'))
+
  $(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, 
\
git --exec-path | xargs -I % -- grep -q -- --recursive %/git-submodule))
  




___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] prereq-build: require python3-distutils

2021-08-10 Thread Andre Heider
Debian and Ubuntu ship a python3-minimal package which does not include
the distutils module. This is not supported by upstream and can be
considered a broken python distribution.

In practice, many scripts depend on said module, and this is a reoccuring
pain point for building various OpenWrt packages.

Require and check for said module, enough time has been wasted on this.

A list of just the most recent issues:
https://github.com/openwrt/packages/pull/16304
https://github.com/openwrt/packages/pull/16027
https://github.com/openwrt/packages/pull/15443
https://github.com/openwrt/packages/pull/14394
https://github.com/openwrt/packages/pull/12909
https://github.com/openwrt/packages/issues/12443
https://github.com/openwrt/packages/pull/11035
https://github.com/openwrt/packages/issues/10993

Signed-off-by: Andre Heider 
---
 include/prereq-build.mk | 4 
 1 file changed, 4 insertions(+)

diff --git a/include/prereq-build.mk b/include/prereq-build.mk
index 8fbf6f22c4..922e7c544b 100644
--- a/include/prereq-build.mk
+++ b/include/prereq-build.mk
@@ -170,6 +170,10 @@ $(eval $(call SetupHostCommand,python3,Please install 
Python >= 3.6, \
python3.6 -V 2>&1 | grep 'Python 3', \
python3 -V 2>&1 | grep -E 'Python 3\.[6-9]\.?'))
 
+$(eval $(call TestHostCommand,python3-distutils, \
+   Please install the Python3 distutils module, \
+   $(STAGING_DIR_HOST)/bin/python3 -c 'import distutils'))
+
 $(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \
git --exec-path | xargs -I % -- grep -q -- --recursive %/git-submodule))
 
-- 
2.30.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH uclient] uclient-fetch: allow to overwrite Content-Type header for POST

2021-06-20 Thread Andre Heider

On 19/06/2021 10:37, Baptiste Jonglez wrote:

Hi,

On 03-06-21, Andre Heider wrote:

This is required by some APIs, e.g. matrix's media upload [0].

[0] 
https://matrix.org/docs/spec/client_server/latest#post-matrix-media-r0-upload




@@ -484,6 +485,7 @@ static int usage(const char *progname)
"  --user-agent | -USet HTTP user agent\n"
"  --post-data=STRING  use the POST method; send STRING 
as the data\n"
"  --post-file=FILEuse the POST method; send FILE as 
the data\n"
+   "  --content-type=STRING   use STRING as Content-Type for 
the POST method\n"
"  --spider | -s   Spider mode - only check file 
existence\n"
"  --timeout=N | -T N  Set connect/request timeout to N 
seconds\n"
"  --proxy=on | -Y on  Enable interpretation of proxy 
env vars (default)\n"


As far as I can tell, GNU wget does not have such an option.  We try to
stay compatible whenever possible, so adding a new custom option is not
a good idea.


Right, this does not exist in wget.


How would you solve this problem with GNU wget?  Reading the man,
--post-data and --post-file are really meant to transmit data in
"application/x-www-form-urlencoded" format, not as arbitrary data.  But if
it is still possible with a custom --header for instance, we should be
able to do the same in uclient-fetch.


Yup, that would be
--header=STRING insert STRING among the headers
wget --header 'Content-Type: foo'

Which is possible to add to uclient-fetch, but the patch will be bigger 
(I tried to keep it as small as possible without hacks).


I'll look into it.


Otherwise, maybe curl will do a better job at this.


I'm trying to use OpenWrt's base tools to keep the dependencies to a 
minimum, that would defeat the purpose :(


Thanks!
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH uclient] uclient-fetch: allow to overwrite Content-Type header for POST

2021-06-03 Thread Andre Heider
This is required by some APIs, e.g. matrix's media upload [0].

[0] 
https://matrix.org/docs/spec/client_server/latest#post-matrix-media-r0-upload

Signed-off-by: Andre Heider 
---
 uclient-fetch.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/uclient-fetch.c b/uclient-fetch.c
index 282092e..176fd37 100644
--- a/uclient-fetch.c
+++ b/uclient-fetch.c
@@ -44,6 +44,7 @@
 static const char *user_agent = "uclient-fetch";
 static const char *post_data;
 static const char *post_file;
+static const char *content_type = "application/x-www-form-urlencoded";
 static struct ustream_ssl_ctx *ssl_ctx;
 static const struct ustream_ssl_ops *ssl_ops;
 static int quiet = false;
@@ -346,13 +347,13 @@ static int init_request(struct uclient *cl)
check_resume_offset(cl);
 
if (post_data) {
-   uclient_http_set_header(cl, "Content-Type", 
"application/x-www-form-urlencoded");
+   uclient_http_set_header(cl, "Content-Type", content_type);
uclient_write(cl, post_data, strlen(post_data));
}
else if(post_file)
{
FILE *input_file;
-   uclient_http_set_header(cl, "Content-Type", 
"application/x-www-form-urlencoded");
+   uclient_http_set_header(cl, "Content-Type", content_type);
 
input_file = fopen(post_file, "r");
if (!input_file)
@@ -484,6 +485,7 @@ static int usage(const char *progname)
"   --user-agent | -U  Set HTTP user agent\n"
"   --post-data=STRING  use the POST method; 
send STRING as the data\n"
"   --post-file=FILEuse the POST method; 
send FILE as the data\n"
+   "   --content-type=STRING   use STRING as 
Content-Type for the POST method\n"
"   --spider | -s   Spider mode - only 
check file existence\n"
"   --timeout=N | -T N  Set connect/request 
timeout to N seconds\n"
"   --proxy=on | -Y on  Enable interpretation 
of proxy env vars (default)\n"
@@ -544,6 +546,7 @@ enum {
L_USER_AGENT,
L_POST_DATA,
L_POST_FILE,
+   L_CONTENT_TYPE,
L_SPIDER,
L_TIMEOUT,
L_CONTINUE,
@@ -561,6 +564,7 @@ static const struct option longopts[] = {
[L_USER_AGENT] = { "user-agent", required_argument, NULL, 0 },
[L_POST_DATA] = { "post-data", required_argument, NULL, 0 },
[L_POST_FILE] = { "post-file", required_argument, NULL, 0 },
+   [L_CONTENT_TYPE] = { "content-type", required_argument, NULL, 0 },
[L_SPIDER] = { "spider", no_argument, NULL, 0 },
[L_TIMEOUT] = { "timeout", required_argument, NULL, 0 },
[L_CONTINUE] = { "continue", no_argument, NULL, 0 },
@@ -632,6 +636,9 @@ int main(int argc, char **argv)
case L_POST_FILE:
post_file = optarg;
break;
+   case L_CONTENT_TYPE:
+   content_type = optarg;
+   break;
case L_SPIDER:
no_output = true;
break;
-- 
2.30.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] iw: update to 8fab0c9e

2021-05-17 Thread Andre Heider
This fixes `iw dev wlan0-mesh station dump`.

8fab0c9 iw: fix ftm_request missing arguments segfault
e816fbc iw: fix mgmt dump missing arguments segfault
5d9d1b8 iw: Fix timestamp output on 32-bit architectures
4b25ae3 iw: fix pointer arithmetic in __print_he_capa
c3df363 iw: add option to print human readable event time
cd64525 iw: print ctrl port tx status event
0ba98b9 iw: use correct type in policy check for mesh
9e38dee iw: scan: fixup HE caps whitespace
17e8564 iw: scan: parse HE capabilities
5735e58 iw: util: factor out HE capability parser
6d8d507 iw: scan: add extension tag parsing
b4e1ec4 man: update wikipage URL, reformat SEE ALSO section
c56036a iw: enable 80MHz support for 6GHz band 11s mesh
fa72728 iw: handle positive error codes gracefully
7ba9093 iw: scan: add flag for scanning colocated ap
5ec60ed iw: Add 'coloc' and 'flush' options to sched_scan
f8ade75 iw: update wikipage URL
b6f2dac iw: Add support for specifying the 160MHz bandwidth when setting the 
channel/frequency

Signed-off-by: Andre Heider 
---
 package/network/utils/iw/Makefile | 11 +++
 .../utils/iw/patches/200-reduce_size.patch| 30 +--
 2 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/package/network/utils/iw/Makefile 
b/package/network/utils/iw/Makefile
index 6db9aaf105..8e11046189 100644
--- a/package/network/utils/iw/Makefile
+++ b/package/network/utils/iw/Makefile
@@ -8,12 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=iw
-PKG_VERSION:=5.9
-PKG_RELEASE:=1
+PKG_VERSION:=5.9-8fab0c9e
+PKG_RELEASE:=$(AUTORELEASE)
 
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_SOURCE_URL:=@KERNEL/software/network/iw
-PKG_HASH:=293a07109aeb7e36267cf59e3ce52857e9ffae3aeb8ac77894b1839fe1f2
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git
+PKG_SOURCE_VERSION:=8fab0c9ee9db217587a58efcc37421c86edcb638
+PKG_MIRROR_HASH:=797b322bc03952f3127ae0a7da476c14ada1bbe9a9ae234a56dd6f864c568e16
 
 PKG_MAINTAINER:=Felix Fietkau 
 PKG_LICENSE:=GPL-2.0
diff --git a/package/network/utils/iw/patches/200-reduce_size.patch 
b/package/network/utils/iw/patches/200-reduce_size.patch
index af30876012..83e11405cb 100644
--- a/package/network/utils/iw/patches/200-reduce_size.patch
+++ b/package/network/utils/iw/patches/200-reduce_size.patch
@@ -1,6 +1,6 @@
 --- a/event.c
 +++ b/event.c
-@@ -944,6 +944,7 @@ static int print_event(struct nl_msg *ms
+@@ -956,6 +956,7 @@ static int print_event(struct nl_msg *ms
}
  
switch (gnlh->cmd) {
@@ -8,7 +8,7 @@
case NL80211_CMD_NEW_WIPHY:
printf("renamed to %s\n", 
nla_get_string(tb[NL80211_ATTR_WIPHY_NAME]));
break;
-@@ -979,6 +980,7 @@ static int print_event(struct nl_msg *ms
+@@ -991,6 +992,7 @@ static int print_event(struct nl_msg *ms
case NL80211_CMD_SCHED_SCAN_RESULTS:
printf("got scheduled scan results\n");
break;
@@ -16,7 +16,7 @@
case NL80211_CMD_WIPHY_REG_CHANGE:
case NL80211_CMD_REG_CHANGE:
if (gnlh->cmd == NL80211_CMD_WIPHY_REG_CHANGE)
-@@ -1061,6 +1063,7 @@ static int print_event(struct nl_msg *ms
+@@ -1073,6 +1075,7 @@ static int print_event(struct nl_msg *ms
mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
printf("del station %s\n", macbuf);
break;
@@ -24,7 +24,7 @@
case NL80211_CMD_JOIN_IBSS:
mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
printf("IBSS %s joined\n", macbuf);
-@@ -1254,9 +1257,9 @@ static int print_event(struct nl_msg *ms
+@@ -1271,9 +1274,9 @@ static int print_event(struct nl_msg *ms
case NL80211_CMD_CH_SWITCH_NOTIFY:
parse_ch_switch_notify(tb, gnlh->cmd);
break;
@@ -134,7 +134,7 @@
  {
 --- a/scan.c
 +++ b/scan.c
-@@ -1297,6 +1297,9 @@ static void print_ht_op(const uint8_t ty
+@@ -1306,6 +1306,9 @@ static void print_ht_op(const uint8_t ty
printf("\t\t * secondary channel offset: %s\n",
ht_secondary_offset[data[1] & 0x3]);
printf("\t\t * STA channel width: %s\n", sta_chan_width[(data[1] & 
0x4)>>2]);
@@ -144,7 +144,7 @@
printf("\t\t * RIFS: %d\n", (data[1] & 0x8)>>3);
printf("\t\t * HT protection: %s\n", protection[data[2] & 0x3]);
printf("\t\t * non-GF present: %d\n", (data[2] & 0x4) >> 2);
-@@ -1707,6 +1710,14 @@ static void print_ie(const struct ie_pri
+@@ -1716,6 +1719,14 @@ static void print_ie(const struct ie_pri
  
  static const struct ie_print ieprinters[] = {
[0] = { "SSID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
@@ -159,7 +159,7 @@
[1] = { "Supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
[3] = { "DS Parameter set", print_ds, 1, 1, BI

Re: OpenWrt 21.02-rc1

2021-04-19 Thread Andre Heider

On 19/04/2021 23:26, Hauke Mehrtens wrote:

On 4/19/21 8:59 AM, Andre Heider wrote:

On 19/04/2021 08:51, Florian Eckert wrote:

Hello,


If there are some other bugs in the 21.02 branch which are fixed in
master, we can backport the fixed as long as they are not so big. If
there is something missing, just ask on the mainling list.


Since last weekend the following patch was merged into master.
The patch extends ltq-vdsl ubus interface with the missing state_num 
and power_state_num values.
https://github.com/openwrt/openwrt/commit/4407d45d9667ab3d376ad4a6b760e07f4dd43e49#diff-ff00a3f4f318bb11684e008813bd876f0865ce6c2c681ec26b0bf178b4e83163 



Could we please backport this to the branch openwrt-21.02 before rc1 
stable release?


Let's get these two patches in too:

48162e4c0c85a7f64d9007565bf5be2c7ace3ada lantiq: enable G.INP 
retransmission counters
4f27ea7c33447f4b0c8e577509726927916b9625 lantiq: use ActualNetDataRate 
for speed reporting


With those 3 patches 21.02 matches master with the big ubus dsl metric 
change.


I added these 3 patches, but only after tagging.

We should do a 21.02.0-rc2 in 2 to 3 weeks anyway.


Nice, thanks!

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: OpenWrt 21.02-rc1

2021-04-19 Thread Andre Heider

On 19/04/2021 08:51, Florian Eckert wrote:

Hello,


If there are some other bugs in the 21.02 branch which are fixed in
master, we can backport the fixed as long as they are not so big. If
there is something missing, just ask on the mainling list.


Since last weekend the following patch was merged into master.
The patch extends ltq-vdsl ubus interface with the missing state_num and 
power_state_num values.
https://github.com/openwrt/openwrt/commit/4407d45d9667ab3d376ad4a6b760e07f4dd43e49#diff-ff00a3f4f318bb11684e008813bd876f0865ce6c2c681ec26b0bf178b4e83163 



Could we please backport this to the branch openwrt-21.02 before rc1 
stable release?


Let's get these two patches in too:

48162e4c0c85a7f64d9007565bf5be2c7ace3ada lantiq: enable G.INP 
retransmission counters
4f27ea7c33447f4b0c8e577509726927916b9625 lantiq: use ActualNetDataRate 
for speed reporting


With those 3 patches 21.02 matches master with the big ubus dsl metric 
change.


Thanks,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] build: prereq: drop support for Python 3.5

2021-04-19 Thread Andre Heider

On 17/04/2021 23:45, Sven Roederer wrote:

Am Samstag, 17. April 2021, 16:45:01 CEST schrieb Sven Roederer:

On my Ubuntu 16.04 based build-system I also have build-failures for meson
using Python3.5.


Correction: it's a 18.04 LTS ...


But 18.04 ships python3.6?
https://packages.ubuntu.com/bionic/python3

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] build: prereq: drop support for Python 3.5

2021-04-19 Thread Andre Heider

On 18/04/2021 20:45, Etienne Champetier wrote:

Le mar. 16 févr. 2021 à 11:19, Petr Štetiar  a écrit :


Andre Heider  [2021-02-16 08:21:08]:

Hi,


The meson build system bumped their python requirement to 3.6 for the 0.57.0
release. This patch ensures that OpenWrt can update meson while still
relying on the host python.


Current buildbot images are based on Debian 9, which uses Python 3.5 so merging 
this
would result in broken buildbots.


Debian 9 is EOL, so we should definitely update the buildbot images


That was already done >4 weeks ago:
https://lists.infradead.org/pipermail/openwrt-devel/2021-March/034292.html
https://lists.infradead.org/pipermail/openwrt-devel/2021-March/034310.html

And the quoted patch has been merged too:
https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=7379f8bd3e7ee0722faa6ec8b2969081fbdc1e07

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH v6 1/1] ltq-vdsl-app: extent dsl metrics with state_num and power_state_num

2021-04-13 Thread Andre Heider

On 13/04/2021 11:30, Florian Eckert wrote:

With the old ubus dsl API, the numbers for the individual line_states and
power_states were also returned. These were not ported to the new DSL
C-API. This commit adds the missing information.

For this the internal values are mapped to numbers.

* additional JSON output for state_num:
"state_num": 

Since not all values are meaningful only the following values are
implemented, this can be extended if the future.

* LSTATE_MAP_NOT_INITIALIZED
* LSTATE_MAP_EXCEPTION
* LSTATE_MAP_IDLE
* LSTATE_MAP_SILENT
* LSTATE_MAP_HANDSHAKE
* LSTATE_MAP_FULL_INIT
* LSTATE_MAP_SHOWTIME_NO_SYNC
* LSTATE_MAP_SHOWTIME_TC_SYNC
* LSTATE_MAP_RESYNC

* additinal JSON output for power_level:
"power_state_num": ,

Since there are not so many here, all are mapped.

* PSTATE_MAP_NA,
* PSTATE_MAP_L0,
* PSTATE_MAP_L1,
* PSTATE_MAP_L2,
* PSTATE_MAP_L3,

Signed-off-by: Florian Eckert 


Reviewed-by: Andre Heider 

Thanks!

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH v5 1/1] ltq-vdsl-app: extent dsl metrics with state_num and power_state_num

2021-04-13 Thread Andre Heider

On 13/04/2021 08:28, Florian Eckert wrote:

  +/* These values are exported via ubus and backwards compability
+ * needs to be kept!
+ */
+enum {
+    LSTATE_MAP_UNKNOWN = 0,
+    LSTATE_MAP_EXCEPTION,
+    LSTATE_MAP_IDLE,
+    LSTATE_MAP_SILENT,
+    LSTATE_MAP_HANDSHAKE,
+    LSTATE_MAP_FULL_INIT,
+    LSTATE_MAP_SHOWTIME_NO_SYNC,
+    LSTATE_MAP_SHOWTIME_TC_SYNC,
+    LSTATE_MAP_RESYNC,
+    LSTATE_MAP_NOT_INITIALIZED,


Except for the last entry, the order matches lantiq's DSL_LineState_t.
Doesn't really matter as long as we don't change these values, but was
there a reason for that?


No there is no particular reason for that.
Should I then send a v6?
Where this value then comes after LSTATE_MAP_UNKNOWN?


I don't care too much either way, but if you do you might as well set 
LSTATE_MAP_UNKNOWN to -1, so the exported values start at 0.


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH v5 1/1] ltq-vdsl-app: extent dsl metrics with state_num and power_state_num

2021-04-12 Thread Andre Heider

On 12/04/2021 12:37, Florian Eckert wrote:

With the old ubus dsl API, the numbers for the individual line_states and
power_states were also returned. These were not ported to the new DSL
C-API. This commit adds the missing information.

For this the internal values are mapped to numbers.

* additional JSON output for state_num:
"state_num": 

Since not all values are meaningful only the following values are
implemented, this can be extended if the future.

* LSTATE_MAP_EXCEPTION
* LSTATE_MAP_IDLE
* LSTATE_MAP_SILENT
* LSTATE_MAP_HANDSHAKE
* LSTATE_MAP_FULL_INIT
* LSTATE_MAP_SHOWTIME_NO_SYNC
* LSTATE_MAP_SHOWTIME_TC_SYNC
* LSTATE_MAP_RESYNC
* LSTATE_MAP_NOT_INITIALIZED

* additinal JSON output for power_level:
"power_state_num": ,

Since there are not so many here, all are mapped.

* PSTATE_MAP_NA,
* PSTATE_MAP_L0,
* PSTATE_MAP_L1,
* PSTATE_MAP_L2,
* PSTATE_MAP_L3,

Signed-off-by: Florian Eckert 


One note below, but in any case, LGTM, so:

Reviewed-by: Andre Heider 


---
v5:
After a discussion off the mailing list with Andre Heider, this is now
the favored solution. All other versions have been marked in the patchwork
as superseded.

  .../ltq-vdsl-app/src/src/dsl_cpe_ubus.c   | 72 +++
  1 file changed, 58 insertions(+), 14 deletions(-)

diff --git a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c 
b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
index 52b2be20e1..dafa45f77c 100644
--- a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
+++ b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
@@ -34,6 +34,12 @@
str = text; \
break;
  
+#define STR_CASE_MAP(id, text, number) \

+   case id: \
+   str = text; \
+   map = number; \
+   break;
+
  #define IOCTL(type, request) \
type out; \
memset(, 0, sizeof(type)); \
@@ -99,6 +105,34 @@ typedef enum {
PROFILE_35B,
  } profile_t;
  
+/* These values are exported via ubus and backwards compability

+ * needs to be kept!
+ */
+enum {
+   LSTATE_MAP_UNKNOWN = 0,
+   LSTATE_MAP_EXCEPTION,
+   LSTATE_MAP_IDLE,
+   LSTATE_MAP_SILENT,
+   LSTATE_MAP_HANDSHAKE,
+   LSTATE_MAP_FULL_INIT,
+   LSTATE_MAP_SHOWTIME_NO_SYNC,
+   LSTATE_MAP_SHOWTIME_TC_SYNC,
+   LSTATE_MAP_RESYNC,
+   LSTATE_MAP_NOT_INITIALIZED,


Except for the last entry, the order matches lantiq's DSL_LineState_t. 
Doesn't really matter as long as we don't change these values, but was 
there a reason for that?



+};
+
+/* These values are exported via ubus and backwards compability
+ * needs to be kept!
+ */
+enum {
+   PSTATE_MAP_UNKNOWN = -2,
+   PSTATE_MAP_NA,
+   PSTATE_MAP_L0,
+   PSTATE_MAP_L1,
+   PSTATE_MAP_L2,
+   PSTATE_MAP_L3,
+};
+
  static DSL_CPE_ThreadCtrl_t thread;
  static struct ubus_context *ctx;
  static struct blob_buf b;
@@ -306,32 +340,33 @@ static void version_information(int fd) {
  static void line_state(int fd) {
IOCTL(DSL_LineState_t, DSL_FIO_LINE_STATE_GET)
  
+	int map = LSTATE_MAP_UNKNOWN;

const char *str;
switch (out.data.nLineState) {
-   STR_CASE(DSL_LINESTATE_NOT_INITIALIZED, "Not initialized")
-   STR_CASE(DSL_LINESTATE_EXCEPTION, "Exception")
+   STR_CASE_MAP(DSL_LINESTATE_NOT_INITIALIZED, "Not initialized", 
LSTATE_MAP_NOT_INITIALIZED)
+   STR_CASE_MAP(DSL_LINESTATE_EXCEPTION, "Exception", LSTATE_MAP_EXCEPTION)
STR_CASE(DSL_LINESTATE_NOT_UPDATED, "Not updated")
STR_CASE(DSL_LINESTATE_IDLE_REQUEST, "Idle request")
-   STR_CASE(DSL_LINESTATE_IDLE, "Idle")
+   STR_CASE_MAP(DSL_LINESTATE_IDLE, "Idle", LSTATE_MAP_IDLE)
STR_CASE(DSL_LINESTATE_SILENT_REQUEST, "Silent request")
-   STR_CASE(DSL_LINESTATE_SILENT, "Silent")
-   STR_CASE(DSL_LINESTATE_HANDSHAKE, "Handshake")
+   STR_CASE_MAP(DSL_LINESTATE_SILENT, "Silent", LSTATE_MAP_SILENT)
+   STR_CASE_MAP(DSL_LINESTATE_HANDSHAKE, "Handshake", LSTATE_MAP_HANDSHAKE)
STR_CASE(DSL_LINESTATE_BONDING_CLR, "Bonding CLR")
-   STR_CASE(DSL_LINESTATE_FULL_INIT, "Full init")
+   STR_CASE_MAP(DSL_LINESTATE_FULL_INIT, "Full init", LSTATE_MAP_FULL_INIT)
STR_CASE(DSL_LINESTATE_SHORT_INIT_ENTRY, "Short init entry")
STR_CASE(DSL_LINESTATE_DISCOVERY, "Discovery")
STR_CASE(DSL_LINESTATE_TRAINING, "Training")
STR_CASE(DSL_LINESTATE_ANALYSIS, "Analysis")
STR_CASE(DSL_LINESTATE_EXCHANGE, "Exchange")
-   STR_CASE(DSL_LINESTATE_SHOWTIME_NO_SYNC, "Showtime without TC-Layer 
sync")
-   STR_CASE(DSL_LINESTATE_SHOWTIME_TC_SYNC, "Showtime with TC-Layer sync")
+   STR_CASE_MAP(DSL_LINESTATE_SHOWTIME_NO_SYNC, &qu

Re: [PATCH v3 1/1] ltq-vdsl-app: extent dsl metrics with boolean power and line states

2021-04-08 Thread Andre Heider

Hi Florian,

On 06/04/2021 14:49, Florian Eckert wrote:

With the old ubus dsl API, the numbers for the individual line_states and
power_states were also returned. These were not ported to the new DSL
C-API. This commit changes the following JSON output.

Instead of outputting the "line_state" and "power_state" numbers directly, the
values is now printed as boolean. This has the advantage that the
internal numbers are not shown, which can change in the future.

* current JSON output for state:
"state": "Showtime with TC-Layer sync"

* new JSON output for state:
"line_state": {
 "exception": false,
 "idle": false,
 "silent": false,
 "handshake": false,
 "full-init": false,
 "showtime-without-sync": false,
 "showtime-with-sync": true,
 "resync": false,
 "not-initialized": false,
 "string": "Showtime with TC-Layer sync"
},


okay with me if you require that detail, although "string" is a little 
weird I think.


How about keeping the old "state" (which has the nice side effect of not 
breaking backwards compability or the need to adapt luci and prometheus) 
and putting the new stuff under an additional "state_detail" table? We'd 
just have a bunch of bools in a table, which could be nicer for 
evaluation too.



* current JSON output for power_state:
"power_state": "L0 - Synchronized"

* new JSON outpug for power_state:
"power_state": {
 "NA": false,
 "L0": true,
 "L1": false,
 "L2": false,
 "L3": false,
 "string": "L0 - Synchronized"
}


This could be an integer metric [0-3], with a missing metric indicating 
"NA".


Similar to above reasoning, it'll be easier to keep "power_state" as is 
and add "power_level" (is "L" level here?) containing [0-3].


What do you think?
Andre



Signed-off-by: Florian Eckert 
---
  package/network/config/ltq-vdsl-app/Makefile  |  2 +-
  .../ltq-vdsl-app/src/src/dsl_cpe_ubus.c   | 32 ---
  2 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/package/network/config/ltq-vdsl-app/Makefile 
b/package/network/config/ltq-vdsl-app/Makefile
index 0823a0e7e9..f5c561078d 100644
--- a/package/network/config/ltq-vdsl-app/Makefile
+++ b/package/network/config/ltq-vdsl-app/Makefile
@@ -9,7 +9,7 @@ include $(INCLUDE_DIR)/kernel.mk
  
  PKG_NAME:=ltq-vdsl-app

  PKG_VERSION:=4.17.18.6
-PKG_RELEASE:=8
+PKG_RELEASE:=9
  PKG_BASE_NAME:=dsl_cpe_control
  PKG_SOURCE:=$(PKG_BASE_NAME)_vrx-$(PKG_VERSION).tar.gz
  PKG_SOURCE_URL:=@OPENWRT
diff --git a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c 
b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
index 8eefdfe4d5..2ab35ac056 100644
--- a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
+++ b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
@@ -306,6 +306,7 @@ static void version_information(int fd) {
  static void line_state(int fd) {
IOCTL(DSL_LineState_t, DSL_FIO_LINE_STATE_GET)
  
+	void *c;

const char *str;
switch (out.data.nLineState) {
STR_CASE(DSL_LINESTATE_NOT_INITIALIZED, "Not initialized")
@@ -351,8 +352,21 @@ static void line_state(int fd) {
str = NULL;
break;
};
-   if (str)
-   m_str("state", str);
+
+   if (str) {
+   c = blobmsg_open_table(, "line_state");
+   m_bool("exception", out.data.nLineState == 
DSL_LINESTATE_EXCEPTION);
+   m_bool("idle", out.data.nLineState == DSL_LINESTATE_IDLE);
+   m_bool("silent", out.data.nLineState == DSL_LINESTATE_SILENT);
+   m_bool("handshake", out.data.nLineState == 
DSL_LINESTATE_HANDSHAKE);
+   m_bool("full-init", out.data.nLineState == 
DSL_LINESTATE_FULL_INIT);
+   m_bool("showtime-without-sync", out.data.nLineState == 
DSL_LINESTATE_SHOWTIME_NO_SYNC);
+   m_bool("showtime-with-sync", out.data.nLineState == 
DSL_LINESTATE_SHOWTIME_TC_SYNC);
+   m_bool("resync", out.data.nLineState == DSL_LINESTATE_RESYNC);
+   m_bool("not-initialized", out.data.nLineState == 
DSL_LINESTATE_NOT_INITIALIZED);
+   m_str("string", str);
+   blobmsg_close_table(, c);
+   }
  
  	m_bool("up", out.data.nLineState == DSL_LINESTATE_SHOWTIME_TC_SYNC);

  }
@@ -377,6 +391,7 @@ static void g997_line_inventory(int fd) {
  static void g997_power_management_status(int fd) {
IOCTL(DSL_G997_PowerManagementStatus_t, 
DSL_FIO_G997_POWER_MANAGEMENT_STATUS_GET)
  
+	void *c;

const char *str;
switch (out.data.nPowerManagementStatus) {
STR_CASE(DSL_G997_PMS_NA, "Power management state is not available")
@@ -388,8 +403,17 @@ static void g997_power_management_status(int fd) {
str = NULL;
break;
};
-   if (str)
-   m_str("power_state", str);
+
+   if (str) {
+   c = blobmsg_open_table(, "power_state");
+   m_bool("NA", 

Re: OpenWrt 21.02-rc1

2021-04-08 Thread Andre Heider

On 08/04/2021 11:14, Mauro Mozzarelli wrote:

2) dsl_control [status|lucistat] was changed with dsl reporting removed 
https://forum.openwrt.org/t/openwrt-21-02-dsl-control/89962/22
I understand the reason behind this change. I had to write my own command line 
reporting and adapt batch data collection and router connectivity keepalive 
scripts that previously depended on dsl_control, but users who have 
dependencies on these removed command line features are likely to be impacted. 
My recommendation is that it should be documented (there is no documentation 
right now).
I wonder why backward compatibility was not considered as it would not be difficult to reproduce 
"status" and "lucistat" functionality.


Going by that forum post, I'm that "genius". Ignoring your misplaced 
tone, it's the same as with most open source projects: upstream you 
stuff or expect breakage if you rely on internal data.


Consumers of these metrics that *are* upstream (luci and prometheus at 
the time) were adopted to the new ubus metrics, so there is no breakage.


Sometimes things need to evolve. And if they do, there's no way to fix 
or even know about downstream users. If you've got something that's 
valuable to other users, it's in your interest to upstream it so you 
won't run into this again. On the other hand, I too use various patches 
that aren't suitable for upstream. That's on me and I need to adapt 
those every now and then if things change. But I don't get the right to 
complain if things change.


Cheers,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: Buildbot infrastructure upgrade

2021-03-17 Thread Andre Heider

On 13/03/2021 07:16, Andre Heider wrote:

On 13/03/2021 07:03, Petr Štetiar wrote:

Petr Štetiar  [2021-03-12 16:38:46]:

Hi,

I would like to let you know, that we've prepared upgrade of the 
Buildbot

based infrastructure and there is a plan to make those changes alive.


we've just finished the migration.


Oh nice, didn't see that coming so soon!

Does that mean it's possible to reconsider this patch now?
http://patchwork.ozlabs.org/project/openwrt/patch/20210216072108.26107-1-a.hei...@gmail.com/ 


I see it's merged by now, thanks!

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: Buildbot infrastructure upgrade

2021-03-12 Thread Andre Heider

On 13/03/2021 07:03, Petr Štetiar wrote:

Petr Štetiar  [2021-03-12 16:38:46]:

Hi,


I would like to let you know, that we've prepared upgrade of the Buildbot
based infrastructure and there is a plan to make those changes alive.


we've just finished the migration.


Oh nice, didn't see that coming so soon!

Does that mean it's possible to reconsider this patch now?
http://patchwork.ozlabs.org/project/openwrt/patch/20210216072108.26107-1-a.hei...@gmail.com/

Cheers,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH v2 1/1] ltq-vdsl-app: add line_state number and power_state number

2021-03-09 Thread Andre Heider

Hi Florian,

On 09/03/2021 13:05, Florian Eckert wrote:

With the old ubus dsl API, the numbers for the individual line_states and
power_states were also returned. These were not ported to the new DSL
C-API. This commit changes the following JSON output.

* current JSON output for state:
"state": "Showtime with TC-Layer sync"

* new JSON output for state:
"line_state": {
 "number": 2049,
 "string": "Showtime with TC-Layer sync"
},


this one is used by the prometheus node collector, so needs to be 
adapted to this change if this goes in.




* current JSON output for power_state:
"power_state": "L0 - Synchronized"

new JSON outpug for power_state:
"power_state": {
 "number": 0,
 "string": "L0 - Synchronized"
}


We already talked about it, but once again for the list:

I skipped both of these numeric state values when porting this to 
ubus/C, because those are internal and lantiq implementation specific. 
I'd like to avoid exposing those if possible.


Looking at the various values [0], which ones are of interest here? I've 
only seen very few of all of those actually happening.


Can we not expose new metrics instead of these internal numbers?

Like there's already "up":
m_bool("up", out.data.nLineState == DSL_LINESTATE_SHOWTIME_TC_SYNC);

If you care e.g. about showtime you could just add:
m_bool("showtime", out.data.nLineState == DSL_LINESTATE_SHOWTIME_NO_SYNC 
|| out.data.nLineState == DSL_LINESTATE_SHOWTIME_TC_SYNC);


And so on.

Thanks,
Andre

[0] 
https://github.com/openwrt/openwrt/blob/master/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c#L311-L348


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] build: prereq: drop support for Python 3.5

2021-02-16 Thread Andre Heider

Hi,

On 16/02/2021 17:17, Petr Štetiar wrote:

Andre Heider  [2021-02-16 08:21:08]:

Hi,


The meson build system bumped their python requirement to 3.6 for the 0.57.0
release. This patch ensures that OpenWrt can update meson while still
relying on the host python.


Current buildbot images are based on Debian 9, which uses Python 3.5 so merging 
this
would result in broken buildbots.


that's unfortunate.

Are there plans to update from oldstable to stable?

Thanks,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] build: prereq: drop support for Python 3.5

2021-02-15 Thread Andre Heider
The final Python 3.5 release was 3.5.10 in September 2020 [0].
This release series is now End-of-Life (EOL).

The only LTS distribution that still only ships Python 3.5 is Ubuntu 16.04,
which will be EOL in April 2021 [1].

The meson build system bumped their python requirement to 3.6 for the 0.57.0
release. This patch ensures that OpenWrt can update meson while still
relying on the host python.

[0] https://www.python.org/dev/peps/pep-0478/#id4
[1] https://ubuntu.com/about/release-cycle
[2] 
https://mesonbuild.com/Release-notes-for-0-57-0.html#minimum-required-python-version-updated-to-36

Signed-off-by: Andre Heider 
---
 include/prereq-build.mk | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/include/prereq-build.mk b/include/prereq-build.mk
index f88e853b52..88064abf98 100644
--- a/include/prereq-build.mk
+++ b/include/prereq-build.mk
@@ -141,21 +141,19 @@ $(eval $(call SetupHostCommand,perl,Please install Perl 
5.x, \
 
 $(eval $(call CleanupPython2))
 
-$(eval $(call SetupHostCommand,python,Please install Python >= 3.5, \
+$(eval $(call SetupHostCommand,python,Please install Python >= 3.6, \
python3.9 -V 2>&1 | grep 'Python 3', \
python3.8 -V 2>&1 | grep 'Python 3', \
python3.7 -V 2>&1 | grep 'Python 3', \
python3.6 -V 2>&1 | grep 'Python 3', \
-   python3.5 -V 2>&1 | grep 'Python 3', \
-   python3 -V 2>&1 | grep -E 'Python 3\.[5-9]\.?'))
+   python3 -V 2>&1 | grep -E 'Python 3\.[6-9]\.?'))
 
-$(eval $(call SetupHostCommand,python3,Please install Python >= 3.5, \
+$(eval $(call SetupHostCommand,python3,Please install Python >= 3.6, \
python3.9 -V 2>&1 | grep 'Python 3', \
python3.8 -V 2>&1 | grep 'Python 3', \
python3.7 -V 2>&1 | grep 'Python 3', \
python3.6 -V 2>&1 | grep 'Python 3', \
-   python3.5 -V 2>&1 | grep 'Python 3', \
-   python3 -V 2>&1 | grep -E 'Python 3\.[5-9]\.?'))
+   python3 -V 2>&1 | grep -E 'Python 3\.[6-9]\.?'))
 
 $(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \
git --exec-path | xargs -I % -- grep -q -- --recursive %/git-submodule))
-- 
2.30.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH v3 0/6] add ubus support to ltq-[v|a]dsl-app

2021-02-05 Thread Andre Heider

On 26/01/2021 23:02, Hauke Mehrtens wrote:

On 1/26/21 9:00 AM, Andre Heider wrote:

v3:
- copy dsl_cpe_ubus.c from ltq-adsl-app to ltq-vdsl-app instead of using
   a symlink
- squash PKG_RELEASE patches
- move feed patches to PRs:
   https://github.com/openwrt/packages/pull/14572
   https://github.com/openwrt/luci/pull/4749

v2:
- drop 0002-ltq-vdsl-app-fix-Wundef-warnings.patch
- use "/dev/dsl_cpe_api" without the "0" suffix for the adsl daemon:
   package/kernel/lantiq/ltq-adsl/patches/100-dsl_compat.patch:+   
device_create(dsl_class, NULL, MKDEV(DRV_DSL_CPE_API_DEV_MAJOR, 0), 
NULL, "dsl_cpe_api");
   package/kernel/lantiq/ltq-vdsl/patches/100-compat.patch:+   
device_create(dsl_class, NULL, dsl_devt, NULL, "dsl_cpe_api0");

- use callDSLMetrics() for luci, per jo
- add Tested-by tags

This is to significantly speed up the generation of the metrics.

The motivation comes from the fact that ~2.6s is just way too
ineffcient for interval based metric collectors like prometheus or
collectd.

The luci status page also loads/refreshes alot faster.

$ time /etc/init.d/dsl_control dslstat
real    0m 2.66s
user    0m 0.90s
sys    0m 1.76s

$ time ubus call dsl metrics
real    0m 0.02s
user    0m 0.00s
sys    0m 0.01s

The ltq-adsl-app changes are only compile time tested.

Andre Heider (6):
   ltq-vdsl-app: shutdown upon sigterm
   ltq-vdsl-app: add ubus support to get metrics
   ltq-adsl-app: add ubus support to get metrics
   ltq-vdsl-app: use ubus to provide metrics
   ltq-adsl-app: use ubus to provide metrics
   ltq-dsl-base: remove usused lantiq_dsl.sh


Hi Andre,

This looks good to me and also thanks Martin Schiller for testing.

I would like to merge this in the next days. I do not have an ADSL line 
or a working Danube board here, did anyone tried this on Danube or 
Amazon SE? The changes are looking ok and we can wait for people to 
complain. ;-)


@Jow and @Rosen: are the changes in the feed ok? I would also like to 
merge them in parallel?


Just in case you're still waiting for feeback:

Jo replied to v1, reads like an ack to the luci changes to me ;)
https://lists.infradead.org/pipermail/openwrt-devel/2020-December/032687.html

Rosen as well as Etienne (prometheus-node-exporter-lua maintainer) 
looked at the changes and at least didn't yell or complain ;)

https://github.com/openwrt/packages/pull/14572

Hope that's good enough!

Thanks,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH v3 0/6] add ubus support to ltq-[v|a]dsl-app

2021-01-26 Thread Andre Heider

On 26/01/2021 23:02, Hauke Mehrtens wrote:

On 1/26/21 9:00 AM, Andre Heider wrote:

v3:
- copy dsl_cpe_ubus.c from ltq-adsl-app to ltq-vdsl-app instead of using
   a symlink
- squash PKG_RELEASE patches
- move feed patches to PRs:
   https://github.com/openwrt/packages/pull/14572
   https://github.com/openwrt/luci/pull/4749

v2:
- drop 0002-ltq-vdsl-app-fix-Wundef-warnings.patch
- use "/dev/dsl_cpe_api" without the "0" suffix for the adsl daemon:
   package/kernel/lantiq/ltq-adsl/patches/100-dsl_compat.patch:+   
device_create(dsl_class, NULL, MKDEV(DRV_DSL_CPE_API_DEV_MAJOR, 0), 
NULL, "dsl_cpe_api");
   package/kernel/lantiq/ltq-vdsl/patches/100-compat.patch:+   
device_create(dsl_class, NULL, dsl_devt, NULL, "dsl_cpe_api0");

- use callDSLMetrics() for luci, per jo
- add Tested-by tags

This is to significantly speed up the generation of the metrics.

The motivation comes from the fact that ~2.6s is just way too
ineffcient for interval based metric collectors like prometheus or
collectd.

The luci status page also loads/refreshes alot faster.

$ time /etc/init.d/dsl_control dslstat
real    0m 2.66s
user    0m 0.90s
sys    0m 1.76s

$ time ubus call dsl metrics
real    0m 0.02s
user    0m 0.00s
sys    0m 0.01s

The ltq-adsl-app changes are only compile time tested.

Andre Heider (6):
   ltq-vdsl-app: shutdown upon sigterm
   ltq-vdsl-app: add ubus support to get metrics
   ltq-adsl-app: add ubus support to get metrics
   ltq-vdsl-app: use ubus to provide metrics
   ltq-adsl-app: use ubus to provide metrics
   ltq-dsl-base: remove usused lantiq_dsl.sh


Hi Andre,

This looks good to me and also thanks Martin Schiller for testing.

I would like to merge this in the next days. I do not have an ADSL line 
or a working Danube board here, did anyone tried this on Danube or 
Amazon SE? The changes are looking ok and we can wait for people to 
complain. ;-)


I asked a handful of ppl, but none had the hardware with an adsl setup. 
Maybe it's just not used anymore these days... I tried my best to not 
break it though, but yeah, that was just blind compile-time test.


@Jow and @Rosen: are the changes in the feed ok? I would also like to 
merge them in parallel?


Hauke



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH v3 2/6] ltq-vdsl-app: add ubus support to get metrics

2021-01-26 Thread Andre Heider
   "lofs": 0,
"fecs": 0,
"hec": 0,
"ibe": 0,
"crc_p": 0,
"crcp_p": 0,
"cv_p": 0,
"cvp_p": 0,
"rx_corrupted": 27740,
"rx_uncorrected_protected": 27010,
"rx_retransmitted": 0,
"rx_corrected": 730,
"tx_retransmitted": 16222
},
"far": {
"es": 242,
"ses": 71,
"loss": 0,
"uas": 424,
"lofs": 0,
"fecs": 22687,
"hec": 0,
"ibe": 0,
"crc_p": 0,
"crcp_p": 0,
"cv_p": 0,
"cvp_p": 0,
"rx_corrupted": 1383552,
"rx_uncorrected_protected": 1220215,
"rx_retransmitted": 0,
"rx_corrected": 163337,
"tx_retransmitted": 1574051
}
}
}

Signed-off-by: Andre Heider 
Tested-by: Martin Schiller 
---
 package/network/config/ltq-vdsl-app/Makefile  |   3 +-
 .../ltq-vdsl-app/patches/300-ubus.patch   |  50 ++
 .../ltq-vdsl-app/src/src/dsl_cpe_ubus.c   | 807 ++
 3 files changed, 859 insertions(+), 1 deletion(-)
 create mode 100644 package/network/config/ltq-vdsl-app/patches/300-ubus.patch
 create mode 100644 package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c

diff --git a/package/network/config/ltq-vdsl-app/Makefile 
b/package/network/config/ltq-vdsl-app/Makefile
index 5e2db1d5c6..33b6ca093b 100644
--- a/package/network/config/ltq-vdsl-app/Makefile
+++ b/package/network/config/ltq-vdsl-app/Makefile
@@ -20,6 +20,7 @@ PKG_LICENSE:=BSD-2-Clause
 PKG_BUILD_DEPENDS:=ltq-vdsl
 
 PKG_FLAGS:=nonshared
+PKG_FIXUP:=autoreconf
 
 include $(INCLUDE_DIR)/package.mk
 
@@ -28,7 +29,7 @@ define Package/ltq-vdsl-app
   CATEGORY:=Network
   TITLE:=Lantiq VDSL userland tool
   URL:=http://www.lantiq.com/
-  DEPENDS:=@TARGET_lantiq_xrx200 +libpthread +librt +ltq-dsl-base
+  DEPENDS:=@TARGET_lantiq_xrx200 +libpthread +librt +ltq-dsl-base +libubox 
+libubus
 endef
 
 define Package/ltq-vdsl-app/description
diff --git a/package/network/config/ltq-vdsl-app/patches/300-ubus.patch 
b/package/network/config/ltq-vdsl-app/patches/300-ubus.patch
new file mode 100644
index 00..f218ea2208
--- /dev/null
+++ b/package/network/config/ltq-vdsl-app/patches/300-ubus.patch
@@ -0,0 +1,50 @@
+--- a/src/dsl_cpe_control.c
 b/src/dsl_cpe_control.c
+@@ -177,6 +177,9 @@ extern DSL_Error_t DSL_CPE_Pipe_StaticRe
+ #endif /* INCLUDE_DSL_RESOURCE_STATISTICS*/
+ #endif
+ 
++extern void ubus_init();
++extern void ubus_deinit();
++
+ DSL_char_t *g_sFirmwareName1 = DSL_NULL;
+ DSL_FirmwareFeatures_t g_nFwFeatures1 = {DSL_FW_XDSLMODE_CLEANED, 
DSL_FW_XDSLFEATURE_CLEANED,
+DSL_FW_XDSLFEATURE_CLEANED};
+@@ -6759,6 +6762,8 @@ DSL_int_t dsl_cpe_daemon (
+signal (SIGTERM, DSL_CPE_TerminationHandler);
+ #endif /* RTEMS*/
+ 
++   ubus_init();
++
+/* Open DSL_CPE_MAX_DSL_ENTITIES devices*/
+for (nDevice = 0; nDevice < DSL_CPE_MAX_DSL_ENTITIES; nDevice++)
+{
+@@ -7213,6 +7218,7 @@ DSL_int_t dsl_cpe_daemon (
+ #endif /* INCLUDE_DSL_CPE_CLI_SUPPORT */
+ 
+ DSL_CPE_CONTROL_EXIT:
++   ubus_deinit();
+ 
+ #ifdef INCLUDE_DSL_BONDING
+DSL_CPE_BND_Stop((DSL_CPE_BND_Context_t*)pCtrlCtx->pBnd);
+--- a/src/Makefile.am
 b/src/Makefile.am
+@@ -11,7 +11,7 @@ else
+ dsl_cpe_control_common_ldflags =
+ endif
+ 
+-dsl_cpe_control_LDADD = -lpthread -lrt
++dsl_cpe_control_LDADD = -lpthread -lrt -lubox -lubus
+ 
+ if INCLUDE_DSL_CPE_DTI_SUPPORT
+ dsl_cpe_control_LDADD += -ldti_agent
+@@ -66,7 +66,8 @@ dsl_cpe_control_SOURCES = \
+   dsl_cpe_control.c \
+   dsl_cpe_init_cfg.c \
+   dsl_cpe_linux.c \
+-  dsl_cpe_debug.c
++  dsl_cpe_debug.c \
++  dsl_cpe_ubus.c
+ 
+ dsl_cpe_control_SOURCES += \
+   $(dsl_cpe_control_dti_sources)
diff --git a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c 
b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
new file mode 100644
index 00..52b2be20e1
--- /dev/null
+++ b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
@@ -0,0 +1,807 @@
+// SPDX-License-Identifier: BSD-2-Clause
+/*
+ * Copyright (C) 2020 Andre Heider 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#inclu

[PATCH v3 6/6] ltq-dsl-base: remove usused lantiq_dsl.sh

2021-01-26 Thread Andre Heider
All users have been converted to ubus.

Signed-off-by: Andre Heider 
Tested-by: Martin Schiller 
---
 package/network/utils/ltq-dsl-base/Makefile   |   2 +-
 .../files/lib/functions/lantiq_dsl.sh | 749 --
 2 files changed, 1 insertion(+), 750 deletions(-)
 delete mode 100755 
package/network/utils/ltq-dsl-base/files/lib/functions/lantiq_dsl.sh

diff --git a/package/network/utils/ltq-dsl-base/Makefile 
b/package/network/utils/ltq-dsl-base/Makefile
index e2cfc4004c..aae07bc299 100644
--- a/package/network/utils/ltq-dsl-base/Makefile
+++ b/package/network/utils/ltq-dsl-base/Makefile
@@ -6,7 +6,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ltq-dsl-base
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 include $(INCLUDE_DIR)/package.mk
 
diff --git 
a/package/network/utils/ltq-dsl-base/files/lib/functions/lantiq_dsl.sh 
b/package/network/utils/ltq-dsl-base/files/lib/functions/lantiq_dsl.sh
deleted file mode 100755
index 5842a7879f..00
--- a/package/network/utils/ltq-dsl-base/files/lib/functions/lantiq_dsl.sh
+++ /dev/null
@@ -1,749 +0,0 @@
-#!/bin/sh /etc/rc.common
-# Copyright (C) 2012-2014 OpenWrt.org
-
-if [ "$( which vdsl_cpe_control )" ]; then
-   XDSL_CTRL=vdsl_cpe_control
-else
-   XDSL_CTRL=dsl_cpe_control
-fi
-
-#
-# Basic functions to send CLI commands to the vdsl_cpe_control daemon
-#
-dsl_cmd() {
-   killall -q -0 ${XDSL_CTRL} && (
-   lock /var/lock/dsl_pipe
-   echo "$@" > /tmp/pipe/dsl_cpe0_cmd
-   cat /tmp/pipe/dsl_cpe0_ack
-   lock -u /var/lock/dsl_pipe
-   )
-}
-dsl_val() {
-   expr "$1" : '.*'$2'=\([-\.[:alnum:]]*\).*'
-}
-dsl_string() {
-   expr "$1" : '.*'$2'=(\([A-Z0-9,]*\))'
-}
-
-#
-# Simple divide by 10 routine to cope with one decimal place
-#
-dbt() {
-   local a=$(expr $1 / 10)
-   local b=$(expr $1 % 10)
-   echo "${a}.${b#-}"
-}
-#
-# Take a number and convert to k or meg
-#
-scale() {
-   local val=$1
-   local a
-   local b
-
-   if [ "$val" -gt 100 ]; then
-   a=$(expr $val / 1000)
-   b=$(expr $a % 1000)
-   a=$(expr $a / 1000)
-   printf "%d.%03d Mb" ${a} ${b}
-   elif [ "$val" -gt 1000 ]; then
-   a=$(expr $val / 1000)
-   printf "%d Kb" ${a}
-   else
-   echo "${val} b"
-   fi
-}
-
-scale_latency() {
-   local val=$1
-   local a
-   local b
-
-   a=$(expr $val / 100)
-   b=$(expr $val % 100)
-   printf "%d.%d ms" ${a} ${b}
-}
-
-scale_latency_us() {
-   local val=$1
-
-   expr $val \* 10
-}
-
-#
-# convert vendorid into human readable form
-#
-parse_vendorid() {
-   local val=$1
-   local name
-   local version
-
-   case "$val" in
-   B5,00,41,4C,43,42*)
-   name="Alcatel"
-   version=${val##*B5,00,41,4C,43,42,}
-   ;;
-   B5,00,41,4E,44,56*)
-   name="Analog Devices"
-   version=${val##*B5,00,41,4E,44,56,}
-   ;;
-   B5,00,42,44,43,4D*)
-   name="Broadcom"
-   version=${val##*B5,00,42,44,43,4D,}
-   ;;
-   B5,00,43,45,4E,54*)
-   name="Centillium"
-   version=${val##*B5,00,43,45,4E,54,}
-   ;;
-   B5,00,47,53,50,4E*)
-   name="Globespan"
-   version=${val##*B5,00,47,53,50,4E,}
-   ;;
-   B5,00,49,4B,4E,53*)
-   name="Ikanos"
-   version=${val##*B5,00,49,4B,4E,53,}
-   ;;
-   B5,00,49,46,54,4E*)
-   name="Infineon"
-   version=${val##*B5,00,49,46,54,4E,}
-   ;;
-   B5,00,54,53,54,43*)
-   name="Texas Instruments"
-   version=${val##*B5,00,54,53,54,43,}
-   ;;
-   B5,00,54,4D,4D,42*)
-   name="Thomson MultiMedia Broadband"
-   version=${val##*B5,00,54,4D,4D,42,}
-   ;;
-   B5,00,54,43,54,4E*)
-   name="Trend Chip Technologies"
-   version=${val##*B5,00,54,43,54,4E,}
-   ;;
-   B5,00,53,54,4D,49*)
-   name="ST Micro"
-   version=${val##*B5,00,53,54,4D,49,}
-   ;;
-   esac
-
-   [ -n "$name" ] && {
-   val="$name"
-
-   [ "$version"

[PATCH v3 0/6] add ubus support to ltq-[v|a]dsl-app

2021-01-26 Thread Andre Heider
v3:
- copy dsl_cpe_ubus.c from ltq-adsl-app to ltq-vdsl-app instead of using
  a symlink
- squash PKG_RELEASE patches
- move feed patches to PRs:
  https://github.com/openwrt/packages/pull/14572
  https://github.com/openwrt/luci/pull/4749

v2:
- drop 0002-ltq-vdsl-app-fix-Wundef-warnings.patch
- use "/dev/dsl_cpe_api" without the "0" suffix for the adsl daemon:
  package/kernel/lantiq/ltq-adsl/patches/100-dsl_compat.patch:+   
device_create(dsl_class, NULL, MKDEV(DRV_DSL_CPE_API_DEV_MAJOR, 0), NULL, 
"dsl_cpe_api");
  package/kernel/lantiq/ltq-vdsl/patches/100-compat.patch:+   
device_create(dsl_class, NULL, dsl_devt, NULL, "dsl_cpe_api0");
- use callDSLMetrics() for luci, per jo
- add Tested-by tags

This is to significantly speed up the generation of the metrics.

The motivation comes from the fact that ~2.6s is just way too
ineffcient for interval based metric collectors like prometheus or
collectd.

The luci status page also loads/refreshes alot faster.

$ time /etc/init.d/dsl_control dslstat
real0m 2.66s
user0m 0.90s
sys 0m 1.76s

$ time ubus call dsl metrics
real0m 0.02s
user0m 0.00s
sys 0m 0.01s

The ltq-adsl-app changes are only compile time tested.

Andre Heider (6):
  ltq-vdsl-app: shutdown upon sigterm
  ltq-vdsl-app: add ubus support to get metrics
  ltq-adsl-app: add ubus support to get metrics
  ltq-vdsl-app: use ubus to provide metrics
  ltq-adsl-app: use ubus to provide metrics
  ltq-dsl-base: remove usused lantiq_dsl.sh

 package/network/config/ltq-adsl-app/Makefile  |   9 +-
 .../config/ltq-adsl-app/files/dsl_control |   7 +-
 .../ltq-adsl-app/patches/300-ubus.patch   |  50 ++
 package/network/config/ltq-vdsl-app/Makefile  |   5 +-
 .../config/ltq-vdsl-app/files/dsl_control |   9 +-
 .../ltq-vdsl-app/patches/201-sigterm.patch|  19 +
 .../ltq-vdsl-app/patches/300-ubus.patch   |  50 ++
 .../ltq-vdsl-app/src/src/dsl_cpe_ubus.c   | 807 ++
 package/network/utils/ltq-dsl-base/Makefile   |   2 +-
 .../files/lib/functions/lantiq_dsl.sh | 749 
 10 files changed, 945 insertions(+), 762 deletions(-)
 create mode 100644 package/network/config/ltq-adsl-app/patches/300-ubus.patch
 create mode 100644 
package/network/config/ltq-vdsl-app/patches/201-sigterm.patch
 create mode 100644 package/network/config/ltq-vdsl-app/patches/300-ubus.patch
 create mode 100644 package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
 delete mode 100755 
package/network/utils/ltq-dsl-base/files/lib/functions/lantiq_dsl.sh

-- 
2.29.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH v3 1/6] ltq-vdsl-app: shutdown upon sigterm

2021-01-26 Thread Andre Heider
procd sends sigterm to stop daemons, hook it up.

This speeds up the shutdown sequence and gets rid of the following message:
daemon.info procd: Instance dsl_control::instance1 pid 15408 not stopped on 
SIGTERM, sending SIGKILL instead

Signed-off-by: Andre Heider 
Tested-by: Martin Schiller 
---
 .../config/ltq-vdsl-app/files/dsl_control |  2 --
 .../ltq-vdsl-app/patches/201-sigterm.patch| 19 +++
 2 files changed, 19 insertions(+), 2 deletions(-)
 create mode 100644 
package/network/config/ltq-vdsl-app/patches/201-sigterm.patch

diff --git a/package/network/config/ltq-vdsl-app/files/dsl_control 
b/package/network/config/ltq-vdsl-app/files/dsl_control
index 3f3cecbca5..5089d7ac31 100644
--- a/package/network/config/ltq-vdsl-app/files/dsl_control
+++ b/package/network/config/ltq-vdsl-app/files/dsl_control
@@ -307,8 +307,6 @@ start_service() {
 }
 
 stop_service() {
-   # do not use dsl_cmd to not block when this is locked up by some other 
proess
-   echo quit > /tmp/pipe/dsl_cpe0_cmd
DSL_NOTIFICATION_TYPE="DSL_INTERFACE_STATUS" \
DSL_INTERFACE_STATUS="DOWN" \
/sbin/dsl_notify.sh
diff --git a/package/network/config/ltq-vdsl-app/patches/201-sigterm.patch 
b/package/network/config/ltq-vdsl-app/patches/201-sigterm.patch
new file mode 100644
index 00..68a416ce24
--- /dev/null
+++ b/package/network/config/ltq-vdsl-app/patches/201-sigterm.patch
@@ -0,0 +1,19 @@
+--- a/src/dsl_cpe_control.c
 b/src/dsl_cpe_control.c
+@@ -6504,7 +6504,7 @@ DSL_CPE_STATIC  void DSL_CPE_Termination
+/* ignore the signal, we'll handle by ourself */
+signal (sig, SIG_IGN);
+ 
+-   if (sig == SIGINT)
++   if (sig == SIGINT || sig == SIGTERM)
+{
+   DSL_CCA_DEBUG(DSL_CCA_DBG_MSG, (DSL_CPE_PREFIX "terminated" 
DSL_CPE_CRLF));
+   DSL_CPE_Termination ();
+@@ -6756,6 +6756,7 @@ DSL_int_t dsl_cpe_daemon (
+ 
+ #ifndef RTEMS
+signal (SIGINT, DSL_CPE_TerminationHandler);
++   signal (SIGTERM, DSL_CPE_TerminationHandler);
+ #endif /* RTEMS*/
+ 
+/* Open DSL_CPE_MAX_DSL_ENTITIES devices*/
-- 
2.29.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH v3 3/6] ltq-adsl-app: add ubus support to get metrics

2021-01-26 Thread Andre Heider
As with ltq-vdsl-app, see previous commit.

Signed-off-by: Andre Heider 
---
 package/network/config/ltq-adsl-app/Makefile  |  7 ++-
 .../ltq-adsl-app/patches/300-ubus.patch   | 50 +++
 2 files changed, 56 insertions(+), 1 deletion(-)
 create mode 100644 package/network/config/ltq-adsl-app/patches/300-ubus.patch

diff --git a/package/network/config/ltq-adsl-app/Makefile 
b/package/network/config/ltq-adsl-app/Makefile
index cfd66d0ee4..d388c43ffb 100644
--- a/package/network/config/ltq-adsl-app/Makefile
+++ b/package/network/config/ltq-adsl-app/Makefile
@@ -35,7 +35,7 @@ define Package/ltq-adsl-app
   CATEGORY:=Network
   TITLE:=Lantiq DSL userland tool
   URL:=http://www.lantiq.com/
-  DEPENDS:=@(TARGET_lantiq_xway||TARGET_lantiq_xway_legacy||TARGET_lantiq_ase) 
+libpthread +ltq-dsl-base
+  DEPENDS:=@(TARGET_lantiq_xway||TARGET_lantiq_xway_legacy||TARGET_lantiq_ase) 
+libpthread +ltq-dsl-base +libubox +libubus
   MENU:=1
 endef
 
@@ -75,6 +75,11 @@ CONFIGURE_ARGS += \
 
 TARGET_CFLAGS += -I$(LINUX_DIR)/include
 
+define Build/Prepare
+   $(call Build/Prepare/Default)
+   $(CP) ../ltq-vdsl-app/src/src/dsl_cpe_ubus.c $(PKG_BUILD_DIR)/src/
+endef
+
 define Package/ltq-adsl-app/install
$(INSTALL_DIR) $(1)/etc/init.d $(1)/sbin $(1)/etc/hotplug.d/dsl
$(INSTALL_BIN) ./files/dsl_control $(1)/etc/init.d/
diff --git a/package/network/config/ltq-adsl-app/patches/300-ubus.patch 
b/package/network/config/ltq-adsl-app/patches/300-ubus.patch
new file mode 100644
index 00..1951efd4f6
--- /dev/null
+++ b/package/network/config/ltq-adsl-app/patches/300-ubus.patch
@@ -0,0 +1,50 @@
+--- a/src/dsl_cpe_control.c
 b/src/dsl_cpe_control.c
+@@ -139,6 +139,9 @@ extern DSL_Error_t DSL_CPE_Pipe_StaticRe
+ #endif /* INCLUDE_DSL_RESOURCE_STATISTICS*/
+ #endif
+ 
++extern void ubus_init();
++extern void ubus_deinit();
++
+ DSL_char_t *g_sFirmwareName1 = DSL_NULL;
+ DSL_char_t *g_sFirmwareName2 = DSL_NULL;
+ #ifdef INCLUDE_SCRIPT_NOTIFICATION
+@@ -5343,6 +5346,8 @@ DSL_int_t dsl_cpe_daemon (
+signal (SIGINT, DSL_CPE_TerminationHandler);
+ #endif /* RTEMS*/
+ 
++   ubus_init();
++
+/* Open DSL_CPE_MAX_DEVICE_NUMBER devices*/
+for (nDevice = 0; nDevice < DSL_CPE_MAX_DEVICE_NUMBER; nDevice++)
+{
+@@ -5738,6 +5743,7 @@ DSL_int_t dsl_cpe_daemon (
+ #endif /* INCLUDE_DSL_CPE_CLI_SUPPORT */
+ 
+ DSL_CPE_CONTROL_EXIT:
++   ubus_deinit();
+ 
+ #ifdef INCLUDE_DSL_BONDING
+DSL_CPE_BND_Stop((DSL_CPE_BND_Context_t*)pCtrlCtx->pBnd);
+--- a/src/Makefile.am
 b/src/Makefile.am
+@@ -11,7 +11,7 @@ else
+ dsl_cpe_control_common_ldflags =
+ endif
+ 
+-dsl_cpe_control_LDADD = -lpthread
++dsl_cpe_control_LDADD = -lpthread -lubox -lubus
+ 
+ if INCLUDE_DSL_CPE_SOAP_SUPPORT
+ dsl_cpe_control_LDADD += -lm
+@@ -70,7 +70,8 @@ dsl_cpe_control_SOURCES = \
+   dsl_cpe_control.c \
+   dsl_cpe_init_cfg.c \
+   dsl_cpe_linux.c \
+-  dsl_cpe_debug.c
++  dsl_cpe_debug.c \
++  dsl_cpe_ubus.c
+ 
+ dsl_cpe_control_SOURCES += \
+   $(dsl_cpe_control_dti_sources)
-- 
2.29.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH v3 4/6] ltq-vdsl-app: use ubus to provide metrics

2021-01-26 Thread Andre Heider
luci now uses ubus directly, so remove 'lucistat'.
For manual usage just print the ubus output, use luci for a pretty
version.

Signed-off-by: Andre Heider 
Tested-by: Martin Schiller 
---
 package/network/config/ltq-vdsl-app/Makefile  | 2 +-
 package/network/config/ltq-vdsl-app/files/dsl_control | 7 ---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/package/network/config/ltq-vdsl-app/Makefile 
b/package/network/config/ltq-vdsl-app/Makefile
index 33b6ca093b..bf9287bc79 100644
--- a/package/network/config/ltq-vdsl-app/Makefile
+++ b/package/network/config/ltq-vdsl-app/Makefile
@@ -9,7 +9,7 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=ltq-vdsl-app
 PKG_VERSION:=4.17.18.6
-PKG_RELEASE:=5
+PKG_RELEASE:=6
 PKG_BASE_NAME:=dsl_cpe_control
 PKG_SOURCE:=$(PKG_BASE_NAME)_vrx-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
diff --git a/package/network/config/ltq-vdsl-app/files/dsl_control 
b/package/network/config/ltq-vdsl-app/files/dsl_control
index 5089d7ac31..54b739e2cd 100644
--- a/package/network/config/ltq-vdsl-app/files/dsl_control
+++ b/package/network/config/ltq-vdsl-app/files/dsl_control
@@ -4,10 +4,11 @@
 START=97
 USE_PROCD=1
 
-extra_command "dslstat" "Get DSL status information"
-extra_command "lucistat" "Get status information in lua friendly format"
+dslstat() {
+   ubus call dsl metrics
+}
 
-. /lib/functions/lantiq_dsl.sh
+extra_command "dslstat" "Get DSL status information"
 
 #
 # ITU-T G.997.1 (06/2012) - Section 7.3.1.1.1 (xTU transmission system 
enabling (XTSE))
-- 
2.29.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH v3 5/6] ltq-adsl-app: use ubus to provide metrics

2021-01-26 Thread Andre Heider
luci now uses ubus directly, so remove 'lucistat'.
For manual usage just print the ubus output, use luci for a pretty
version.

Signed-off-by: Andre Heider 
---
 package/network/config/ltq-adsl-app/Makefile  | 2 +-
 package/network/config/ltq-adsl-app/files/dsl_control | 7 ---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/package/network/config/ltq-adsl-app/Makefile 
b/package/network/config/ltq-adsl-app/Makefile
index d388c43ffb..2d3e4314eb 100644
--- a/package/network/config/ltq-adsl-app/Makefile
+++ b/package/network/config/ltq-adsl-app/Makefile
@@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=dsl_cpe_control_danube
 PKG_VERSION:=3.24.4.4
-PKG_RELEASE:=9
+PKG_RELEASE:=10
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_BUILD_DIR:=$(BUILD_DIR)/dsl_cpe_control-$(PKG_VERSION)
 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/
diff --git a/package/network/config/ltq-adsl-app/files/dsl_control 
b/package/network/config/ltq-adsl-app/files/dsl_control
index 49c342d9d5..4bd6e860e8 100644
--- a/package/network/config/ltq-adsl-app/files/dsl_control
+++ b/package/network/config/ltq-adsl-app/files/dsl_control
@@ -4,10 +4,11 @@
 START=97
 USE_PROCD=1
 
-extra_command "dslstat" "Get DSL status information"
-extra_command "lucistat" "Get status information in lua friendly format"
+dslstat() {
+   ubus call dsl metrics
+}
 
-. /lib/functions/lantiq_dsl.sh
+extra_command "dslstat" "Get DSL status information"
 
 annex_b=10_00_10_00_00_04_00_00
 annex_bdmt=10_00_00_00_00_00_00_00
-- 
2.29.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH 03/12] ltq-adsl-app: add ubus support to get metrics

2021-01-25 Thread Andre Heider

On 25/01/2021 21:13, Hauke Mehrtens wrote:

On 12/15/20 10:35 AM, Andre Heider wrote:

As with ltq-vdsl-app, see previous commit.

Signed-off-by: Andre Heider 
---
  package/network/config/ltq-adsl-app/Makefile  |  2 +-
  .../ltq-adsl-app/patches/300-ubus.patch   | 50 +++
  package/network/config/ltq-adsl-app/src   |  1 +
  3 files changed, 52 insertions(+), 1 deletion(-)
  create mode 100644 
package/network/config/ltq-adsl-app/patches/300-ubus.patch

  create mode 12 package/network/config/ltq-adsl-app/src

diff --git a/package/network/config/ltq-adsl-app/Makefile 
b/package/network/config/ltq-adsl-app/Makefile

index cfd66d0ee4..e03c0911a5 100644
--- a/package/network/config/ltq-adsl-app/Makefile
+++ b/package/network/config/ltq-adsl-app/Makefile
@@ -35,7 +35,7 @@ define Package/ltq-adsl-app
    CATEGORY:=Network
    TITLE:=Lantiq DSL userland tool
    URL:=http://www.lantiq.com/
-  
DEPENDS:=@(TARGET_lantiq_xway||TARGET_lantiq_xway_legacy||TARGET_lantiq_ase) 
+libpthread +ltq-dsl-base
+  
DEPENDS:=@(TARGET_lantiq_xway||TARGET_lantiq_xway_legacy||TARGET_lantiq_ase) 
+libpthread +ltq-dsl-base +libubox +libubus

    MENU:=1
  endef
diff --git a/package/network/config/ltq-adsl-app/src 
b/package/network/config/ltq-adsl-app/src

new file mode 12
index 00..d3dfcc3b34
--- /dev/null
+++ b/package/network/config/ltq-adsl-app/src
@@ -0,0 +1 @@
+../ltq-vdsl-app/src
\ No newline at end of file



Is this simlink here ok?
I would prefer if you package Makefile would copy this instead of this 
symlink.


symlink seems to work just fine, but sure, I'll add a `cp` build step 
instead.


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH v2 0/12] add ubus support to ltq-[v|a]dsl-app

2021-01-25 Thread Andre Heider

On 25/01/2021 21:22, Hauke Mehrtens wrote:

On 12/15/20 10:35 AM, Andre Heider wrote:

v2:
- drop 0002-ltq-vdsl-app-fix-Wundef-warnings.patch
- use "/dev/dsl_cpe_api" without the "0" suffix for the adsl daemon:
   package/kernel/lantiq/ltq-adsl/patches/100-dsl_compat.patch:+   
device_create(dsl_class, NULL, MKDEV(DRV_DSL_CPE_API_DEV_MAJOR, 0), 
NULL, "dsl_cpe_api");
   package/kernel/lantiq/ltq-vdsl/patches/100-compat.patch:+   
device_create(dsl_class, NULL, dsl_devt, NULL, "dsl_cpe_api0");

- use callDSLMetrics() for luci, per jo
- add Tested-by tags

This is to significantly speed up the generation of the metrics.

The motivation comes from the fact that ~2.6s is just way too
ineffcient for interval based metric collectors like prometheus or
collectd.

The luci status page also loads/refreshes alot faster.

$ time /etc/init.d/dsl_control dslstat
real    0m 2.66s
user    0m 0.90s
sys    0m 1.76s

$ time ubus call dsl metrics
real    0m 0.02s
user    0m 0.00s
sys    0m 0.01s

The ltq-adsl-app changes are only compile time tested.



Do you have pull requests on github for the luci and package feed changes?


Nope, not yet. I assume you want me to do that, so I'll drop those 
patches here and link to the PRs for v3 instead.


Thanks,
Andre

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH 10/12] ltq-dsl-base: bump PKG_RELEASE

2021-01-25 Thread Andre Heider

On 25/01/2021 21:22, Hauke Mehrtens wrote:

On 12/15/20 10:35 AM, Andre Heider wrote:

Signed-off-by: Andre Heider 
Tested-by: Martin Schiller 
---
  package/network/utils/ltq-dsl-base/Makefile | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/utils/ltq-dsl-base/Makefile 
b/package/network/utils/ltq-dsl-base/Makefile

index e2cfc4004c..aae07bc299 100644
--- a/package/network/utils/ltq-dsl-base/Makefile
+++ b/package/network/utils/ltq-dsl-base/Makefile
@@ -6,7 +6,7 @@
  include $(TOPDIR)/rules.mk
  PKG_NAME:=ltq-dsl-base
-PKG_RELEASE:=2
+PKG_RELEASE:=3
  include $(INCLUDE_DIR)/package.mk



Could you please integrate these increases of the PKG_RELEASE into the 
patches which change the package please.


Ok, I'll add that bump to the last patches in this set touching the 
packages.



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


  1   2   3   >