[PATCH] netifd: add possibility to switch off route config

2020-11-23 Thread Florian Eckert
This change adds the new configuration option `disabled` for the route
section, which can be used to temporarily disable the section so that
the route is not set. The advantage is that I do not have to delete the
whole configuration to achieve this.

config route
  option disabled '1

Signed-off-by: Florian Eckert 
---
 .../patches/001-make-route-disable.patch  | 29 +++
 1 file changed, 29 insertions(+)
 create mode 100644 
package/network/config/netifd/patches/001-make-route-disable.patch

diff --git a/package/network/config/netifd/patches/001-make-route-disable.patch 
b/package/network/config/netifd/patches/001-make-route-disable.patch
new file mode 100644
index 00..8184449e4e
--- /dev/null
+++ b/package/network/config/netifd/patches/001-make-route-disable.patch
@@ -0,0 +1,29 @@
+--- a/interface-ip.c
 b/interface-ip.c
+@@ -49,6 +49,7 @@ enum {
+   ROUTE_ONLINK,
+   ROUTE_TYPE,
+   ROUTE_PROTO,
++  ROUTE_DISABLED,
+   __ROUTE_MAX
+ };
+ 
+@@ -65,6 +66,7 @@ static const struct blobmsg_policy route
+   [ROUTE_ONLINK] = { .name = "onlink", .type = BLOBMSG_TYPE_BOOL },
+   [ROUTE_TYPE] = { .name = "type", .type = BLOBMSG_TYPE_STRING },
+   [ROUTE_PROTO] = { .name = "proto", .type = BLOBMSG_TYPE_STRING },
++  [ROUTE_DISABLED] = { .name = "disabled", .type = BLOBMSG_TYPE_BOOL },
+ };
+ 
+ const struct uci_blob_param_list route_attr_list = {
+@@ -400,6 +402,10 @@ interface_ip_add_route(struct interface
+ 
+   blobmsg_parse(route_attr, __ROUTE_MAX, tb, blobmsg_data(attr), 
blobmsg_data_len(attr));
+ 
++  if ((cur = tb[ROUTE_DISABLED]) != NULL && blobmsg_get_bool(cur)) {
++  return;
++  }
++
+   if (!iface) {
+   if ((cur = tb[ROUTE_INTERFACE]) == NULL)
+   return;
-- 
2.20.1


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


[Patch v2] netifd: add possibility to switch off route config

2020-11-23 Thread Florian Eckert
This change adds the new configuration option `disabled` for the route
section, which can be used to temporarily disable the section so that
the route is not set. The advantage is that we do not have to delete
this route configuration section to achieve this.

config route
  option disabled '1

Signed-off-by: Florian Eckert 
---

V2:
  - Fix code style
  - Create patch from netif repository

 interface-ip.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/interface-ip.c b/interface-ip.c
index 6efc3c5..e14a154 100644
--- a/interface-ip.c
+++ b/interface-ip.c
@@ -49,6 +49,7 @@ enum {
ROUTE_ONLINK,
ROUTE_TYPE,
ROUTE_PROTO,
+   ROUTE_DISABLED,
__ROUTE_MAX
 };
 
@@ -65,6 +66,7 @@ static const struct blobmsg_policy route_attr[__ROUTE_MAX] = {
[ROUTE_ONLINK] = { .name = "onlink", .type = BLOBMSG_TYPE_BOOL },
[ROUTE_TYPE] = { .name = "type", .type = BLOBMSG_TYPE_STRING },
[ROUTE_PROTO] = { .name = "proto", .type = BLOBMSG_TYPE_STRING },
+   [ROUTE_DISABLED] = { .name = "disabled", .type = BLOBMSG_TYPE_BOOL },
 };
 
 const struct uci_blob_param_list route_attr_list = {
@@ -400,6 +402,9 @@ interface_ip_add_route(struct interface *iface, struct 
blob_attr *attr, bool v6)
 
blobmsg_parse(route_attr, __ROUTE_MAX, tb, blobmsg_data(attr), 
blobmsg_data_len(attr));
 
+   if ((cur = tb[ROUTE_DISABLED]) != NULL && blobmsg_get_bool(cur))
+   return;
+
if (!iface) {
if ((cur = tb[ROUTE_INTERFACE]) == NULL)
return;
-- 
2.20.1


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


[PATCH 1/5] procd: add restart ubus call

2020-12-02 Thread Florian Eckert
To allow other services to respsond to a restart event from a procd initialised
service, a new ubus method "restart" in the ubus "service" path is needed
to trigger a ubus notify and also execute the installed service triggers.

Cc: Aaron Goodman 
Signed-off-by: Florian Eckert 
The original implementation is by Aaron Goodman.
---
 .../patches/0010-add-restart-event.patch  | 64 +++
 1 file changed, 64 insertions(+)
 create mode 100644 package/system/procd/patches/0010-add-restart-event.patch

diff --git a/package/system/procd/patches/0010-add-restart-event.patch 
b/package/system/procd/patches/0010-add-restart-event.patch
new file mode 100644
index 00..86ec3d38e1
--- /dev/null
+++ b/package/system/procd/patches/0010-add-restart-event.patch
@@ -0,0 +1,64 @@
+--- a/service/service.c
 b/service/service.c
+@@ -204,6 +204,17 @@ static const struct blobmsg_policy servi
+ };
+ 
+ enum {
++  SERVICE_RESTART_ATTR_NAME,
++  SERVICE_RESTART_ATTR_INSTANCE,
++  __SERVICE_RESTART_ATTR_MAX,
++};
++
++static const struct blobmsg_policy 
service_restart_attrs[__SERVICE_RESTART_ATTR_MAX] = {
++  [SERVICE_RESTART_ATTR_NAME] = { "name", BLOBMSG_TYPE_STRING },
++  [SERVICE_RESTART_ATTR_INSTANCE] = { "instance", BLOBMSG_TYPE_STRING },
++};
++
++enum {
+   SERVICE_DEL_ATTR_NAME,
+   SERVICE_DEL_ATTR_INSTANCE,
+   __SERVICE_DEL_ATTR_MAX,
+@@ -681,6 +692,35 @@ service_handle_update(struct ubus_contex
+   return 0;
+ }
+ 
++static int
++service_handle_restart(struct ubus_context *ctx, struct ubus_object *obj,
++ struct ubus_request_data *req, const char *method,
++ struct blob_attr *msg)
++{
++  struct blob_attr *tb[__SERVICE_RESTART_ATTR_MAX], *cur;
++  struct service *s = NULL;
++  const char *name;
++
++  blobmsg_parse(service_set_attrs, __SERVICE_RESTART_ATTR_MAX, tb, 
blobmsg_data(msg), blobmsg_data_len(msg));
++  cur = tb[SERVICE_RESTART_ATTR_NAME];
++  if (!cur)
++  return UBUS_STATUS_INVALID_ARGUMENT;
++
++  name = blobmsg_data(cur);
++
++  s = avl_find_element(&services, name, s, avl);
++  if (!s)
++  return UBUS_STATUS_INVALID_ARGUMENT;
++
++  blob_buf_init(&b, 0);
++  blobmsg_add_string(&b, "service", s->name);
++  trigger_event("service.restart", b.head);
++
++  service_event("service.restart", s->name, NULL);
++
++  return UBUS_STATUS_OK;
++}
++
+ static void ubus_event_bcast(const char *type, const char *param1, const char 
*val1,
+const char *param2, const char *val2)
+ {
+@@ -951,6 +991,7 @@ static struct ubus_method main_object_me
+   UBUS_METHOD("add", service_handle_set, service_set_attrs),
+   UBUS_METHOD("list", service_handle_list, service_list_attrs),
+   UBUS_METHOD("delete", service_handle_delete, service_del_attrs),
++  UBUS_METHOD("restart", service_handle_restart, service_restart_attrs),
+   UBUS_METHOD("signal", service_handle_signal, service_signal_attrs),
+   UBUS_METHOD("update_start", service_handle_update, service_attrs),
+   UBUS_METHOD("update_complete", service_handle_update, service_attrs),
-- 
2.20.1


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


[PATCH 2/5] base-files: add restart function wrapper

2020-12-02 Thread Florian Eckert
Thies commit add the new wrapper function to rc.common to execute the new ubus
service method "restart" on a service restart.

Signed-off-by: Florian Eckert 
---
 package/base-files/files/etc/rc.common | 13 +
 1 file changed, 13 insertions(+)

diff --git a/package/base-files/files/etc/rc.common 
b/package/base-files/files/etc/rc.common
index f39b69464e..ad5af4b7a1 100755
--- a/package/base-files/files/etc/rc.common
+++ b/package/base-files/files/etc/rc.common
@@ -139,6 +139,19 @@ extra_command "enabled" "Check if service is started on 
boot"
fi
}
 
+   restart() {
+   if eval "type restart_service" 2>/dev/null >/dev/null; then
+   restart_service "$@"
+   else
+   trap '' TERM
+   stop "$@"
+   trap - TERM
+   start "$@"
+   fi
+   procd_open_service "$(basename ${basescript:-$initscript})" 
"$initscript"
+   procd_close_service "restart"
+   }
+
trace() {
TRACE_SYSCALLS=1
start "$@"
-- 
2.20.1


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


[PATCH 3/5] firewall: fix whitespace

2020-12-02 Thread Florian Eckert
Remove trailing whitespace.

Signed-off-by: Florian Eckert 
---
 package/network/config/firewall/files/firewall.init | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/config/firewall/files/firewall.init 
b/package/network/config/firewall/files/firewall.init
index ee3ed1a283..4c2fb7b617 100755
--- a/package/network/config/firewall/files/firewall.init
+++ b/package/network/config/firewall/files/firewall.init
@@ -29,7 +29,7 @@ validate_firewall_rule()
 }
 
 service_triggers() {
-   procd_add_reload_trigger firewall   
+   procd_add_reload_trigger firewall
 
procd_open_validate
validate_firewall_redirect
-- 
2.20.1


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


[PATCH 4/5] firewall: use new restart_service callback

2020-12-02 Thread Florian Eckert
In order that the prcod restart service can also be triggered during a
firewall restart, this call function must be changed.

Signed-off-by: Florian Eckert 
---
 package/network/config/firewall/files/firewall.init | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/config/firewall/files/firewall.init 
b/package/network/config/firewall/files/firewall.init
index 4c2fb7b617..089b02bb4c 100755
--- a/package/network/config/firewall/files/firewall.init
+++ b/package/network/config/firewall/files/firewall.init
@@ -37,7 +37,7 @@ service_triggers() {
procd_close_validate
 }
 
-restart() {
+restart_service() {
fw3 restart
 }
 
-- 
2.20.1


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


[PATCH 5/5] procd: add api wrapper

2020-12-02 Thread Florian Eckert
This commit add a wrapper for procd services, to add a callback script
if the "service.restart" trigger event was fired.

Example:

service_trigger() {
procd_add_trigger
procd_add service_trigger "service.restart" "firewall" 

[PATCH 0/5] ubus: extend the service object with a restart method

2020-12-02 Thread Florian Eckert
This patchset adds the new method "restart" to the ubus service object.
This method is called on a service restart, if it is managed by procd.

I have noticed that during a firewall restart the mwan3 rules have all
disappeared and I have to restart my service as well. I did not expected
this. So that I don't have to do this extra step, an event should be
generated during a service restart.

All services that want to react to this event can create a
callback script. The same applies to a config change.

As an example I used the firewall here, because I came across the
problem here.

Full discussion hat taken place at this URL:
https://github.com/openwrt/packages/pull/13931

Florian Eckert (5):
  procd: add restart ubus call
  base-files: add restart function wrapper
  firewall: fix whitespace
  firewall: use new restart_service callback
  procd: add api wrapper

 package/base-files/files/etc/rc.common| 13 
 .../config/firewall/files/firewall.init   |  4 +-
 package/system/procd/files/procd.sh   | 23 +++
 .../patches/0010-add-restart-event.patch  | 64 +++
 4 files changed, 102 insertions(+), 2 deletions(-)
 create mode 100644 package/system/procd/patches/0010-add-restart-event.patch

-- 
2.20.1


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


[PATCH v2 5/5] procd: add api wrapper

2020-12-03 Thread Florian Eckert
This commit adds the functions `procd_add_service_trigger` and
`procd_add_restart_service_trigger`. In order for the service to be
triggered by another service during a restart, only the function
procd_add_restart_service_trigger is needed.

Example:

service_trigger() {
procd add_restart_service_trigger 'firewall' 
}

If the firewall is restarted, the specified  will be executed.

Signed-off-by: Florian Eckert 
---

Changes since v1:

 - Augment procd_add_service_trigger with
   procd_add_restart_service_trigger

 package/system/procd/files/procd.sh | 33 +
 1 file changed, 33 insertions(+)

diff --git a/package/system/procd/files/procd.sh 
b/package/system/procd/files/procd.sh
index d86b7219da..007c99fca0 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -329,6 +329,37 @@ _procd_add_config_trigger() {
json_close_array
 }
 
+_procd_add_service_trigger() {
+   json_add_array
+   _procd_add_array_data "$1"
+   shift
+
+   json_add_array
+   _procd_add_array_data "if"
+
+   json_add_array
+   _procd_add_array_data "eq" "service" "$1"
+   shift
+   json_close_array
+
+   json_add_array
+   _procd_add_array_data "run_script" "$@"
+   json_close_array
+
+   json_close_array
+   _procd_add_timeout
+   json_close_array
+}
+
+_procd_add_restart_service_trigger() {
+   local service=$1
+   shift
+
+   _procd_open_trigger
+   _procd_add_service_trigger "service.restart" "$service" "$@"
+   _procd_close_trigger
+}
+
 _procd_add_raw_trigger() {
json_add_array
_procd_add_array_data "$1"
@@ -559,6 +590,8 @@ _procd_wrapper \
procd_add_instance \
procd_add_raw_trigger \
procd_add_config_trigger \
+   procd_add_service_trigger \
+   procd_add_restart_service_trigger \
procd_add_interface_trigger \
procd_add_reload_trigger \
procd_add_reload_interface_trigger \
-- 
2.20.1


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


Re: [PATCH] ltq-dsl-base: only lock the dsl pipe once for all stats

2020-12-04 Thread Florian Eckert

Hi


is there any reason not to use the flock style below? It should be more
reliable wrt. unlocking if the script is prematurely terminated.

-- 8< --
  {
  flock -x 1000

  command
  command
  command
  ...
  } 1000>/var/lock/dsl_pipe
-- >8 --


We could also use the procd_lock function [1].
As I already use in mwan3 [2].

Florian

[1] https://github.com/openwrt/openwrt/search?q=procd_lock
[2] https://github.com/openwrt/packages/search?q=procd_lock

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


Re: [RFC] remove x86 qemu images

2020-12-07 Thread Florian Eckert

Hi,


openwrt.git includes an old version of QEMU (0.14 vs 5.1.0 in
packages.git) only to convert x86 images to vdi and vmdk. Is there
anyone actively using the vanilla x86 QEMU images from the upstream
servers or can can we remove that "feature"?


I am building my own openwrt.
So I do not use the upstream vmdk image.
But I use the generated vmdk image by the image builder for a few tests.

If we remove a feature, then we should offer an alternative.
Even if it is only a command.

Regards

Florian

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


[PATCH] procd: add info json output

2020-12-14 Thread Florian Eckert
By adding the extra command `info` it is now possible to retrieve all
relevant data from a procd started service directly via the init script.

Until now, you have to query the ubus with the command:
ubus call service list '{"name":"","verbose":true}'

With this change, the init script is now used with the command:
/etc/init.d/ info

Signed-off-by: Florian Eckert 
---
 package/base-files/files/etc/rc.common |  5 +
 package/system/procd/files/procd.sh| 14 ++
 2 files changed, 19 insertions(+)

diff --git a/package/base-files/files/etc/rc.common 
b/package/base-files/files/etc/rc.common
index f39b69464e..c7fde31d41 100755
--- a/package/base-files/files/etc/rc.common
+++ b/package/base-files/files/etc/rc.common
@@ -121,6 +121,7 @@ extra_command "enabled" "Check if service is started on 
boot"
extra_command "running" "Check if service is running"
extra_command "status" "Service status"
extra_command "trace" "Start with syscall trace"
+   extra_command "info" "Dump service info as json"
 
. $IPKG_INSTROOT/lib/functions/procd.sh
basescript=$(readlink "$initscript")
@@ -173,6 +174,10 @@ extra_command "enabled" "Check if service is started on 
boot"
_procd_status "$(basename ${basescript:-$initscript})" 
"$1"
fi
}
+
+   info() {
+   _procd_info "$(basename ${basescript:-$initscript})"
+   }
 }
 
 ALL_COMMANDS="${ALL_COMMANDS} ${EXTRA_COMMANDS}"
diff --git a/package/system/procd/files/procd.sh 
b/package/system/procd/files/procd.sh
index d86b7219da..1969cdf973 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -474,6 +474,20 @@ _procd_status() {
fi
 }
 
+_procd_info() {
+   local service="$1"
+   local data
+
+   data=$(_procd_ubus_call list | jsonfilter -e '@["'"$service"'"]')
+   [ -z "$data" ] && { echo "not found"; return 3; }
+
+   json_init
+   json_add_string name "$service"
+   json_add_boolean verbose "1"
+   json_add_string name "$service"
+   _procd_ubus_call list
+}
+
 procd_open_data() {
local name="$1"
json_set_namespace procd __procd_old_cb
-- 
2.20.1


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


[PATCH v2] procd: add info json output

2020-12-14 Thread Florian Eckert
By adding the extra command `info` it is now possible to retrieve all
relevant data from a procd started service directly via the init script.

Until now, you have to query the ubus with the command:
ubus call service list '{"name":"","verbose":true}'

With this change, the init script is now used with the command:
/etc/init.d/ info

Signed-off-by: Florian Eckert 
---
v2:
- Remove duplicate json service string

 package/base-files/files/etc/rc.common |  5 +
 package/system/procd/files/procd.sh| 13 +
 2 files changed, 18 insertions(+)

diff --git a/package/base-files/files/etc/rc.common 
b/package/base-files/files/etc/rc.common
index f39b69464e..c7fde31d41 100755
--- a/package/base-files/files/etc/rc.common
+++ b/package/base-files/files/etc/rc.common
@@ -121,6 +121,7 @@ extra_command "enabled" "Check if service is started on 
boot"
extra_command "running" "Check if service is running"
extra_command "status" "Service status"
extra_command "trace" "Start with syscall trace"
+   extra_command "info" "Dump service info as json"
 
. $IPKG_INSTROOT/lib/functions/procd.sh
basescript=$(readlink "$initscript")
@@ -173,6 +174,10 @@ extra_command "enabled" "Check if service is started on 
boot"
_procd_status "$(basename ${basescript:-$initscript})" 
"$1"
fi
}
+
+   info() {
+   _procd_info "$(basename ${basescript:-$initscript})"
+   }
 }
 
 ALL_COMMANDS="${ALL_COMMANDS} ${EXTRA_COMMANDS}"
diff --git a/package/system/procd/files/procd.sh 
b/package/system/procd/files/procd.sh
index d86b7219da..07d5bff8b6 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -474,6 +474,19 @@ _procd_status() {
fi
 }
 
+_procd_info() {
+   local service="$1"
+   local data
+
+   data=$(_procd_ubus_call list | jsonfilter -e '@["'"$service"'"]')
+   [ -z "$data" ] && { echo "not found"; return 3; }
+
+   json_init
+   json_add_string name "$service"
+   json_add_boolean verbose "1"
+   _procd_ubus_call list
+}
+
 procd_open_data() {
local name="$1"
json_set_namespace procd __procd_old_cb
-- 
2.20.1


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


Re: [PATCH v2] procd: add info json output

2020-12-14 Thread Florian Eckert

Hi Petr,


By adding the extra command `info` it is now possible to retrieve all
relevant data from a procd started service directly via the init 
script.


whats the use case, how is this useful?


As already mentioned, it is a improvement to get the information of the 
procd service objects faster.

Until now, you always had to enter the whole string with valid json.
I just don't want to type so much.
And It's always easy to make a typo.

So I thought why not give the procd an extra command for this task.


Until now, you have to query the ubus with the command:
ubus call service list '{"name":"","verbose":true}'

With this change, the init script is now used with the command:
/etc/init.d/ info


I find the `info` name ambiguous and misleading.


I am open about that. I can also imagine `json`.
It should just be short.

Best Regards

Florian

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


[PATCH v3] procd: add procd json output to init

2020-12-17 Thread Florian Eckert
By adding the extra command `procd` it is now possible to retrieve all
relevant data from a procd started service directly via the init script.

Until now, you have to query the ubus to get the information with the
following command.

`ubus call service list '{"name":"","verbose":true}'`

With this change, the init script is now extend with the command to get
this information easier.

`/etc/init.d/ procd`

Signed-off-by: Florian Eckert 
---
v2:
- Remove duplicate json service string

v3:
- Change init call from `info` to `procd`
- Update PKG_RELEASE for base-files and procd package

 package/base-files/Makefile|  2 +-
 package/base-files/files/etc/rc.common |  5 +
 package/system/procd/Makefile  |  2 +-
 package/system/procd/files/procd.sh| 14 ++
 4 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index 0c612b73ca..fbcb694592 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk
 include $(INCLUDE_DIR)/feeds.mk
 
 PKG_NAME:=base-files
-PKG_RELEASE:=239
+PKG_RELEASE:=240
 PKG_FLAGS:=nonshared
 
 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
diff --git a/package/base-files/files/etc/rc.common 
b/package/base-files/files/etc/rc.common
index f39b69464e..1a4ee2929b 100755
--- a/package/base-files/files/etc/rc.common
+++ b/package/base-files/files/etc/rc.common
@@ -121,6 +121,7 @@ extra_command "enabled" "Check if service is started on 
boot"
extra_command "running" "Check if service is running"
extra_command "status" "Service status"
extra_command "trace" "Start with syscall trace"
+   extra_command "procd" "Show procd info as json"
 
. $IPKG_INSTROOT/lib/functions/procd.sh
basescript=$(readlink "$initscript")
@@ -173,6 +174,10 @@ extra_command "enabled" "Check if service is started on 
boot"
_procd_status "$(basename ${basescript:-$initscript})" 
"$1"
fi
}
+
+   procd() {
+   _procd_info "$(basename ${basescript:-$initscript})"
+   }
 }
 
 ALL_COMMANDS="${ALL_COMMANDS} ${EXTRA_COMMANDS}"
diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile
index ed73587056..ad0ead2346 100644
--- a/package/system/procd/Makefile
+++ b/package/system/procd/Makefile
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=procd
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git
diff --git a/package/system/procd/files/procd.sh 
b/package/system/procd/files/procd.sh
index d86b7219da..1969cdf973 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -474,6 +474,20 @@ _procd_status() {
fi
 }
 
+_procd_info() {
+   local service="$1"
+   local data
+
+   data=$(_procd_ubus_call list | jsonfilter -e '@["'"$service"'"]')
+   [ -z "$data" ] && { echo "not found"; return 3; }
+
+   json_init
+   json_add_string name "$service"
+   json_add_boolean verbose "1"
+   json_add_string name "$service"
+   _procd_ubus_call list
+}
+
 procd_open_data() {
local name="$1"
json_set_namespace procd __procd_old_cb
-- 
2.20.1


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


Re: [PATCH v3] procd: add procd json output to init

2020-12-17 Thread Florian Eckert

Hello Petr

On 2020-12-17 10:12, Petr Štetiar wrote:

Florian Eckert  [2020-12-17 09:40:08]:
With this change, the init script is now extend with the command to 
get

this information easier.


I still lack the information about your use case, how do you use this 
output

of this command.


Should I write this in the commit messsage?
If yes, then I will do that.
I just thought that this is clearly evident to simplify the input.
So that I do not always have to type the whole string.

BTW it looks like you're doing something similar to what we're already 
doing

in the `status` command.


Yes, but that only returns `running`.
But I want to see more information.

Maybe you just want to implement `status_verbose` (or such) command 
with all

the details you would like to get, but in human readable format?


The command `status_verbose` would be good as a command.
But the whole json is quit complex.
I do not think we could convert this to a non json output.

I see the service command as CLI mainly for end users, so in my 
oppinion it

should provide human readable output.


I didn't realize it that way, that only human readable output are 
allowed.
The different service in the openwrt, which use the procd add also 
extra_commands.

I'm not sure if these are always human readable outputs.


+   json_init
+   json_add_string name "$service"
+   json_add_boolean verbose "1"
+   json_add_string name "$service"


Duplicate json_add_string line.


Damn, that slipped back in.
That's what happens when you don't update the thing right away!
My fault -> sorry

Best regards

Florian

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


[PATCH v2 3/5] firewall: fix whitespace

2020-12-17 Thread Florian Eckert
Remove trailing whitespace.

Signed-off-by: Florian Eckert 
---
 package/network/config/firewall/files/firewall.init | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/config/firewall/files/firewall.init 
b/package/network/config/firewall/files/firewall.init
index ee3ed1a283..4c2fb7b617 100755
--- a/package/network/config/firewall/files/firewall.init
+++ b/package/network/config/firewall/files/firewall.init
@@ -29,7 +29,7 @@ validate_firewall_rule()
 }
 
 service_triggers() {
-   procd_add_reload_trigger firewall   
+   procd_add_reload_trigger firewall
 
procd_open_validate
validate_firewall_redirect
-- 
2.20.1


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


[PATCH v2 4/5] firewall: use new restart_service callback

2020-12-17 Thread Florian Eckert
In order that the prcod restart service can also be triggered during a
firewall restart, this call function must be changed.

Signed-off-by: Florian Eckert 
---
 package/network/config/firewall/files/firewall.init | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/config/firewall/files/firewall.init 
b/package/network/config/firewall/files/firewall.init
index 4c2fb7b617..089b02bb4c 100755
--- a/package/network/config/firewall/files/firewall.init
+++ b/package/network/config/firewall/files/firewall.init
@@ -37,7 +37,7 @@ service_triggers() {
procd_close_validate
 }
 
-restart() {
+restart_service() {
fw3 restart
 }
 
-- 
2.20.1


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


[PATCH v2 1/5] procd: add restart ubus call

2020-12-17 Thread Florian Eckert
To allow other services to respsond to a restart event from a procd initialised
service, a new ubus method "restart" in the ubus "service" path is needed
to trigger a ubus notify and also execute the installed service triggers.

Cc: Aaron Goodman 
Signed-off-by: Florian Eckert 
The original implementation is by Aaron Goodman.
---
 .../patches/0010-add-restart-event.patch  | 64 +++
 1 file changed, 64 insertions(+)
 create mode 100644 package/system/procd/patches/0010-add-restart-event.patch

diff --git a/package/system/procd/patches/0010-add-restart-event.patch 
b/package/system/procd/patches/0010-add-restart-event.patch
new file mode 100644
index 00..86ec3d38e1
--- /dev/null
+++ b/package/system/procd/patches/0010-add-restart-event.patch
@@ -0,0 +1,64 @@
+--- a/service/service.c
 b/service/service.c
+@@ -204,6 +204,17 @@ static const struct blobmsg_policy servi
+ };
+ 
+ enum {
++  SERVICE_RESTART_ATTR_NAME,
++  SERVICE_RESTART_ATTR_INSTANCE,
++  __SERVICE_RESTART_ATTR_MAX,
++};
++
++static const struct blobmsg_policy 
service_restart_attrs[__SERVICE_RESTART_ATTR_MAX] = {
++  [SERVICE_RESTART_ATTR_NAME] = { "name", BLOBMSG_TYPE_STRING },
++  [SERVICE_RESTART_ATTR_INSTANCE] = { "instance", BLOBMSG_TYPE_STRING },
++};
++
++enum {
+   SERVICE_DEL_ATTR_NAME,
+   SERVICE_DEL_ATTR_INSTANCE,
+   __SERVICE_DEL_ATTR_MAX,
+@@ -681,6 +692,35 @@ service_handle_update(struct ubus_contex
+   return 0;
+ }
+ 
++static int
++service_handle_restart(struct ubus_context *ctx, struct ubus_object *obj,
++ struct ubus_request_data *req, const char *method,
++ struct blob_attr *msg)
++{
++  struct blob_attr *tb[__SERVICE_RESTART_ATTR_MAX], *cur;
++  struct service *s = NULL;
++  const char *name;
++
++  blobmsg_parse(service_set_attrs, __SERVICE_RESTART_ATTR_MAX, tb, 
blobmsg_data(msg), blobmsg_data_len(msg));
++  cur = tb[SERVICE_RESTART_ATTR_NAME];
++  if (!cur)
++  return UBUS_STATUS_INVALID_ARGUMENT;
++
++  name = blobmsg_data(cur);
++
++  s = avl_find_element(&services, name, s, avl);
++  if (!s)
++  return UBUS_STATUS_INVALID_ARGUMENT;
++
++  blob_buf_init(&b, 0);
++  blobmsg_add_string(&b, "service", s->name);
++  trigger_event("service.restart", b.head);
++
++  service_event("service.restart", s->name, NULL);
++
++  return UBUS_STATUS_OK;
++}
++
+ static void ubus_event_bcast(const char *type, const char *param1, const char 
*val1,
+const char *param2, const char *val2)
+ {
+@@ -951,6 +991,7 @@ static struct ubus_method main_object_me
+   UBUS_METHOD("add", service_handle_set, service_set_attrs),
+   UBUS_METHOD("list", service_handle_list, service_list_attrs),
+   UBUS_METHOD("delete", service_handle_delete, service_del_attrs),
++  UBUS_METHOD("restart", service_handle_restart, service_restart_attrs),
+   UBUS_METHOD("signal", service_handle_signal, service_signal_attrs),
+   UBUS_METHOD("update_start", service_handle_update, service_attrs),
+   UBUS_METHOD("update_complete", service_handle_update, service_attrs),
-- 
2.20.1


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


[PATCH v2 2/5] base-files: add restart function wrapper

2020-12-17 Thread Florian Eckert
Thies commit add the new wrapper function to rc.common to execute the new ubus
service method "restart" on a service restart.

Signed-off-by: Florian Eckert 
---
 package/base-files/files/etc/rc.common | 13 +
 1 file changed, 13 insertions(+)

diff --git a/package/base-files/files/etc/rc.common 
b/package/base-files/files/etc/rc.common
index f39b69464e..ad5af4b7a1 100755
--- a/package/base-files/files/etc/rc.common
+++ b/package/base-files/files/etc/rc.common
@@ -139,6 +139,19 @@ extra_command "enabled" "Check if service is started on 
boot"
fi
}
 
+   restart() {
+   if eval "type restart_service" 2>/dev/null >/dev/null; then
+   restart_service "$@"
+   else
+   trap '' TERM
+   stop "$@"
+   trap - TERM
+   start "$@"
+   fi
+   procd_open_service "$(basename ${basescript:-$initscript})" 
"$initscript"
+   procd_close_service "restart"
+   }
+
trace() {
TRACE_SYSCALLS=1
start "$@"
-- 
2.20.1


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


[PATCH v2 5/5] procd: add api wrapper

2020-12-17 Thread Florian Eckert
This commit adds the functions `procd_add_service_trigger` and
`procd_add_restart_service_trigger`. In order for the service to be
triggered by another service during a restart, only the function
procd_add_restart_service_trigger is needed.

Example:

service_trigger() {
procd add_restart_service_trigger 'firewall' 
}

If the firewall is restarted, the specified  will be executed.

Signed-off-by: Florian Eckert 
---
 package/system/procd/files/procd.sh | 33 +
 1 file changed, 33 insertions(+)

diff --git a/package/system/procd/files/procd.sh 
b/package/system/procd/files/procd.sh
index d86b7219da..007c99fca0 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -329,6 +329,37 @@ _procd_add_config_trigger() {
json_close_array
 }
 
+_procd_add_service_trigger() {
+   json_add_array
+   _procd_add_array_data "$1"
+   shift
+
+   json_add_array
+   _procd_add_array_data "if"
+
+   json_add_array
+   _procd_add_array_data "eq" "service" "$1"
+   shift
+   json_close_array
+
+   json_add_array
+   _procd_add_array_data "run_script" "$@"
+   json_close_array
+
+   json_close_array
+   _procd_add_timeout
+   json_close_array
+}
+
+_procd_add_restart_service_trigger() {
+   local service=$1
+   shift
+
+   _procd_open_trigger
+   _procd_add_service_trigger "service.restart" "$service" "$@"
+   _procd_close_trigger
+}
+
 _procd_add_raw_trigger() {
json_add_array
_procd_add_array_data "$1"
@@ -559,6 +590,8 @@ _procd_wrapper \
procd_add_instance \
procd_add_raw_trigger \
procd_add_config_trigger \
+   procd_add_service_trigger \
+   procd_add_restart_service_trigger \
procd_add_interface_trigger \
procd_add_reload_trigger \
procd_add_reload_interface_trigger \
-- 
2.20.1


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


[PATCH v2 0/5] ubus: extend the service object with a restart method

2020-12-17 Thread Florian Eckert
This patchset adds the new method "restart" to the ubus service object.
This method is called on a service restart, if it is managed by procd.

I have noticed that during a firewall restart the mwan3 rules have all
disappeared and I have to restart my service as well. I did not expected
this. So that I don't have to do this extra step, an event should be
generated during a service restart, so other service could subscribe to
this event.

All services that want to react to this event can create a
callback script. The same applies to a config change.

As an example I used the firewall here, because I came across the
problem here. So if the firewall gets restart, then a event es
generated.

Full discussion hat taken place at this URL.
https://github.com/openwrt/packages/pull/13931

A pull request is already staged to use this new funcionality.
https://github.com/openwrt/packages/pull/14215

v2:
- As requested by John Chrispin, I wrapped the new
  `_procd_add_service_trigger` with the function
  `_procd_add_restart_service_trigger` to make it a one-liner to use this
  functionality.

Florian Eckert (5):
  procd: add restart ubus call
  base-files: add restart function wrapper
  firewall: fix whitespace
  firewall: use new restart_service callback
  procd: add api wrapper

 package/base-files/files/etc/rc.common| 13 
 .../config/firewall/files/firewall.init   |  4 +-
 package/system/procd/files/procd.sh   | 33 ++
 .../patches/0010-add-restart-event.patch  | 64 +++
 4 files changed, 112 insertions(+), 2 deletions(-)
 create mode 100644 package/system/procd/patches/0010-add-restart-event.patch

-- 
2.20.1


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


Add package version dependency for point releases

2021-01-11 Thread Florian Eckert

I would like to add a dependency to mwan3 on a specific kernel version.
In the master branch it does not matter, but I have a use case for this, 
especial for the stable release openwrt-19.07.
I just realized (thanks to @brianjmurrell [1]) that in a stable release, 
this is quite important.


The problem is, that a bug fix has been added to the kernel, which makes 
a workaround in mwan3 superfluous.
This workaround in the mwan3 I have now reverted. Since this is no 
longer needed.
Because of my revert now mwan3 tracking no longer works on IPv6 with 
older kernel version on openwrt-19.07, which do not have at least the 
kernel version from the 19.07.5 point release.
I was also not aware that the packages in the feeds for the point 
release are not pinned to the version that was in the repository when 
the tagging was on.

Only openwrt core is pinned.
The feeds always use the latest stable snapshot builds from 19.07 and so 
are rolling.


The fix now would be to check the version of the kernel when installing 
the package and only install or update the package if the correct 
version is installed.

But how can I do that? This is not a build dependency.

Or does anyone have another suggestion

See discussion on github [2].

Best regards

Florian

[1] https://github.com/brianjmurrell
[2] 
https://github.com/openwrt/packages/commit/6bd3f5c3777c5cbad4ac9156fa5b0fda26af14a9


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


Re: [PATCH] iperf3: move over to packages.git

2021-01-17 Thread Florian Eckert





That package is not required for building OpenWrt so the maintenance
should happen over at packages.git.

Sounds about right. I think most people prefer to use iperf anyway...


But then I would also move the iperf package to the package feed.



CC: Felix Fietkau 

Signed-off-by: Paul Spooren 

Reviewed-by: Rosen Penev 
Reviewed-by: Florian Eckert 
---
 package/network/utils/iperf3/Makefile | 83 
---

 1 file changed, 83 deletions(-)
 delete mode 100644 package/network/utils/iperf3/Makefile

diff --git a/package/network/utils/iperf3/Makefile 
b/package/network/utils/iperf3/Makefile

deleted file mode 100644
index 6f90bc9221..00
--- a/package/network/utils/iperf3/Makefile
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# Copyright (C) 2007-2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public 
License v2.

-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=iperf
-PKG_VERSION:=3.9
-PKG_RELEASE:=1
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=https://downloads.es.net/pub/iperf
-PKG_HASH:=24b63a26382325f759f11d421779a937b63ca1bc17c44587d2fcfedab60ac038
-
-PKG_MAINTAINER:=Felix Fietkau 
-PKG_LICENSE:=BSD-3-Clause
-
-PKG_BUILD_PARALLEL:=1
-PKG_INSTALL:=1
-
-PKG_FIXUP:=autoreconf
-
-include $(INCLUDE_DIR)/package.mk
-
-DISABLE_NLS:=
-
-define Package/iperf3/default
-  SECTION:=net
-  CATEGORY:=Network
-  TITLE:=Internet Protocol bandwidth measuring tool
-  URL:=https://github.com/esnet/iperf
-endef
-
-define Package/iperf3
-$(call Package/iperf3/default)
-  VARIANT:=nossl
-endef
-
-define Package/iperf3-ssl
-$(call Package/iperf3/default)
-  TITLE+= with iperf_auth support
-  VARIANT:=ssl
-  DEPENDS:= +libopenssl
-endef
-
-TARGET_CFLAGS += -D_GNU_SOURCE
-CONFIGURE_ARGS += --disable-shared
-
-ifeq ($(BUILD_VARIANT),ssl)
-   CONFIGURE_ARGS += --with-openssl="$(STAGING_DIR)/usr"
-else
-   CONFIGURE_ARGS += --without-openssl
-endif
-
-MAKE_FLAGS += noinst_PROGRAMS=
-
-define Package/iperf3/description
- Iperf is a modern alternative for measuring TCP and UDP bandwidth
- performance, allowing the tuning of various parameters and
- characteristics.
-endef
-
-# autoreconf fails if the README file isn't present
-define Build/Prepare
-   $(call Build/Prepare/Default)
-   touch $(PKG_BUILD_DIR)/README
-endef
-
-define Package/iperf3/install
-   $(INSTALL_DIR) $(1)/usr/bin
-   $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/iperf3 $(1)/usr/bin/
-endef
-
-define Package/iperf3-ssl/install
-   $(INSTALL_DIR) $(1)/usr/bin
-   $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/iperf3 $(1)/usr/bin/
-endef
-
-$(eval $(call BuildPackage,iperf3))
-$(eval $(call BuildPackage,iperf3-ssl))
--
2.29.2


___
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


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


Unnecessary extension of default packeges for x86 generic

2021-03-01 Thread Florian Eckert

Hello,

Is it really necessary that we keep expanding the default package here 
[1]?

The problem is, for example, that I don't need the whole AWS stuff.
But now the whole package gets installed.

If this is the case, then we should also install the vmware needed 
driver as default package.
Maybe someone (like me) would like to run the image in a vmware 
environment.

But I do not want to install this per default.

I think this are all special image.
Therefore it would be a good idea to create individual images.
For example
* define Device/aws
* define Device/vmware


Also, binary blobs are currently already get installed as a dependency 
that the default drivers work.

Therefore I have changed the line before this change as following.
So no binary blob dependency gets installed.
I am also not clear why we need kmod-bnx2, kmod-forcedeth and kmod-r8169 
as default, which have the binary blob dependency.


--- a/target/linux/x86/image/64.mk
+++ b/target/linux/x86/image/64.mk
@@ -1,7 +1,6 @@
 define Device/generic
   DEVICE_TITLE := Generic x86/64
-  DEVICE_PACKAGES += kmod-bnx2 kmod-e1000e kmod-e1000 kmod-forcedeth 
kmod-igb \

-   kmod-ixgbe kmod-r8169
+  DEVICE_PACKAGES += kmod-e1000e kmod-e1000 kmod-igb kmod-ixgbe
   GRUB2_VARIANT := generic
 endef
 TARGET_DEVICES += generic
--

From my point of view, these are the minimum packets needed to make the 
generic image to work.



Kind Regards

Florian

[1] 
https://github.com/openwrt/openwrt/commit/788ec9a7cfc843c8e46451331521cdc7d81866bd


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


Re: Unnecessary extension of default packeges for x86 generic

2021-03-01 Thread Florian Eckert

Hello Alberto,

Thank you for the explanation.
If that is so then we should also remove the vmware driver as a kmod 
package [1].

That makes no sense if this is then already in the kernel enabled [2].

Kind Regards

Florian

[1] 
https://github.com/openwrt/openwrt/blob/master/package/kernel/linux/modules/netdevices.mk#L1007
[2] 
https://github.com/openwrt/openwrt/blob/1ca5de13a153061feae260864d73d96f7c463785/target/linux/x86/64/config-5.4#L440


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


[PATCH 1/1] ltq-vdsl-app: add line_state number and power_state number

2021-03-09 Thread Florian Eckert
With the old ubus dsl API, the numbers for the individual line_states and
power_states were also returned. These were not ported to the new DSL
C-API. This commit changes the following JSON output.

* current JSON output for state:
"state": "Showtime with TC-Layer sync"

* new JSON output for state:
"line_state": {
"mumber": 2049,
"string": "Showtime with TC-Layer sync"
},

* current JSON output for power_state:
"power_state": "L0 - Synchronized"

new JSON outpug for power_state:
"power_state": {
"mumber": 0,
"string": "L0 - Synchronized"
}

Signed-off-by: Florian Eckert 
---
 .../ltq-vdsl-app/src/src/dsl_cpe_ubus.c   | 22 +++
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c 
b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
index 52b2be20e1..9d78b61188 100644
--- a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
+++ b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
@@ -306,7 +306,9 @@ static void version_information(int fd) {
 static void line_state(int fd) {
IOCTL(DSL_LineState_t, DSL_FIO_LINE_STATE_GET)
 
+   void *c;
const char *str;
+
switch (out.data.nLineState) {
STR_CASE(DSL_LINESTATE_NOT_INITIALIZED, "Not initialized")
STR_CASE(DSL_LINESTATE_EXCEPTION, "Exception")
@@ -351,8 +353,13 @@ static void line_state(int fd) {
str = NULL;
break;
};
-   if (str)
-   m_str("state", str);
+
+   if (str) {
+   c = blobmsg_open_table(&b, "line_state");
+   m_u32("mumber", out.data.nLineState);
+   m_str("string", str);
+   blobmsg_close_table(&b, c);
+   }
 
m_bool("up", out.data.nLineState == DSL_LINESTATE_SHOWTIME_TC_SYNC);
 }
@@ -377,7 +384,9 @@ static void g997_line_inventory(int fd) {
 static void g997_power_management_status(int fd) {
IOCTL(DSL_G997_PowerManagementStatus_t, 
DSL_FIO_G997_POWER_MANAGEMENT_STATUS_GET)
 
+   void *c;
const char *str;
+
switch (out.data.nPowerManagementStatus) {
STR_CASE(DSL_G997_PMS_NA, "Power management state is not available")
STR_CASE(DSL_G997_PMS_L0, "L0 - Synchronized")
@@ -388,8 +397,13 @@ static void g997_power_management_status(int fd) {
str = NULL;
break;
};
-   if (str)
-   m_str("power_state", str);
+
+   if (str) {
+   c = blobmsg_open_table(&b, "power_state");
+   m_u32("mumber", out.data.nPowerManagementStatus);
+   m_str("string", str);
+   blobmsg_close_table(&b, c);
+   }
 }
 
 static void g997_xtu_system_enabling(int fd, standard_t *standard) {
-- 
2.20.1


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


[PATCH v2 1/1] ltq-vdsl-app: add line_state number and power_state number

2021-03-09 Thread Florian Eckert
With the old ubus dsl API, the numbers for the individual line_states and
power_states were also returned. These were not ported to the new DSL
C-API. This commit changes the following JSON output.

* current JSON output for state:
"state": "Showtime with TC-Layer sync"

* new JSON output for state:
"line_state": {
"number": 2049,
"string": "Showtime with TC-Layer sync"
},

* current JSON output for power_state:
"power_state": "L0 - Synchronized"

new JSON outpug for power_state:
"power_state": {
"number": 0,
"string": "L0 - Synchronized"
}

Signed-off-by: Florian Eckert 
---
v2:
* Fixed typo

 .../ltq-vdsl-app/src/src/dsl_cpe_ubus.c   | 22 +++
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c 
b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
index 52b2be20e1..4629620a90 100644
--- a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
+++ b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
@@ -306,7 +306,9 @@ static void version_information(int fd) {
 static void line_state(int fd) {
IOCTL(DSL_LineState_t, DSL_FIO_LINE_STATE_GET)
 
+   void *c;
const char *str;
+
switch (out.data.nLineState) {
STR_CASE(DSL_LINESTATE_NOT_INITIALIZED, "Not initialized")
STR_CASE(DSL_LINESTATE_EXCEPTION, "Exception")
@@ -351,8 +353,13 @@ static void line_state(int fd) {
str = NULL;
break;
};
-   if (str)
-   m_str("state", str);
+
+   if (str) {
+   c = blobmsg_open_table(&b, "line_state");
+   m_u32("number", out.data.nLineState);
+   m_str("string", str);
+   blobmsg_close_table(&b, c);
+   }
 
m_bool("up", out.data.nLineState == DSL_LINESTATE_SHOWTIME_TC_SYNC);
 }
@@ -377,7 +384,9 @@ static void g997_line_inventory(int fd) {
 static void g997_power_management_status(int fd) {
IOCTL(DSL_G997_PowerManagementStatus_t, 
DSL_FIO_G997_POWER_MANAGEMENT_STATUS_GET)
 
+   void *c;
const char *str;
+
switch (out.data.nPowerManagementStatus) {
STR_CASE(DSL_G997_PMS_NA, "Power management state is not available")
STR_CASE(DSL_G997_PMS_L0, "L0 - Synchronized")
@@ -388,8 +397,13 @@ static void g997_power_management_status(int fd) {
str = NULL;
break;
};
-   if (str)
-   m_str("power_state", str);
+
+   if (str) {
+   c = blobmsg_open_table(&b, "power_state");
+   m_u32("number", out.data.nPowerManagementStatus);
+   m_str("string", str);
+   blobmsg_close_table(&b, c);
+   }
 }
 
 static void g997_xtu_system_enabling(int fd, standard_t *standard) {
-- 
2.20.1


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


Re: [PATCH v2 1/1] ltq-vdsl-app: add line_state number and power_state number

2021-03-11 Thread Florian Eckert

Hello Andre


We already talked about it, but once again for the list:


Here are my thoughts on why I would like to have this for the 
mailinglist.



I skipped both of these numeric state values when porting this to
ubus/C, because those are internal and lantiq implementation specific.
I'd like to avoid exposing those if possible.


So far we only have the lantiq DSL implementation.
The only thing I can think of is that Broadcom also has DSL.
But they have a strange licensing policy and are therefore negligible.
I have also not yet seen a target that has this DSL frontend from 
broadcom.


With the old implementation, we also exported the numbers via the UBUS.
I already used this data for the collectd to also record the line_state 
and the power_state over time.
There is already a pullrequest pending to integrate this into collectd 
[0] with some other datas



I've only seen very few of all of those actually happening.


That's right, I've only seen a handful so far too
But I can't tell which ones are important or negligible.


Can we not expose new metrics instead of these internal numbers?


We can do that.
The only question is which data we want to export.
I definitely can not save strings in an RRD database.


Like there's already "up":
m_bool("up", out.data.nLineState == DSL_LINESTATE_SHOWTIME_TC_SYNC);

If you care e.g. about showtime you could just add:
m_bool("showtime", out.data.nLineState ==
DSL_LINESTATE_SHOWTIME_NO_SYNC || out.data.nLineState ==
DSL_LINESTATE_SHOWTIME_TC_SYNC);


That would be a possibility.
The collectd db type would be a bool.
From my point of view, the following values would be important.
I am currently evaluating this.
All other values are saved as unknown and so -1 in ma rrd database


0 -> Not initialized
1 -> Exception
256 -> Idle
512 -> Silent
768 -> Handshake
896 -> Full init
1280 -> Training
2048 -> Showtime without TC-Layer sync
2049 -> Showtime without TC-Layer sync
3328 -> Resync

What is also added is the power_state. However, these are not many 
values.



Kind regards

Florian

[0] https://github.com/openwrt/packages/pull/12175

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


netifd: Send permission denied for syslog after proto misconfiguration

2021-03-11 Thread Florian Eckert

Hello Hans,

I have had the problem for a long time that I see the following message 
in the syslog.


Tue Apr  2 10:50:23 2019 daemon.notice netifd: wwan (11146): Command 
failed: Permission denied


This message in the syslog is written when the interface makes a 
teardown after a misconfiguration.

According to my researches, it must be related to this commit [1].

In the proto handler uqmi [2] and I think also in umbim [3] these are 
the function calls that generate this message in the log.


It's not bad but it's not clean.
How can we stop this message to get written to the syslog?
Is it enough to send it to /dev/null?

I also wonder why we need this call at all.
The proto is cleaned up by the calls to uqmi and umbim binaries.

I'm missing the connections, can you help me?

Or does this have something to do with the dhcp?

Kind regards

Florian

[1] 
https://git.openwrt.org/?p=project/netifd.git;a=commit;h=99cfef35370b274352934c2f85a9de83ac537036
[2] 
https://github.com/openwrt/openwrt/blob/master/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh#L449
[3] 
https://github.com/openwrt/openwrt/blob/master/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh#L177


PS:

Can you please also look at this patch.
https://patchwork.ozlabs.org/project/openwrt/patch/20201124071800.9080-1...@dev.tdt.de/


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


[PATCH v3 1/1] ltq-vdsl-app: extent dsl metrics with boolean power and line states

2021-04-06 Thread Florian Eckert
With the old ubus dsl API, the numbers for the individual line_states and
power_states were also returned. These were not ported to the new DSL
C-API. This commit changes the following JSON output.

Instead of outputting the "line_state" and "power_state" numbers directly, the
values is now printed as boolean. This has the advantage that the
internal numbers are not shown, which can change in the future.

* current JSON output for state:
"state": "Showtime with TC-Layer sync"

* new JSON output for state:
"line_state": {
"exception": false,
"idle": false,
"silent": false,
"handshake": false,
"full-init": false,
"showtime-without-sync": false,
"showtime-with-sync": true,
"resync": false,
"not-initialized": false,
"string": "Showtime with TC-Layer sync"
},

* current JSON output for power_state:
"power_state": "L0 - Synchronized"

* new JSON outpug for power_state:
"power_state": {
"NA": false,
"L0": true,
"L1": false,
"L2": false,
"L3": false,
"string": "L0 - Synchronized"
}

Signed-off-by: Florian Eckert 
---
 package/network/config/ltq-vdsl-app/Makefile  |  2 +-
 .../ltq-vdsl-app/src/src/dsl_cpe_ubus.c   | 32 ---
 2 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/package/network/config/ltq-vdsl-app/Makefile 
b/package/network/config/ltq-vdsl-app/Makefile
index 0823a0e7e9..f5c561078d 100644
--- a/package/network/config/ltq-vdsl-app/Makefile
+++ b/package/network/config/ltq-vdsl-app/Makefile
@@ -9,7 +9,7 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=ltq-vdsl-app
 PKG_VERSION:=4.17.18.6
-PKG_RELEASE:=8
+PKG_RELEASE:=9
 PKG_BASE_NAME:=dsl_cpe_control
 PKG_SOURCE:=$(PKG_BASE_NAME)_vrx-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@OPENWRT
diff --git a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c 
b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
index 8eefdfe4d5..2ab35ac056 100644
--- a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
+++ b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
@@ -306,6 +306,7 @@ static void version_information(int fd) {
 static void line_state(int fd) {
IOCTL(DSL_LineState_t, DSL_FIO_LINE_STATE_GET)
 
+   void *c;
const char *str;
switch (out.data.nLineState) {
STR_CASE(DSL_LINESTATE_NOT_INITIALIZED, "Not initialized")
@@ -351,8 +352,21 @@ static void line_state(int fd) {
str = NULL;
break;
};
-   if (str)
-   m_str("state", str);
+
+   if (str) {
+   c = blobmsg_open_table(&b, "line_state");
+   m_bool("exception", out.data.nLineState == 
DSL_LINESTATE_EXCEPTION);
+   m_bool("idle", out.data.nLineState == DSL_LINESTATE_IDLE);
+   m_bool("silent", out.data.nLineState == DSL_LINESTATE_SILENT);
+   m_bool("handshake", out.data.nLineState == 
DSL_LINESTATE_HANDSHAKE);
+   m_bool("full-init", out.data.nLineState == 
DSL_LINESTATE_FULL_INIT);
+   m_bool("showtime-without-sync", out.data.nLineState == 
DSL_LINESTATE_SHOWTIME_NO_SYNC);
+   m_bool("showtime-with-sync", out.data.nLineState == 
DSL_LINESTATE_SHOWTIME_TC_SYNC);
+   m_bool("resync", out.data.nLineState == DSL_LINESTATE_RESYNC);
+   m_bool("not-initialized", out.data.nLineState == 
DSL_LINESTATE_NOT_INITIALIZED);
+   m_str("string", str);
+   blobmsg_close_table(&b, c);
+   }
 
m_bool("up", out.data.nLineState == DSL_LINESTATE_SHOWTIME_TC_SYNC);
 }
@@ -377,6 +391,7 @@ static void g997_line_inventory(int fd) {
 static void g997_power_management_status(int fd) {
IOCTL(DSL_G997_PowerManagementStatus_t, 
DSL_FIO_G997_POWER_MANAGEMENT_STATUS_GET)
 
+   void *c;
const char *str;
switch (out.data.nPowerManagementStatus) {
STR_CASE(DSL_G997_PMS_NA, "Power management state is not available")
@@ -388,8 +403,17 @@ static void g997_power_management_status(int fd) {
str = NULL;
break;
};
-   if (str)
-   m_str("power_state", str);
+
+   if (str) {
+   c = blobmsg_open_table(&b, "power_state");
+   m_bool("NA", out.data.nPowerManagementStatus == 
DSL_G997_PMS_NA);
+   m_bool("L0", out.data.nPowerManagementStatus == 
DSL_G997_PMS_L0);
+   m_bool("L1", out.data.nPowerManagementStatus == 
DSL_G997_PMS_L1);
+   m_bool("L2", out.data.nPowerManagementStatus == 
DSL_G997_PMS_L2);
+   m_bool("L3", out.data.nPowerManagementStatus == 
DSL_G997_PMS_L3);
+   m_str("string", str);
+   blobmsg_close_table(&b, c);
+   }
 }
 
 static void g997_xtu_system_enabling(int fd, standard_t *standard) {
-- 
2.20.1


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


[PATCH v4 1/1] ltq-vdsl-app: extent dsl metrics with power_level and state_detail

2021-04-09 Thread Florian Eckert
With the old ubus dsl API, the numbers for the individual line_states and
power_states were also returned. These were not ported to the new DSL
C-API. This commit adds the missing information to the JSON output.

* additional JSON output for state_detail:
"state_detail": {
"exception": false,
"idle": false,
"silent": false,
"handshake": false,
"full-init": false,
"showtime-without-sync": false,
"showtime-with-sync": true,
"resync": false,
"not-initialized": false,
},

* additinal JSON output for power_level:
"power_level": ,

Possible values are if the information is available:
0: L0
1: L1
2: L2
3: L3

Signed-off-by: Florian Eckert 
---
 .../ltq-vdsl-app/src/src/dsl_cpe_ubus.c   | 34 +--
 1 file changed, 32 insertions(+), 2 deletions(-)

diff --git a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c 
b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
index 8eefdfe4d5..d8ebbb584c 100644
--- a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
+++ b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
@@ -306,6 +306,7 @@ static void version_information(int fd) {
 static void line_state(int fd) {
IOCTL(DSL_LineState_t, DSL_FIO_LINE_STATE_GET)
 
+   void *c;
const char *str;
switch (out.data.nLineState) {
STR_CASE(DSL_LINESTATE_NOT_INITIALIZED, "Not initialized")
@@ -351,8 +352,21 @@ static void line_state(int fd) {
str = NULL;
break;
};
-   if (str)
+
+   if (str) {
m_str("state", str);
+   c = blobmsg_open_table(&b, "state_detail");
+   m_bool("exception", out.data.nLineState == 
DSL_LINESTATE_EXCEPTION);
+   m_bool("idle", out.data.nLineState == DSL_LINESTATE_IDLE);
+   m_bool("silent", out.data.nLineState == DSL_LINESTATE_SILENT);
+   m_bool("handshake", out.data.nLineState == 
DSL_LINESTATE_HANDSHAKE);
+   m_bool("full-init", out.data.nLineState == 
DSL_LINESTATE_FULL_INIT);
+   m_bool("showtime-without-sync", out.data.nLineState == 
DSL_LINESTATE_SHOWTIME_NO_SYNC);
+   m_bool("showtime-with-sync", out.data.nLineState == 
DSL_LINESTATE_SHOWTIME_TC_SYNC);
+   m_bool("resync", out.data.nLineState == DSL_LINESTATE_RESYNC);
+   m_bool("not-initialized", out.data.nLineState == 
DSL_LINESTATE_NOT_INITIALIZED);
+   blobmsg_close_table(&b, c);
+   }
 
m_bool("up", out.data.nLineState == DSL_LINESTATE_SHOWTIME_TC_SYNC);
 }
@@ -388,8 +402,24 @@ static void g997_power_management_status(int fd) {
str = NULL;
break;
};
-   if (str)
+
+   if (str) {
m_str("power_state", str);
+   switch (out.data.nPowerManagementStatus) {
+   case DSL_G997_PMS_L0:
+   m_u32("power_level", 0);
+   break;
+   case DSL_G997_PMS_L1:
+   m_u32("power_level", 1);
+   break;
+   case DSL_G997_PMS_L2:
+   m_u32("power_level", 2);
+   break;
+   case DSL_G997_PMS_L3:
+   m_u32("power_level", 3);
+   break;
+   }
+   }
 }
 
 static void g997_xtu_system_enabling(int fd, standard_t *standard) {
-- 
2.20.1


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


[PATCH v5 1/1] ltq-vdsl-app: extent dsl metrics with state_num and power_state_num

2021-04-12 Thread Florian Eckert
With the old ubus dsl API, the numbers for the individual line_states and
power_states were also returned. These were not ported to the new DSL
C-API. This commit adds the missing information.

For this the internal values are mapped to numbers.

* additional JSON output for state_num:
"state_num": 

Since not all values are meaningful only the following values are
implemented, this can be extended if the future.

* LSTATE_MAP_EXCEPTION
* LSTATE_MAP_IDLE
* LSTATE_MAP_SILENT
* LSTATE_MAP_HANDSHAKE
* LSTATE_MAP_FULL_INIT
* LSTATE_MAP_SHOWTIME_NO_SYNC
* LSTATE_MAP_SHOWTIME_TC_SYNC
* LSTATE_MAP_RESYNC
* LSTATE_MAP_NOT_INITIALIZED

* additinal JSON output for power_level:
"power_state_num": ,

Since there are not so many here, all are mapped.

* PSTATE_MAP_NA,
* PSTATE_MAP_L0,
* PSTATE_MAP_L1,
* PSTATE_MAP_L2,
* PSTATE_MAP_L3,

Signed-off-by: Florian Eckert 
---
v5:
After a discussion off the mailing list with Andre Heider, this is now
the favored solution. All other versions have been marked in the patchwork
as superseded.

 .../ltq-vdsl-app/src/src/dsl_cpe_ubus.c   | 72 +++
 1 file changed, 58 insertions(+), 14 deletions(-)

diff --git a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c 
b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
index 52b2be20e1..dafa45f77c 100644
--- a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
+++ b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
@@ -34,6 +34,12 @@
str = text; \
break;
 
+#define STR_CASE_MAP(id, text, number) \
+   case id: \
+   str = text; \
+   map = number; \
+   break;
+
 #define IOCTL(type, request) \
type out; \
memset(&out, 0, sizeof(type)); \
@@ -99,6 +105,34 @@ typedef enum {
PROFILE_35B,
 } profile_t;
 
+/* These values are exported via ubus and backwards compability
+ * needs to be kept!
+ */
+enum {
+   LSTATE_MAP_UNKNOWN = 0,
+   LSTATE_MAP_EXCEPTION,
+   LSTATE_MAP_IDLE,
+   LSTATE_MAP_SILENT,
+   LSTATE_MAP_HANDSHAKE,
+   LSTATE_MAP_FULL_INIT,
+   LSTATE_MAP_SHOWTIME_NO_SYNC,
+   LSTATE_MAP_SHOWTIME_TC_SYNC,
+   LSTATE_MAP_RESYNC,
+   LSTATE_MAP_NOT_INITIALIZED,
+};
+
+/* These values are exported via ubus and backwards compability
+ * needs to be kept!
+ */
+enum {
+   PSTATE_MAP_UNKNOWN = -2,
+   PSTATE_MAP_NA,
+   PSTATE_MAP_L0,
+   PSTATE_MAP_L1,
+   PSTATE_MAP_L2,
+   PSTATE_MAP_L3,
+};
+
 static DSL_CPE_ThreadCtrl_t thread;
 static struct ubus_context *ctx;
 static struct blob_buf b;
@@ -306,32 +340,33 @@ static void version_information(int fd) {
 static void line_state(int fd) {
IOCTL(DSL_LineState_t, DSL_FIO_LINE_STATE_GET)
 
+   int map = LSTATE_MAP_UNKNOWN;
const char *str;
switch (out.data.nLineState) {
-   STR_CASE(DSL_LINESTATE_NOT_INITIALIZED, "Not initialized")
-   STR_CASE(DSL_LINESTATE_EXCEPTION, "Exception")
+   STR_CASE_MAP(DSL_LINESTATE_NOT_INITIALIZED, "Not initialized", 
LSTATE_MAP_NOT_INITIALIZED)
+   STR_CASE_MAP(DSL_LINESTATE_EXCEPTION, "Exception", LSTATE_MAP_EXCEPTION)
STR_CASE(DSL_LINESTATE_NOT_UPDATED, "Not updated")
STR_CASE(DSL_LINESTATE_IDLE_REQUEST, "Idle request")
-   STR_CASE(DSL_LINESTATE_IDLE, "Idle")
+   STR_CASE_MAP(DSL_LINESTATE_IDLE, "Idle", LSTATE_MAP_IDLE)
STR_CASE(DSL_LINESTATE_SILENT_REQUEST, "Silent request")
-   STR_CASE(DSL_LINESTATE_SILENT, "Silent")
-   STR_CASE(DSL_LINESTATE_HANDSHAKE, "Handshake")
+   STR_CASE_MAP(DSL_LINESTATE_SILENT, "Silent", LSTATE_MAP_SILENT)
+   STR_CASE_MAP(DSL_LINESTATE_HANDSHAKE, "Handshake", LSTATE_MAP_HANDSHAKE)
STR_CASE(DSL_LINESTATE_BONDING_CLR, "Bonding CLR")
-   STR_CASE(DSL_LINESTATE_FULL_INIT, "Full init")
+   STR_CASE_MAP(DSL_LINESTATE_FULL_INIT, "Full init", LSTATE_MAP_FULL_INIT)
STR_CASE(DSL_LINESTATE_SHORT_INIT_ENTRY, "Short init entry")
STR_CASE(DSL_LINESTATE_DISCOVERY, "Discovery")
STR_CASE(DSL_LINESTATE_TRAINING, "Training")
STR_CASE(DSL_LINESTATE_ANALYSIS, "Analysis")
STR_CASE(DSL_LINESTATE_EXCHANGE, "Exchange")
-   STR_CASE(DSL_LINESTATE_SHOWTIME_NO_SYNC, "Showtime without TC-Layer 
sync")
-   STR_CASE(DSL_LINESTATE_SHOWTIME_TC_SYNC, "Showtime with TC-Layer sync")
+   STR_CASE_MAP(DSL_LINESTATE_SHOWTIME_NO_SYNC, "Showtime without TC-Layer 
sync", LSTATE_MAP_SHOWTIME_NO_SYNC)
+   STR_CASE_MAP(DSL_LINESTATE_SHOWTIME_TC_SYNC, "Showtime with TC-Layer 
sync", LSTATE_MAP_SHOWTIME_TC_SYNC)
STR_CASE(DSL_LINESTATE_FASTRETRAIN, "Fastretrain")
STR_CASE(DSL_LINESTATE_LOWPOW

Re: [PATCH v5 1/1] ltq-vdsl-app: extent dsl metrics with state_num and power_state_num

2021-04-12 Thread Florian Eckert

  +/* These values are exported via ubus and backwards compability
+ * needs to be kept!
+ */
+enum {
+   LSTATE_MAP_UNKNOWN = 0,
+   LSTATE_MAP_EXCEPTION,
+   LSTATE_MAP_IDLE,
+   LSTATE_MAP_SILENT,
+   LSTATE_MAP_HANDSHAKE,
+   LSTATE_MAP_FULL_INIT,
+   LSTATE_MAP_SHOWTIME_NO_SYNC,
+   LSTATE_MAP_SHOWTIME_TC_SYNC,
+   LSTATE_MAP_RESYNC,
+   LSTATE_MAP_NOT_INITIALIZED,


Except for the last entry, the order matches lantiq's DSL_LineState_t.
Doesn't really matter as long as we don't change these values, but was
there a reason for that?


No there is no particular reason for that.
Should I then send a v6?
Where this value then comes after LSTATE_MAP_UNKNOWN?

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


[PATCH v6 1/1] ltq-vdsl-app: extent dsl metrics with state_num and power_state_num

2021-04-13 Thread Florian Eckert
With the old ubus dsl API, the numbers for the individual line_states and
power_states were also returned. These were not ported to the new DSL
C-API. This commit adds the missing information.

For this the internal values are mapped to numbers.

* additional JSON output for state_num:
"state_num": 

Since not all values are meaningful only the following values are
implemented, this can be extended if the future.

* LSTATE_MAP_NOT_INITIALIZED
* LSTATE_MAP_EXCEPTION
* LSTATE_MAP_IDLE
* LSTATE_MAP_SILENT
* LSTATE_MAP_HANDSHAKE
* LSTATE_MAP_FULL_INIT
* LSTATE_MAP_SHOWTIME_NO_SYNC
* LSTATE_MAP_SHOWTIME_TC_SYNC
* LSTATE_MAP_RESYNC

* additinal JSON output for power_level:
"power_state_num": ,

Since there are not so many here, all are mapped.

* PSTATE_MAP_NA,
* PSTATE_MAP_L0,
* PSTATE_MAP_L1,
* PSTATE_MAP_L2,
* PSTATE_MAP_L3,

Signed-off-by: Florian Eckert 
v6:
Add state LSTATE_MAP_NOT_INITILIZED at the beginning of the list
Start the list LSTATE_MAP with -1
---
 .../ltq-vdsl-app/src/src/dsl_cpe_ubus.c   | 72 +++
 1 file changed, 58 insertions(+), 14 deletions(-)

diff --git a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c 
b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
index 52b2be20e1..91f36b18a7 100644
--- a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
+++ b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
@@ -34,6 +34,12 @@
str = text; \
break;
 
+#define STR_CASE_MAP(id, text, number) \
+   case id: \
+   str = text; \
+   map = number; \
+   break;
+
 #define IOCTL(type, request) \
type out; \
memset(&out, 0, sizeof(type)); \
@@ -99,6 +105,34 @@ typedef enum {
PROFILE_35B,
 } profile_t;
 
+/* These values are exported via ubus and backwards compability
+ * needs to be kept!
+ */
+enum {
+   LSTATE_MAP_UNKNOWN = -1,
+   LSTATE_MAP_NOT_INITIALIZED,
+   LSTATE_MAP_EXCEPTION,
+   LSTATE_MAP_IDLE,
+   LSTATE_MAP_SILENT,
+   LSTATE_MAP_HANDSHAKE,
+   LSTATE_MAP_FULL_INIT,
+   LSTATE_MAP_SHOWTIME_NO_SYNC,
+   LSTATE_MAP_SHOWTIME_TC_SYNC,
+   LSTATE_MAP_RESYNC,
+};
+
+/* These values are exported via ubus and backwards compability
+ * needs to be kept!
+ */
+enum {
+   PSTATE_MAP_UNKNOWN = -2,
+   PSTATE_MAP_NA,
+   PSTATE_MAP_L0,
+   PSTATE_MAP_L1,
+   PSTATE_MAP_L2,
+   PSTATE_MAP_L3,
+};
+
 static DSL_CPE_ThreadCtrl_t thread;
 static struct ubus_context *ctx;
 static struct blob_buf b;
@@ -306,32 +340,33 @@ static void version_information(int fd) {
 static void line_state(int fd) {
IOCTL(DSL_LineState_t, DSL_FIO_LINE_STATE_GET)
 
+   int map = LSTATE_MAP_UNKNOWN;
const char *str;
switch (out.data.nLineState) {
-   STR_CASE(DSL_LINESTATE_NOT_INITIALIZED, "Not initialized")
-   STR_CASE(DSL_LINESTATE_EXCEPTION, "Exception")
+   STR_CASE_MAP(DSL_LINESTATE_NOT_INITIALIZED, "Not initialized", 
LSTATE_MAP_NOT_INITIALIZED)
+   STR_CASE_MAP(DSL_LINESTATE_EXCEPTION, "Exception", LSTATE_MAP_EXCEPTION)
STR_CASE(DSL_LINESTATE_NOT_UPDATED, "Not updated")
STR_CASE(DSL_LINESTATE_IDLE_REQUEST, "Idle request")
-   STR_CASE(DSL_LINESTATE_IDLE, "Idle")
+   STR_CASE_MAP(DSL_LINESTATE_IDLE, "Idle", LSTATE_MAP_IDLE)
STR_CASE(DSL_LINESTATE_SILENT_REQUEST, "Silent request")
-   STR_CASE(DSL_LINESTATE_SILENT, "Silent")
-   STR_CASE(DSL_LINESTATE_HANDSHAKE, "Handshake")
+   STR_CASE_MAP(DSL_LINESTATE_SILENT, "Silent", LSTATE_MAP_SILENT)
+   STR_CASE_MAP(DSL_LINESTATE_HANDSHAKE, "Handshake", LSTATE_MAP_HANDSHAKE)
STR_CASE(DSL_LINESTATE_BONDING_CLR, "Bonding CLR")
-   STR_CASE(DSL_LINESTATE_FULL_INIT, "Full init")
+   STR_CASE_MAP(DSL_LINESTATE_FULL_INIT, "Full init", LSTATE_MAP_FULL_INIT)
STR_CASE(DSL_LINESTATE_SHORT_INIT_ENTRY, "Short init entry")
STR_CASE(DSL_LINESTATE_DISCOVERY, "Discovery")
STR_CASE(DSL_LINESTATE_TRAINING, "Training")
STR_CASE(DSL_LINESTATE_ANALYSIS, "Analysis")
STR_CASE(DSL_LINESTATE_EXCHANGE, "Exchange")
-   STR_CASE(DSL_LINESTATE_SHOWTIME_NO_SYNC, "Showtime without TC-Layer 
sync")
-   STR_CASE(DSL_LINESTATE_SHOWTIME_TC_SYNC, "Showtime with TC-Layer sync")
+   STR_CASE_MAP(DSL_LINESTATE_SHOWTIME_NO_SYNC, "Showtime without TC-Layer 
sync", LSTATE_MAP_SHOWTIME_NO_SYNC)
+   STR_CASE_MAP(DSL_LINESTATE_SHOWTIME_TC_SYNC, "Showtime with TC-Layer 
sync", LSTATE_MAP_SHOWTIME_TC_SYNC)
STR_CASE(DSL_LINESTATE_FASTRETRAIN, "Fastretrain")
STR_CASE(DSL_LINESTATE_LOWPOWER_L2, "Lowpower L2")
STR_CASE(DSL_LINESTATE_LOOPDIAGNOS

[OpenWrt-Devel] Uci event on config change

2015-05-25 Thread Florian Eckert
Hi.

I have a question and i dont find anything in the dokumentation of openwrt

In older version of openwrt "ucitrack" was used to watch config changes
and to restart services if something changed.
In newer version of openwrt "procd" is now used to make the same thing.

I need something diffrent

I am using the easycwmp tr069 client to get an config from am acs and to
preconfig the cpe. If someone changes the config over the Webgui (luci)
the acs should be informed that something has changed. I can do this
with easycwmp but I have to poll the config. This is not very clever.

Question:

Is there any possibility in openwrt to get an event from the uci over
ubus that a config parameter has changed to send this to the acs?

Some thing like:

1. Webgui
[ change something in the luci ]
[ press -> save/apply ]

2 . Console [ script ]
-> ubus listen &
-> get event
-> grep paramter and map this to tr069
-> grep new value
-> ubus call tr069
notify{"parameter":"Device.Network.Lan.IP","value":"1.2.3.4"}

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


[OpenWrt-Devel] lantiq DSL drivers / firmware info

2015-06-18 Thread Florian Eckert
Hello,

I have the new source packages for lantiq dsl stuffs. This are the new
packages rom UGW-6.1.
I don´t know the differences in the new packages!

Martin Blumenstingl [xdarklight] on github -> UGW-6.1

lib_ifxos-1.5.14.tar.gz -> lib_ifxos-1.5.19.tar.gz
ltq-vdsl-vr9-mei-1.4.1.tar.gz -> drv_mei_cpe-1.4.8.4.tar.gz
ltq-vdsl-vr9-4.15.2.tar.gz -> drv_dsl_cpe_api_vrx-4.16.2.4.tar.gz
ltq-vdsl-app-4.15.2 -> drv_dsl_cpe_api_vrx-4.16.2.4.tar.gz

[2] https://github.com/xdarklight/drv_mei_cpe
[3] https://github.com/xdarklight/drv_dsl_cpe_api_vrx
[4] https://github.com/xdarklight/lib_ifxos
[5] https://github.com/xdarklight/dsl_cpe_control_vrx



Kind regards

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


Re: [OpenWrt-Devel] watchping

2015-07-03 Thread Florian Eckert
On 03.07.2015 13:32, Bastian Bittorf wrote:
> * Bruno Randolf  [03.07.2015 13:15]:
>> I am writing here to ask wether someone has done this already, or if
>> there are any other concerns or opinions. Please let me know!
> 
> I think nearly every wireless community has something like this.
> A good approach is IMHO the sven-ola "check different routing-tables
> via traceroute" thing. Check out the this cron.minutely script for
> that.
> 
> I think you must have in mind is, that after 'ifup' there is an
> delay till internet is working. (and you need a threshold)
> 
> bye, bastian / weimarnetz.de
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
Hello

I am using the mwan3 from openwrt and ping a server in the Internt for
example google 8.8.8.8. If you get a pong you can suppose that you have
established a internet connection over this wan interface.

Kind regards

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


[OpenWrt-Devel] Package License

2015-07-14 Thread Florian Eckert
Hello

I know that in a makfile of a package it is possible to deposite a license
string for this package

Is there a script in the build environments or in a Router image where i
can get a list of all installed package with there licenses?
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] Fwd: [PATCH v3] lantiq: get more status information from xDSL

2015-08-06 Thread Florian Eckert
Sorry i dont understand your question.

This is the third version of the patch.

I edit this in v2 and v3

In v2 i have added the conversation of latency to ms (mentioned by
Martin Blumenstingl). I have forgotten the quotation around the ms
output. The lucistat output was broken so i fixed this in v3
(mentioned by Andre Heider)
In v2 i also fixed the line mode comma separation (mentioned by Martin
Blumenstingl)
In v3 i deleted the echo "" output because this will also be
printed during lucistat output (mentioned by Andre Heider)

2015-08-06 9:15 GMT+02:00 Sylwester Petela :
> W dniu 2015-08-06 o 07:41, feckert pisze:
>
>> Signed-off-by: Florian Eckert 
>> Signed-off-by: Helge Mader 
>> Tested-by: Martin Blumenstingl 
>> Tested-by: Andre Heider 
>> ---
>>
>> v2 fix annex and line mode comma
>> v2 fix latency to ms
>> v3 fix latency syntax quotation error "x ms"
>> v3 fix echo "" separation removed from status function
>>
>>   .../lantiq/base-files/lib/functions/lantiq_dsl.sh  |  412
>> +++-
>>   1 file changed, 400 insertions(+), 12 deletions(-)
>>   mode change 100644 => 100755
>> target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
>>
>> diff --git a/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
>> b/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
>> old mode 100644
>> new mode 100755
>> index 56b8652..7809d01
>> --- a/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
>> +++ b/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
>> @@ -19,6 +19,9 @@ dsl_cmd() {
>>   dsl_val() {
>> echo $(expr "$1" : '.*'$2'=\([-\.[:alnum:]]*\).*')
>>   }
>> +dsl_string() {
>> +   echo $(expr "$1" : '.*'$2'=(\([A-Z0-9,]*\))')
>> +}
>> #
>>   # Simple divide by 10 routine to cope with one decimal place
>> @@ -49,6 +52,16 @@ scale() {
>> fi
>>   }
>>   +scale_latency() {
>> +   local val=$1
>> +   local a
>> +   local b
>> +
>> +   a=$(expr $val / 100)
>> +   b=$(expr $val % 100)
>> +   printf "%d.%d ms" ${a} ${b}
>> +}
>> +
>>   #
>>   # Read the data rates for both directions
>>   #
>> @@ -77,7 +90,7 @@ data_rates() {
>> echo "dsl.data_rate_down_s=\"$sdrd\""
>> echo "dsl.data_rate_up_s=\"$sdru\""
>> else
>> -   echo "Data Rate:${sdrd}/s / ${sdru}/s"
>> +   echo "Data Rate:Down:
>> ${sdrd}/s / Up: ${sdru}/s"
>> fi
>>   }
>>   @@ -92,11 +105,340 @@ chipset() {
>> vig=$(dsl_cmd vig)
>> cs=$(dsl_val "$vig" DSL_ChipSetType)
>> csv=$(dsl_val "$vig" DSL_ChipSetHWVersion)
>> +   csfw=$(dsl_val "$vig" DSL_ChipSetFWVersion)
>> +   csapi=$(dsl_val "$vig" DSL_DriverVersionApi)
>> if [ "$action" = "lucistat" ]; then
>> echo "dsl.chipset=\"${cs} ${csv}\""
>> +   echo "dsl.firmware_version=\"${csfw}\""
>> +   echo "dsl.api_version=\"${csapi}\""
>> else
>> -   echo "Chipset:  ${cs} ${csv}"
>> +   echo "Chipset:  ${cs}
>> ${csv}"
>> +   echo "Firmware Version: ${csfw}"
>> +   echo "API Version:  ${csapi}"
>> +   fi
>> +}
>> +
>> +#
>> +# Vendor information
>> +#
>> +vendor() {
>> +   local lig
>> +   local vid
>> +   local svid
>> +
>> +   lig=$(dsl_cmd g997lig 1)
>> +   vid=$(dsl_string "$lig" G994VendorID)
>> +   svid=$(dsl_string "$lig" SystemVendorID)
>> +
>> +   if [ "$action" = "lucistat" ]; then
>> +   echo "dsl.atuc_vendor_id=\"${vid}\""
>> +   echo "dsl.atuc_system_vendor_id=\"${svid}\""
>> +   else
>> +   echo "ATU-C Vendor ID:  ${vid}"
>> +   echo "ATU-C System Vendor ID:   ${svid}"
>> +   fi
>> +}
>> +
>> +#
>> +# XTSE capabilities
>

Re: [OpenWrt-Devel] [PATCH v3] lantiq: get more status information from xDSL

2015-08-06 Thread Florian Eckert
Am 06.08.2015 4:01 nachm. schrieb "Sylwek ScApi" :
>
> I don't know that You done something wrong, You misunderstood me, as
example We will use this part of patch:
> :
> @@ -226,16 +609,21 @@ line_state() {
> fi
> else
> if [ "$ls" = "0x801" ]; then
> -   echo "Line State:   UP [$ls: $s]"
> +   echo "Line State:
 UP [$ls: $s]"
> else
> -   echo "Line State:   DOWN [$ls: $s]"
> +   echo "Line State:
 DOWN [$ls: $s]"
> fi
> fi
>  }
>
> Why You replace tab separated "words" with space separated "words" ?
I replaced this with space so i get a well formated output for "dsl_control
status", If i use 3 tabs the out put will get too fare left on screen i
think. I could change it If you want.
>
> Patch is send correctly but why replace "tabs" ?
>
> My thunderbird is white space broken so You need to look in Your source
patch for reference.
>
> Best Regards
>
> 2015-08-06 11:52 GMT+02:00 Florian Eckert :
>>
>> Hello Petela
>>
>> sorry but i dont understand your question!
>>
>> I checked out openwrt with git and edited the file. After that i made
>> "git format-patch -1" and then "git send-email --to
>> openwrt-devel@lists.openwrt.org
>> 0001-lantiq-get-more-status-information-from-xDSL.patch". I used the
>> same whitespaces in this file as in the other functions of this file
>> -> in this case it was an tab. What did i made wrong?
>>
>> Kind Regards Flo
>>
>> 2015-08-06 9:15 GMT+02:00 Sylwester Petela :
>> > W dniu 2015-08-06 o 07:41, feckert pisze:
>> >
>> >> Signed-off-by: Florian Eckert 
>> >> Signed-off-by: Helge Mader 
>> >> Tested-by: Martin Blumenstingl 
>> >> Tested-by: Andre Heider 
>> >> ---
>> >>
>> >> v2 fix annex and line mode comma
>> >> v2 fix latency to ms
>> >> v3 fix latency syntax quotation error "x ms"
>> >> v3 fix echo "" separation removed from status function
>> >>
>> >>   .../lantiq/base-files/lib/functions/lantiq_dsl.sh  |  412
>> >> +++-
>> >>   1 file changed, 400 insertions(+), 12 deletions(-)
>> >>   mode change 100644 => 100755
>> >> target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
>> >>
>> >> diff --git
a/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
>> >> b/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
>> >> old mode 100644
>> >> new mode 100755
>> >> index 56b8652..7809d01
>> >> --- a/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
>> >> +++ b/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
>> >> @@ -19,6 +19,9 @@ dsl_cmd() {
>> >>   dsl_val() {
>> >> echo $(expr "$1" : '.*'$2'=\([-\.[:alnum:]]*\).*')
>> >>   }
>> >> +dsl_string() {
>> >> +   echo $(expr "$1" : '.*'$2'=(\([A-Z0-9,]*\))')
>> >> +}
>> >> #
>> >>   # Simple divide by 10 routine to cope with one decimal place
>> >> @@ -49,6 +52,16 @@ scale() {
>> >> fi
>> >>   }
>> >>   +scale_latency() {
>> >> +   local val=$1
>> >> +   local a
>> >> +   local b
>> >> +
>> >> +   a=$(expr $val / 100)
>> >> +   b=$(expr $val % 100)
>> >> +   printf "%d.%d ms" ${a} ${b}
>> >> +}
>> >> +
>> >>   #
>> >>   # Read the data rates for both directions
>> >>   #
>> >> @@ -77,7 +90,7 @@ data_rates() {
>> >> echo "dsl.data_rate_down_s=\"$sdrd\""
>> >> echo "dsl.data_rate_up_s=\"$sdru\""
>> >> else
>> >> -   echo "Data Rate:${sdrd}/s / ${sdru}/s"
>> >> +   echo "Data Rate:Down:
>> >> ${sdrd}/s / Up: ${sdru}/s"
>> >> fi
>> >>   }
>> >>   @@ -92,11 +105,340 @@ chipset() {
>> >> vig=$(dsl_cmd vig)
>> >> cs=$(dsl_val 

[OpenWrt-Devel] [PATCH] uboot_envtools: add P2812HNUF1

2015-09-17 Thread Florian Eckert
Add generation of /etc/fw_env.config for P2812HNUF1

Signed-off-by: Florian Eckert 
---
 package/boot/uboot-envtools/files/lantiq | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/package/boot/uboot-envtools/files/lantiq 
b/package/boot/uboot-envtools/files/lantiq
index 69b375d..b152061 100644
--- a/package/boot/uboot-envtools/files/lantiq
+++ b/package/boot/uboot-envtools/files/lantiq
@@ -20,6 +20,9 @@ GIGASX76X)
 BTHOMEHUBV2B)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1" "0x1" "1"
;;
+P2812HNUF1)
+   ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x2000" "0x2" "1"
+   ;;
 esac
 
 config_load ubootenv
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] build: download.mk: bugfix download.pl argument call order

2016-01-20 Thread Florian Eckert
From: Florian Eckert 

Signed-off-by: Florian Eckert 
---
 include/download.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/download.mk b/include/download.mk
index ca5eee4..562a7b9 100644
--- a/include/download.mk
+++ b/include/download.mk
@@ -48,7 +48,7 @@ define DownloadMethod/default
 endef
 
 define wrap_mirror
-   $(if $(if $(MIRROR),$(filter-out 
x,$(MIRROR_MD5SUM))),@$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "" 
"$(MIRROR_MD5SUM)" || ( $(1) ),$(1))
+   $(if $(if $(MIRROR),$(filter-out 
x,$(MIRROR_MD5SUM))),@$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" 
"$(MIRROR_MD5SUM)" "" || ( $(1) ),$(1))
 endef
 
 define DownloadMethod/cvs
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2] build: download.mk: bugfix download.pl argument call order

2016-01-21 Thread Florian Eckert
Change wrong download.pl argument call order.
See download.pl argument list.

Signed-off-by: Florian Eckert 
---
-v2 add patch description

 include/download.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/download.mk b/include/download.mk
index ca5eee4..562a7b9 100644
--- a/include/download.mk
+++ b/include/download.mk
@@ -48,7 +48,7 @@ define DownloadMethod/default
 endef
 
 define wrap_mirror
-   $(if $(if $(MIRROR),$(filter-out 
x,$(MIRROR_MD5SUM))),@$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "" 
"$(MIRROR_MD5SUM)" || ( $(1) ),$(1))
+   $(if $(if $(MIRROR),$(filter-out 
x,$(MIRROR_MD5SUM))),@$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" 
"$(MIRROR_MD5SUM)" "" || ( $(1) ),$(1))
 endef
 
 define DownloadMethod/cvs
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/3] lantiq-dsl: bugfix db negative sign after comma

2016-04-07 Thread Florian Eckert
From: Florian Eckert 

If db is negative minus sign was shown after comma

Signed-off-by: Florian Eckert 
---
 target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh 
b/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
index aefefcd..adf245a 100755
--- a/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
+++ b/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
@@ -31,7 +31,7 @@ dsl_string() {
 dbt() {
local a=$(expr $1 / 10)
local b=$(expr $1 % 10)
-   echo "${a}.${b}"
+   echo "${a}.${b#-}"
 }
 #
 # Take a number and convert to k or meg
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/3] lantiq-dsl: bugfix latency values swapped for lucistat

2016-04-07 Thread Florian Eckert
From: Florian Eckert 

swapped wrong latency output

Signed-off-by: Florian Eckert 
---
 target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh 
b/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
index adf245a..8c6482f 100755
--- a/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
+++ b/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
@@ -430,8 +430,8 @@ latency_delay() {
sidd=$(scale_latency $idd)
 
if [ "$action" = "lucistat" ]; then
-   echo "dsl.latency_num_down=\"$sidu\""
-   echo "dsl.latency_num_up=\"$sidd\""
+   echo "dsl.latency_num_down=\"$sidd\""
+   echo "dsl.latency_num_up=\"$sidu\""
echo "dsl.latency_s_down=\"$idd_s\""
echo "dsl.latency_s_up=\"$idu_s\""
else
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/3] lantiq-dsl: bugfix db negative sign after comma

2016-04-07 Thread Florian Eckert
From: Florian Eckert 

If db is negative minus sign was shown after comma

Signed-off-by: Florian Eckert 
---
 target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh 
b/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
index aefefcd..adf245a 100755
--- a/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
+++ b/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
@@ -31,7 +31,7 @@ dsl_string() {
 dbt() {
local a=$(expr $1 / 10)
local b=$(expr $1 % 10)
-   echo "${a}.${b}"
+   echo "${a}.${b#-}"
 }
 #
 # Take a number and convert to k or meg
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 3/3] lantiq-dsl: add missing blank in dsl output

2016-04-07 Thread Florian Eckert
From: Florian Eckert 

blank inserted before ACTATP

Signed-off-by: Florian Eckert 
---
 target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh 
b/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
index 8c6482f..41993f7 100755
--- a/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
+++ b/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
@@ -639,7 +639,7 @@ line_data() {
echo "Line Attenuation (LATN):  Down: 
${latnd}dB / Up: ${latnu}dB"
echo "Signal Attenuation (SATN):Down: 
${satnd}dB / Up: ${satnu}dB"
echo "Noise Margin (SNR):   Down: ${snrd}dB 
/ Up: ${snru}dB"
-   echo "Aggregate Transmit Power(ACTATP): Down: 
${actatpd}dB / Up: ${actatpu}dB"
+   echo "Aggregate Transmit Power (ACTATP):Down: 
${actatpd}dB / Up: ${actatpu}dB"
echo "Max. Attainable Data Rate (ATTNDR):   Down: 
${sattndrd}/s / Up: ${sattndru}/s"
fi
 }
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [LEDE-DEV] TR-069 for OpenWrt

2016-05-28 Thread Florian Eckert
Hello,

nice to hear the there are intentions to make a openwrt/lede solution. We
are now using a freecwmp fork ( EasyCwmp ) to configure our devices.
Freecwmo was mit maintained anymore. We extend the parameter set with the
openwrt parameter which are not in the standard.

Will the Meeting online (irc) for everyone?

Regards

Flo

Am 28.05.2016 1:34 nachm. schrieb "Hauke Mehrtens" :
>
> On 05/27/2016 12:43 PM, David Lang wrote:
> > On Thu, 26 May 2016, Delbar Jos wrote:
> >
> >> We are conscious of the fact that together with the proposals made by
> >> Felix, Luka and Wojtek we are now looking at many "competing"
> >> proposals. As a next step, we recommend to organize a workshop, at a
> >> practical location and time, where we put everything on the table and
> >> define the most appropriate path forward to the benefit of OpenWrt as
> >> a whole.
> >
> > nothing wrong with supporting many different remote management daemons.
> >
> >> TR-069 is a complicated remote management system and in order to make
> >> this initiative a success, we must ensure that the complexity is
> >> handled in an elegant way and with respect for OpenWrt's core
> >> architecture. More than on the protocol itself, we believe that we
> >> should focus on the architectural enhancements required to support
> >> remote management in general.
> >
> > What is it that you think is needed to "support remote management in
> > general"?
> >
> > It's worth pointing out that many people are remotely managing OpenWRT
> > devices, Ansible/Salt/Puppet/Chef/etc are all common tools for the job.
> >
> > now, those are all tools aimed at managing Linux Servers, not networking
> > gear, but OpenWRT is a server.
> >
> > So I'd suggest starting off by creating a daemon that talks  > protocol> and just stores the stuff it's sent in some simple files so
> > that it can return the info when queried.
> >
> > Once you have something that talks the network protocol correctly,
> > modifying it to change the real files, make uci calls, etc for different
> > distros is much easier (just write your daemon with the expectation that
> > the input and output details are going to change, so don't get fancy
> > with them).
> >
> > David Lang
>
> The TR-069 family is currently wildly used by ISPs controlling the (DSL)
> CPE devices of their customers. There are probably more than 100 million
> device controlled by standards from the TR-069 family out there.  When
> you get a DSL router from your ISP or buy one in the retail store it is
> very likely it supports the standards from the TR-069 family, as a
> vendor in this area you basically need support for this to sell your
> devices.
>
> In other technologies you have different protocols to manage your
> devices, like cable often uses something different and EPON and GPON
> even have all their own management standards. Then there are also some
> technology independent standards and so on. It makes sense to build such
> a solution in a way to make it easily to expendable for new protocols.
>
> Hauke
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH CC 1/4] usbutils: add license tag

2016-05-31 Thread Florian Eckert
show the license for this package in opkg

Signed-off-by: Florian Eckert 
---
 package/utils/usbutils/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/package/utils/usbutils/Makefile b/package/utils/usbutils/Makefile
index b1c058b..84359a3 100644
--- a/package/utils/usbutils/Makefile
+++ b/package/utils/usbutils/Makefile
@@ -9,11 +9,13 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=usbutils
 PKG_VERSION:=007
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=@KERNEL/linux/utils/usb/usbutils
 PKG_MD5SUM:=a6bd63d5c44cebb717a960eae22a3ca9
+PKG_LICENSE:=GPL-2.0
+PKG_LICENSE_FILES:=COPYING
 
 USB_IDS_VERSION:=2013-01-16
 USB_IDS_MD5SUM:=2a2344907b6344f0935c86efaf9de620
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH CC 2/4] qos-scripts: add license tag

2016-05-31 Thread Florian Eckert
show the license for this package in opkg

Signed-off-by: Florian Eckert 
---
 package/network/config/qos-scripts/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/network/config/qos-scripts/Makefile 
b/package/network/config/qos-scripts/Makefile
index a098598..bf5be62 100644
--- a/package/network/config/qos-scripts/Makefile
+++ b/package/network/config/qos-scripts/Makefile
@@ -9,9 +9,10 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=qos-scripts
 PKG_VERSION:=1.2.1
-PKG_RELEASE:=7
+PKG_RELEASE:=8
 
 PKG_MAINTAINER:=Felix Fietkau 
+PKG_LICENSE:=GPL-2.0
 
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH CC 3/4] px5g: add license tag

2016-05-31 Thread Florian Eckert
show the license for this package in opkg

Signed-off-by: Florian Eckert 
---
 package/utils/px5g/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/utils/px5g/Makefile b/package/utils/px5g/Makefile
index 8677a8b..071f479 100644
--- a/package/utils/px5g/Makefile
+++ b/package/utils/px5g/Makefile
@@ -8,9 +8,10 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=px5g
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_USE_MIPS16:=0
+PKG_LICENSE:=LGPL-2.1
 
 include $(INCLUDE_DIR)/package.mk
 
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH CC 4/4] libiconv-full: add license tag

2016-05-31 Thread Florian Eckert
show the license for this package in opkg

Signed-off-by: Florian Eckert 
---
 package/libs/libiconv-full/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/package/libs/libiconv-full/Makefile 
b/package/libs/libiconv-full/Makefile
index 75bca83..9be0c78 100644
--- a/package/libs/libiconv-full/Makefile
+++ b/package/libs/libiconv-full/Makefile
@@ -17,6 +17,8 @@ PKG_SOURCE:=libiconv-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@GNU/libiconv
 PKG_MD5SUM:=d42b97f6ef5dd0ba4469d520ed732fed
 PKG_BUILD_DIR:=$(BUILD_DIR)/libiconv-$(PKG_VERSION)
+PKG_LICENSE:=LGPL-2.0
+PKG_LICENSE_FILES:=COPYING.LIB
 
 PKG_FIXUP:=patch-libtool
 
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Automatic service reload

2015-09-22 Thread Florian Eckert
You have call the shell script in der /sbin/reload_config
Am 23.09.2015 4:56 vorm. schrieb "Lars Boegild Thomsen" <
l...@bright-things.com>:

> Hi Everybody,
>
>
>
> I am struggling a bit with triggering automatic service reload based on
> configuration change.
>
>
>
> Latest trunk and all that jazz. New software package called "mqttbridge"
> which basically is meant to publish ubus method results to mqtt. Init is in
> /etc/init.d/mqttbridge, config in /etc/config/mqttbridge.
>
>
>
> In the "olden days" this was all defined in /etc/config/ucitrack -
> something along this line:
>
>
>
> config mqttbridge
>
> option init mqttbridge
>
>
>
> However, according to this:
>
>
>
>
> http://wiki.openwrt.org/inbox/procd-init-scripts#procd_triggers_on_config_filenetwork_interface_changes
>
>
>
> It would appear that ucitrack is no longer used? I have also tried the
> service_triggers in the init script:
>
>
>
> root@pm2:/etc/config# cat /etc/init.d/mqttbridge
>
> #!/bin/sh /etc/rc.common
>
>
>
> START=90
>
>
>
> USE_PROCD=1
>
> NAME=mqttbridge
>
> PROG=/usr/sbin/mqttbridge
>
>
>
> start_service()
>
> {
>
> procd_open_instance
>
> procd_set_param respawn
>
> procd_set_param command "$PROG"
>
> procd_close_instance
>
> }
>
>
>
> service_triggers()
>
> {
>
> procd_add_reload_trigger "mqttbridge"
>
> }
>
>
>
> The thing is - neither approach (or rather both of them) works. Manual
> "/etc/init.d/mqttbridge" restart works fine, but automatic reload is never
> triggered on configuration change.
>
>
>
> What did I miss and what is the correct approach.
>
>
>
> --
>
> Lars Bøgild Thomsen
>
> Public Key: http://bright-things.com/lars-bogild-thomsen/
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] lantiq: bugfix uninitialized variables

2015-09-25 Thread Florian Eckert
Signed-off-by: Florian Eckert 
Reported-by: Sylwester Petela 
---

If you are in the luci overview page and the dsl is not in showtime state
and the variables are not initialized we get messages in log and luci brakes
> Thu Sep 17 15:40:16 2015 daemon.err uhttpd[1110]: expr: syntax error
> Thu Sep 17 15:40:16 2015 daemon.err uhttpd[1110]: expr: syntax error
> Thu Sep 17 15:40:16 2015 daemon.err uhttpd[1110]: expr: syntax error
> Thu Sep 17 15:40:16 2015 daemon.err uhttpd[1110]: expr: syntax error
> Thu Sep 17 15:40:17 2015 daemon.err uhttpd[1110]:
> /usr/lib/lua/luci/dispatcher.lua:433: Failed to execute function dispatcher
> target for entry '/'.
> Thu Sep 17 15:40:17 2015 daemon.err uhttpd[1110]: The called action
> terminated with an exception:
> Thu Sep 17 15:40:17 2015 daemon.err uhttpd[1110]:
> /usr/lib/lua/luci/dispatcher.lua:433: Failed to execute firstchild
> dispatcher target for entry '/admin'.
> Thu Sep 17 15:40:17 2015 daemon.err uhttpd[1110]: The called action
> terminated with an exception:
> Thu Sep 17 15:40:17 2015 daemon.err uhttpd[1110]:
> /usr/lib/lua/luci/dispatcher.lua:433: Failed to execute function dispatcher
> target for entry '/admin/status'.
> Thu Sep 17 15:40:17 2015 daemon.err uhttpd[1110]: The called action
> terminated with an exception:
> Thu Sep 17 15:40:17 2015 daemon.err uhttpd[1110]:
> /usr/lib/lua/luci/dispatcher.lua:433: Failed to execute template dispatcher
> target for entry '/admin/status/overview'.
> Thu Sep 17 15:40:17 2015 daemon.err uhttpd[1110]: The called action
> terminated with an exception:
> Thu Sep 17 15:40:17 2015 daemon.err uhttpd[1110]:
> /usr/lib/lua/luci/template.lua:97: Failed to execute template
> 'admin_status/index'.
> Thu Sep 17 15:40:17 2015 daemon.err uhttpd[1110]: A runtime error occured:
> [string "/usr/lib/lua/luci/view/admin_status/index.h..."]:85: attempt to
> call local 'dsl_func' (a nil value)
> Thu Sep 17 15:40:17 2015 daemon.err uhttpd[1110]: stack traceback:
> Thu Sep 17 15:40:17 2015 daemon.err uhttpd[1110]: [C]: in function
> 'assert'
> Thu Sep 17 15:40:17 2015 daemon.err uhttpd[1110]:
> /usr/lib/lua/luci/dispatcher.lua:433: in function 'dispatch'
> Thu Sep 17 15:40:17 2015 daemon.err uhttpd[1110]:
> /usr/lib/lua/luci/dispatcher.lua:168: in function
> 

The patch will resolve this issue.

 target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh 
b/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
index 7809d01..8f1d0c2 100755
--- a/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
+++ b/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
@@ -524,6 +524,8 @@ line_data() {
[ -z "$satnu" ] && satnu=0
[ -z "$snrd" ] && snrd=0
[ -z "$snru" ] && snru=0
+   [ -z "$actatpd" ] && actatpd=0
+   [ -z "$actatpu" ] && actatpu=0
 
latnd=$(dbt $latnd)
latnu=$(dbt $latnu)
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v3] lantiq: get more status information from xDSL

2015-10-03 Thread Florian Eckert
Hello,

Should i change only the four lines or should i change alle new lines which
where added by this patch.

I have also added a bug fix for values which are not initialized. See

https://lists.openwrt.org/pipermail/openwrt-devel/2015-September/036160.html

Kind regards

Flo
Am 03.10.2015 4:06 nachm. schrieb "Jo-Philipp Wich" :

> Hi,
>
> the patch caused a regression in LuCI, please see
> https://dev.openwrt.org/ticket/20607#comment:6
>
> Basically the problem is that the current "lucistatus" code emits
> invalid Lua code by providing no value for these parameters:
>
> dsl.errors_crc_p_near=
> dsl.errors_crc_p_far=
> dsl.errors_crcp_p_near=
> dsl.errors_crcp_p_far=
>
>
> Can you please provide a followup patch which changes the newly added
> lines to something like ...
>
>   echo "dsl.errors_crc_p_near=${crc_pn:-nil}"
>
> ... to ensure that there's always a value after the equal sign ?
>
>
> Regards,
> Jow
>
> On 08/06/2015 07:41 AM, feckert wrote:
> > Signed-off-by: Florian Eckert 
> > Signed-off-by: Helge Mader 
> > Tested-by: Martin Blumenstingl 
> > Tested-by: Andre Heider 
> > ---
> >
> > v2 fix annex and line mode comma
> > v2 fix latency to ms
> > v3 fix latency syntax quotation error "x ms"
> > v3 fix echo "" separation removed from status function
> >
> >  .../lantiq/base-files/lib/functions/lantiq_dsl.sh  |  412
> +++-
> >  1 file changed, 400 insertions(+), 12 deletions(-)
> >  mode change 100644 => 100755
> target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
> >
> > diff --git a/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
> b/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
> > old mode 100644
> > new mode 100755
> > index 56b8652..7809d01
> > --- a/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
> > +++ b/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
> > @@ -19,6 +19,9 @@ dsl_cmd() {
> >  dsl_val() {
> >   echo $(expr "$1" : '.*'$2'=\([-\.[:alnum:]]*\).*')
> >  }
> > +dsl_string() {
> > + echo $(expr "$1" : '.*'$2'=(\([A-Z0-9,]*\))')
> > +}
> >
> >  #
> >  # Simple divide by 10 routine to cope with one decimal place
> > @@ -49,6 +52,16 @@ scale() {
> >   fi
> >  }
> >
> > +scale_latency() {
> > + local val=$1
> > + local a
> > + local b
> > +
> > + a=$(expr $val / 100)
> > + b=$(expr $val % 100)
> > + printf "%d.%d ms" ${a} ${b}
> > +}
> > +
> >  #
> >  # Read the data rates for both directions
> >  #
> > @@ -77,7 +90,7 @@ data_rates() {
> >   echo "dsl.data_rate_down_s=\"$sdrd\""
> >   echo "dsl.data_rate_up_s=\"$sdru\""
> >   else
> > - echo "Data Rate:${sdrd}/s / ${sdru}/s"
> > + echo "Data Rate:Down:
> ${sdrd}/s / Up: ${sdru}/s"
> >   fi
> >  }
> >
> > @@ -92,11 +105,340 @@ chipset() {
> >   vig=$(dsl_cmd vig)
> >   cs=$(dsl_val "$vig" DSL_ChipSetType)
> >   csv=$(dsl_val "$vig" DSL_ChipSetHWVersion)
> > + csfw=$(dsl_val "$vig" DSL_ChipSetFWVersion)
> > + csapi=$(dsl_val "$vig" DSL_DriverVersionApi)
> >
> >   if [ "$action" = "lucistat" ]; then
> >   echo "dsl.chipset=\"${cs} ${csv}\""
> > + echo "dsl.firmware_version=\"${csfw}\""
> > + echo "dsl.api_version=\"${csapi}\""
> >   else
> > - echo "Chipset:  ${cs} ${csv}"
> > + echo "Chipset:  ${cs}
> ${csv}"
> > + echo "Firmware Version: ${csfw}"
> > + echo "API Version:  ${csapi}"
> > + fi
> > +}
> > +
> > +#
> > +# Vendor information
> > +#
> > +vendor() {
> > + local lig
> > + local vid
> > + local svid
> > +
> > + lig=$(dsl_cmd g997lig 1)
> > + vid=$(dsl_string "$lig" G994VendorID)
> > + svid=$(dsl_string "$lig" SystemVendorID)
> > +
> > + if [ "$action" = "lucistat" ]; then
> > +   

[OpenWrt-Devel] [PATCH] lantiq: bugfix luci lantiq_dsl status

2015-10-07 Thread Florian Eckert
Signed-off-by: Florian Eckert 
Signed-off-by: Helge Mader 
Reported-by: Jo-Philipp Wich 

---

Basically the problem is that the current "lucistatus" code emits
invalid Lua code by providing no value for some  parameters if dsl
is not in showtime mode.

 .../lantiq/base-files/lib/functions/lantiq_dsl.sh  | 50 +++---
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh 
b/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
index 8f1d0c2..46f3a17 100755
--- a/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
+++ b/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
@@ -268,14 +268,14 @@ xtse() {
xtse_s="${xtse1}, ${xtse2}, ${xtse3}, ${xtse4}, ${xtse5}, ${xtse6}, 
${xtse7}, ${xtse8}"
 
if [ "$action" = "lucistat" ]; then
-   echo "dsl.xtse1=$xtse1"
-   echo "dsl.xtse2=$xtse2"
-   echo "dsl.xtse3=$xtse3"
-   echo "dsl.xtse4=$xtse4"
-   echo "dsl.xtse5=$xtse5"
-   echo "dsl.xtse6=$xtse6"
-   echo "dsl.xtse7=$xtse7"
-   echo "dsl.xtse8=$xtse8"
+   echo "dsl.xtse1=${xtse1:-nil}"
+   echo "dsl.xtse2=${xtse2:-nil}"
+   echo "dsl.xtse3=${xtse3:-nil}"
+   echo "dsl.xtse4=${xtse4:-nil}"
+   echo "dsl.xtse5=${xtse5:-nil}"
+   echo "dsl.xtse6=${xtse6:-nil}"
+   echo "dsl.xtse7=${xtse7:-nil}"
+   echo "dsl.xtse8=${xtse8:-nil}"
echo "dsl.xtse_s=\"$xtse_s\""
echo "dsl.annex_s=\"${annex_s}\""
echo "dsl.line_mode_s=\"${line_mode_s}\""
@@ -304,7 +304,7 @@ power_mode() {
esac
 
if [ "$action" = "lucistat" ]; then
-   echo "dsl.power_mode_num=$pm"
+   echo "dsl.power_mode_num=${pm:-nil}"
echo "dsl.power_mode_s=\"$s\""
else
echo "Power Management Mode:$s"
@@ -414,22 +414,22 @@ errors() {
fecn=$(dsl_val "$ccsg" nFEC)
 
if [ "$action" = "lucistat" ]; then
-   echo "dsl.errors_fec_near=$fecn"
-   echo "dsl.errors_fec_far=$fecf"
-   echo "dsl.errors_es_near=$esn"
-   echo "dsl.errors_es_far=$esf"
-   echo "dsl.errors_ses_near=$sesn"
-   echo "dsl.errors_ses_far=$sesf"
-   echo "dsl.errors_loss_near=$lossn"
-   echo "dsl.errors_loss_far=$lossf"
-   echo "dsl.errors_uas_near=$uasn"
-   echo "dsl.errors_uas_far=$uasf"
-   echo "dsl.errors_hec_near=$hecn"
-   echo "dsl.errors_hec_far=$hecf"
-   echo "dsl.errors_crc_p_near=$crc_pn"
-   echo "dsl.errors_crc_p_far=$crc_pf"
-   echo "dsl.errors_crcp_p_near=$crcp_pn"
-   echo "dsl.errors_crcp_p_far=$crcp_pf"
+   echo "dsl.errors_fec_near=${fecn:-nil}"
+   echo "dsl.errors_fec_far=${fecf:-nil}"
+   echo "dsl.errors_es_near=${esn:-nil}"
+   echo "dsl.errors_es_far=${esf:-nil}"
+   echo "dsl.errors_ses_near=${sesn:-nil}"
+   echo "dsl.errors_ses_far=${sesf:-nil}"
+   echo "dsl.errors_loss_near=${lossn:-nil}"
+   echo "dsl.errors_loss_far=${lossf:-nil}"
+   echo "dsl.errors_uas_near=${uasn:-nil}"
+   echo "dsl.errors_uas_far=${uasf:-nil}"
+   echo "dsl.errors_hec_near=${hecn:-nil}"
+   echo "dsl.errors_hec_far=${hecf:-nil}"
+   echo "dsl.errors_crc_p_near=${crc_pn:-nil}"
+   echo "dsl.errors_crc_p_far=${crc_pf:-nil}"
+   echo "dsl.errors_crcp_p_near=${crcp_pn:-nil}"
+   echo "dsl.errors_crcp_p_far=${crcp_pf:-nil}"
else
echo "Forward Error Correction Seconds (FECS):  Near: ${fecn} / 
Far: ${fecf}"
echo "Errored seconds (ES): Near: ${esn} / 
Far: ${esf}"
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] lantiq: add phy led config support over devicetree bindings

2015-11-09 Thread Florian Eckert
---

This patch adds the posibility to config the led behaviour of the lantiq phys 
over the devicetree bindings. It patches the 
0023-NET-PHY-adds-driver-for-lantiq-PHY11G
for 3.18 and 4.1. I have also added a register description overview for 
applicable values.

 ...023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch | 268 -
 ...023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch | 268 -
 2 files changed, 534 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 
target/linux/lantiq/patches-3.18/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch

diff --git 
a/target/linux/lantiq/patches-3.18/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch
 
b/target/linux/lantiq/patches-3.18/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch
old mode 100644
new mode 100755
index 6d1805f..55db4c7
--- 
a/target/linux/lantiq/patches-3.18/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch
+++ 
b/target/linux/lantiq/patches-3.18/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch
@@ -37,7 +37,7 @@ Signed-off-by: John Crispin 
  obj-$(CONFIG_AT803X_PHY)  += at803x.o
 --- /dev/null
 +++ b/drivers/net/phy/lantiq.c
-@@ -0,0 +1,231 @@
+@@ -0,0 +1,278 @@
 +/*
 + *   This program is free software; you can redistribute it and/or modify
 + *   it under the terms of the GNU General Public License as published by
@@ -58,6 +58,7 @@ Signed-off-by: John Crispin 
 +
 +#include 
 +#include 
++#include 
 +
 +#define MII_MMDCTRL   0x0d
 +#define MII_MMDDATA   0x0e
@@ -104,6 +105,50 @@ Signed-off-by: John Crispin 
 +  return 0;
 +}
 +
++#if IS_ENABLED(CONFIG_OF_MDIO)
++static int vr9_gphy_of_reg_init(struct phy_device *phydev)
++{
++  u32 tmp;
++
++  /* store the led values if one was passed by the devicetree */
++  if (!of_property_read_u32(phydev->dev.of_node, "lantiq,ledch", &tmp))
++  vr9_gphy_mmd_write(phydev, 0x1e0, tmp);
++
++  if (!of_property_read_u32(phydev->dev.of_node, "lantiq,ledcl", &tmp))
++  vr9_gphy_mmd_write(phydev, 0x1e1, tmp);
++
++  if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led0h", &tmp))
++  vr9_gphy_mmd_write(phydev, 0x1e2, tmp);
++
++  if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led0l", &tmp))
++  vr9_gphy_mmd_write(phydev, 0x1e3, tmp);
++
++  if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led1h", &tmp))
++  vr9_gphy_mmd_write(phydev, 0x1e4, tmp);
++
++  if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led1l", &tmp))
++  vr9_gphy_mmd_write(phydev, 0x1e5, tmp);
++  if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led2h", &tmp))
++  vr9_gphy_mmd_write(phydev, 0x1e6, tmp);
++
++  if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led2l", &tmp))
++  vr9_gphy_mmd_write(phydev, 0x1e7, tmp);
++
++  if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led3h", &tmp))
++  vr9_gphy_mmd_write(phydev, 0x1e8, tmp);
++
++  if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led3l", &tmp))
++  vr9_gphy_mmd_write(phydev, 0x1e9, tmp);
++
++  return 0;
++}
++#else
++static int vr9_gphy_of_reg_init(struct phy_device *phydev)
++{
++  return 0;
++}
++#endif /* CONFIG_OF_MDIO */
++
 +static int vr9_gphy_config_init(struct phy_device *phydev)
 +{
 +  int err;
@@ -129,6 +174,8 @@ Signed-off-by: John Crispin 
 +  vr9_gphy_mmd_write(phydev, 0x1e8, 0x40);
 +  vr9_gphy_mmd_write(phydev, 0x1e9, 0x20);
 +
++  vr9_gphy_of_reg_init(phydev);
++
 +  return 0;
 +}
 +
@@ -269,3 +316,222 @@ Signed-off-by: John Crispin 
 +MODULE_DESCRIPTION("Lantiq PHY drivers");
 +MODULE_AUTHOR("Daniel Schwierzeck ");
 +MODULE_LICENSE("GPL");
+--- /dev/null
 b/Documentation/devicetree/bindings/phy/phy-lanitq.txt
+@@ -0,0 +1,216 @@
++Lanitq PHY binding
++
++
++This devicetree binding controls the lantiq ethernet phys led functionality.
++
++Example:
++  mdio@0 {
++  #address-cells = <1>;
++  #size-cells = <0>;
++  compatible = "lantiq,xrx200-mdio";
++  phy5: ethernet-phy@5 {
++  reg = <0x1>;
++  compatible = "lantiq,phy11g", 
"ethernet-phy-ieee802.3-c22";
++  };
++  phy11: ethernet-phy@11 {
++  reg = <0x11>;
++  compatible = "lantiq,phy22f", 
"ethernet-phy-ieee802.3-c22";
++  lantiq,led2h = <0x00>;
++  lantiq,led2l = <0x03>;
++  };
++  phy12: ethernet-phy@12 {
++  reg = <0x12>;
++  compatible = "lantiq,phy22f", 
"ethernet-phy-ieee802.3-c22";
++  lantiq,led1h = <0x00>;
++  lantiq,led1l = <0x03>;
++  };
++  phy13: ethernet-phy@13 {
++  reg = <0x13>;
++  compatible = 

[OpenWrt-Devel] [PATCH v2] lantiq: add phy led config support over devicetree bindings

2015-11-09 Thread Florian Eckert
This patch adds the posibility to config the led behaviour of the lantiq phys 
over the devicetree bindings.It patches the 
0023-NET-PHY-adds-driver-for-lantiq-PHY11G
for 3.18 and 4.1. I have also added a register description overview for 
applicable values. This goes to the documentation folder in the linux kernel.

Signed-off-by: Florian Eckert 
---

v2 add Signed-off-by marker

 ...023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch | 268 -
 ...023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch | 268 -
 2 files changed, 534 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 
target/linux/lantiq/patches-3.18/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch

diff --git 
a/target/linux/lantiq/patches-3.18/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch
 
b/target/linux/lantiq/patches-3.18/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch
old mode 100644
new mode 100755
index 6d1805f..55db4c7
--- 
a/target/linux/lantiq/patches-3.18/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch
+++ 
b/target/linux/lantiq/patches-3.18/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch
@@ -37,7 +37,7 @@ Signed-off-by: John Crispin 
  obj-$(CONFIG_AT803X_PHY)  += at803x.o
 --- /dev/null
 +++ b/drivers/net/phy/lantiq.c
-@@ -0,0 +1,231 @@
+@@ -0,0 +1,278 @@
 +/*
 + *   This program is free software; you can redistribute it and/or modify
 + *   it under the terms of the GNU General Public License as published by
@@ -58,6 +58,7 @@ Signed-off-by: John Crispin 
 +
 +#include 
 +#include 
++#include 
 +
 +#define MII_MMDCTRL   0x0d
 +#define MII_MMDDATA   0x0e
@@ -104,6 +105,50 @@ Signed-off-by: John Crispin 
 +  return 0;
 +}
 +
++#if IS_ENABLED(CONFIG_OF_MDIO)
++static int vr9_gphy_of_reg_init(struct phy_device *phydev)
++{
++  u32 tmp;
++
++  /* store the led values if one was passed by the devicetree */
++  if (!of_property_read_u32(phydev->dev.of_node, "lantiq,ledch", &tmp))
++  vr9_gphy_mmd_write(phydev, 0x1e0, tmp);
++
++  if (!of_property_read_u32(phydev->dev.of_node, "lantiq,ledcl", &tmp))
++  vr9_gphy_mmd_write(phydev, 0x1e1, tmp);
++
++  if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led0h", &tmp))
++  vr9_gphy_mmd_write(phydev, 0x1e2, tmp);
++
++  if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led0l", &tmp))
++  vr9_gphy_mmd_write(phydev, 0x1e3, tmp);
++
++  if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led1h", &tmp))
++  vr9_gphy_mmd_write(phydev, 0x1e4, tmp);
++
++  if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led1l", &tmp))
++  vr9_gphy_mmd_write(phydev, 0x1e5, tmp);
++  if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led2h", &tmp))
++  vr9_gphy_mmd_write(phydev, 0x1e6, tmp);
++
++  if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led2l", &tmp))
++  vr9_gphy_mmd_write(phydev, 0x1e7, tmp);
++
++  if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led3h", &tmp))
++  vr9_gphy_mmd_write(phydev, 0x1e8, tmp);
++
++  if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led3l", &tmp))
++  vr9_gphy_mmd_write(phydev, 0x1e9, tmp);
++
++  return 0;
++}
++#else
++static int vr9_gphy_of_reg_init(struct phy_device *phydev)
++{
++  return 0;
++}
++#endif /* CONFIG_OF_MDIO */
++
 +static int vr9_gphy_config_init(struct phy_device *phydev)
 +{
 +  int err;
@@ -129,6 +174,8 @@ Signed-off-by: John Crispin 
 +  vr9_gphy_mmd_write(phydev, 0x1e8, 0x40);
 +  vr9_gphy_mmd_write(phydev, 0x1e9, 0x20);
 +
++  vr9_gphy_of_reg_init(phydev);
++
 +  return 0;
 +}
 +
@@ -269,3 +316,222 @@ Signed-off-by: John Crispin 
 +MODULE_DESCRIPTION("Lantiq PHY drivers");
 +MODULE_AUTHOR("Daniel Schwierzeck ");
 +MODULE_LICENSE("GPL");
+--- /dev/null
 b/Documentation/devicetree/bindings/phy/phy-lanitq.txt
+@@ -0,0 +1,216 @@
++Lanitq PHY binding
++
++
++This devicetree binding controls the lantiq ethernet phys led functionality.
++
++Example:
++  mdio@0 {
++  #address-cells = <1>;
++  #size-cells = <0>;
++  compatible = "lantiq,xrx200-mdio";
++  phy5: ethernet-phy@5 {
++  reg = <0x1>;
++  compatible = "lantiq,phy11g", 
"ethernet-phy-ieee802.3-c22";
++  };
++  phy11: ethernet-phy@11 {
++  reg = <0x11>;
++  compatible = "lantiq,phy22f", 
"ethernet-phy-ieee802.3-c22";
++  lantiq,led2h = <0x00>;
++  lantiq,led2l =

Re: [OpenWrt-Devel] [PATCH v2] lantiq: add phy led config support over devicetree bindings

2015-11-21 Thread Florian Eckert
Hallo,

if you mean "CONFIG_OF_MDIO"? I have added this define because if we have
no "openfirmware" a dummy function will be called. Or do you mean the whole
patch?

Regards

Flo

Am 21.11.2015 6:55 nachm. schrieb "John Crispin" :
>
> Hi
>
> 1 comment inline
>
> On 09/11/2015 13:44, Florian Eckert wrote:
> > This patch adds the posibility to config the led behaviour of the
lantiq phys
> > over the devicetree bindings.It patches the
0023-NET-PHY-adds-driver-for-lantiq-PHY11G
> > for 3.18 and 4.1. I have also added a register description overview for
> > applicable values. This goes to the documentation folder in the linux
kernel.
> >
> > Signed-off-by: Florian Eckert 
> > ---
> >
> > v2 add Signed-off-by marker
> >
> >  ...023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch | 268
-
> >  ...023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch | 268
-
> >  2 files changed, 534 insertions(+), 2 deletions(-)
> >  mode change 100644 => 100755
target/linux/lantiq/patches-3.18/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch
> >
> > diff --git
a/target/linux/lantiq/patches-3.18/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch
b/target/linux/lantiq/patches-3.18/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch
> > old mode 100644
> > new mode 100755
> > index 6d1805f..55db4c7
> > ---
a/target/linux/lantiq/patches-3.18/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch
> > +++
b/target/linux/lantiq/patches-3.18/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch
> > @@ -37,7 +37,7 @@ Signed-off-by: John Crispin 
> >   obj-$(CONFIG_AT803X_PHY)+= at803x.o
> >  --- /dev/null
> >  +++ b/drivers/net/phy/lantiq.c
> > -@@ -0,0 +1,231 @@
> > +@@ -0,0 +1,278 @@
> >  +/*
> >  + *   This program is free software; you can redistribute it and/or
modify
> >  + *   it under the terms of the GNU General Public License as
published by
> > @@ -58,6 +58,7 @@ Signed-off-by: John Crispin 
> >  +
> >  +#include 
> >  +#include 
> > ++#include 
> >  +
> >  +#define MII_MMDCTRL 0x0d
> >  +#define MII_MMDDATA 0x0e
> > @@ -104,6 +105,50 @@ Signed-off-by: John Crispin 
> >  +return 0;
> >  +}
> >  +
> > ++#if IS_ENABLED(CONFIG_OF_MDIO)
>
> we are inside a phy driver here that we talk to using a mdio bus. are
> you sure this is required ?
>
> John
>
> > ++static int vr9_gphy_of_reg_init(struct phy_device *phydev)
> > ++{
> > ++u32 tmp;
> > ++
> > ++/* store the led values if one was passed by the devicetree */
> > ++if (!of_property_read_u32(phydev->dev.of_node, "lantiq,ledch",
&tmp))
> > ++vr9_gphy_mmd_write(phydev, 0x1e0, tmp);
> > ++
> > ++if (!of_property_read_u32(phydev->dev.of_node, "lantiq,ledcl",
&tmp))
> > ++vr9_gphy_mmd_write(phydev, 0x1e1, tmp);
> > ++
> > ++if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led0h",
&tmp))
> > ++vr9_gphy_mmd_write(phydev, 0x1e2, tmp);
> > ++
> > ++if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led0l",
&tmp))
> > ++vr9_gphy_mmd_write(phydev, 0x1e3, tmp);
> > ++
> > ++if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led1h",
&tmp))
> > ++vr9_gphy_mmd_write(phydev, 0x1e4, tmp);
> > ++
> > ++if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led1l",
&tmp))
> > ++vr9_gphy_mmd_write(phydev, 0x1e5, tmp);
> > ++if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led2h",
&tmp))
> > ++vr9_gphy_mmd_write(phydev, 0x1e6, tmp);
> > ++
> > ++if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led2l",
&tmp))
> > ++vr9_gphy_mmd_write(phydev, 0x1e7, tmp);
> > ++
> > ++if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led3h",
&tmp))
> > ++vr9_gphy_mmd_write(phydev, 0x1e8, tmp);
> > ++
> > ++if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led3l",
&tmp))
> > ++vr9_gphy_mmd_write(phydev, 0x1e9, tmp);
> > ++
> > ++return 0;
> > ++}
> > ++#else
> > ++static int vr9_gphy_of_reg_init(struct phy_device *phydev)
> > ++{
> > ++return 0;
> > ++}
> > ++#endif /* CONFIG_OF_MDIO */
> > ++
> >  +static int vr9_gphy_config_init(struct phy_device *phydev)
> >  +{
> >  +int err;
> > @@ -129,6 +17

Re: [OpenWrt-Devel] [PATCH 2/8] lantiq: add dsl-vr9-firmware-xdsl

2015-11-25 Thread Florian Eckert
Sounds good,

Lantiq will move as discussed on the openwrt summit.
Does this mean that in the future other firmwares (older/newer) are
provided by lantiq?

Flo

2015-11-25 23:39 GMT+01:00 Hauke Mehrtens :
> On 11/25/2015 11:29 AM, John Crispin wrote:
>>
>>
>> On 25/11/2015 10:53, Andre Heider wrote:
>>> Hi,
>>>
>>> On Tue, Nov 24, 2015 at 9:24 PM, Hauke Mehrtens  wrote:
 +define Package/dsl-vr9-firmware-xdsl/install
 +   $(INSTALL_DIR) $(1)/lib/firmware/
 +   $(INSTALL_DATA) $(PKG_BUILD_DIR)/LICENSE 
 $(1)/lib/firmware/xcpe_574306_571801.LICENSE
 +   $(INSTALL_DATA) $(PKG_BUILD_DIR)/xcpe_574306_571801.bin 
 $(1)/lib/firmware/
 +   ln -s xcpe_574306_571801.bin $(1)/lib/firmware/vdsl.bin
 +endef
>>>
>>> this adds +900kb to the root fs, at least on my TD-W8970 there's a MTD
>>> partition which I use for the dsl firmware.
>>> That gets tmpfs mounted at boot, see /etc/init.d/dsl_fs and
>>> /sbin/vdsl_fw_install.sh.
>>>
>>> Can we use that instead?
>>>
>>> Regards,
>>> Andre
>>>
>>
>> no we will drop the dsl partition once the annex-B version of the FW is
>> available.
>>   John
>>
> Hi,
>
> the Annex B firmware is currently located here, but it should show up on
> the OpenWrt mirror soon:
> https://www.hauke-m.de/files/.lantiq/dsl_vr9_firmware_xdsl-05.07.03.03.00.06_05.07.01.0C.00.02_osc.tar.gz
>
> We probably have to change some of the scripts, because OpenWrt was not
> allowed to ship the firmware before. Currently it is in a extra package.
>
> Hauke
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



-- 
Mit freundlichen Grüßen
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] fstools: factory reset on power failure during startup

2015-11-26 Thread Florian Eckert
Hi,

I am using openwrt CC and an ubifs filesystem on top of ubi.
If I plug off the power during startup, some times my configuration
get lost and i am back to factory reset.

In the package fstools there is the bin "mount_root" it is called
twice during startup.
1. S10boot at line 10
2. S95done at line 6

this calles edit the ./fs_state link

S10boot/S95done:
---
Because ubifs is doing filesystem handling in a background process
"ubi_bgt0d", could it be possible,
that (see code) ./.fs_state is not rewritten written anymore?
So that at next boot the system thinks he is in upgrade mode?

If I add a sleep(10) between unlink and symlink function call i can
reproduce the failure if i unplug the power.
I think the first think what should be done is to call
"snprintf(valstr, sizeof(valstr), "%d", state);" before "unlink(path).

Or this this a deeper Problem?

int fs_state_set(const char *dir, enum fs_state state)
{
char valstr[16];
char *path;

->path = alloca(strlen(dir) + 1 + sizeof("/.fs_state"));
->sprintf(path, "%s/.fs_state", dir);
->unlink(path);
->snprintf(valstr, sizeof(valstr), "%d", state);

return symlink(valstr, path);
}

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


Re: [OpenWrt-Devel] fstools: factory reset on power failure during startup

2015-11-26 Thread Florian Eckert
Hi,

thank your very much for your fast reply and the fix :-).
I will try it and give you an respond.

flo

2015-11-26 14:05 GMT+01:00 Felix Fietkau :
> On 2015-11-26 09:24, Florian Eckert wrote:
>> Hi,
>>
>> I am using openwrt CC and an ubifs filesystem on top of ubi.
>> If I plug off the power during startup, some times my configuration
>> get lost and i am back to factory reset.
>>
>> In the package fstools there is the bin "mount_root" it is called
>> twice during startup.
>> 1. S10boot at line 10
>> 2. S95done at line 6
>>
>> this calles edit the ./fs_state link
>>
>> S10boot/S95done:
>> ---
>> Because ubifs is doing filesystem handling in a background process
>> "ubi_bgt0d", could it be possible,
>> that (see code) ./.fs_state is not rewritten written anymore?
>> So that at next boot the system thinks he is in upgrade mode?
>>
>> If I add a sleep(10) between unlink and symlink function call i can
>> reproduce the failure if i unplug the power.
>> I think the first think what should be done is to call
>> "snprintf(valstr, sizeof(valstr), "%d", state);" before "unlink(path).
>>
>> Or this this a deeper Problem?
> I think you're right that there's a race here. When I wrote this code,
> I never actually intended for the file to get re-written after the
> first boot, it seems that I simply forgot to add the necessary check
> for it.
> Please test if this fstools patch fixes the problem:
> ---
> --- a/libfstools/overlay.c
> +++ b/libfstools/overlay.c
> @@ -311,6 +311,9 @@ int fs_state_set(const char *dir, enum fs_state state)
> char valstr[16];
> char *path;
>
> +   if (fs_state_get(dir) == state)
> +   return 0;
> +
> path = alloca(strlen(dir) + 1 + sizeof("/.fs_state"));
> sprintf(path, "%s/.fs_state", dir);
> unlink(path);
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] fstools: factory reset on power failure during startup

2015-11-27 Thread Florian Eckert
Hi,

I have tested your patch since last day when I got the patch from you.
I am using an programmable dc/dc power supply, who switches the power
between startup randomly.
I will run the test during the weekend. And then I will see what
happend on Monday morning.
But for now i havn't lost the configuration anymore.

Flo


2015-11-26 14:25 GMT+01:00 Florian Eckert :
> Hi,
>
> thank your very much for your fast reply and the fix :-).
> I will try it and give you an respond.
>
> flo
>
> 2015-11-26 14:05 GMT+01:00 Felix Fietkau :
>> On 2015-11-26 09:24, Florian Eckert wrote:
>>> Hi,
>>>
>>> I am using openwrt CC and an ubifs filesystem on top of ubi.
>>> If I plug off the power during startup, some times my configuration
>>> get lost and i am back to factory reset.
>>>
>>> In the package fstools there is the bin "mount_root" it is called
>>> twice during startup.
>>> 1. S10boot at line 10
>>> 2. S95done at line 6
>>>
>>> this calles edit the ./fs_state link
>>>
>>> S10boot/S95done:
>>> ---
>>> Because ubifs is doing filesystem handling in a background process
>>> "ubi_bgt0d", could it be possible,
>>> that (see code) ./.fs_state is not rewritten written anymore?
>>> So that at next boot the system thinks he is in upgrade mode?
>>>
>>> If I add a sleep(10) between unlink and symlink function call i can
>>> reproduce the failure if i unplug the power.
>>> I think the first think what should be done is to call
>>> "snprintf(valstr, sizeof(valstr), "%d", state);" before "unlink(path).
>>>
>>> Or this this a deeper Problem?
>> I think you're right that there's a race here. When I wrote this code,
>> I never actually intended for the file to get re-written after the
>> first boot, it seems that I simply forgot to add the necessary check
>> for it.
>> Please test if this fstools patch fixes the problem:
>> ---
>> --- a/libfstools/overlay.c
>> +++ b/libfstools/overlay.c
>> @@ -311,6 +311,9 @@ int fs_state_set(const char *dir, enum fs_state state)
>> char valstr[16];
>> char *path;
>>
>> +   if (fs_state_get(dir) == state)
>> +   return 0;
>> +
>> path = alloca(strlen(dir) + 1 + sizeof("/.fs_state"));
>> sprintf(path, "%s/.fs_state", dir);
>> unlink(path);
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] fstools: factory reset on power failure during startup

2015-11-30 Thread Florian Eckert
Hello,

i think the patch fixes the issue.
We could reproduce a factory reset with the dc/dc test very often
befor we apply your patch.
But now i think there is an other problem with ubifs! See log

The system fails at Saturday evening with this error

Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[7.184000] random: nonblocking pool is initialized
[   10.236000] mount_root: Boot cmd:
[   10.264000] UBIFS: background thread "ubifs_bgt0_1" started, PID 302
[   10.288000] UBIFS: recovery needed
[   10.292000] UBIFS error (pid 300): check_lpt_type: invalid type
(15) in LPT node type 2
[   10.30] CPU: 0 PID: 300 Comm: mount_root Not tainted 3.18.23 #37
[   10.304000] Stack :     804e45f2
0038  
  87bb9350 0001 8041316c 80490b43 012c 804e382c 87bb9350 0001
  87013db8 87013dbc c01bd000 80055e54 0006 8002d3e8  
  804179e8 87013d2c      
         
  ...
[   10.34] Call Trace:
[   10.344000] [<800199a8>] show_stack+0x50/0x84
[   10.348000] [<80161b88>] check_lpt_type.constprop.9+0x4c/0x60
[   10.352000] [<80163bc0>] ubifs_lpt_init+0x148/0x4e8
[   10.36] [<8014adc8>] ubifs_mount+0xfec/0x1794
[   10.364000] [<800cba38>] mount_fs+0x20/0xdc
[   10.368000] [<800e4634>] vfs_kern_mount+0x64/0x138
[   10.372000] [<800e7f74>] do_mount+0x95c/0xb20
[   10.376000] [<800e8478>] SyS_mount+0x90/0xd4
[   10.38] [<8000875c>] handle_sys+0x11c/0x140
[   10.384000]
[   10.388000] UBIFS: background thread "ubifs_bgt0_1" stops
[   10.392000] mount_root: failed to mount -t ubifs /dev/ubi0_1
/tmp/overlay: Invalid argument
[   10.40] mount_root: TDT readlink return value of file
/tmp/overlay/.fs_state is -1
[   10.408000] mount_root: TDT readlink error string is ** No such
file or directory **
[   10.416000] mount_root: TDT actual filystem state is 0
[   10.42] mount_root: TDT readlink return value of file
/tmp/overlay/.fs_state is -1
[   10.428000] mount_root: TDT readlink error string is ** No such
file or directory **
[   10.436000] mount_root: TDT readlink return value of file
/tmp/overlay/.fs_state is 1
[   10.444000] mount_root: overlay filesystem has not been fully initialized yet
[   10.452000] mount_root: switching to jffs2 overlay
[   10.456000] mount_root: TDT olddir /tmp/overlay failed: No such
file or directory
[   10.464000] mount_root: switching to jffs2 failed - fallback to ramoverlay
[   10.472000] mount_root: failed /rom/overlay /overlay: Invalid argument
[   10.488000] procd: - early -
[   10.492000] procd: - watchdog -
[   11.212000] procd: - ubus -
[   12.22] procd: - init -
Please press Enter to activate this console.
#

I dont know if you are the right persons?
I think it has do to with the ubifs layer and not with your fstool.

Flo


2015-11-27 13:17 GMT+01:00 Florian Eckert :
> Hi,
>
> I have tested your patch since last day when I got the patch from you.
> I am using an programmable dc/dc power supply, who switches the power
> between startup randomly.
> I will run the test during the weekend. And then I will see what
> happend on Monday morning.
> But for now i havn't lost the configuration anymore.
>
> Flo
>
>
> 2015-11-26 14:25 GMT+01:00 Florian Eckert :
>> Hi,
>>
>> thank your very much for your fast reply and the fix :-).
>> I will try it and give you an respond.
>>
>> flo
>>
>> 2015-11-26 14:05 GMT+01:00 Felix Fietkau :
>>> On 2015-11-26 09:24, Florian Eckert wrote:
>>>> Hi,
>>>>
>>>> I am using openwrt CC and an ubifs filesystem on top of ubi.
>>>> If I plug off the power during startup, some times my configuration
>>>> get lost and i am back to factory reset.
>>>>
>>>> In the package fstools there is the bin "mount_root" it is called
>>>> twice during startup.
>>>> 1. S10boot at line 10
>>>> 2. S95done at line 6
>>>>
>>>> this calles edit the ./fs_state link
>>>>
>>>> S10boot/S95done:
>>>> ---
>>>> Because ubifs is doing filesystem handling in a background process
>>>> "ubi_bgt0d", could it be possible,
>>>> that (see code) ./.fs_state is not rewritten written anymore?
>>>> So that at next boot the system thinks he is in upgrade mode?
>>>>
>>>> If I add a sleep(10) between unlink and symlink function call i can
>>>> reproduce the failure if i unplug the power.
>>>> I think the first

[OpenWrt-Devel] lantiq: vrx200 nmi handling

2015-12-04 Thread Florian Eckert
Hallo mailinglist,

I have seen in the linux sources of the lantiq falcon soc, that there
is some working done for nmi handling.

I have an lantiq xrx200 board and want to use nmi handling to react on
an power failure which is signaled over the nmi gpio.
I have seen filesystem errors if it is not cleanly unmounted (raw nand
writes/erases not completly finshed for an peb)

https://lists.openwrt.org/pipermail/openwrt-devel/2015-November/037575.html

I have lookend around in the sources but it is not obvious what i have
do to get called my own nmi function.

Does anyone has an hint?

Regards

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


[OpenWrt-Devel] [PATCH] openssl: add config option for no_hw support

2015-12-09 Thread Florian Eckert
The hardware support is required by some 3rd party engines (tpm)

Signed-off-by: Florian Eckert 
---
 package/libs/openssl/Config.in | 5 +
 package/libs/openssl/Makefile  | 9 +++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/package/libs/openssl/Config.in b/package/libs/openssl/Config.in
index b0a29c5..e2aa10d 100644
--- a/package/libs/openssl/Config.in
+++ b/package/libs/openssl/Config.in
@@ -25,4 +25,9 @@ config OPENSSL_ENGINE_DIGEST
depends on OPENSSL_ENGINE_CRYPTO
prompt "Digests acceleration support"
 
+config OPENSSL_HARDWARE_SUPPORT
+   bool
+   default n
+   prompt "Enable hardware support"
+
 endmenu
diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index 17f7d03..5358e35 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -29,7 +29,8 @@ PKG_CONFIG_DEPENDS:= \
CONFIG_OPENSSL_ENGINE_DIGEST \
CONFIG_OPENSSL_WITH_EC \
CONFIG_OPENSSL_WITH_EC2M \
-   CONFIG_OPENSSL_WITH_SSL3
+   CONFIG_OPENSSL_WITH_SSL3 \
+   CONFIG_OPENSSL_HARDWARE_SUPPORT
 
 include $(INCLUDE_DIR)/package.mk
 
@@ -89,7 +90,7 @@ endef
 
 
 OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-camellia no-krb5
-OPENSSL_OPTIONS:= shared no-err no-hw zlib-dynamic no-sse2 no-ssl2
+OPENSSL_OPTIONS:= shared no-err zlib-dynamic no-sse2 no-ssl2
 
 ifdef CONFIG_OPENSSL_ENGINE_CRYPTO
   OPENSSL_OPTIONS += -DHAVE_CRYPTODEV
@@ -112,6 +113,10 @@ ifndef CONFIG_OPENSSL_WITH_SSL3
   OPENSSL_OPTIONS += no-ssl3
 endif
 
+ifndef CONFIG_OPENSSL_HARDWARE_SUPPORT
+  OPENSSL_OPTIONS += no-hw
+endif
+
 ifeq ($(CONFIG_x86_64),y)
   OPENSSL_TARGET:=linux-x86_64-openwrt
   OPENSSL_MAKEFLAGS += LIBDIR=lib
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] SDK enhancement proposal - add external toolchains via feeds

2019-04-23 Thread Florian Eckert

Hello Mirko,

I am not a member of OpenWrt but this are my hints.


 To start this process, we have collected a small number of core
features that we would propose to add to the OpenWrt build system. Our
goal with these patches is to remove the need for companies to develop
external scripts used to manipulate the build configuration of
OpenWrt. We will present the use cases and our proposed way to
implement these in a series of emails.

 If and when there is agreement on the proposal and implementation
approach, we will develop the feature and submit a patch for approval.
We are aware that this might take time and are prepared for several
iterations.


Do not ask if this would be a good improvement.
Just do it and make a traceable pullrequest with the changes.
If the community likes this then it will get merged.



 The first use case we would like to present is the ability to add
external toolchains in a feed.


Why not include the toolchain for new archs or changes to existing into 
OpenWrt Upstream?

This has a lot of advantages, which hopefully are all well known.


Regards
Florian


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


[OpenWrt-Devel] [PATCH 1/2] services/uhttpd: add Strict-Transport-Security option

2018-08-02 Thread Florian Eckert
This is a web security policy mechanism that helps to protect websites
against protocol downgrade attacks and cookie hijacking.

HSTS is an IETF standards track protocol and is specified in RFC 6797.

This patch will add the possibility to specify a max-age with the option
-P on uhttp start. If the option is set and https is enabled then force
the client with the Strict-Transport-Securtiy header for the specified
time only communicate over https for this content.

This is a follow up request from:
https://github.com/openwrt/luci/pull/1555

Signed-off-by: Florian Eckert 
---
 ...-Strict-Transport-Security-header-max-age.patch | 55 ++
 1 file changed, 55 insertions(+)
 create mode 100644 
package/network/services/uhttpd/patches/0005-make-uhttpd-configurable-to-send-Strict-Transport-Security-header-max-age.patch

diff --git 
a/package/network/services/uhttpd/patches/0005-make-uhttpd-configurable-to-send-Strict-Transport-Security-header-max-age.patch
 
b/package/network/services/uhttpd/patches/0005-make-uhttpd-configurable-to-send-Strict-Transport-Security-header-max-age.patch
new file mode 100644
index 00..b64b991ce3
--- /dev/null
+++ 
b/package/network/services/uhttpd/patches/0005-make-uhttpd-configurable-to-send-Strict-Transport-Security-header-max-age.patch
@@ -0,0 +1,55 @@
+--- a/main.c
 b/main.c
+@@ -135,6 +135,7 @@ static int usage(const char *name)
+   "   -C file ASN.1 server certificate file\n"
+   "   -K file ASN.1 server private key file\n"
+   "   -q  Redirect all HTTP requests to HTTPS\n"
++  "   -P seconds  Set Strict-Transport-Security header 
max-age\n"
+ #endif
+   "   -h directorySpecify the document root, default is 
'.'\n"
+   "   -E string   Use given virtual URL as 404 error 
handler\n"
+@@ -232,7 +233,7 @@ int main(int argc, char **argv)
+   init_defaults_pre();
+   signal(SIGPIPE, SIG_IGN);
+ 
+-  while ((ch = getopt(argc, argv, 
"A:aC:c:Dd:E:fh:H:I:i:K:k:L:l:m:N:n:p:qRr:Ss:T:t:U:u:Xx:y:")) != -1) {
++  while ((ch = getopt(argc, argv, 
"A:aC:c:Dd:E:fh:H:I:i:K:k:L:l:m:N:n:P:p:qRr:Ss:T:t:U:u:Xx:y:")) != -1) {
+   switch(ch) {
+ #ifdef HAVE_TLS
+   case 'C':
+@@ -247,6 +248,10 @@ int main(int argc, char **argv)
+   conf.tls_redirect = 1;
+   break;
+ 
++  case 'P':
++  conf.hsts = atoi(optarg);
++  break;
++
+   case 's':
+   n_tls++;
+   /* fall through */
+--- a/uhttpd.h
 b/uhttpd.h
+@@ -64,6 +64,7 @@ struct config {
+   const char *lua_prefix;
+   const char *ubus_prefix;
+   const char *ubus_socket;
++  int hsts;
+   int no_symlinks;
+   int no_dirlists;
+   int network_timeout;
+--- a/client.c
 b/client.c
+@@ -64,6 +64,12 @@ void uh_http_header(struct client *cl, i
+   http_versions[cl->request.version],
+   code, summary, conn, enc);
+ 
++  if (( cl->tls ) && ( conf.hsts > 0 )) {
++  ustream_printf(cl->us,
++  "Strict-Transport-Security: max-age=%d\r\n",
++  conf.hsts);
++  }
++
+   if (!r->connection_close)
+   ustream_printf(cl->us, "Keep-Alive: timeout=%d\r\n", 
conf.http_keepalive);
+ 
-- 
2.11.0


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


[OpenWrt-Devel] [PATCH 2/2] services/uhttpd: add hsts uci support

2018-08-02 Thread Florian Eckert
Make new uhttpd hsts option configurable over uci.

Signed-off-by: Florian Eckert 
---
 package/network/services/uhttpd/files/uhttpd.init | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/network/services/uhttpd/files/uhttpd.init 
b/package/network/services/uhttpd/files/uhttpd.init
index 47270bcc15..66dd9182f9 100755
--- a/package/network/services/uhttpd/files/uhttpd.init
+++ b/package/network/services/uhttpd/files/uhttpd.init
@@ -122,6 +122,7 @@ start_instance()
append_arg "$cfg" error_page "-E"
append_arg "$cfg" max_requests "-n" 3
append_arg "$cfg" max_connections "-N"
+   append_arg "$cfg" hsts "-P"
 
append_bool "$cfg" no_ubusauth "-a" 0
append_bool "$cfg" no_symlinks "-S" 0
-- 
2.11.0


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


[OpenWrt-Devel] [PATCH] base-files: add network_get_metric() to /lib/functions/network.sh

2018-09-24 Thread Florian Eckert
Signed-off-by: Florian Eckert 
---
 package/base-files/files/lib/functions/network.sh | 5 +
 1 file changed, 5 insertions(+)

diff --git a/package/base-files/files/lib/functions/network.sh 
b/package/base-files/files/lib/functions/network.sh
index d7fd2dea57..4fdcb66302 100644
--- a/package/base-files/files/lib/functions/network.sh
+++ b/package/base-files/files/lib/functions/network.sh
@@ -271,6 +271,11 @@ network_is_up()
 # 2: interface
 network_get_protocol() { __network_ifstatus "$1" "$2" ".proto"; }
 
+# determine the metric of the given logical interface
+# 1: destination variable
+# 2: interface
+network_get_metric() { __network_ifstatus "$1" "$2" ".metric"; }
+
 # determine the layer 3 linux network device of the given logical interface
 # 1: destination variable
 # 2: interface
-- 
2.11.0


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


[OpenWrt-Devel] [PATCH 2/2] lantiq: enable LEDS_TRIGGER_MTD support

2018-11-29 Thread Florian Eckert
Enable mtd led trigger for lantiq devices by default to show MTD
activity

Signed-off-by: Florian Eckert 
---
 target/linux/lantiq/config-4.14 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/linux/lantiq/config-4.14 b/target/linux/lantiq/config-4.14
index 055a428792..938aafc1f5 100644
--- a/target/linux/lantiq/config-4.14
+++ b/target/linux/lantiq/config-4.14
@@ -127,6 +127,7 @@ CONFIG_LANTIQ_ETOP=y
 CONFIG_LANTIQ_WDT=y
 # CONFIG_LANTIQ_XRX200 is not set
 CONFIG_LEDS_GPIO=y
+CONFIG_LEDS_TRIGGER_MTD=y
 CONFIG_LIBFDT=y
 CONFIG_MDIO_BUS=y
 CONFIG_MDIO_DEVICE=y
-- 
2.11.0


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


[OpenWrt-Devel] [PATCH 0/2] lantiq: udpate kernel config

2018-11-29 Thread Florian Eckert
- Sync kernel config 4.14 with the command
  make kernel_menuconfig CONFIG_TARGET=target
- Enable MTD LEDs trigger for lantiq target.

Florian Eckert (2):
  lantiq: sync kernel CONFIG_TARGET
  lantiq: enable LEDS_TRIGGER_MTD support

 target/linux/lantiq/config-4.14 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.11.0


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


[OpenWrt-Devel] [PATCH 1/2] lantiq: sync kernel CONFIG_TARGET

2018-11-29 Thread Florian Eckert
Sync target config changes with the following command
make kernel_menuconfig=target

Signed-off-by: Florian Eckert 
---
 target/linux/lantiq/config-4.14 | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/target/linux/lantiq/config-4.14 b/target/linux/lantiq/config-4.14
index aec0efa408..055a428792 100644
--- a/target/linux/lantiq/config-4.14
+++ b/target/linux/lantiq/config-4.14
@@ -38,8 +38,6 @@ CONFIG_CPU_R4K_FPU=y
 CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
 CONFIG_CPU_SUPPORTS_HIGHMEM=y
 CONFIG_CPU_SUPPORTS_MSA=y
-CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_HASH2=y
 CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_WORKQUEUE=y
 CONFIG_CSRC_R4K=y
@@ -75,6 +73,7 @@ CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 # CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
 # CONFIG_HAVE_ARCH_BITREVERSE is not set
+CONFIG_HAVE_ARCH_COMPILER_H=y
 CONFIG_HAVE_ARCH_JUMP_LABEL=y
 CONFIG_HAVE_ARCH_KGDB=y
 CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
@@ -133,6 +132,7 @@ CONFIG_MDIO_BUS=y
 CONFIG_MDIO_DEVICE=y
 CONFIG_MFD_CORE=y
 CONFIG_MFD_SYSCON=y
+CONFIG_MIGRATION=y
 CONFIG_MIPS=y
 CONFIG_MIPS_ASID_BITS=8
 CONFIG_MIPS_ASID_SHIFT=0
@@ -196,7 +196,6 @@ CONFIG_RTL8366RB_PHY=y
 CONFIG_RTL8366_SMI=y
 # CONFIG_SCHED_INFO is not set
 # CONFIG_SCSI_DMA is not set
-# CONFIG_SENSORS_LTQ_CPUTEMP is not set
 # CONFIG_SERIAL_8250 is not set
 CONFIG_SERIAL_LANTIQ=y
 # CONFIG_SOC_AMAZON_SE is not set
-- 
2.11.0


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


Re: [OpenWrt-Devel] [PATCH 1/2] lantiq: sync kernel CONFIG_TARGET

2018-11-29 Thread Florian Eckert

Hello Matihas



It works slightly different.


I have not seen any howto about this topic.
I thought it is OK to call only make kernel_menuconfig 
CONFIG_TARGET=subtarget

and every thing is in sync. I guess I made a mistake.

Regards
Flo


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


[OpenWrt-Devel] [PATCH v2] lantiq: enable LEDS_TRIGGER_MTD support

2018-11-29 Thread Florian Eckert
Enable mtd led trigger for lantiq/xrx200 devices by default to show MTD
activity

Signed-off-by: Florian Eckert 
---
 target/linux/lantiq/xrx200/config-4.14 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/linux/lantiq/xrx200/config-4.14 
b/target/linux/lantiq/xrx200/config-4.14
index 7b15d4283b..5cbbf31633 100644
--- a/target/linux/lantiq/xrx200/config-4.14
+++ b/target/linux/lantiq/xrx200/config-4.14
@@ -27,6 +27,7 @@ CONFIG_INTEL_XWAY_PHY=y
 # CONFIG_ISDN is not set
 CONFIG_LANTIQ_XRX200=y
 CONFIG_LEDS_TRIGGER_HEARTBEAT=y
+CONFIG_LEDS_TRIGGER_MTD=y
 CONFIG_LZO_COMPRESS=y
 CONFIG_LZO_DECOMPRESS=y
 CONFIG_MIPS_MT=y
-- 
2.11.0


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


Re: [OpenWrt-Devel] [PATCH 2/2] lantiq: enable LEDS_TRIGGER_MTD support

2018-12-03 Thread Florian Eckert

Hello John



this is a very specific feature and I dont see any devices in tree
using the driver. it'll increase the image size and we have several
small flashed units in the target. cant you simplly make it AutoProbe
during preinit ? there is next to no flash activity until preinit
anyway.




I've found another way. I would suggest that we add the trigger as 
kernel

modules under /package/kernel/linux/modules/leds.mk. Anyone who needs
this trigger can install it with opkg or install during image 
generation.


What is your opinion?

Regards
Flo

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


Re: [OpenWrt-Devel] [PATCH 2/2] lantiq: enable LEDS_TRIGGER_MTD support

2018-12-03 Thread Florian Eckert

Hello John


this is a very specific feature and I dont see any devices in tree
using the driver.


It is also correct that no image use this trigger per default.
But it is still possible for someone to put this trigger on a user 
defined LED if he wants.



it'll increase the image size and we have several
small flashed units in the target.


I don't think the size will change significantly.


cant you simplly make it AutoProbe
during preinit ? there is next to no flash activity until preinit
anyway.




I've found another way. I would suggest that we add the trigger as 
kernel

modules under /package/kernel/linux/modules/leds.mk. Anyone who needs
this trigger can install it with opkg or install during image 
generation.




I have to withdraw my statement.
This is a bool option and must be switched on or off during compilation.
This could not be compiled as a module.


Regards
Flo


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


[OpenWrt-Devel] [PATCH 2/2] services/uhttpd: Disable option -M for Last-Modified header

2018-07-02 Thread Florian Eckert
Make Last-Modified header configurable over uci.
If option is not set then send Last-Modified header.
This is the equal to the behaviour as before this option was added.

Signed-off-by: Florian Eckert 
---
 package/network/services/uhttpd/files/uhttpd.init | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/network/services/uhttpd/files/uhttpd.init 
b/package/network/services/uhttpd/files/uhttpd.init
index 47270bcc15..2367ac137f 100755
--- a/package/network/services/uhttpd/files/uhttpd.init
+++ b/package/network/services/uhttpd/files/uhttpd.init
@@ -127,6 +127,7 @@ start_instance()
append_bool "$cfg" no_symlinks "-S" 0
append_bool "$cfg" no_dirlists "-D" 0
append_bool "$cfg" rfc1918_filter "-R" 0
+   append_bool "$cfg" no_last_modified_header "-M" 0
 
config_get alias_list "$cfg" alias
for alias in $alias_list; do
-- 
2.11.0


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


[OpenWrt-Devel] [PATCH 1/2] services/uhttpd: add -M option for Last-Modified header sending

2018-07-02 Thread Florian Eckert
If uhttpd is started with the option -M then Last-Modified header is not
send during ok respond. We have already an ETag header set which is more
accurate.

See URL:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Etag

So make sending of Last-Modified header optional with a config option.
If the option is not set then the behaviour is as before this option was
added.

Signed-off-by: Florian Eckert 
---
 ...ct-if-last-modified-header-should-be-send.patch | 46 ++
 1 file changed, 46 insertions(+)
 create mode 100644 
package/network/services/uhttpd/patches/0001-add-a-M-option-to-select-if-last-modified-header-should-be-send.patch

diff --git 
a/package/network/services/uhttpd/patches/0001-add-a-M-option-to-select-if-last-modified-header-should-be-send.patch
 
b/package/network/services/uhttpd/patches/0001-add-a-M-option-to-select-if-last-modified-header-should-be-send.patch
new file mode 100644
index 00..9835ca8cfd
--- /dev/null
+++ 
b/package/network/services/uhttpd/patches/0001-add-a-M-option-to-select-if-last-modified-header-should-be-send.patch
@@ -0,0 +1,46 @@
+--- a/file.c
 b/file.c
+@@ -337,8 +337,9 @@ static void uh_file_response_ok_hdrs(str
+ 
+   if (s) {
+   ustream_printf(cl->us, "ETag: %s\r\n", uh_file_mktag(s, buf, 
sizeof(buf)));
+-  ustream_printf(cl->us, "Last-Modified: %s\r\n",
+- uh_file_unix2date(s->st_mtime, buf, 
sizeof(buf)));
++  if(!conf.no_last_modified_header)
++  ustream_printf(cl->us, "Last-Modified: %s\r\n",
++ uh_file_unix2date(s->st_mtime, buf, 
sizeof(buf)));
+   }
+   ustream_printf(cl->us, "Date: %s\r\n",
+  uh_file_unix2date(time(NULL), buf, sizeof(buf)));
+--- a/main.c
 b/main.c
+@@ -232,7 +232,7 @@ int main(int argc, char **argv)
+   init_defaults_pre();
+   signal(SIGPIPE, SIG_IGN);
+ 
+-  while ((ch = getopt(argc, argv, 
"A:aC:c:Dd:E:fh:H:I:i:K:k:L:l:m:N:n:p:qRr:Ss:T:t:U:u:Xx:y:")) != -1) {
++  while ((ch = getopt(argc, argv, 
"A:aC:c:Dd:E:fh:H:I:i:K:k:L:l:Mm:N:n:p:qRr:Ss:T:t:U:u:Xx:y:")) != -1) {
+   switch(ch) {
+ #ifdef HAVE_TLS
+   case 'C':
+@@ -311,6 +311,10 @@ int main(int argc, char **argv)
+   conf.rfc1918_filter = 1;
+   break;
+ 
++  case 'M':
++  conf.no_last_modified_header = 1;
++  break;
++
+   case 'n':
+   conf.max_script_requests = atoi(optarg);
+   break;
+--- a/uhttpd.h
 b/uhttpd.h
+@@ -77,6 +77,7 @@ struct config {
+   int ubus_noauth;
+   int ubus_cors;
+   int cgi_prefix_len;
++  int no_last_modified_header;
+   struct list_head cgi_alias;
+ };
+ 
-- 
2.11.0


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


[OpenWrt-Devel] [PATCH 2/2] services/uhttpd: Make new uhttpd no_cache option configurable over uci

2018-07-04 Thread Florian Eckert
Make Cache-Control header no-cache configurable with uci. If the option
is not specified (default) then the Cache-Control header no-cache is not send
to the client.

Signed-off-by: Florian Eckert 
---
 package/network/services/uhttpd/files/uhttpd.init | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/network/services/uhttpd/files/uhttpd.init 
b/package/network/services/uhttpd/files/uhttpd.init
index 47270bcc15..aff24b5219 100755
--- a/package/network/services/uhttpd/files/uhttpd.init
+++ b/package/network/services/uhttpd/files/uhttpd.init
@@ -127,6 +127,7 @@ start_instance()
append_bool "$cfg" no_symlinks "-S" 0
append_bool "$cfg" no_dirlists "-D" 0
append_bool "$cfg" rfc1918_filter "-R" 0
+   append_bool "$cfg" no_cache "-o" 0
 
config_get alias_list "$cfg" alias
for alias in $alias_list; do
-- 
2.11.0


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


[OpenWrt-Devel] uhttpd: add configurable client Cache-Control http header

2018-07-04 Thread Florian Eckert
I am working with luci-ng. And i have problems with caching with the following
Browser Edge, Internet-Explorer and Firefox. Chrome is working fine.
If the javascript or html files have changed on the system for example on
sysupgrade then the new files will not get loaded from uhttpd server.
The browsers always used the cached version and not the new version from
uhttpd.

To fix this tell the uhttpd to send the header Cache-Control no-cache on file
download. This header tells the browser to always check if the file has
changed on the server. If the file has not changed then the server send a 302
status header. The status header 302 tells the browser to load the file from
the browser cache because nothing has changed. On the other side if the file
has changed then the browser will deliver the new one.

This makes following patches deprecated
http://lists.infradead.org/pipermail/openwrt-devel/2018-July/013098.html
http://lists.infradead.org/pipermail/openwrt-devel/2018-July/013097.html


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


[OpenWrt-Devel] [PATCH 1/2] services/uhttpd: add -o option for Cache-Control header no-cache

2018-07-04 Thread Florian Eckert
If uhttpd is started with the option -o then Cache-Control header is
send with option no-cache to client. This option will instruct the client
software (browser) do not cache the content.

I have seen some problem with luci-ng with the Browsers Edge, IE and Firefox.
They will not load the new files even the file content has changed.
If I set this option then all browser will load the new file from uhttpd.
This works with the Etag header feature.

Signed-off-by: Florian Eckert 
---
 ...ble-to-send-Cache-Control-header-no_cache.patch | 43 ++
 1 file changed, 43 insertions(+)
 create mode 100644 
package/network/services/uhttpd/patches/0001-make-uhttpd-configurable-to-send-Cache-Control-header-no_cache.patch

diff --git 
a/package/network/services/uhttpd/patches/0001-make-uhttpd-configurable-to-send-Cache-Control-header-no_cache.patch
 
b/package/network/services/uhttpd/patches/0001-make-uhttpd-configurable-to-send-Cache-Control-header-no_cache.patch
new file mode 100644
index 00..4c40abd2ac
--- /dev/null
+++ 
b/package/network/services/uhttpd/patches/0001-make-uhttpd-configurable-to-send-Cache-Control-header-no_cache.patch
@@ -0,0 +1,43 @@
+--- a/file.c
 b/file.c
+@@ -339,6 +339,8 @@ static void uh_file_response_ok_hdrs(str
+   ustream_printf(cl->us, "ETag: %s\r\n", uh_file_mktag(s, buf, 
sizeof(buf)));
+   ustream_printf(cl->us, "Last-Modified: %s\r\n",
+  uh_file_unix2date(s->st_mtime, buf, 
sizeof(buf)));
++  if(conf.no_cache)
++  ustream_printf(cl->us, "Cache-Control: %s\r\n", 
"no-cache");
+   }
+   ustream_printf(cl->us, "Date: %s\r\n",
+  uh_file_unix2date(time(NULL), buf, sizeof(buf)));
+--- a/main.c
 b/main.c
+@@ -232,7 +232,7 @@ int main(int argc, char **argv)
+   init_defaults_pre();
+   signal(SIGPIPE, SIG_IGN);
+ 
+-  while ((ch = getopt(argc, argv, 
"A:aC:c:Dd:E:fh:H:I:i:K:k:L:l:m:N:n:p:qRr:Ss:T:t:U:u:Xx:y:")) != -1) {
++  while ((ch = getopt(argc, argv, 
"A:aC:c:Dd:E:fh:H:I:i:K:k:L:l:m:N:n:op:qRr:Ss:T:t:U:u:Xx:y:")) != -1) {
+   switch(ch) {
+ #ifdef HAVE_TLS
+   case 'C':
+@@ -311,6 +311,10 @@ int main(int argc, char **argv)
+   conf.rfc1918_filter = 1;
+   break;
+ 
++  case 'o':
++  conf.no_cache = 1;
++  break;
++
+   case 'n':
+   conf.max_script_requests = atoi(optarg);
+   break;
+--- a/uhttpd.h
 b/uhttpd.h
+@@ -77,6 +77,7 @@ struct config {
+   int ubus_noauth;
+   int ubus_cors;
+   int cgi_prefix_len;
++  int no_cache;
+   struct list_head cgi_alias;
+ };
+ 
-- 
2.11.0


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


Re: [OpenWrt-Devel] uhttpd: add configurable client Cache-Control http header

2018-07-04 Thread Florian Eckert

Thanks for reply

On 2018-07-04 16:01, Karl Palsson wrote:

Florian Eckert  wrote:

To fix this tell the uhttpd to send the header Cache-Control
no-cache on file download. This header tells the browser to
always check if the file has changed on the server. If the file
has not changed then the server send a 302 status header. The
status header 302 tells the browser to load the file from the
browser cache because nothing has changed. On the other side if
the file has changed then the browser will deliver the new one.


That _seems_ like an exceptionally big hammer.


We could also use additional the other options, which are allowed by 
http Cache-Control header.

I have found an interesting article from google about the caching topic.
It is only in german :-(
But the graph with the head "Optimale Cache-Control-Richtlinien 
festlegen"

is interesting.

May be we could change the option from no_cache -> cache-control?
With the following options:

no-cache
no-store
max-age=

So each uhttp instance could be configured to send a Cache-Control 
header or not.



I just made all my code request js files with ?ver= version
suffixes, so that only the right versions were cached.


Yes i have seen this in luci but not in luci-ng.

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


Re: [OpenWrt-Devel] uhttpd: add configurable client Cache-Control http header

2018-07-06 Thread Florian Eckert

On 2018-07-05 12:53, Karl Palsson wrote:

> I just made all my code request js files with ?ver= version
> suffixes, so that only the right versions were cached.

Yes i have seen this in luci but not in luci-ng.


well, fix that? :)


I think the problem with caching could be split up in two topics.

* Web-server solution:
  The http 1.1 spec have this header defined for caching so why not use 
them in uhttp?
  A lot of server send "Cache-Control: max-age=" and "Expire: 0" 
additional to the
  other headers uhttp already sends ("Last-Modified: " and "Etag: 
").


* Web-page solution:
  This is good practice in the wildlife to solve this if we could not 
change the web-server configuration.

  But luci-ng does not append a version string to files for now.
  By the way this is similar to the "Etag:" header.





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


[OpenWrt-Devel] [PATCH] kernel.mk: fix kmod VERSION string

2018-07-06 Thread Florian Eckert
If a "+" is in the version string of a kernel package then the package could
not get installed by opkg with ftp. Because the file could not get found.
"kmod-wireguard_4.4.135%2b0.0.20180519-1_mips_24kc.ipk: No such file or 
directory"
The problem is that "+" is replaced with "%2b".

Change the "+" in version string to "-" will solve this issue.

Kmod version string:
old: $(LINUX_VERSIO)+$(PKG_VERSION)-$(PKG_RELEASE)
new: $(LINUX_VERSIO)-$(PKG_VERSION)-$(PKG_RELEASE)

Signed-off-by: Florian Eckert 
---
 include/kernel.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/kernel.mk b/include/kernel.mk
index c169550f48..cd186e9d3b 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -196,7 +196,7 @@ define KernelPackage
 CATEGORY:=Kernel modules
 DESCRIPTION:=$(DESCRIPTION)
 EXTRA_DEPENDS:=kernel 
(=$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC))
-VERSION:=$(LINUX_VERSION)$(if $(PKG_VERSION),+$(PKG_VERSION))-$(if 
$(PKG_RELEASE),$(PKG_RELEASE),$(LINUX_RELEASE))
+VERSION:=$(LINUX_VERSION)$(if $(PKG_VERSION),-$(PKG_VERSION))-$(if 
$(PKG_RELEASE),$(PKG_RELEASE),$(LINUX_RELEASE))
 PKGFLAGS:=$(PKGFLAGS)
 $(call KernelPackage/$(1))
 $(call KernelPackage/$(1)/$(BOARD))
-- 
2.11.0


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


[OpenWrt-Devel] [PATCH] linux: update license tag to use correct SPDX tag

2018-07-06 Thread Florian Eckert
Use SPDX tag.

Signed-off-by: Florian Eckert 
---
 package/kernel/linux/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/kernel/linux/Makefile b/package/kernel/linux/Makefile
index c2d10ec188..39b9e82c27 100644
--- a/package/kernel/linux/Makefile
+++ b/package/kernel/linux/Makefile
@@ -14,7 +14,7 @@ PKG_FLAGS:=hold
 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/packages
 SCAN_DEPS=modules/*.mk $(TOPDIR)/target/linux/*/modules.mk 
$(TOPDIR)/include/netfilter.mk
 
-PKG_LICENSE:=GPLv2
+PKG_LICENSE:=GPL-2.0
 PKG_LICENSE_FILES:=
 
 export SHELL:=/bin/sh
-- 
2.11.0


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


Re: [OpenWrt-Devel] OpenWrt 19.07 release schedule ?

2019-10-11 Thread Florian Eckert

I'm not sure if my opinion is helpful, but that's how I see it.


Or: Start discussing the release blockers here and now.  Thanks.


1) Blocker: LuCI master needs to be backported to 19.07
  Time estimate: 2-3 weeks


I think it's good that LuCI has now outsourced more work to the client.
Thanks to Jo-Philipp to do this work (great job) but I think it needs 
more testing time.

So it should go into next release maybe 20.03?


2) Blocker: All relevant sub-components for WPA-3 + GUI support, such
as
  hostapd, iwinfo etc. need to be backported to 19.07
  Time estimate: 2 weeks


should go into next release maybe 20.03 because this is neede by LuCI


3) Blocker: Some weaknesses in libustream-ssl client certificate
  handling need to  be addressed, which can only be solved by an API
  redesign. Band-aid fixes available but not merged, nobody worked
  on API redesign yet
  Time estimate: 1 week


should be done before 19.07 release



4) Blocker: Need to assert the state of the Dragonblood WPA3
  vulnerabilities in 19.07's hostapd
  Time estimate: a few days I guess


should go into next release maybe 20.03 maks only sense in master.


Question: How long would it take to stabilize/test a fresh fork from
today's Master branch instead? I assume none of these issues apply to
master or need to be solved in master as well?


There are always changes in the master that may need to be backported to 
a stable branch.
But since the master is constantly evolving a stable will never be 
released if we keep going like this.

I think the release will delayed even more.

It is clear to me that there is more effort in the LuCI to fix the bugs, 
that there were big change in the master -> switching to Javascript.

There is always advantage and disadvantage.
How to do it may be wrong. This is life.

Kind regards

Florian

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


[OpenWrt-Devel] Embedded Linux Conference Europe

2019-10-23 Thread Florian Eckert

Is anyone at ELCE [1] in Lyon from the Community next week?


[1] 
https://events19.linuxfoundation.org/events/embedded-linux-conference-europe-2019/


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


[OpenWrt-Devel] [PATCH 1/1] rpcd: add respawn param

2019-11-07 Thread Florian Eckert
The rpcd service is an important service, but if the service stops
working for any reason, no one will ever respawn that service. With this
commit, the procd service will monitor if the rpcd service
is running. If the rpcd service has crashed, then
procd respawns the rpcd service.

Signed-off-by: Florian Eckert 
---
 package/system/rpcd/Makefile| 2 +-
 package/system/rpcd/files/rpcd.init | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile
index 6f23bbe96e..fcbcc613a6 100644
--- a/package/system/rpcd/Makefile
+++ b/package/system/rpcd/Makefile
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=rpcd
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git
diff --git a/package/system/rpcd/files/rpcd.init 
b/package/system/rpcd/files/rpcd.init
index 447133c67a..f75d0e0f0e 100755
--- a/package/system/rpcd/files/rpcd.init
+++ b/package/system/rpcd/files/rpcd.init
@@ -12,6 +12,7 @@ start_service() {
 
procd_open_instance
procd_set_param command "$PROG" ${socket:+-s "$socket"} ${timeout:+-t 
"$timeout"}
+   procd_set_param respawn
procd_close_instance
 }
 
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH 1/1] uhttpd: add enable instance option

2019-11-07 Thread Florian Eckert
With this change it is now possible to switch off single instances of
the uhttpd config. Until now it was only possible to switch all
instances of uhttpd on or off.

Signed-off-by: Florian Eckert 
---
 package/network/services/uhttpd/Makefile  | 2 +-
 package/network/services/uhttpd/files/uhttpd.init | 4 
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/package/network/services/uhttpd/Makefile 
b/package/network/services/uhttpd/Makefile
index 85b7be7607..2d1fbf4492 100644
--- a/package/network/services/uhttpd/Makefile
+++ b/package/network/services/uhttpd/Makefile
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=uhttpd
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git
diff --git a/package/network/services/uhttpd/files/uhttpd.init 
b/package/network/services/uhttpd/files/uhttpd.init
index 6322473b97..869f79bea2 100755
--- a/package/network/services/uhttpd/files/uhttpd.init
+++ b/package/network/services/uhttpd/files/uhttpd.init
@@ -98,6 +98,10 @@ start_instance()
local cfg="$1"
local realm="$(uci_get system.@system[0].hostname)"
local listen http https interpreter indexes path handler httpdconf 
haveauth
+   local enabled
+
+   config_get_bool enabled "$cfg" 'enabled' 1
+   [ $enabled -gt 0 ] || return
 
procd_open_instance
procd_set_param respawn
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH v2 1/1] rpcd: add respawn param

2019-11-07 Thread Florian Eckert
The rpcd service is an important service, but if the service stops
working for any reason, no one will ever respawn that service. With this
commit, the procd service will monitor if the rpcd service
is running. If the rpcd service has crashed, then
procd respawns the rpcd service.

Signed-off-by: Florian Eckert 
---
 package/system/rpcd/Makefile| 2 +-
 package/system/rpcd/files/rpcd.init | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile
index 6f23bbe96e..fcbcc613a6 100644
--- a/package/system/rpcd/Makefile
+++ b/package/system/rpcd/Makefile
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=rpcd
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git
diff --git a/package/system/rpcd/files/rpcd.init 
b/package/system/rpcd/files/rpcd.init
index 447133c67a..3e9ea5bbf3 100755
--- a/package/system/rpcd/files/rpcd.init
+++ b/package/system/rpcd/files/rpcd.init
@@ -12,6 +12,7 @@ start_service() {
 
procd_open_instance
procd_set_param command "$PROG" ${socket:+-s "$socket"} ${timeout:+-t 
"$timeout"}
+   procd_set_param respawn ${respawn_retry:-0}
procd_close_instance
 }
 
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH] wireguard: fix reload config on peer change

2019-11-29 Thread Florian Eckert
If we change a peer section, then the interface of netifd gets not
reloaded. Because the change were not made in an interface section.
And so the netifd does not recognize the change. And the new config gets
not applied until we do a network restart or we restart the interface
with 'ifup '.

With this new wireguard init script, a md5sum will be calculated on
every network change. The sum is generated over the wireguard peers for
each wireguard interface. If a change in the peers section gets detected
then only the detecated wireguard interface gets restarted.

With this change we can see if the peer section has changed to the
corresponding interface. The wireguard configuration is rewritten and
reconfigured by the netif proto handler.

Signed-off-by: Florian Eckert 
---
 package/network/services/wireguard/Makefile   |  2 +
 .../services/wireguard/files/wireguard.init   | 49 +++
 2 files changed, 51 insertions(+)
 create mode 100644 package/network/services/wireguard/files/wireguard.init

diff --git a/package/network/services/wireguard/Makefile 
b/package/network/services/wireguard/Makefile
index ea34b7550b..d78fcfface 100644
--- a/package/network/services/wireguard/Makefile
+++ b/package/network/services/wireguard/Makefile
@@ -93,6 +93,8 @@ define Package/wireguard-tools/install
$(INSTALL_BIN) ./files/wireguard_watchdog $(1)/usr/bin/
$(INSTALL_DIR) $(1)/lib/netifd/proto/
$(INSTALL_BIN) ./files/wireguard.sh $(1)/lib/netifd/proto/
+   $(INSTALL_DIR) $(1)/etc/init.d/
+   $(INSTALL_BIN) ./files/wireguard.init $(1)/etc/init.d/wireguard
 endef
 
 define KernelPackage/wireguard
diff --git a/package/network/services/wireguard/files/wireguard.init 
b/package/network/services/wireguard/files/wireguard.init
new file mode 100644
index 00..24569752b4
--- /dev/null
+++ b/package/network/services/wireguard/files/wireguard.init
@@ -0,0 +1,49 @@
+#!/bin/sh /etc/rc.common
+
+START=80
+USE_PROCD=1
+
+WG_DIR="/tmp/wireguard"
+
+wireguard_check_peer(){
+   local cfg="${1}"
+   local cfile="${2}"
+
+   uci show "network.${cfg}" >> "${cfile}"
+}
+
+wireguard_check_interface() {
+   local cfg="${1}"
+   local proto cfile n_sum o_sum
+
+   config_get proto "${cfg}" proto
+   [ "${proto}" = "wireguard" ] || return 0
+   cfile="$(mktemp -p "${WG_DIR}")"
+   config_foreach wireguard_check_peer "wireguard_${1}" "${cfile}"
+
+   . /lib/functions/network.sh
+
+   n_sum="$(md5sum "${cfile}" | cut -d" " -f1)"
+   rm -rf "${cfile}"
+   [ -f "${WG_DIR}/${cfg}.check" ] && {
+   o_sum="$(cat "${WG_DIR}/${cfg}.check")"
+   [ "${o_sum}" != "${n_sum}" ] && {
+   network_is_up "${cfg}" && ifup "${cfg}"
+   }
+   }
+   echo "$n_sum" > "${WG_DIR}/${cfg}.check"
+}
+
+boot() {
+   config_load network
+   config_foreach wireguard_check_interface interface
+}
+
+service_triggers() {
+   procd_add_reload_trigger "network"
+}
+
+reload_service() {
+   config_load network
+   config_foreach wireguard_check_interface interface
+}
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH] wireguard: skip peer config if public key of the peer is not defined

2019-12-04 Thread Florian Eckert
If a config section of a peer does not have a public key defined, the
whole interface does not start. The following log is shown

daemon.notice netifd: test (21071): Line unrecognized: `PublicKey='
daemon.notice netifd: test (21071): Configuration parsing erro

The command 'wg show' does only show the interface name.

With this change we skip the peer for this interface and emit a log
message. So the other peers get configured.

Signed-off-by: Florian Eckert 
---
 package/network/services/wireguard/files/wireguard.sh | 5 +
 1 file changed, 5 insertions(+)

diff --git a/package/network/services/wireguard/files/wireguard.sh 
b/package/network/services/wireguard/files/wireguard.sh
index 4c811c6ba9..f89be583f7 100644
--- a/package/network/services/wireguard/files/wireguard.sh
+++ b/package/network/services/wireguard/files/wireguard.sh
@@ -42,6 +42,11 @@ proto_wireguard_setup_peer() {
config_get endpoint_port "${peer_config}" "endpoint_port"
config_get persistent_keepalive "${peer_config}" "persistent_keepalive"
 
+   if [ -z "$public_key" ]; then
+   echo "Skipping peer config $peer_config public key not defined"
+   return 0
+   fi
+
echo "[Peer]" >> "${wg_cfg}"
echo "PublicKey=${public_key}" >> "${wg_cfg}"
if [ "${preshared_key}" ]; then
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH] wireguard: fix interface remove on lonely peers

2019-12-04 Thread Florian Eckert
Redmine-patch-id: 4230
If we delete the main wireguard interface, then the related are not
delete. They remain in the network configuration.

With this commit wo get called on a network config change, and check if
each wireguard peer has an interface. If this is not the case delete
alle peers that do not have a related wireguard interface.

Signed-off-by: Florian Eckert 
---
This was discussed on the irc with Kevin Darbyshire-Bryant alias ldir
on the irc that this is a bug and should be get fixed.

 package/network/services/wireguard/Makefile   |  2 ++
 .../services/wireguard/files/wireguard.init   | 31 +++
 2 files changed, 33 insertions(+)
 create mode 100644 package/network/services/wireguard/files/wireguard.init

diff --git a/package/network/services/wireguard/Makefile 
b/package/network/services/wireguard/Makefile
index ea34b7550b..d78fcfface 100644
--- a/package/network/services/wireguard/Makefile
+++ b/package/network/services/wireguard/Makefile
@@ -93,6 +93,8 @@ define Package/wireguard-tools/install
$(INSTALL_BIN) ./files/wireguard_watchdog $(1)/usr/bin/
$(INSTALL_DIR) $(1)/lib/netifd/proto/
$(INSTALL_BIN) ./files/wireguard.sh $(1)/lib/netifd/proto/
+   $(INSTALL_DIR) $(1)/etc/init.d/
+   $(INSTALL_BIN) ./files/wireguard.init $(1)/etc/init.d/wireguard
 endef
 
 define KernelPackage/wireguard
diff --git a/package/network/services/wireguard/files/wireguard.init 
b/package/network/services/wireguard/files/wireguard.init
new file mode 100644
index 00..781d0839bc
--- /dev/null
+++ b/package/network/services/wireguard/files/wireguard.init
@@ -0,0 +1,31 @@
+#!/bin/sh /etc/rc.common
+
+START=80
+USE_PROCD=1
+
+service_triggers() {
+   procd_add_reload_trigger "network"
+}
+
+reload_service() {
+   # delete old peers of related wireguard interface
+   wireguard_check_peers
+}
+
+wireguard_check_peers() {
+   local iface peer
+
+   # get all wireguard peers
+   for peer in $(uci show network | grep =wireguard_); do
+   # extract peer section type
+   peer="${peer##*=}"
+   # extract interface name
+   iface="${peer#*_}"
+
+   # delete peer if iface is not present anymore
+   if ! uci -q show "network.${iface}" 1>/dev/null 2>/dev/null; 
then
+   uci -q delete "network.@${peer}[-1]"
+   uci commit network
+   fi
+   done
+}
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH v2] wireguard: skip peer config if public key of the peer is not defined

2019-12-05 Thread Florian Eckert
If a config section of a peer does not have a public key defined, the
whole interface does not start. The following log is shown

daemon.notice netifd: test (21071): Line unrecognized: `PublicKey='
daemon.notice netifd: test (21071): Configuration parsing erro

The command 'wg show' does only show the interface name.

With this change we skip the peer for this interface and emit a log
message. So the other peers get configured.

Signed-off-by: Florian Eckert 
---
v2:
* Update error message to be a sentence

 package/network/services/wireguard/files/wireguard.sh | 5 +
 1 file changed, 5 insertions(+)

diff --git a/package/network/services/wireguard/files/wireguard.sh 
b/package/network/services/wireguard/files/wireguard.sh
index 4c811c6ba9..ccac34e45f 100644
--- a/package/network/services/wireguard/files/wireguard.sh
+++ b/package/network/services/wireguard/files/wireguard.sh
@@ -42,6 +42,11 @@ proto_wireguard_setup_peer() {
config_get endpoint_port "${peer_config}" "endpoint_port"
config_get persistent_keepalive "${peer_config}" "persistent_keepalive"
 
+   if [ -z "$public_key" ]; then
+   echo "Skipping peer config $peer_config because public key is 
not defined."
+   return 0
+   fi
+
echo "[Peer]" >> "${wg_cfg}"
echo "PublicKey=${public_key}" >> "${wg_cfg}"
if [ "${preshared_key}" ]; then
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH v2] wireguard: fix interface remove for lonely peers

2019-12-05 Thread Florian Eckert
When we delete a Wireguard interface, the associated peer sections are
not deleted. They remain in the network configuration.

This commit adds an init script, that triggers when the network
configuration file is changed.

For each change event, each Wireguard peer section is checked to see if
the corresponding wireguard interface section still exists. If this is not
the case, all wireguard peer sections for that interface are deleted.

Signed-off-by: Florian Eckert 
---
v2:
* update commit description

 package/network/services/wireguard/Makefile   |  2 ++
 .../services/wireguard/files/wireguard.init   | 31 +++
 2 files changed, 33 insertions(+)
 create mode 100644 package/network/services/wireguard/files/wireguard.init

diff --git a/package/network/services/wireguard/Makefile 
b/package/network/services/wireguard/Makefile
index ea34b7550b..d78fcfface 100644
--- a/package/network/services/wireguard/Makefile
+++ b/package/network/services/wireguard/Makefile
@@ -93,6 +93,8 @@ define Package/wireguard-tools/install
$(INSTALL_BIN) ./files/wireguard_watchdog $(1)/usr/bin/
$(INSTALL_DIR) $(1)/lib/netifd/proto/
$(INSTALL_BIN) ./files/wireguard.sh $(1)/lib/netifd/proto/
+   $(INSTALL_DIR) $(1)/etc/init.d/
+   $(INSTALL_BIN) ./files/wireguard.init $(1)/etc/init.d/wireguard
 endef
 
 define KernelPackage/wireguard
diff --git a/package/network/services/wireguard/files/wireguard.init 
b/package/network/services/wireguard/files/wireguard.init
new file mode 100644
index 00..781d0839bc
--- /dev/null
+++ b/package/network/services/wireguard/files/wireguard.init
@@ -0,0 +1,31 @@
+#!/bin/sh /etc/rc.common
+
+START=80
+USE_PROCD=1
+
+service_triggers() {
+   procd_add_reload_trigger "network"
+}
+
+reload_service() {
+   # delete old peers of related wireguard interface
+   wireguard_check_peers
+}
+
+wireguard_check_peers() {
+   local iface peer
+
+   # get all wireguard peers
+   for peer in $(uci show network | grep =wireguard_); do
+   # extract peer section type
+   peer="${peer##*=}"
+   # extract interface name
+   iface="${peer#*_}"
+
+   # delete peer if iface is not present anymore
+   if ! uci -q show "network.${iface}" 1>/dev/null 2>/dev/null; 
then
+   uci -q delete "network.@${peer}[-1]"
+   uci commit network
+   fi
+   done
+}
-- 
2.20.1


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


Re: [OpenWrt-Devel] [PATCH v2] wireguard: fix interface remove for lonely peers

2020-01-16 Thread Florian Eckert

Thanks for feedback


I think this behavior is not really acceptable. Programs, init scripts,
hotplug events etc. should not automatically modify (and commit) uci
configurations, especially not such vital ones like the network config.


The new wireguard init script is only executed if the network 
configuration

has changes. This is triggered by the procd ubus service.


The main problem I see is that you do not know what state the config is
in at any point in time, whether there are other (intentionally!)
uncommitted user changes etc.


Yes, I agree, but I couldn't think of any other solution for this 
problem
without touching the current configuration handling as you mentioned 
below



Wouldn't it be better to modify the code deleting the wireguard
interface to delete the peer sections as well? Or to remodel the
wireguard configuration model to cope with orphaned peer sections?


I already thought of that. I could imagine a list item that references
the peers in the interface section. If this wireguard interface section
is deleted then these list element sections should also be deleted.

For example

config interface 'wg
option proto 'wireguard
option private_key 
'8OGwbqPFAJjjMgdF1kwkNYQ+uXCUYMWMyJjreDsruMk4='

list peers 
list peers 

config wireguard_test 
option endpoint_host 'test.de
option public_key 
'Cs46OJr5d3NoDRYf/g2l0RINYLvaypQCMtchlJhQgSQ='.

list allowed_ips '0.0.0.0

Deleting an interface section in LuCI is generic. So I don't know if we 
should

do this and make an exception for wireguard.

Best regards Flo

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


Re: OpenWrt 21.02-rc1

2021-04-18 Thread Florian Eckert

Hello,


If there are some other bugs in the 21.02 branch which are fixed in
master, we can backport the fixed as long as they are not so big. If
there is something missing, just ask on the mainling list.


Since last weekend the following patch was merged into master.
The patch extends ltq-vdsl ubus interface with the missing state_num and 
power_state_num values.

https://github.com/openwrt/openwrt/commit/4407d45d9667ab3d376ad4a6b760e07f4dd43e49#diff-ff00a3f4f318bb11684e008813bd876f0865ce6c2c681ec26b0bf178b4e83163

Could we please backport this to the branch openwrt-21.02 before rc1 
stable release?


Thanks

Florian

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


Re: [PATCH] uqmi: fix network registration loop

2021-04-19 Thread Florian Eckert




On 2021-04-19 19:46, thomas.rich...@kontron.com wrote:

From: Thomas Richard 

Instrumenting qmi.sh script with following patch, some errors are 
visible.

--- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
+++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
@@ -29,6 +29,7 @@ proto_qmi_init_config() {
 }

 proto_qmi_setup() {
+   set -x
local interface="$1"
local dataformat connstat plmn_mode mcc mnc
local device apn auth username password pincode delay modes 
pdptype

@@ -224,6 +225,8 @@ proto_qmi_setup() {
fi
done

+   registration=$(uqmi -s -d "$device" --get-serving-system)
+
[ -n "$modes" ] && uqmi -s -d "$device" --set-network-modes
"$modes" > /dev/null 2>&1

echo "Starting network $interface"

During the boot of the system, modem could not start automatically its
network registration.
netifd: wan (9235): + echo 'Waiting for network registration'
netifd: wan (9235): Waiting for network registration
netifd: wan (9235): + local 'registration_timeout=0'
netifd: wan (9235): + uqmi -s -d /dev/cdc-wdm1 --get-serving-system
netifd: wan (9235): + grep '"searching"'
netifd: wan (9235): + uqmi -s -d /dev/cdc-wdm1 --get-serving-system
netifd: wan (9235): +
registration='{"registration":"not_registered","plmn_mcc":208,"plmn_mnc":20,"plmn_description":"","roaming":true}'
netifd: wan (9235): + '[' -n  ]
netifd: wan (9235): + echo 'Starting network wan'

As the while loop checks only "searching" pattern, uqmi.sh script
quits searching loop and continues whereas the modem is not registered

Other issue, after X seconds modem stop searching.
netifd: wan (9213): + uqmi -s -d /dev/cdc-wdm0 --get-serving-system
netifd: wan (9213): + grep '"searching"'
netifd: wan (9213): + '[' -e /dev/cdc-wdm0 ]
netifd: wan (9213): + '[' 3 -lt 0 -o 0 '=' 0 ]
netifd: wan (9213): + let registration_timeout++
netifd: wan (9213): + sleep 1
netifd: wan (9213): + uqmi -s -d /dev/cdc-wdm0 --get-serving-system
netifd: wan (9213): + grep '"searching"'
netifd: wan (9213): + uqmi -s -d /dev/cdc-wdm0 --get-serving-system
netifd: wan (9213): + registration='{"registration":"not_registered"}'
netifd: wan (9213): + '[' -n  ]
netifd: wan (9213): + echo 'Starting network wan'
netifd: wan (9213): Starting network wan

If registration_timeout is not expired, registration can be restarted

Signed-off-by: Thomas Richard 
---
 package/network/utils/uqmi/Makefile|  2 +-
 .../utils/uqmi/files/lib/netifd/proto/qmi.sh   | 35 
--

 2 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/package/network/utils/uqmi/Makefile
b/package/network/utils/uqmi/Makefile
index 68958a3729..da54ba0f46 100644
--- a/package/network/utils/uqmi/Makefile
+++ b/package/network/utils/uqmi/Makefile
@@ -1,7 +1,7 @@
 include $(TOPDIR)/rules.mk

 PKG_NAME:=uqmi
-PKG_RELEASE:=2
+PKG_RELEASE:=3

 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/uqmi.git
diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
index a6c785eb56..c29187cfbf 100755
--- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
+++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
@@ -209,19 +209,36 @@ proto_qmi_setup() {

uqmi -s -d "$device" --sync > /dev/null 2>&1

+   uqmi -s -d "$device" --network-register > /dev/null 2>&1
+
echo "Waiting for network registration"
+   sleep 1
local registration_timeout=0
-   while uqmi -s -d "$device" --get-serving-system | grep '"searching"'
> /dev/null; do
-   [ -e "$device" ] || return 1
-		if [ "$registration_timeout" -lt "$timeout" -o "$timeout" = "0" ]; 
then


Could we please use not -o or -a?

In OpenWrt we prefer && or || pattern


-   let registration_timeout++
-   sleep 1;
+   local registration_state=""
+   while true; do
+   registration_state=$(uqmi -s -d "$device" --get-serving-system
2>/dev/null | jsonfilter -e "@.registration" 2>/dev/null)
+
+   [ "$registration_state" = "registered" ] && break
+
+   if [ "$registration_state" = "searching" -o 
"$registration_state" =
"not_registered" ]; then
+   [ "$registration_timeout" -lt "$timeout" -o "$timeout" = "0" ] 
&& {
+   [ "$registration_state" = "searching" ] || {
+   echo "Device stopped network 
registration. Restart
network registration"
+   uqmi -s -d "$device" --network-register > 
/dev/null 2>&1
+   }
+   let registration_timeout++
+   sleep 1
+   continue
+   }
+   echo "Network registration failed, registration timeout 
reached"
else
- 

  1   2   3   >