[OpenWrt-Devel] [PATCH] [rpcd][v2] file: add md5sum support

2015-04-11 Thread Luka Perkov
Signed-off-by: Luka Perkov 
---
changes in v2:

* no need to null-terminate string after sprintf()

 file.c | 35 +++
 1 file changed, 35 insertions(+)

diff --git a/file.c b/file.c
index 3831c54..9c1b301 100644
--- a/file.c
+++ b/file.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -237,6 +238,39 @@ rpc_file_write(struct ubus_context *ctx, struct 
ubus_object *obj,
 }
 
 static int
+rpc_file_md5(struct ubus_context *ctx, struct ubus_object *obj,
+ struct ubus_request_data *req, const char *method,
+ struct blob_attr *msg)
+{ 
+   int rv, i;
+   char *path;
+   struct stat s;
+   uint8_t md5[16];
+   char *wbuf;
+
+   if (!rpc_check_path(msg, &path, &s))
+   return rpc_errno_status();
+
+   if (!S_ISREG(s.st_mode))
+   return UBUS_STATUS_NOT_SUPPORTED;
+
+   if ((rv = md5sum(path, md5)) <= 0)
+   return rpc_errno_status();
+
+   blob_buf_init(&buf, 0);
+   wbuf = blobmsg_alloc_string_buffer(&buf, "md5", 33);
+
+   for (i = 0; i < 16; i++)
+   sprintf(wbuf + (i * 2), "%02x", (uint8_t) md5[i]);
+
+   blobmsg_add_string_buffer(&buf);
+   ubus_send_reply(ctx, req, buf.head);
+   blob_buf_free(&buf);
+
+   return UBUS_STATUS_OK;
+}
+
+static int
 rpc_file_list(struct ubus_context *ctx, struct ubus_object *obj,
   struct ubus_request_data *req, const char *method,
   struct blob_attr *msg)
@@ -611,6 +645,7 @@ rpc_file_api_init(const struct rpc_daemon_ops *o, struct 
ubus_context *ctx)
UBUS_METHOD("write",   rpc_file_write, rpc_file_rw_policy),
UBUS_METHOD("list",rpc_file_list,  rpc_file_r_policy),
UBUS_METHOD("stat",rpc_file_stat,  rpc_file_r_policy),
+   UBUS_METHOD("md5", rpc_file_md5,   rpc_file_r_policy),
UBUS_METHOD("exec",rpc_file_exec,  rpc_exec_policy),
};
 
-- 
2.3.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] [libubox][v2] b64: add base64 support

2015-04-11 Thread Luka Perkov
The base code has been taken from zstream project which was
written by Steven Barth.

Signed-off-by: Luka Perkov 
CC: Steven Barth 
---
changes in v2:

Use new API:

size_t b64decode(void **out, const char *in, size_t len);
size_t b64encode(char **out, const void *in, size_t len);

 CMakeLists.txt |   2 +-
 b64.c  | 154 +
 b64.h  |  26 ++
 3 files changed, 181 insertions(+), 1 deletion(-)
 create mode 100644 b64.c
 create mode 100644 b64.h

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 58381da..77f4842 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,7 +14,7 @@ IF(JSONC_FOUND)
   INCLUDE_DIRECTORIES(${JSONC_INCLUDE_DIRS})
 ENDIF()
 
-SET(SOURCES avl.c avl-cmp.c blob.c blobmsg.c uloop.c usock.c ustream.c 
ustream-fd.c vlist.c utils.c safe_list.c runqueue.c md5.c kvlist.c ulog.c)
+SET(SOURCES avl.c avl-cmp.c blob.c blobmsg.c uloop.c usock.c ustream.c 
ustream-fd.c vlist.c utils.c safe_list.c runqueue.c md5.c kvlist.c ulog.c b64.c)
 
 ADD_LIBRARY(ubox SHARED ${SOURCES})
 ADD_LIBRARY(ubox-static STATIC ${SOURCES})
diff --git a/b64.c b/b64.c
new file mode 100644
index 000..86593d2
--- /dev/null
+++ b/b64.c
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2011 Steven Barth 
+ * Copyright (C) 2015 Luka Perkov 
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include 
+#include 
+
+#include "b64.h"
+
+static const unsigned char b64decode_tbl[] = {
+   0x3e, 0xff, 0xff, 0xff, 0x3f, 0x34, 0x35, 0x36,
+   0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0xff,
+   0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0x01,
+   0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
+   0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11,
+   0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
+   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1a, 0x1b,
+   0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
+   0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
+   0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33
+};
+
+static inline size_t b64_decode_size(const char *in, size_t len)
+{
+   size_t ret;
+
+   if ((len == 0) || (len % 4))
+   return 0;
+
+   ret = len / 4 * 3;
+
+   if (in[(int) len - 1] == '=')
+   ret--;
+
+   if (in[(int) len - 2] == '=')
+   ret--;
+
+   return ret;
+}
+
+size_t b64decode(void **out, const char *in, size_t len)
+{
+   size_t lenout, i, j;
+   unsigned char *o;
+
+   lenout = b64_decode_size(in, len);
+   if (!lenout) {
+   *out = NULL;
+   return 0;
+   }
+
+   *out = calloc(lenout, sizeof(char));
+   if (!(*out))
+   return 0;
+
+   o = (unsigned char *) *out;
+   for (i = 0; i < len; i += 4) {
+   uint32_t cv = 0;
+   for (j = 0; j < 4; j++) {
+   unsigned char c = in[i + j] - 43;
+   if (c > 79 || (c = b64decode_tbl[c]) == 0xff) {
+   free(*out);
+   *out = NULL;
+   return 0;
+   }
+
+   cv |= c;
+   if (j != 3) {
+   cv <<= 6;
+   }
+   }
+
+   o[2] = (unsigned char)( cv& 0xff);
+   o[1] = (unsigned char)((cv >>  8) & 0xff);
+   o[0] = (unsigned char)((cv >> 16) & 0xff);
+   o += 3;
+   }
+
+   return lenout;
+}
+
+static const unsigned char b64encode_tbl[] =
+   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+static inline size_t b64_encode_size(size_t len)
+{
+   size_t ret;
+
+   if (len == 0)
+   return 0;
+
+   ret = len / 3;
+   ret *= 4;
+
+   if (len % 3)
+   ret += 4;
+
+   return ret;
+}
+
+size_t b64encode(char **out, const void *in, size_t len)
+{
+   size_t lenout, pad, i;
+   const uint8_t *data = (const uint8_t *) in;
+   uint8_t *o;
+
+   lenout = b64_encode_size(len);
+   if (!lenout) {
+   *out = NULL;
+   return 0;
+   }
+
+   *out = calloc(lenout, sizeof(char));
+   if (!(*out))
+   return 0;
+
+ 

[OpenWrt-Devel] [PATCH] [ustream-ssl][v3] polarssl: fix long writes

2015-04-11 Thread Luka Perkov
Enable to write more data then defined in SSL_MAX_CONTENT_LEN.

Signed-off-by: Luka Perkov 
---
changes in v2:
* fix return value at the end

changes in v3:
* fix another return value

 ustream-polarssl.c | 20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/ustream-polarssl.c b/ustream-polarssl.c
index cbf24cb..615ac2d 100644
--- a/ustream-polarssl.c
+++ b/ustream-polarssl.c
@@ -232,17 +232,23 @@ __hidden enum ssl_conn_status 
__ustream_ssl_connect(struct ustream_ssl *us)
 __hidden int __ustream_ssl_write(struct ustream_ssl *us, const char *buf, int 
len)
 {
void *ssl = us->ssl;
-   int ret = ssl_write(ssl, (const unsigned char *) buf, len);
+   int done = 0, ret = 0;
 
-   if (ret < 0) {
-   if (ssl_do_wait(ret))
-   return 0;
+   while (done != len) {
+   ret = ssl_write(ssl, (const unsigned char *) buf + done, len - 
done);
 
-   ustream_ssl_error(us, ret);
-   return -1;
+   if (ret < 0) {
+   if (ssl_do_wait(ret))
+   return done;
+
+   ustream_ssl_error(us, ret);
+   return -1;
+   }
+
+   done += ret;
}
 
-   return ret;
+   return done;
 }
 
 __hidden int __ustream_ssl_read(struct ustream_ssl *us, char *buf, int len)
-- 
2.3.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] [ustream-ssl] polarssl: fix long writes

2015-04-11 Thread Luka Perkov
On Sat, Apr 11, 2015 at 11:36:14PM +0200, Felix Fietkau wrote:
> On 2015-04-11 23:23, Luka Perkov wrote:
> > Enable to write more data then defined in SSL_MAX_CONTENT_LEN.
> > 
> > Signed-off-by: Luka Perkov 
> > ---
> >  ustream-polarssl.c | 18 --
> >  1 file changed, 12 insertions(+), 6 deletions(-)
> > 
> > diff --git a/ustream-polarssl.c b/ustream-polarssl.c
> > index cbf24cb..ce9b164 100644
> > --- a/ustream-polarssl.c
> > +++ b/ustream-polarssl.c
> > @@ -232,14 +232,20 @@ __hidden enum ssl_conn_status 
> > __ustream_ssl_connect(struct ustream_ssl *us)
> >  __hidden int __ustream_ssl_write(struct ustream_ssl *us, const char *buf, 
> > int len)
> >  {
> > void *ssl = us->ssl;
> > -   int ret = ssl_write(ssl, (const unsigned char *) buf, len);
> > +   int done = 0, ret = 0;
> >  
> > -   if (ret < 0) {
> > -   if (ssl_do_wait(ret))
> > -   return 0;
> > +   while (done != len) {
> > +   ret = ssl_write(ssl, (const unsigned char *) buf + done, len - 
> > done);
> >  
> > -   ustream_ssl_error(us, ret);
> > -   return -1;
> > +   if (ret < 0) {
> > +   if (ssl_do_wait(ret))
> > +   return 0;
> This does not look right. I think it should be 'return done', otherwise
> plaintext data will be duplicated if the first write succeeds but the
> second doesn't.

Yes, this one too... I've sent v2 with other return fixed. Going to send
v3 in a bit.

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


Re: [OpenWrt-Devel] [PATCH] [ustream-ssl] polarssl: fix long writes

2015-04-11 Thread Felix Fietkau
On 2015-04-11 23:23, Luka Perkov wrote:
> Enable to write more data then defined in SSL_MAX_CONTENT_LEN.
> 
> Signed-off-by: Luka Perkov 
> ---
>  ustream-polarssl.c | 18 --
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/ustream-polarssl.c b/ustream-polarssl.c
> index cbf24cb..ce9b164 100644
> --- a/ustream-polarssl.c
> +++ b/ustream-polarssl.c
> @@ -232,14 +232,20 @@ __hidden enum ssl_conn_status 
> __ustream_ssl_connect(struct ustream_ssl *us)
>  __hidden int __ustream_ssl_write(struct ustream_ssl *us, const char *buf, 
> int len)
>  {
>   void *ssl = us->ssl;
> - int ret = ssl_write(ssl, (const unsigned char *) buf, len);
> + int done = 0, ret = 0;
>  
> - if (ret < 0) {
> - if (ssl_do_wait(ret))
> - return 0;
> + while (done != len) {
> + ret = ssl_write(ssl, (const unsigned char *) buf + done, len - 
> done);
>  
> - ustream_ssl_error(us, ret);
> - return -1;
> + if (ret < 0) {
> + if (ssl_do_wait(ret))
> + return 0;
This does not look right. I think it should be 'return done', otherwise
plaintext data will be duplicated if the first write succeeds but the
second doesn't.

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


[OpenWrt-Devel] [PATCH] [ustream-ssl][v2] polarssl: fix long writes

2015-04-11 Thread Luka Perkov
Enable to write more data then defined in SSL_MAX_CONTENT_LEN.

Signed-off-by: Luka Perkov 
---
changes in v2:
* fix return value

 ustream-polarssl.c | 20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/ustream-polarssl.c b/ustream-polarssl.c
index cbf24cb..66718f1 100644
--- a/ustream-polarssl.c
+++ b/ustream-polarssl.c
@@ -232,17 +232,23 @@ __hidden enum ssl_conn_status 
__ustream_ssl_connect(struct ustream_ssl *us)
 __hidden int __ustream_ssl_write(struct ustream_ssl *us, const char *buf, int 
len)
 {
void *ssl = us->ssl;
-   int ret = ssl_write(ssl, (const unsigned char *) buf, len);
+   int done = 0, ret = 0;
 
-   if (ret < 0) {
-   if (ssl_do_wait(ret))
-   return 0;
+   while (done != len) {
+   ret = ssl_write(ssl, (const unsigned char *) buf + done, len - 
done);
 
-   ustream_ssl_error(us, ret);
-   return -1;
+   if (ret < 0) {
+   if (ssl_do_wait(ret))
+   return 0;
+
+   ustream_ssl_error(us, ret);
+   return -1;
+   }
+
+   done += ret;
}
 
-   return ret;
+   return done;
 }
 
 __hidden int __ustream_ssl_read(struct ustream_ssl *us, char *buf, int len)
-- 
2.3.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] [ustream-ssl] polarssl: fix long writes

2015-04-11 Thread Luka Perkov
Enable to write more data then defined in SSL_MAX_CONTENT_LEN.

Signed-off-by: Luka Perkov 
---
 ustream-polarssl.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/ustream-polarssl.c b/ustream-polarssl.c
index cbf24cb..ce9b164 100644
--- a/ustream-polarssl.c
+++ b/ustream-polarssl.c
@@ -232,14 +232,20 @@ __hidden enum ssl_conn_status 
__ustream_ssl_connect(struct ustream_ssl *us)
 __hidden int __ustream_ssl_write(struct ustream_ssl *us, const char *buf, int 
len)
 {
void *ssl = us->ssl;
-   int ret = ssl_write(ssl, (const unsigned char *) buf, len);
+   int done = 0, ret = 0;
 
-   if (ret < 0) {
-   if (ssl_do_wait(ret))
-   return 0;
+   while (done != len) {
+   ret = ssl_write(ssl, (const unsigned char *) buf + done, len - 
done);
 
-   ustream_ssl_error(us, ret);
-   return -1;
+   if (ret < 0) {
+   if (ssl_do_wait(ret))
+   return 0;
+
+   ustream_ssl_error(us, ret);
+   return -1;
+   }
+
+   done += ret;
}
 
return ret;
-- 
2.3.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] Update StrongSwan to 5.3.0 for BB 14.07

2015-04-11 Thread Atanas Vladimirov
Update StrongSwan to 5.3.0 in BB 14.07 
(https://github.com/openwrt/packages.git;for-14.07). 

Changelog:
https://wiki.strongswan.org/projects/strongswan/wiki/Changelog53

Tested on mpc85xx and ar71xx.

Signed-off-by: Atanas Vladimirov 

---

diff --git a/net/strongswan/Makefile b/net/strongswan/Makefile
index 85816dd..5a2e0fa 100644
--- a/net/strongswan/Makefile
+++ b/net/strongswan/Makefile
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=strongswan
-PKG_VERSION:=5.2.2
+PKG_VERSION:=5.3.0
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://download.strongswan.org/ 
http://download2.strongswan.org/
-PKG_MD5SUM:=7ee1a33060b2bde35be0f6d78a1d26d0
+PKG_MD5SUM:=c52d4228231c2025d9c320d0e9990327
 PKG_LICENSE:=GPL-2.0+
 PKG_MAINTAINER:=Steven Barth 
 
@@ -407,7 +407,7 @@ endef
 
 define Plugin/updown/install
$(INSTALL_DIR) $(1)/usr/lib/ipsec/plugins
-   $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/{_updown,_updown_espmark} 
$(1)/usr/lib/ipsec/
+   $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/_updown $(1)/usr/lib/ipsec/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-updown.so 
$(1)/usr/lib/ipsec/plugins/
$(INSTALL_DIR) $(1)/etc
$(INSTALL_CONF) ./files/ipsec.user $(1)/etc/
@@ -435,7 +435,7 @@ $(eval $(call BuildPlugin,aes,AES crypto,))
 $(eval $(call BuildPlugin,af-alg,AF_ALG crypto interface to Linux Crypto 
API,+kmod-crypto-user))
 $(eval $(call BuildPlugin,agent,SSH agent signing,))
 $(eval $(call BuildPlugin,attr,file based config,))
-$(eval $(call BuildPlugin,attr-sql,SQL based config,+strongswan-mod-sql))
+$(eval $(call BuildPlugin,attr-sql,SQL based config,+strongswan-mod-sql 
+strongswan-charon))
 $(eval $(call BuildPlugin,blowfish,Blowfish crypto,))
 $(eval $(call BuildPlugin,ccm,CCM AEAD wrapper crypto,))
 $(eval $(call BuildPlugin,cmac,CMAC crypto,))
diff --git a/net/strongswan/patches/300-include-ipsec-user-script.patch 
b/net/strongswan/patches/300-include-ipsec-user-script.patch
index d96e844..6835e02 100644
--- a/net/strongswan/patches/300-include-ipsec-user-script.patch
+++ b/net/strongswan/patches/300-include-ipsec-user-script.patch
@@ -13,5 +13,5 @@
 +
 +[ -e /etc/ipsec.user ] && . /etc/ipsec.user "$1"
  
- # things that this script gets (from ipsec_pluto(8) man page)
- #
+ #  PLUTO_VERSION
+ #  indicates  what  version of this interface is being
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ar71xx: uThing support - take II

2015-04-11 Thread Karl Palsson

There's a few places here where things are sorted alphabetically. 
You've added the uthing beside the dragino2, presumably because it's
based on the dragino2-HE module?  Still, it's just another ar9331 board,
so please keep the lists sorted.

Further, the board patch lists it as being based on the RIO700?  Which
is it?

Further, you still have // comments as mentioned earlier.

You've added _new_ files with copyright year of 2011.  This cannot be
correct. (target/linux/ar71xx/generic/profiles/uthing.mk)

Sincerely,
Karl Palsson

Lars Boegild Thomsen  wrote:
> Adding OpenWrt support for the uThing module.
> 
> Sorry for earlier mistakes.  I think they have all been fixed, except I
> am still a bit confused about the "subject line".
> 
> Signed-off-by: Lars Boegild Thomsen 
> 

full patch elided___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/2] bug #19345 netifd: radio0: sh: bad number / hostapd

2015-04-11 Thread Hannu Nyman
Two errors "netifd: radio0: sh: bad number" have recently surfaced in system 
log in trunk when wifi interfaces come up. I tracked the errors to checking 
numerical values of some config options without ensuring that the option has 
any value.


The errors I see have apparently been introduced by r45051 (ieee80211r in 
hostapd) and r45326 (start_disabled in mac80211). My patches fix two 
instances of "bad number", but there may be a third one, as the original 
report in bug 19345 pre-dates r45326 and already has two "bad number" errors 
for radio0.


https://dev.openwrt.org/ticket/19345

Signed-off-by: Hannu Nyman 

Index: package/network/services/hostapd/files/netifd.sh
===
--- package/network/services/hostapd/files/netifd.sh(revision 45369)
+++ package/network/services/hostapd/files/netifd.sh(working copy)
@@ -346,6 +350,7 @@
 
if [ "$wpa" -ge "1" ]; then
json_get_vars nasid ieee80211r
+   set_default ieee80211r 0
[ -n "$nasid" ] && append bss_conf "nas_identifier=$nasid" "$N"
 
if [ "$ieee80211r" -gt "0" ]; then
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/2] bug #19345 netifd: radio0: sh: bad number / mac80211

2015-04-11 Thread Hannu Nyman
Two errors "netifd: radio0: sh: bad number" have recently surfaced in system 
log in trunk when wifi interfaces come up. I tracked the errors to checking 
numerical values of some config options without ensuring that the option has 
any value.


The errors I see have apparently been introduced by r45051 (ieee80211r in 
hostapd) and r45326 (start_disabled in mac80211). My patches fix two 
instances of "bad number", but there may be a third one, as the original 
report in bug 19345 pre-dates r45326 and already has two "bad number" errors 
for radio0.


https://dev.openwrt.org/ticket/19345

Signed-off-by: Hannu Nyman 

Index: package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
===
--- package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh   
(revision 45369)
+++ package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh   
(working copy)
@@ -318,6 +318,7 @@
json_get_vars wds dtim_period max_listen_int start_disabled
 
set_default wds 0
+   set_default start_disabled 0
 
[ "$wds" -gt 0 ] && append hostapd_cfg "wds_sta=1" "$N"
[ "$staidx" -gt 0 -o "$start_disabled" -eq 1 ] && append hostapd_cfg 
"start_disabled=1" "$N"
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] ag71xx unstable link problems on AR7241r1

2015-04-11 Thread Daniel Golle
On Fri, Apr 10, 2015 at 07:06:24PM +0200, Daniel Golle wrote:
> On Fri, Apr 10, 2015 at 05:58:04PM +0200, Sven Eckelmann wrote:
> > I had problems in the past with some optimization by from Felix which caused
> > situations like that. For some reason the device was not correctly reseted 
> > on
> > errors. This looked like it was caused by his reset optimizations. When this
> > device uses the ag71xx driver, is a ar724x device and you suspect that this 
> > is
> > a partial reset problem then you may try something like this
> 
> I flashed the affected device (turns out to be a non-XW nanostation)
> with your testing patch applied. I'll see how it goes, I'll let you
> know in the next days if the ethernet link is more stable now.

Result: the problem persists also with your patch applied...
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] brcm47xx: explicitly select CPU_MIPS32_R2 and CPU_MIPSR2 for mips74k

2015-04-11 Thread Hauke Mehrtens
On 04/11/2015 09:59 AM, Rafał Miłecki wrote:
> On 5 April 2015 at 20:03, Nathan Hintz  wrote:
>> The mips74k subtarget of brcm47xx configures gcc to compile for mips32r2;
>> however, the generated kernel config for 3.14 and later kernels ends up
>> with CPU_MIPS32_R1 and CPU_MIPSR1 selected.  The generated kernel config
>> for the 3.10 kernel (Barrier Breaker) properly selected CPU_MIPS32_R2 and
>> CPU_MIPSR2.  Modify the default kernel config for mips74k to explicitly
>> select CPU_MIPS32_R2 and CPU_MIPSR2.
> 
> I think it makes sense. Hauke? Any reason it wasn't applied back in 2014?
> 
Hi Rafał,

yes this makes scene. I think that an older kernel version automatically
selected this when CONFIG_BCM47XX_BCMA was selected and now something
changed.

Do you want to apply it?

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


Re: [OpenWrt-Devel] [PATCH] brcm47xx: explicitly select CPU_MIPS32_R2 and CPU_MIPSR2 for mips74k

2015-04-11 Thread Rafał Miłecki
On 5 April 2015 at 20:03, Nathan Hintz  wrote:
> The mips74k subtarget of brcm47xx configures gcc to compile for mips32r2;
> however, the generated kernel config for 3.14 and later kernels ends up
> with CPU_MIPS32_R1 and CPU_MIPSR1 selected.  The generated kernel config
> for the 3.10 kernel (Barrier Breaker) properly selected CPU_MIPS32_R2 and
> CPU_MIPSR2.  Modify the default kernel config for mips74k to explicitly
> select CPU_MIPS32_R2 and CPU_MIPSR2.

I think it makes sense. Hauke? Any reason it wasn't applied back in 2014?
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH V3 fstools 2/2] jffs2reset: use jffs2_mark if rootfs_data isn't mounted

2015-04-11 Thread Rafał Miłecki
Erasing all rootfs_data blocks may cause some problems with partition
identification. It won't contain MAGIC, but will be successfully mounted
with delayed blocks marking. This may be really confusing when user
reboots before JFFS2 finishes its blocks management. During the next
boot rootfs_data will be a valid partition (possibly with data) but
libblkid won't detect it.
Also adjust message in jffs2_mark to make more sense when used together
with jffs2_reset.

Signed-off-by: Rafał Miłecki 
---
V2: Update ulog messages. E.hg. the one in jffs2_mark shouldn't include
implementation details (deadc0de).
---
 jffs2reset.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/jffs2reset.c b/jffs2reset.c
index 778a97e..0410466 100644
--- a/jffs2reset.c
+++ b/jffs2reset.c
@@ -27,6 +27,8 @@
 #include "libfstools/libfstools.h"
 #include "libfstools/volume.h"
 
+static int jffs2_mark(struct volume *v);
+
 static int
 ask_user(int argc, char **argv)
 {
@@ -50,8 +52,8 @@ static int jffs2_reset(struct volume *v)
overlay_delete(mp, false);
mount(mp, "/", NULL, MS_REMOUNT, 0);
} else {
-   ULOG_INFO("%s is not mounted, erasing it\n", v->blk);
-   volume_erase_all(v);
+   ULOG_INFO("%s is not mounted\n", v->blk);
+   return jffs2_mark(v);
}
 
return 0;
@@ -64,7 +66,7 @@ static int jffs2_mark(struct volume *v)
int fd;
 
fd = open(v->blk, O_WRONLY);
-   ULOG_INFO("%s - marking with deadc0de\n", v->blk);
+   ULOG_INFO("%s will be erased on next mount\n", v->blk);
if (!fd) {
ULOG_ERR("opening %s failed\n", v->blk);
return -1;
-- 
1.8.4.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH V3 fstools 1/2] jffs2reset: avoid code duplication in jffs2_reset and jffs2_mark

2015-04-11 Thread Rafał Miłecki
Signed-off-by: Rafał Miłecki 
---
V3: Update TODO comment to be more clear.
---
 jffs2reset.c | 56 +---
 1 file changed, 25 insertions(+), 31 deletions(-)

diff --git a/jffs2reset.c b/jffs2reset.c
index 1080883..778a97e 100644
--- a/jffs2reset.c
+++ b/jffs2reset.c
@@ -39,26 +39,10 @@ ask_user(int argc, char **argv)
 
 }
 
-static int
-jffs2_reset(int argc, char **argv)
+static int jffs2_reset(struct volume *v)
 {
-   struct volume *v;
char *mp;
 
-   if (ask_user(argc, argv))
-   return -1;
-
-   if (find_filesystem("overlay")) {
-   ULOG_ERR("overlayfs not supported by kernel\n");
-   return -1;
-   }
-
-   v = volume_find("rootfs_data");
-   if (!v) {
-   ULOG_ERR("MTD partition 'rootfs_data' not found\n");
-   return -1;
-   }
-
mp = find_mount_point(v->blk, 1);
if (mp) {
ULOG_INFO("%s is mounted as %s, only erasing files\n", v->blk, 
mp);
@@ -73,23 +57,12 @@ jffs2_reset(int argc, char **argv)
return 0;
 }
 
-static int
-jffs2_mark(int argc, char **argv)
+static int jffs2_mark(struct volume *v)
 {
__u32 deadc0de = __cpu_to_be32(0xdeadc0de);
-   struct volume *v;
size_t sz;
int fd;
 
-   if (ask_user(argc, argv))
-   return -1;
-
-   v = volume_find("rootfs_data");
-   if (!v) {
-   ULOG_ERR("MTD partition 'rootfs_data' not found\n");
-   return -1;
-   }
-
fd = open(v->blk, O_WRONLY);
ULOG_INFO("%s - marking with deadc0de\n", v->blk);
if (!fd) {
@@ -110,7 +83,28 @@ jffs2_mark(int argc, char **argv)
 
 int main(int argc, char **argv)
 {
+   struct volume *v;
+
+   if (ask_user(argc, argv))
+   return -1;
+
+   /*
+* TODO: Currently this only checks if kernel supports OverlayFS. We
+* should check if there is a mount point using it with rootfs_data
+* as upperdir.
+*/
+   if (find_filesystem("overlay")) {
+   ULOG_ERR("overlayfs not supported by kernel\n");
+   return -1;
+   }
+
+   v = volume_find("rootfs_data");
+   if (!v) {
+   ULOG_ERR("MTD partition 'rootfs_data' not found\n");
+   return -1;
+   }
+
if (!strcmp(*argv, "jffs2mark"))
-   return jffs2_mark(argc, argv);
-   return jffs2_reset(argc, argv);
+   return jffs2_mark(v);
+   return jffs2_reset(v);
 }
-- 
1.8.4.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel