[OpenWrt-Devel] UEFI firmware for x86_64

2019-03-18 Thread John Braley
I was wondering if we are going to see UEFI compatible builds for x86_64
anytime soon. Neither of the 2 suggested solutions in the wiki work at this
time.

The first method fails at commits. I have emailed the author of that fix to
see if something can be done to resolve that.

The 2nd suggestion does successfully build however it looks to be 8-12
months behind and from what I can tell based on LEDE 17 instead of the
rejoined OpenWRT. There is no functioning luci from that build at all.

If there is no plan to provide UEFI compatible builds, does anyone have any
idea on how to boot a non UEFI build on a UEFI system? The motherboard I
bought does not have a CSM module for compatibility so I am stuck with UEFI
only.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ath79: GL.iNet AR300M-nand/nor: correct LAN LED

2019-03-18 Thread Andreas Ziegler
The port labled as "LAN" is eth1.
That's different from the -lite variant,
where the only existing port eth0 is used as LAN
---
 target/linux/ath79/base-files/etc/board.d/01_leds | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/ath79/base-files/etc/board.d/01_leds 
b/target/linux/ath79/base-files/etc/board.d/01_leds
index 0b0dda3bcf..66247ca55d 100755
--- a/target/linux/ath79/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/base-files/etc/board.d/01_leds
@@ -65,7 +65,7 @@ glinet,gl-ar150)
;;
 glinet,gl-ar300m-nand|\
 glinet,gl-ar300m-nor)
-   ucidef_set_led_netdev "lan" "LAN" "gl-ar300m:green:lan" "eth0"
+   ucidef_set_led_netdev "lan" "LAN" "gl-ar300m:green:lan" "eth1"
;;
 glinet,gl-ar300m-lite)
ucidef_set_led_netdev "lan" "LAN" "gl-ar300m-lite:green:lan" "eth0"
-- 
2.21.0


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


[OpenWrt-Devel] [PATCH] tools/xz: Compile with PIC to fix linking errors

2019-03-18 Thread Rosen Penev
I made a similar change to this here:
https://github.com/openwrt/packages/pull/8159

However, it turns out this did not fix the problem as the problem has to
do with tools/xz and not the xz package. The error is the same and it's
causing build failures with CircleCI, as in:

https://github.com/openwrt/packages/pull/8442

Signed-off-by: Rosen Penev 
---
 tools/xz/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/xz/Makefile b/tools/xz/Makefile
index 5d574892bb..21029a74aa 100644
--- a/tools/xz/Makefile
+++ b/tools/xz/Makefile
@@ -1,4 +1,4 @@
-# 
+#
 # Copyright (C) 2006-2015 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
@@ -25,7 +25,8 @@ HOSTCXX := $(HOSTCXX_NOCACHE)
 HOST_CONFIGURE_ARGS += \
--enable-static=yes \
--enable-shared=no \
-   --disable-doc
+   --disable-doc \
+   --with-pic
 
 define Host/Install
+$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) install xzlinks="unxz xzcat"
-- 
2.17.1


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


Re: [OpenWrt-Devel] coverity results are now public

2019-03-18 Thread Petr Štetiar
Alexander Couzens  [2019-03-10 12:29:10]:

> > > I changed the project to allow everybody to view the defects.  
> > 
> > can you please try harder? :-) I can view some stats, but no details
> > about actual defects. Am I doing it wrong?
> 
> maybe it needs another run of the coverity scan. but I set it already
> to the option to allow everybody.

Just FYI, I've filled a bug report to scan-adm@, it was just confirmed and
should be fixed.

-- ynezz

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


Re: [OpenWrt-Devel] [PATCH] [odhcp6c] ra: clear RA information and request new after link-up event or SIGUSR2

2019-03-18 Thread Pavel Merzlyakov
Hi,

>Can you be elaborate more in detail what use case you want to cover
>with this patch; in other words what is not working now ?
Ok,
my setup:
Two peer routers A and B which both connected to gateway C.
Routers A and B have public IPv6 addresses on WAN interfaces from same
subnet (because of RA on C) and private IPv6 addresses on LAN interfaces.
and issue:
If I unplug router B from C and then plug it in LAN port of router A:
1) Router B does not send Router Solicitation message. So router B does not
have a valid gateway for some time.
2) Router B does not delete old IPv6 address on the WAN. After first Router
Advertisement message router B is capable to send a request via new gateway
A, but it can't receive responses because of invalid/old source address in
request.


>Why do you want to restart RA if an SIGUSR2 signal is received ?
Because I assume that SIGUSR2 signal is equivalent to link-up event  (see
odhcp6c:674 ->
https://git.openwrt.org/?p=project/odhcp6c.git;a=blob;f=src/odhcp6c.c;h=19a86f2654bf3c59b0f47cf0aedd87235187bf89;hb=d2e247d8d87ecf8c60fcf0acdad05667bd379521#l674
).
In my case I use hotplug script witch on link-up sends SIGUSR2 signal to
odhcp6c (it's connected to bridge interface).
ra_restart () could be called without condition in beginning of the main
loop.

Br,
Pavel

On Mon, 18 Mar 2019 at 18:26, Hans Dedecker  wrote:

> Hi,
>
> On Mon, Mar 18, 2019 at 2:43 PM  wrote:
> >
> > From: Pavel Merzlyakov 
> >
> > A subnet may be changed after link-up event
> Can you be elaborate more in detail what use case you want to cover
> with this patch; in other words what is not working now ?
> >
> > Signed-off-by: Pavel Merzlyakov 
> > ---
> >  src/odhcp6c.c |  3 +++
> >  src/ra.c  | 20 +---
> >  src/ra.h  |  1 +
> >  3 files changed, 21 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/odhcp6c.c b/src/odhcp6c.c
> > index 19a86f2..dd20f39 100644
> > --- a/src/odhcp6c.c
> > +++ b/src/odhcp6c.c
> > @@ -455,6 +455,9 @@ int main(_unused int argc, char* const argv[])
> >
> > syslog(LOG_NOTICE, "(re)starting transaction on %s",
> ifname);
> >
> > +   if (signal_usr2)
> > +   ra_restart();
> Why do you want to restart RA if an SIGUSR2 signal is received ?
>
> Hans
> > +
> > signal_usr1 = signal_usr2 = false;
> > int mode = dhcpv6_set_ia_mode(ia_na_mode, ia_pd_mode);
> > if (mode != DHCPV6_STATELESS)
> > diff --git a/src/ra.c b/src/ra.c
> > index 898f449..917df11 100644
> > --- a/src/ra.c
> > +++ b/src/ra.c
> > @@ -55,6 +55,7 @@ static int sock = -1, rtnl = -1;
> >  static int if_index = 0;
> >  static char if_name[IF_NAMESIZE] = {0};
> >  static volatile int rs_attempt = 0;
> > +static const int rs_attempt_limit = 4;
> >  static struct in6_addr lladdr = IN6ADDR_ANY_INIT;
> >  static unsigned int ra_options = 0;
> >  static unsigned int ra_holdoff_interval = 0;
> > @@ -179,6 +180,20 @@ failure:
> > return -1;
> >  }
> >
> > +void ra_restart(void)
> > +{
> > +   const int rs_attempt_old = rs_attempt;
> > +
> > +   odhcp6c_clear_state(STATE_RA_PREFIX);
> > +   odhcp6c_clear_state(STATE_RA_ROUTE);
> > +   odhcp6c_clear_state(STATE_RA_DNS);
> > +   odhcp6c_clear_state(STATE_RA_SEARCH);
> > +
> > +   rs_attempt = 0;
> > +   if (rs_attempt_old == 0 || rs_attempt_old >= rs_attempt_limit)
> > +   ra_send_rs(SIGALRM);
> > +}
> > +
> >  static void ra_send_rs(int signal __attribute__((unused)))
> >  {
> > const struct sockaddr_in6 dest = {AF_INET6, 0, 0,
> ALL_IPV6_ROUTERS, if_index};
> > @@ -193,7 +208,7 @@ static void ra_send_rs(int signal
> __attribute__((unused)))
> > if (sendto(sock, , len, MSG_DONTWAIT, (struct
> sockaddr*), sizeof(dest)) < 0)
> > syslog(LOG_ERR, "Failed to send RS (%s)",
> strerror(errno));
> >
> > -   if (++rs_attempt <= 3)
> > +   if (++rs_attempt < rs_attempt_limit)
> > alarm(4);
> >  }
> >
> > @@ -243,8 +258,7 @@ bool ra_link_up(void)
> > if (ret) {
> > syslog(LOG_NOTICE, "carrier => %i event on %s",
> (int)!nocarrier, if_name);
> >
> > -   rs_attempt = 0;
> > -   ra_send_rs(SIGALRM);
> > +   ra_restart();
> > }
> >
> > return ret;
> > diff --git a/src/ra.h b/src/ra.h
> > index 9acc8cd..4ec208f 100644
> > --- a/src/ra.h
> > +++ b/src/ra.h
> > @@ -46,5 +46,6 @@ struct icmpv6_opt_route_info {
> >
> >  int ra_init(const char *ifname, const struct in6_addr *ifid,
> > unsigned int options, unsigned int holdoff_interval);
> > +void ra_restart(void);
> >  bool ra_link_up(void);
> >  bool ra_process(void);
> > --
> > 2.21.0
> >
> >
> > ___
> > openwrt-devel mailing list
> > openwrt-devel@lists.openwrt.org
> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
___
openwrt-devel 

[OpenWrt-Devel] [PATCH 2/2] ath79: engenius epg5000: add leds migration script

2019-03-18 Thread Tomasz Maciej Nowak
With transition from ar71xx to ath79 some of devices change their naming
of LEDs. When upgrading from ar71xx target images this will require the
user to adjust previously working configuration. This commit adds
migration script which can be used to rename old names to new ones.
With this previously working configuration will be automatically
adjusted, wihtout user intervention.

This commit adds migration case for EnGenius EPG5000, the wireless LEDs
names have changed from epg5000:blue:wlan2-g and epg5000:blue:wlan-5g to
epg5000:blue:wlan2g and epg5000:blue:wlan5g.

Signed-off-by: Tomasz Maciej Nowak 
---
 .../base-files/etc/uci-defaults/04_led_migration | 16 
 1 file changed, 16 insertions(+)
 create mode 100644 
target/linux/ath79/base-files/etc/uci-defaults/04_led_migration

diff --git a/target/linux/ath79/base-files/etc/uci-defaults/04_led_migration 
b/target/linux/ath79/base-files/etc/uci-defaults/04_led_migration
new file mode 100644
index 00..2ca87ccb34
--- /dev/null
+++ b/target/linux/ath79/base-files/etc/uci-defaults/04_led_migration
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+. /lib/functions.sh
+. /lib/functions/migrations.sh
+
+board=$(board_name)
+
+case "$board" in
+engenius,epg5000)
+   migrate_leds ":wlan-2g=:wlan2g" ":wlan-5g=:wlan5g"
+   ;;
+esac
+
+migrations_apply system
+
+exit 0
-- 
2.21.0


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


[OpenWrt-Devel] [PATCH 1/2] base-files: add leds migration

2019-03-18 Thread Tomasz Maciej Nowak
Currently leds migration scripts in ar71xx and lantiq share a lot of
logic and introducing leds migration to another target would mean
copying this code, again. Therefore move common logic to library in
base-files package.

Suggested-by: Petr Štetiar 
Signed-off-by: Petr Štetiar 
Signed-off-by: Tomasz Maciej Nowak 
---
 .../files/lib/functions/migrations.sh | 39 ++
 .../etc/uci-defaults/04_led_migration | 39 +-
 .../etc/uci-defaults/01_led_migration | 40 +--
 3 files changed, 43 insertions(+), 75 deletions(-)
 create mode 100644 package/base-files/files/lib/functions/migrations.sh

diff --git a/package/base-files/files/lib/functions/migrations.sh 
b/package/base-files/files/lib/functions/migrations.sh
new file mode 100644
index 00..b180a0242f
--- /dev/null
+++ b/package/base-files/files/lib/functions/migrations.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+. /lib/functions.sh
+
+migrate_led_sysfs() {
+   local cfg="$1"; shift
+   local tuples="$@"
+   local sysfs
+   local name
+
+   config_get sysfs ${cfg} sysfs
+   config_get name ${cfg} name
+
+   [ -z "${sysfs}" ] && return
+
+   for tuple in ${tuples}; do
+   local old=${tuple%=*}
+   local new=${tuple#*=}
+   local new_sysfs
+
+   new_sysfs=$(echo ${sysfs} | sed "s/${old}/${new}/")
+
+   [ "${new_sysfs}" = "${sysfs}" ] && continue
+
+   uci set system.${cfg}.sysfs="${new_sysfs}"
+
+   logger -t led-migration "sysfs option of LED \"${name}\" 
updated to ${new_sysfs}"
+   done;
+}
+
+migrate_leds() {
+   config_load system
+   config_foreach migrate_led_sysfs led "$@"
+}
+
+migrations_apply() {
+   local realm="$1"
+   [ -n "$(uci changes ${realm})" ] && uci -q commit ${realm}
+}
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/04_led_migration 
b/target/linux/ar71xx/base-files/etc/uci-defaults/04_led_migration
index 4dd224b549..5b78d9a910 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/04_led_migration
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/04_led_migration
@@ -3,43 +3,8 @@
 # Copyright (C) 2013 OpenWrt.org
 #
 
-LED_OPTIONS_CHANGED=0
-
 . /lib/functions.sh
-
-do_led_update_sysfs()
-{
-   local cfg=$1; shift
-   local tuples="$@"
-   local sysfs
-   local name
-
-   config_get sysfs $cfg sysfs
-   config_get name $cfg name
-
-   [ -z "$sysfs" ] && return
-
-   for tuple in $tuples; do
-   local old=${tuple%=*}
-   local new=${tuple#*=}
-   local new_sysfs
-
-   new_sysfs=$(echo ${sysfs} | sed "s/${old}/${new}/")
-
-   [ "$new_sysfs" = "$sysfs" ] && continue
-
-   uci set system.${cfg}.sysfs="${new_sysfs}"
-   LED_OPTIONS_CHANGED=1
-
-   logger -t led-migration "sysfs option of LED \"${name}\" 
updated to ${new_sysfs}"
-   done;
-}
-
-migrate_leds()
-{
-   config_load system
-   config_foreach do_led_update_sysfs led "$@"
-}
+. /lib/functions/migrations.sh
 
 board=$(board_name)
 
@@ -76,6 +41,6 @@ wnr612-v2)
;;
 esac
 
-[ "$LED_OPTIONS_CHANGED" = "1" ] && uci commit system
+migrations_apply system
 
 exit 0
diff --git a/target/linux/lantiq/base-files/etc/uci-defaults/01_led_migration 
b/target/linux/lantiq/base-files/etc/uci-defaults/01_led_migration
index dc594e35e9..b14751b6e6 100644
--- a/target/linux/lantiq/base-files/etc/uci-defaults/01_led_migration
+++ b/target/linux/lantiq/base-files/etc/uci-defaults/01_led_migration
@@ -3,37 +3,8 @@
 # Copyright (C) 2013 OpenWrt.org
 #
 
-LED_OPTIONS_CHANGED=0
-
 . /lib/functions.sh
-
-do_led_update_sysfs()
-{
-   local cfg=$1; shift
-   local tuples="$@"
-   local sysfs
-   local name
-
-   config_get sysfs $cfg sysfs
-   config_get name $cfg name
-
-   [ -z "$sysfs" ] && return
-
-   for tuple in $tuples; do
-   local old=${tuple%=*}
-   local new=${tuple#*=}
-   local new_sysfs
-
-   new_sysfs=$(echo ${sysfs} | sed "s/${old}/${new}/")
-
-   [ "$new_sysfs" = "$sysfs" ] && continue
-
-   uci set system.${cfg}.sysfs="${new_sysfs}"
-   LED_OPTIONS_CHANGED=1
-
-   logger -t led-migration "sysfs option of LED \"${name}\" 
updated to ${new_sysfs}"
-   done;
-}
+. /lib/functions/migrations.sh
 
 do_internet_led_rename()
 {
@@ -45,16 +16,9 @@ do_internet_led_rename()
uci rename system.led_internet=led_dsl
uci set system.led_dsl.name=dsl
 
-   LED_OPTIONS_CHANGED=1
logger -t led-migration "internet led renamed to dsl"
 }
 
-migrate_leds()
-{
-   config_load system
-   config_foreach do_led_update_sysfs led "$@"
-}
-
 case "$(board_name)" in
 arcadyan,arv452cqw|\
 arcadyan,arv7510pw22|\
@@ -77,6 +41,6 @@ netgear,dgn3500b)
;;
 esac
 
-[ "$LED_OPTIONS_CHANGED" 

Re: [OpenWrt-Devel] [PATCH] ramips: Speed up eeprom read/write

2019-03-18 Thread mail
> -Original Message-
> From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
> On Behalf Of Tom Psyborg
> Sent: Montag, 18. März 2019 15:51
> To: Rosen Penev 
> Cc: Adrian Schmutzler ; OpenWrt
> Development List 
> Subject: Re: [OpenWrt-Devel] [PATCH] ramips: Speed up eeprom read/write
> 
> So, how enourmous boot speed-up did it achieve? I'd say not much since you
> read like what 500bytes of eeprom data?
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

On ipq40xx, the test went from 0.28s to 0.01s for a 12k test. (RT-AC58U, which 
has SPI-NAND)

On other targets (ath79/ar71xx) I went from ~16s to about 0.02s for a 4k test.

Since I do not own a ramips device, I cannot test it myself.


pgp_iCKPM8c70.pgp
Description: PGP signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] [odhcp6c] ra: clear RA information and request new after link-up event or SIGUSR2

2019-03-18 Thread Hans Dedecker
Hi,

On Mon, Mar 18, 2019 at 2:43 PM  wrote:
>
> From: Pavel Merzlyakov 
>
> A subnet may be changed after link-up event
Can you be elaborate more in detail what use case you want to cover
with this patch; in other words what is not working now ?
>
> Signed-off-by: Pavel Merzlyakov 
> ---
>  src/odhcp6c.c |  3 +++
>  src/ra.c  | 20 +---
>  src/ra.h  |  1 +
>  3 files changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/src/odhcp6c.c b/src/odhcp6c.c
> index 19a86f2..dd20f39 100644
> --- a/src/odhcp6c.c
> +++ b/src/odhcp6c.c
> @@ -455,6 +455,9 @@ int main(_unused int argc, char* const argv[])
>
> syslog(LOG_NOTICE, "(re)starting transaction on %s", ifname);
>
> +   if (signal_usr2)
> +   ra_restart();
Why do you want to restart RA if an SIGUSR2 signal is received ?

Hans
> +
> signal_usr1 = signal_usr2 = false;
> int mode = dhcpv6_set_ia_mode(ia_na_mode, ia_pd_mode);
> if (mode != DHCPV6_STATELESS)
> diff --git a/src/ra.c b/src/ra.c
> index 898f449..917df11 100644
> --- a/src/ra.c
> +++ b/src/ra.c
> @@ -55,6 +55,7 @@ static int sock = -1, rtnl = -1;
>  static int if_index = 0;
>  static char if_name[IF_NAMESIZE] = {0};
>  static volatile int rs_attempt = 0;
> +static const int rs_attempt_limit = 4;
>  static struct in6_addr lladdr = IN6ADDR_ANY_INIT;
>  static unsigned int ra_options = 0;
>  static unsigned int ra_holdoff_interval = 0;
> @@ -179,6 +180,20 @@ failure:
> return -1;
>  }
>
> +void ra_restart(void)
> +{
> +   const int rs_attempt_old = rs_attempt;
> +
> +   odhcp6c_clear_state(STATE_RA_PREFIX);
> +   odhcp6c_clear_state(STATE_RA_ROUTE);
> +   odhcp6c_clear_state(STATE_RA_DNS);
> +   odhcp6c_clear_state(STATE_RA_SEARCH);
> +
> +   rs_attempt = 0;
> +   if (rs_attempt_old == 0 || rs_attempt_old >= rs_attempt_limit)
> +   ra_send_rs(SIGALRM);
> +}
> +
>  static void ra_send_rs(int signal __attribute__((unused)))
>  {
> const struct sockaddr_in6 dest = {AF_INET6, 0, 0, ALL_IPV6_ROUTERS, 
> if_index};
> @@ -193,7 +208,7 @@ static void ra_send_rs(int signal __attribute__((unused)))
> if (sendto(sock, , len, MSG_DONTWAIT, (struct sockaddr*), 
> sizeof(dest)) < 0)
> syslog(LOG_ERR, "Failed to send RS (%s)",  strerror(errno));
>
> -   if (++rs_attempt <= 3)
> +   if (++rs_attempt < rs_attempt_limit)
> alarm(4);
>  }
>
> @@ -243,8 +258,7 @@ bool ra_link_up(void)
> if (ret) {
> syslog(LOG_NOTICE, "carrier => %i event on %s", 
> (int)!nocarrier, if_name);
>
> -   rs_attempt = 0;
> -   ra_send_rs(SIGALRM);
> +   ra_restart();
> }
>
> return ret;
> diff --git a/src/ra.h b/src/ra.h
> index 9acc8cd..4ec208f 100644
> --- a/src/ra.h
> +++ b/src/ra.h
> @@ -46,5 +46,6 @@ struct icmpv6_opt_route_info {
>
>  int ra_init(const char *ifname, const struct in6_addr *ifid,
> unsigned int options, unsigned int holdoff_interval);
> +void ra_restart(void);
>  bool ra_link_up(void);
>  bool ra_process(void);
> --
> 2.21.0
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

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


Re: [OpenWrt-Devel] [PATCH] ramips: Speed up eeprom read/write

2019-03-18 Thread Daniel Golle
On Mon, Mar 18, 2019 at 03:51:09PM +0100, Tom Psyborg wrote:
> So, how enourmous boot speed-up did it achieve? I'd say not much since
> you read like what 500bytes of eeprom data?

Extracting 500b out of lets say 256kb is still more than 500 offsets
to be probed. If you do that byte-by-byte it's much slower than
doing it block-by-block.

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


Re: [OpenWrt-Devel] [PATCH] ramips: Speed up eeprom read/write

2019-03-18 Thread Tom Psyborg
So, how enourmous boot speed-up did it achieve? I'd say not much since
you read like what 500bytes of eeprom data?

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


[OpenWrt-Devel] [PATCH] [odhcp6c] ra: clear RA information and request new after link-up event or SIGUSR2

2019-03-18 Thread pavel . merzlyakov
From: Pavel Merzlyakov 

A subnet may be changed after link-up event

Signed-off-by: Pavel Merzlyakov 
---
 src/odhcp6c.c |  3 +++
 src/ra.c  | 20 +---
 src/ra.h  |  1 +
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/src/odhcp6c.c b/src/odhcp6c.c
index 19a86f2..dd20f39 100644
--- a/src/odhcp6c.c
+++ b/src/odhcp6c.c
@@ -455,6 +455,9 @@ int main(_unused int argc, char* const argv[])
 
syslog(LOG_NOTICE, "(re)starting transaction on %s", ifname);
 
+   if (signal_usr2)
+   ra_restart();
+
signal_usr1 = signal_usr2 = false;
int mode = dhcpv6_set_ia_mode(ia_na_mode, ia_pd_mode);
if (mode != DHCPV6_STATELESS)
diff --git a/src/ra.c b/src/ra.c
index 898f449..917df11 100644
--- a/src/ra.c
+++ b/src/ra.c
@@ -55,6 +55,7 @@ static int sock = -1, rtnl = -1;
 static int if_index = 0;
 static char if_name[IF_NAMESIZE] = {0};
 static volatile int rs_attempt = 0;
+static const int rs_attempt_limit = 4;
 static struct in6_addr lladdr = IN6ADDR_ANY_INIT;
 static unsigned int ra_options = 0;
 static unsigned int ra_holdoff_interval = 0;
@@ -179,6 +180,20 @@ failure:
return -1;
 }
 
+void ra_restart(void)
+{
+   const int rs_attempt_old = rs_attempt;
+
+   odhcp6c_clear_state(STATE_RA_PREFIX);
+   odhcp6c_clear_state(STATE_RA_ROUTE);
+   odhcp6c_clear_state(STATE_RA_DNS);
+   odhcp6c_clear_state(STATE_RA_SEARCH);
+
+   rs_attempt = 0;
+   if (rs_attempt_old == 0 || rs_attempt_old >= rs_attempt_limit)
+   ra_send_rs(SIGALRM);
+}
+
 static void ra_send_rs(int signal __attribute__((unused)))
 {
const struct sockaddr_in6 dest = {AF_INET6, 0, 0, ALL_IPV6_ROUTERS, 
if_index};
@@ -193,7 +208,7 @@ static void ra_send_rs(int signal __attribute__((unused)))
if (sendto(sock, , len, MSG_DONTWAIT, (struct sockaddr*), 
sizeof(dest)) < 0)
syslog(LOG_ERR, "Failed to send RS (%s)",  strerror(errno));
 
-   if (++rs_attempt <= 3)
+   if (++rs_attempt < rs_attempt_limit)
alarm(4);
 }
 
@@ -243,8 +258,7 @@ bool ra_link_up(void)
if (ret) {
syslog(LOG_NOTICE, "carrier => %i event on %s", 
(int)!nocarrier, if_name);
 
-   rs_attempt = 0;
-   ra_send_rs(SIGALRM);
+   ra_restart();
}
 
return ret;
diff --git a/src/ra.h b/src/ra.h
index 9acc8cd..4ec208f 100644
--- a/src/ra.h
+++ b/src/ra.h
@@ -46,5 +46,6 @@ struct icmpv6_opt_route_info {
 
 int ra_init(const char *ifname, const struct in6_addr *ifid,
unsigned int options, unsigned int holdoff_interval);
+void ra_restart(void);
 bool ra_link_up(void);
 bool ra_process(void);
-- 
2.21.0


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


Re: [OpenWrt-Devel] Meson/Ninja build system

2019-03-18 Thread Petr Štetiar
Daniel Engberg  [2019-03-18 13:55:07]:

Hi,

> Having a look at https://www.python.org/dev/peps/pep-0537/#lifespan it seems
> like a good idea to stick with 3.7?

it's a PITA to demand versions which are not packaged in current versions of LTS
Linux distros. Since Meson is a build system generator, I hope, that it's
going to work with any Python 3 version, but can't find any details about
Meson's Python version requirements.

-- ynezz

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


Re: [OpenWrt-Devel] Meson/Ninja build system

2019-03-18 Thread Jo-Philipp Wich
Hi,

> I think the cmake.mk-link approach would be a good idea and given 
> previous discussions the plan is afaik to pull in Ninja first and 
> once that's confirmed working via CMake add support for Meson.

fine with me.

> Having a look at https://www.python.org/dev/peps/pep-0537/#lifespan 
> it seems like a good idea to stick with 3.7?

No opinion.

> As for OpenWrt, there are already files with hard dependency of 
> python3 dating back to 2015 doing a quick grep of the source tree.
> 
> https://github.com/openwrt/openwrt/blob/master/scripts/dl_cleanup.py
> https://github.com/openwrt/openwrt/blob/master/scripts/flashing/eva_ramboot.py

Both files are supplemental scripts not used as part of the actual build
process.

> There are also upstream projects like wireless-db that doesn't 
> compile/build cleanly with vanilla 2.7 
> https://github.com/openwrt/openwrt/pull/1521

On the other end of the spectrum there is SCons (include/scons.mk) which
apparently explicitly does not support Python 3 [1].

Having to depend on two Python versions is not ideal. Maybe it is worth
sacrificing scons support for meson, depending on the number of users.

~ Jo

1:
https://bitbucket.org/scons/scons/wiki/FrequentlyAskedQuestions#markdown-header-am-i-restricted-to-using-python-24-code-in-my-sconscript-files



signature.asc
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Meson/Ninja build system

2019-03-18 Thread Daniel Engberg

Hi,

I think the cmake.mk-link approach would be a good idea and given 
previous discussions the plan is afaik to pull in Ninja first and once 
that's confirmed working via CMake add support for Meson. Having a look 
at https://www.python.org/dev/peps/pep-0537/#lifespan it seems like a 
good idea to stick with 3.7?


As for OpenWrt, there are already files with hard dependency of python3 
dating back to 2015 doing a quick grep of the source tree.


https://github.com/openwrt/openwrt/blob/master/scripts/dl_cleanup.py
https://github.com/openwrt/openwrt/blob/master/scripts/flashing/eva_ramboot.py 
(added recently)


CCed: Jan

There are also upstream projects like wireless-db that doesn't 
compile/build cleanly with vanilla 2.7

https://github.com/openwrt/openwrt/pull/1521

Best regards,
Daniel

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


Re: [OpenWrt-Devel] Meson/Ninja build system

2019-03-18 Thread Jo-Philipp Wich
Hi Jan,

> I'm trying to add ninja and meson to packages feed. The reason for that
> is described here https://github.com/openwrt/openwrt/pull/1871 and
> https://github.com/openwrt/packages/issues/8315 .

great to hear that! I think eventually there should be a
"tools/meson/Makefile" along with an "include/meson.mk" similar to how
Cmake is handled in Buildroot.

I don't think it is necessary to actually add a Python 3 host build as
well since the Buildroot already build-depends on a system Python, but
only on 2.x while Meson requires 3.

> If you want to look at that, my test repo is here
> https://github.com/ja-pa/meson-turris but it's not ready for primetime
> yet...

Allright. Will check it out, thanks!

~ Jo



signature.asc
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Meson/Ninja build system

2019-03-18 Thread Jan Pavlinec
Hi,

I'm trying to add ninja and meson to packages feed. The reason for that
is described here https://github.com/openwrt/openwrt/pull/1871 and
https://github.com/openwrt/packages/issues/8315 .
If you want to look at that, my test repo is here
https://github.com/ja-pa/meson-turris but it's not ready for primetime
yet...

Regards,

J.P.


Dne 18. 03. 19 v 13:09 Jo-Philipp Wich napsal(a):
> Hi,
>
>> A number of upstream projects are beginning to use the Meson/Ninja build
>> system. OpenWrt's sound/mpc and libs/libmpdclient kludge around this,
>> and I would like to update the glib2 package. The latest version of
>> glib2 uses Meson/Ninja.
> just what the world needed, yet another build system :)
>
>> Is there any plan to build the Meson/Ninja environment into the OpenWrt
>> build system?
> I took a quick look at "meson" but got confused after it referred to
> something else called "ninja". So it appears to be some high level thing
> producing other lowlevel things which then do stuff.
>
> I am not aware of any developer actively working on support for this, so
> a patch would be greatly appreciated. At least there are no plans to
> *not* support it.
>
> One nuisance is that it appears to mandate Python 3 while OpenWrt
> buildroot currently requires Python 2.7 - so in order to avoid depending
> on both versions, all the existing buildroot python users probably need
> to be ported to Python 3 first.
>
> Regards,
> Jo
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Meson/Ninja build system

2019-03-18 Thread Jo-Philipp Wich
Hi,

> A number of upstream projects are beginning to use the Meson/Ninja build
> system. OpenWrt's sound/mpc and libs/libmpdclient kludge around this,
> and I would like to update the glib2 package. The latest version of
> glib2 uses Meson/Ninja.

just what the world needed, yet another build system :)

> Is there any plan to build the Meson/Ninja environment into the OpenWrt
> build system?

I took a quick look at "meson" but got confused after it referred to
something else called "ninja". So it appears to be some high level thing
producing other lowlevel things which then do stuff.

I am not aware of any developer actively working on support for this, so
a patch would be greatly appreciated. At least there are no plans to
*not* support it.

One nuisance is that it appears to mandate Python 3 while OpenWrt
buildroot currently requires Python 2.7 - so in order to avoid depending
on both versions, all the existing buildroot python users probably need
to be ported to Python 3 first.

Regards,
Jo



signature.asc
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] [ubox] kmodloader: fix and optimize loading of failed modules

2019-03-18 Thread pavel . merzlyakov
From: Pavel Merzlyakov 

1) Restore functionality which was lost in commit 876c7f5b.
   Again at boot time kmodloader can load all modules (/etc/modules.d/*)
   even if dependency information is completely missing.
   This functionality is important in case of hidden dependency (not symbol 
dependency).
   For example, in kernel 4.4.60 is hidden dependency between nf_nat_ipv6 and 
nf_conntrack_ipv6.
   We can't load nf_nat_ipv6 before nf_conntrack_ipv6 and modinfo do not show 
this dependency.
   Two sequential load attempts of nf_nat_ipv6 may not be enough (in my case 
it's definitely not enough).
   nf_nat_ipv4 has a similar problem.

2) Reduce count of attempts to load failed modules.
   Now kmodloader try to load failed modules after all others are loaded.

main_loader: Count of failed and successful attempts to load nf_nat_ipv6.ko 
(kernel 4.4.60) depend on ubox version:
   COMMITFAILED  SUCCESSFUL TOTAL
   128bc35f  53  1  54
   876c7f5b  2   0  2
   this  1   1  2

Signed-off-by: Pavel Merzlyakov 
---
 kmodloader.c | 39 ---
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/kmodloader.c b/kmodloader.c
index 3196deb..e0f4e6d 100644
--- a/kmodloader.c
+++ b/kmodloader.c
@@ -615,12 +615,13 @@ static void load_moddeps(struct module *_m)
}
 }
 
-static int iterations = 0;
-static int load_modprobe(void)
+static int load_modprobe(bool allow_load_retry)
 {
-   int loaded, todo;
+   int loaded, skipped, failed;
struct module_node *mn;
struct module *m;
+   bool load_retry = false;
+   static bool first_iteration = true;
 
avl_for_each_element(, mn, avl) {
if (mn->is_alias)
@@ -632,12 +633,13 @@ static int load_modprobe(void)
 
do {
loaded = 0;
-   todo = 0;
+   skipped = 0;
+   failed = 0;
avl_for_each_element(, mn, avl) {
if (mn->is_alias)
continue;
m = mn->m;
-   if ((m->state == PROBE) && (!deps_available(m, 0)) && 
m->error < 2) {
+   if ((m->state == PROBE) && (!deps_available(m, 0)) && 
(!m->error || load_retry)) {
if (!insert_module(get_module_path(m->name), 
(m->opts) ? (m->opts) : (""))) {
m->state = LOADED;
m->error = 0;
@@ -645,17 +647,24 @@ static int load_modprobe(void)
continue;
}
 
-   if (++m->error > 1)
-   ULOG_ERR("failed to load %s\n", 
m->name);
+   m->error = 1;
}
 
-   if ((m->state == PROBE) || m->error)
-   todo++;
+   if (m->error)
+   failed++;
+   else if (m->state == PROBE)
+   skipped++;
}
-   iterations++;
-   } while (loaded);
 
-   return todo;
+   if (allow_load_retry) {
+   /* if we can't load anything else let's try to load 
failed modules */
+   load_retry = loaded ? (failed && !skipped) : (failed && 
!load_retry && !first_iteration);
+   }
+
+   first_iteration = false;
+   } while (loaded || load_retry);
+
+   return skipped + failed;
 }
 
 static int print_insmod_usage(void)
@@ -884,7 +893,7 @@ static int main_modprobe(int argc, char **argv)
 
m->state = PROBE;
 
-   fail = load_modprobe();
+   fail = load_modprobe(true);
 
if (fail) {
ULOG_ERR("%d module%s could not be probed\n",
@@ -972,14 +981,14 @@ static int main_loader(int argc, char **argv)
m->opts = strdup(opts);
m->state = PROBE;
if (basename(gl.gl_pathv[j])[0] - '0' <= 9)
-   load_modprobe();
+   load_modprobe(false);
 
}
free(mod);
fclose(fp);
}
 
-   fail = load_modprobe();
+   fail = load_modprobe(true);
 
if (fail) {
ULOG_ERR("%d module%s could not be probed\n",
-- 
2.21.0


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