Re: [LEDE-DEV] odhcpd: [PATCH 1/3] enable loglevel setting via envvar ODHCPD_LOG_LEVEL

2016-09-26 Thread John Crispin


On 27/09/2016 01:33, Karl Palsson wrote:
> 
> John Crispin  wrote:
>>
>>
>> On 22/09/2016 19:32, Karl Palsson wrote:
>>> From: Karl Palsson 
>>>
>>> Currently the loglevel is hardcoded to LOG_WARNING, even though there is
>>> debug log messages.  Allow an env var to control the log threshold.
>>>
>>> Signed-off-by: Karl Palsson 
>>> ---
>>>  src/odhcpd.c | 16 +++-
>>>  1 file changed, 15 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/src/odhcpd.c b/src/odhcpd.c
>>> index 74830ac..c51cfa1 100644
>>> --- a/src/odhcpd.c
>>> +++ b/src/odhcpd.c
>>> @@ -58,7 +58,21 @@ static void sighandler(_unused int signal)
>>>  int main()
>>>  {
>>> openlog("odhcpd", LOG_PERROR | LOG_PID, LOG_DAEMON);
>>> -   setlogmask(LOG_UPTO(LOG_WARNING));
>>> +   char *env_log_level = getenv("ODHCPD_LOG_LEVEL");
>>> +   int log_level = LOG_WARNING;
>>> +   if (env_log_level) {
>>> +   char *end;
>>> +   errno = 0;
>>> +   long temp = strtol(env_log_level, , 0);
>>> +   if (end == env_log_level || *end != '\0'
>>> +   || ((temp == LONG_MIN || temp == LONG_MAX) && errno == 
>>> ERANGE)
>>> +   || (log_level > LOG_DEBUG) || log_level < LOG_EMERG) {
>>> +   syslog(LOG_ERR, "ODHCPD_LOG_LEVEL envvar was invalid");
>>> +   } else {
>>> +   log_level = temp;
>>> +   }
>>> +   }
>>> +   setlogmask(LOG_UPTO(log_level));
>>> uloop_init();
>>
>> this is pretty bloaty. i am also not sure if using an env var
>> is the right way to solve this.
> 
> sure, strol sucks. But that's "the" way of checking. I could use
> atoi, and just convert nulls to some sort of default maybe. As
> for an env var, sure, they suck too, I just copied procd, was
> trying to be consistent. I'm open to other suggestions. I don't
> _need_ the logging anymore, after adding more for the fixing the
> "ignore" problem, and with logging feasible, there's probably
> more debug that would be relevant, so this patch could be dropped
> entirely if it's too much of a headache.
> 
> Cheers,
> Karl P

being able to set the debug level is good but not like this. why not use
the normal config code path or a commandline option ?

John


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] odhcpd: [PATCH 1/3] enable loglevel setting via envvar ODHCPD_LOG_LEVEL

2016-09-26 Thread Karl Palsson

John Crispin  wrote:
> 
> 
> On 22/09/2016 19:32, Karl Palsson wrote:
> > From: Karl Palsson 
> > 
> > Currently the loglevel is hardcoded to LOG_WARNING, even though there is
> > debug log messages.  Allow an env var to control the log threshold.
> > 
> > Signed-off-by: Karl Palsson 
> > ---
> >  src/odhcpd.c | 16 +++-
> >  1 file changed, 15 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/odhcpd.c b/src/odhcpd.c
> > index 74830ac..c51cfa1 100644
> > --- a/src/odhcpd.c
> > +++ b/src/odhcpd.c
> > @@ -58,7 +58,21 @@ static void sighandler(_unused int signal)
> >  int main()
> >  {
> > openlog("odhcpd", LOG_PERROR | LOG_PID, LOG_DAEMON);
> > -   setlogmask(LOG_UPTO(LOG_WARNING));
> > +   char *env_log_level = getenv("ODHCPD_LOG_LEVEL");
> > +   int log_level = LOG_WARNING;
> > +   if (env_log_level) {
> > +   char *end;
> > +   errno = 0;
> > +   long temp = strtol(env_log_level, , 0);
> > +   if (end == env_log_level || *end != '\0'
> > +   || ((temp == LONG_MIN || temp == LONG_MAX) && errno == 
> > ERANGE)
> > +   || (log_level > LOG_DEBUG) || log_level < LOG_EMERG) {
> > +   syslog(LOG_ERR, "ODHCPD_LOG_LEVEL envvar was invalid");
> > +   } else {
> > +   log_level = temp;
> > +   }
> > +   }
> > +   setlogmask(LOG_UPTO(log_level));
> > uloop_init();
> 
> this is pretty bloaty. i am also not sure if using an env var
> is the right way to solve this.

sure, strol sucks. But that's "the" way of checking. I could use
atoi, and just convert nulls to some sort of default maybe. As
for an env var, sure, they suck too, I just copied procd, was
trying to be consistent. I'm open to other suggestions. I don't
_need_ the logging anymore, after adding more for the fixing the
"ignore" problem, and with logging feasible, there's probably
more debug that would be relevant, so this patch could be dropped
entirely if it's too much of a headache.

Cheers,
Karl P

signature.asc
Description: OpenPGP Digital Signature
___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] odhcpd: [PATCH 1/3] enable loglevel setting via envvar ODHCPD_LOG_LEVEL

2016-09-26 Thread John Crispin


On 22/09/2016 19:32, Karl Palsson wrote:
> From: Karl Palsson 
> 
> Currently the loglevel is hardcoded to LOG_WARNING, even though there is
> debug log messages.  Allow an env var to control the log threshold.
> 
> Signed-off-by: Karl Palsson 
> ---
>  src/odhcpd.c | 16 +++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/src/odhcpd.c b/src/odhcpd.c
> index 74830ac..c51cfa1 100644
> --- a/src/odhcpd.c
> +++ b/src/odhcpd.c
> @@ -58,7 +58,21 @@ static void sighandler(_unused int signal)
>  int main()
>  {
>   openlog("odhcpd", LOG_PERROR | LOG_PID, LOG_DAEMON);
> - setlogmask(LOG_UPTO(LOG_WARNING));
> + char *env_log_level = getenv("ODHCPD_LOG_LEVEL");
> + int log_level = LOG_WARNING;
> + if (env_log_level) {
> + char *end;
> + errno = 0;
> + long temp = strtol(env_log_level, , 0);
> + if (end == env_log_level || *end != '\0'
> + || ((temp == LONG_MIN || temp == LONG_MAX) && errno == 
> ERANGE)
> + || (log_level > LOG_DEBUG) || log_level < LOG_EMERG) {
> + syslog(LOG_ERR, "ODHCPD_LOG_LEVEL envvar was invalid");
> + } else {
> + log_level = temp;
> + }
> + }
> + setlogmask(LOG_UPTO(log_level));
>   uloop_init();

this is pretty bloaty. i am also not sure if using an env var is the
right way to solve this.

John

>  
>   if (getuid() != 0) {
> 

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH v2] check: upgrade to 0.10.0

2016-09-26 Thread John Crispin
Hi Eduardo,

patches against the packages feed need to be sent via a PR on github ->
https://github.com/openwrt/packages

John

On 21/09/2016 17:23, Eduardo Abinader wrote:
> updated new package url and solved some issues:
> https://github.com/libcheck/check/releases/tag/0.10.0
> 
> Signed-off-by: Eduardo Abinader 
> ---
>  libs/check/Makefile | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/libs/check/Makefile b/libs/check/Makefile
> index eb735ee..d0e75a6 100644
> --- a/libs/check/Makefile
> +++ b/libs/check/Makefile
> @@ -8,12 +8,12 @@
>  include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=check
> -PKG_VERSION:=0.9.14
> -PKG_RELEASE:=2
> +PKG_VERSION:=0.10.0
> +PKG_RELEASE:=1
>  
>  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
> -PKG_SOURCE_URL:=@SF/check
> -PKG_MD5SUM:=38263d115d784c17aa3b959ce94be8b8
> +PKG_SOURCE_URL:=https://github.com/libcheck/check/releases/tag/$(PKG_VERSION)
> +PKG_MD5SUM:=53c5e5c77d090e103a17f3ed7fd7d8b8
>  
>  PKG_LICENSE:=LGPL-2.1+
>  PKG_LICENSE_FILES:=COPYING.LESSER
> @@ -27,7 +27,7 @@ define Package/check
>SECTION:=libs
>CATEGORY:=Libraries
>TITLE:=Unit testing framework for C
> -  URL:=http://check.sourceforge.net/
> +  URL:=https://libcheck.github.io/check/
>DEPENDS:= +libpthread +librt
>  endef
>  
> 

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH] openssl: update to 1.0.2j

2016-09-26 Thread Magnus Kroken
A bug fix which included a CRL sanity check was added to OpenSSL 1.1.0
but was omitted from OpenSSL 1.0.2i. As a result any attempt to use
CRLs in OpenSSL 1.0.2i will crash with a null pointer exception.

Patches applied upstream:
* 301-fix_no_nextprotoneg_build.patch
* 302-Fix_typo_introduced_by_a03f81f4.patch

Security advisory: https://www.openssl.org/news/secadv/20160926.txt

Signed-off-by: Magnus Kroken <mkro...@gmail.com>
---
 package/libs/openssl/Makefile  |  4 ++--
 .../patches/301-fix_no_nextprotoneg_build.patch| 26 --
 .../302-Fix_typo_introduced_by_a03f81f4.patch  | 21 -
 3 files changed, 2 insertions(+), 49 deletions(-)
 delete mode 100644 
package/libs/openssl/patches/301-fix_no_nextprotoneg_build.patch
 delete mode 100644 
package/libs/openssl/patches/302-Fix_typo_introduced_by_a03f81f4.patch

diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index dc1202c..d690ab0 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.0.2
-PKG_BUGFIX:=i
+PKG_BUGFIX:=j
 PKG_VERSION:=$(PKG_BASE)$(PKG_BUGFIX)
 PKG_RELEASE:=1
 PKG_USE_MIPS16:=0
@@ -22,7 +22,7 @@ PKG_SOURCE_URL:=http://www.openssl.org/source/ \
http://www.openssl.org/source/old/$(PKG_BASE)/ \
ftp://ftp.funet.fi/pub/crypt/mirrors/ftp.openssl.org/source \
ftp://ftp.sunet.se/pub/security/tools/net/openssl/source/
-PKG_MD5SUM:=9287487d11c9545b6efb287cdb70535d4e9b284dd10d51441d9b9963d000de6f
+PKG_MD5SUM:=e7aff292be21c259c6af26469c7a9b3ba26e9abaaffd325e3dccc9785256c431
 
 PKG_LICENSE:=OpenSSL
 PKG_LICENSE_FILES:=LICENSE
diff --git a/package/libs/openssl/patches/301-fix_no_nextprotoneg_build.patch 
b/package/libs/openssl/patches/301-fix_no_nextprotoneg_build.patch
deleted file mode 100644
index 91465a3..000
--- a/package/libs/openssl/patches/301-fix_no_nextprotoneg_build.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From f15a7e39a1f7d41716ca5f07faef74f55147d2cf Mon Sep 17 00:00:00 2001
-From: Dirk Feytons <dirk.feyt...@gmail.com>
-Date: Thu, 22 Sep 2016 16:17:45 +0200
-Subject: [PATCH] Fix build with no-nextprotoneg
-
-Add a missing ifdef. Same change is already present in master.
-
-Reviewed-by: Matt Caswell <m...@openssl.org>
-Reviewed-by: Rich Salz <rs...@openssl.org>
-(Merged from https://github.com/openssl/openssl/pull/1100)

- ssl/t1_ext.c | 2 ++
- 1 file changed, 2 insertions(+)
-
 a/ssl/t1_ext.c
-+++ b/ssl/t1_ext.c
-@@ -275,7 +275,9 @@ int SSL_extension_supported(unsigned int
- case TLSEXT_TYPE_ec_point_formats:
- case TLSEXT_TYPE_elliptic_curves:
- case TLSEXT_TYPE_heartbeat:
-+# ifndef OPENSSL_NO_NEXTPROTONEG
- case TLSEXT_TYPE_next_proto_neg:
-+# endif
- case TLSEXT_TYPE_padding:
- case TLSEXT_TYPE_renegotiate:
- case TLSEXT_TYPE_server_name:
diff --git 
a/package/libs/openssl/patches/302-Fix_typo_introduced_by_a03f81f4.patch 
b/package/libs/openssl/patches/302-Fix_typo_introduced_by_a03f81f4.patch
deleted file mode 100644
index 8b14365..000
--- a/package/libs/openssl/patches/302-Fix_typo_introduced_by_a03f81f4.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-From 581215a519c66db7255ea360ed25bb00033ccd52 Mon Sep 17 00:00:00 2001
-From: Rich Salz <rs...@openssl.org>
-Date: Thu, 22 Sep 2016 08:47:45 -0400
-Subject: [PATCH] Fix typo introduced by a03f81f4
-
-Reviewed-by: Richard Levitte <levi...@openssl.org>

- crypto/engine/eng_cryptodev.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
 a/crypto/engine/eng_cryptodev.c
-+++ b/crypto/engine/eng_cryptodev.c
-@@ -939,7 +939,7 @@ static int cryptodev_digest_copy(EVP_MD_
- if (fstate->mac_len != 0) {
- if (fstate->mac_data != NULL) {
- dstate->mac_data = OPENSSL_malloc(fstate->mac_len);
--if (dstate->ac_data == NULL) {
-+if (dstate->mac_data == NULL) {
- printf("cryptodev_digest_init: malloc failed\n");
- return 0;
- }
-- 
2.1.4


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH v3] toolchain: Rework external toolchain libc selection

2016-09-26 Thread Felix Fietkau
On 2016-09-19 21:59, Florian Fainelli wrote:
> From: Florian Fainelli 
> 
> Make it a choice menu which offers the 3 C libraries we know about: glibc,
> uClibc and musl. While at it, make it possible for the external toolchain libc
> to select USE_GLIBC, USE_UCLIBC or USE_MUSL which is used by several packages
> to conditionally include specific CFLAGS (e.g: iproute2).
> 
> Because USE_GLIBC et al. can now be selected by external toolchains, we need 
> to
> restrict the per-libc menus to check on !EXTERNAL_TOOLCHAIN.
> 
> While at it, make musl the default C library for external toolchain to match
> the internal toolchain.
> 
> Signed-off-by: Florian Fainelli 
Applied to my staging tree, with one small change:
I dropped the bogus !(mips64 || mips64el) dependency for musl

- Felix


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH packages] pptpd: run service in foreground for procd compatibility

2016-09-26 Thread Rafał Miłecki
From: Rafał Miłecki 

To have service working nicely with procd it should be running in the
foreground. Otherwise it's not possible to e.g. stop it with the init.d
script. Luckily for us pptpd has a simple switch that allows it.

Signed-off-by: Rafał Miłecki 
Fixes: 15e7f611afb ("pptpd: convert init script to procd")
---
Hi Luka,

This pptpd package with broken procd compatibility has been also backported
to the for-15.05 branch. Can you apply this fix to for-15.05 as well, please?
---
 net/pptpd/files/pptpd.init | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/pptpd/files/pptpd.init b/net/pptpd/files/pptpd.init
index 0d18aa1..294b00f 100644
--- a/net/pptpd/files/pptpd.init
+++ b/net/pptpd/files/pptpd.init
@@ -67,6 +67,6 @@ start_service() {
ln -sfn $CHAP_SECRETS /etc/ppp/chap-secrets
 
procd_open_instance
-   procd_set_param command $BIN -c $CONFIG -o $OPTIONS_PPTP
+   procd_set_param command $BIN -c $CONFIG --fg -o $OPTIONS_PPTP
procd_close_instance
 }
-- 
2.9.3


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev