Re: [OpenWrt-Devel] [PATCH] ath79: add D-Link DIR-615 rev. E4

2019-11-07 Thread Paul Fertser
On Thu, Nov 07, 2019 at 08:19:27AM +0300, Paul Fertser wrote:
> I see there's some http server mentioned in the wiki article, haven't
> tried it yet (and I can't understand what "simple" web browser it
> talks about, probably there should be a curl command instead?),

So I gave it a try but the results are not fruitful. This command
should work:

curl http://192.168.0.1/cgi/index -F 
Send=@built/targets/ath79/tiny/openwrt-ath79-tiny-dlink_dir-615-e4-squashfs-factory.bin

BUT the recovery HTTP server is using a very old uIP implementation
that seems to be unable to play well along with the current TCP stack
in Linux. The result is a very slow upload (left it overnight and it's
still not finished).

>From working with uIP before on an embedded target I know that it
doesn't support delayed ACKs in any form, for any packet it sends it
waits for an ACK before sending the next, and I would guess that for
any packet it receives it's better to wait for its ACK before sending
the next (as I see plenty of duplicated ACKs from this backup server
all confirming just the first packet received, and then long wait
before retransmission). The problem is in the number of packets sent,
not the size (so changing MTU/MSS doesn't help much).

I haven't been able to find a way to trick it into behaving, sorry.

-- 
Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
mailto:fercer...@gmail.com

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


[OpenWrt-Devel] ath79: Force usb host mode for ar9331

2019-11-07 Thread Micke Prag
In commit 00ea16557d [1] the way usb is initiated was changed. Instead
of initiate both ehci-platform and ci_hdrc the bootstrap status register
is checked and used to determine which platform to initiate.

Unfortunately this break my board since the gpio used to determine this
is used for other purposes.

dev-usb.h only exposes one function: 
void ath79_register_usb(void);
so there is not much to alter the way usb is initiated.

I tried to write to the bootstrap register but unfortunately this did
not seem to work:

u32 t;
t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
pr_warn("ath79: Register before %X", t);
t |= AR933X_BOOTSTRAP_USB_MODE_HOST;
ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP, t);
pr_warn("ath79: Register after %X",
ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP));

Gives the following output:

ath79: Register before 42202
ath79: Register after 42202

How can I solve this?


[1] https://github.com/openwrt/openwrt/commit/00ea16557d


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


Re: [OpenWrt-Devel] [PATCH uci 2/2] build: Add -Wclobbered to detect problems with longjmp

2019-11-07 Thread Petr Štetiar
Hauke Mehrtens  [2019-11-07 23:51:50]:

Hi,

> How do we want to go forward with these patches?

as noone provided better fix for those warnings(or proved them wrong) yet,
then I would simply move forward.  Your changes pass all unit tests and CI
compile tests so:

 Acked-by: Petr Štetiar 

-- ynezz

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


[OpenWrt-Devel] [PATCH] xfsprogs: Fix compilation with newer musl

2019-11-07 Thread Rosen Penev
Backported upstream patch.

Signed-off-by: Rosen Penev 
---
 package/utils/xfsprogs/Makefile   |  2 +-
 .../patches/140-copy-file-range.patch | 50 +++
 2 files changed, 51 insertions(+), 1 deletion(-)
 create mode 100644 package/utils/xfsprogs/patches/140-copy-file-range.patch

diff --git a/package/utils/xfsprogs/Makefile b/package/utils/xfsprogs/Makefile
index 353773840a..f717185bb6 100644
--- a/package/utils/xfsprogs/Makefile
+++ b/package/utils/xfsprogs/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=xfsprogs
 PKG_CPE_ID:=cpe:/a:sgi:xfsprogs
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 PKG_VERSION:=4.11.0
 PKG_SOURCE_URL:=@KERNEL/linux/utils/fs/xfs/xfsprogs
 PKG_HASH:=c3a6d87b564d7738243c507df82276bed982265e345363a95f2c764e8a5f5bb2
diff --git a/package/utils/xfsprogs/patches/140-copy-file-range.patch 
b/package/utils/xfsprogs/patches/140-copy-file-range.patch
new file mode 100644
index 00..e3547bb67e
--- /dev/null
+++ b/package/utils/xfsprogs/patches/140-copy-file-range.patch
@@ -0,0 +1,50 @@
+From 8041435de7ed028a27ecca64302945ad455c69a6 Mon Sep 17 00:00:00 2001
+From: "Darrick J. Wong" 
+Date: Mon, 5 Feb 2018 14:38:02 -0600
+Subject: [PATCH] xfs_io: fix copy_file_range symbol name collision
+
+glibc 2.27 has a copy_file_range wrapper, so we need to change our
+internal function out of the way to avoid compiler warnings.
+
+Reported-by: fred...@crux.nu
+Signed-off-by: Darrick J. Wong 
+Reviewed-by: Eric Sandeen 
+Signed-off-by: Eric Sandeen 
+---
+ io/copy_file_range.c | 11 ---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/io/copy_file_range.c b/io/copy_file_range.c
+index d1dfc5a5..99fba20a 100644
+--- a/io/copy_file_range.c
 b/io/copy_file_range.c
+@@ -42,13 +42,18 @@ copy_range_help(void)
+ "));
+ }
+ 
++/*
++ * Issue a raw copy_file_range syscall; for our test program we don't want the
++ * glibc buffered copy fallback.
++ */
+ static loff_t
+-copy_file_range(int fd, loff_t *src, loff_t *dst, size_t len)
++copy_file_range_cmd(int fd, loff_t *src, loff_t *dst, size_t len)
+ {
+   loff_t ret;
+ 
+   do {
+-  ret = syscall(__NR_copy_file_range, fd, src, file->fd, dst, 
len, 0);
++  ret = syscall(__NR_copy_file_range, fd, src, file->fd, dst,
++  len, 0);
+   if (ret == -1) {
+   perror("copy_range");
+   return errno;
+@@ -130,7 +135,7 @@ copy_range_f(int argc, char **argv)
+   copy_dst_truncate();
+   }
+ 
+-  ret = copy_file_range(fd, , , len);
++  ret = copy_file_range_cmd(fd, , , len);
+   close(fd);
+   return ret;
+ }
-- 
2.23.0


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


Re: [OpenWrt-Devel] [PATCH uci 2/2] build: Add -Wclobbered to detect problems with longjmp

2019-11-07 Thread Hauke Mehrtens
On 11/7/19 9:51 AM, Petr Štetiar wrote:
> Hauke Mehrtens  [2019-11-07 00:26:23]:
> 
> Hi,
> 
>>> I didn't looked deeper, but GCC 6,7,8,9 on x86/64 reports following:
>>>
>>>  list.c:626:21: error: variable ‘prev’ might be clobbered by ‘longjmp’ or 
>>> ‘vfork’ [-Werror=clobbered]
>>>   626 |  struct uci_option *prev = NULL;
>>>   | ^~~~
>>>
>>>  list.c:627:14: error: variable ‘value2’ might be clobbered by ‘longjmp’ or 
>>> ‘vfork’ [-Werror=clobbered]
>>>   627 |  const char *value2 = NULL;
>>>   |  ^~
>>
>> I think I also saw these problems in my manual review, but the
>> -Wclobbered did not complain about them for me with gcc 8.3 on MIPS.
> 
> Interesting, out of curiosity which MIPS? BTW I see a consistent gcc 8.3
> behaviour[1] across all CI testing targets (ath79, malta be, imx6, armada
> a-53) with -Wextra and without your patch applied.  You need to click on the
> "[x] Failed" button in order to see the build failure.
> 
> 1. https://gitlab.com/ynezz/openwrt-uci/pipelines/94051766/builds

I also saw these and they are fixed in my patch by adding a volatile
which is the correct fix for these problems.

It was something else where I saw some potential problem in the review,
but GCC was not warning about, as far as I know.

How do we want to go forward with these patches?

Hauke



signature.asc
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] uboot-envtools: Add TARGET_LDFLAGS to fix PIE and RELRO

2019-11-07 Thread Hauke Mehrtens
Forward the OpenWrt TARGET_LDFLAGS to the linker of the fw_printenv tool.
In addition also use the more standard make invocation script.
With this change the fw_printenv tool is built with PIE and Full RELRO
support when activated globally in OpenWrt.

Signed-off-by: Hauke Mehrtens 
---
 package/boot/uboot-envtools/Makefile  | 15 +--
 .../boot/uboot-envtools/patches/001-compile.patch |  5 -
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/package/boot/uboot-envtools/Makefile 
b/package/boot/uboot-envtools/Makefile
index 4be043dcab..f880698e9c 100644
--- a/package/boot/uboot-envtools/Makefile
+++ b/package/boot/uboot-envtools/Makefile
@@ -51,16 +51,11 @@ define Build/Configure
touch $(PKG_BUILD_DIR)/include/generated/autoconf.h
 endef
 
-TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
-
-define Build/Compile
-   $(MAKE) -C $(PKG_BUILD_DIR) \
-   CROSS_COMPILE="$(TARGET_CROSS)" \
-   TARGET_CFLAGS="$(TARGET_CFLAGS)" \
-   HOSTLDFLAGS= \
-   no-dot-config-targets=envtools \
-   envtools
-endef
+MAKE_FLAGS += \
+   TARGET_CFLAGS="$(TARGET_CFLAGS)" \
+   TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \
+   no-dot-config-targets=envtools \
+   envtools
 
 define Package/uboot-envtools/conffiles
 /etc/config/ubootenv
diff --git a/package/boot/uboot-envtools/patches/001-compile.patch 
b/package/boot/uboot-envtools/patches/001-compile.patch
index 34072f309d..5413aa4a41 100644
--- a/package/boot/uboot-envtools/patches/001-compile.patch
+++ b/package/boot/uboot-envtools/patches/001-compile.patch
@@ -1,12 +1,15 @@
 --- a/tools/env/Makefile
 +++ b/tools/env/Makefile
-@@ -8,6 +8,10 @@
+@@ -8,6 +8,13 @@
  # with "CC" here for the maximum code reuse of scripts/Makefile.host.
  override HOSTCC = $(CC)
  
 +ifneq ($(TARGET_CFLAGS),)
 +HOSTCFLAGS = $(TARGET_CFLAGS)
 +endif
++ifneq ($(TARGET_LDFLAGS),)
++HOSTLDFLAGS = $(TARGET_LDFLAGS)
++endif
 +
  # Compile for a hosted environment on the target
  HOST_EXTRACFLAGS  = -I$(srctree)/tools \
-- 
2.17.1


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


Re: [OpenWrt-Devel] [PATCH 1/2] build: image: add common and reproducible IMG_PART_SIGNATURE variable

2019-11-07 Thread Paul Spooren
Thank you for reworking this! Daniel already told me that a fallback is 
required if SOURCE_DATE_EPOCH is unset, this looks like a clean solution.


On 11/7/19 4:09 AM, Petr Štetiar wrote:

From: Paul Spooren 

x86, mvebu and tegra targets are currently using more or less same
SIGNATURE variable which provides unique partition ID/signature, so it
makes sense to refactor it out into common variable which could be
reused by all targets.  While at it, make the content of the variable
reproducible.

Ref: http://lists.infradead.org/pipermail/openwrt-devel/2019-March/016148.html
Signed-off-by: Paul Spooren 
Suggested-by: Jo-Philipp Wich 
[renamed to IMG_PARTSIGNATURE, reworked with epoch+vermagic hash]
Signed-off-by: Petr Štetiar 
---
  include/image.mk | 1 +
  1 file changed, 1 insertion(+)

diff --git a/include/image.mk b/include/image.mk
index 77d456719711..8755c4832abd 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -44,6 +44,7 @@ IMG_PREFIX_VERCODE:=$(if 
$(CONFIG_VERSION_CODE_FILENAMES),$(call sanitize,$(VERS
  
IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(BOARD)$(if
 $(SUBTARGET),-$(SUBTARGET))
  IMG_ROOTFS:=$(IMG_PREFIX)-rootfs
  IMG_COMBINED:=$(IMG_PREFIX)-combined
+IMG_PART_SIGNATURE:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | 
mkhash md5 | head --bytes 8)
  
  MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt
  


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


[OpenWrt-Devel] [PATCH] ipq40xx: u4019: use reset-gpios instead of phy-reset-gpio

2019-11-07 Thread Kristian Evensen
Use reset-gpio instead of the custom phy-reset-gpio property to do phy
reset on the U4019. phy-reset-gpio was incorrectly introduced when we
added support for the U4019, and will be deprecated.

Signed-off-by: Kristian Evensen 
---
 .../arch/arm/boot/dts/qcom-ipq4019-unielec-u4019.dtsi  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-unielec-u4019.dtsi
 
b/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-unielec-u4019.dtsi
index cf67fddd2b..c768e25ca0 100644
--- 
a/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-unielec-u4019.dtsi
+++ 
b/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-unielec-u4019.dtsi
@@ -17,7 +17,8 @@
status = "okay";
pinctrl-0 = <_pins>;
pinctrl-names = "default";
-   phy-reset-gpio = < 47 0>;
+   reset-gpios = < 47 GPIO_ACTIVE_LOW>;
+   reset-delay-us = <2000>;
};
 
ess-psgmii@98000 {
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH 1/2] build: image: add common and reproducible IMG_PART_SIGNATURE variable

2019-11-07 Thread Petr Štetiar
From: Paul Spooren 

x86, mvebu and tegra targets are currently using more or less same
SIGNATURE variable which provides unique partition ID/signature, so it
makes sense to refactor it out into common variable which could be
reused by all targets.  While at it, make the content of the variable
reproducible.

Ref: http://lists.infradead.org/pipermail/openwrt-devel/2019-March/016148.html
Signed-off-by: Paul Spooren 
Suggested-by: Jo-Philipp Wich 
[renamed to IMG_PARTSIGNATURE, reworked with epoch+vermagic hash]
Signed-off-by: Petr Štetiar 
---
 include/image.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/image.mk b/include/image.mk
index 77d456719711..8755c4832abd 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -44,6 +44,7 @@ IMG_PREFIX_VERCODE:=$(if 
$(CONFIG_VERSION_CODE_FILENAMES),$(call sanitize,$(VERS
 
IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(BOARD)$(if
 $(SUBTARGET),-$(SUBTARGET))
 IMG_ROOTFS:=$(IMG_PREFIX)-rootfs
 IMG_COMBINED:=$(IMG_PREFIX)-combined
+IMG_PART_SIGNATURE:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | 
mkhash md5 | head --bytes 8)
 
 MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt
 

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


[OpenWrt-Devel] [PATCH 2/2] x86, tegra, mvebu: image: use common reproducible IMG_PART_SIGNATURE

2019-11-07 Thread Petr Štetiar
From: Paul Spooren 

These targets are currently using more or less same SIGNATURE variable
which provides unique partition ID/signature, so it makes sense to
refactor it out into common IMG_PART_SIGNATURE variable which could be
reused by all targets.

This is another step in the direction of reproducible OpenWrt images.

Signed-off-by: Paul Spooren 
[split into separate commit, renamed to IMG_PART_SIGNATURE]
Signed-off-by: Petr Štetiar 
---
 target/linux/mvebu/image/Makefile | 8 +++-
 target/linux/tegra/image/Makefile | 6 ++
 target/linux/x86/image/Makefile   | 5 ++---
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/target/linux/mvebu/image/Makefile 
b/target/linux/mvebu/image/Makefile
index 967a1e4ee152..ce1344a5470e 100644
--- a/target/linux/mvebu/image/Makefile
+++ b/target/linux/mvebu/image/Makefile
@@ -13,12 +13,10 @@ include $(INCLUDE_DIR)/image.mk
 
 KERNEL_LOADADDR := 0x8000
 
-SIGNATURE:=$(shell printf "%.8s" $(SOURCE_DATE_EPOCH))
-
 define Build/boot-scr
rm -f $@-boot.scr
sed \
-   -e 's#@ROOT@#$(SIGNATURE)#g' \
+   -e 's#@ROOT@#$(IMG_PART_SIGNATURE)#g' \
-e 's#@DTB@#$(firstword $(DEVICE_DTS))#g' \
$(BOOT_SCRIPT).bootscript > $@-new.bootscript
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d 
$@-new.bootscript $@-boot.scr
@@ -42,7 +40,7 @@ define Build/boot-img-ext4
 endef
 
 define Build/sdcard-img
-   SIGNATURE="$(SIGNATURE)" \
+   SIGNATURE="$(IMG_PART_SIGNATURE)" \
./gen_mvebu_sdcard_img.sh $@ \
$(if $(UBOOT),$(STAGING_DIR_IMAGE)/$(UBOOT)) \
c $(CONFIG_TARGET_KERNEL_PARTSIZE) $@.boot \
@@ -50,7 +48,7 @@ define Build/sdcard-img
 endef
 
 define Build/sdcard-img-ext4
-   SIGNATURE="$(SIGNATURE)" \
+   SIGNATURE="$(IMG_PART_SIGNATURE)" \
./gen_mvebu_sdcard_img.sh $@ \
$(if $(UBOOT),$(STAGING_DIR_IMAGE)/$(UBOOT)) \
83 $(CONFIG_TARGET_KERNEL_PARTSIZE) $@.bootimg \
diff --git a/target/linux/tegra/image/Makefile 
b/target/linux/tegra/image/Makefile
index 2ce86599954c..10bada9c38b1 100644
--- a/target/linux/tegra/image/Makefile
+++ b/target/linux/tegra/image/Makefile
@@ -7,8 +7,6 @@
 include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/image.mk
 
-SIGNATURE:=$(shell printf "%.8s" $(SOURCE_DATE_EPOCH))
-
 define Build/tegra-sdcard
rm -fR $@.boot
mkdir -p $@.boot
@@ -17,7 +15,7 @@ define Build/tegra-sdcard
$(foreach dtb,$(DEVICE_DTS),$(CP) $(DTS_DIR)/$(dtb).dtb 
$@.boot), \
$(CP) $(DTS_DIR)/*.dtb $@.boot)
sed \
-   -e 's#@ROOT@#$(SIGNATURE)#g' \
+   -e 's#@ROOT@#$(IMG_PART_SIGNATURE)#g' \
-e 's#@KERNEL@#$(KERNEL_NAME)#g' \
$(BOOT_SCRIPT) > $@-boot.scr
mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
@@ -25,7 +23,7 @@ define Build/tegra-sdcard
-d $@-boot.scr \
$@.boot/boot.scr
 
-   SIGNATURE="$(SIGNATURE)" \
+   SIGNATURE="$(IMG_PART_SIGNATURE)" \
$(SCRIPT_DIR)/gen_image_generic.sh \
$@ \
$(CONFIG_TARGET_KERNEL_PARTSIZE) $@.boot \
diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile
index ac70e771c86f..4383bcdcb2b1 100644
--- a/target/linux/x86/image/Makefile
+++ b/target/linux/x86/image/Makefile
@@ -40,9 +40,8 @@ ifneq ($(GRUB_TERMINALS),)
   GRUB_TERMINAL_CONFIG := terminal_input $(GRUB_TERMINALS); terminal_output 
$(GRUB_TERMINALS)
 endif
 
-SIGNATURE:=$(shell perl -e 'printf("%08x", rand(0x))')
 ROOTPART:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_PARTNAME))
-ROOTPART:=$(if $(ROOTPART),$(ROOTPART),PARTUUID=$(SIGNATURE)-02)
+ROOTPART:=$(if $(ROOTPART),$(ROOTPART),PARTUUID=$(IMG_PART_SIGNATURE)-02)
 
 GRUB_TIMEOUT:=$(call qstrip,$(CONFIG_GRUB_TIMEOUT))
 GRUB_TITLE:=$(call qstrip,$(CONFIG_GRUB_TITLE))
@@ -80,7 +79,7 @@ ifneq ($(CONFIG_GRUB_IMAGES),)
-e 's#@TITLE@#$(GRUB_TITLE)#g' \
./grub.cfg > $(KDIR)/root.grub/boot/grub/grub.cfg
-$(CP) $(STAGING_DIR_ROOT)/boot/. $(KDIR)/root.grub/boot/
-   PADDING="1" SIGNATURE="$(SIGNATURE)" PATH="$(TARGET_PATH)" 
$(SCRIPT_DIR)/gen_image_generic.sh \
+   PADDING="1" SIGNATURE="$(IMG_PART_SIGNATURE)" PATH="$(TARGET_PATH)" 
$(SCRIPT_DIR)/gen_image_generic.sh \
$(BIN_DIR)/$(IMG_COMBINED)-$(1).img \
$(CONFIG_TARGET_KERNEL_PARTSIZE) $(KDIR)/root.grub \
$(CONFIG_TARGET_ROOTFS_PARTSIZE) $(KDIR)/root.$(1) \

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


[OpenWrt-Devel] [PATCH v2 1/1] rpcd: add respawn param

2019-11-07 Thread Florian Eckert
The rpcd service is an important service, but if the service stops
working for any reason, no one will ever respawn that service. With this
commit, the procd service will monitor if the rpcd service
is running. If the rpcd service has crashed, then
procd respawns the rpcd service.

Signed-off-by: Florian Eckert 
---
 package/system/rpcd/Makefile| 2 +-
 package/system/rpcd/files/rpcd.init | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile
index 6f23bbe96e..fcbcc613a6 100644
--- a/package/system/rpcd/Makefile
+++ b/package/system/rpcd/Makefile
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=rpcd
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git
diff --git a/package/system/rpcd/files/rpcd.init 
b/package/system/rpcd/files/rpcd.init
index 447133c67a..3e9ea5bbf3 100755
--- a/package/system/rpcd/files/rpcd.init
+++ b/package/system/rpcd/files/rpcd.init
@@ -12,6 +12,7 @@ start_service() {
 
procd_open_instance
procd_set_param command "$PROG" ${socket:+-s "$socket"} ${timeout:+-t 
"$timeout"}
+   procd_set_param respawn ${respawn_retry:-0}
procd_close_instance
 }
 
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH] uqmi: add timeout parameter

2019-11-07 Thread Zefir Kurtisi
Working with Quectel EM12 LTE-module, we observe
regular stalls of the QMI interface which cause
a request issued by uqmi to hang forever.

Most reproducibly this happens after the device
has been power-cycled and left untouched for a
while (~ 60s+). Most of the time the very first
QMI request fails, since it is not responded by
the module. This is the strace from such a run
(from --get-pin-status):

 open("/dev/cdc-wdm0", O_RDWR|O_EXCL|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) = 6
 fcntl64(6, F_GETFL) = 0x10802 (flags 
O_RDWR|O_NONBLOCK|O_LARGEFILE)
 fcntl64(6, F_SETFL, O_RDWR|O_NONBLOCK|O_LARGEFILE) = 0
 epoll_ctl(3, EPOLL_CTL_ADD, 6, {EPOLLIN|EPOLLRDHUP|EPOLLET, {u32=268567076, 
u64=1153486808202346496}}) = 0
 write(6, "\1\17\0\0\0\0\0\1\"\0\4\0\1\1\0\2", 16) = 16
 clock_gettime(CLOCK_MONOTONIC, {tv_sec=95, tv_nsec=583444789}) = 0
 clock_gettime(CLOCK_MONOTONIC, {tv_sec=95, tv_nsec=583770264}) = 0
 epoll_pwait(3,
 [ hang forever ]

After killing the blocked uqmi process, the next
request works as expected.

We don't know whether this is a device FW issue
(we use the latest EM12GPAR01A15M4G) or whether
the device enters some undocumented power-save
mode after idling for some time.

This patch extends uqmi with a timeout option
(-t, --timeout ) which if set terminates a
request after the given amount of msecs. In
our usecase it provides a means of preventing
infinitively stuck QMI requests. Since we
observe the issue only for the very first
request after cold-boot, we use a dummy access
early in qmi.sh, e.g.
  uqmi -d /dev/cdc-wdm0 --get-pin-status -t 3000 >/dev/null 2>&1

This ensures the QMI interface is un-stuck in
case it entered the stall-state observed. The
change is intentionally not included in this
commit, since you don't need it if it works
for you.


Signed-off-by: Zefir Kurtisi 
---
 main.c | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/main.c b/main.c
index 9b43e5e..aa4634c 100644
--- a/main.c
+++ b/main.c
@@ -44,6 +44,7 @@ static const struct option uqmi_getopt[] = {
{ "keep-client-id", required_argument, NULL, 'k' },
{ "release-client-id", required_argument, NULL, 'r' },
{ "mbim",  no_argument, NULL, 'm' },
+   { "timeout", required_argument, NULL, 't' },
{ NULL, 0, NULL, 0 }
 };
 #undef __uqmi_command
@@ -57,6 +58,7 @@ static int usage(const char *progname)
"  --keep-client-id :  Keep Client ID for service 
\n"
"  --release-client-id :   Release Client ID after 
exiting\n"
"  --mbim, -mNAME is an MBIM device 
with EXT_QMUX support\n"
+   "  --timeout, -t response timeout in 
msecs\n"
"\n"
"Services:   dms, nas, pds, wds, wms\n"
"\n"
@@ -103,6 +105,14 @@ static void handle_exit_signal(int signal)
uloop_end();
 }
 
+static void _request_timeout_handler(struct uloop_timeout *timeout)
+{
+   fprintf(stderr, "Request timed out\n");
+   handle_exit_signal(0);
+}
+
+struct uloop_timeout request_timeout = { .cb = _request_timeout_handler, };
+
 int main(int argc, char **argv)
 {
static struct qmi_dev dev;
@@ -112,7 +122,7 @@ int main(int argc, char **argv)
signal(SIGINT, handle_exit_signal);
signal(SIGTERM, handle_exit_signal);
 
-   while ((ch = getopt_long(argc, argv, "d:k:sm", uqmi_getopt, NULL)) != 
-1) {
+   while ((ch = getopt_long(argc, argv, "d:k:smt:", uqmi_getopt, NULL)) != 
-1) {
int cmd_opt = CMD_OPT(ch);
 
if (ch < 0 && cmd_opt >= 0 && cmd_opt < __UQMI_COMMAND_LAST) {
@@ -136,6 +146,9 @@ int main(int argc, char **argv)
case 'm':
dev.is_mbim = true;
break;
+   case 't':
+   uloop_timeout_set(_timeout, atol(optarg));
+   break;
default:
return usage(argv[0]);
}
-- 
2.17.1


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


[OpenWrt-Devel] [PATCH 1/1] uhttpd: add enable instance option

2019-11-07 Thread Florian Eckert
With this change it is now possible to switch off single instances of
the uhttpd config. Until now it was only possible to switch all
instances of uhttpd on or off.

Signed-off-by: Florian Eckert 
---
 package/network/services/uhttpd/Makefile  | 2 +-
 package/network/services/uhttpd/files/uhttpd.init | 4 
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/package/network/services/uhttpd/Makefile 
b/package/network/services/uhttpd/Makefile
index 85b7be7607..2d1fbf4492 100644
--- a/package/network/services/uhttpd/Makefile
+++ b/package/network/services/uhttpd/Makefile
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=uhttpd
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git
diff --git a/package/network/services/uhttpd/files/uhttpd.init 
b/package/network/services/uhttpd/files/uhttpd.init
index 6322473b97..869f79bea2 100755
--- a/package/network/services/uhttpd/files/uhttpd.init
+++ b/package/network/services/uhttpd/files/uhttpd.init
@@ -98,6 +98,10 @@ start_instance()
local cfg="$1"
local realm="$(uci_get system.@system[0].hostname)"
local listen http https interpreter indexes path handler httpdconf 
haveauth
+   local enabled
+
+   config_get_bool enabled "$cfg" 'enabled' 1
+   [ $enabled -gt 0 ] || return
 
procd_open_instance
procd_set_param respawn
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH 1/1] rpcd: add respawn param

2019-11-07 Thread Florian Eckert
The rpcd service is an important service, but if the service stops
working for any reason, no one will ever respawn that service. With this
commit, the procd service will monitor if the rpcd service
is running. If the rpcd service has crashed, then
procd respawns the rpcd service.

Signed-off-by: Florian Eckert 
---
 package/system/rpcd/Makefile| 2 +-
 package/system/rpcd/files/rpcd.init | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile
index 6f23bbe96e..fcbcc613a6 100644
--- a/package/system/rpcd/Makefile
+++ b/package/system/rpcd/Makefile
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=rpcd
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git
diff --git a/package/system/rpcd/files/rpcd.init 
b/package/system/rpcd/files/rpcd.init
index 447133c67a..f75d0e0f0e 100755
--- a/package/system/rpcd/files/rpcd.init
+++ b/package/system/rpcd/files/rpcd.init
@@ -12,6 +12,7 @@ start_service() {
 
procd_open_instance
procd_set_param command "$PROG" ${socket:+-s "$socket"} ${timeout:+-t 
"$timeout"}
+   procd_set_param respawn
procd_close_instance
 }
 
-- 
2.20.1


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


Re: [OpenWrt-Devel] [PATCH uci 2/2] build: Add -Wclobbered to detect problems with longjmp

2019-11-07 Thread Petr Štetiar
Hauke Mehrtens  [2019-11-07 00:26:23]:

Hi,

> > I didn't looked deeper, but GCC 6,7,8,9 on x86/64 reports following:
> > 
> >  list.c:626:21: error: variable ‘prev’ might be clobbered by ‘longjmp’ or 
> > ‘vfork’ [-Werror=clobbered]
> >   626 |  struct uci_option *prev = NULL;
> >   | ^~~~
> > 
> >  list.c:627:14: error: variable ‘value2’ might be clobbered by ‘longjmp’ or 
> > ‘vfork’ [-Werror=clobbered]
> >   627 |  const char *value2 = NULL;
> >   |  ^~
> 
> I think I also saw these problems in my manual review, but the
> -Wclobbered did not complain about them for me with gcc 8.3 on MIPS.

Interesting, out of curiosity which MIPS? BTW I see a consistent gcc 8.3
behaviour[1] across all CI testing targets (ath79, malta be, imx6, armada
a-53) with -Wextra and without your patch applied.  You need to click on the
"[x] Failed" button in order to see the build failure.

1. https://gitlab.com/ynezz/openwrt-uci/pipelines/94051766/builds

-- ynezz

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