Re: [OpenWrt-Devel] [PATCH] wireguard: bump to 0.0.20180802

2018-08-03 Thread Yousong Zhou
On Sat, 4 Aug 2018 at 04:13, Jason A. Donenfeld  wrote:
>
> Signed-off-by: Jason A. Donenfeld 
> ---
>  package/network/services/wireguard/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/package/network/services/wireguard/Makefile 
> b/package/network/services/wireguard/Makefile
> index a88dca1..d314cd5 100644
> --- a/package/network/services/wireguard/Makefile
> +++ b/package/network/services/wireguard/Makefile
> @@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk
>
>  PKG_NAME:=wireguard
>
> -PKG_VERSION:=0.0.20180718
> +PKG_VERSION:=0.0.20180802
>  PKG_RELEASE:=2

Applied after resetting PKG_RELEASE to 1 and adding changelog from the
announcement.  Thank you

yousong

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


[OpenWrt-Devel] [PATCH 1/1] uclient: update to latest git HEAD

2018-08-03 Thread Tobias Schramm
f2573da uclient-fetch: use package name pattern in message for missing SSL 
library
9fd8070 uclient-fetch: Check for nullpointer returned by 
uclient_get_url_filename
f41ff60 uclient-http: basic auth: Handle memory allocation failure
a73b23b uclient-http: auth digest: Handle multiple possible memory allocation 
failures
66fb58d uclient-http: Handle memory allocation failure
2ac991b uclient: Handle memory allocation failure for url
63beea4 uclient-http: Implement error handling for header-sending
eb850df uclient-utils: Handle memory allocation failure for url file name
ae1c656 uclient-http: Close ustream file handle only if allocated

Signed-off-by: Tobias Schramm 
---
 package/libs/uclient/Makefile | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/package/libs/uclient/Makefile b/package/libs/uclient/Makefile
index 3eefa2e012..888fce3e2a 100644
--- a/package/libs/uclient/Makefile
+++ b/package/libs/uclient/Makefile
@@ -4,10 +4,10 @@ PKG_NAME:=uclient
 PKG_RELEASE=1
 
 PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL=$(LEDE_GIT)/project/uclient.git
-PKG_SOURCE_DATE:=2017-11-02
-PKG_SOURCE_VERSION:=4b87d83160fec70d50b7fcd736a8c538c28a016c
-PKG_MIRROR_HASH:=4bbb4d5f295ebdcd67fec87a6794168bea2176a42cb2907c47d8566fb33dafb3
+PKG_SOURCE_URL=$(PROJECT_GIT)/project/uclient.git
+PKG_SOURCE_DATE:=2018-08-03
+PKG_SOURCE_VERSION:=ae1c656ff041c6f1ccb37b070fa261e0d71f2b12
+PKG_MIRROR_HASH:=e88c92f880d3c1cf4162f62c4eeb8986baa8d73772e51eed3a60a8346aeb1b7c
 CMAKE_INSTALL:=1
 
 PKG_BUILD_DEPENDS:=ustream-ssl
-- 
2.18.0


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


[OpenWrt-Devel] [PATCH 0/1] uclient: update uclient to latest git HEAD

2018-08-03 Thread Tobias Schramm
Hey,

I'd like to update uclient in LEDE 17.01 to the latest git HEAD
(ae1c656ff041c6f1ccb37b070fa261e0d71f2b12) since there have been quite a
few bugfixes regarding error handling and memory management and most
importantly a bugfix that prevents libuclient from erroneously closing
STDIN.

I've takem the liberty to steal Jo-Philipps update commit from the 18.06
branch and rebranded it so people know who to blame in case it breaks ;)
(It really shouldn't though, I've spent some time testing the changes
and there were no issues whatsoever)

I hope this is the proper procedure to request patching for LEDE, please
let me know if it isn't.


Cheers,

Tobias


Tobias Schramm (1):
  uclient: update to latest git HEAD

 package/libs/uclient/Makefile | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

-- 
2.18.0


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


[OpenWrt-Devel] [PATCH] kernel: modules: fix kmod-regmap redux

2018-08-03 Thread Christian Lamparter
Jonas Gorski commented on the previous patch:
|This is actually the wrong fix and papers over an issue in one of our
|local patches.
|
|We intentionally allow regmap to be built as a module, see
|
|/target/linux/generic/hack-4.14/259-regmap_dynamic.patch
|[...]
|[The regulator code] optionally supports regmap thanks to the stubs
|provided if regmap is disabled - which breaks if you compile regmap
|as a module.

In order to mitigate this issue, this patch reverts the previous patch
and replaces the existing IS_ENABLED(CONFIG_REGMAP) with
IS_REACHABLE(CONFIG_REGMAP). This solves this particular issue as the
regulator code will now automatically fallback to the regmap stubs in
case the kmod-regmap module is enabled, but nothing else sets
CONFIG_REGMAP=y.

Note: There's still a potential issue that this patch doesn't solve:
If someone ever wants to make a OpenWrt kernel package for a
regulator module that requires the REGMAP feature for a target that
doesn't set CONFIG_REGMAP=y but has CONFIG_REGULATOR=y, the resulting
kmod-regulator-xyz package will not work on the target.
Luckily, there aren't any in-tree OpenWrt kernel module packages for
regulators at the moment. On the bright side: regmap is a critical
part nowadays and all new and upcoming architectures require it by
default. This will likely only ever be a problem for legacy targets
and devices that cannot afford to enable REGMAP.

Cc: Jonas Gorski 
Cc: John Crispin 
Fixes: d00913d1215b ("kernel: modules: fix kmod-regmap")
Signed-off-by: Christian Lamparter 
---

yeee, as usual: nothing is ever complete or simple...
If anyone does have a good idea how to fully tackle the
"final" issue above: Then let's hear it! In the mean time:
Let's try this as an better interim build fix.
---
 package/kernel/linux/modules/other.mk   | 2 +-
 target/linux/generic/hack-4.14/259-regmap_dynamic.patch | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/kernel/linux/modules/other.mk 
b/package/kernel/linux/modules/other.mk
index dd037cf86c..7e18a21db3 100644
--- a/package/kernel/linux/modules/other.mk
+++ b/package/kernel/linux/modules/other.mk
@@ -718,7 +718,7 @@ define KernelPackage/regmap
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Generic register map support
   DEPENDS:=+kmod-lib-lzo +kmod-i2c-core
-  KCONFIG:=CONFIG_REGMAP=y \
+  KCONFIG:=CONFIG_REGMAP \
   CONFIG_REGMAP_MMIO \
   CONFIG_REGMAP_SPI \
   CONFIG_REGMAP_I2C \
diff --git a/target/linux/generic/hack-4.14/259-regmap_dynamic.patch 
b/target/linux/generic/hack-4.14/259-regmap_dynamic.patch
index 1c6e78df30..458b7c35a1 100644
--- a/target/linux/generic/hack-4.14/259-regmap_dynamic.patch
+++ b/target/linux/generic/hack-4.14/259-regmap_dynamic.patch
@@ -103,7 +103,7 @@ Signed-off-by: Felix Fietkau 
  })
  
 -#ifdef CONFIG_REGMAP
-+#if IS_ENABLED(CONFIG_REGMAP)
++#if IS_REACHABLE(CONFIG_REGMAP)
  
  enum regmap_endian {
/* Unspecified -> 0 -> Backwards compatible default */
-- 
2.18.0


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


[OpenWrt-Devel] Merged: uclient-http: Close ustream file handle only if allocated

2018-08-03 Thread Jo-Philipp Wich
Merged into project/uclient.git, branch master at
http://git.openwrt.org/?p=project/uclient.git.

Thank you!


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


[OpenWrt-Devel] [PATCH 1/1] uclient-http: Close ustream file handle only if allocated

2018-08-03 Thread Tobias Schramm
Since the connection setup in uclient_do_connect can fail before
ustream_init_fd is called we must check the fd was actually allocated
before closing it, else we would close STDIN.

Signed-off-by: Tobias Schramm 
---
 uclient-http.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/uclient-http.c b/uclient-http.c
index ebe7758..8d6d327 100644
--- a/uclient-http.c
+++ b/uclient-http.c
@@ -149,7 +149,8 @@ static void uclient_http_disconnect(struct uclient_http *uh)
if (uh->ssl)
ustream_free(>ussl.stream);
ustream_free(>ufd.stream);
-   close(uh->ufd.fd.fd);
+   if(uh->ufd.fd.fd)
+   close(uh->ufd.fd.fd);
uh->us = NULL;
 }
 
-- 
2.18.0


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


[OpenWrt-Devel] [PATCH 0/1] uclient-http: Close ustream file handle only if allocated

2018-08-03 Thread Tobias Schramm
Hi,

this patch fixes a bug in uclient that caused it to close STDIN if the
connection setup failed very early on.

Together with a small oversight in busybox this lead to quite an
interesting bug in Freifunk Gluon:
https://github.com/freifunk-gluon/gluon/issues/1496


Cheers,

Tobias


Tobias Schramm (1):
  uclient-http: Close ustream file handle only if allocated

 uclient-http.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

-- 
2.18.0


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


[OpenWrt-Devel] [PATCH] wireguard: bump to 0.0.20180802

2018-08-03 Thread Jason A. Donenfeld
Signed-off-by: Jason A. Donenfeld 
---
 package/network/services/wireguard/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/network/services/wireguard/Makefile 
b/package/network/services/wireguard/Makefile
index a88dca1..d314cd5 100644
--- a/package/network/services/wireguard/Makefile
+++ b/package/network/services/wireguard/Makefile
@@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=wireguard
 
-PKG_VERSION:=0.0.20180718
+PKG_VERSION:=0.0.20180802
 PKG_RELEASE:=2
 
 PKG_SOURCE:=WireGuard-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=https://git.zx2c4.com/WireGuard/snapshot/
-PKG_HASH:=083c093a6948c8d38f92e7ea5533f9ff926019f24dc2612ea974851ed3e24705
+PKG_HASH:=cd1da34b377d58df760aadf69ced045081517570586fc2d4eed7f09f5d5a47c6
 
 PKG_LICENSE:=GPL-2.0 Apache-2.0
 PKG_LICENSE_FILES:=COPYING
-- 
2.18.0


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


Re: [OpenWrt-Devel] [PATCH] kernel: modules: fix kmod-regmap

2018-08-03 Thread Jonas Gorski
On 3 August 2018 at 18:00, Christian Lamparter  wrote:
> diff --git a/package/kernel/linux/modules/other.mk 
> b/package/kernel/linux/modules/other.mk
> index dd037cf86c..7e18a21db3 100644
> --- a/package/kernel/linux/modules/other.mk
> +++ b/package/kernel/linux/modules/other.mk
> @@ -718,7 +718,7 @@ define KernelPackage/regmap
>SUBMENU:=$(OTHER_MENU)
>TITLE:=Generic register map support
>DEPENDS:=+kmod-lib-lzo +kmod-i2c-core
> -  KCONFIG:=CONFIG_REGMAP=y \
> +  KCONFIG:=CONFIG_REGMAP \
>CONFIG_REGMAP_MMIO \
>CONFIG_REGMAP_SPI \
>CONFIG_REGMAP_I2C \
> diff --git a/target/linux/generic/hack-4.14/259-regmap_dynamic.patch 
> b/target/linux/generic/hack-4.14/259-regmap_dynamic.patch
> index 1c6e78df30..458b7c35a1 100644
> --- a/target/linux/generic/hack-4.14/259-regmap_dynamic.patch
> +++ b/target/linux/generic/hack-4.14/259-regmap_dynamic.patch
> @@ -103,7 +103,7 @@ Signed-off-by: Felix Fietkau 
>   })
>
>  -#ifdef CONFIG_REGMAP
> -+#if IS_ENABLED(CONFIG_REGMAP)
> ++#if IS_REACHABLE(CONFIG_REGMAP)
>
>   enum regmap_endian {
> /* Unspecified -> 0 -> Backwards compatible default */
> ---
>
> I think this should do just that. To quote IS_REACHABLE help text:"
> IS_REACHABLE(CONFIG_FOO) evaluates to 1 if the currently compiled
> code can call a function defined in code compiled based on CONFIG_FOO.
> This is similar to IS_ENABLED(), but returns false when invoked from
> built-in code when CONFIG_FOO is set to 'm'."
>
> and it should combine the best of both worlds. (And maybe make it
> possible to disable the REGMAP=y from ath79-tiny. Any testers?)

Ooh, I didn't know that one exists! Nice find! Yes, that should
fix it in a clean way without introducing more hacks.

I really like this one!


Regards
Jonas

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


[OpenWrt-Devel] [PATCH] base-files: make wifi report unknown command

2018-08-03 Thread Thibaut VARÈNE
Avoid having /sbin/wifi silently ignore unknown keywords and execute
"enable"; instead display the help message and exit with an error.

Signed-off-by: Thibaut VARÈNE 
---
 package/base-files/files/sbin/wifi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/sbin/wifi 
b/package/base-files/files/sbin/wifi
index 83befc0d6f..09e483ec55 100755
--- a/package/base-files/files/sbin/wifi
+++ b/package/base-files/files/sbin/wifi
@@ -241,5 +241,5 @@ case "$1" in
reload) wifi_reload "$2";;
reload_legacy) wifi_reload_legacy "$2";;
--help|help) usage;;
-   *) ubus call network reload; wifi_updown "enable" "$2";;
+   *) usage; exit 1;;
 esac
-- 
2.13.6 (Apple Git-96)


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


Re: [OpenWrt-Devel] [PATCH] kernel: modules: fix kmod-regmap

2018-08-03 Thread Christian Lamparter
On Thursday, August 2, 2018 11:43:50 AM CEST Jonas Gorski wrote:
> On 1 August 2018 at 22:44, Christian Lamparter  wrote:
>> On Wednesday, August 1, 2018 3:21:00 PM CEST Jonas Gorski wrote:
>>> On 30/07/18 22:33, Christian Lamparter wrote:

 This patch fixes the a compile issue that was triggered by
 apm821xx/sata when kmod-regmap was selected.

 The CONFIG_REGMAP is declared in drivers/base/regmap/Kconfig
 as type "bool" and not "tristate". Hence the symbol should
 never be set to module, as this confuses the #if CONFIG_REGMAP
 guards in include/linux/regmap.h:
>>> This is actually the wrong fix and papers over an issue in one of our
>>> local patches.
>>> [...]
>>>
>>> We intentionally allow regmap to be built as a module, see
>>>
>>> https://github.com/openwrt/openwrt/blob/master/target/linux/generic/hack-4.14/259-regmap_dynamic.patch
>>>
>>> So there are likely some additional EXPORT_SYMBOL_GPL()s required instead.
>> Thanks for FYI, I missed this patch completely.
>>
>> I found that the issue lies in the upstream regulator core code.
>> It is using these regmap's functions. And the CONFIG_REGULATOR symbol that 
>> pulls
>> in the core's code is sadly a bool menuconfig option... so CONFIG_REGMAP 
>> pretty
>> much becomes a requirement/select for the REGULATOR.
>
> This is one of the more trickier variants, it optionally supports
> regmap thanks to the stubs provided if regmap is disabled - which
> breaks if you compile regmap as a module. I expect this to happen
> more in the future.
>From what I can tell, this did already happend in the past as well.

https://github.com/openwrt/archive/commit/5e76bea8b4d45b87ea237bc19bcf8a2ac2ce9a42

Sadly, there's no explanation in the commit message. I guess it was
a different time back then. Anyway, I can tell from my previous post,
that the issue can fixed in the same way (i.e. adding CONFIG_REGMAP=y
to the sata/config-default and a revert of the kmod-regmap patch).
 
> This is a bit tricky to solve. We can't just generally stub out the
> regmap stuff unless compiled in, as a lot of regulators depend on it.
Right, it's becoming very tricky in OpenWrt patch context. In vanilla linux
it's pretty straight forward, since it does not allow regmap to be a module.
And I don't think upstream will be changing its stance on a regmap module.
>From their POV "in upstream everything works as intended" and regmap is a
critical part of many subsystems that "you want anyway (tm)".
Which is sort of true too, but more to this later.

> A proper fix is likely a bit more work (as usual).
This begs the question if a proper fix for a hack makes sense or not.
It's definitely easier to follow kirkwood target and just add the
CONFIG_REGMAP=y to the config of apm821xx/sata and revert the
kmod-regmap patch.

>> diff --git a/target/linux/generic/hack-4.14/259-regmap_dynamic.patch 
>> b/target/linux/generic/hack-4.14/259-regmap_dynamic.patch
>> index 1c6e78df30..35803c3181 100644
>> --- a/target/linux/generic/hack-4.14/259-regmap_dynamic.patch
>> +++ b/target/linux/generic/hack-4.14/259-regmap_dynamic.patch
>> @@ -96,6 +97,15 @@ Signed-off-by: Felix Fietkau 
>>   postcore_initcall(regmap_initcall);
>>  +
>>  +MODULE_LICENSE("GPL");
>> +--- a/drivers/regulator/Kconfig
>>  b/drivers/regulator/Kconfig
>> +@@ -1,5 +1,6 @@
>> + menuconfig REGULATOR
>> +   bool "Voltage and Current Regulator Support"
>> ++  select REGMAP
> 
> This will cause REGMAP to be included regardless if needed or not, but
> would be acceptable (at least to me) as an interim build fix (most
> targets using REGULATORs likely won't be part of the 4/32 gang
> anyway).
Yes exactly that is the idea. I did make that patch with ar71xx + tiny 
and ramips rt288x/rt305x in mind. The situation is a little bit different
with ath79-tiny as its config-4.14 already sets:

CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y

And it inherits the CONFIG_REGMAP=y from the main ath79 config.

If the REGMAP=y is only needed there because of the REGULATOR_FIXED_VOLTAGE
(which does not need it), then it could make sense to extend the hack for
this special case. In order to keep the kernel image as small as possible.
(see below)

> The correct fix is likely to
> 
> a) add this REGMAP select to all REGULATOR drivers depending on/using
> it (this can probably even be upstreamed)
>From looking at the upstream Kconfigs, I think this is pretty much already
the case. The drivers for the i2c jellybean regulator parts select REGMAP_I2C.
The remaining regulators drivers are usually part of a SoC and have a indirect
dependency/select to another symbol that selects REGMAP (these are mostly 
syscon/mfd symbols and CONFIG_SYSCON pulls in REGMAP_MMIO). So I guess this
will only become a problem is regulator kmods are added.

> b) (OpenWrt only) Change the usage in regulator/core.c and
> regulator/helper.c to work like REGMAP is disabled if it is
> build as a module.

---
diff --git