Re: [OpenWrt-Devel] [PATCH] base-files utils/busybox: Make requiring login in console default for easily accessed devices

2015-12-22 Thread Heinrich Schuchardt
Hello Daniel,

my TP-LINK MR3020 (AR71XX, OpenWrt 15.05) uses /dev/ttyATH0 as serial
console .

I could not find this device in the getty commands of the inittab that
you create in the patch below.

I would feel more comfortable having a password verification on my
router. Shouldn't this be default on all targets?

Best regards

Heinrich Schuchardt


On 23.12.2015 07:58, Daniel Dickinson wrote:
> I am reworking this (requiring console login) as couple of packages for
> the packages feed, although it may require an image.mk or packages
> Makefile hook in order to embed an appropriate inittab into the image
> (since the inittab will need to be modified and we need to guarantee the
> correct order of actions; and inittab comes from base-files which is
> last thing done in the packages Makefile).
> 
> Regards,
> 
> Daniel
> 
> On 16/12/15 09:59 AM, open...@daniel.thecshore.com wrote:
>> From: Daniel Dickinson 
>>
>> Some devices like generic PC's and Raspberry Pi/Pi2 are much more
>> trivial to
>> get hardware console access than a typical router scenario and
>> therefore really
>> ought to require login even on hardware console rather than a hardware
>> console
>> granting passwordless root access.
>>
>> Since we're at it, we also make requiring login on hardware console an
>> easily configured build-time option.
>>
>> Signed-off-by: Daniel Dickinson 
>> ---
>>   config/Config-build.in | 17
>> 
>>   package/base-files/Makefile| 23
>> +-
>>   package/utils/busybox/Config-defaults.in   |  3 +++
>>   .../linux/adm5120/base-files-console/etc/inittab   |  5 +
>>   .../base-files-console/etc/uci-defaults/inittab|  6 ++
>>   .../linux/brcm2708/base-files-console/etc/inittab  |  4 
>>   .../linux/ipq806x/base-files-console/etc/inittab   |  4 
>>   target/linux/lantiq/base-files-console/etc/inittab |  3 +++
>>   target/linux/malta/base-files-console/etc/inittab  |  7 +++
>>   .../linux/mediatek/base-files-console/etc/inittab  |  3 +++
>>   target/linux/mxs/base-files-console/etc/inittab|  3 +++
>>   target/linux/omap/base-files-console/etc/inittab   |  5 +
>>   .../linux/omap24xx/base-files-console/etc/inittab  |  5 +
>>   target/linux/ppc44x/base-files-console/etc/inittab |  4 
>>   .../linux/realview/base-files-console/etc/inittab  |  5 +
>>   target/linux/sunxi/base-files-console/etc/inittab  |  5 +
>>   target/linux/x86/base-files-console/etc/inittab|  4 
>>   17 files changed, 105 insertions(+), 1 deletion(-)
>>   create mode 100644 target/linux/adm5120/base-files-console/etc/inittab
>>   create mode 100644
>> target/linux/ar71xx/base-files-console/etc/uci-defaults/inittab
>>   create mode 100644 target/linux/brcm2708/base-files-console/etc/inittab
>>   create mode 100644 target/linux/ipq806x/base-files-console/etc/inittab
>>   create mode 100644 target/linux/lantiq/base-files-console/etc/inittab
>>   create mode 100644 target/linux/malta/base-files-console/etc/inittab
>>   create mode 100644 target/linux/mediatek/base-files-console/etc/inittab
>>   create mode 100644 target/linux/mxs/base-files-console/etc/inittab
>>   create mode 100644 target/linux/omap/base-files-console/etc/inittab
>>   create mode 100644 target/linux/omap24xx/base-files-console/etc/inittab
>>   create mode 100644 target/linux/ppc44x/base-files-console/etc/inittab
>>   create mode 100644 target/linux/realview/base-files-console/etc/inittab
>>   create mode 100644 target/linux/sunxi/base-files-console/etc/inittab
>>   create mode 100644 target/linux/x86/base-files-console/etc/inittab
>>
>> diff --git a/config/Config-build.in b/config/Config-build.in
>> index 1a35c5d..f975d45 100644
>> --- a/config/Config-build.in
>> +++ b/config/Config-build.in
>> @@ -75,6 +75,23 @@ menu "Global build settings"
>> encrypted and unencrypted flavours, even when the
>> encryption library
>> is a 'heavier' one such as OpenSSL.
>>
>> +config CONSOLE_LOGIN
>> +bool
>> +prompt "Require login even on hardware/serial console"
>> +default y if (TARGET_x86_generic || TARGET_x86_64 ||
>> TARGET_brcm2708)
>> +default n
>> +help
>> +  Enables Busybox applets getty and login and uses them
>> instead of default
>> +  respawn of ash on hardware/serial consoles.  This is made
>> the default for
>> +  targets which are fairly easy to gain hardware console
>> access compared to
>> +  a typical router (which generally require more electronics
>> skill or at least
>> +  equipment that than is common except with
>> electronics enthusiasts and
>> +  professionals).  This includes the Raspberry Pi/Pi2
>> (built in HDMI and USB
>> +  support making adding a console trivial), and *generic* x86
>> 32-bit and
>> +  64-bit systems (typically physical PCs for which it is also
>> 

Re: [OpenWrt-Devel] [PATCH] base-files utils/busybox: Make requiring login in console default for easily accessed devices

2015-12-22 Thread Daniel Dickinson
I am reworking this (requiring console login) as couple of packages for 
the packages feed, although it may require an image.mk or packages 
Makefile hook in order to embed an appropriate inittab into the image 
(since the inittab will need to be modified and we need to guarantee the 
correct order of actions; and inittab comes from base-files which is 
last thing done in the packages Makefile).


Regards,

Daniel

On 16/12/15 09:59 AM, open...@daniel.thecshore.com wrote:

From: Daniel Dickinson 

Some devices like generic PC's and Raspberry Pi/Pi2 are much more trivial to
get hardware console access than a typical router scenario and therefore really
ought to require login even on hardware console rather than a hardware console
granting passwordless root access.

Since we're at it, we also make requiring login on hardware console an
easily configured build-time option.

Signed-off-by: Daniel Dickinson 
---
  config/Config-build.in | 17 
  package/base-files/Makefile| 23 +-
  package/utils/busybox/Config-defaults.in   |  3 +++
  .../linux/adm5120/base-files-console/etc/inittab   |  5 +
  .../base-files-console/etc/uci-defaults/inittab|  6 ++
  .../linux/brcm2708/base-files-console/etc/inittab  |  4 
  .../linux/ipq806x/base-files-console/etc/inittab   |  4 
  target/linux/lantiq/base-files-console/etc/inittab |  3 +++
  target/linux/malta/base-files-console/etc/inittab  |  7 +++
  .../linux/mediatek/base-files-console/etc/inittab  |  3 +++
  target/linux/mxs/base-files-console/etc/inittab|  3 +++
  target/linux/omap/base-files-console/etc/inittab   |  5 +
  .../linux/omap24xx/base-files-console/etc/inittab  |  5 +
  target/linux/ppc44x/base-files-console/etc/inittab |  4 
  .../linux/realview/base-files-console/etc/inittab  |  5 +
  target/linux/sunxi/base-files-console/etc/inittab  |  5 +
  target/linux/x86/base-files-console/etc/inittab|  4 
  17 files changed, 105 insertions(+), 1 deletion(-)
  create mode 100644 target/linux/adm5120/base-files-console/etc/inittab
  create mode 100644 
target/linux/ar71xx/base-files-console/etc/uci-defaults/inittab
  create mode 100644 target/linux/brcm2708/base-files-console/etc/inittab
  create mode 100644 target/linux/ipq806x/base-files-console/etc/inittab
  create mode 100644 target/linux/lantiq/base-files-console/etc/inittab
  create mode 100644 target/linux/malta/base-files-console/etc/inittab
  create mode 100644 target/linux/mediatek/base-files-console/etc/inittab
  create mode 100644 target/linux/mxs/base-files-console/etc/inittab
  create mode 100644 target/linux/omap/base-files-console/etc/inittab
  create mode 100644 target/linux/omap24xx/base-files-console/etc/inittab
  create mode 100644 target/linux/ppc44x/base-files-console/etc/inittab
  create mode 100644 target/linux/realview/base-files-console/etc/inittab
  create mode 100644 target/linux/sunxi/base-files-console/etc/inittab
  create mode 100644 target/linux/x86/base-files-console/etc/inittab

diff --git a/config/Config-build.in b/config/Config-build.in
index 1a35c5d..f975d45 100644
--- a/config/Config-build.in
+++ b/config/Config-build.in
@@ -75,6 +75,23 @@ menu "Global build settings"
encrypted and unencrypted flavours, even when the 
encryption library
is a 'heavier' one such as OpenSSL.

+   config CONSOLE_LOGIN
+   bool
+   prompt "Require login even on hardware/serial console"
+   default y if (TARGET_x86_generic || TARGET_x86_64 || 
TARGET_brcm2708)
+   default n
+   help
+ Enables Busybox applets getty and login and uses them instead 
of default
+ respawn of ash on hardware/serial consoles.  This is made the 
default for
+ targets which are fairly easy to gain hardware console access 
compared to
+ a typical router (which generally require more electronics 
skill or at least
+  equipment that than is common except with electronics 
enthusiasts and
+  professionals).  This includes the Raspberry Pi/Pi2 (built 
in HDMI and USB
+ support making adding a console trivial), and *generic* x86 
32-bit and
+ 64-bit systems (typically physical PCs for which it is also 
usually trivial
+  to add a keyboard and monitor without even rebooting).
+
+
comment "Kernel build options"

source "config/Config-kernel.in"
diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index 1367fa9..b4fe806 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -112,25 +112,46 @@ define Package/base-files/install
if [ -d $(GENERIC_PLATFORM_DIR)/base-files/. ]; then \
$(CP) $(GENERIC_PLATFORM_DIR)/base-files/* $(1)/; \
fi
+   $(if $(CONFIG_CONS

[OpenWrt-Devel] [PATCH] network/services/uhttpd: Add Basic Auth config

2015-12-22 Thread openwrt
From: Daniel Dickinson 

We add an 'httpauth' section type that contains the options:

instance: Which uhttpd config section the auth is associated with
prefix: What virtual or real URL is being protected
username: The username for the Basic Auth dialogue
password: Hashed (crypt()) or plaintext password for the Basic Auth dialogue

If instance is not specified auth section applies to
all instances of uhttpd; if instance is specified
the auth section only applies to the uhttpd config
section with the same name as specified with the
instance option.

Signed-off-by: Daniel Dickinson 
---
 package/network/services/uhttpd/files/uhttpd.init | 36 ++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/package/network/services/uhttpd/files/uhttpd.init 
b/package/network/services/uhttpd/files/uhttpd.init
index add0924..df17c31 100755
--- a/package/network/services/uhttpd/files/uhttpd.init
+++ b/package/network/services/uhttpd/files/uhttpd.init
@@ -53,6 +53,28 @@ generate_keys() {
}
 }
 
+create_httpauth() {
+   local cfg="$1"
+   local basecfg="$2"
+   local prefix username password
+
+   local instance
+   config_get instance "$cfg" instance
+   if [ -n "$instance" ] && [ "$instance" != "$basecfg" ]; then
+   return
+   fi
+
+   config_get prefix "$cfg" prefix
+   config_get username "$cfg" username
+   config_get password "$cfg" password
+
+   if [ -z "$prefix" ] || [ -z "$username" ] || [ -z "$password" ]; then
+   return
+   fi
+   echo "${prefix}:${username}:${password}" >>$httpdconf
+   haveauth=1
+}
+
 start_instance()
 {
UHTTPD_CERT=""
@@ -60,17 +82,29 @@ start_instance()
 
local cfg="$1"
local realm="$(uci_get system.@system[0].hostname)"
-   local listen http https interpreter indexes path handler
+   local listen http https interpreter indexes path handler httpdconf 
haveauth
 
procd_open_instance
procd_set_param respawn
procd_set_param stderr 1
procd_set_param command "$UHTTPD_BIN" -f
 
+   config_get config "$cfg" config
+   if [ -z "$config" ]; then
+   mkdir -p /var/etc/uhttpd
+   httpdconf="/var/etc/uhttpd/httpd.${cfg}.conf"
+   rm -f ${httpdconf}
+   config_foreach create_httpauth httpauth "$cfg"
+   if [ "$haveauth" = "1" ]; then
+   procd_append_param command -c ${httpdconf}
+   fi
+   fi
+
append_arg "$cfg" home "-h"
append_arg "$cfg" realm "-r" "${realm:-OpenWrt}"
append_arg "$cfg" config "-c"
append_arg "$cfg" cgi_prefix "-x"
+
[ -f /usr/lib/uhttpd_lua.so ] && {
config_get handler "$cfg" lua_handler
[ -f "$handler" ] && append_arg "$cfg" lua_prefix "-l" && {
-- 
2.4.3
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] A note on selects vs. DEPENDS

2015-12-22 Thread Daniel Dickinson

I've run into a situation where that solution does not work.

Specifically:

  DEPENDS:=+PACKAGE_TAR_POSIX_ACL:libacl +PACKAGE_TAR_XATTR:libxattr 
+PACKAGE_TAR_BZIP2:bzip2 +PACKAGE_TAR_XZ:xz

endef

define Package/tar/config
config PACKAGE_TAR_POSIX_ACL
bool "tar: Enable POSIX ACL support" if PACKAGE_tar
default y if USE_FS_ACL_ATTR
default n

config PACKAGE_TAR_XATTR
bool "tar: Enable extended attribute (xattr) support" if 
PACKAGE_tar

default y if USE_FS_ACL_ATTR
default n

config PACKAGE_TAR_GZIP
bool "tar: Enable seamless gzip support" if PACKAGE_tar
default y

config PACKAGE_TAR_BZIP2
bool "tar: Enable seamless bzip2 support" if PACKAGE_tar
default y

config PACKAGE_TAR_XZ
bool "tar: Enable seamless xz support" if PACKAGE_tar
select PACKAGE_xz
default y
endef

That results in a circular dependency.

Using EXTRA_DEPENDS and select in config section is necessary because of 
the way package dependency parsing mangles the dependencies when using 
+PACKAGE_TAR_XZ:xz.  Specifically xz 'depends on' xz-utils in the xz 
package definition. When taken in combination with +PACKAGE_TAR_XZ:xz 
the parsing/mangling results in a recursive dependency where tar depends 
on PACKAGE_TAR_XZ and vice versa, because the recursive dependency 
checker does not distinguish between


depends on SYMBOL
vs.
depends on !SYMBOL

and the xz-utils depends results in

PACKAGE_tar depends on !(PACKAGE_TAR_XZ) || PACKAGE_xz-utils

and PACKAGE_TAR_XZ depends on PACKAGE_tar because it makes no sense 
without tar (and submenu doesn't work without the if PACKAGE_tar or a 
depends on PACKAGE_tar).



On 22/12/15 06:46 PM, Felix Fietkau wrote:

On 2015-12-23 00:42, Daniel Dickinson wrote:

Hi Felix,

On 22/12/15 09:03 AM, Felix Fietkau wrote:

On 2015-12-22 06:02, Daniel Dickinson wrote:

Hi all,

I just discovered something.  It seems that in a package if you have a
config section that does select PACKAGE_condition_dependency then the
build succeeds but when you do opkg install, opkg does not 'know' about
the dependency.

That means if you have a situation like lldpd where you have a
conditional dependency it is not enough to add selects to same
config section as the conditional compilation flags, but you also need
to add an EXTRA_DEPENDS:=$(if
$(CONFIG_),conditional_dependency) line.

I will be submitting a patch to lldpd with that fix, since my previous
patch fixed compilation, but doesn't solve the opkg problem (although no
one is likely to actually run across it because libjson-c is installed
by default so it's unlikely any failure would actually occur).  (Before
my patch even compilation would fail if json output was disable due to
missing dependency, now you would likely never notice the problem
because libjson-c is installed by default, but I discovered the issue in
reference to package to which I'm adding conditional build logic in the
packages feed for which the conditional dependency is not included
unless the package I'm working on depends on it).

You should just use the normal conditional depends syntax for the
DEPENDS line in the package, instead of duplicating it in Config.in and
EXTRA_DEPENDS.

DEPENDS:=+PACKAGE_conditional_package:selected_package


It's actually used in the context of a Package//config section that
does some condition compilation option that when enabled adds another
dependency.  Hence the unusual method.  Conditional dependency based on
the configure option I had forgotten as an option though:

i.e.

config PACKAGE_LLDPD_JSON
bool "Enable JSON output"
default n

and in depends

DEPENDS:=PACKAGE_LLDPD_JSON:libjson-c

DEPENDS:=+PACKAGE_LLDPD_JSON:libjson-c (the + turns it into a select).
Then you don't need to select libjson-c from the /config section.

- Felix


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


Re: [OpenWrt-Devel] A note on selects vs. DEPENDS

2015-12-22 Thread Felix Fietkau
On 2015-12-23 00:42, Daniel Dickinson wrote:
> Hi Felix,
> 
> On 22/12/15 09:03 AM, Felix Fietkau wrote:
>> On 2015-12-22 06:02, Daniel Dickinson wrote:
>>> Hi all,
>>>
>>> I just discovered something.  It seems that in a package if you have a
>>> config section that does select PACKAGE_condition_dependency then the
>>> build succeeds but when you do opkg install, opkg does not 'know' about
>>> the dependency.
>>>
>>> That means if you have a situation like lldpd where you have a
>>> conditional dependency it is not enough to add selects to same
>>> config section as the conditional compilation flags, but you also need
>>> to add an EXTRA_DEPENDS:=$(if
>>> $(CONFIG_),conditional_dependency) line.
>>>
>>> I will be submitting a patch to lldpd with that fix, since my previous
>>> patch fixed compilation, but doesn't solve the opkg problem (although no
>>> one is likely to actually run across it because libjson-c is installed
>>> by default so it's unlikely any failure would actually occur).  (Before
>>> my patch even compilation would fail if json output was disable due to
>>> missing dependency, now you would likely never notice the problem
>>> because libjson-c is installed by default, but I discovered the issue in
>>> reference to package to which I'm adding conditional build logic in the
>>> packages feed for which the conditional dependency is not included
>>> unless the package I'm working on depends on it).
>> You should just use the normal conditional depends syntax for the
>> DEPENDS line in the package, instead of duplicating it in Config.in and
>> EXTRA_DEPENDS.
>>
>> DEPENDS:=+PACKAGE_conditional_package:selected_package
> 
> It's actually used in the context of a Package//config section that 
> does some condition compilation option that when enabled adds another 
> dependency.  Hence the unusual method.  Conditional dependency based on 
> the configure option I had forgotten as an option though:
> 
> i.e.
> 
> config PACKAGE_LLDPD_JSON
> bool "Enable JSON output"
> default n
> 
> and in depends
> 
> DEPENDS:=PACKAGE_LLDPD_JSON:libjson-c
DEPENDS:=+PACKAGE_LLDPD_JSON:libjson-c (the + turns it into a select).
Then you don't need to select libjson-c from the /config section.

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


Re: [OpenWrt-Devel] A note on selects vs. DEPENDS

2015-12-22 Thread Daniel Dickinson

On 22/12/15 06:42 PM, Daniel Dickinson wrote:

Hi Felix,

On 22/12/15 09:03 AM, Felix Fietkau wrote:

On 2015-12-22 06:02, Daniel Dickinson wrote:

Hi all,

I just discovered something.  It seems that in a package if you have a
config section that does select PACKAGE_condition_dependency then the
build succeeds but when you do opkg install, opkg does not 'know' about
the dependency.

That means if you have a situation like lldpd where you have a
conditional dependency it is not enough to add selects to same
config section as the conditional compilation flags, but you also need
to add an EXTRA_DEPENDS:=$(if
$(CONFIG_),conditional_dependency) line.

I will be submitting a patch to lldpd with that fix, since my previous
patch fixed compilation, but doesn't solve the opkg problem (although no
one is likely to actually run across it because libjson-c is installed
by default so it's unlikely any failure would actually occur).  (Before
my patch even compilation would fail if json output was disable due to
missing dependency, now you would likely never notice the problem
because libjson-c is installed by default, but I discovered the issue in
reference to package to which I'm adding conditional build logic in the
packages feed for which the conditional dependency is not included
unless the package I'm working on depends on it).

You should just use the normal conditional depends syntax for the
DEPENDS line in the package, instead of duplicating it in Config.in and
EXTRA_DEPENDS.

DEPENDS:=+PACKAGE_conditional_package:selected_package


It's actually used in the context of a Package//config section that
does some condition compilation option that when enabled adds another
dependency.  Hence the unusual method.  Conditional dependency based on
the configure option I had forgotten as an option though:

i.e.

config PACKAGE_LLDPD_JSON
bool "Enable JSON output"
default n

and in depends

DEPENDS:=PACKAGE_LLDPD_JSON:libjson-c


I mean

DEPENDS:=+PACKAGE_LLDPD_JSON:libjson-c



That sound right?

Regards,

Daniel
___
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


Re: [OpenWrt-Devel] A note on selects vs. DEPENDS

2015-12-22 Thread Daniel Dickinson

Hi Felix,

On 22/12/15 09:03 AM, Felix Fietkau wrote:

On 2015-12-22 06:02, Daniel Dickinson wrote:

Hi all,

I just discovered something.  It seems that in a package if you have a
config section that does select PACKAGE_condition_dependency then the
build succeeds but when you do opkg install, opkg does not 'know' about
the dependency.

That means if you have a situation like lldpd where you have a
conditional dependency it is not enough to add selects to same
config section as the conditional compilation flags, but you also need
to add an EXTRA_DEPENDS:=$(if
$(CONFIG_),conditional_dependency) line.

I will be submitting a patch to lldpd with that fix, since my previous
patch fixed compilation, but doesn't solve the opkg problem (although no
one is likely to actually run across it because libjson-c is installed
by default so it's unlikely any failure would actually occur).  (Before
my patch even compilation would fail if json output was disable due to
missing dependency, now you would likely never notice the problem
because libjson-c is installed by default, but I discovered the issue in
reference to package to which I'm adding conditional build logic in the
packages feed for which the conditional dependency is not included
unless the package I'm working on depends on it).

You should just use the normal conditional depends syntax for the
DEPENDS line in the package, instead of duplicating it in Config.in and
EXTRA_DEPENDS.

DEPENDS:=+PACKAGE_conditional_package:selected_package


It's actually used in the context of a Package//config section that 
does some condition compilation option that when enabled adds another 
dependency.  Hence the unusual method.  Conditional dependency based on 
the configure option I had forgotten as an option though:


i.e.

config PACKAGE_LLDPD_JSON
bool "Enable JSON output"
default n

and in depends

DEPENDS:=PACKAGE_LLDPD_JSON:libjson-c

That sound right?

Regards,

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


[OpenWrt-Devel] [PATCH] [ar71xx] Support for Ubiquiti UniFi AP AC LITE

2015-12-22 Thread p . wassi
From: P.Wassi 

Add support for the Ubiquiti UniFi AP AC LITE
Signed-off-by: P.Wassi 
---
The UniFi AC series will only be supported, if these patches are
applied first (especially for the QCA956x SoC support):
https://patchwork.ozlabs.org/patch/559284/
https://patchwork.ozlabs.org/patch/559285/
https://patchwork.ozlabs.org/patch/559286/
https://patchwork.ozlabs.org/patch/559287/
https://patchwork.ozlabs.org/patch/559288/
Then, this patch adds:
* New machine type
* Code for device setup
* Proper image configuration
* New target for the build system
* Network setup as LAN-only
* Diagnostic LED
* Sysupgrade Support
* ath10k firmware extraction
* Board detection
Additional information on https://pwassi.privatedns.org/openwrt/unifiac/

diff -rup a/target/linux/ar71xx/base-files/etc/board.d/02_network 
b/target/linux/ar71xx/base-files/etc/board.d/02_network
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -357,6 +357,7 @@ tl-wa901nd-v2 |\
 tl-wa901nd-v3 |\
 tl-wr703n |\
 tube2h |\
+unifiac |\
 wndap360 |\
 mynet-rext |\
 wp543)
diff -rup a/target/linux/ar71xx/base-files/etc/diag.sh 
b/target/linux/ar71xx/base-files/etc/diag.sh
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -333,7 +333,8 @@ get_status_led() {
unifi)
status_led="ubnt:green:dome"
;;
-   uap-pro)
+   uap-pro | \
+   unifiac)
status_led="ubnt:white:dome"
;;
unifi-outdoor-plus)
diff -rup 
a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -75,6 +75,9 @@ case "$FIRMWARE" in
ath10kcal_extract "ART" 20480 2116
ath10kcal_patch_mac $(macaddr_add $(cat 
/sys/class/net/eth0/address) +16)
;;
+   unifiac)
+   ath10kcal_extract "EEPROM" 20480 2116
+   ;;
esac
;;
 "ath10k/cal-pci-:01:00.0.bin")
diff -rup a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -899,6 +899,9 @@ ar71xx_board_detect() {
*UniFi)
name="unifi"
;;
+   *"UniFi-AC")
+   name="unifiac"
+   ;;
*"UniFi AP Pro")
name="uap-pro"
;;
diff -rup a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -261,6 +261,7 @@ platform_check_image() {
wlae-ag300n | \
nbg460n_550n_550nh | \
unifi | \
+   unifiac | \
unifi-outdoor | \
carambola2 | \
weio )
diff -rup a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h 
b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -207,6 +207,7 @@ enum ath79_mach_type {
ATH79_MACH_UBNT_RS, /* Ubiquiti RouterStation */
ATH79_MACH_UBNT_UAP_PRO,/* Ubiquiti UniFi AP Pro */
ATH79_MACH_UBNT_UNIFI,  /* Ubiquiti Unifi */
+   ATH79_MACH_UBNT_UNIFIAC,/* Ubiquiti Unifi AC */
ATH79_MACH_UBNT_UNIFI_OUTDOOR,  /* Ubiquiti UnifiAP Outdoor */
ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, /* Ubiquiti UnifiAP Outdoor+ */
ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */
diff -rup a/target/linux/ar71xx/generic/profiles/ubnt.mk 
b/target/linux/ar71xx/generic/profiles/ubnt.mk
--- a/target/linux/ar71xx/generic/profiles/ubnt.mk
+++ b/target/linux/ar71xx/generic/profiles/ubnt.mk
@@ -38,6 +38,17 @@ endef
 
 $(eval $(call Profile,UBNTUNIFI))
 
+define Profile/UBNTUNIFIAC
+   NAME:=Ubiquiti UniFi AP AC
+   PACKAGES:=kmod-ath10k ath10k-firmware-qca988x
+endef
+
+define Profile/UBNTUNIFIAC/Description
+   Package set optimized for the Ubiquiti UniFi AP AC.
+endef
+
+$(eval $(call Profile,UBNTUNIFIAC))
+
 define Profile/UBNTUNIFIOUTDOOR
NAME:=Ubiquiti UniFiAP Outdoor
PACKAGES:=
diff -rup a/target/linux/ar71xx/image/Makefile 
b/target/linux/ar71xx/image/Makefile
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -1124,12 +1124,25 @@ define Device/ubnt-unifi
   DEVICE_PROFILE := UBNT UBNTUNIFI
 endef
 
+define Device/ubnt-unifiac
+  DEVICE_PROFILE := UBNT
+  IMAGE_SIZE := 7744k
+  MTDPARTS = 
spi0.0:384k(u-boot)ro,64k(u-boot-env)ro,7744k(firmware),7744k(ubnt-airos)ro,128k(bs

Re: [OpenWrt-Devel] [PATCH 05/10] imx6: add RS485 gpio-based txen support

2015-12-22 Thread Pushpal Sidhu
This patch isn't really applicable as we're still trying to clear this
with mainline. I'll mark as "Not Applicable" in patchwork. Removal of
this patch has no bearing on applying other patches as it's numbered
last.

- Pushpal

On Mon, Dec 21, 2015 at 2:25 PM, Pushpal Sidhu  wrote:
> Signed-off-by: Tim Harvey 
> ---
>  .../300-imx-serial-rs485-gpio-txen-support.patch   | 186 
> +
>  ...1-imx-ventana-add-rs485-txen-gpio-support.patch |  60 +++
>  2 files changed, 246 insertions(+)
>  create mode 100644 
> target/linux/imx6/patches-4.3/300-imx-serial-rs485-gpio-txen-support.patch
>  create mode 100644 
> target/linux/imx6/patches-4.3/301-imx-ventana-add-rs485-txen-gpio-support.patch
>
> diff --git 
> a/target/linux/imx6/patches-4.3/300-imx-serial-rs485-gpio-txen-support.patch 
> b/target/linux/imx6/patches-4.3/300-imx-serial-rs485-gpio-txen-support.patch
> new file mode 100644
> index 000..156cdd6
> --- /dev/null
> +++ 
> b/target/linux/imx6/patches-4.3/300-imx-serial-rs485-gpio-txen-support.patch
> @@ -0,0 +1,186 @@
> +Index: linux-4.3/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt
> +===
> +--- linux-4.3.orig/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt 
>   2015-11-01 16:05:25.0 -0800
>  linux-4.3/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt  
>   2015-12-18 10:39:45.103158319 -0800
> +@@ -6,6 +6,7 @@
> + - interrupts : Should contain uart interrupt
> +
> + Optional properties:
> ++- fsl,rs485-gpio-txen : Indicate a GPIO is used as TXEN instead of RTS
> + - fsl,uart-has-rtscts : Indicate the uart has rts and cts
> + - fsl,irda-mode : Indicate the uart supports irda mode
> + - fsl,dte-mode : Indicate the uart works in DTE mode. The uart works
> +Index: linux-4.3/drivers/tty/serial/imx.c
> +===
> +--- linux-4.3.orig/drivers/tty/serial/imx.c2015-11-01 16:05:25.0 
> -0800
>  linux-4.3/drivers/tty/serial/imx.c 2015-12-18 10:39:45.103158319 -0800
> +@@ -21,6 +21,7 @@
> + #define SUPPORT_SYSRQ
> + #endif
> +
> ++#include 
> + #include 
> + #include 
> + #include 
> +@@ -37,6 +38,7 @@
> + #include 
> + #include 
> + #include 
> ++#include 
> + #include 
> + #include 
> +
> +@@ -203,6 +205,7 @@
> +   unsigned short  trcv_delay; /* transceiver delay */
> +   struct clk  *clk_ipg;
> +   struct clk  *clk_per;
> ++  int txen_gpio;
> +   const struct imx_uart_data *devdata;
> +
> +   /* DMA fields */
> +@@ -373,13 +376,21 @@
> +   /* in rs485 mode disable transmitter if shifter is empty */
> +   if (port->rs485.flags & SER_RS485_ENABLED &&
> +   readl(port->membase + USR2) & USR2_TXDC) {
> +-  temp = readl(port->membase + UCR2);
> +-  if (port->rs485.flags & SER_RS485_RTS_AFTER_SEND)
> +-  temp &= ~UCR2_CTS;
> +-  else
> +-  temp |= UCR2_CTS;
> +-  writel(temp, port->membase + UCR2);
> ++  if (sport->txen_gpio != -1) {
> ++  if (port->rs485.flags & SER_RS485_RTS_AFTER_SEND)
> ++  gpio_set_value(sport->txen_gpio, 1);
> ++  else
> ++  gpio_set_value(sport->txen_gpio, 0);
> ++  } else {
> ++  temp = readl(port->membase + UCR2);
> ++  if (port->rs485.flags & SER_RS485_RTS_AFTER_SEND)
> ++  temp &= ~UCR2_CTS;
> ++  else
> ++  temp |= UCR2_CTS;
> ++  writel(temp, port->membase + UCR2);
> ++  }
> +
> ++  /* disable shifter empty irq */
> +   temp = readl(port->membase + UCR4);
> +   temp &= ~UCR4_TCEN;
> +   writel(temp, port->membase + UCR4);
> +@@ -578,14 +589,22 @@
> +   unsigned long temp;
> +
> +   if (port->rs485.flags & SER_RS485_ENABLED) {
> +-  /* enable transmitter and shifter empty irq */
> +-  temp = readl(port->membase + UCR2);
> +-  if (port->rs485.flags & SER_RS485_RTS_ON_SEND)
> +-  temp &= ~UCR2_CTS;
> +-  else
> +-  temp |= UCR2_CTS;
> +-  writel(temp, port->membase + UCR2);
> ++  /* enable transmitter */
> ++  if (sport->txen_gpio != -1) {
> ++  if (port->rs485.flags & SER_RS485_RTS_ON_SEND)
> ++  gpio_set_value(sport->txen_gpio, 1);
> ++  else
> ++  gpio_set_value(sport->txen_gpio, 0);
> ++  } else {
> ++  temp = readl(port->membase + UCR2);
> ++  if (port->rs485.flags & SER_RS485_RTS_ON_SEND)
> ++   

Re: [OpenWrt-Devel] [PATCH 04/10] imx6: Add gen2 disable patch

2015-12-22 Thread Pushpal Sidhu
This patch isn't really applicable as we're still trying to clear this
with mainline. I'll mark as "Not Applicable" in patchwork. Removal of
this patch has no bearing on applying other patches as it's numbered
last.

- Pushpal

On Mon, Dec 21, 2015 at 2:25 PM, Pushpal Sidhu  wrote:
> Disable pcie-gen2 in this kernel as the products meant to run it do not fall
> within specification for it. Instead, leave only Gen1 enabled.
>
> Signed-off-by: Tim Harvey 
> Signed-off-by: Pushpal Sidhu 
> ---
>  .../linux/imx6/patches-4.3/210-disable_gen2.patch  | 30 
> ++
>  1 file changed, 30 insertions(+)
>  create mode 100644 target/linux/imx6/patches-4.3/210-disable_gen2.patch
>
> diff --git a/target/linux/imx6/patches-4.3/210-disable_gen2.patch 
> b/target/linux/imx6/patches-4.3/210-disable_gen2.patch
> new file mode 100644
> index 000..8b3a010
> --- /dev/null
> +++ b/target/linux/imx6/patches-4.3/210-disable_gen2.patch
> @@ -0,0 +1,30 @@
> +Index: linux-4.3/drivers/pci/host/pci-imx6.c
> +===
> +--- linux-4.3.orig/drivers/pci/host/pci-imx6.c 2015-11-01 16:05:25.0 
> -0800
>  linux-4.3/drivers/pci/host/pci-imx6.c  2015-12-18 10:39:45.015158318 
> -0800
> +@@ -392,12 +392,15 @@
> +   if (ret)
> +   return ret;
> +
> ++#if 0   /* Disable Gen2 */
> +   /* Allow Gen2 mode after the link is up. */
> +   tmp = readl(pp->dbi_base + PCIE_RC_LCR);
> +   tmp &= ~PCIE_RC_LCR_MAX_LINK_SPEEDS_MASK;
> +   tmp |= PCIE_RC_LCR_MAX_LINK_SPEEDS_GEN2;
> +   writel(tmp, pp->dbi_base + PCIE_RC_LCR);
> +-
> ++#else
> ++  dev_info(pp->dev, "Link: Gen2 disabled\n");
> ++#endif
> +   /*
> +* Start Directed Speed Change so the best possible speed both link
> +* partners support can be negotiated.
> +@@ -420,7 +423,7 @@
> +   }
> +
> +   tmp = readl(pp->dbi_base + PCIE_RC_LCSR);
> +-  dev_dbg(pp->dev, "Link up, Gen=%i\n", (tmp >> 16) & 0xf);
> ++  dev_info(pp->dev, "Link up, Gen=%i\n", (tmp >> 16) & 0xf);
> +   return 0;
> + }
> +
> --
> 2.6.4
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 1/1] [package] GNU Make

2015-12-22 Thread Heinrich Schuchardt


On 22.12.2015 02:50, Yousong Zhou wrote:
> On 22 December 2015 at 06:08, Heinrich Schuchardt  wrote:
>> OpenWRT provides gcc but lacks make. So building foreign software is
>> difficult.
>>
> 
> GCC is provided as part of the OpenWrt packages feeds
> (https://github.com/openwrt/packages), so maybe this should also go
> there.
>

Thank you for the hint.

I have created a pull request now:
https://github.com/openwrt/packages/pull/2165

>> This patch provides GNU Make 4.1.
>>
>> Built on Debian Jessie amd64.
>> Tested on TP-Link MR3020 (ar71xx/generic).
>>
>> Signed-off-by: Heinrich Schuchardt 
>> ---
>>  package/devel/make/Makefile | 52 
>> +
>>  1 file changed, 52 insertions(+)
>>  create mode 100644 package/devel/make/Makefile
>>
>> diff --git a/package/devel/make/Makefile b/package/devel/make/Makefile
>> new file mode 100644
>> index 000..7c938bd
>> --- /dev/null
>> +++ b/package/devel/make/Makefile
>> @@ -0,0 +1,52 @@
>> +#
>> +# Copyright (C) 2015 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:=make
>> +PKG_VERSION:=4.1
>> +PKG_RELEASE:=1
>> +
>> +PKG_SOURCE_URL:=@GNU/make
>> +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
>> +PKG_VERSION:=$(PKG_VERSION)
> 
> This line should not be necessary.
> 
>> +PKG_MD5SUM:=654f9117957e6fa6a1c49a8f08270ec9
>> +PKG_MAINTAINER:=Heinrich Schuchardt 
>> +PKG_LICENSE:=GPL-3.0+
>> +
>> +PKG_INSTALL:=1
>> +
>> +include $(INCLUDE_DIR)/package.mk
>> +
>> +define Package/make
>> +  SECTION:=devel
>> +  CATEGORY:=Development
>> +  TITLE:=make
>> +  DEPENDS:=
>> +  URL:=https://www.gnu.org/software/make/
>> +endef
>> +
>> +define Package/make/description
>> +  The Make package contains a tool to create executables from source files.
>> +endef
>> +
>> +TARGET_CFLAGS += $(FPIC) -Wno-unused-value
>> +
>> +CONFIGURE_ARGS += \
>> +   --host=$(REAL_GNU_TARGET_NAME) \
>> +   --target=$(REAL_GNU_TARGET_NAME) \
>> +   --prefix=/usr
> 
> Could this package be built and run without these statements?
> 
>> +
>> +define Package/make/install
>> +   $(INSTALL_DIR) $(1)/usr/bin
>> +   $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/make $(1)/usr/bin/
>> +   $(INSTALL_DIR) $(1)/usr/include
>> +   $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
>> +endef
>> +
>> +$(eval $(call BuildPackage,make))
>> --
>> 2.1.4
>> ___
>> 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


Re: [OpenWrt-Devel] [PATCH] use NTP server received via DHCP

2015-12-22 Thread Bastian Bittorf
* amine ahd  [22.12.2015 17:40]:
> + #get the list of ntp servers from DHCP using ubus.
> + ntpservers=`ubus call network.interface dump | grep "ntpserver" | cut 
> -d":" -f2 | tr -d '"'`

remove the comment, it's obvious what you are doing.
when using comment, use a space e.g. # mycomment

when speaking with ubus/parsing json do this:

ubus list network.interface -> interfaces
. /usr/share/libubox/jshn.sh
json_load "$( ubus call network.interface.wan2 status )"
...

@jow: can you say more about that?


>   validate_ntp_section ntp || {
>   echo "validation failed"
>   return 1
> @@ -22,12 +24,20 @@ start_service() {
>  
>   [ $enabled = 0 ] && return
>  
> - [ -z "$server" ] && return
> + [ -z "$server" ] && [ "$ntpservers" == "" ] && return

please do
[ -z "$ntpservers" ]

> +handle_default_ntp_servers() {
> + local server="$1"
> + # append the server to the list
> + new_ntp_servers="$new_ntp_servers $server"
> +}

this comment also does not help 8-)

> +local proto=`uci get network.$INTERFACE.proto`

please use OpenWrt-style: "$(...)"

> +#get the list of ntp servers returned from DHCP, remote leading and trailing 
> whitespaces as well as string quotes
> +dhcp_ntp_servers=`ubus call network.interface dump | grep "ntpserver" | cut 
> -d":" -f2 | sed 's/\"//g;s/^[ \t]*//;s/[ \t]*$//'`

same as on top, dont parse JSON like this.

> +#get the current list of ntp servers in the running instance
> +current_ntp_servers=`ubus call service get_data '{"name":"sysntpd"}' | grep 
> "ntp_servers" | cut -d":" -f2 | sed 's/\"//g;s/^[ \t]*//;s/[ \t]*$//'`

same as on top

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


[OpenWrt-Devel] [PATCH] use NTP server received via DHCP

2015-12-22 Thread amine ahd
The current state of NTP is to load the list of NTP servers 
from the static file /etc/config/system.
This patch allows ntpd to get NTP servers from DHCP.
ntpd will restart whenever the list of NTP servers is changed.

Signed-off-by: amine hamed 
---
 package/utils/busybox/Makefile |  3 +++
 package/utils/busybox/files/sysntpd| 15 +--
 .../package/utils/busybox/files/sysntpd.hotplug| 31 ++
 3 files changed, 47 insertions(+), 2 deletions(-)
 create mode 100755 package/utils/busybox/files/sysntpd.hotplug

diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index 9571d48..3c33246 100644
--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -112,6 +112,9 @@ define Package/busybox/install
$(INSTALL_BIN) ./files/cron $(1)/etc/init.d/cron
$(INSTALL_BIN) ./files/telnet $(1)/etc/init.d/telnet
$(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
+   $(INSTALL_DIR) $(1)/etc/hotplug.d
+   $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+   $(INSTALL_BIN) ./files/sysntpd.hotplug 
$(1)/etc/hotplug.d/iface/30-sysntpd
$(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
-rm -rf $(1)/lib64
 endef
diff --git a/package/utils/busybox/files/sysntpd 
b/package/utils/busybox/files/sysntpd
index f73bb83..fbe1838 100755
--- a/package/utils/busybox/files/sysntpd
+++ b/package/utils/busybox/files/sysntpd
@@ -1,12 +1,12 @@
 #!/bin/sh /etc/rc.common
 # Copyright (C) 2011 OpenWrt.org
 
+. /lib/functions.sh
 START=98
 
 USE_PROCD=1
 PROG=/usr/sbin/ntpd
 HOTPLUG_SCRIPT=/usr/sbin/ntpd-hotplug
-
 validate_ntp_section() {
uci_validate_section system timeserver "${1}" \
'server:list(host)' 'enabled:bool:1' 'enable_server:bool:0'
@@ -15,6 +15,8 @@ validate_ntp_section() {
 start_service() {
local server enabled enable_server peer
 
+   #get the list of ntp servers from DHCP using ubus.
+   ntpservers=`ubus call network.interface dump | grep "ntpserver" | cut 
-d":" -f2 | tr -d '"'`
validate_ntp_section ntp || {
echo "validation failed"
return 1
@@ -22,12 +24,20 @@ start_service() {
 
[ $enabled = 0 ] && return
 
-   [ -z "$server" ] && return
+   [ -z "$server" ] && [ "$ntpservers" == "" ] && return
 
procd_open_instance
procd_set_param command "$PROG" -n
[ "$enable_server" = "1" ] && procd_append_param command -l
[ -x "$HOTPLUG_SCRIPT" ] && procd_append_param command -S 
"$HOTPLUG_SCRIPT"
+
+   #add this data so we can use it in the sysntpd hotplug script.
+   procd_set_param data ntp_servers="$ntpservers $server"
+
+   for ntpserver in $ntpservers; do
+   procd_append_param command -p $ntpserver
+   done
+
for peer in $server; do
procd_append_param command -p $peer
done
@@ -38,5 +48,6 @@ start_service() {
 service_triggers()
 {
procd_add_reload_trigger "system"
+
procd_add_validation validate_ntp_section
 }
diff --git a/package/utils/busybox/files/sysntpd.hotplug 
b/package/utils/busybox/files/sysntpd.hotplug
new file mode 100755
index 000..de2946a
--- /dev/null
+++ b/package/utils/busybox/files/sysntpd.hotplug
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+. /lib/functions.sh
+
+[ "$ACTION" = ifup ] || exit 0
+
+handle_default_ntp_servers() {
+   local server="$1"
+   # append the server to the list
+   new_ntp_servers="$new_ntp_servers $server"
+}
+
+local proto=`uci get network.$INTERFACE.proto`
+
+#get the list of ntp servers returned from DHCP, remote leading and trailing 
whitespaces as well as string quotes
+dhcp_ntp_servers=`ubus call network.interface dump | grep "ntpserver" | cut 
-d":" -f2 | sed 's/\"//g;s/^[ \t]*//;s/[ \t]*$//'`
+
+new_ntp_servers="$dhcp_ntp_servers"
+
+#get the default list of ntp servers from the config file and append it to the 
new list
+config_load system
+config_list_foreach "ntp" "server" handle_default_ntp_servers
+
+#get the current list of ntp servers in the running instance
+current_ntp_servers=`ubus call service get_data '{"name":"sysntpd"}' | grep 
"ntp_servers" | cut -d":" -f2 | sed 's/\"//g;s/^[ \t]*//;s/[ \t]*$//'`
+
+#if its an up action, the iface uses DHCP and the new list of ntp servers is 
different from the old, restart sysntpd
+[ "$proto" == "dhcp" ]  && [ "$current_ntp_servers" != "$new_ntp_servers" ] || 
exit 0
+
+logger -t sysntpd "Reloading sysntpd due to $ACTION of interface $INTERFACE 
and a change of NTP servers"
+/etc/init.d/sysntpd enabled && /etc/init.d/sysntpd reload
\ No newline at end of file
-- 
2.5.0
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 2/3] ar71xx: add support for QCA956x ethernet

2015-12-22 Thread p . wassi
Ok, I see.
At first I did not test 10MBit links, but then I thought for completeness' 
sake...

I just added 0x1313 to the board config, so it won't get overriden by the
default value.

I'm currently doing a last test run of my patch for UAPAC LITE support and
will then submit it to the mailinglist.

Regards,
P.Wassi


> > Hi Roman,
> >
> > are you sure about the value of QCA956X_PLL_VAL_10,
> > which is 0x1919 in your patch?
> >
> > At least for the UAPAC LITE I have the problem that packet transmission
> > on 10MBit/s links does not work with 0x1919.
> > Instead, with QCA956X_PLL_VAL_10 = 0x1313 everything is fine.
> >
> > Is this specific to the UAPAC LITE or the QCA9563?
> 
> Honestly I don't remember where it comes from, Possibly from codeaurora repo.
> So no, I'm not sure. But still it can be overriden from board file.
> Sorry didn't bother testing with 10Mbit links :)
> 
> Regards,
> Roman
> 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] A note on selects vs. DEPENDS

2015-12-22 Thread Felix Fietkau
On 2015-12-22 06:02, Daniel Dickinson wrote:
> Hi all,
> 
> I just discovered something.  It seems that in a package if you have a 
> config section that does select PACKAGE_condition_dependency then the 
> build succeeds but when you do opkg install, opkg does not 'know' about 
> the dependency.
> 
> That means if you have a situation like lldpd where you have a 
> conditional dependency it is not enough to add selects to same
> config section as the conditional compilation flags, but you also need 
> to add an EXTRA_DEPENDS:=$(if 
> $(CONFIG_),conditional_dependency) line.
> 
> I will be submitting a patch to lldpd with that fix, since my previous 
> patch fixed compilation, but doesn't solve the opkg problem (although no 
> one is likely to actually run across it because libjson-c is installed 
> by default so it's unlikely any failure would actually occur).  (Before 
> my patch even compilation would fail if json output was disable due to 
> missing dependency, now you would likely never notice the problem 
> because libjson-c is installed by default, but I discovered the issue in 
> reference to package to which I'm adding conditional build logic in the 
> packages feed for which the conditional dependency is not included 
> unless the package I'm working on depends on it).
You should just use the normal conditional depends syntax for the
DEPENDS line in the package, instead of duplicating it in Config.in and
EXTRA_DEPENDS.

DEPENDS:=+PACKAGE_conditional_package:selected_package

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


Re: [OpenWrt-Devel] [PATCH 2/3] ar71xx: add support for QCA956x ethernet

2015-12-22 Thread Roman Yeryomin
On 22 December 2015 at 01:03,   wrote:
>
> Hi Roman,
>
> are you sure about the value of QCA956X_PLL_VAL_10,
> which is 0x1919 in your patch?
>
> At least for the UAPAC LITE I have the problem that packet transmission
> on 10MBit/s links does not work with 0x1919.
> Instead, with QCA956X_PLL_VAL_10 = 0x1313 everything is fine.
>
> Is this specific to the UAPAC LITE or the QCA9563?

Honestly I don't remember where it comes from, Possibly from codeaurora repo.
So no, I'm not sure. But still it can be overriden from board file.
Sorry didn't bother testing with 10Mbit links :)

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


[OpenWrt-Devel] default console patch / avoiding differential busybox builds

2015-12-22 Thread Daniel Dickinson

Hi all,

I just thought I'd let you know I got thinking about the patch making 
the config option to make console login the default on certain platform 
and the undesirable fact that it alters the busybox config, and have 
plans for a solution.


I also intend to use this same concept for two other scenarios:

1) Supporting old-style net-tools (ifconfig/route/netstat) without 
requiring it them to be part of the default openwrt build (once I submit 
my patch for udhcpc netifd script that uses route and ifconfig to use ip 
command instead).


2) Support a version busybox to provide programs not provided elsewhere 
when using full versions of commands normally in busybox, without 
requiring custom compiled version of openwrt/sdk.


My plan is to add (in packages feed, not base), builds of busybox that 
include only appropriate subset of commands, call busybox e.g. 
net-tools, and creates (i.e. package creates rather than relying on 
busybox's install logic) the symlinks the the alternately named busybox.


2) is mostly an exercise to prepare for the real goal which is 
supporting toybox instead of busybox once toybox has completed 
sufficient set of tasks in it's 1.0 roadmap to be useful for OpenWrt, 
and then it's not about 2) itself but the metapackage I am creating that 
make for a drop-in replacement of busybox (in terms of allowing 
busybox-compat-full to take the place of busybox via use of PROVIDES to 
avoid real busybox being installed when busybox-compat-full is specified).


Regards,

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


Re: [OpenWrt-Devel] [PATCH v2] lantiq, xrx200-net: add devicetree aliases support for port->mac mapping

2015-12-22 Thread Martin Schiller
On 12/17/2015 at 12:13 PM, John Crispin wrote:
>
>
> On 17/12/2015 12:03, Martin Schiller wrote:
> > On 12/17/2015 at 9:20 AM, John Crispin wrote:
> >>
> >>
> >> On 14/12/2015 10:18, Martin Schiller wrote:
> >>> This patch adds devicetree aliases support, which makes it possible
> >> to
> >>> renumber the physical mac ports.
> >>>
> >>> This change has only cosmetical reasons (e.g. appearance in
> swconfig,
> >>> kernel messages on link change).
> >>>
> >>> Signed-off-by: Martin Schiller 
> >>
> >> i have a problem with this patch. port 5 is port 5 *always*. i dont
> see
> >> how this fixes an issue. did you HW guys build broken HW with badly
> >> ordered mac ports ?
> >
> > Yes, you are right. This patch is intended to reorder broken/unlovely
> > placed mac ports.
> >
> > The user should see ports in the order 1,2,3,4,5 instead of
> 1,4,5,2,3.
> >
>
> ah of coruse the ports are ordered in a wonky way on the SoC
>
> > Our HW guys told us it would be much more work to solve this in
> hardware
> > by doing a lot of "wire crossings" (with unwanted hf side-effects) in
> the
> > pcb layout.
> >
>
> correct
>
> > And there are also situations, where you even can't do it in
> hardware:
> > when you use the xrx200 in Gigabit mode, you can use mac 0,1,2,4,5.
> > mac/port 3 is dead in this case.
> >
> > But you can't tell an enduser/customer that there is a port 2 and a
> port 4
> > but no port 3.
>
> sure but solving this in the driver by using a virtual port abstraction
> is imho not good.
>
> i'll see if i can think of a better solution for this issue

As this is a board specific issue, I thought solving this in the
devicetree would be a nice way.

But any better solution would be welcome.

>
>
>
>
>
> >
> >>
> >>
> >>
> >>> ---
> >>> Changes in v2:
> >>> - use devicetree aliases instead of 'id' property
> >>> - only map ports, which are "configured" in the devicetree
> >>>
> >>>  .../0025-NET-MIPS-lantiq-adds-xrx200-net.patch | 46
> >> --
> >>>  1 file changed, 33 insertions(+), 13 deletions(-)
> >>>
> >>> diff --git a/target/linux/lantiq/patches-4.1/0025-NET-MIPS-lantiq-
> >> adds-xrx200-net.patch b/target/linux/lantiq/patches-4.1/0025-NET-
> MIPS-
> >> lantiq-adds-xrx200-net.patch
> >>> index 48c7395..c76c165 100644
> >>> --- a/target/linux/lantiq/patches-4.1/0025-NET-MIPS-lantiq-adds-
> >> xrx200-net.patch
> >>> +++ b/target/linux/lantiq/patches-4.1/0025-NET-MIPS-lantiq-adds-
> >> xrx200-net.patch
> >>> @@ -209,7 +209,7 @@ Subject: [PATCH 25/36] NET: MIPS: lantiq: adds
> >> xrx200-net
> >>>  +};
> >>>  --- /dev/null
> >>>  +++ b/drivers/net/ethernet/lantiq_xrx200.c
> >>> -@@ -0,0 +1,1798 @@
> >>> +@@ -0,0 +1,1818 @@
> >>>  +/*
> >>>  + *   This program is free software; you can redistribute it
> and/or
> >> modify it
> >>>  + *   under the terms of the GNU General Public License version 2
> as
> >> published
> >>> @@ -404,6 +404,7 @@ Subject: [PATCH 25/36] NET: MIPS: lantiq: adds
> >> xrx200-net
> >>>  +
> >>>  +struct xrx200_port {
> >>>  +u8 num;
> >>> ++u8 id;
> >>>  +u8 phy_addr;
> >>>  +u16 flags;
> >>>  +phy_interface_t phy_if;
> >>> @@ -461,6 +462,9 @@ Subject: [PATCH 25/36] NET: MIPS: lantiq: adds
> >> xrx200-net
> >>>  +struct xrx200_hw *hw;
> >>>  +};
> >>>  +
> >>> ++static int id_to_mac[XRX200_MAX_PORT] = {-1,-1,-1,-1,-1,-1,6};
> >>> ++static int mac_to_id[XRX200_MAX_PORT] = {-1,-1,-1,-1,-1,-1,6};
> >>> ++
> >>>  +static __iomem void *xrx200_switch_membase;
> >>>  +static __iomem void *xrx200_mii_membase;
> >>>  +static __iomem void *xrx200_mdio_membase;
> >>> @@ -789,9 +793,13 @@ Subject: [PATCH 25/36] NET: MIPS: lantiq: adds
> >> xrx200-net
> >>>  +{
> >>>  +struct switch_port *p = &val->value.ports[i];
> >>>  +
> >>> -+portmap |= (1 << p->id);
> >>> ++if (id_to_mac[p->id] < 0) {
> >>> ++continue;
> >>> ++}
> >>> ++
> >>> ++portmap |= (1 << id_to_mac[p->id]);
> >>>  +if (p->flags & (1 << SWITCH_PORT_FLAG_TAGGED))
> >>> -+tagmap |= (1 << p->id);
> >>> ++tagmap |= (1 << id_to_mac[p->id]);
> >>>  +}
> >>>  +
> >>>  +tem.table = XRX200_PCE_VLANMAP_IDX;
> >>> @@ -855,7 +863,7 @@ Subject: [PATCH 25/36] NET: MIPS: lantiq: adds
> >> xrx200-net
> >>>  +continue;
> >>>  +
> >>>  +p = &val->value.ports[val->len++];
> >>> -+p->id = i;
> >>> ++p->id = mac_to_id[i];
> >>>  +if (tags & (1 << i))
> >>>  +p->flags = (1 << SWITCH_PORT_FLAG_TAGGED);
> >>>  +else
> >>> @@ -898,11 +906,12 @@ Subject: [PATCH 25/36] NET: MIPS: lantiq:
> adds
> >> xrx200-net
> >>>  +}
> >>>  +
> >>>  +// port
> >>> -+static int xrx200sw_get_port_pvid(struct switch_dev *dev, int
> port,
> >> int *val)
> >>> ++static int xrx200sw_get_port_pvid(struct switch_dev *dev, int
> >> port_id, int *val)
> >>>  +{
> >>> ++int port = id_to_mac[port_id];
> >>>  +struct xrx200_pce_table_entry tev;
> >>>  +
> >>> -+if (port >= XRX200_MAX_PORT)
> >>> ++if (port < 0 || port >= XRX200_MAX_PORT)
> >>>  +return -EINVAL;
> >>>  +
> >>>  +tev.table = XRX200_PCE_ACTVLAN_IDX;
> >>> @@ -914,10 +923,12 @@ Subject: [PATCH 25/36] NET: MIPS: