Re: [LEDE-DEV] image: when using the new image build code, gzip ext4 images by default

2017-01-13 Thread Christian Lamparter via Lede-dev
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---
This is a comment on the patch:
>commit 87b668765e1e987aebef8cf0aae657569b631477
>Author: Felix Fietkau 
>Date:   Fri Jan 13 15:58:37 2017 +0100
>
>   image: when using the new image build code, gzip ext4 images by default
>
>   This reduces the amount of hacks in the makefile code.
>
>   Remove the apm821xx code to do the same - it was broken and left both
>   compressed and uncompressed images in $(BIN_DIR)

Let me explain that apm821xx code.

The uncompressed image was left in place because it allowed "easy install
method" by just using dd with the image on the original WD firmware. 
I refered to this method in the commit [0]:

>The extracted/raw image can be directly installed on
>the internal HDD via "dd if=img.ext4 of=/dev/sdX".
>
>This can either be done in place with the stock MyBook Live
>firmware via ssh. Or by removing the HDD and writing the image
>with a different PC.
>
>The the compressed images are useful for sysupgrade.

so there was some reason behind the uncompressed and compressed image.

Of course, back then the generated ext4 images where like 50-60 MiB.
So I'm fine with the change. But I would like to document the change
somewhere. Editing my wiki [1] is easy enough, but I would like to
move the article to LEDE's wiki. 

So how do I do that? 

[Actually, I want to know: If it is possible to add new articles to 
the wiki for supported devices in LEDE (not OpenWRT sadly) now - and
what format these articles should have.
As far as I can tell the current ToH just links to wiki.openwrt.org.
So I'm looking for a sample/template that just needs to be customized
for the different apm821xx targets.]

Regards,
Christian

[0] 

[1] 

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


[LEDE-DEV] [PATCH v3] procd: update procd.sh to disallow signal-numbers, enforce signal-names

2017-01-13 Thread Bastian Bittorf
A given signal-name is now converted to the corresonding number. In general
it's good style to use names (readability) and it's more portable: signal
numbers can be architecture-dependent, so we are more safe giving names.

A real world example is signal 10, which is BUS on ramips and USR1 on PPC.

All users of 'procd_send_signal' must change their code to reflect this.

Signed-off-by: Bastian Bittorf 
---

Changelog:
v2: give example in decription and safe 1 line of code
v3: simplify code (do not parse kill-output, but give an argument to kill)
enforce using of names instead of numbers
thanks for suggestions to 'Etienne Champetier' and 'Jo-Philipp Wich'


 package/system/procd/files/procd.sh | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/package/system/procd/files/procd.sh 
b/package/system/procd/files/procd.sh
index 8f18cda..a1b9f2f 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -213,9 +213,12 @@ _procd_set_param() {
json_add_string "" "$@"
json_close_array
;;
-   nice|reload_signal)
+   nice)
json_add_int "$type" "$1"
;;
+   reload_signal)
+   json_add_int "$type" $(kill -l "$1")
+   ;;
pidfile|user|seccomp|capabilities)
json_add_string "$type" "$1"
;;
-- 
1.9.1


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


Re: [LEDE-DEV] [PATCH v2] procd: update procd.sh to support both: signal-names and signal-numbers

2017-01-13 Thread Etienne Champetier
2017-01-13 10:12 GMT-08:00 Bastian Bittorf :
> * Etienne Champetier  [13.01.2017 19:07]:
>> > A real world example is signal 10, which is BUS on ramips and USR1 on PPC.
>>
>> If we know supporting signal number will lead to bug, why not remove it?
>
> for the moment we should be backward compatible.
> after everybody has changed the calls, we should
> indeed remove signal numbers...
>
> command 'git grep procd_send_signal' shows, that
> only 'odhcpd' is a user, but how many external packages?

It's a month old, so i don't think there is a lot of "external" user if any,
and if there is, pretty sure the maintainer is following this ML

If you really don't want to break backward compatibility now, maybe
add a warning?

>
> bye, bastian

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


Re: [LEDE-DEV] [PATCH v2] procd: update procd.sh to support both: signal-names and signal-numbers

2017-01-13 Thread Jo-Philipp Wich
Hi Bastian,

you do not need to iterate the entire list, passing the signal name directly is 
way simpler:

case "$val" in
  [0-9]|[0-9][0-9]) : ;;
  *) val=$(kill -l "$value") || return ;;
esac

~ Jo



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


Re: [LEDE-DEV] [PATCH v2] procd: update procd.sh to support both: signal-names and signal-numbers

2017-01-13 Thread Etienne Champetier
Hi Bastian,


2017-01-13 9:28 GMT-08:00 Bastian Bittorf :
> It is automatically detected if the input is an integer. If not,
> the name is converted to the corresonding number. In general it's
> good style to use names (readability) and it's more portable: signal
> numbers can be architecture-dependent, so we are more safe giving names.
>
> A real world example is signal 10, which is BUS on ramips and USR1 on PPC.

If we know supporting signal number will lead to bug, why not remove it?

My 2 cents
Etienne


>
> Signed-off-by: Bastian Bittorf 
> ---
>
> Changelog:
> v2: give example in decription and safe 1 line of code
>
>  package/system/procd/files/procd.sh | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/package/system/procd/files/procd.sh 
> b/package/system/procd/files/procd.sh
> index 8f18cda..0a441b1 100644
> --- a/package/system/procd/files/procd.sh
> +++ b/package/system/procd/files/procd.sh
> @@ -200,6 +200,7 @@ _procd_add_jail_mount_rw() {
>
>  _procd_set_param() {
> local type="$1"; shift
> +   local obj old_obj signal
>
> case "$type" in
> env|data|limits)
> @@ -213,9 +214,17 @@ _procd_set_param() {
> json_add_string "" "$@"
> json_close_array
> ;;
> -   nice|reload_signal)
> +   nice)
> json_add_int "$type" "$1"
> ;;
> +   reload_signal)
> +   signal="$1"
> +   test "$signal" -eq "$signal" 2>/dev/null || {
> +   for obj in $( kill -l ) NOT_FOUND; do test 
> "$signal" = "$obj" && break; old_obj="$obj"; done
> +   signal="${old_obj%)}"
> +   }
> +   json_add_int "$type" "$signal"
> +   ;;
> pidfile|user|seccomp|capabilities)
> json_add_string "$type" "$1"
> ;;
> --
> 1.9.1
>
>
> ___
> Lede-dev mailing list
> Lede-dev@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev

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


[LEDE-DEV] [PATCH v2] procd: update procd.sh to support both: signal-names and signal-numbers

2017-01-13 Thread Bastian Bittorf
It is automatically detected if the input is an integer. If not,
the name is converted to the corresonding number. In general it's
good style to use names (readability) and it's more portable: signal
numbers can be architecture-dependent, so we are more safe giving names.

A real world example is signal 10, which is BUS on ramips and USR1 on PPC.

Signed-off-by: Bastian Bittorf 
---

Changelog:
v2: give example in decription and safe 1 line of code

 package/system/procd/files/procd.sh | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/package/system/procd/files/procd.sh 
b/package/system/procd/files/procd.sh
index 8f18cda..0a441b1 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -200,6 +200,7 @@ _procd_add_jail_mount_rw() {
 
 _procd_set_param() {
local type="$1"; shift
+   local obj old_obj signal
 
case "$type" in
env|data|limits)
@@ -213,9 +214,17 @@ _procd_set_param() {
json_add_string "" "$@"
json_close_array
;;
-   nice|reload_signal)
+   nice)
json_add_int "$type" "$1"
;;
+   reload_signal)
+   signal="$1"
+   test "$signal" -eq "$signal" 2>/dev/null || {
+   for obj in $( kill -l ) NOT_FOUND; do test 
"$signal" = "$obj" && break; old_obj="$obj"; done
+   signal="${old_obj%)}"
+   }
+   json_add_int "$type" "$signal"
+   ;;
pidfile|user|seccomp|capabilities)
json_add_string "$type" "$1"
;;
-- 
1.9.1


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


[LEDE-DEV] [PATCH v2 ubox 0/6] kmodloader: add module alias support

2017-01-13 Thread Yousong Zhou
Aliases are essential information for working with kernel modules.  Netfilter
subsystem will request for ipt_hashlimit and ip6t_hashlimit respectively when
called with

xt_request_find_match(NFPROTO_IPV{4,6}, "hashlimit", 1)

The kernel __request_module() will then invoke user mode modprobe to load them

/sbin/modprobe -q -- ipt_hashlimit
/sbin/modprobe -q -- ip6t_hashlimit

where ipt_hashlimit and ip6t_hashlimit are aliases of xt_hashlimit

The patch depends on another patch in the build system to restore alias info
to kernel modules.

v2 <- v1

 - Fixed a missing pair of curly parenthesis after avl_for_each_element, and
   this time the code was checked okay with -Wmisleading-indentation
 - Dropped the now redundant argc < 2 check in load_modprobe()

Yousong Zhou (6):
  kmodloader: remove redundant glob wildcard char
  kmodloader: log to kmsg when loading directories of modules
  kmodloader: modprobe: skip possible command line arguments
  kmodloader: fix out-of-bound access when parsing .modinfo
  kmodloader: add module alias awareness
  kmodloader: make insert_module() idempotent

 kmodloader.c | 184 +--
 1 file changed, 153 insertions(+), 31 deletions(-)

-- 
2.6.4


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


[LEDE-DEV] [PATCH v2 ubox 1/6] kmodloader: remove redundant glob wildcard char

2017-01-13 Thread Yousong Zhou
Signed-off-by: Yousong Zhou 
---
 kmodloader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kmodloader.c b/kmodloader.c
index f80835a..9fe7d7f 100644
--- a/kmodloader.c
+++ b/kmodloader.c
@@ -762,7 +762,7 @@ static int main_modprobe(int argc, char **argv)
 static int main_loader(int argc, char **argv)
 {
int gl_flags = GLOB_NOESCAPE | GLOB_MARK;
-   char *dir = "/etc/modules.d/*";
+   char *dir = "/etc/modules.d/";
struct module *m;
glob_t gl;
char *path;
-- 
2.6.4


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


Re: [LEDE-DEV] [Babel-users] Babeld now has procd support on OpenWRT/LEDE

2017-01-13 Thread Dave Taht
On Fri, Jan 13, 2017 at 8:11 AM, L. D. Pinney  wrote:
> Go back to playing the guitar and smoking dopethat's what you do best.

I look forward very much to doing more of that... after lede ships.

In the interim, I have two fairly large testbeds setup to test lede -
the ATF patch, the dnsmasq-dnssec code, the bcp38 code, the dhcpv6-pd
code, the new bridging code, and babel integration are all high on my
list, along with sch_cake and the sqm-scripts. I have 5 lede platforms
under test - the archer c7v2, wndr3800, linksys 1200ac, uap-lite, and
picostation, with two more that I plan to add after testing interop
(edgerouter and an apu2). There are also 3 different brands of
cablemodem in the loop. Test clients include a dozen hackerboards
(kernels going back to 3.10), OSX, and Linux.

I'm perpetually testing edge cases and things that seem like they
should work, but don't. While things are vague and confusing (like,
babel-1.8's behavior being confusing in some instances) - and a piece
of a puzzle lands (like not restarting it as much, thus causing less
route retractions and floods) - I do tend to dump partial state about
the rathole I may have been going down.

I've been trying to come up with tests for understanding the true
effects of the multicast-unicast bridging code, for wifi primarily,
and simplifying. At the moment I'm more trying to test 3 layers of
lede dhcp-pd (bridged and routed scenarios) across gear that needs to
interop...

... instead of dealing with how all that feeds into babel source
specific routing - which is a combination of interactions between
netifd, babeld, and multicast/bridging.

>
> STOP CROSS POSTING YOU FSCKin' Clown Boy

If these projects want to write "no cross posting ever" into the
rules, I will gladly comply.

I hope you get your caps-lock key fixed.

I'm going to just filter out all further postings from you into my trash folder.


>
> On Saturday, January 14, 2017 12:06 AM, Dave Taht 
> wrote:
>
>
> On Fri, Jan 13, 2017 at 4:08 AM, L. D. Pinney  wrote:
>> DAVE :
>>
>> WILL YOU PLEASE STOP YOUR FSCKin' CROSS POSTING ???
>
> I did not start the cross-post in this case.
>
>> This is UNRELATED to the OpenWrt / LEDE DEV mailing list...as the change
>> has
>> been merged.
>
> Interop with routing protocols... and networking in general... does
> exist outside of the openwrt universe. In my case I am deeply
> concerned about what happens against older, deployed versions of
> Linuxes (and other OSes) with the new multicast-unicast bridge
> conversion code in lede. Babel tends to use it, and I am also testing
> (in lede!), as per the below, the dhcpv6-pd code, interop-ing with
> several devices.
>
>> F O
>
> I'm really sorry that you hate cross posting so much. It must be
> terrible to have to elide additional responses or deal with bounce
> messages on every 20th email from me. And it must be wonderful to be
> living in a world where all you have is openwrt/lede devices on the
> network and modern kernels everywhere.
>
>>
>> On Friday, January 13, 2017 5:20 AM, Dave Taht 
>> wrote:
>>
>>
>> On Thu, Jan 12, 2017 at 1:01 PM, Baptiste Jonglez
>>  wrote:
>>> Hi,
>>>
>>> Here is yet another OpenWRT-related change for babeld: I just merged
>>> procd
>>> support for babeld [2], after more than two years of lingering [1].
>>>
>>> The only user-visible changes should be:
>>>
>>> - babeld now logs to the system log (visible with "logread") instead of a
>>>  file in /var/log.  This is nice for embedded devices, where you don't
>>>  want to write too much to the filesystem.  It is still possible to
>>>  explicitly configure babeld to use a log file;
>>>
>>> - babeld is now restarted automatically whenever it crashes;
>>>
>>> - the usual procd niceties: calling "/etc/init.d/babeld reload" will
>>>  restart babeld only if the configuration has changed.
>>>
>>>
>>> Please test babeld 1.8.0-2 and report any resulting breakage.  I would
>>> like this change (and the other compatibility change) to make it into the
>>> upcoming LEDE release, which is due to happen quite soon.
>>
>> Groovy.
>>
>> lede can dynamically insert/delete routes into tables from netifd
>> babeld can pull routes from "protos" but not tables.
>>
>> I spoke with hedecker (? can't remember his email) about somehow
>> having a field to export routes into kernel protos in the lede network
>> file, he indicated he'd look at it in a few weeks.
>>
>> (I wanted to get away from ever having to revise the conf file
>> dynamically, but it looks like not this release. Not having to restart
>> babeld as per the above is a nice improvement though and I'll get on
>> testing it this weekend. At the moment I'm going through some mild
>> hell with dhcpv6-pd on comcast and adding "sonic" fiber (with a HE
>> ipv6 tunnel. Will hopefully have 4 source specific gateways to play
>> with here)
>>
>> In other other news the "rabeld" 

[LEDE-DEV] [PATCH v2 ubox 5/6] kmodloader: add module alias awareness

2017-01-13 Thread Yousong Zhou
To achieve this, the following changes are made

 - scan module folders before scaning loaded modules
 - struct module was splited into struct module_node for the avl tree
   and struct module for storing actual info about modules

The other minor fix is that module.opts is now freed in free_modules()
when appliable

Signed-off-by: Yousong Zhou 
---
 kmodloader.c | 152 ++-
 1 file changed, 129 insertions(+), 23 deletions(-)

diff --git a/kmodloader.c b/kmodloader.c
index c780379..bcb213b 100644
--- a/kmodloader.c
+++ b/kmodloader.c
@@ -45,22 +45,31 @@ enum {
 };
 
 struct module {
-   struct avl_node avl;
-
char *name;
char *depends;
char *opts;
+   char **aliases;
+   int naliases;
 
int size;
int usage;
int state;
int error;
+   int refcnt; /* number of references from 
module_node.m */
+};
+
+struct module_node {
+   struct avl_node avl;
+   struct module *m;
+   bool is_alias;
 };
 
 static struct avl_tree modules;
 
 static char **module_folders = NULL;
 
+static void free_module(struct module *m);
+
 static int init_module_folders(void)
 {
int n = 0;
@@ -106,16 +115,26 @@ static int init_module_folders(void)
 
 static struct module *find_module(const char *name)
 {
-   struct module *m;
-   return avl_find_element(, name, m, avl);
+   struct module_node *mn;
+   mn = avl_find_element(, name, mn, avl);
+   if (mn)
+   return mn->m;
+   else
+   return NULL;
 }
 
 static void free_modules(void)
 {
-   struct module *m, *tmp;
+   struct module_node *mn, *tmp;
+
+   avl_remove_all_elements(, mn, avl, tmp) {
+   struct module *m = mn->m;
 
-   avl_remove_all_elements(, m, avl, tmp)
-   free(m);
+   m->refcnt -= 1;
+   if (m->refcnt == 0)
+   free_module(m);
+   free(mn);
+   }
 }
 
 static char* get_module_path(char *name)
@@ -208,19 +227,43 @@ static int elf_find_section(char *map, const char 
*section, unsigned int *offset
return -1;
 }
 
+static struct module_node *
+alloc_module_node(const char *name, struct module *m, bool is_alias)
+{
+   struct module_node *mn;
+   char *_name;
+
+   mn = calloc_a(sizeof(*mn),
+   &_name, strlen(name) + 1);
+   if (mn) {
+   mn->avl.key = strcpy(_name, name);
+   mn->m = m;
+   mn->is_alias = is_alias;
+   avl_insert(, >avl);
+   m->refcnt += 1;
+   }
+   return mn;
+}
+
 static struct module *
-alloc_module(const char *name, const char *depends, int size)
+alloc_module(const char *name, const char * const *aliases, int naliases, 
const char *depends, int size)
 {
struct module *m;
char *_name, *_dep;
+   char **_aliases;
+   int i, len_aliases;
 
+   len_aliases = naliases * sizeof(aliases[0]);
+   for (i = 0; i < naliases; i++)
+   len_aliases += strlen(aliases[i]) + 1;
m = calloc_a(sizeof(*m),
&_name, strlen(name) + 1,
-   &_dep, depends ? strlen(depends) + 2 : 0);
+   &_dep, depends ? strlen(depends) + 2 : 0,
+   &_aliases, len_aliases);
if (!m)
return NULL;
 
-   m->avl.key = m->name = strcpy(_name, name);
+   m->name = strcpy(_name, name);
m->opts = 0;
 
if (depends) {
@@ -231,13 +274,40 @@ alloc_module(const char *name, const char *depends, int 
size)
_dep++;
}
}
-
m->size = size;
-   avl_insert(, >avl);
+   m->naliases = naliases;
+   if (naliases == 0)
+   m->aliases = NULL;
+   else {
+   char *ptr = (char *)_aliases + naliases * sizeof(_aliases[0]);
+   int len;
+
+   i = 0;
+   do {
+   len = strlen(aliases[i]) + 1;
+   memcpy(ptr, aliases[i], len);
+   _aliases[i] = ptr;
+   ptr += len;
+   i++;
+   } while (i < naliases);
+   m->aliases = _aliases;
+   }
+
+   m->refcnt = 0;
+   alloc_module_node(m->name, m, false);
+   for (i = 0; i < m->naliases; i++)
+   alloc_module_node(m->aliases[i], m, true);
 
return m;
 }
 
+static void free_module(struct module *m)
+{
+   if (m->opts)
+   free(m->opts);
+   free(m);
+}
+
 static int scan_loaded_modules(void)
 {
size_t buf_len = 0;
@@ -262,7 +332,11 @@ static int scan_loaded_modules(void)
if (!m.name || !m.depends)
continue;
 
-   n = alloc_module(m.name, m.depends, m.size);
+   n = find_module(m.name);
+   if (!n) {
+   

[LEDE-DEV] [PATCH v2 ubox 6/6] kmodloader: make insert_module() idempotent

2017-01-13 Thread Yousong Zhou
To fix spurious error messages in the following situation

 1. scan loaded modules
 2. load wireguard.ko and the module itself will request xt_hashlimit to
be loaded
 3. xt_hashlimit is still in PROBE state here so we also try to load it,
but init_module() returns EEXIST

Signed-off-by: Yousong Zhou 
---
 kmodloader.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kmodloader.c b/kmodloader.c
index bcb213b..729027a 100644
--- a/kmodloader.c
+++ b/kmodloader.c
@@ -574,8 +574,11 @@ static int insert_module(char *path, const char *options)
}
 
data = malloc(s.st_size);
-   if (read(fd, data, s.st_size) == s.st_size)
+   if (read(fd, data, s.st_size) == s.st_size) {
ret = syscall(__NR_init_module, data, (unsigned long) 
s.st_size, options);
+   if (errno == EEXIST)
+   ret = 0;
+   }
else
ULOG_ERR("failed to read full module %s\n", path);
 
-- 
2.6.4


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


[LEDE-DEV] [PATCH v2 ubox 2/6] kmodloader: log to kmsg when loading directories of modules

2017-01-13 Thread Yousong Zhou
syslog may not be ready yet before PREINIT

Signed-off-by: Yousong Zhou 
---
 kmodloader.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kmodloader.c b/kmodloader.c
index 9fe7d7f..b20de6e 100644
--- a/kmodloader.c
+++ b/kmodloader.c
@@ -27,7 +27,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -785,7 +784,7 @@ static int main_loader(int argc, char **argv)
return -1;
}
 
-   syslog(LOG_INFO, "kmodloader: loading kernel modules from %s\n", path);
+   ULOG_INFO("loading kernel modules from %s\n", path);
 
if (glob(path, gl_flags, NULL, ) < 0)
goto out;
@@ -836,6 +835,8 @@ static int main_loader(int argc, char **argv)
avl_for_each_element(, m, avl)
if ((m->state == PROBE) || (m->error))
ULOG_ERR("- %s - %d\n", m->name, 
deps_available(m, 1));
+   } else {
+   ULOG_INFO("done loading kernel modules from %s\n", path);
}
 
 out:
@@ -881,5 +882,6 @@ int main(int argc, char **argv)
if (!strcmp(exec, "modprobe"))
return main_modprobe(argc, argv);
 
+   ulog_open(ULOG_KMSG, LOG_USER, "kmodloader");
return main_loader(argc, argv);
 }
-- 
2.6.4


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


[LEDE-DEV] [PATCH v2 ubox 4/6] kmodloader: fix out-of-bound access when parsing .modinfo

2017-01-13 Thread Yousong Zhou
Fixes output of "modinfo nf_conntrack_ipv4"

module: /lib/modules/4.4.40/nf_conntrack_ipv4.ko
license:GPL
alias:  ip_conntrack
alias:  nf_conntrack-2
depends:nf_conntrack,nf_defrag_ipv4
src:%pI4 dst=%pI4

Signed-off-by: Yousong Zhou 
---
 kmodloader.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/kmodloader.c b/kmodloader.c
index 065ac82..c780379 100644
--- a/kmodloader.c
+++ b/kmodloader.c
@@ -302,12 +302,14 @@ static struct module* get_module_info(const char *module, 
const char *name)
}
 
strings = map + offset;
-   while (strings && (strings < map + offset + size)) {
+   while (true) {
char *sep;
int len;
 
while (!strings[0])
strings++;
+   if (strings >= map + offset + size)
+   break;
sep = strstr(strings, "=");
if (!sep)
break;
@@ -410,12 +412,14 @@ static int print_modinfo(char *module)
 
strings = map + offset;
printf("module:\t\t%s\n", module);
-   while (strings && (strings < map + offset + size)) {
+   while (true) {
char *dup = NULL;
char *sep;
 
while (!strings[0])
strings++;
+   if (strings >= map + offset + size)
+   break;
sep = strstr(strings, "=");
if (!sep)
break;
-- 
2.6.4


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


[LEDE-DEV] ar71xx: Detect USB port on Mikrotik RB750UP

2017-01-13 Thread João Chaínho
The USB port on Mikrotik RB750UP isn’t detected. This patch provides a fix. 
Tested and working.

Signed-off-by: João Chaínho 
---
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c
index 5656d3c..c308f95 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c
@@ -169,6 +169,9 @@ static void __init rb750_setup(void)
rb750_nand_data.disable_pins = rb750_nand_disable_pins;
rb750_nand_data.latch_change = rb750_latch_change;
platform_device_register(_nand_device);
+
+   /* USB */
+   ath79_register_usb();
 }
 
 MIPS_MACHINE(ATH79_MACH_RB_750, "750i", "MikroTik RouterBOARD 750",

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


Re: [LEDE-DEV] [Babel-users] Babeld now has procd support on OpenWRT/LEDE

2017-01-13 Thread Dave Taht
On Fri, Jan 13, 2017 at 4:08 AM, L. D. Pinney  wrote:
> DAVE :
>
> WILL YOU PLEASE STOP YOUR FSCKin' CROSS POSTING ???

I did not start the cross-post in this case.

> This is UNRELATED to the OpenWrt / LEDE DEV mailing list...as the change has
> been merged.

Interop with routing protocols... and networking in general... does
exist outside of the openwrt universe. In my case I am deeply
concerned about what happens against older, deployed versions of
Linuxes (and other OSes) with the new multicast-unicast bridge
conversion code in lede. Babel tends to use it, and I am also testing
(in lede!), as per the below, the dhcpv6-pd code, interop-ing with
several devices.

> F O

I'm really sorry that you hate cross posting so much. It must be
terrible to have to elide additional responses or deal with bounce
messages on every 20th email from me. And it must be wonderful to be
living in a world where all you have is openwrt/lede devices on the
network and modern kernels everywhere.

>
> On Friday, January 13, 2017 5:20 AM, Dave Taht  wrote:
>
>
> On Thu, Jan 12, 2017 at 1:01 PM, Baptiste Jonglez
>  wrote:
>> Hi,
>>
>> Here is yet another OpenWRT-related change for babeld: I just merged procd
>> support for babeld [2], after more than two years of lingering [1].
>>
>> The only user-visible changes should be:
>>
>> - babeld now logs to the system log (visible with "logread") instead of a
>>  file in /var/log.  This is nice for embedded devices, where you don't
>>  want to write too much to the filesystem.  It is still possible to
>>  explicitly configure babeld to use a log file;
>>
>> - babeld is now restarted automatically whenever it crashes;
>>
>> - the usual procd niceties: calling "/etc/init.d/babeld reload" will
>>  restart babeld only if the configuration has changed.
>>
>>
>> Please test babeld 1.8.0-2 and report any resulting breakage.  I would
>> like this change (and the other compatibility change) to make it into the
>> upcoming LEDE release, which is due to happen quite soon.
>
> Groovy.
>
> lede can dynamically insert/delete routes into tables from netifd
> babeld can pull routes from "protos" but not tables.
>
> I spoke with hedecker (? can't remember his email) about somehow
> having a field to export routes into kernel protos in the lede network
> file, he indicated he'd look at it in a few weeks.
>
> (I wanted to get away from ever having to revise the conf file
> dynamically, but it looks like not this release. Not having to restart
> babeld as per the above is a nice improvement though and I'll get on
> testing it this weekend. At the moment I'm going through some mild
> hell with dhcpv6-pd on comcast and adding "sonic" fiber (with a HE
> ipv6 tunnel. Will hopefully have 4 source specific gateways to play
> with here)
>
> In other other news the "rabeld" backport of the gentler route switch
> change loses kernel routes on the vyatta (3.10 based) OS in the
> edgerouter. :(. That said, haven't tested mainline babeld there yet.
> It seems to work on debian.
>
> For those fiddling with edgerouter's default 1.9.x OS, backports of
> cake, iproute, and rabeld are presently here:
> https://build.lochnair.net/
>
>
>> Baptiste
>>
>> [1] https://github.com/openwrt-routing/packages/pull/55
>> [2] https://github.com/openwrt-routing/packages/pull/250
>
>>
>> ___
>> Babel-users mailing list
>> babel-us...@lists.alioth.debian.org
>> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/babel-users
>
>
>
> --
> Dave Täht
> Let's go make home routers and wifi faster! With better software!
> http://blog.cerowrt.org
>
> ___
> Lede-dev mailing list
> Lede-dev@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev
>
>
>



-- 
Dave Täht
Let's go make home routers and wifi faster! With better software!
http://blog.cerowrt.org

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


Re: [LEDE-DEV] procd & custom reload support

2017-01-13 Thread Bastian Bittorf
* Jo-Philipp Wich  [13.01.2017 15:38]:
> To enable it, add "procd_set_param reload_signal 10" to your init script.

i send a patch to the mailinglist,
with this it is possible to write

procd_set_param reload_signal USR1

be warned: if you are e.g. on ramips, than
the signal 10 is 'BUS', so thats not what you want 8-)

bye, bastian

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


[LEDE-DEV] [PATCH] procd: update procd.sh to support both: signal-names and signal-numbers

2017-01-13 Thread Bastian Bittorf
It is automatically detected if the input is a number. If not,
the name is converted to the corresonding number. In general it's
good style to use names and it's more portable: signal numbers can
be architecture-dependent, so we are more safe giving names.

Signed-off-by: Bastian Bittorf 
---
 package/system/procd/files/procd.sh | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/package/system/procd/files/procd.sh 
b/package/system/procd/files/procd.sh
index 8f18cda..695d815 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -200,6 +200,7 @@ _procd_add_jail_mount_rw() {
 
 _procd_set_param() {
local type="$1"; shift
+   local obj old_obj signal
 
case "$type" in
env|data|limits)
@@ -213,9 +214,18 @@ _procd_set_param() {
json_add_string "" "$@"
json_close_array
;;
-   nice|reload_signal)
+   nice)
json_add_int "$type" "$1"
;;
+   reload_signal)
+   signal="$1"
+   test "$signal" -eq "$signal" 2>/dev/null || {
+   set -- $( kill -l ) NOT_FOUND
+   for obj in "$@"; do test "$signal" = "$obj" && 
break; old_obj="$obj"; done
+   signal="${old_obj%)}"
+   }
+   json_add_int "$type" "$signal"
+   ;;
pidfile|user|seccomp|capabilities)
json_add_string "$type" "$1"
;;
-- 
1.9.1


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


[LEDE-DEV] [PATCH] netfilter: re-enable TEE support for kernel 4.4

2017-01-13 Thread Koen Vandeputte
It got disabled in commit 4454a3fb6375cf1adf17f63a54cd7660bc40caa7
but works nicely these days.

Tested on cns3xxx

Signed-off-by: Koen Vandeputte 
---
 package/kernel/linux/modules/netfilter.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/kernel/linux/modules/netfilter.mk 
b/package/kernel/linux/modules/netfilter.mk
index bc2f349..a5941d2 100644
--- a/package/kernel/linux/modules/netfilter.mk
+++ b/package/kernel/linux/modules/netfilter.mk
@@ -495,7 +495,7 @@ $(eval $(call KernelPackage,ipt-tproxy))
 
 define KernelPackage/ipt-tee
   TITLE:=TEE support
-  DEPENDS:=+kmod-ipt-conntrack @!LINUX_4_4
+  DEPENDS:=+kmod-ipt-conntrack
   KCONFIG:= \
CONFIG_NETFILTER_XT_TARGET_TEE
   FILES:= \
-- 
2.7.4


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


[LEDE-DEV] [PATCH] ramips: Add I2C driver to the default kernel config

2017-01-13 Thread Rosen Penev
I made a commit that added the RTC driver to the kernel config with
the intent that it would fix hctosys. Unfortunately while the RTC
driver is in there, it's connected through I2C, the driver for which
comes in module form and is thus loaded late. After this commit, it
works fine.

Signed-off by: Rosen Penev 
---
 target/linux/ramips/image/mt7621.mk   | 12 +---
 target/linux/ramips/modules.mk| 16 
 target/linux/ramips/mt7621/config-4.4 |  2 ++
 3 files changed, 7 insertions(+), 23 deletions(-)

diff --git a/target/linux/ramips/image/mt7621.mk 
b/target/linux/ramips/image/mt7621.mk
index 6d9a727..fd28e19 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -30,7 +30,7 @@ define Device/11acnas
   DTS := 11ACNAS
   IMAGE_SIZE := $(ralink_default_fw_size_16M)
   DEVICE_TITLE := WeVO 11AC NAS Router
-  DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-i2c-mt7621 
kmod-mt76
+  DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-mt76
 endef
 TARGET_DEVICES += 11acnas
 
@@ -83,7 +83,7 @@ define Device/newifi-d1
   DTS := Newifi-D1
   IMAGE_SIZE := $(ralink_default_fw_size_32M)
   DEVICE_TITLE := Newifi D1
-  DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-i2c-mt7621
+  DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport
 endef
 TARGET_DEVICES += newifi-d1
 
@@ -91,8 +91,7 @@ define Device/pbr-m1
   DTS := PBR-M1
   IMAGE_SIZE := $(ralink_default_fw_size_16M)
   DEVICE_TITLE := PBR-M1
-  DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core 
kmod-ata-ahci \
-   kmod-i2c-mt7621
+  DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core 
kmod-ata-ahci
 endef
 TARGET_DEVICES += pbr-m1
 
@@ -157,7 +156,7 @@ define Device/w2914nsv2
   DTS := W2914NSV2
   IMAGE_SIZE := $(ralink_default_fw_size_16M)
   DEVICE_TITLE := WeVO W2914NS v2
-  DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-i2c-mt7621 
kmod-mt76
+  DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-mt76
 endef
 TARGET_DEVICES += w2914nsv2
 
@@ -179,8 +178,7 @@ define Device/witi
   DTS := WITI
   IMAGE_SIZE := $(ralink_default_fw_size_16M)
   DEVICE_TITLE := MQmaker WiTi
-  DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core 
kmod-ata-ahci \
-   kmod-i2c-mt7621
+  DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core 
kmod-ata-ahci
 endef
 TARGET_DEVICES += witi
 
diff --git a/target/linux/ramips/modules.mk b/target/linux/ramips/modules.mk
index 99c5a9d..c2b6f50 100644
--- a/target/linux/ramips/modules.mk
+++ b/target/linux/ramips/modules.mk
@@ -58,22 +58,6 @@ endef
 $(eval $(call KernelPackage,i2c-ralink))
 
 
-I2C_MT7621_MODULES:= \
-  CONFIG_I2C_MT7621:drivers/i2c/busses/i2c-mt7621
-
-define KernelPackage/i2c-mt7621
-  $(call i2c_defaults,$(I2C_MT7621_MODULES),59)
-  TITLE:=MT7621 I2C Controller
-  DEPENDS:=kmod-i2c-core \
-   @(TARGET_ramips_mt7621||TARGET_ramips_mt7628||TARGET_ramips_mt7688)
-endef
-
-define KernelPackage/i2c-mt7621/description
- Kernel modules for enable mt7621 i2c controller.
-endef
-
-$(eval $(call KernelPackage,i2c-mt7621))
-
 define KernelPackage/dma-ralink
   SUBMENU:=Other modules
   TITLE:=Ralink GDMA Engine
diff --git a/target/linux/ramips/mt7621/config-4.4 
b/target/linux/ramips/mt7621/config-4.4
index 73c3b39..383370b 100644
--- a/target/linux/ramips/mt7621/config-4.4
+++ b/target/linux/ramips/mt7621/config-4.4
@@ -115,6 +115,8 @@ CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
 CONFIG_HIGHMEM=y
 CONFIG_HW_HAS_PCI=y
 CONFIG_HZ_PERIODIC=y
+CONFIG_I2C=y
+CONFIG_I2C_MT7621=y
 # CONFIG_IMG_MDC_DMA is not set
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_IRQCHIP=y
-- 
2.9.3


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


Re: [LEDE-DEV] [PATCH ubox 3/6] kmodloader: modprobe: skip possible command line arguments

2017-01-13 Thread Yousong Zhou
On 13 January 2017 at 17:02, Felix Fietkau  wrote:
> On 2017-01-11 12:54, Yousong Zhou wrote:
>> The kernel may invocate user mode modprobe with the following scheme
>>
>> modprobe -q -- 
>>
>> Signed-off-by: Yousong Zhou 
>> ---
>>  kmodloader.c | 13 +++--
>>  1 file changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/kmodloader.c b/kmodloader.c
>> index b20de6e..b5dc4d1 100644
>> --- a/kmodloader.c
>> +++ b/kmodloader.c
>> @@ -719,8 +719,17 @@ static int main_modprobe(int argc, char **argv)
>>  {
>>   struct module *m;
>>   char *name;
>> + char *mod = NULL;
>> + int i;
>>
>> - if (argc != 2)
>> + if (argc < 2)
>> + return print_usage("modprobe");
>> + for (i = 1; i < argc; i++)
>> + if (argv[i][0] != '-') {
> Wouldn't it make more sense to use getopt here and fail on invalid options?
>
> - Felix
>

I thought the code intended to be minimal and options are not part of
the game.  That's why all options are just ignored like above.  Though
the argc < 2 check could have been dropped...

If we accept -q and reject others, that means we will introduce a
global quiet flag and will really be quiet?  Or can we depend on
current behaviour of ulog_open(channels=0) to effectively close all
ULOG_XXX channels?

yousong

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


Re: [LEDE-DEV] procd & custom reload support

2017-01-13 Thread Jo-Philipp Wich
Hi Matthias,

> Btw., does this support symbolic signal names? Many signal numbers 
> (including SIGUSR1) are arch-dependent (in particular, differ on
> MIPS) (see `man 7 signal`).

at the moment not. One can use $(kill -l SIGUSR1) to resolve the numbers
for now.

~ Jo



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


Re: [LEDE-DEV] procd & custom reload support

2017-01-13 Thread Matthias Schiffer
On 01/13/2017 12:20 PM, Jo-Philipp Wich wrote:
> Hi Rafał,
> 
>> What I'd like to achieve is procd monitoring /etc/foo.conf and calling
>> my custom reload function if there is a real need to reload service.
>>
>> Is that possible with procd?
> 
> Yes. This facility was recently introduced with
> 
> https://git.lede-project.org/?p=project/procd.git;a=commitdiff;h=f800ecf860addd4fc7f1acde76a9adbd4b1f50e7
> 
> and
> 
> https://git.lede-project.org/?p=source.git;a=commitdiff;h=b22a20af450b19fb47235e684afcddb301221def
> 
> To enable it, add "procd_set_param reload_signal 10" to your init script.
> 
> ~ Jo

Btw., does this support symbolic signal names? Many signal numbers
(including SIGUSR1) are arch-dependent (in particular, differ on MIPS) (see
`man 7 signal`).

Matthias




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


Re: [LEDE-DEV] procd & custom reload support

2017-01-13 Thread Jo-Philipp Wich
Hi Rafał,

> What I'd like to achieve is procd monitoring /etc/foo.conf and calling
> my custom reload function if there is a real need to reload service.
> 
> Is that possible with procd?

Yes. This facility was recently introduced with

https://git.lede-project.org/?p=project/procd.git;a=commitdiff;h=f800ecf860addd4fc7f1acde76a9adbd4b1f50e7

and

https://git.lede-project.org/?p=source.git;a=commitdiff;h=b22a20af450b19fb47235e684afcddb301221def

To enable it, add "procd_set_param reload_signal 10" to your init script.

~ Jo

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


Re: [LEDE-DEV] [PATCH] ramips: Add I2C driver to the default kernel config

2017-01-13 Thread Felix Fietkau
On 2017-01-13 04:05, Rosen Penev wrote:
> I made a commit that added the RTC driver to the kernel config with
> the intent that it would fix hctosys. Unfortunately while the RTC
> driver is in there, it's connected through I2C, the driver for which
> comes in module form and is thus loaded late. After this commit, it
> works fine.
> 
> Signed-off by: Rosen Penev 
Please remove kmod-i2c-mt7621 from modules.mk as well.

- Felix


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


[LEDE-DEV] [PATCH] imx6: kernel: Backport serial port fixes

2017-01-13 Thread Petr Štetiar
Signed-off-by: Petr Štetiar 
---
 ...erial-imx-repair-and-complete-handshaking.patch | 78 ++
 .../111-serial-imx-fix-polarity-of-RI.patch| 38 +++
 ...let-irq-handler-return-IRQ_NONE-if-no-eve.patch | 72 
 ...imx-make-sure-unhandled-irqs-are-disabled.patch | 61 +
 4 files changed, 249 insertions(+)
 create mode 100644 
target/linux/imx6/patches-4.4/110-serial-imx-repair-and-complete-handshaking.patch
 create mode 100644 
target/linux/imx6/patches-4.4/111-serial-imx-fix-polarity-of-RI.patch
 create mode 100644 
target/linux/imx6/patches-4.4/112-serial-imx-let-irq-handler-return-IRQ_NONE-if-no-eve.patch
 create mode 100644 
target/linux/imx6/patches-4.4/113-serial-imx-make-sure-unhandled-irqs-are-disabled.patch

diff --git 
a/target/linux/imx6/patches-4.4/110-serial-imx-repair-and-complete-handshaking.patch
 
b/target/linux/imx6/patches-4.4/110-serial-imx-repair-and-complete-handshaking.patch
new file mode 100644
index 000..0a117f6
--- /dev/null
+++ 
b/target/linux/imx6/patches-4.4/110-serial-imx-repair-and-complete-handshaking.patch
@@ -0,0 +1,78 @@
+From 90ebc4838666d148eac5bbac6f4044e5b25cd2d6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= 
+Date: Sun, 18 Oct 2015 21:34:46 +0200
+Subject: [PATCH] serial: imx: repair and complete handshaking
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The .get_mctrl callback should not report the status of RTS or LOOP, so
+drop this. Instead implement reporting the state of CAR (aka DCD) and
+RI.
+
+For .set_mctrl implement setting the DTR line.
+
+Signed-off-by: Uwe Kleine-König 
+Signed-off-by: Greg Kroah-Hartman 
+Signed-off-by: Petr Štetiar 
+---
+ drivers/tty/serial/imx.c | 23 +--
+ 1 file changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
+index 76818f5..086675e 100644
+--- a/drivers/tty/serial/imx.c
 b/drivers/tty/serial/imx.c
+@@ -148,8 +148,11 @@
+ #define USR2_TXFE  (1<<14) /* Transmit buffer FIFO empty */
+ #define USR2_DTRF  (1<<13) /* DTR edge interrupt flag */
+ #define USR2_IDLE  (1<<12) /* Idle condition */
++#define USR2_RIDELT(1<<10) /* Ring Interrupt Delta */
++#define USR2_RIIN  (1<<9)  /* Ring Indicator Input */
+ #define USR2_IRINT (1<<8)  /* Serial infrared interrupt flag */
+ #define USR2_WAKE  (1<<7)  /* Wake */
++#define USR2_DCDIN (1<<5)  /* Data Carrier Detect Input */
+ #define USR2_RTSF  (1<<4)  /* RTS edge interrupt flag */
+ #define USR2_TXDC  (1<<3)  /* Transmitter complete */
+ #define USR2_BRCD  (1<<2)  /* Break condition */
+@@ -804,16 +807,19 @@ static unsigned int imx_tx_empty(struct uart_port *port)
+ static unsigned int imx_get_mctrl(struct uart_port *port)
+ {
+   struct imx_port *sport = (struct imx_port *)port;
+-  unsigned int tmp = TIOCM_DSR | TIOCM_CAR;
++  unsigned int tmp = TIOCM_DSR;
++  unsigned usr1 = readl(sport->port.membase + USR1);
+ 
+-  if (readl(sport->port.membase + USR1) & USR1_RTSS)
++  if (usr1 & USR1_RTSS)
+   tmp |= TIOCM_CTS;
+ 
+-  if (readl(sport->port.membase + UCR2) & UCR2_CTS)
+-  tmp |= TIOCM_RTS;
++  /* in DCE mode DCDIN is always 0 */
++  if (!(usr1 & USR2_DCDIN))
++  tmp |= TIOCM_CAR;
+ 
+-  if (readl(sport->port.membase + uts_reg(sport)) & UTS_LOOP)
+-  tmp |= TIOCM_LOOP;
++  /* in DCE mode RIIN is always 0 */
++  if (readl(sport->port.membase + USR2) & USR2_RIIN)
++  tmp |= TIOCM_RI;
+ 
+   return tmp;
+ }
+@@ -831,6 +837,11 @@ static void imx_set_mctrl(struct uart_port *port, 
unsigned int mctrl)
+   writel(temp, sport->port.membase + UCR2);
+   }
+ 
++  temp = readl(sport->port.membase + UCR3) & ~UCR3_DSR;
++  if (!(mctrl & TIOCM_DTR))
++  temp |= UCR3_DSR;
++  writel(temp, sport->port.membase + UCR3);
++
+   temp = readl(sport->port.membase + uts_reg(sport)) & ~UTS_LOOP;
+   if (mctrl & TIOCM_LOOP)
+   temp |= UTS_LOOP;
+-- 
+1.9.1
+
diff --git 
a/target/linux/imx6/patches-4.4/111-serial-imx-fix-polarity-of-RI.patch 
b/target/linux/imx6/patches-4.4/111-serial-imx-fix-polarity-of-RI.patch
new file mode 100644
index 000..a065575
--- /dev/null
+++ b/target/linux/imx6/patches-4.4/111-serial-imx-fix-polarity-of-RI.patch
@@ -0,0 +1,38 @@
+From 9a061cea4477f26a1dfcc0a08dc20575016e91df Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= 
+Date: Thu, 24 Mar 2016 14:24:20 +0100
+Subject: [PATCH 1/3] serial: imx: fix polarity of RI
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+When in DTE mode, the bit USR2_RIIN is active low. So invert the logic

Re: [LEDE-DEV] [PATCH 1/2] mac80211: backport some upstream fixes

2017-01-13 Thread Felix Fietkau
On 2017-01-13 10:34, Koen Vandeputte wrote:
> Backports the following upstream fixes:
> 
> mac80211: initialize fast-xmit 'info' later
> mac80211: fix legacy and invalid rx-rate report
> mac80211: fix tid_agg_rx NULL dereference
> 
> Compiled and tested on: cns3xxx
> 
> Signed-off-by: Koen Vandeputte 
Applied the first patch, did the refresh myself because your patch did
not apply to my staging tree.

Thanks,

- Felix


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


[LEDE-DEV] [PATCH 1/2] mac80211: backport some upstream fixes

2017-01-13 Thread Koen Vandeputte
Backports the following upstream fixes:

mac80211: initialize fast-xmit 'info' later
mac80211: fix legacy and invalid rx-rate report
mac80211: fix tid_agg_rx NULL dereference

Compiled and tested on: cns3xxx

Signed-off-by: Koen Vandeputte 
---
 .../349-mac80211-fix-legacy-invalid-rxrate.patch   | 60 +
 .../patches/350-mac80211-init-fastxmit-later.patch | 41 +
 .../patches/351-mac80211-fix-tid-agg-null.patch| 99 ++
 3 files changed, 200 insertions(+)
 create mode 100644 
package/kernel/mac80211/patches/349-mac80211-fix-legacy-invalid-rxrate.patch
 create mode 100644 
package/kernel/mac80211/patches/350-mac80211-init-fastxmit-later.patch
 create mode 100644 
package/kernel/mac80211/patches/351-mac80211-fix-tid-agg-null.patch

diff --git 
a/package/kernel/mac80211/patches/349-mac80211-fix-legacy-invalid-rxrate.patch 
b/package/kernel/mac80211/patches/349-mac80211-fix-legacy-invalid-rxrate.patch
new file mode 100644
index 000..c160515
--- /dev/null
+++ 
b/package/kernel/mac80211/patches/349-mac80211-fix-legacy-invalid-rxrate.patch
@@ -0,0 +1,60 @@
+From a17d93ff3a950fefaea40e4a4bf3669b9137c533 Mon Sep 17 00:00:00 2001
+From: Ben Greear 
+Date: Wed, 14 Dec 2016 11:30:38 -0800
+Subject: [PATCH] mac80211: fix legacy and invalid rx-rate report
+
+This fixes obtaining the rate info via sta_set_sinfo
+when the rx rate is invalid (for instance, on IBSS
+interface that has received no frames from one of its
+peers).
+
+Also initialize rinfo->flags for legacy rates, to not
+rely on the whole sinfo being initialized to zero.
+
+Signed-off-by: Ben Greear 
+Signed-off-by: Johannes Berg 
+---
+ net/mac80211/sta_info.c | 14 --
+ 1 file changed, 8 insertions(+), 6 deletions(-)
+
+--- a/net/mac80211/sta_info.c
 b/net/mac80211/sta_info.c
+@@ -1975,6 +1975,7 @@ static void sta_stats_decode_rate(struct
+   u16 brate;
+   unsigned int shift;
+ 
++  rinfo->flags = 0;
+   sband = local->hw.wiphy->bands[(rate >> 4) & 0xf];
+   brate = sband->bitrates[rate & 0xf].bitrate;
+   if (rinfo->bw == RATE_INFO_BW_5)
+@@ -1990,14 +1991,15 @@ static void sta_stats_decode_rate(struct
+   rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI;
+ }
+ 
+-static void sta_set_rate_info_rx(struct sta_info *sta, struct rate_info 
*rinfo)
++static int sta_set_rate_info_rx(struct sta_info *sta, struct rate_info *rinfo)
+ {
+   u16 rate = ACCESS_ONCE(sta_get_last_rx_stats(sta)->last_rate);
+ 
+   if (rate == STA_STATS_RATE_INVALID)
+-  rinfo->flags = 0;
+-  else
+-  sta_stats_decode_rate(sta->local, rate, rinfo);
++  return -EINVAL;
++
++  sta_stats_decode_rate(sta->local, rate, rinfo);
++  return 0;
+ }
+ 
+ static void sta_set_tidstats(struct sta_info *sta,
+@@ -2202,8 +2204,8 @@ void sta_set_sinfo(struct sta_info *sta,
+   }
+ 
+   if (!(sinfo->filled & BIT(NL80211_STA_INFO_RX_BITRATE))) {
+-  sta_set_rate_info_rx(sta, >rxrate);
+-  sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE);
++  if (sta_set_rate_info_rx(sta, >rxrate) == 0)
++  sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE);
+   }
+ 
+   sinfo->filled |= BIT(NL80211_STA_INFO_TID_STATS);
diff --git 
a/package/kernel/mac80211/patches/350-mac80211-init-fastxmit-later.patch 
b/package/kernel/mac80211/patches/350-mac80211-init-fastxmit-later.patch
new file mode 100644
index 000..0b640ef
--- /dev/null
+++ b/package/kernel/mac80211/patches/350-mac80211-init-fastxmit-later.patch
@@ -0,0 +1,41 @@
+From 35f432a03e41d3bf08c51ede917f94e2288fbe8c Mon Sep 17 00:00:00 2001
+From: Johannes Berg 
+Date: Mon, 2 Jan 2017 11:19:29 +0100
+Subject: [PATCH] mac80211: initialize fast-xmit 'info' later
+
+In ieee80211_xmit_fast(), 'info' is initialized to point to the skb
+that's passed in, but that skb may later be replaced by a clone (if
+it was shared), leading to an invalid pointer.
+
+This can lead to use-after-free and also later crashes since the
+real SKB's info->hw_queue doesn't get initialized properly.
+
+Fix this by assigning info only later, when it's needed, after the
+skb replacement (may have) happened.
+
+Cc: sta...@vger.kernel.org
+Reported-by: Ben Greear 
+Signed-off-by: Johannes Berg 
+---
+ net/mac80211/tx.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/net/mac80211/tx.c
 b/net/mac80211/tx.c
+@@ -3297,7 +3297,7 @@ static bool ieee80211_xmit_fast(struct i
+   int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2);
+   int hw_headroom = sdata->local->hw.extra_tx_headroom;
+   struct ethhdr eth;
+-  struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
++  struct ieee80211_tx_info *info;
+   struct ieee80211_hdr 

[LEDE-DEV] [PATCH 2/2] mac80211: refresh all patches

2017-01-13 Thread Koen Vandeputte
Signed-off-by: Koen Vandeputte 
---
 .../100-remove-cryptoapi-dependencies.patch| 90 --
 ...h-to-using-mac80211-intermediate-software.patch |  4 +-
 ...ath9k_hw-issue-external-reset-for-QCA955x.patch | 51 ++--
 ...void-extra-memcpy-in-A-MSDU-head-creation.patch | 15 ++--
 .../mac80211/patches/404-regd_no_assoc_hints.patch |  4 +-
 .../522-mac80211_configure_antenna_gain.patch  |  4 +-
 .../mac80211/patches/530-ath9k_extra_leds.patch| 12 +--
 ...e-all-EEPROM-fields-in-Little-Endian-form.patch | 50 ++--
 .../patches/910-01-add-support-for-mt7620.patch|  6 +-
 9 files changed, 125 insertions(+), 111 deletions(-)

diff --git 
a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch 
b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
index b65b0bd..fbe22e5 100644
--- a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
+++ b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
@@ -34,9 +34,12 @@
  #include "aes_ccm.h"
  
 -void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
+- u8 *data, size_t data_len, u8 *mic,
+- size_t mic_len)
 +static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *b_0, u8 *aad, u8 
*s_0,
 +  u8 *a, u8 *b)
-+{
+ {
+-  struct scatterlist sg[3];
 +  int i;
 +
 +  crypto_cipher_encrypt_one(tfm, b, b_0);
@@ -51,56 +54,55 @@
 +  for (i = 0; i < AES_BLOCK_SIZE; i++)
 +  aad[i] ^= b[i];
 +  crypto_cipher_encrypt_one(tfm, a, aad);
-+
+ 
+-  char aead_req_data[sizeof(struct aead_request) +
+- crypto_aead_reqsize(tfm)]
+-  __aligned(__alignof__(struct aead_request));
+-  struct aead_request *aead_req = (void *) aead_req_data;
 +  /* Mask out bits from auth-only-b_0 */
 +  b_0[0] &= 0x07;
-+
+ 
+-  memset(aead_req, 0, sizeof(aead_req_data));
 +  /* S_0 is used to encrypt T (= MIC) */
 +  b_0[14] = 0;
 +  b_0[15] = 0;
 +  crypto_cipher_encrypt_one(tfm, s_0, b_0);
 +}
-+
-+
+ 
+-  sg_init_table(sg, 3);
+-  sg_set_buf([0], [2], be16_to_cpup((__be16 *)aad));
+-  sg_set_buf([1], data, data_len);
+-  sg_set_buf([2], mic, mic_len);
+ 
+-  aead_request_set_tfm(aead_req, tfm);
+-  aead_request_set_crypt(aead_req, sg, sg, data_len, b_0);
+-  aead_request_set_ad(aead_req, sg[0].length);
 +void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
-  u8 *data, size_t data_len, u8 *mic,
-  size_t mic_len)
- {
--  struct scatterlist sg[3];
++ u8 *data, size_t data_len, u8 *mic,
++ size_t mic_len)
++{
 +  int i, j, last_len, num_blocks;
 +  u8 b[AES_BLOCK_SIZE];
 +  u8 s_0[AES_BLOCK_SIZE];
 +  u8 e[AES_BLOCK_SIZE];
 +  u8 *pos, *cpos;
- 
--  char aead_req_data[sizeof(struct aead_request) +
-- crypto_aead_reqsize(tfm)]
--  __aligned(__alignof__(struct aead_request));
--  struct aead_request *aead_req = (void *) aead_req_data;
++
 +  num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
 +  last_len = data_len % AES_BLOCK_SIZE;
 +  aes_ccm_prepare(tfm, b_0, aad, s_0, b, b);
- 
--  memset(aead_req, 0, sizeof(aead_req_data));
++
 +  /* Process payload blocks */
 +  pos = data;
 +  cpos = data;
 +  for (j = 1; j <= num_blocks; j++) {
 +  int blen = (j == num_blocks && last_len) ?
 +  last_len : AES_BLOCK_SIZE;
- 
--  sg_init_table(sg, 3);
--  sg_set_buf([0], [2], be16_to_cpup((__be16 *)aad));
--  sg_set_buf([1], data, data_len);
--  sg_set_buf([2], mic, mic_len);
++
 +  /* Authentication followed by encryption */
 +  for (i = 0; i < blen; i++)
 +  b[i] ^= pos[i];
 +  crypto_cipher_encrypt_one(tfm, b, b);
- 
--  aead_request_set_tfm(aead_req, tfm);
--  aead_request_set_crypt(aead_req, sg, sg, data_len, b_0);
--  aead_request_set_ad(aead_req, sg[0].length);
++
 +  b_0[14] = (j >> 8) & 0xff;
 +  b_0[15] = j & 0xff;
 +  crypto_cipher_encrypt_one(tfm, e, b_0);
@@ -123,30 +125,37 @@
 - crypto_aead_reqsize(tfm)]
 -  __aligned(__alignof__(struct aead_request));
 -  struct aead_request *aead_req = (void *) aead_req_data;
+-
+-  if (data_len == 0)
+-  return -EINVAL;
+-
+-  memset(aead_req, 0, sizeof(aead_req_data));
+-
+-  sg_init_table(sg, 3);
+-  sg_set_buf([0], [2], be16_to_cpup((__be16 *)aad));
+-  sg_set_buf([1], data, data_len);
+-  sg_set_buf([2], mic, mic_len);
+-
+-  aead_request_set_tfm(aead_req, tfm);
+-  aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, 

Re: [LEDE-DEV] [PATCH ubox 3/6] kmodloader: modprobe: skip possible command line arguments

2017-01-13 Thread Felix Fietkau
On 2017-01-11 12:54, Yousong Zhou wrote:
> The kernel may invocate user mode modprobe with the following scheme
> 
> modprobe -q -- 
> 
> Signed-off-by: Yousong Zhou 
> ---
>  kmodloader.c | 13 +++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/kmodloader.c b/kmodloader.c
> index b20de6e..b5dc4d1 100644
> --- a/kmodloader.c
> +++ b/kmodloader.c
> @@ -719,8 +719,17 @@ static int main_modprobe(int argc, char **argv)
>  {
>   struct module *m;
>   char *name;
> + char *mod = NULL;
> + int i;
>  
> - if (argc != 2)
> + if (argc < 2)
> + return print_usage("modprobe");
> + for (i = 1; i < argc; i++)
> + if (argv[i][0] != '-') {
Wouldn't it make more sense to use getopt here and fail on invalid options?

- Felix


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


Re: [LEDE-DEV] Backporting some mac80211 fixes

2017-01-13 Thread Felix Fietkau
On 2017-01-12 19:34, Koen Vandeputte wrote:
> Hi Felix,
> 
> Would you mind if I send a patch to backport these? :
> 
> mac80211: initialize fast-xmit 'info' later
> mac80211: fix legacy and invalid rx-rate report
> mac80211: fix tid_agg_rx NULL dereference
> 
> https://github.com/torvalds/linux/commit/35f432a03e41d3bf08c51ede917f94e2288fbe8c
> https://github.com/torvalds/linux/commit/a17d93ff3a950fefaea40e4a4bf3669b9137c533
> https://github.com/torvalds/linux/commit/1c3d185a9a0b136a58e73b02912d593d0303d1da
> 
> 
> I noticed you have patch 
> 348-mac80211-initialize-SMPS-field-in-HT-capabilities in your staging dir
> so I locally backported the 3 above to nrs 349, 350, 351
> 
> 
> Both commits build & run fine together should they both be pushed.
Fine with me, please send your backports and I'll take them through my
staging tree.

Thanks,

- Felix


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


Re: [LEDE-DEV] Branching LEDE 17.01 / problems with ath9k

2017-01-13 Thread Bastian Bittorf
* Thomas Endt  [13.01.2017 09:19]:
> > the page https://lede-project.org changed again and 'reporting bugs'
> > is hidden under 'Developer Guide' which is just...wrong Please make
> > this more "friendly".
> 
> https://lede-project.org/contact contains a link to
> https://bugs.lede-project.org/ since 11/11/2016.
> IMHO the perfect place.

thank you - that makes sense. maybe move it more
ontop? it's nearly the last entry after, even after
"Server Status Changes Announcements on Twitter" 8-)

bye, bastian

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