Re: [LEDE-DEV] [PATCH netifd] ubus: Display the IPv6 prefix assigned address

2016-12-10 Thread John Crispin


On 09/12/2016 09:19, Hans Dedecker wrote:
> Display the IPv6 address obtained from a prefix assignment
> as local-address element in the ubus ipv6-prefix-assignment
> list so it's explicitly clear which IPv6 address from the
> delegated prefix is assigned to the interface.
> 
> Signed-off-by: Hans Dedecker 

Acked-by: John Crispin 

feel free to push this to the tree yourself. i have closed the patchwork
ticket for you already

John

> ---
>  ubus.c | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/ubus.c b/ubus.c
> index 8ba43c0..29924c1 100644
> --- a/ubus.c
> +++ b/ubus.c
> @@ -600,12 +600,21 @@ interface_ip_dump_prefix_assignment_list(struct 
> interface *iface)
>   if (prefix->valid_until)
>   blobmsg_add_u32(, "valid", 
> prefix->valid_until - now);
>  
> + void *c = blobmsg_open_table(, "local-address");
> + if (assign->enabled) {
> + buf = blobmsg_alloc_string_buffer(, 
> "address", buflen);
> + inet_ntop(AF_INET6, >addr, buf, buflen);
> + blobmsg_add_string_buffer();
> +
> + blobmsg_add_u32(, "mask", assign->length < 64 
> ? 64 : assign->length);
> + }
> + blobmsg_close_table(, c);
> +
>   blobmsg_close_table(, a);
>   }
>   }
>  }
>  
> -
>  static void
>  interface_ip_dump_dns_server_list(struct interface_ip_settings *ip,
>bool enabled)
> 

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


Re: [LEDE-DEV] [PATCH] comgt-ncm: Add support for specifying profile index

2016-12-10 Thread John Crispin
Hi Matti

i noticed that you remove the ipv6 option/support and this is not
mentioned in the commit message. could you elaborate on that one ?

John

On 06/12/2016 17:52, Matti Laakso wrote:
> Add support for specifying a call profile index instead of APN. A
> specific index different from 1 must be used for some service
> provider and modem combinations.
> 
> In addition, change the manufacturer detection to use the standard
> AT+CGMI command, which produces more predictable output than ATI,
> and remove the redundant ipv6 option, since it is more customary
> to specify the PDP context type with mobile connections.
> 
> Signed-off-by: Matti Laakso 
> ---
>  package/network/utils/comgt/Makefile   |  2 +-
>  package/network/utils/comgt/files/getcardinfo.gcom |  2 +-
>  package/network/utils/comgt/files/ncm.json | 26 -
>  package/network/utils/comgt/files/ncm.sh   | 65 
> ++
>  4 files changed, 44 insertions(+), 51 deletions(-)
> 
> diff --git a/package/network/utils/comgt/Makefile 
> b/package/network/utils/comgt/Makefile
> index 9d99d64..4b6e6ea 100644
> --- a/package/network/utils/comgt/Makefile
> +++ b/package/network/utils/comgt/Makefile
> @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=comgt
>  PKG_VERSION:=0.32
> -PKG_RELEASE:=27
> +PKG_RELEASE:=28
>  
>  PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tgz
>  PKG_SOURCE_URL:=@SF/comgt
> diff --git a/package/network/utils/comgt/files/getcardinfo.gcom 
> b/package/network/utils/comgt/files/getcardinfo.gcom
> index 5c69a64..f91665f 100644
> --- a/package/network/utils/comgt/files/getcardinfo.gcom
> +++ b/package/network/utils/comgt/files/getcardinfo.gcom
> @@ -6,7 +6,7 @@ opengt
>   flash 0.1
>  
>  :start
> - send "ATI^m"
> + send "AT+CGMI^m"
>   get 1 "" $s
>   print $s
>  
> diff --git a/package/network/utils/comgt/files/ncm.json 
> b/package/network/utils/comgt/files/ncm.json
> index d1f8699..8f74e17 100644
> --- a/package/network/utils/comgt/files/ncm.json
> +++ b/package/network/utils/comgt/files/ncm.json
> @@ -7,7 +7,7 @@
>   "ATV1",
>   "ATE1",
>   "ATS0=0",
> - "AT+CGDCONT=1,\\\"${pdptype}\\\",\\\"${apn}\\\""
> + 
> "AT+CGDCONT=${profile},\\\"${pdptype}\\\"${apn:+,\\\"$apn\\\"}"
>   ],
>   "modes": {
>   "preferlte": 
> "AT^SYSCFGEX=\\\"030201\\\",3fff,2,4,7fff,,",
> @@ -17,8 +17,8 @@
>   "gsm": 
> "AT^SYSCFGEX=\\\"01\\\",3fff,2,4,7fff,,",
>   "auto": 
> "AT^SYSCFGEX=\\\"00\\\",3fff,2,4,7fff,,"
>   },
> - "connect": 
> "AT^NDISDUP=1,1,\\\"${apn}\\\"${username:+,\\\"$username\\\"}${password:+,\\\"$password\\\"}${auth:+,$auth}",
> - "disconnect": "AT^NDISDUP=1,0"
> + "connect": 
> "AT^NDISDUP=${profile},1${apn:+,\\\"$apn\\\"}${username:+,\\\"$username\\\"}${password:+,\\\"$password\\\"}${auth:+,$auth}",
> + "disconnect": "AT^NDISDUP=${profile},0"
>   },
>   "samsung": {
>   "initialize": [
> @@ -26,7 +26,7 @@
>   "AT+CGREG=2",
>   "AT+CFUN=5",
>   "AT+MODESELECT=3",
> - "AT+CGDCONT=1,\\\"${pdptype}\\\",\\\"${apn}\\\""
> + 
> "AT+CGDCONT=${profile},\\\"${pdptype}\\\"${apn:+,\\\"$apn\\\"}"
>   ],
>   "modes": {
>   "umts": "AT+CHANGEALLPATH=1"
> @@ -34,11 +34,11 @@
>   "connect": "AT+CGATT=1",
>   "disconnect": "AT+CGATT=0"
>   },
> - "sierra wireless, incorporated": {
> + "sierra": {
>   "initialize": [
>   "AT+CFUN=1",
> - "AT+CGDCONT=1,\\\"${pdptype}\\\",\\\"${apn}\\\"",
> - 
> "AT$QCPDPP=1${auth:+,$auth}${password:+,\\\"$password\\\"}${username:+,\\\"$username\\\"}"
> + 
> "AT+CGDCONT=${profile},\\\"${pdptype}\\\"${apn:+,\\\"$apn\\\"}",
> + 
> "AT$QCPDPP=${profile},${auth:-0}${password:+,\\\"$password\\\"}${username:+,\\\"$username\\\"}"
>   ],
>   "modes": {
>   "preferlte": "AT!SELRAT=07",
> @@ -48,20 +48,20 @@
>   "gsm": "AT!SELRAT=02",
>   "auto": "AT!SELRAT=00"
>   },
> - "connect": "AT!SCACT=1,1",
> - "disconnect": "AT!SCACT=0,1"
> + "connect": "AT!SCACT=1,${profile}",
> + "disconnect": "AT!SCACT=0,${profile}"
>   },
> - "sony ericsson": {
> + "sony": {
>   "initialize": [
>   "AT+CFUN=1",
> - "AT+CGDCONT=1,\\\"${pdptype}\\\",\\\"${apn}\\\"",
> - 
> "AT*EIAAUW=1,1,\\\"${username}\\\",\\\"${password}\\\",${auth:-00111}"
> +  

[LEDE-DEV] [PATCH netifd] proto: allow configuring deprecated static IPv6 addresses

2016-12-10 Thread Matthias Schiffer
Add a new boolean attribute ip6preferred to the static protocol which can
be set to 0 to mark IPv6 addresses as deprecated (set the preferred
lifetime to 0). This is useful to configure addresses that may be used for
incoming, but not for outgoing connections unless bound explicitly.

Signed-off-by: Matthias Schiffer 
---
 proto.c | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/proto.c b/proto.c
index 23304f3..a8642db 100644
--- a/proto.c
+++ b/proto.c
@@ -36,6 +36,7 @@ enum {
OPT_GATEWAY,
OPT_IP6GW,
OPT_IP6PREFIX,
+   OPT_IP6PREFERRED,
__OPT_MAX,
 };
 
@@ -47,6 +48,7 @@ static const struct blobmsg_policy 
proto_ip_attributes[__OPT_MAX] = {
[OPT_GATEWAY] = { .name = "gateway", .type = BLOBMSG_TYPE_STRING },
[OPT_IP6GW] = { .name = "ip6gw", .type = BLOBMSG_TYPE_STRING },
[OPT_IP6PREFIX] = { .name = "ip6prefix", .type = BLOBMSG_TYPE_ARRAY },
+   [OPT_IP6PREFERRED] = { .name = "ip6preferred", .type = 
BLOBMSG_TYPE_BOOL },
 };
 
 static const struct uci_blob_param_info proto_ip_attr_info[__OPT_MAX] = {
@@ -113,7 +115,7 @@ alloc_device_addr(bool v6, bool ext)
 
 static bool
 parse_addr(struct interface *iface, const char *str, bool v6, int mask,
-  bool ext, uint32_t broadcast)
+  bool ext, uint32_t broadcast, bool pref)
 {
struct device_addr *addr;
int af = v6 ? AF_INET6 : AF_INET;
@@ -136,6 +138,9 @@ parse_addr(struct interface *iface, const char *str, bool 
v6, int mask,
if (broadcast)
addr->broadcast = broadcast;
 
+   if (!pref)
+   addr->preferred_until = system_get_rtime();
+
vlist_add(>proto_ip.addr, >node, >flags);
return true;
 
@@ -148,7 +153,7 @@ error:
 
 static int
 parse_static_address_option(struct interface *iface, struct blob_attr *attr,
-   bool v6, int netmask, bool ext, uint32_t broadcast)
+   bool v6, int netmask, bool ext, uint32_t broadcast, 
bool pref)
 {
struct blob_attr *cur;
int n_addr = 0;
@@ -160,7 +165,7 @@ parse_static_address_option(struct interface *iface, struct 
blob_attr *attr,
 
n_addr++;
if (!parse_addr(iface, blobmsg_data(cur), v6, netmask, ext,
-   broadcast))
+   broadcast, pref))
return -1;
}
 
@@ -400,6 +405,7 @@ proto_apply_static_ip_settings(struct interface *iface, 
struct blob_attr *attr)
struct blob_attr *cur;
const char *error;
unsigned int netmask = 32;
+   bool ip6pref;
int n_v4 = 0, n_v6 = 0;
struct in_addr bcast = {};
 
@@ -420,13 +426,15 @@ proto_apply_static_ip_settings(struct interface *iface, 
struct blob_attr *attr)
}
}
 
+   ip6pref = blobmsg_get_bool_default(tb[OPT_IP6PREFERRED], true);
+
if ((cur = tb[OPT_IPADDR]))
n_v4 = parse_static_address_option(iface, cur, false,
-   netmask, false, bcast.s_addr);
+   netmask, false, bcast.s_addr, true);
 
if ((cur = tb[OPT_IP6ADDR]))
n_v6 = parse_static_address_option(iface, cur, true,
-   128, false, 0);
+   128, false, 0, ip6pref);
 
if ((cur = tb[OPT_IP6PREFIX]))
if (parse_prefix_list(iface, cur) < 0)
-- 
2.10.2


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


[LEDE-DEV] [PATCH v3] ramips: build factory images for Buffalo WSR-1166DHP/WSR-1166DHP2

2016-12-10 Thread FUKAUMI Naoki
factory image has to have custom trx magic, and trx file will be written
in the middle of the mtd3 partition (bootpartition=1 on u-boot).
therefore, sysupgrade.bin cannot be installed directly from stock Web UI.

with this patch, factory.bin will be built with initramfs image. it can
be installed from stock Web UI, then sysupgrade.bin can be installed by
sysupgrade on initramfs image.

install procedure:
 1. install factory.bin (initramfs image) from stock Web UI
 2. ssh root@192.168.1.1
 3. run "mtd erase firmware" (erase trx file from factory.bin in mtd3)
 4. install sysupgrade.bin by sysupgrade

Signed-off-by: FUKAUMI Naoki 
---
Changes in v3:
- use "DHP/dhp" instead of "WSR/wsr" for keyword for common things
- use "-I" instead of "-W" for buffalo-tag optarg
- make commit log message better

Changes in v2:
- cosmetic cleanup in mt7621.mk

 target/linux/ramips/image/mt7621.mk| 33 
 tools/firmware-utils/Makefile  |  1 +
 tools/firmware-utils/src/buffalo-tag.c | 29 ---
 tools/firmware-utils/src/mkdhpimg.c| 94 ++
 tools/firmware-utils/src/trx.c | 13 -
 5 files changed, 161 insertions(+), 9 deletions(-)
 create mode 100644 tools/firmware-utils/src/mkdhpimg.c

diff --git a/target/linux/ramips/image/mt7621.mk 
b/target/linux/ramips/image/mt7621.mk
index 6d85511..23a79f5 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -192,8 +192,41 @@ define Device/wndr3700v5
 endef
 TARGET_DEVICES += wndr3700v5
 
+define Build/wsr-factory-image
+   $(STAGING_DIR_HOST)/bin/trx \
+   -M $(2) \
+   -m $(IMAGE_SIZE) \
+   -f $(1) \
+   -o $(1).trx
+   $(STAGING_DIR_HOST)/bin/buffalo-enc \
+   -l -m 'start' \
+   -p $(3) -v '0.00' \
+   -i $(1).trx -o $(1).trx.enc
+   $(STAGING_DIR_HOST)/bin/buffalo-tag \
+   -a MTK \
+   -b $(3) -p $(3) \
+   -l JP -r JP -r JP \
+   -s \
+   -v '0.00' -m '0.00' \
+   -w 1 \
+   -I $(1).trx.enc -o $(1).tag
+   $(STAGING_DIR_HOST)/bin/buffalo-enc \
+   -l -m 'start' \
+   -p '' -v '' \
+   -i $(1).tag -o $(1).tag.enc
+   $(STAGING_DIR_HOST)/bin/mkdhpimg \
+   $(1).tag.enc $(1).trx.enc \
+   $(call imgname,initramfs,$(4))-factory.bin
+endef
+
+define Build/wsr-1166-factory-images
+   $(call Build/wsr-factory-image,$@,0x746f435c,WSR-1166DHP,wsr-1166dhp)
+   $(call Build/wsr-factory-image,$@,0x1fc384dd,WSR-1166DHP2,wsr-1166dhp2)
+endef
+
 define Device/wsr-1166
   DTS := WSR-1166
+  KERNEL_INITRAMFS := $$(KERNEL) | wsr-1166-factory-images
   IMAGE/sysupgrade.bin := trx | pad-rootfs | append-metadata
   IMAGE_SIZE := $(ralink_default_fw_size_16M)
   DEVICE_TITLE := Buffalo WSR-1166
diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index 456b7a3..8a0d13f 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -79,6 +79,7 @@ define Host/Compile
$(call cc,jcgimage, -lz -Wall)
$(call cc,mkbuffaloimg, -Wall)
$(call cc,zyimage, -Wall)
+   $(call cc,mkdhpimg buffalo-lib, -Wall)
 endef
 
 define Host/Install
diff --git a/tools/firmware-utils/src/buffalo-tag.c 
b/tools/firmware-utils/src/buffalo-tag.c
index b5db72e..63bc6d3 100644
--- a/tools/firmware-utils/src/buffalo-tag.c
+++ b/tools/firmware-utils/src/buffalo-tag.c
@@ -7,6 +7,7 @@
  *
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -48,6 +49,7 @@ static uint32_t base2;
 static char *region_code;
 static uint32_t region_mask;
 static int num_regions;
+static int dhp;
 
 void usage(int status)
 {
@@ -63,6 +65,7 @@ void usage(int status)
 "  -d \n"
 "  -fset flag to \n"
 "  -iread input from the file \n"
+"  -Iread input from the file  for DHP series\n"
 "  -lset language to \n"
 "  -m set minor version to \n"
 "  -owrite output to the file \n"
@@ -177,11 +180,17 @@ static void fixup_tag(unsigned char *buf, ssize_t buflen)
memcpy(tag->region_code, region_code, 2);
}
 
-   tag->len = htonl(buflen);
-   tag->data_len = htonl(fsize[0]);
-   tag->base1 = htonl(base1);
-   tag->base2 = htonl(base2);
-   tag->flag = flag;
+   if (dhp) {
+   tag->len = htonl(buflen + 200);
+   tag->base1 = htonl(buflen);
+   tag->base2 = htonl(0x0100);
+   } else {
+   tag->len = htonl(buflen);
+   tag->data_len = htonl(fsize[0]);
+   tag->base1 = htonl(base1);
+   tag->base2 = htonl(base2);
+   tag->flag = flag;
+   }
 
if (hwver) {
memcpy(tag->hwv, "hwv", 3);
@@ -270,7 +279,10 @@ static int tag_file(void)
offset += fsize[i];
}
 
-   if (num_files == 1)
+   

Re: [LEDE-DEV] [PATCH RFC v2 2/2] openvpn: update to 2.4_rc1

2016-12-10 Thread Magnus Kroken

On 10.12.2016 12.36, Felix Fietkau wrote:

If you have some time, please take a look at the other mbedtls/openvpn
changes that I made:
https://git.lede-project.org/?p=lede/nbd/staging.git;a=summary


Thanks, these changes look good to me. With your tweaks I did a new test 
regarding internal/external LZ4 support, and the difference is much 
smaller now. On mips, using OpenVPNs internal liblz4 adds ~5kB to the 
uncompressed binary and ~3kB to the .ipk, compared to using liblz4.so. 
(With my original patch series the uncompressed binary difference was 28kB.)



- Felix


/Magnus

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


Re: [LEDE-DEV] rt5350-spi rt2880-spi question

2016-12-10 Thread Giuseppe Lippolis
In the driver code is written the follow comment:

/*
 * spidev should never be referenced in DT without a specific
 * compatible string, it is a Linux implementation thing
 * rather than a description of the hardware.
 */

What shall I use in the .dts to bind a generic spi driver?


> -Ursprüngliche Nachricht-
> Von: Giuseppe Lippolis [mailto:giu.lippo...@gmail.com]
> Gesendet: Samstag, 10. Dezember 2016 23:21
> An: lede-dev@lists.infradead.org
> Betreff: rt5350-spi rt2880-spi question
> 
> I have an update.
> Using the following add to the DWR-512-B.dts
> 
>  {
> status = "okay";
> 
> spidev@1 {
> #address-cells = <1>;
> #size-cells = <1>;
> compatible = "spidev";
> reg = <0>;
> spi-max-frequency = <3000>;
> };
> };
> 
> I'm able to see the device:
> root@lede:/tmp# ls /dev/spi*
> /dev/spidev1.0
> 
> But in the bootlog I get:
> 
> [   56.306119] procd: - init -
> [   56.902341] ip6_tables: (C) 2000-2006 Netfilter Core Team
> [   56.944417] i2c /dev entries driver
> [   56.965816] Loading modules backported from Linux version
> wt-2016-10-03-1-g6fcb1a6
> [   56.981067] Backport generated by backports.git
> backports-20160324-9-g0e38f5c
> [   57.003743] ip_tables: (C) 2000-2006 Netfilter Core Team
> [   57.034967] nf_conntrack version 0.5.0 (447 buckets, 1788 max)
> [   57.084989] spidev spi1.0: buggy DT: spidev listed directly in DT
> [   57.097291] [ cut here ]
> [   57.106611] WARNING: CPU: 0 PID: 415 at drivers/spi/spidev.c:719
> init_module+0x333c/0x3dec [spidev]()
> [   57.125042] Modules linked in: spidev(+) slhc nf_reject_ipv4
> nf_nat_redirect nf_nat_masquerade_ipv4 nf_nat nf_log_ipv4
> nf_defrag_ipv6
> nf_defrag_ipv4 nf_conntrack_rtcache nf_conntrack iptable_raw
> iptable_mangle iptable_filter ip_tables crc_itu_t crc_ccitt compat
i2c_ralink
> i2c_dev i2c_core ip6t_REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common
> ip6table_raw ip6table_mangle ip6table_filter ip6_tables x_tables
> eeprom_93cx6 leds_gpio ehci_platform ehci_hcd gpio_button_hotplug
> usbcore nls_base usb_common
> [   57.213233] CPU: 0 PID: 415 Comm: kmodloader Not tainted 4.4.36 #0
> [   57.225597] Stack : 80325d94  0001 8036 819aaa80
> 80362d23
> 803076cc 019f
> [   57.225597]  803a3430 0007 001a 024000c0 80065a9c
8004a6c8
> 8030cbe4 8036
> [   57.225597]  0003 0007 8030afe8 81bf3b4c 80065a9c
80048634
>  
> [   57.225597]  0001    

>  
> [   57.225597]      

>  
> [   57.225597]  ...
> [   57.296770] Call Trace:
> [   57.301757] [<80065a9c>] module_sect_show+0x0/0x18
> [   57.311382] [<8004a6c8>] vprintk_default+0x24/0x30
> [   57.321003] [<80065a9c>] module_sect_show+0x0/0x18
> [   57.330619] [<80048634>] printk+0x2c/0x38
> [   57.338626] [<80024f44>] warn_slowpath_common+0xa0/0xd0
> [   57.349107] [<80148d38>] dump_stack+0x14/0x28
> [   57.357871] [<8001442c>] show_stack+0x50/0x84
> [   57.366623] [<80024f44>] warn_slowpath_common+0xa0/0xd0
> [   57.377117] [<80d8633c>] init_module+0x333c/0x3dec [spidev]
> [   57.388288] [<80d8>] 0x80d8
> [   57.395318] [<80024ffc>] warn_slowpath_null+0x18/0x24
> [   57.405459] [<801bebd0>] of_match_node+0x20/0x44
> [   57.414739] [<80d8>] 0x80d8
> [   57.421771] [<80d8633c>] init_module+0x333c/0x3dec [spidev]
> [   57.432971] [<801964a8>] devm_kfree+0x20/0x44
> [   57.441752] [<801ad3f4>] spi_drv_probe+0x3c/0x84
> [   57.451019] [<80192e7c>] driver_probe_device+0x120/0x288
> [   57.461695] [<80089984>] kstrdup+0x44/0x8c
> [   57.469923] [<801ad2f4>] spi_match_device+0x38/0xa8
> [   57.479733] [<80193060>] __driver_attach+0x7c/0xb4
> [   57.489291] [<80191284>] next_device+0x10/0x30
> [   57.498221] [<80192fe4>] __driver_attach+0x0/0xb4
> [   57.507665] [<80191340>] bus_for_each_dev+0x9c/0xac
> [   57.517469] [<802b3ca8>] klist_add_tail+0x24/0x50
> [   57.526910] [<80d8>] 0x80d8
> [   57.533925] [<80191114>] bus_get+0x2c/0x50
> [   57.542171] [<80192574>] bus_add_driver+0xec/0x20c
> [   57.551796] [<800ac068>] exact_match+0x0/0x8
> [   57.560352] [<800ac570>] exact_lock+0x0/0x24
> [   57.568869] [<80d8>] 0x80d8
> [   57.575875] [<80d8>] 0x80d8
> [   57.582898] [<80193778>] driver_register+0xa8/0xf8
> [   57.592523] [<80d83000>] init_module+0x0/0xdc [spidev]
> [   57.602838] [<80d8>] 0x80d8
> [   57.609852] [<80d8>] 0x80d8
> [   57.616809] [<80d8>] 0x80d8
> [   57.623828] [<80d83098>] init_module+0x98/0xdc [spidev]
> [   57.634314] [<80154908>] kasprintf+0x1c/0x28
> [   57.642923] [<80045050>] __wake_up+0x24/0x48
> [   57.651510] [<80d83000>] init_module+0x0/0xdc [spidev]
> [   57.661847] [<8000d5c8>] do_one_initcall+0x1e8/0x214
> [   

[LEDE-DEV] rt5350-spi rt2880-spi question

2016-12-10 Thread Giuseppe Lippolis
Dear All,
I'd like to enable all the function available to my DWR-512.
Currently on the board is mounted the SLIC device Si3210.
This device is controlled by the spi interface.
I checked that its spi interface is connected to the spi master of the
rt5350 on the cs1.

Running the following cmd in the uboot:
RT5350 # nm 1060

1b54: 00400080 ? 0080

RT5350 # md 1b00

1b00:    

1b10: 0152 0001  R...

1b20: 00f7   

1b30:    

1b40:    

1b50: 0152 0001  R...

1b60: 00ff   

1b70:    

1b80:    

1b90:    

1ba0:    

1bb0:    

1bc0:    

1bd0:    

1be0:    

1bf0: 8003   

RT5350 # nm 1b54

1b54: 0001 ? 3

1b54: 0001 ? 2 

I'm able to see the clock burst and the cs1 moving on the proper Si3210
pins.

Therefore I'd like to enable the second spi channel in my dts.
But here I found something strange.

Currently the included rt5350.dtsi have the following structure:
palmbus: palmbus@1000 {
compatible = "palmbus";
reg = <0x1000 0x20>;
ranges = <0x0 0x1000 0x1F>;

#address-cells = <1>;
#size-cells = <1>;

[ ... ]

spi0: spi@b00 {
compatible = "ralink,rt5350-spi",
"ralink,rt2880-spi";
reg = <0xb00 0x40>;

resets = < 18>;
reset-names = "spi";

#address-cells = <1>;
#size-cells = <0>;

pinctrl-names = "default";
pinctrl-0 = <_pins>;

status = "disabled";
};

spi1: spi@b40 {
compatible = "ralink,rt5350-spi",
"ralink,rt2880-spi";
reg = <0xb40 0x60>;

resets = < 18>;
reset-names = "spi";

#address-cells = <1>;
#size-cells = <0>;

pinctrl-names = "default";
pinctrl-0 = <_cs1>;

status = "disabled";
};

[ ... ]

};

and in my DWR-512-B.dts:

#include "rt5350.dtsi"

 {
status = "okay";

mx25l6405d@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <3000>;
m25p,fast-read;

partition@0 {
label = "u-boot";
reg = <0x0 0x3>;
read-only;
};

[ ... ]

config: partition@7f {
label = "config";
reg = <0x7f 0x1>;
};
};
};

>From what I understood sufing online, to enable the second chipselect
channel I need to add the following section into the  section of my
DWR-512-B.dts file.

spidev@1 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "spidev";
reg = <1>;
spi-max-frequency = <3000>;
};

Is this correct? Or shall I use the spi1 section of the rt5350.dtsi?
Is the spi1 section in the rt5350.dtsi correct?
(from the rt5350 datasheet, it is clear that the device have only one master
with two cs channel).

Thanks,
Bye.


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


[LEDE-DEV] [PATCH] Kernel: update kernel 4.4 to version 4.4.37

2016-12-10 Thread Stijn Segers
Bump to .37 for all platforms supported by 4.4. All patches refreshed.

Compile-tested on ar71xx, ramips/mt7621 and x86/64.

Run-tested on ar71xx and ramips/mt7621.

Signed-off-by: Stijn Segers 
---
 ...tend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/target/linux/cns3xxx/patches-4.4/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch
 
b/target/linux/cns3xxx/patches-4.4/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch
index 96f20a4..c58830a 100644
--- 
a/target/linux/cns3xxx/patches-4.4/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch
+++ 
b/target/linux/cns3xxx/patches-4.4/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch
@@ -1,6 +1,6 @@
 --- a/drivers/pci/probe.c
 +++ b/drivers/pci/probe.c
-@@ -1938,7 +1938,8 @@ static void pcie_write_mrrs(struct pci_d
+@@ -1964,7 +1964,8 @@ static void pcie_write_mrrs(struct pci_d
/* In the "safe" case, do not configure the MRRS.  There appear to be
 * issues with setting MRRS to 0 on a number of devices.
 */
-- 
2.10.2


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


Re: [LEDE-DEV] [PATCH] kernel: make fix extending dtb cmd with bootloader

2016-12-10 Thread Hauke Mehrtens
On 12/09/2016 08:08 AM, John Crispin wrote:
> 
> 
> On 09/12/2016 00:21, Hauke Mehrtens wrote:
>> This was introduced in kernel 4.4, but broken there and fixed in 4.5.
>> I would like to activate it, but I am scared about the boot loader
>> around giving us all sorts of command lines.
>>
>> Signed-off-by: Hauke Mehrtens 
> 
> we had previously used a syntax of prepending the cmdline with +/- to
> indicate whether this should replace/extend the bootloader cmdline. the
> biggest problem is that the bootloaders will pass console= and root= and
> thus breaking boot. merging/activating this as is will most likely lead
> to 50% of lantiq boards not booting anymore. imho this feature should be
> an opt-in based on the specific board
> 
>   John

Yes when you do not have control over the boot loader this is a big
problem, like I said in the commit comment.

We had this "bootargs-append" option in our kernel for a long time, but
this never got upstream. Are there any more upstream ways to extend the
boot loader command line in a device tree file, but not replacing it
completely?

I was thinking about adding a Kconfig option to append the device tree
version to the boot loader version, but I would prefer to do this in the
device tree for each board and not globally.

Currently I would remove the dtb bootargs line for every board were we
need the boot loader command line. Sometimes the Mac address is given by
the boot loader in the boot args.

Internally at Intel we are booting some SoC with a root file system
mounted from a NFS server that makes it pretty easy to modify files
without reboot. For this use case we provide the settings for the NFS
server in the boot command line. This works with just not defining any
bootargs line in the device tree at all.

Hauke

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


Re: [LEDE-DEV] [PATCH v2] ramips: build factory images for Buffalo WSR-1166DHP/WSR-1166DHP2

2016-12-10 Thread John Crispin
it is still in my staging tree. i will drop it and await your V3

John

On 10/12/2016 14:34, Naoki FUKAUMI wrote:
> hi
> 
> I noticed buffalo-tag fix and mkwsrimg can be used for some other
> Buffalo WxR products too.
> (probably. I just checked some of official update images for now)
> 
> if this patch is not merged yet, I want to make v3 patch ASAP to do
> some more cosmetic changes (e.g. s/WSR/WxR/).
> 
> if it's too late, I'll make new patch later.
> 
> Regards,
> 
> On Thu, Dec 8, 2016 at 12:01 AM, FUKAUMI Naoki  wrote:
>> factory image has to have custom trx magic, and trx file will be written
>> in the middle of the mtd3 partition (bootpartition=1 on u-boot).
>> therefore, sysupgrade.bin cannot be installed directly from stock Web UI.
>>
>> with this patch, factory.bin will be built with initramfs image which
>> can be installed from stock Web UI, and can be used to install
>> sysupgrade.bin.
>>
>> install procedure:
>>  1. install initramfs image (factory.bin) from stock Web UI
>>  2. ssh root@192.168.1.1
>>  3. run "mtd erase firmware" (erase factory.bin in mtd3)
>>  4. install sysupgrade.bin by sysupgrade
>>
>> Signed-off-by: FUKAUMI Naoki 
>> ---
>> Changes in v2:
>> - cosmetic cleanup in mt7621.mk
>>
>>  target/linux/ramips/image/mt7621.mk| 33 
>>  tools/firmware-utils/Makefile  |  1 +
>>  tools/firmware-utils/src/buffalo-tag.c | 29 ---
>>  tools/firmware-utils/src/mkwsrimg.c| 94 
>> ++
>>  tools/firmware-utils/src/trx.c | 13 -
>>  5 files changed, 161 insertions(+), 9 deletions(-)
>>  create mode 100644 tools/firmware-utils/src/mkwsrimg.c
>>
>> diff --git a/target/linux/ramips/image/mt7621.mk 
>> b/target/linux/ramips/image/mt7621.mk
>> index 6d85511..d44b70b 100644
>> --- a/target/linux/ramips/image/mt7621.mk
>> +++ b/target/linux/ramips/image/mt7621.mk
>> @@ -192,8 +192,41 @@ define Device/wndr3700v5
>>  endef
>>  TARGET_DEVICES += wndr3700v5
>>
>> +define Build/wsr-factory-image
>> +   $(STAGING_DIR_HOST)/bin/trx \
>> +   -M $(2) \
>> +   -m $(IMAGE_SIZE) \
>> +   -f $(1) \
>> +   -o $(1).trx
>> +   $(STAGING_DIR_HOST)/bin/buffalo-enc \
>> +   -l -m 'start' \
>> +   -p $(3) -v '0.00' \
>> +   -i $(1).trx -o $(1).trx.enc
>> +   $(STAGING_DIR_HOST)/bin/buffalo-tag \
>> +   -a MTK \
>> +   -b $(3) -p $(3) \
>> +   -l JP -r JP -r JP \
>> +   -s \
>> +   -v '0.00' -m '0.00' \
>> +   -w 1 \
>> +   -W $(1).trx.enc -o $(1).tag
>> +   $(STAGING_DIR_HOST)/bin/buffalo-enc \
>> +   -l -m 'start' \
>> +   -p '' -v '' \
>> +   -i $(1).tag -o $(1).tag.enc
>> +   $(STAGING_DIR_HOST)/bin/mkwsrimg \
>> +   $(1).tag.enc $(1).trx.enc \
>> +   $(call imgname,initramfs,$(4))-factory.bin
>> +endef
>> +
>> +define Build/wsr-1166-factory-images
>> +   $(call Build/wsr-factory-image,$@,0x746f435c,WSR-1166DHP,wsr-1166dhp)
>> +   $(call 
>> Build/wsr-factory-image,$@,0x1fc384dd,WSR-1166DHP2,wsr-1166dhp2)
>> +endef
>> +
>>  define Device/wsr-1166
>>DTS := WSR-1166
>> +  KERNEL_INITRAMFS := $$(KERNEL) | wsr-1166-factory-images
>>IMAGE/sysupgrade.bin := trx | pad-rootfs | append-metadata
>>IMAGE_SIZE := $(ralink_default_fw_size_16M)
>>DEVICE_TITLE := Buffalo WSR-1166
>> diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
>> index 456b7a3..e7654ec 100644
>> --- a/tools/firmware-utils/Makefile
>> +++ b/tools/firmware-utils/Makefile
>> @@ -79,6 +79,7 @@ define Host/Compile
>> $(call cc,jcgimage, -lz -Wall)
>> $(call cc,mkbuffaloimg, -Wall)
>> $(call cc,zyimage, -Wall)
>> +   $(call cc,mkwsrimg buffalo-lib, -Wall)
>>  endef
>>
>>  define Host/Install
>> diff --git a/tools/firmware-utils/src/buffalo-tag.c 
>> b/tools/firmware-utils/src/buffalo-tag.c
>> index b5db72e..f255bb9 100644
>> --- a/tools/firmware-utils/src/buffalo-tag.c
>> +++ b/tools/firmware-utils/src/buffalo-tag.c
>> @@ -7,6 +7,7 @@
>>   *
>>   */
>>
>> +#include 
>>  #include 
>>  #include 
>>  #include 
>> @@ -48,6 +49,7 @@ static uint32_t base2;
>>  static char *region_code;
>>  static uint32_t region_mask;
>>  static int num_regions;
>> +static int wsr;
>>
>>  void usage(int status)
>>  {
>> @@ -63,6 +65,7 @@ void usage(int status)
>>  "  -d \n"
>>  "  -fset flag to \n"
>>  "  -iread input from the file \n"
>> +"  -Wread input from the file  for Buffalo WSR\n"
>>  "  -lset language to \n"
>>  "  -m set minor version to \n"
>>  "  -owrite output to the file \n"
>> @@ -177,11 +180,17 @@ static void fixup_tag(unsigned char *buf, ssize_t 
>> buflen)
>> memcpy(tag->region_code, region_code, 2);
>> }
>>
>> -   tag->len = htonl(buflen);
>> -   tag->data_len 

Re: [LEDE-DEV] [PATCH RFC v2 2/2] openvpn: update to 2.4_rc1

2016-12-10 Thread Felix Fietkau
On 2016-12-10 12:11, Magnus Kroken wrote:
> OpenVPN 2.4 builds with mbedTLS 2.x, rename openvpn-polarssl
> variant to openvpn-mbedtls.
> 
> Some feature highlights:
> * Data channel cipher negotiation
> * AEAD cipher support for data channel encryption (currently only AES-GCM)
> * ECDH key exchange for control channel
> * LZ4 compression support
> 
> See https://github.com/OpenVPN/openvpn/blob/master/Changes.rst
> for additional change notes.
> 
> Signed-off-by: Magnus Kroken 
I've pushed this to my staging tree, including some further tuning of
the mbedtls config and some follow-up fixes. This works fine in my test
in client mode against an older OpenVPN 2.3 server.
I will let this sit in my staging tree for a while, and maybe push it to
master around the time of the 2.4 final release.

If you have some time, please take a look at the other mbedtls/openvpn
changes that I made:
https://git.lede-project.org/?p=lede/nbd/staging.git;a=summary

Thanks,

- Felix

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


[LEDE-DEV] [PATCH RFC v2 2/2] openvpn: update to 2.4_rc1

2016-12-10 Thread Magnus Kroken
OpenVPN 2.4 builds with mbedTLS 2.x, rename openvpn-polarssl
variant to openvpn-mbedtls.

Some feature highlights:
* Data channel cipher negotiation
* AEAD cipher support for data channel encryption (currently only AES-GCM)
* ECDH key exchange for control channel
* LZ4 compression support

See https://github.com/OpenVPN/openvpn/blob/master/Changes.rst
for additional change notes.

Signed-off-by: Magnus Kroken 
---
v2: Rename 100-polarssl-disable-runtime-version-check.patch,
fix indentation in 101-fix_mbedtls_net_sockets_include.patch.

 package/network/services/openvpn/Config-mbedtls.in | 70 ++
 package/network/services/openvpn/Config-nossl.in   |  4 ++
 package/network/services/openvpn/Config-openssl.in |  4 ++
 .../network/services/openvpn/Config-polarssl.in| 66 
 package/network/services/openvpn/Makefile  | 17 +++---
 .../network/services/openvpn/files/openvpn.config  | 11 +++-
 .../patches/001-reproducible-remove_DATE.patch |  6 +-
 ...100-mbedtls-disable-runtime-version-check.patch | 11 
 ...00-polarssl-disable-runtime-version-check.patch | 11 
 ...101-backport_upstream_polarssl_debug_call.patch | 33 --
 .../101-fix_mbedtls_net_sockets_include.patch  | 39 
 .../patches/200-small_build_enable_occ.patch   |  2 +-
 .../210-build_always_use_internal_lz4.patch| 41 +
 13 files changed, 191 insertions(+), 124 deletions(-)
 create mode 100644 package/network/services/openvpn/Config-mbedtls.in
 delete mode 100644 package/network/services/openvpn/Config-polarssl.in
 create mode 100644 
package/network/services/openvpn/patches/100-mbedtls-disable-runtime-version-check.patch
 delete mode 100644 
package/network/services/openvpn/patches/100-polarssl-disable-runtime-version-check.patch
 delete mode 100644 
package/network/services/openvpn/patches/101-backport_upstream_polarssl_debug_call.patch
 create mode 100644 
package/network/services/openvpn/patches/101-fix_mbedtls_net_sockets_include.patch
 create mode 100644 
package/network/services/openvpn/patches/210-build_always_use_internal_lz4.patch

diff --git a/package/network/services/openvpn/Config-mbedtls.in 
b/package/network/services/openvpn/Config-mbedtls.in
new file mode 100644
index 000..c1c8c7a
--- /dev/null
+++ b/package/network/services/openvpn/Config-mbedtls.in
@@ -0,0 +1,70 @@
+if PACKAGE_openvpn-mbedtls
+
+config OPENVPN_mbedtls_ENABLE_LZO
+   bool "Enable LZO compression support"
+   default y
+
+config OPENVPN_mbedtls_ENABLE_LZ4
+   bool "Enable LZ4 compression support"
+   default y
+
+config OPENVPN_mbedtls_ENABLE_X509_ALT_USERNAME
+   bool "Enable the --x509-username-field feature"
+   default n
+
+config OPENVPN_mbedtls_ENABLE_SERVER
+   bool "Enable server support (otherwise only client mode is support)"
+   default y
+
+#config OPENVPN_mbedtls_ENABLE_EUREPHIA
+#  bool "Enable support for the eurephia plug-in"
+#  default n
+
+config OPENVPN_mbedtls_ENABLE_MANAGEMENT
+   bool "Enable management server support"
+   default n
+
+#config OPENVPN_mbedtls_ENABLE_PKCS11
+#  bool "Enable pkcs11 support"
+#  default n
+
+config OPENVPN_mbedtls_ENABLE_HTTP
+   bool "Enable HTTP proxy support"
+   default y
+
+config OPENVPN_mbedtls_ENABLE_SOCKS
+   bool "Enable SOCKS proxy support"
+   default y
+
+config OPENVPN_mbedtls_ENABLE_FRAGMENT
+   bool "Enable internal fragmentation support (--fragment)"
+   default y
+
+config OPENVPN_mbedtls_ENABLE_MULTIHOME
+   bool "Enable multi-homed UDP server support (--multihome)"
+   default y
+
+config OPENVPN_mbedtls_ENABLE_PORT_SHARE
+   bool "Enable TCP server port-share support (--port-share)"
+   default y
+
+config OPENVPN_mbedtls_ENABLE_DEF_AUTH
+   bool "Enable deferred authentication"
+   default y
+
+config OPENVPN_mbedtls_ENABLE_PF
+   bool "Enable internal packet filter"
+   default y
+
+config OPENVPN_mbedtls_ENABLE_IPROUTE2
+   bool "Enable support for iproute2"
+   default n
+
+config OPENVPN_mbedtls_ENABLE_SMALL
+   bool "Enable size optimization"
+   default y
+   help
+ enable smaller executable size (disable OCC, usage
+ message, and verb 4 parm list)
+
+endif
diff --git a/package/network/services/openvpn/Config-nossl.in 
b/package/network/services/openvpn/Config-nossl.in
index 3eaa228..199cda0 100644
--- a/package/network/services/openvpn/Config-nossl.in
+++ b/package/network/services/openvpn/Config-nossl.in
@@ -4,6 +4,10 @@ config OPENVPN_nossl_ENABLE_LZO
bool "Enable LZO compression support"
default y
 
+config OPENVPN_nossl_ENABLE_LZ4
+   bool "Enable LZ4 compression support"
+   default y
+
 config OPENVPN_nossl_ENABLE_SERVER
bool "Enable server support (otherwise only client mode is support)"
default y
diff --git a/package/network/services/openvpn/Config-openssl.in 

[LEDE-DEV] [PATCH RFC v2 1/2] openvpn: quote parameters to --push in openvpn config file

2016-12-10 Thread Magnus Kroken
OpenVPN requires arguments to --push to be enclosed in double quotes.
One set of quotes is stripped when the UCI config is parsed.
Change append_params() of openvpn.init to enclose push parameters in
double quotes.

Unquoted push parameters do not cause errors in OpenVPN 2.3,
but OpenVPN 2.4 fails to start with unquoted push parameters.

Fixes: FS#290.

Signed-off-by: Magnus Kroken 
---
v2: Fix by changing openvpn.init rather than requiring users
to edit their openvpn config.

 package/network/services/openvpn/files/openvpn.init | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/network/services/openvpn/files/openvpn.init 
b/package/network/services/openvpn/files/openvpn.init
index 4c8f77f..0fcdc7e 100644
--- a/package/network/services/openvpn/files/openvpn.init
+++ b/package/network/services/openvpn/files/openvpn.init
@@ -42,7 +42,8 @@ append_params() {
config_get v "$s" "$p"
IFS="$LIST_SEP"
for v in $v; do
-   [ -n "$v" ] && append_param "$s" "$p" && echo " $v" >> 
"/var/etc/openvpn-$s.conf"
+   [ -n "$v" ] && [ "$p" != "push" ] && append_param "$s" 
"$p" && echo " $v" >> "/var/etc/openvpn-$s.conf"
+   [ -n "$v" ] && [ "$p" == "push" ] && append_param "$s" 
"$p" && echo " \"$v\"" >> "/var/etc/openvpn-$s.conf"
done
unset IFS
done
-- 
2.1.4


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


Re: [LEDE-DEV] [PATCH RFC 2/3] openvpn: use proper quoting of push option in openvpn.config

2016-12-10 Thread Felix Fietkau
On 2016-12-09 21:07, Magnus Kroken wrote:
> OpenVPN requires arguments to --push to be enclosed in double quotes.
> A single set of quotes is stripped when the UCI config is parsed.
> Enclosing in double and single quotes results in a proper configuration.
> 
> This does not cause errors in OpenVPN 2.3, but OpenVPN 2.4 fails to start
> with unquoted push arguments.
> 
> This fixes FS#290 by way of documentation, but existing configurations
> will need editing to work with OpenVPN 2.4.
> 
> Signed-off-by: Magnus Kroken 
I think pushing the double quotes inside the configuration is the wrong
place. This should be fixed in the init script instead.

- Felix


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