Re: [PATCH] tplink-safeloader: fix C7v5 factory flashing from vendor fw > v1.1.x

2021-04-09 Thread Luiz Angelo Daros de Luca
> Currently it's not possible to flash factory images on devices shipped
> with vendor firmware versions 1.1.0 Build 20201120 rel. 50406 (published
> 2020-12-22):
>
>  (curFw_ver, newFw_ver) == (1.1, 1.0) [NM_Error](nm_checkSoftVer) 00848: 
> Firmwave not supports, check failed.
>  [NM_Error](nm_checkUpdateContent) 01084: software version dismatched
>  [NM_Error](nm_buildUpgradeStruct) 01188: checkUpdateContent failed.
>
> They've even following note in release notes:
>
>  Note: You will be unable to downgrade to the previous firmware version after 
> updating this firmware.
>
> This version check is in vendor firmware is implemented in
> /usr/bin/nvrammanager binary as following code[1]:
>
>  sscanf(buf, "%d.%d.%*s",_fw_major, _fw_minor);
>  ...
>  if (((int)upd_fw_major < (int)cur_fw_major) ||
>  ((ret = 1, cur_fw_major == upd_fw_major && (upd_fw_minor < 
> (int)cur_fw_minor {
>ret = 0;
>printf("[NM_Error](%s) %05d: Firmwave not supports, check 
> failed.\r\n\r\n","nm_checkSoftVer" ,0x350);
>  }
>  ...
>  return ret;
>
> So in order to fix this and make it future proof it should be enough to
> ship our factory firmware images with major version 7 (lucky number).
>
> Tested on latest firmware version 1.1.2 Build 20210125 rel.37999:
>
>  Firmwave supports, check OK.
>   (curFw_ver, newFw_ver) == (1.1, 7.0) check firmware ok!
>  chekc firmware file success!
>
> 1. https://gist.github.com/ynezz/2e0583647d863386a66c3d231541b6d1
>
> Signed-off-by: Petr Štetiar 
> ---
>  tools/firmware-utils/src/tplink-safeloader.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/firmware-utils/src/tplink-safeloader.c 
> b/tools/firmware-utils/src/tplink-safeloader.c
> index da73e1bf307e..ac71b3305ee6 100644
> --- a/tools/firmware-utils/src/tplink-safeloader.c
> +++ b/tools/firmware-utils/src/tplink-safeloader.c
> @@ -1262,7 +1262,7 @@ static struct device_info boards[] = {
> "{product_name:Archer 
> C7,product_ver:5.0.0,special_id:4B52}\n",
>
> .part_trail = 0x00,
> -   .soft_ver = "soft_ver:1.0.0\n",
> +   .soft_ver = "soft_ver:7.0.0\n",


Why not something bigger? Maybe 126 instead of 7? It is still safe
even if the version is stored as an unsigned char.

>
> Currently it's not possible to flash factory images on devices shipped
> with vendor firmware versions 1.1.0 Build 20201120 rel. 50406 (published
> 2020-12-22):
>
>  (curFw_ver, newFw_ver) == (1.1, 1.0) [NM_Error](nm_checkSoftVer) 00848: 
> Firmwave not supports, check failed.
>  [NM_Error](nm_checkUpdateContent) 01084: software version dismatched
>  [NM_Error](nm_buildUpgradeStruct) 01188: checkUpdateContent failed.
>
> They've even following note in release notes:
>
>  Note: You will be unable to downgrade to the previous firmware version after 
> updating this firmware.
>
> This version check is in vendor firmware is implemented in
> /usr/bin/nvrammanager binary as following code[1]:
>
>  sscanf(buf, "%d.%d.%*s",_fw_major, _fw_minor);
>  ...
>  if (((int)upd_fw_major < (int)cur_fw_major) ||
>  ((ret = 1, cur_fw_major == upd_fw_major && (upd_fw_minor < 
> (int)cur_fw_minor {
>ret = 0;
>printf("[NM_Error](%s) %05d: Firmwave not supports, check 
> failed.\r\n\r\n","nm_checkSoftVer" ,0x350);
>  }
>  ...
>  return ret;
>
> So in order to fix this and make it future proof it should be enough to
> ship our factory firmware images with major version 7 (lucky number).
>
> Tested on latest firmware version 1.1.2 Build 20210125 rel.37999:
>
>  Firmwave supports, check OK.
>   (curFw_ver, newFw_ver) == (1.1, 7.0) check firmware ok!
>  chekc firmware file success!
>
> 1. https://gist.github.com/ynezz/2e0583647d863386a66c3d231541b6d1
>
> Signed-off-by: Petr Štetiar 
> ---
>  tools/firmware-utils/src/tplink-safeloader.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/firmware-utils/src/tplink-safeloader.c 
> b/tools/firmware-utils/src/tplink-safeloader.c
> index da73e1bf307e..ac71b3305ee6 100644
> --- a/tools/firmware-utils/src/tplink-safeloader.c
> +++ b/tools/firmware-utils/src/tplink-safeloader.c
> @@ -1262,7 +1262,7 @@ static struct device_info boards[] = {
> "{product_name:Archer 
> C7,product_ver:5.0.0,special_id:4B52}\n",
>
> .part_trail = 0x00,
> -   .soft_ver = "soft_ver:1.0.0\n",
> +   .soft_ver = "soft_ver:7.0.0\n",
>
> /* We're using a dynamic kernel/rootfs split here */
> .partitions = {
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

---
 Luiz Angelo Daros de Luca
luizl...@gmail.com

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


[PATCH] base-files: fix zoneinfo support

2021-04-09 Thread Rosen Penev
The system init script currently sets /tmp/localinfo when zoneinfo is
populated. However, zoneinfo has spaces in it whereas the actual files
have _ instead of spaces. This made the if condition never return true.

Example failure when removing the if condition:

/tmp/localtime -> /usr/share/zoneinfo/America/Los Angeles

This file does not exist. America/Los_Angeles does.

Signed-off-by: Rosen Penev 
---
 this should be backported to 21.02 and 19.07 as the issue is also
 present there. This was tested on 19.07.
 package/base-files/files/etc/init.d/system | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/package/base-files/files/etc/init.d/system 
b/package/base-files/files/etc/init.d/system
index 08cf86b97f..b1fc154cec 100755
--- a/package/base-files/files/etc/init.d/system
+++ b/package/base-files/files/etc/init.d/system
@@ -22,9 +22,13 @@ system_config() {
 
echo "$hostname" > /proc/sys/kernel/hostname
[ -z "$conloglevel" -a -z "$buffersize" ] || dmesg ${conloglevel:+-n 
$conloglevel} ${buffersize:+-s $buffersize}
-   echo "$timezone" > /tmp/TZ
-   [ -n "$zonename" ] && [ -f "/usr/share/zoneinfo/$zonename" ] && \
-   ln -sf "/usr/share/zoneinfo/$zonename" /tmp/localtime && rm -f 
/tmp/TZ
+   if [ -n "$zonename" ]; then
+   local zname=$(echo "$zonename" | tr ' ' _)
+   [ -f "/usr/share/zoneinfo/$zname" ] && \
+   ln -sf "/usr/share/zoneinfo/$zname" /tmp/localtime
+   else
+   echo "$timezone" > /tmp/TZ
+   fi
 
# apply timezone to kernel
hwclock -u --systz
-- 
2.30.2


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


[PATCH]-19.07 busybox: backport hwclock fixes

2021-04-09 Thread Rosen Penev
Currently on devices with an RTC, sysfixtime uses busybox' hwclock to
set the RTC time. Unfortunately, g/settimeofday on musl completely
ignore the second parameter which forces users to use the syscall
directly.

Backport two patches to fix hwclock's support for timezones.

Signed-off-by: Rosen Penev 
---
 Note: this is already fixed in master and 21.02.
 package/utils/busybox/Makefile|   2 +-
 ...ock-Fix-settimeofday-for-glibc-v2.31.patch |  53 +
 ...fix-musl-breakage-of-settimeofday-tz.patch | 195 ++
 3 files changed, 249 insertions(+), 1 deletion(-)
 create mode 100644 
package/utils/busybox/patches/010-hwclock-Fix-settimeofday-for-glibc-v2.31.patch
 create mode 100644 
package/utils/busybox/patches/020-hwclock-fix-musl-breakage-of-settimeofday-tz.patch

diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index 23dd5498a1..a12401ff30 100644
--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=busybox
 PKG_VERSION:=1.30.1
-PKG_RELEASE:=6
+PKG_RELEASE:=7
 PKG_FLAGS:=essential
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
diff --git 
a/package/utils/busybox/patches/010-hwclock-Fix-settimeofday-for-glibc-v2.31.patch
 
b/package/utils/busybox/patches/010-hwclock-Fix-settimeofday-for-glibc-v2.31.patch
new file mode 100644
index 00..c6dd897b78
--- /dev/null
+++ 
b/package/utils/busybox/patches/010-hwclock-Fix-settimeofday-for-glibc-v2.31.patch
@@ -0,0 +1,53 @@
+From 38b8f0a91a786f42531b1e27746060377fbdcaba Mon Sep 17 00:00:00 2001
+From: Eddie James 
+Date: Mon, 10 Aug 2020 09:59:02 -0500
+Subject: [PATCH 1/2] hwclock: Fix settimeofday for glibc v2.31+
+
+The glibc implementation changed for settimeofday, resulting in "invalid
+argument" error when attempting to set both timezone and time with a single
+call. Fix this by calling settimeofday twice
+
+Signed-off-by: Eddie James 
+Signed-off-by: Denys Vlasenko 
+---
+ util-linux/hwclock.c | 14 +++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+--- a/util-linux/hwclock.c
 b/util-linux/hwclock.c
+@@ -122,16 +122,20 @@ static void to_sys_clock(const char **pp
+   struct timeval tv;
+   struct timezone tz;
+ 
+-  tz.tz_minuteswest = timezone/60;
++  tz.tz_minuteswest = timezone / 60;
+   /* ^^^ used to also subtract 60*daylight, but it's wrong:
+* daylight!=0 means "this timezone has some DST
+* during the year", not "DST is in effect now".
+*/
+   tz.tz_dsttime = 0;
+ 
++  /* glibc v2.31+ returns an error if both args are non-NULL */
++  if (settimeofday(NULL, ))
++  bb_simple_perror_msg_and_die("settimeofday");
++
+   tv.tv_sec = read_rtc(pp_rtcname, NULL, utc);
+   tv.tv_usec = 0;
+-  if (settimeofday(, ))
++  if (settimeofday(, NULL))
+   bb_perror_msg_and_die("settimeofday");
+ }
+ 
+@@ -283,7 +287,11 @@ static void set_system_clock_timezone(in
+   gettimeofday(, NULL);
+   if (!utc)
+   tv.tv_sec += tz.tz_minuteswest * 60;
+-  if (settimeofday(, ))
++
++  /* glibc v2.31+ returns an error if both args are non-NULL */
++  if (settimeofday(NULL, ))
++  bb_perror_msg_and_die("settimeofday");
++  if (settimeofday(, NULL))
+   bb_perror_msg_and_die("settimeofday");
+ }
+ 
diff --git 
a/package/utils/busybox/patches/020-hwclock-fix-musl-breakage-of-settimeofday-tz.patch
 
b/package/utils/busybox/patches/020-hwclock-fix-musl-breakage-of-settimeofday-tz.patch
new file mode 100644
index 00..88ab9f7b18
--- /dev/null
+++ 
b/package/utils/busybox/patches/020-hwclock-fix-musl-breakage-of-settimeofday-tz.patch
@@ -0,0 +1,195 @@
+From 54644059ef984727168c124858448ec66f4ecb5f Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko 
+Date: Wed, 16 Dec 2020 13:49:10 +0100
+Subject: [PATCH 2/2] hwclock: fix musl breakage of settimeofday(tz)
+
+function old new   delta
+set_kernel_timezone_and_clock  - 119+119
+set_kernel_tz  -  28 +28
+hwclock_main 480 301-179
+--
+(add/remove: 2/0 grow/shrink: 0/1 up/down: 147/-179)  Total: -32 bytes
+
+Signed-off-by: Denys Vlasenko 
+---
+ util-linux/hwclock.c | 128 +--
+ 1 file changed, 75 insertions(+), 53 deletions(-)
+
+--- a/util-linux/hwclock.c
 b/util-linux/hwclock.c
+@@ -37,6 +37,19 @@
+ #include 
+ #include "rtc_.h"
+ 
++
++//musl has no __MUSL__ or similar define to check for,
++//but its  has these lines:
++// #define __NEED_fsblkcnt_t
++// #define __NEED_fsfilcnt_t
++#if defined(__linux__) && defined(__NEED_fsblkcnt_t) && 
defined(__NEED_fsfilcnt_t)
++# define LIBC_IS_MUSL 1
++# include 
++#else
++# define 

[PATCH v2] netfilter: remove no-op kconfig symbols

2021-04-09 Thread Rui Salvaterra
These have long been obsolete. For reference, here's the Linux version where
each symbol has been dropped:

CONFIG_IP6_NF_QUEUE - 3.5
CONFIG_IP6_NF_TARGET_LOG - 3.4
CONFIG_IP_NF_MATCH_DSCP - 2.6.19
CONFIG_NF_CONNTRACK_IPV4 - 4.19
CONFIG_NF_CONNTRACK_IPV6 - 4.19
CONFIG_NF_CONNTRACK_RTCACHE - OOT, superseded upstream by flow offloading

Signed-off-by: Rui Salvaterra 
---
v2: also removed CONFIG_NF_CONNTRACK_RTCACHE and two references to
CONFIG_NF_CONNTRACK_IPV4 in the WireGuard patches (the QEMU kconfigs).

 include/netfilter.mk| 6 --
 ...reguard-selftests-import-harness-makefile-for-test.patch | 3 +--
 ...reguard-selftests-check-that-route_me_harder-packe.patch | 3 +--
 target/linux/generic/config-5.10| 2 --
 target/linux/generic/config-5.4 | 2 --
 5 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/include/netfilter.mk b/include/netfilter.mk
index 45e9dadf85..803749d931 100644
--- a/include/netfilter.mk
+++ b/include/netfilter.mk
@@ -64,9 +64,7 @@ $(eval $(if $(NF_KMOD),,$(call 
nf_add,IPT_CORE,CONFIG_NETFILTER_XT_MARK, $(P_XT)
 
 # kernel only
 $(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK,CONFIG_NF_CONNTRACK, 
$(P_XT)nf_conntrack),))
-$(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK,CONFIG_NF_CONNTRACK_RTCACHE, 
$(P_XT)nf_conntrack_rtcache),))
 $(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK,CONFIG_NF_DEFRAG_IPV4, 
$(P_V4)nf_defrag_ipv4),))
-$(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK,CONFIG_NF_CONNTRACK_IPV4, 
$(P_V4)nf_conntrack_ipv4),))
 
 $(eval $(call nf_add,IPT_CONNTRACK,CONFIG_NETFILTER_XT_MATCH_STATE, 
$(P_XT)xt_state))
 $(eval $(call nf_add,IPT_CONNTRACK,CONFIG_NETFILTER_XT_TARGET_CT, 
$(P_XT)xt_CT))
@@ -120,7 +118,6 @@ $(eval $(call 
nf_add,IPT_IPOPT,CONFIG_NETFILTER_XT_MATCH_STATISTIC, $(P_XT)xt_st
 $(eval $(call nf_add,IPT_IPOPT,CONFIG_NETFILTER_XT_MATCH_TCPMSS, 
$(P_XT)xt_tcpmss))
 
 $(eval $(call nf_add,IPT_IPOPT,CONFIG_NETFILTER_XT_TARGET_CLASSIFY, 
$(P_XT)xt_CLASSIFY))
-$(eval $(call nf_add,IPT_IPOPT,CONFIG_IP_NF_MATCH_DSCP, $(P_V4)ipt_dscp))
 $(eval $(call nf_add,IPT_IPOPT,CONFIG_IP_NF_TARGET_ECN, $(P_V4)ipt_ECN))
 
 $(eval $(call nf_add,IPT_IPOPT,CONFIG_NETFILTER_XT_MATCH_ECN, $(P_XT)xt_ecn))
@@ -156,17 +153,14 @@ $(eval $(if $(NF_KMOD),$(call 
nf_add,NF_REJECT6,CONFIG_NF_REJECT_IPV6, $(P_V6)nf
 $(eval $(if $(NF_KMOD),$(call nf_add,NF_IPT6,CONFIG_IP6_NF_IPTABLES, 
$(P_V6)ip6_tables),))
 
 $(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK,CONFIG_NF_DEFRAG_IPV6, 
$(P_V6)nf_defrag_ipv6),))
-$(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK6,CONFIG_NF_CONNTRACK_IPV6, 
$(P_V6)nf_conntrack_ipv6),))
 
 $(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_FILTER, 
$(P_V6)ip6table_filter),))
 $(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_MANGLE, 
$(P_V6)ip6table_mangle),))
-$(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_QUEUE, 
$(P_V6)ip6_queue),))
 $(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_NF_LOG_IPV6, 
$(P_V6)nf_log_ipv6),))
 
 $(eval $(if $(NF_KMOD),,$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_IPTABLES, 
ip6t_icmp6)))
 
 
-$(eval $(call nf_add,IPT_IPV6,CONFIG_IP6_NF_TARGET_LOG, $(P_V6)ip6t_LOG))
 $(eval $(call nf_add,IPT_IPV6,CONFIG_IP6_NF_TARGET_REJECT, $(P_V6)ip6t_REJECT))
 
 # ipv6 extra
diff --git 
a/target/linux/generic/backport-5.4/080-wireguard-0073-wireguard-selftests-import-harness-makefile-for-test.patch
 
b/target/linux/generic/backport-5.4/080-wireguard-0073-wireguard-selftests-import-harness-makefile-for-test.patch
index ca3853aa19..bc3d1edeb6 100644
--- 
a/target/linux/generic/backport-5.4/080-wireguard-0073-wireguard-selftests-import-harness-makefile-for-test.patch
+++ 
b/target/linux/generic/backport-5.4/080-wireguard-0073-wireguard-selftests-import-harness-makefile-for-test.patch
@@ -989,7 +989,7 @@ Signed-off-by: Jason A. Donenfeld 
 +}
 --- /dev/null
 +++ b/tools/testing/selftests/wireguard/qemu/kernel.config
-@@ -0,0 +1,86 @@
+@@ -0,0 +1,85 @@
 +CONFIG_LOCALVERSION=""
 +CONFIG_NET=y
 +CONFIG_NETDEVICES=y
@@ -1010,7 +1010,6 @@ Signed-off-by: Jason A. Donenfeld 
 +CONFIG_NETFILTER_XTABLES=y
 +CONFIG_NETFILTER_XT_NAT=y
 +CONFIG_NETFILTER_XT_MATCH_LENGTH=y
-+CONFIG_NF_CONNTRACK_IPV4=y
 +CONFIG_NF_NAT_IPV4=y
 +CONFIG_IP_NF_IPTABLES=y
 +CONFIG_IP_NF_FILTER=y
diff --git 
a/target/linux/generic/backport-5.4/080-wireguard-0116-wireguard-selftests-check-that-route_me_harder-packe.patch
 
b/target/linux/generic/backport-5.4/080-wireguard-0116-wireguard-selftests-check-that-route_me_harder-packe.patch
index 09c1b0b8f8..35abdf8774 100644
--- 
a/target/linux/generic/backport-5.4/080-wireguard-0116-wireguard-selftests-check-that-route_me_harder-packe.patch
+++ 
b/target/linux/generic/backport-5.4/080-wireguard-0116-wireguard-selftests-check-that-route_me_harder-packe.patch
@@ -41,12 +41,11 @@ Signed-off-by: Jason A. Donenfeld 
  ip1 addr add 192.168.242.1/24 dev wg0
 --- a/tools/testing/selftests/wireguard/qemu/kernel.config
 

Re: [PATCH] netfilter: remove no-op kconfig symbols

2021-04-09 Thread Rui Salvaterra
Please ignore this one, I'm going to send a more complete version soon.

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


[PATCH] tplink-safeloader: fix C7v5 factory flashing from vendor fw > v1.1.x

2021-04-09 Thread Petr Štetiar
Currently it's not possible to flash factory images on devices shipped
with vendor firmware versions 1.1.0 Build 20201120 rel. 50406 (published
2020-12-22):

 (curFw_ver, newFw_ver) == (1.1, 1.0) [NM_Error](nm_checkSoftVer) 00848: 
Firmwave not supports, check failed.
 [NM_Error](nm_checkUpdateContent) 01084: software version dismatched
 [NM_Error](nm_buildUpgradeStruct) 01188: checkUpdateContent failed.

They've even following note in release notes:

 Note: You will be unable to downgrade to the previous firmware version after 
updating this firmware.

This version check is in vendor firmware is implemented in
/usr/bin/nvrammanager binary as following code[1]:

 sscanf(buf, "%d.%d.%*s",_fw_major, _fw_minor);
 ...
 if (((int)upd_fw_major < (int)cur_fw_major) ||
 ((ret = 1, cur_fw_major == upd_fw_major && (upd_fw_minor < 
(int)cur_fw_minor {
   ret = 0;
   printf("[NM_Error](%s) %05d: Firmwave not supports, check 
failed.\r\n\r\n","nm_checkSoftVer" ,0x350);
 }
 ...
 return ret;

So in order to fix this and make it future proof it should be enough to
ship our factory firmware images with major version 7 (lucky number).

Tested on latest firmware version 1.1.2 Build 20210125 rel.37999:

 Firmwave supports, check OK.
  (curFw_ver, newFw_ver) == (1.1, 7.0) check firmware ok!
 chekc firmware file success!

1. https://gist.github.com/ynezz/2e0583647d863386a66c3d231541b6d1

Signed-off-by: Petr Štetiar 
---
 tools/firmware-utils/src/tplink-safeloader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/firmware-utils/src/tplink-safeloader.c 
b/tools/firmware-utils/src/tplink-safeloader.c
index da73e1bf307e..ac71b3305ee6 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -1262,7 +1262,7 @@ static struct device_info boards[] = {
"{product_name:Archer 
C7,product_ver:5.0.0,special_id:4B52}\n",
 
.part_trail = 0x00,
-   .soft_ver = "soft_ver:1.0.0\n",
+   .soft_ver = "soft_ver:7.0.0\n",
 
/* We're using a dynamic kernel/rootfs split here */
.partitions = {

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


Re: [PATCH] kernel: drop the conntrack rtcache patch

2021-04-09 Thread Felix Fietkau
On 2021-04-09 00:57, Rui Salvaterra wrote:
> It's in backports-5.4, but it wasn't ever merged. Upstream followed another
> approach, with flow offloading, which has much better performance. Drop this
> obsolete patch and refresh the kernel patches.
> 
> Signed-off-by: Rui Salvaterra 
Acked-by: Felix Fietkau 

- Felix

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


[PATCH v4 1/1] ltq-vdsl-app: extent dsl metrics with power_level and state_detail

2021-04-09 Thread Florian Eckert
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 to the JSON output.

* additional JSON output for state_detail:
"state_detail": {
"exception": false,
"idle": false,
"silent": false,
"handshake": false,
"full-init": false,
"showtime-without-sync": false,
"showtime-with-sync": true,
"resync": false,
"not-initialized": false,
},

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

Possible values are if the information is available:
0: L0
1: L1
2: L2
3: L3

Signed-off-by: Florian Eckert 
---
 .../ltq-vdsl-app/src/src/dsl_cpe_ubus.c   | 34 +--
 1 file changed, 32 insertions(+), 2 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 8eefdfe4d5..d8ebbb584c 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)
+
+   if (str) {
m_str("state", str);
+   c = blobmsg_open_table(, "state_detail");
+   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);
+   blobmsg_close_table(, c);
+   }
 
m_bool("up", out.data.nLineState == DSL_LINESTATE_SHOWTIME_TC_SYNC);
 }
@@ -388,8 +402,24 @@ static void g997_power_management_status(int fd) {
str = NULL;
break;
};
-   if (str)
+
+   if (str) {
m_str("power_state", str);
+   switch (out.data.nPowerManagementStatus) {
+   case DSL_G997_PMS_L0:
+   m_u32("power_level", 0);
+   break;
+   case DSL_G997_PMS_L1:
+   m_u32("power_level", 1);
+   break;
+   case DSL_G997_PMS_L2:
+   m_u32("power_level", 2);
+   break;
+   case DSL_G997_PMS_L3:
+   m_u32("power_level", 3);
+   break;
+   }
+   }
 }
 
 static void g997_xtu_system_enabling(int fd, standard_t *standard) {
-- 
2.20.1


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