[OpenWrt-Devel] [PATCH] ar71xx: add support for TL-WR720N-v4.

2015-06-13 Thread Yousong Zhou
The hardware should be almost the same as TL-WR720N-v3.  WiFi and LAN networks
were tested by Lo Yuk Fai loyuk...@gmail.com.  Failsafe and slider switch
were tested by Wong min alpha...@gmail.com.

Signed-off-by: Yousong Zhou yszhou4t...@gmail.com
---
Well this patch has been sitting on my local tree for a while.  Just refreshed
and should still work.

 target/linux/ar71xx/base-files/lib/ar71xx.sh |2 +-
 .../linux/ar71xx/files/arch/mips/ath79/mach-tl-wr720n-v3.c   |3 +--
 target/linux/ar71xx/image/Makefile   |   10 +-
 .../patches-3.18/610-MIPS-ath79-openwrt-machines.patch   |4 ++--
 tools/firmware-utils/src/mktplinkfw.c|6 ++
 5 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index b13be1e..2a2fddd 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -769,7 +769,7 @@ ar71xx_board_detect() {
*TL-WR710N v1)
name=tl-wr710n
;;
-   *TL-WR720N v3)
+   *TL-WR720N*)
name=tl-wr720n-v3
;;
*TL-MR10U)
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr720n-v3.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr720n-v3.c
index 80e8df6..2bb3b44 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr720n-v3.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr720n-v3.c
@@ -104,6 +104,5 @@ static void __init tl_wr720n_v3_setup(void)
ath79_register_wmac(ee, mac);
 }
 
-MIPS_MACHINE(ATH79_MACH_TL_WR720N_V3, TL-WR720N-v3, TP-LINK TL-WR720N v3,
+MIPS_MACHINE(ATH79_MACH_TL_WR720N_V3, TL-WR720N-v3, TP-LINK TL-WR720N 
v3/v4,
tl_wr720n_v3_setup);
-
diff --git a/target/linux/ar71xx/image/Makefile 
b/target/linux/ar71xx/image/Makefile
index 580a640..bf20e45 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -433,7 +433,15 @@ define Device/tl-wr720n-v3
 TPLINK_HWID := 0x07200103
 CONSOLE := ttyATH0,115200
 endef
-TARGET_DEVICES += tl-wr703n-v1 tl-wr710n-v1 tl-wr710n-v2 tl-wr720n-v3
+
+define Device/tl-wr720n-v4
+$(Device/tplink-4mlzma)
+BOARDNAME := TL-WR720N-v3
+DEVICE_PROFILE := TLWR720
+TPLINK_HWID := 0x07200104
+CONSOLE := ttyATH0,115200
+endef
+TARGET_DEVICES += tl-wr703n-v1 tl-wr710n-v1 tl-wr710n-v2 tl-wr720n-v3 
tl-wr720n-v4
 
 define Device/tl-wr740n-v4
 $(Device/tplink-4mlzma)
diff --git 
a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch 
b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
index f8a561c..780ac5b 100644
--- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
+++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch
@@ -134,7 +134,7 @@
 +  ATH79_MACH_TL_WR2543N,  /* TP-LINK TL-WR2543N/ND */
 +  ATH79_MACH_TL_WR703N,   /* TP-LINK TL-WR703N */
 +  ATH79_MACH_TL_WR710N,   /* TP-LINK TL-WR710N */
-+  ATH79_MACH_TL_WR720N_V3,/* TP-LINK TL-WR720N v3 */
++  ATH79_MACH_TL_WR720N_V3,/* TP-LINK TL-WR720N v3/v4 */
 +  ATH79_MACH_TL_WR741ND,  /* TP-LINK TL-WR741ND */
 +  ATH79_MACH_TL_WR741ND_V4,   /* TP-LINK TL-WR741ND  v4*/
 +  ATH79_MACH_TL_WR841N_V1,/* TP-LINK TL-WR841N v1 */
@@ -1118,7 +1118,7 @@
 +  select ATH79_DEV_WMAC
 +
 +config ATH79_MACH_TL_WR720N_V3
-+  bool TP-LINK TL-WR720N v3 support
++  bool TP-LINK TL-WR720N v3/v4 support
 +  select SOC_AR933X
 +  select ATH79_DEV_ETH
 +  select ATH79_DEV_GPIO_BUTTONS
diff --git a/tools/firmware-utils/src/mktplinkfw.c 
b/tools/firmware-utils/src/mktplinkfw.c
index 80db8f8..f263bc6 100644
--- a/tools/firmware-utils/src/mktplinkfw.c
+++ b/tools/firmware-utils/src/mktplinkfw.c
@@ -53,6 +53,7 @@
 #define HWID_TL_WDR4900_V1 0x4901
 #define HWID_TL_WR703N_V1  0x07030101
 #define HWID_TL_WR720N_V3  0x07200103
+#define HWID_TL_WR720N_V4  0x07200104
 #define HWID_TL_WR741ND_V1 0x07410001
 #define HWID_TL_WR741ND_V4 0x07410004
 #define HWID_TL_WR740N_V1  0x0741
@@ -402,6 +403,11 @@ static struct board_info boards[] = {
.hw_rev = 1,
.layout_id  = 4Mlzma,
}, {
+   .id = TL-WR720Nv4,
+   .hw_id  = HWID_TL_WR720N_V4,
+   .hw_rev = 1,
+   .layout_id  = 4Mlzma,
+   }, {
.id = GL-INETv1,
.hw_id  = HWID_GL_INET_V1,
.hw_rev = 1,
-- 
1.7.10.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] procd: correct the order of respawn params in the comments.

2015-06-13 Thread Yousong Zhou
Signed-off-by: Yousong Zhou yszhou4t...@gmail.com
---
 package/system/procd/files/procd.sh |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/system/procd/files/procd.sh 
b/package/system/procd/files/procd.sh
index 0e798a0..e83e75c 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -12,7 +12,7 @@
 # procd_set_param(type, [value...])
 #   Available types:
 # command: command line (array).
-# respawn info: array with 3 values $restart_timeout $fail_hreshold 
$max_fail
+# respawn info: array with 3 values $fail_threshold $restart_timeout 
$max_fail
 # env: environment variable (passed to the process)
 # data: arbitrary name/value pairs for detecting config changes (table)
 # file: configuration files (array)
-- 
1.7.10.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 5/5] service: close instance pipe fd on restart.

2015-06-13 Thread Yousong Zhou
Otherwise we hit max number of fd limit (1024) and instances fail to
start with the following errors in syslog

Sun Jun 14 01:27:38 2015 daemon.warn procd: pipe() failed: 24 (Too many 
open files)

Signed-off-by: Yousong Zhou yszhou4t...@gmail.com
---
 service/instance.c |   14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/service/instance.c b/service/instance.c
index e89cbc6..29fb834 100644
--- a/service/instance.c
+++ b/service/instance.c
@@ -295,6 +295,8 @@ instance_run(struct service_instance *in, int _stdout, int 
_stderr)
exit(127);
 }
 
+static void instance_free_stdio(struct service_instance *in);
+
 void
 instance_start(struct service_instance *in)
 {
@@ -310,6 +312,7 @@ instance_start(struct service_instance *in)
if (in-proc.pending)
return;
 
+   instance_free_stdio(in);
if (in-_stdout.fd.fd  -2) {
if (pipe(opipe)) {
ULOG_WARN(pipe() failed: %d (%s)\n, errno, 
strerror(errno));
@@ -820,19 +823,26 @@ instance_update(struct service_instance *in, struct 
service_instance *in_new)
return true;
 }
 
-void
-instance_free(struct service_instance *in)
+static void
+instance_free_stdio(struct service_instance *in)
 {
if (in-_stdout.fd.fd  -1) {
ustream_free(in-_stdout.stream);
close(in-_stdout.fd.fd);
+   in-_stdout.fd.fd = -1;
}
 
if (in-_stderr.fd.fd  -1) {
ustream_free(in-_stderr.stream);
close(in-_stderr.fd.fd);
+   in-_stderr.fd.fd = -1;
}
+}
 
+void
+instance_free(struct service_instance *in)
+{
+   instance_free_stdio(in);
uloop_process_delete(in-proc);
uloop_timeout_cancel(in-timeout);
trigger_del(in);
-- 
1.7.10.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 4/5] service: allow get_data of specifc instance.

2015-06-13 Thread Yousong Zhou

Signed-off-by: Yousong Zhou yszhou4t...@gmail.com
---
 service/service.c |   33 +++--
 1 file changed, 27 insertions(+), 6 deletions(-)

diff --git a/service/service.c b/service/service.c
index c2a242b..2702dc3 100644
--- a/service/service.c
+++ b/service/service.c
@@ -213,8 +213,17 @@ static const struct blobmsg_policy 
validate_policy[__VALIDATE_MAX] = {
[VALIDATE_SERVICE] = { .name = service, .type = BLOBMSG_TYPE_STRING },
 };
 
+enum {
+   DATA_NAME,
+   DATA_INSTANCE,
+   DATA_TYPE,
+   __DATA_MAX
+};
+
 static const struct blobmsg_policy get_data_policy[] = {
-   { type, BLOBMSG_TYPE_STRING }
+   [DATA_NAME] = { name, BLOBMSG_TYPE_STRING },
+   [DATA_INSTANCE] = { instance, BLOBMSG_TYPE_STRING },
+   [DATA_TYPE] = { type, BLOBMSG_TYPE_STRING },
 };
 
 static int
@@ -424,24 +433,36 @@ service_get_data(struct ubus_context *ctx, struct 
ubus_object *obj,
 {
struct service_instance *in;
struct service *s;
-   struct blob_attr *tb;
+   struct blob_attr *tb[__DATA_MAX];
+   const char *name = NULL;
+   const char *instance = NULL;
const char *type = NULL;
 
-   blobmsg_parse(get_data_policy, 1, tb, blob_data(msg), blob_len(msg));
-   if (tb)
-   type = blobmsg_data(tb);
+   blobmsg_parse(get_data_policy, __DATA_MAX, tb, blob_data(msg), 
blob_len(msg));
+   if (tb[DATA_NAME])
+   name = blobmsg_data(tb[DATA_NAME]);
+   if (tb[DATA_INSTANCE])
+   instance = blobmsg_data(tb[DATA_INSTANCE]);
+   if (tb[DATA_TYPE])
+   type = blobmsg_data(tb[DATA_TYPE]);
 
blob_buf_init(b, 0);
avl_for_each_element(services, s, avl) {
void *cs = NULL;
 
+   if (name  strcmp(name, s-name))
+   continue;
+
vlist_for_each_element(s-instances, in, node) {
struct blobmsg_list_node *var;
void *ci = NULL;
 
+   if (instance  strcmp(instance, in-name))
+   continue;
+
blobmsg_list_for_each(in-data, var) {
if (type 
-   strcmp(blobmsg_name(var-data), type) != 0)
+   strcmp(blobmsg_name(var-data), type))
continue;
 
if (!cs)
-- 
1.7.10.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/3] openvpn: let instances drop to nobody in default config.

2015-06-13 Thread Yousong Zhou
This is for security precautions.  As persist_tun and persist_key are
already there, this should not cause compatibility issue.

Signed-off-by: Yousong Zhou yszhou4t...@gmail.com
---
 package/network/services/openvpn/files/openvpn.config |2 ++
 1 file changed, 2 insertions(+)

diff --git a/package/network/services/openvpn/files/openvpn.config 
b/package/network/services/openvpn/files/openvpn.config
index 5cf0ba6..3e053c3 100644
--- a/package/network/services/openvpn/files/openvpn.config
+++ b/package/network/services/openvpn/files/openvpn.config
@@ -253,6 +253,7 @@ config openvpn sample_server
# of the privilege downgrade.
option persist_key 1
option persist_tun 1
+   option user nobody
 
# Output a short status file showing
# current connections, truncated
@@ -337,6 +338,7 @@ config openvpn sample_client
# Try to preserve some state across restarts.
option persist_key 1
option persist_tun 1
+   option user nobody
 
# If you are connecting through an
# HTTP proxy to reach the actual OpenVPN
-- 
1.7.10.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 3/3] openvpn: bump PKG_RELEASE.

2015-06-13 Thread Yousong Zhou

Signed-off-by: Yousong Zhou yszhou4t...@gmail.com
---
 package/network/services/openvpn/Makefile |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/services/openvpn/Makefile 
b/package/network/services/openvpn/Makefile
index 3e9be0d..81d8007 100644
--- a/package/network/services/openvpn/Makefile
+++ b/package/network/services/openvpn/Makefile
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=openvpn
 
 PKG_VERSION:=2.3.6
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 
 PKG_SOURCE_URL:=http://swupdate.openvpn.net/community/releases
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-- 
1.7.10.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/5] service: optimize relaying stdio output of daemons a bit.

2015-06-13 Thread Yousong Zhou

Signed-off-by: Yousong Zhou yszhou4t...@gmail.com
---
 service/instance.c |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/service/instance.c b/service/instance.c
index 3367885..4ace40b 100644
--- a/service/instance.c
+++ b/service/instance.c
@@ -366,6 +366,10 @@ instance_stdio(struct ustream *s, int prio, struct 
service_instance *in)
char *newline, *str, *arg0, ident[32];
int len;
 
+   arg0 = basename(blobmsg_data(blobmsg_data(in-command)));
+   snprintf(ident, sizeof(ident), %s[%d], arg0, in-proc.pid);
+   ulog_open(ULOG_SYSLOG, LOG_DAEMON, ident);
+
do {
str = ustream_get_read_buf(s, NULL);
if (!str)
@@ -376,17 +380,13 @@ instance_stdio(struct ustream *s, int prio, struct 
service_instance *in)
break;
 
*newline = 0;
-   len = newline + 1 - str;
-
-   arg0 = basename(blobmsg_data(blobmsg_data(in-command)));
-   snprintf(ident, sizeof(ident), %s[%d], arg0, in-proc.pid);
-
-   ulog_open(ULOG_SYSLOG, LOG_DAEMON, ident);
ulog(prio, %s\n, str);
-   ulog_open(ULOG_SYSLOG, LOG_DAEMON, procd);
 
+   len = newline + 1 - str;
ustream_consume(s, len);
} while (1);
+
+   ulog_open(ULOG_SYSLOG, LOG_DAEMON, procd);
 }
 
 static void
-- 
1.7.10.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 3/5] service: remove unused struct watch_subscribe definition.

2015-06-13 Thread Yousong Zhou

Signed-off-by: Yousong Zhou yszhou4t...@gmail.com
---
 service/watch.c |5 -
 1 file changed, 5 deletions(-)

diff --git a/service/watch.c b/service/watch.c
index 65e1fec..349b484 100644
--- a/service/watch.c
+++ b/service/watch.c
@@ -26,11 +26,6 @@ struct watch_object {
char *name;
 };
 
-struct watch_subscribe {
-   struct uloop_timeout t;
-   uint32_t id;
-};
-
 static struct ubus_event_handler watch_event;
 static struct ubus_subscriber watch_subscribe;
 static LIST_HEAD(watch_objects);
-- 
1.7.10.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 0/5] procd: a few cleanup and fixes

2015-06-13 Thread Yousong Zhou
Mostly of these are formed when working on `ossherd` [1] recently.

There is a possible use-after-free bug I am not sure what's the proper fix.

 1. In service_instance_update(), instance_stop() and instance_free() are 
called.
 2. Later instance_exit() will access the instance structure already free'd 
previously.

[1] https://github.com/yousong/waller/tree/master/ossherd

Yousong Zhou (5):
  service: optimize relaying stdio output of daemons a bit.
  service: dump respawn params in the same order as when passed in.
  service: remove unused struct watch_subscribe definition.
  service: allow get_data of specifc instance.
  service: close instance pipe fd on restart.

 service/instance.c |   30 --
 service/service.c  |   33 +++--
 service/watch.c|5 -
 3 files changed, 47 insertions(+), 21 deletions(-)

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


[OpenWrt-Devel] [PATCH 2/5] service: dump respawn params in the same order as when passed in.

2015-06-13 Thread Yousong Zhou

Signed-off-by: Yousong Zhou yszhou4t...@gmail.com
---
 service/instance.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/service/instance.c b/service/instance.c
index 4ace40b..e89cbc6 100644
--- a/service/instance.c
+++ b/service/instance.c
@@ -917,8 +917,8 @@ void instance_dump(struct blob_buf *b, struct 
service_instance *in, int verbose)
 
if (in-respawn) {
void *r = blobmsg_open_table(b, respawn);
-   blobmsg_add_u32(b, timeout, in-respawn_timeout);
blobmsg_add_u32(b, threshold, in-respawn_threshold);
+   blobmsg_add_u32(b, timeout, in-respawn_timeout);
blobmsg_add_u32(b, retry, in-respawn_retry);
blobmsg_close_table(b, r);
}
-- 
1.7.10.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/3] openvpn: fix handling comp_lzo and auth_retry as the wrong type.

2015-06-13 Thread Yousong Zhou
As reported in #19104.

Signed-off-by: Yousong Zhou yszhou4t...@gmail.com
---
 package/network/services/openvpn/files/openvpn.init |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/package/network/services/openvpn/files/openvpn.init 
b/package/network/services/openvpn/files/openvpn.init
index 294e3ed..acdc7de 100644
--- a/package/network/services/openvpn/files/openvpn.init
+++ b/package/network/services/openvpn/files/openvpn.init
@@ -94,8 +94,8 @@ start_instance() {
 
# append flags
append_bools $s \
-   auth_nocache auth_retry auth_user_pass_optional bind 
ccd_exclusive client client_cert_not_required \
-   client_to_client comp_noadapt disable \
+   auth_nocache auth_user_pass_optional bind ccd_exclusive client 
client_cert_not_required \
+   client_to_client comp_lzo comp_noadapt disable \
disable_occ down_pre duplicate_cn fast_io float 
http_proxy_retry \
ifconfig_noexec ifconfig_nowarn ifconfig_pool_linear 
management_forget_disconnect management_hold \
management_query_passwords management_signal mktun mlock 
mtu_test multihome mute_replay_warnings \
@@ -107,8 +107,8 @@ start_instance() {
 
# append params
append_params $s \
-   cd askpass auth auth_user_pass auth_user_pass_verify 
bcast_buffers ca cert \
-   chroot cipher client_config_dir client_connect 
client_disconnect comp_lzo connect_freq \
+   cd askpass auth auth_retry auth_user_pass auth_user_pass_verify 
bcast_buffers ca cert \
+   chroot cipher client_config_dir client_connect 
client_disconnect connect_freq \
connect_retry connect_timeout connect_retry_max crl_verify dev 
dev_node dev_type dh \
echo engine explicit_exit_notify fragment group hand_window 
hash_size \
http_proxy http_proxy_option http_proxy_timeout ifconfig 
ifconfig_pool \
-- 
1.7.10.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] firmware-tools/ptgen: fix endianness conversion for PTE .start, .length field.

2015-06-13 Thread Yousong Zhou
They are of 32-bit little endian integers.

Signed-off-by: Yousong Zhou yszhou4t...@gmail.com
---
 tools/firmware-utils/src/ptgen.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/firmware-utils/src/ptgen.c b/tools/firmware-utils/src/ptgen.c
index 6379ed7..68bad6f 100644
--- a/tools/firmware-utils/src/ptgen.c
+++ b/tools/firmware-utils/src/ptgen.c
@@ -31,9 +31,9 @@
 #include stdint.h
 
 #if __BYTE_ORDER == __BIG_ENDIAN
-#define cpu_to_le16(x) bswap_16(x)
+#define cpu_to_le32(x) bswap_32(x)
 #elif __BYTE_ORDER == __LITTLE_ENDIAN
-#define cpu_to_le16(x) (x)
+#define cpu_to_le32(x) (x)
 #else
 #error unknown endianness!
 #endif
@@ -142,11 +142,11 @@ static int gen_ptable(uint32_t signature, int nr)
start = sect + sectors;
if (kb_align != 0)
start = round_to_kb(start);
-   pte[i].start = cpu_to_le16(start);
+   pte[i].start = cpu_to_le32(start);
sect = start + parts[i].size * 2;
if (kb_align == 0)
sect = round_to_cyl(sect);
-   pte[i].length = cpu_to_le16(len = sect - start);
+   pte[i].length = cpu_to_le32(len = sect - start);
to_chs(start, pte[i].chs_start);
to_chs(start + len - 1, pte[i].chs_end);
if (verbose)
-- 
1.7.10.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] Chaos Calmer 15.05-rc2

2015-06-13 Thread Steven Barth
The OpenWrt developers are proud to announce the first release candidate
of OpenWrt Chaos Calmer.

   ___ __
 |   |.-.-.-.|  |  |  |..|  |_
 |   -   ||  _  |  -__| ||  |  |  ||   _||   _|
 |___||   __|_|__|__||||__|  ||
  |__| W I R E L E S S   F R E E D O M
 -
 CHAOS CALMER (15.05 RC2)
 -
  * 1 1/2 oz GinShake with a glassful
  * 1/4 oz Triple Sec   of broken ice and pour
  * 3/4 oz Lime Juice   unstrained into a goblet.
  * 1 1/2 oz Orange Juice
  * 1 tsp. Grenadine Syrup
 -

 -
http://downloads.openwrt.org/chaos_calmer/15.05-rc2/

** Improvements since RC 1 **
* Fixed broken ImageBuilders for most targets
* Updated 3.18 to 3.18.14
* Fixed broken IPv6 downstream DHCPv6-PD and onlink-route handling
* Images (special format) for Asus brcm47xx and bcm53xx devices
* Improved stability of sysupgrade on brcm47xx and bcm53xx
* Added HTTPS enforcement option to uhttpd
* Fixed umask issue
* Added support for a few new boards


** Highlights since Barrier Breaker **

* Linux kernel updated to version 3.18
* Improved Security Features
- Rewritten package signing architecture based on ed25519
- Added support for jails
- Added support for hardened builds
* Improved Networking Support
- Added or improved support for lots of 3G/4G modems (MBIM, QMI,
NCM, ...)
- Added support for 464XLAT (CLAT) [RFC 6877 + RFC 7050]
- Netfilter performance enhancements (conntrack route cache)
- Improved support for self-managing networks [draft-ietf-homenet-hncp]
- Better multi-core support for the network stack
- Improved support for MAP-E, MAP-T and LW4over6 IPv4 transitioning
technologies
[draft-ietf-softwire-map, -map-t, -map-dhcp, -lw4over6]
- Improved network auto-setup capable of detecting and bootstrapping
IPv4-only,
  6rd, Dual-Stack, IPv6-only, DS-Lite, LW4over6, MAP-E, MAP-T, 464XLAT
  and combinations without explicit configuration [based on RFC 7084]
- Added support for Smart Queue Management (SQM) QoS, AQM and
Traffic Shaping
- Improved support for DNSSEC
* Platform and Driver Support
- Added support for feeds of externally maintained targets
- New mt7621 subtarget for Mediatek 11ac SoC
- New mt76 mac80211 based wifi driver for MTK 11ac cores.
- New mwlwifi mac80211 based wifi driver for the Marvell 88W8864
- New bcm53xx target for Broadcom ARM BCM47xx/53xx devices
- New mxs target for Freescale i.MX23/28 family and various boards
- New sunxi target for AllWinner A10/A13/A20 family and various boards
- brcm2708: support for Raspberry Pi 2
- brcm63xx: support for BCM6318 and BCM63268 family
- brcm63xx: improved fallback sprom support with bcma support

* Known Issues
- Sysupgrade on brcm47xx may fail by running out of memory when
using .bin or .chk files. Please use .trx when using rc1 (it was fixed
in rc2).
 - openssl and strongswan are outdated. If you intend to use either
of them please update the packages using the snapshots repository:
https://downloads.openwrt.org/snapshots/trunk/


And lots and lots of other advancements...
As always a big thank you goes to all our active package maintainers,
testers, supporters and documenters.


Have fun!
The OpenWrt developer team
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v3 1/2] [mac80211] Add channel set helper callback to ath9k

2015-06-13 Thread Felix Fietkau
On 2015-06-12 21:36, Stefan Rompf wrote:
 This patch adds a channel set helper callback to the ath9k driver and 
 exports the ath9k kernel API for other packages. The registered function
 is called whenever ath9k changes the channel. 
 
 Signed-off-by: Stefan Rompf ste...@loplof.de
NACK from me for the ath9k_set_channel_helper part. This helper function
needs to be passed in from the platform data, similar to how external
reset is handled.
From previous emails you pointed out that you guys chose this
design/structure simply because you want to have an easy way of
debugging, but I think that's not a strong enough reason to make the API
between ath9k and the HSR code this quirky.

Here's what I want:
The hsr filter code function is passed in by the mach-* function for the
UniFi Outdoor, and the code is in the kernel itself.

And here's how you make debugging easy:
You make a package (which can live somewhere in a separate git tree),
which contains a copy of the code that is also in the kernel, and when
this package gets loaded, it looks up the ath9k pci device and the
platform data, and it overwrites the channel helper function callback.

Whenever you're finished testing your changes, you simply copy them back
to the source file used by the kernel and submit patches based on that.

Does that seem like a reasonable compromise to you?

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


Re: [OpenWrt-Devel] Chaos Calmer 15.05-rc2

2015-06-13 Thread Arturo Rinaldi
Can i get the exact commit hash and description of the 15.05-rc2 please ?

Thank you very much in advance.

Kind Regards, Arturo
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Chaos Calmer 15.05-rc2

2015-06-13 Thread Fernando Frediani

Hi folks,

I'm seeing an issue on my Barrier Breaker running on a TP-Link WR842ND 
where it gets an IPv6 /128 to the WAN interface + /64 on the LAN 
interface via DHCPv6 + PD, however it does NOT set the default gateway 
by default, so I have to discover it and set manually using the 
other-side link-local.
Even though eventually while running and after a few Save  Apply it 
mysteriously looses the same default gateway I have set manually (I'm 
guessing due DHCPv6 changing it every in a while to the original when it 
booted - none). And it can't ping it anymore (the other-side link local 
address). By the way, it's a cable connection.


For comparison I have another router running DD-WRT from 22/Nov/2014 
connected to the same ISP in another point of the city and it works fine 
DHCPv6, sets the default gateway by default and never looses it.


By any chance this changelog /Fixed broken IPv6 downstream DHCPv6-PD 
and onlink-route handling/ would perhaps have anything to do with that 
problem observed ?


Thanks
Fernando


On 13/06/2015 11:21, Steven Barth wrote:

The OpenWrt developers are proud to announce the first release candidate
of OpenWrt Chaos Calmer.

___ __
  |   |.-.-.-.|  |  |  |..|  |_
  |   -   ||  _  |  -__| ||  |  |  ||   _||   _|
  |___||   __|_|__|__||||__|  ||
   |__| W I R E L E S S   F R E E D O M
  -
  CHAOS CALMER (15.05 RC2)
  -
   * 1 1/2 oz GinShake with a glassful
   * 1/4 oz Triple Sec   of broken ice and pour
   * 3/4 oz Lime Juice   unstrained into a goblet.
   * 1 1/2 oz Orange Juice
   * 1 tsp. Grenadine Syrup
  -

  -
http://downloads.openwrt.org/chaos_calmer/15.05-rc2/

** Improvements since RC 1 **
* Fixed broken ImageBuilders for most targets
* Updated 3.18 to 3.18.14
* Fixed broken IPv6 downstream DHCPv6-PD and onlink-route handling
* Images (special format) for Asus brcm47xx and bcm53xx devices
* Improved stability of sysupgrade on brcm47xx and bcm53xx
* Added HTTPS enforcement option to uhttpd
* Fixed umask issue
* Added support for a few new boards


** Highlights since Barrier Breaker **

* Linux kernel updated to version 3.18
* Improved Security Features
 - Rewritten package signing architecture based on ed25519
 - Added support for jails
 - Added support for hardened builds
* Improved Networking Support
 - Added or improved support for lots of 3G/4G modems (MBIM, QMI,
NCM, ...)
 - Added support for 464XLAT (CLAT) [RFC 6877 + RFC 7050]
 - Netfilter performance enhancements (conntrack route cache)
 - Improved support for self-managing networks [draft-ietf-homenet-hncp]
 - Better multi-core support for the network stack
 - Improved support for MAP-E, MAP-T and LW4over6 IPv4 transitioning
technologies
 [draft-ietf-softwire-map, -map-t, -map-dhcp, -lw4over6]
 - Improved network auto-setup capable of detecting and bootstrapping
IPv4-only,
   6rd, Dual-Stack, IPv6-only, DS-Lite, LW4over6, MAP-E, MAP-T, 464XLAT
   and combinations without explicit configuration [based on RFC 7084]
 - Added support for Smart Queue Management (SQM) QoS, AQM and
Traffic Shaping
 - Improved support for DNSSEC
* Platform and Driver Support
 - Added support for feeds of externally maintained targets
 - New mt7621 subtarget for Mediatek 11ac SoC
 - New mt76 mac80211 based wifi driver for MTK 11ac cores.
 - New mwlwifi mac80211 based wifi driver for the Marvell 88W8864
 - New bcm53xx target for Broadcom ARM BCM47xx/53xx devices
 - New mxs target for Freescale i.MX23/28 family and various boards
 - New sunxi target for AllWinner A10/A13/A20 family and various boards
 - brcm2708: support for Raspberry Pi 2
 - brcm63xx: support for BCM6318 and BCM63268 family
 - brcm63xx: improved fallback sprom support with bcma support

* Known Issues
 - Sysupgrade on brcm47xx may fail by running out of memory when
using .bin or .chk files. Please use .trx when using rc1 (it was fixed
in rc2).
  - openssl and strongswan are outdated. If you intend to use either
of them please update the packages using the snapshots repository:
https://downloads.openwrt.org/snapshots/trunk/


And lots and lots of other advancements...
As always a big thank you goes to all our active package maintainers,
testers, supporters and documenters.


Have fun!
 The OpenWrt developer team
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org

Re: [OpenWrt-Devel] Chaos Calmer 15.05-rc2

2015-06-13 Thread Rafał Miłecki
On 13 June 2015 at 17:31, Arturo Rinaldi art...@doghunter.org wrote:
 Can i get the exact commit hash and description of the 15.05-rc2 please ?

f5c2b51 ralink: add missing symbol

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


Re: [OpenWrt-Devel] [PATCH v3 1/2] [mac80211] Add channel set helper callback to ath9k

2015-06-13 Thread Felix Fietkau
On 2015-06-13 10:57, Stefan Rompf wrote:
 Hi Felix,
 
 thanks for your feedback!
 
 NACK from me for the ath9k_set_channel_helper part. This helper function
 needs to be passed in from the platform data, similar to how external
 reset is handled.
 From previous emails you pointed out that you guys chose this
 design/structure simply because you want to have an easy way of
 debugging, but I think that's not a strong enough reason to make the API
 between ath9k and the HSR code this quirky.
 
 Here's what I want:
 The hsr filter code function is passed in by the mach-* function for the
 UniFi Outdoor, and the code is in the kernel itself.
 
 however this approach looks even more ugly to me.
 
 The HSR is connected to the GPIO lines of the AR928x. As long as ath9k does 
 not register with the kernels' GPIO subsystem (which is definitely Designated 
 Driver stuff if I had to implement it), we need to callback into the ath9k 
 driver when tuning it. We'd end up with something like this in 
 ath9k_platform.h:
Okay, I missed that. I thought it was on system GPIO lines.

 typedef void (cfg_gpio_input_fkt)(struct ath_hw *ah, u32 gpio);
 typedef void (cfg_gpio_output_fkt)struct ath_hw *ah, u32 gpio,
 
 u32 ah_signal_type);
 typedef void (set_gpio_fkt)(struct ath_hw *ah, u32 gpio, u32 val);
 typedef u32 (gpio_get_fkt)(struct ath_hw *ah, u32 gpio, u32 val);
 
 struct ath9k_platform_data {
 ...
  void (*set_channel_helper)(struct ath_hw*, int bw, int fq, 
 cfg_gpio_input_fkt 
 *,  cfg_gpio_output_fkt *, set_gpio_fkt*, gpio_get_fkt*);
 ...
 };
 
 and the callback inside channel.c:
 
 if (sc-dev-platform_data-set_channel_helper) {
  sc-dev-platform_data-set_channel_helper(ah, chandef-width, chan-
center_freq, ath9k_hw_cfg_gpio_input, ath9k_hw_cfg_output, ath9k_hw_set_gpio, 
 ath9k_hw_gpio_get);
 }
 
 And here's how you make debugging easy:
 You make a package (which can live somewhere in a separate git tree),
 which contains a copy of the code that is also in the kernel, and when
 this package gets loaded, it looks up the ath9k pci device and the
 platform data, and it overwrites the channel helper function callback.
 
 May be we can use a similiar approach to avoid this function pointer passing 
 horror. Let's have a 
 
 void (*set_channel_helper)(struct ath_hw*, int bw, int fq)
 
 callback in ath9k_platform_data that is enabled by the channel tuning module. 
 The module could then call into ath9k without indirections.
 
 What do you think?
That won't work, because the kernel ath9k header files are not in sync
with the ones from the mac80211 package. Maybe in this case it would be
better to put the code in ath9k.ko and enable it via a Kconfig option in
the mac80211 package. Then add a bool flag to the ath9k_platform_data
struct to enable it only for devices that need it.

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


Re: [OpenWrt-Devel] [PATCH v3 1/2] [mac80211] Add channel set helper callback to ath9k

2015-06-13 Thread Stefan Rompf
Hi Felix,

thanks for your feedback!

 NACK from me for the ath9k_set_channel_helper part. This helper function
 needs to be passed in from the platform data, similar to how external
 reset is handled.
 From previous emails you pointed out that you guys chose this
 design/structure simply because you want to have an easy way of
 debugging, but I think that's not a strong enough reason to make the API
 between ath9k and the HSR code this quirky.
 
 Here's what I want:
 The hsr filter code function is passed in by the mach-* function for the
 UniFi Outdoor, and the code is in the kernel itself.

however this approach looks even more ugly to me.

The HSR is connected to the GPIO lines of the AR928x. As long as ath9k does 
not register with the kernels' GPIO subsystem (which is definitely Designated 
Driver stuff if I had to implement it), we need to callback into the ath9k 
driver when tuning it. We'd end up with something like this in 
ath9k_platform.h:

typedef void (cfg_gpio_input_fkt)(struct ath_hw *ah, u32 gpio);
typedef void (cfg_gpio_output_fkt)struct ath_hw *ah, u32 gpio,  
  
u32 ah_signal_type);
typedef void (set_gpio_fkt)(struct ath_hw *ah, u32 gpio, u32 val);
typedef u32 (gpio_get_fkt)(struct ath_hw *ah, u32 gpio, u32 val);

struct ath9k_platform_data {
...
 void (*set_channel_helper)(struct ath_hw*, int bw, int fq, cfg_gpio_input_fkt 
*,  cfg_gpio_output_fkt *, set_gpio_fkt*, gpio_get_fkt*);
...
};

and the callback inside channel.c:

if (sc-dev-platform_data-set_channel_helper) {
 sc-dev-platform_data-set_channel_helper(ah, chandef-width, chan-
center_freq, ath9k_hw_cfg_gpio_input, ath9k_hw_cfg_output, ath9k_hw_set_gpio, 
ath9k_hw_gpio_get);
}

 And here's how you make debugging easy:
 You make a package (which can live somewhere in a separate git tree),
 which contains a copy of the code that is also in the kernel, and when
 this package gets loaded, it looks up the ath9k pci device and the
 platform data, and it overwrites the channel helper function callback.

May be we can use a similiar approach to avoid this function pointer passing 
horror. Let's have a 

void (*set_channel_helper)(struct ath_hw*, int bw, int fq)

callback in ath9k_platform_data that is enabled by the channel tuning module. 
The module could then call into ath9k without indirections.

What do you think?

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


Re: [OpenWrt-Devel] [PATCH] b53 switch driver memory leak and reset gpio pin initialization fix

2015-06-13 Thread blmink

Hi, Jonas
I inserted trace points (pr_info) at functions in b53_common and figured 
out that driver behave wrong.

Please have a look at this:

~~~cut~~~
root@(none):/# uname -a
Linux (none) 4.0.4 #1 SMP Sat Jun 13 02:59:36 MSK 2015 mips64 GNU/Linux
root@(none):/#
root@(none):/# ifconfig eth0 up
[   15.561304] b53_common: b53_switch_alloc
[   15.565265] b53_common: b53_switch_register
[   15.569960] b53_common: b53_switch_init
[   15.650583] b53_common: found switch: BCM53115, rev 8
[   15.659538] eth0: 1000 Mbps Full duplex, port 0
[   15.664439] eth1: 1000 Mbps Full duplex, port  1, queue  1
root@(none):/#
root@(none):/# root@(none):/# ifconfig eth0 down
[   42.697656] eth0: Link down
[   42.700742] eth0: 1000 Mbps Full duplex, port  0, queue  0
root@(none):/#
root@(none):/# ifconfig eth0 down
root@(none):/# ifconfig eth0 up
[   49.145311] b53_common: b53_switch_alloc
[   49.149267] b53_common: b53_switch_register
[   49.153972] b53_common: b53_switch_init
[   49.160932] Broadcom B53 (1) 800118001800:1e: failed to register 
switch: -16

ifconfig: SIOCSIFFLAGS: No such device
root@(none):/# reboot
~~~cut~~~

We can see that ifconfig up calls b53_switch_alloc which calls 
devm_kzalloc in sequence.

b53_switch_alloc is called by following sequence:
ifconfig up -- b53_mdio driver probe/register -- b53_phy_config_init 
-- b53_switch_alloc
Driver removes never (in case of ifconfig down either) and it do not 
free memory.

So,  in our example we have b53_switch_alloc called twice in a row.

As for switch gpio reset.. failed to register switch: -16 is from 
devm_gpio_request_one().

-16 is EBUSY (Device or resource busy).

My system is D-Link DSR-1000 (Cavium Octeon MIPS64), I have added 
support for it.

But things described above affect any platform.

Please also see comments below.


13.06.2015 01:57, Jonas Gorski пишет:

Hi,

On Fri, Jun 12, 2015 at 8:16 PM, Fedor Konstantinov blm...@mink.su wrote:

Memory and switch reset gpio pin must be allocated on switch/module init and 
freed on removal. At least they should not be allocated 2 or more times in a 
row.

Signed-off-by: Fedor Konstantinov blm...@mink.su
---
Comments:

Following cmd sequence calls b53_switch_init() twice, so causes leak of memory.
Last ifconfig will fail also on targets which support switch reset gpio pin, 
because devm_gpio_request_one() will be called twice in a row.
ifconfig eth0 up
ifconfig eth0 down
ifconfig eth0 up

On what platform? This also requires a better explanation why this is
the correct fix.

These affect any platform.

mmap/spi/srab drivers were not tested yet because I don't have such hardware.
---
  .../generic/files/drivers/net/phy/b53/b53_common.c | 19 +++
  .../generic/files/drivers/net/phy/b53/b53_mdio.c   |  6 +
  .../generic/files/drivers/net/phy/b53/b53_mmap.c   | 28 +-
  .../generic/files/drivers/net/phy/b53/b53_priv.h   |  7 +++---
  .../generic/files/drivers/net/phy/b53/b53_spi.c| 20 
  .../generic/files/drivers/net/phy/b53/b53_srab.c   | 28 +-
  6 files changed, 88 insertions(+), 20 deletions(-)

diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c 
b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
index 47b5a8b..2e2f6aa 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
@@ -1362,6 +1362,12 @@ struct b53_device *b53_switch_alloc(struct device *base, 
struct b53_io_ops *ops,
  }
  EXPORT_SYMBOL(b53_switch_alloc);

+void b53_switch_free(struct device *dev, struct b53_device *priv)
+{
+   devm_kfree(dev, priv);
+}
+EXPORT_SYMBOL(b53_switch_free);
+
  int b53_switch_detect(struct b53_device *dev)
  {
 u32 id32;
@@ -1452,6 +1458,19 @@ int b53_switch_register(struct b53_device *dev)
  }
  EXPORT_SYMBOL(b53_switch_register);

+void b53_switch_remove(struct b53_device *dev)
+{
+   unregister_switch(dev-sw_dev);
+
+   if (dev-reset_gpio = 0)
+   devm_gpio_free(dev-dev, dev-reset_gpio);
+
+   devm_kfree(dev-dev, dev-buf);
+   devm_kfree(dev-dev, dev-vlans);
+   devm_kfree(dev-dev, dev-ports);
+}
+EXPORT_SYMBOL(b53_switch_remove);

These look wrong, the whole point of using devm_* is that you do *not*
need to free the resources manually and it will be automatically done
on removal or probe failure.
Removal occurs never, unfortunately. But memory may be allocated several 
times. :(
In our case ifconfig down doesn't remove driver. But ifconfig up 
allocates memory.

+
  MODULE_AUTHOR(Jonas Gorski j...@openwrt.org);
  MODULE_DESCRIPTION(B53 switch library);
  MODULE_LICENSE(Dual BSD/GPL);
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c 
b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
index 3c25f0e..9a5f058 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
@@ -285,6 

Re: [OpenWrt-Devel] [PATCH v3 1/2] [mac80211] Add channel set helper callback to ath9k

2015-06-13 Thread Stefan Rompf
Hi Felix,

 Maybe in this case it would be
 better to put the code in ath9k.ko and enable it via a Kconfig option in
 the mac80211 package. Then add a bool flag to the ath9k_platform_data
 struct to enable it only for devices that need it.

sounds good to me, will create a patch...

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


Re: [OpenWrt-Devel] Chaos Calmer 15.05-rc2

2015-06-13 Thread Arturo Rinaldi
Thank you Rafał ! ! !

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