Re: [OpenWrt-Devel] script hook for odhcpd

2019-11-09 Thread Alberto Bursi



On 10/11/19 03:41, Hans Dedecker wrote:

On Sat, Nov 9, 2019 at 2:43 AM Alberto Bursi  wrote:

I'm adding hotplug.d support to all DHCP events.
For now only dnsmasq triggers them, with
openwrt/package/network/services/dnsmasq/files/dhcp-script.sh

DHCP clients like udcpc and udcp6c are easy to add as the client calls
a script hook with documented arguments and environment
variables I can pass to scripts in hotplug.d/dhcp.

I'm not finding anything useful for odhcpd.

It does have a similar script,
openwrt/package/network/services/odhcpd/files/odhcpd-update
that is called "lease trigger", and currently just calls dnsmasq to
reload hosts file.

It does not seem to be called with any argument or environmental variable I
can use for hotplug scripts.

That's correct; odhcpd has no hotplug script support at the moment
triggered by DHCP(v6) lease changes.

I can also use its ubus API to get a list of ipv4 leases or ipv6 leases.

Did I miss something? Any ideas to implement DHCP hotplug in ipv6 server?

What is your exact use case ?

Hans



I don't have an usecase for DHCP server lease events, so it's fine for me.

I started looking into this to have a working hotplug for DHCP client 
events on IPv4


(for a custom dynamic-DNS-like setup without having to poll WAN IP on a 
loop).


I've though that if someone has added hotplug to DHCP server in ipv4 
then it might make sense for IPv6 too


-Alberto


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


Re: [OpenWrt-Devel] [PATCH] ipq40xx: fritz4040 depends on uboot-fritz4040

2019-11-09 Thread Christian Lamparter
On Saturday, 9 November 2019 23:52:17 CET Sven Roederer wrote:
> The "append-uboot" macro is looking for the file 
> "$(STAGING_DIR_IMAGE)/uboot-fritz4040.bin"
> which is provided by the u-boot-fritz4040 package. If this is not build, 
> image creation
> will fail with "file not found".

The FRITZ!Box 4040 is a special case as the "eva.bin" image file needs the
u-boot binary to work as intended.

In OpenWrt's u-boot.mk, the u-boots for a target are usually get built/enabled
because 
adds something like this to the u-boot packages:
|Default: y if (TARGET_ipq40xx_generic_Default || 
TARGET_ipq40xx_generic_DEVICE_avm_fritzbox-4040 || 
TARGET_DEVICE_ipq40xx_generic_DEVICE_avm_fritzbox-4040)

This causes the needed u-boot package to be included automatically.
Unless the package is either deselected actively, or accidentally.
(This can happen when a existing .config in which the device was
previously disabled, is grandfathered in. Because the existing
"not set" will take preference [the diffconfig.pl will catch this]).

Technically, the eva.bin isn't necessary. It allows for an easier
installation, but nobody apart from the 4040 uses the append-uboot
and there have been issues in the past with this as well.

Question is: should we add that dependency, ditch the eva.bin image
(or make it so that it's optional - this requires some changes to
the builtsystem) or decide that "this is a bug elsewhere"?

Cheers,
Christian
> ---
>  target/linux/ipq40xx/image/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/linux/ipq40xx/image/Makefile 
> b/target/linux/ipq40xx/image/Makefile
> index a9c5e625af..7ae6f36baa 100644
> --- a/target/linux/ipq40xx/image/Makefile
> +++ b/target/linux/ipq40xx/image/Makefile
> @@ -130,7 +130,7 @@ define Device/avm_fritzbox-4040
>   IMAGES = eva.bin sysupgrade.bin
>   IMAGE/eva.bin := append-uboot | pad-to (UBOOT_PARTITION_SIZE) | 
> append-kernel | append-rootfs | pad-rootfs
>   IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | 
> append-metadata
> - DEVICE_PACKAGES := fritz-tffs fritz-caldata
> + DEVICE_PACKAGES := fritz-tffs fritz-caldata u-boot-fritz4040



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


Re: [OpenWrt-Devel] [PATCH] ipq40xx: fritz4040 depends on uboot-fritz4040

2019-11-09 Thread David Bauer
Hello Sven,

On 11/9/19 11:52 PM, Sven Roederer wrote:
> The "append-uboot" macro is looking for the file 
> "$(STAGING_DIR_IMAGE)/uboot-fritz4040.bin"
> which is provided by the u-boot-fritz4040 package. If this is not build, 
> image creation
> will fail with "file not found".

The dependency comes from the U-Boot package [0], so it should be pulled in 
automatically.
Maybe you are missing this commit [1]?

[0] 
https://github.com/openwrt/openwrt/blob/master/package/boot/uboot-fritz4040/Makefile#L31
[1] 
https://github.com/openwrt/openwrt/commit/40e3f660c1c0f400092cce09feb8c13bec97caeb

Best wishes
David

> 
> Signed-off-by: Sven Roederer 
> ---
>  target/linux/ipq40xx/image/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/linux/ipq40xx/image/Makefile 
> b/target/linux/ipq40xx/image/Makefile
> index a9c5e625af..7ae6f36baa 100644
> --- a/target/linux/ipq40xx/image/Makefile
> +++ b/target/linux/ipq40xx/image/Makefile
> @@ -130,7 +130,7 @@ define Device/avm_fritzbox-4040
>   IMAGES = eva.bin sysupgrade.bin
>   IMAGE/eva.bin := append-uboot | pad-to (UBOOT_PARTITION_SIZE) | 
> append-kernel | append-rootfs | pad-rootfs
>   IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | 
> append-metadata
> - DEVICE_PACKAGES := fritz-tffs fritz-caldata
> + DEVICE_PACKAGES := fritz-tffs fritz-caldata u-boot-fritz4040
>  endef
>  TARGET_DEVICES += avm_fritzbox-4040
>  
> 

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


[OpenWrt-Devel] [PATCH] ipq40xx: fritz4040 depends on uboot-fritz4040

2019-11-09 Thread Sven Roederer
The "append-uboot" macro is looking for the file 
"$(STAGING_DIR_IMAGE)/uboot-fritz4040.bin"
which is provided by the u-boot-fritz4040 package. If this is not build, image 
creation
will fail with "file not found".

Signed-off-by: Sven Roederer 
---
 target/linux/ipq40xx/image/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/ipq40xx/image/Makefile 
b/target/linux/ipq40xx/image/Makefile
index a9c5e625af..7ae6f36baa 100644
--- a/target/linux/ipq40xx/image/Makefile
+++ b/target/linux/ipq40xx/image/Makefile
@@ -130,7 +130,7 @@ define Device/avm_fritzbox-4040
IMAGES = eva.bin sysupgrade.bin
IMAGE/eva.bin := append-uboot | pad-to (UBOOT_PARTITION_SIZE) | 
append-kernel | append-rootfs | pad-rootfs
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | 
append-metadata
-   DEVICE_PACKAGES := fritz-tffs fritz-caldata
+   DEVICE_PACKAGES := fritz-tffs fritz-caldata u-boot-fritz4040
 endef
 TARGET_DEVICES += avm_fritzbox-4040
 
-- 
2.20.1


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


[OpenWrt-Devel] 4K sectors on ath79-tiny

2019-11-09 Thread Paul Fertser
Hello,

What is the reason for not enabling 4K erase sectors for the 4M
devices in ath79 target?

jffs2 needs minimum 5 erase blocks so for those space-constrained
devices this option seems to be really useful (to be able to keep
configs when the space gets tight). 

However please note that if this option is enabled then sysupgrade
will fail to properly keep configs on upgrade, that might be a nasty
surprise for those already using the supported boards. So what would
be the way towards enabling this feature now? 

-- 
Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
mailto:fercer...@gmail.com

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


Re: [OpenWrt-Devel] script hook for odhcpd

2019-11-09 Thread Hans Dedecker
On Sat, Nov 9, 2019 at 2:43 AM Alberto Bursi  wrote:
>
> I'm adding hotplug.d support to all DHCP events.
> For now only dnsmasq triggers them, with
> openwrt/package/network/services/dnsmasq/files/dhcp-script.sh
>
> DHCP clients like udcpc and udcp6c are easy to add as the client calls
> a script hook with documented arguments and environment
> variables I can pass to scripts in hotplug.d/dhcp.
>
> I'm not finding anything useful for odhcpd.
>
> It does have a similar script,
> openwrt/package/network/services/odhcpd/files/odhcpd-update
> that is called "lease trigger", and currently just calls dnsmasq to
> reload hosts file.
>
> It does not seem to be called with any argument or environmental variable I
> can use for hotplug scripts.
That's correct; odhcpd has no hotplug script support at the moment
triggered by DHCP(v6) lease changes.
>
> I can also use its ubus API to get a list of ipv4 leases or ipv6 leases.
>
> Did I miss something? Any ideas to implement DHCP hotplug in ipv6 server?
What is your exact use case ?

Hans
>
>
> -Alberto
>

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


Re: [OpenWrt-Devel] [PATCH v2 5/5] base-files: add 'wifi reconf'

2019-11-09 Thread Daniel Golle


On Sat, Nov 09, 2019 at 06:35:45PM +0100, Daniel Golle wrote:
> From: John Crispin 
> 
> Now that netifd and hostapd allow dynamic reconfiguration, add a
> command to trigger it.
> 
> Signed-off-by: Daniel Golle 
> ---
> v2: unchanged

I forgot to add the Makefiles of base-files, mac80211 and hostapd
which contained PKG_RELEASE bumps... I pushed that to my staging tree
now instead of re-posting the whole series once again here...

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


Re: [OpenWrt-Devel] [PATCH v2 3/5] hostapd: add ubus reload

2019-11-09 Thread Daniel Golle
On Sat, Nov 09, 2019 at 06:41:52PM +0100, Ansuel Smith wrote:
> also by using a single instance we would finally use band steering to
> make client autoswitch from 2.4 to 5 ghz

Obviously this won't just magically happen, but by having a single
instance (of hostapd) managing all wiphy's in the system this becomes
something hostapd could manage internally.
Current solutions rely on adding band-steering functionality externally
by using hostapd's ubus hooks instead, hence this is not necessarily
related.

> 
> Il giorno sab 9 nov 2019 alle ore 18:34 Daniel Golle
>  ha scritto:
> >
> > From: John Crispin 
> >
> > Add ubus interface to hostapd and wpa_supplicant to allow dynamically
> > reloading wiface configuration without having to restart the hostapd
> > process.
> > As a consequence, both hostapd and wpa_supplicant are now started
> > persistently on boot for each wifi device in the system and then
> > receive ubus calls adding, modifying or removing interface
> > configuration.
> > At a later stage it would be desirable to reduce the services to one
> > single instance managing all radios.
> >
> > Signed-off-by: John Crispin 
> > Signed-off-by: Daniel Golle 
> > ---
> > v2: unchanged
> >
> >  package/network/services/hostapd/Makefile |   3 +-
> >  .../services/hostapd/files/hostapd.hotplug|  14 ++
> >  .../network/services/hostapd/files/hostapd.sh |  25 +--
> >  .../hostapd/patches/600-ubus_support.patch| 127 -
> >  .../hostapd/patches/700-wifi-reload.patch | 118 
> >  .../services/hostapd/src/src/ap/ubus.c| 131 -
> >  .../services/hostapd/src/src/ap/ubus.h|  12 ++
> >  .../hostapd/src/wpa_supplicant/ubus.c | 176 +-
> >  .../hostapd/src/wpa_supplicant/ubus.h |  13 ++
> >  9 files changed, 600 insertions(+), 19 deletions(-)
> >  create mode 100644 package/network/services/hostapd/files/hostapd.hotplug
> >  create mode 100644 
> > package/network/services/hostapd/patches/700-wifi-reload.patch
> >
> > diff --git a/package/network/services/hostapd/Makefile 
> > b/package/network/services/hostapd/Makefile
> > index 4f6420f503..52adb1115e 100644
> > --- a/package/network/services/hostapd/Makefile
> > +++ b/package/network/services/hostapd/Makefile
> > @@ -519,8 +519,9 @@ define Install/supplicant
> >  endef
> >
> >  define Package/hostapd-common/install
> > -   $(INSTALL_DIR) $(1)/lib/netifd $(1)/etc/rc.button
> > +   $(INSTALL_DIR) $(1)/lib/netifd $(1)/etc/rc.button 
> > $(1)/etc/hotplug.d/ieee80211
> > $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/netifd/hostapd.sh
> > +   $(INSTALL_BIN) ./files/hostapd.hotplug 
> > $(1)/etc/hotplug.d/ieee80211/20-hostapd
> > $(INSTALL_BIN) ./files/wps-hotplug.sh $(1)/etc/rc.button/wps
> >  endef
> >
> > diff --git a/package/network/services/hostapd/files/hostapd.hotplug 
> > b/package/network/services/hostapd/files/hostapd.hotplug
> > new file mode 100644
> > index 00..d568b3c85a
> > --- /dev/null
> > +++ b/package/network/services/hostapd/files/hostapd.hotplug
> > @@ -0,0 +1,14 @@
> > +#!/bin/sh
> > +
> > +[ ${ACTION} = "remove" -a -n "${DEVICENAME}" ] && {
> > +   kill $(cat /var/run/hostapd-${DEVICENAME}.pid)
> > +   rm -rf /var/run/hostapd-${DEVICENAME}.pid 
> > /var/run/hostapd-${DEVICENAME}/
> > +   kill $(cat /var/run/wpa_supplicant-${DEVICENAME}.pid)
> > +   rm -rf /var/run/wpa_supplicant-${DEVICENAME}.pid 
> > /var/run/wpa_supplicant-${DEVICENAME}/
> > +}
> > +
> > +[ ${ACTION} = "add" -a -n "${DEVICENAME}" ] && {
> > +   /usr/sbin/hostapd -s -n ${DEVICENAME} -P 
> > /var/run/hostapd-${DEVICENAME}.pid -g /var/run/hostapd-${DEVICENAME}/global 
> > -B &
> > +   mkdir -p /var/run/wpa_supplicant-${DEVICENAME}
> > +   /usr/sbin/wpa_supplicant -s -n ${DEVICENAME} -P 
> > /var/run/wpa_supplicant-${DEVICENAME}.pid -g 
> > /var/run/wpa_supplicant-${DEVICENAME}/global -B &
> > +}
> > diff --git a/package/network/services/hostapd/files/hostapd.sh 
> > b/package/network/services/hostapd/files/hostapd.sh
> > index 3c1504ca60..f03b98ff85 100644
> > --- a/package/network/services/hostapd/files/hostapd.sh
> > +++ b/package/network/services/hostapd/files/hostapd.sh
> > @@ -254,7 +254,7 @@ hostapd_set_bss_options() {
> >
> > wireless_vif_parse_encryption
> >
> > -   local bss_conf
> > +   local bss_conf bss_md5sum
> > local wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey 
> > wpa_key_mgmt
> >
> > json_get_vars \
> > @@ -627,6 +627,9 @@ hostapd_set_bss_options() {
> > }
> > }
> >
> > +   bss_md5sum=$(echo $bss_conf | md5sum | cut -d" " -f1)
> > +   append bss_conf "config_id=$bss_md5sum" "$N"
> > +
> > append "$var" "$bss_conf" "$N"
> > return 0
> >  }
> > @@ -950,21 +953,19 @@ EOF
> >  }
> >
> >  wpa_supplicant_run() {
> > -   local ifname="$1"; shift
> > +   local ifname="$1"
> > +   local hostapd_ctrl="$2"
> >
> >

Re: [OpenWrt-Devel] [PATCH maintainer-tools] patchwork-apply.sh: help spotting DMARC mangled patches

2019-11-09 Thread Jonas Gorski
On Sat, 9 Nov 2019 at 13:55, Petr Štetiar  wrote:
>
> Avoid DMARC plague in the commit messages:
>
>  87f9292300cf hostapd: add IEEE 802.11k support
>  450d44a8ead2 openssl: change defaults: ENGINE:on, NPN:off, misc
>  eabc1ddc4541 build: Honour NO_COLOR in include/scan.mk
>  3fb45576ac16 cryptodev-linux: move from packages feed
>  a73283dc10f7 kernel: nf-nathelper-extra depends on ipt-raw
>  0317fc3658eb libpcap: patch to add limits.h to pcap-usb-linux.c
>  26dbf79f4905 libevent2: Don't build tests and samples
>  d59126040701 brcm63xx: initial support for Sky SR102 router
>  094d49cddf93 kernel: bump 4.14 to 4.14.51
>  247055cbfbf1 igmpproxy: bump to 0.2.1
>  c451434b963d cake: bump to 20180504 bake
>  080fb7a3fbb6 iproute2: import latest cake
>  ad5af37ca793 iproute2: backport json_print-fix-hidden-64-bit-type-promotion
>  78f4305933b9 iftop: bump to latest
>  7783f31359cb base-files: nand: use CI_KERNPART whenever the kernel volume is 
> needed
>
> Signed-off-by: Petr Štetiar 
> ---
>  patchwork-apply.sh | 6 ++
>  1 file changed, 6 insertions(+)
>
> diff --git a/patchwork-apply.sh b/patchwork-apply.sh
> index 5506adbfe451..506a09fd4fd5 100755
> --- a/patchwork-apply.sh
> +++ b/patchwork-apply.sh
> @@ -140,6 +140,12 @@ echo "$1" | grep -sqE '^[0-9]+$' || {
> }
>  }
>
> +grep --color --context=3 "DMARC Reject/Quarantine" "$1.patch" && {
> +   if yesno "Beware DMARC text detected! Set to 'Changes Requested'?" 
> "y"; then
> +   pwclient update -s "Changes Requested" "$1"

This DMARC thing is nothing the submitter can fix unless they run
their own mail server. At best a sed script fixing up the patch would
work here, if this can be sufficiently expressed.

A better place would be a git hook on our server rejecting any commits
with it (like we already have for missing SOB).


Regards
Jonas

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


Re: [OpenWrt-Devel] [PATCH v2 3/5] hostapd: add ubus reload

2019-11-09 Thread Ansuel Smith
also by using a single instance we would finally use band steering to
make client autoswitch from 2.4 to 5 ghz

Il giorno sab 9 nov 2019 alle ore 18:34 Daniel Golle
 ha scritto:
>
> From: John Crispin 
>
> Add ubus interface to hostapd and wpa_supplicant to allow dynamically
> reloading wiface configuration without having to restart the hostapd
> process.
> As a consequence, both hostapd and wpa_supplicant are now started
> persistently on boot for each wifi device in the system and then
> receive ubus calls adding, modifying or removing interface
> configuration.
> At a later stage it would be desirable to reduce the services to one
> single instance managing all radios.
>
> Signed-off-by: John Crispin 
> Signed-off-by: Daniel Golle 
> ---
> v2: unchanged
>
>  package/network/services/hostapd/Makefile |   3 +-
>  .../services/hostapd/files/hostapd.hotplug|  14 ++
>  .../network/services/hostapd/files/hostapd.sh |  25 +--
>  .../hostapd/patches/600-ubus_support.patch| 127 -
>  .../hostapd/patches/700-wifi-reload.patch | 118 
>  .../services/hostapd/src/src/ap/ubus.c| 131 -
>  .../services/hostapd/src/src/ap/ubus.h|  12 ++
>  .../hostapd/src/wpa_supplicant/ubus.c | 176 +-
>  .../hostapd/src/wpa_supplicant/ubus.h |  13 ++
>  9 files changed, 600 insertions(+), 19 deletions(-)
>  create mode 100644 package/network/services/hostapd/files/hostapd.hotplug
>  create mode 100644 
> package/network/services/hostapd/patches/700-wifi-reload.patch
>
> diff --git a/package/network/services/hostapd/Makefile 
> b/package/network/services/hostapd/Makefile
> index 4f6420f503..52adb1115e 100644
> --- a/package/network/services/hostapd/Makefile
> +++ b/package/network/services/hostapd/Makefile
> @@ -519,8 +519,9 @@ define Install/supplicant
>  endef
>
>  define Package/hostapd-common/install
> -   $(INSTALL_DIR) $(1)/lib/netifd $(1)/etc/rc.button
> +   $(INSTALL_DIR) $(1)/lib/netifd $(1)/etc/rc.button 
> $(1)/etc/hotplug.d/ieee80211
> $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/netifd/hostapd.sh
> +   $(INSTALL_BIN) ./files/hostapd.hotplug 
> $(1)/etc/hotplug.d/ieee80211/20-hostapd
> $(INSTALL_BIN) ./files/wps-hotplug.sh $(1)/etc/rc.button/wps
>  endef
>
> diff --git a/package/network/services/hostapd/files/hostapd.hotplug 
> b/package/network/services/hostapd/files/hostapd.hotplug
> new file mode 100644
> index 00..d568b3c85a
> --- /dev/null
> +++ b/package/network/services/hostapd/files/hostapd.hotplug
> @@ -0,0 +1,14 @@
> +#!/bin/sh
> +
> +[ ${ACTION} = "remove" -a -n "${DEVICENAME}" ] && {
> +   kill $(cat /var/run/hostapd-${DEVICENAME}.pid)
> +   rm -rf /var/run/hostapd-${DEVICENAME}.pid 
> /var/run/hostapd-${DEVICENAME}/
> +   kill $(cat /var/run/wpa_supplicant-${DEVICENAME}.pid)
> +   rm -rf /var/run/wpa_supplicant-${DEVICENAME}.pid 
> /var/run/wpa_supplicant-${DEVICENAME}/
> +}
> +
> +[ ${ACTION} = "add" -a -n "${DEVICENAME}" ] && {
> +   /usr/sbin/hostapd -s -n ${DEVICENAME} -P 
> /var/run/hostapd-${DEVICENAME}.pid -g /var/run/hostapd-${DEVICENAME}/global 
> -B &
> +   mkdir -p /var/run/wpa_supplicant-${DEVICENAME}
> +   /usr/sbin/wpa_supplicant -s -n ${DEVICENAME} -P 
> /var/run/wpa_supplicant-${DEVICENAME}.pid -g 
> /var/run/wpa_supplicant-${DEVICENAME}/global -B &
> +}
> diff --git a/package/network/services/hostapd/files/hostapd.sh 
> b/package/network/services/hostapd/files/hostapd.sh
> index 3c1504ca60..f03b98ff85 100644
> --- a/package/network/services/hostapd/files/hostapd.sh
> +++ b/package/network/services/hostapd/files/hostapd.sh
> @@ -254,7 +254,7 @@ hostapd_set_bss_options() {
>
> wireless_vif_parse_encryption
>
> -   local bss_conf
> +   local bss_conf bss_md5sum
> local wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey 
> wpa_key_mgmt
>
> json_get_vars \
> @@ -627,6 +627,9 @@ hostapd_set_bss_options() {
> }
> }
>
> +   bss_md5sum=$(echo $bss_conf | md5sum | cut -d" " -f1)
> +   append bss_conf "config_id=$bss_md5sum" "$N"
> +
> append "$var" "$bss_conf" "$N"
> return 0
>  }
> @@ -950,21 +953,19 @@ EOF
>  }
>
>  wpa_supplicant_run() {
> -   local ifname="$1"; shift
> +   local ifname="$1"
> +   local hostapd_ctrl="$2"
>
> _wpa_supplicant_common "$ifname"
>
> -   /usr/sbin/wpa_supplicant -B -s \
> -   ${network_bridge:+-b $network_bridge} \
> -   -P "/var/run/wpa_supplicant-${ifname}.pid" \
> -   -D ${_w_driver:-wext} \
> -   -i "$ifname" \
> -   -c "$_config" \
> -   -C "$_rpath" \
> -   "$@"
> +   ubus call wpa_supplicant.$phy config_add "{ \
> +   \"driver\": \"${_w_driver:-wext}\", \"ctrl\": \"$_rpath\", \
> +   \"iface\": \"$ifname\", \"config\": \"$_config\" \
> +   ${network_bridge:+, \"bridge\": \"$netw

[OpenWrt-Devel] [PATCH v2 4/5] mac80211: add support for dynamically reconfiguring wifi

2019-11-09 Thread Daniel Golle
From: John Crispin 

Change scripts to use ubus interface of hostapd/wpa_supplicant to
add/remove/modify wireless interfaces instead of (re-)starting the
services.

Signed-off-by: Daniel Golle 
---
v2: honour vif_enable for supplicant and bare ifaces

 .../files/lib/netifd/wireless/mac80211.sh | 170 ++
 1 file changed, 134 insertions(+), 36 deletions(-)

diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh 
b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
index 12af2d1d0e..5b174cded6 100644
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -19,6 +19,11 @@ iw() {
command iw $@ || logger -t mac80211 "Failed command: iw $@"
 }
 
+NEWAPLIST=
+OLDAPLIST=
+NEWSPLIST=
+OLDSPLIST=
+
 drv_mac80211_init_device_config() {
hostapd_common_add_device_config
 
@@ -58,7 +63,7 @@ drv_mac80211_init_iface_config() {
 
config_add_string 'macaddr:macaddr' ifname
 
-   config_add_boolean wds powersave
+   config_add_boolean wds powersave enable
config_add_int maxassoc
config_add_int max_listen_int
config_add_int dtim_period
@@ -454,7 +459,7 @@ mac80211_iw_interface_add() {
 mac80211_prepare_vif() {
json_select config
 
-   json_get_vars ifname mode ssid wds powersave macaddr
+   json_get_vars ifname mode ssid wds powersave macaddr enable
 
[ -n "$ifname" ] || ifname="wlan${phy#phy}${if_idx:+-$if_idx}"
if_idx=$((${if_idx:-0} + 1))
@@ -490,8 +495,8 @@ mac80211_prepare_vif() {
 
mac80211_hostapd_setup_bss "$phy" "$ifname" "$macaddr" 
"$type" || return
 
+   NEWAPLIST="${NEWAPLIST}$ifname "
[ -n "$hostapd_ctrl" ] || {
-   mac80211_iw_interface_add "$phy" "$ifname" __ap 
|| return

hostapd_ctrl="${hostapd_ctrl:-/var/run/hostapd/$ifname}"
}
;;
@@ -503,7 +508,7 @@ mac80211_prepare_vif() {
;;
sta)
local wdsflag=
-   staidx="$(($staidx + 1))"
+   [ "$enable" = 0 ] || staidx="$(($staidx + 1))"
[ "$wds" -gt 0 ] && wdsflag="4addr on"
mac80211_iw_interface_add "$phy" "$ifname" managed 
"$wdsflag" || return
[ "$powersave" -gt 0 ] && powersave="on" || 
powersave="off"
@@ -529,19 +534,62 @@ mac80211_prepare_vif() {
 }
 
 mac80211_setup_supplicant() {
+   local enable=$1
+   local add_sp=0
+   local spobj="$(ubus -S list | grep wpa_supplicant.${ifname})"
+
wpa_supplicant_prepare_interface "$ifname" nl80211 || return 1
+   wpa_supplicant_prepare_interface "$ifname" nl80211 || {
+   iw dev "$ifname" del
+   return 1
+   }
if [ "$mode" = "sta" ]; then
wpa_supplicant_add_network "$ifname"
else
wpa_supplicant_add_network "$ifname" "$freq" "$htmode" "$noscan"
fi
-   wpa_supplicant_run "$ifname" ${hostapd_ctrl:+-H $hostapd_ctrl}
+
+   NEWSPLIST="${NEWSPLIST}$ifname "
+
+   if [ "${NEWAPLIST%% *}" != "${OLDAPLIST%% *}" ]; then
+   [ "$spobj" ] && ubus call wpa_supplicant.${phy} config_del 
"{\"iface\":\"$ifname\"}"
+   add_sp=1
+   fi
+   [ "$enable" = 0 ] && {
+   ubus call wpa_supplicant.${phy} config_del 
"{\"iface\":\"$ifname\"}"
+   ip link set dev "$ifname" down
+   return 0
+   }
+   [ -z "$spobj" ] && add_sp=1
+
+   if [ "$add_sp" = "1" ]; then
+   wpa_supplicant_run "$ifname" "$hostapd_ctrl"
+   else
+   ubus call $spobj reload
+   fi
 }
 
 mac80211_setup_supplicant_noctl() {
-   wpa_supplicant_prepare_interface "$ifname" nl80211 || return 1
+   local enable=$1
+   local spobj="$(ubus -S list | grep wpa_supplicant.${ifname})"
+   wpa_supplicant_prepare_interface "$ifname" nl80211 || {
+   iw dev "$ifname" del
+   return 1
+   }
+
wpa_supplicant_add_network "$ifname" "$freq" "$htmode" "$noscan"
-   wpa_supplicant_run "$ifname"
+
+   NEWSPLIST="${NEWSPLIST}$ifname "
+   [ "$enable" = 0 ] && {
+   ubus call wpa_supplicant.${phy} config_del 
"{\"iface\":\"$ifname\"}"
+   ip link set dev "$ifname" down
+   return 0
+   }
+   if [ -z "$spobj" ]; then
+   wpa_supplicant_run "$ifname"
+   else
+   ubus call $spobj reload
+   fi
 }
 
 mac80211_setup_adhoc_htmode() {
@@ -579,12 +627,17 @@ mac80211_setup_adhoc_htmode() {
;;
*) ibss_htmode="" ;;
esac
-
 }
 
 mac80211_setup_adhoc() {
+   local enable=$1
json_get_vars bssid ssid key mcast_rate
 
+   [ "$enable" = 0 ] && {
+ 

[OpenWrt-Devel] [PATCH v2 5/5] base-files: add 'wifi reconf'

2019-11-09 Thread Daniel Golle
From: John Crispin 

Now that netifd and hostapd allow dynamic reconfiguration, add a
command to trigger it.

Signed-off-by: Daniel Golle 
---
v2: unchanged

 package/base-files/files/sbin/wifi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/package/base-files/files/sbin/wifi 
b/package/base-files/files/sbin/wifi
index f7a10de215..261d2fb500 100755
--- a/package/base-files/files/sbin/wifi
+++ b/package/base-files/files/sbin/wifi
@@ -130,6 +130,10 @@ wifi_updown() {
scan_wifi
cmd=up
}
+   [ reconf = "$1" ] && {
+   scan_wifi
+   cmd=reconf
+   }
ubus_wifi_cmd "$cmd" "$2"
_wifi_updown "$@"
 }
@@ -241,6 +245,7 @@ case "$1" in
reload) wifi_reload "$2";;
reload_legacy) wifi_reload_legacy "$2";;
--help|help) usage;;
+   reconf) ubus call network reload; wifi_updown "reconf" "$2";;
''|up) ubus call network reload; wifi_updown "enable" "$2";;
*) usage; exit 1;;
 esac
-- 
2.23.0


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


[OpenWrt-Devel] [PATCH v2 3/5] hostapd: add ubus reload

2019-11-09 Thread Daniel Golle
From: John Crispin 

Add ubus interface to hostapd and wpa_supplicant to allow dynamically
reloading wiface configuration without having to restart the hostapd
process.
As a consequence, both hostapd and wpa_supplicant are now started
persistently on boot for each wifi device in the system and then
receive ubus calls adding, modifying or removing interface
configuration.
At a later stage it would be desirable to reduce the services to one
single instance managing all radios.

Signed-off-by: John Crispin 
Signed-off-by: Daniel Golle 
---
v2: unchanged

 package/network/services/hostapd/Makefile |   3 +-
 .../services/hostapd/files/hostapd.hotplug|  14 ++
 .../network/services/hostapd/files/hostapd.sh |  25 +--
 .../hostapd/patches/600-ubus_support.patch| 127 -
 .../hostapd/patches/700-wifi-reload.patch | 118 
 .../services/hostapd/src/src/ap/ubus.c| 131 -
 .../services/hostapd/src/src/ap/ubus.h|  12 ++
 .../hostapd/src/wpa_supplicant/ubus.c | 176 +-
 .../hostapd/src/wpa_supplicant/ubus.h |  13 ++
 9 files changed, 600 insertions(+), 19 deletions(-)
 create mode 100644 package/network/services/hostapd/files/hostapd.hotplug
 create mode 100644 
package/network/services/hostapd/patches/700-wifi-reload.patch

diff --git a/package/network/services/hostapd/Makefile 
b/package/network/services/hostapd/Makefile
index 4f6420f503..52adb1115e 100644
--- a/package/network/services/hostapd/Makefile
+++ b/package/network/services/hostapd/Makefile
@@ -519,8 +519,9 @@ define Install/supplicant
 endef
 
 define Package/hostapd-common/install
-   $(INSTALL_DIR) $(1)/lib/netifd $(1)/etc/rc.button
+   $(INSTALL_DIR) $(1)/lib/netifd $(1)/etc/rc.button 
$(1)/etc/hotplug.d/ieee80211
$(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/netifd/hostapd.sh
+   $(INSTALL_BIN) ./files/hostapd.hotplug 
$(1)/etc/hotplug.d/ieee80211/20-hostapd
$(INSTALL_BIN) ./files/wps-hotplug.sh $(1)/etc/rc.button/wps
 endef
 
diff --git a/package/network/services/hostapd/files/hostapd.hotplug 
b/package/network/services/hostapd/files/hostapd.hotplug
new file mode 100644
index 00..d568b3c85a
--- /dev/null
+++ b/package/network/services/hostapd/files/hostapd.hotplug
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+[ ${ACTION} = "remove" -a -n "${DEVICENAME}" ] && {
+   kill $(cat /var/run/hostapd-${DEVICENAME}.pid)
+   rm -rf /var/run/hostapd-${DEVICENAME}.pid 
/var/run/hostapd-${DEVICENAME}/
+   kill $(cat /var/run/wpa_supplicant-${DEVICENAME}.pid)
+   rm -rf /var/run/wpa_supplicant-${DEVICENAME}.pid 
/var/run/wpa_supplicant-${DEVICENAME}/
+}
+
+[ ${ACTION} = "add" -a -n "${DEVICENAME}" ] && {
+   /usr/sbin/hostapd -s -n ${DEVICENAME} -P 
/var/run/hostapd-${DEVICENAME}.pid -g /var/run/hostapd-${DEVICENAME}/global -B &
+   mkdir -p /var/run/wpa_supplicant-${DEVICENAME}
+   /usr/sbin/wpa_supplicant -s -n ${DEVICENAME} -P 
/var/run/wpa_supplicant-${DEVICENAME}.pid -g 
/var/run/wpa_supplicant-${DEVICENAME}/global -B &
+}
diff --git a/package/network/services/hostapd/files/hostapd.sh 
b/package/network/services/hostapd/files/hostapd.sh
index 3c1504ca60..f03b98ff85 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -254,7 +254,7 @@ hostapd_set_bss_options() {
 
wireless_vif_parse_encryption
 
-   local bss_conf
+   local bss_conf bss_md5sum
local wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey 
wpa_key_mgmt
 
json_get_vars \
@@ -627,6 +627,9 @@ hostapd_set_bss_options() {
}
}
 
+   bss_md5sum=$(echo $bss_conf | md5sum | cut -d" " -f1)
+   append bss_conf "config_id=$bss_md5sum" "$N"
+
append "$var" "$bss_conf" "$N"
return 0
 }
@@ -950,21 +953,19 @@ EOF
 }
 
 wpa_supplicant_run() {
-   local ifname="$1"; shift
+   local ifname="$1"
+   local hostapd_ctrl="$2"
 
_wpa_supplicant_common "$ifname"
 
-   /usr/sbin/wpa_supplicant -B -s \
-   ${network_bridge:+-b $network_bridge} \
-   -P "/var/run/wpa_supplicant-${ifname}.pid" \
-   -D ${_w_driver:-wext} \
-   -i "$ifname" \
-   -c "$_config" \
-   -C "$_rpath" \
-   "$@"
+   ubus call wpa_supplicant.$phy config_add "{ \
+   \"driver\": \"${_w_driver:-wext}\", \"ctrl\": \"$_rpath\", \
+   \"iface\": \"$ifname\", \"config\": \"$_config\" \
+   ${network_bridge:+, \"bridge\": \"$network_bridge\"} \
+   ${hostapd_ctrl:+, \"hostapd_ctrl\": \"$hostapd_ctrl\"} \
+   }"
 
ret="$?"
-   wireless_add_process "$(cat "/var/run/wpa_supplicant-${ifname}.pid")" 
/usr/sbin/wpa_supplicant 1
 
[ "$ret" != 0 ] && wireless_setup_vif_failed WPA_SUPPLICANT_FAILED
 
@@ -972,5 +973,5 @@ wpa_supplicant_run() {
 }
 
 hostapd_common_cleanup() {
-   killall h

[OpenWrt-Devel] [PATCH v2 netifd 2/5] wireless: serialize wireless interface configuration\

2019-11-09 Thread Daniel Golle
From: John Crispin 

Signed-off-by: Daniel Golle 
---
v2: initilialize serialize as false

 wireless.c | 57 --
 wireless.h |  7 +++
 2 files changed, 62 insertions(+), 2 deletions(-)

diff --git a/wireless.c b/wireless.c
index 9986e9a..52b0fa6 100644
--- a/wireless.c
+++ b/wireless.c
@@ -23,6 +23,8 @@ struct vlist_tree wireless_devices;
 struct avl_tree wireless_drivers;
 static struct blob_buf b;
 static int drv_fd;
+static LIST_HEAD(handlers);
+static bool handler_pending;
 
 static const struct blobmsg_policy wdev_policy =
{ .name = "disabled", .type = BLOBMSG_TYPE_BOOL };
@@ -52,6 +54,15 @@ static const struct uci_blob_param_list vif_param = {
.params = vif_policy,
 };
 
+static void
+wireless_handler_stop(struct wireless_device *wdev)
+{
+   if (wdev->handler_pending) {
+   wdev->handler_pending = false;
+   list_del(&wdev->handler);
+   }
+}
+
 static void
 put_container(struct blob_buf *buf, struct blob_attr *attr, const char *name)
 {
@@ -188,6 +199,7 @@ wireless_device_free_state(struct wireless_device *wdev)
 {
struct wireless_interface *vif;
 
+   wireless_handler_stop(wdev);
uloop_timeout_cancel(&wdev->script_check);
uloop_timeout_cancel(&wdev->timeout);
wireless_complete_kill_request(wdev);
@@ -236,6 +248,7 @@ wireless_device_setup_cancel(struct wireless_device *wdev)
if (wdev->cancel)
return;
 
+   wireless_handler_stop(wdev);
D(WIRELESS, "Cancel wireless device '%s' setup\n", wdev->name);
wdev->cancel = true;
uloop_timeout_set(&wdev->timeout, 10 * 1000);
@@ -250,6 +263,17 @@ wireless_device_run_handler(struct wireless_device *wdev, 
bool up)
int i = 0;
int fds[2] = { -1, -1 };
 
+   wireless_handler_stop(wdev);
+
+   if (handler_pending && wdev->serialize) {
+   wdev->handler_action = up;
+   wdev->handler_pending = true;
+   list_add_tail(&wdev->handler, &handlers);
+   return;
+   }
+   if (wdev->serialize)
+   handler_pending = true;
+
D(WIRELESS, "Wireless device '%s' run %s handler\n", wdev->name, 
action);
if (!up && wdev->prev_config) {
config = blobmsg_format_json(wdev->prev_config, true);
@@ -281,6 +305,21 @@ wireless_device_run_handler(struct wireless_device *wdev, 
bool up)
free(config);
 }
 
+static void
+wireless_handler_next(void)
+{
+   struct wireless_device *wdev;
+
+   if (handler_pending)
+   return;
+   if (list_empty(&handlers))
+   return;
+   wdev = list_first_entry(&handlers, struct wireless_device, handler);
+   list_del(&wdev->handler);
+   wdev->handler_pending = false;
+   wireless_device_run_handler(wdev, wdev->handler_action);
+}
+
 static void
 __wireless_device_set_up(struct wireless_device *wdev, int force)
 {
@@ -305,6 +344,7 @@ __wireless_device_set_up(struct wireless_device *wdev, int 
force)
 static void
 wireless_device_free(struct wireless_device *wdev)
 {
+   wireless_handler_stop(wdev);
vlist_flush_all(&wdev->interfaces);
avl_delete(&wireless_devices.avl, &wdev->node.avl);
free(wdev->config);
@@ -353,6 +393,10 @@ wireless_device_setup_timeout(struct uloop_timeout 
*timeout)
 {
struct wireless_device *wdev = container_of(timeout, struct 
wireless_device, timeout);
 
+   if (wdev->handler_pending) {
+   wdev->handler_pending = false;
+   list_del(&wdev->handler);
+   }
netifd_kill_process(&wdev->script_task);
wdev->script_task.cb(&wdev->script_task, -1);
wireless_device_mark_down(wdev);
@@ -371,7 +415,7 @@ wireless_device_reconf(struct wireless_device *wdev)
 {
wdev->retry = WIRELESS_SETUP_RETRY;
wdev->autostart = true;
-   __wireless_device_set_up(wdev, 1);
+   __wireless_device_set_up(wdev, wdev->reconf && (wdev->state == IFS_UP));
 }
 
 static void
@@ -433,6 +477,11 @@ wireless_device_script_task_cb(struct netifd_process 
*proc, int ret)
default:
break;
}
+
+   if (wdev->serialize) {
+   handler_pending = false;
+   wireless_handler_next();
+   }
 }
 
 void
@@ -452,7 +501,7 @@ wdev_set_config_state(struct wireless_device *wdev, enum 
interface_config_state
wdev->config_state = s;
if (wdev->state == IFS_DOWN)
wdev_handle_config_change(wdev);
-   else
+   else if (!wdev->reconf || wdev->state != IFS_UP)
__wireless_device_set_down(wdev);
 }
 
@@ -501,6 +550,7 @@ wdev_update(struct vlist_tree *tree, struct vlist_node 
*node_new,
struct wireless_device *wd_new = container_of(node_new, struct 
wireless_device, node);
 
if (wd_old && wd_new) {
+   D(WIRELESS, "Update wireless device '%s'\n", wd_old->name);
wdev_ch

[OpenWrt-Devel] [PATCH v2 netifd 1/5] wireless: add ubus method for reloading configuration

2019-11-09 Thread Daniel Golle
From: John Crispin 

Signed-off-by: Daniel Golle 
---
v2: unchanged
 ubus.c | 23 +++
 wireless.c | 18 +-
 wireless.h |  1 +
 3 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/ubus.c b/ubus.c
index 150d818..5a2a339 100644
--- a/ubus.c
+++ b/ubus.c
@@ -1081,6 +1081,28 @@ get_wdev(struct blob_attr *msg, int *ret)
return wdev;
 }
 
+static int
+netifd_handle_wdev_reconf(struct ubus_context *ctx, struct ubus_object *obj,
+ struct ubus_request_data *req, const char *method,
+ struct blob_attr *msg)
+{
+   struct wireless_device *wdev;
+   int ret;
+
+   wdev = get_wdev(msg, &ret);
+   if (ret == UBUS_STATUS_NOT_FOUND)
+   return ret;
+
+   if (wdev) {
+   wireless_device_reconf(wdev);
+   } else {
+   vlist_for_each_element(&wireless_devices, wdev, node)
+   wireless_device_reconf(wdev);
+   }
+
+   return 0;
+}
+
 static int
 netifd_handle_wdev_up(struct ubus_context *ctx, struct ubus_object *obj,
  struct ubus_request_data *req, const char *method,
@@ -1189,6 +1211,7 @@ netifd_handle_wdev_notify(struct ubus_context *ctx, 
struct ubus_object *obj,
 static struct ubus_method wireless_object_methods[] = {
{ .name = "up", .handler = netifd_handle_wdev_up },
{ .name = "down", .handler = netifd_handle_wdev_down },
+   { .name = "reconf", .handler = netifd_handle_wdev_reconf },
{ .name = "status", .handler = netifd_handle_wdev_status },
{ .name = "notify", .handler = netifd_handle_wdev_notify },
{ .name = "get_validate", .handler = netifd_handle_wdev_get_validate },
diff --git a/wireless.c b/wireless.c
index 387f4ba..9986e9a 100644
--- a/wireless.c
+++ b/wireless.c
@@ -282,7 +282,7 @@ wireless_device_run_handler(struct wireless_device *wdev, 
bool up)
 }
 
 static void
-__wireless_device_set_up(struct wireless_device *wdev)
+__wireless_device_set_up(struct wireless_device *wdev, int force)
 {
if (wdev->disabled)
return;
@@ -293,7 +293,7 @@ __wireless_device_set_up(struct wireless_device *wdev)
if (!wdev->autostart)
return;
 
-   if (wdev->state != IFS_DOWN || config_init)
+   if (!force && (wdev->state != IFS_DOWN || config_init))
return;
 
free(wdev->prev_config);
@@ -320,7 +320,7 @@ wdev_handle_config_change(struct wireless_device *wdev)
switch(state) {
case IFC_NORMAL:
case IFC_RELOAD:
-   __wireless_device_set_up(wdev);
+   __wireless_device_set_up(wdev, 0);
 
wdev->config_state = IFC_NORMAL;
break;
@@ -363,7 +363,15 @@ wireless_device_set_up(struct wireless_device *wdev)
 {
wdev->retry = WIRELESS_SETUP_RETRY;
wdev->autostart = true;
-   __wireless_device_set_up(wdev);
+   __wireless_device_set_up(wdev, 0);
+}
+
+void
+wireless_device_reconf(struct wireless_device *wdev)
+{
+   wdev->retry = WIRELESS_SETUP_RETRY;
+   wdev->autostart = true;
+   __wireless_device_set_up(wdev, 1);
 }
 
 static void
@@ -1001,5 +1009,5 @@ wireless_start_pending(void)
struct wireless_device *wdev;
 
vlist_for_each_element(&wireless_devices, wdev, node)
-   __wireless_device_set_up(wdev);
+   __wireless_device_set_up(wdev, 0);
 }
diff --git a/wireless.h b/wireless.h
index 3498bd8..bade738 100644
--- a/wireless.h
+++ b/wireless.h
@@ -93,6 +93,7 @@ struct wireless_process {
 void wireless_device_create(struct wireless_driver *drv, const char *name, 
struct blob_attr *data);
 void wireless_device_set_up(struct wireless_device *wdev);
 void wireless_device_set_down(struct wireless_device *wdev);
+void wireless_device_reconf(struct wireless_device *wdev);
 void wireless_device_status(struct wireless_device *wdev, struct blob_buf *b);
 void wireless_device_get_validate(struct wireless_device *wdev, struct 
blob_buf *b);
 void wireless_interface_create(struct wireless_device *wdev, struct blob_attr 
*data, const char *section);
-- 
2.23.0


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


[OpenWrt-Devel] [PATCH 3/3] ath10k-ct: Use ath10k-ct version 5.4

2019-11-09 Thread Hauke Mehrtens
This makes ath10k-ct use the version based on kernel 5.4 by default.

Signed-off-by: Hauke Mehrtens 
---

This was only tested in AP mode on a IPQ4019 device so far.

 package/kernel/ath10k-ct/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/kernel/ath10k-ct/Makefile 
b/package/kernel/ath10k-ct/Makefile
index b32d1923f7..4e9b0c1883 100644
--- a/package/kernel/ath10k-ct/Makefile
+++ b/package/kernel/ath10k-ct/Makefile
@@ -12,10 +12,10 @@ PKG_SOURCE_DATE:=2019-11-07
 PKG_SOURCE_VERSION:=080cd781e12dfc2a83f41c4de7a7257398943839
 
PKG_MIRROR_HASH:=2a66e0188b699b4e240ae9d605f36a3bba072f33e6ce71e370b65dafcc5ad0db
 
-# Build the 5.2 ath10k-ct driver version.  Other option is "-4.19".
+# Build the 5.4 ath10k-ct driver version.  Other option is "-4.19".
 # Probably this should match as closely as
 # possible to whatever mac80211 backports version is being used.
-CT_KVER="-4.19"
+CT_KVER="-5.4"
 
 PKG_MAINTAINER:=Ben Greear 
 PKG_BUILD_PARALLEL:=1
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH 1/3] ath10-ct: Update to version 2019-11-07

2019-11-09 Thread Hauke Mehrtens
This version adds support for ath10k-ct based on kernel 5.4.
The patches are now also covering ath10k-ct based on kernel 5.4.

Signed-off-by: Hauke Mehrtens 
---
 package/kernel/ath10k-ct/Makefile |   6 +-
 ...rt-for-configuring-management-packet.patch |   4 +-
 ...ble-out-of-bound-access-of-ath10k_ra.patch |   2 +-
 ...rect-multicast-broadcast-rate-settin.patch |   4 +-
 ...64-ath10k-commit-rates-from-mac80211.patch |  38 +-
 ...-the-vif-to-cancel_remain_on_channel.patch |   4 +-
 ...rolling-support-for-various-chipsets.patch | 552 +-
 ...h10k-4.16-use-tpt-trigger-by-default.patch |  45 +-
 ...ilable-channels-via-DT-ieee80211-fre.patch |   2 +-
 ...station-exists-before-forwarding-tx-.patch |  11 +
 10 files changed, 628 insertions(+), 40 deletions(-)

diff --git a/package/kernel/ath10k-ct/Makefile 
b/package/kernel/ath10k-ct/Makefile
index dbf75fe174..b32d1923f7 100644
--- a/package/kernel/ath10k-ct/Makefile
+++ b/package/kernel/ath10k-ct/Makefile
@@ -8,9 +8,9 @@ PKG_LICENSE_FILES:=
 
 PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git
 PKG_SOURCE_PROTO:=git
-PKG_SOURCE_DATE:=2019-09-09
-PKG_SOURCE_VERSION:=5e8cd86f90dac966d12df6ece84ac41458d0e95f
-PKG_MIRROR_HASH:=dc1097f3a7b4b7e346918f206746d00a0b7df07ae3be9b89be55dfaef3cbbe45
+PKG_SOURCE_DATE:=2019-11-07
+PKG_SOURCE_VERSION:=080cd781e12dfc2a83f41c4de7a7257398943839
+PKG_MIRROR_HASH:=2a66e0188b699b4e240ae9d605f36a3bba072f33e6ce71e370b65dafcc5ad0db
 
 # Build the 5.2 ath10k-ct driver version.  Other option is "-4.19".
 # Probably this should match as closely as
diff --git 
a/package/kernel/ath10k-ct/patches/161-ath10k-add-support-for-configuring-management-packet.patch
 
b/package/kernel/ath10k-ct/patches/161-ath10k-add-support-for-configuring-management-packet.patch
index e67003c5a7..526ec2f9b6 100644
--- 
a/package/kernel/ath10k-ct/patches/161-ath10k-add-support-for-configuring-management-packet.patch
+++ 
b/package/kernel/ath10k-ct/patches/161-ath10k-add-support-for-configuring-management-packet.patch
@@ -43,7 +43,7 @@ Origin: backport, 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
  static int ath10k_mac_get_max_vht_mcs_map(u16 mcs_map, int nss)
  {
switch ((mcs_map >> (2 * nss)) & 0x3) {
-@@ -6405,9 +6421,10 @@ static void ath10k_bss_info_changed(stru
+@@ -6410,9 +6426,10 @@ static void ath10k_bss_info_changed(stru
struct cfg80211_chan_def def;
u32 vdev_param, pdev_param, slottime, preamble;
u16 bitrate, hw_value;
@@ -56,7 +56,7 @@ Origin: backport, 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
  
mutex_lock(&ar->conf_mutex);
  
-@@ -6613,6 +6630,30 @@ static void ath10k_bss_info_changed(stru
+@@ -6618,6 +6635,30 @@ static void ath10k_bss_info_changed(stru
arvif->vdev_id,  ret);
}
  
diff --git 
a/package/kernel/ath10k-ct/patches/162-ath10k-fix-possible-out-of-bound-access-of-ath10k_ra.patch
 
b/package/kernel/ath10k-ct/patches/162-ath10k-fix-possible-out-of-bound-access-of-ath10k_ra.patch
index a24029983c..197a6f5100 100644
--- 
a/package/kernel/ath10k-ct/patches/162-ath10k-fix-possible-out-of-bound-access-of-ath10k_ra.patch
+++ 
b/package/kernel/ath10k-ct/patches/162-ath10k-fix-possible-out-of-bound-access-of-ath10k_ra.patch
@@ -26,7 +26,7 @@ Origin: backport, 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
if (ath10k_rates[i].bitrate == bitrate)
return hw_value_prefix | ath10k_rates[i].hw_value;
}
-@@ -6636,22 +6636,22 @@ static void ath10k_bss_info_changed(stru
+@@ -6641,22 +6641,22 @@ static void ath10k_bss_info_changed(stru
return;
}
  
diff --git 
a/package/kernel/ath10k-ct/patches/163-ath10k-fix-incorrect-multicast-broadcast-rate-settin.patch
 
b/package/kernel/ath10k-ct/patches/163-ath10k-fix-incorrect-multicast-broadcast-rate-settin.patch
index f6fd75b7e5..dc53c260b8 100644
--- 
a/package/kernel/ath10k-ct/patches/163-ath10k-fix-incorrect-multicast-broadcast-rate-settin.patch
+++ 
b/package/kernel/ath10k-ct/patches/163-ath10k-fix-incorrect-multicast-broadcast-rate-settin.patch
@@ -17,7 +17,7 @@ Origin: other, https://patchwork.kernel.org/patch/10723033/
 
 --- a/ath10k-4.19/mac.c
 +++ b/ath10k-4.19/mac.c
-@@ -6421,8 +6421,8 @@ static void ath10k_bss_info_changed(stru
+@@ -6426,8 +6426,8 @@ static void ath10k_bss_info_changed(stru
struct cfg80211_chan_def def;
u32 vdev_param, pdev_param, slottime, preamble;
u16 bitrate, hw_value;
@@ -28,7 +28,7 @@ Origin: other, https://patchwork.kernel.org/patch/10723033/
enum nl80211_band band;
const struct ieee80211_supported_band *sband;
  
-@@ -6595,7 +6595,11 @@ static void ath10k_bss_info_changed(stru
+@@ -6600,7 +6600,11 @@ static void ath10k_bss_info_changed(stru
if (changed & BSS_CHANGED_MCAST_RATE &&
!WARN_ON(ath10k_mac_vif_chan(arvif->vif, &def))) {
band = def.chan->b

[OpenWrt-Devel] [PATCH 2/3] mac80211: Allow ADHOC mode and different beacon intervals

2019-11-09 Thread Hauke Mehrtens
ath10k-ct supports the combination to select ADHOC (IBSS) mode and
different beacon intervals together. mac80211 does not like this
combination, but Ben says this is ok, so remove this check.

Signed-off-by: Hauke Mehrtens 
---

As an alternative we can also remove the beacon_int_min_gcd setting from 
ath10k-ct.


 ...ckports-pci-Include-linux-pci-aspm.h.patch |  6 ++--
 ..._disable_link_state-wrapper-with-ret.patch |  2 +-
 .../patches/subsys/400-allow-ibss-mixed.patch | 29 +++
 3 files changed, 33 insertions(+), 4 deletions(-)
 create mode 100644 
package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch

diff --git 
a/package/kernel/mac80211/patches/build/100-backports-pci-Include-linux-pci-aspm.h.patch
 
b/package/kernel/mac80211/patches/build/100-backports-pci-Include-linux-pci-aspm.h.patch
index 5faeb96748..91740a62b9 100644
--- 
a/package/kernel/mac80211/patches/build/100-backports-pci-Include-linux-pci-aspm.h.patch
+++ 
b/package/kernel/mac80211/patches/build/100-backports-pci-Include-linux-pci-aspm.h.patch
@@ -11,9 +11,9 @@ Signed-off-by: Hauke Mehrtens 
 
 --- a/backport-include/linux/pci.h
 +++ b/backport-include/linux/pci.h
-@@ -3,6 +3,10 @@
- #include_next 
- #include 
+@@ -7,6 +7,10 @@
+ #include 
+ #endif
  
 +#if LINUX_VERSION_IS_LESS(5,4,0)
 +#include 
diff --git 
a/package/kernel/mac80211/patches/build/101-backport-add-pci_disable_link_state-wrapper-with-ret.patch
 
b/package/kernel/mac80211/patches/build/101-backport-add-pci_disable_link_state-wrapper-with-ret.patch
index a41879184b..7691522e73 100644
--- 
a/package/kernel/mac80211/patches/build/101-backport-add-pci_disable_link_state-wrapper-with-ret.patch
+++ 
b/package/kernel/mac80211/patches/build/101-backport-add-pci_disable_link_state-wrapper-with-ret.patch
@@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau 
 
 --- a/backport-include/linux/pci.h
 +++ b/backport-include/linux/pci.h
-@@ -236,4 +236,29 @@ static inline struct pci_dev *pcie_find_
+@@ -240,4 +240,29 @@ static inline struct pci_dev *pcie_find_
(PCI_IRQ_LEGACY | PCI_IRQ_MSI | PCI_IRQ_MSIX)
  #endif
  
diff --git a/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch 
b/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch
new file mode 100644
index 00..52200b6ecc
--- /dev/null
+++ b/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch
@@ -0,0 +1,29 @@
+ath10k-ct starting with version 5.2 allows the combination of 
+NL80211_IFTYPE_ADHOC and beacon_int_min_gcd in ath10k_10x_ct_if_comb 
+which triggers this warning. Ben told me that this is not a big problem 
+and we should ignore this.
+
+--- a/net/wireless/core.c
 b/net/wireless/core.c
+@@ -613,21 +613,6 @@ static int wiphy_verify_combinations(str
+   c->limits[j].max > 1))
+   return -EINVAL;
+ 
+-  /*
+-   * This isn't well-defined right now. If you have an
+-   * IBSS interface, then its beacon interval may change
+-   * by joining other networks, and nothing prevents it
+-   * from doing that.
+-   * So technically we probably shouldn't even allow AP
+-   * and IBSS in the same interface, but it seems that
+-   * some drivers support that, possibly only with fixed
+-   * beacon intervals for IBSS.
+-   */
+-  if (WARN_ON(types & BIT(NL80211_IFTYPE_ADHOC) &&
+-  c->beacon_int_min_gcd)) {
+-  return -EINVAL;
+-  }
+-
+   cnt += c->limits[j].max;
+   /*
+* Don't advertise an unsupported type
-- 
2.20.1


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


[OpenWrt-Devel] [PATCH v2] ath79: add D-Link DIR-615 E4

2019-11-09 Thread Paul Fertser
Support ported from ar71xx.

Tested on hardware: flashing OpenWrt, then downgrading to vendor
firmware, then using regular vendor web interface to upgrade to OpenWrt
(using -factory.bin image). All MACs in vendor firmware were correct,
the only visible quirk was meaningless "Hardware Version:" field in the
web interface page header (one can append "mac" partition contents to
the vendor firmware dump prior to flashing if that's too worrying).

Signed-off-by: Paul Fertser 
---
Changes for v2:

- Remove "rev." from board name
- Use a single DTS file; whoever has hardware to port this to the other
  similar devices can easily unsplit it later
- Fix label_mac handling (as it's not available in DT)
- Rename gpio_leds to leds DTS section
- Use boardname for LEDs and merge the setup code with buffalo,whr-g301n
- Use 33 MHz for SPI clock (max frequency for READ command acconding to the
  chip datasheet)
- Make "firmware" partition 0x3b (3776 kiB) long, covering "mac" and 
"lp"

 .../ath79/dts/ar7240_dlink_dir-615-e4.dts | 188 ++
 target/linux/ath79/image/tiny.mk  |  16 ++
 .../ath79/tiny/base-files/etc/board.d/01_leds |   3 +-
 .../tiny/base-files/etc/board.d/02_network|   6 +
 .../etc/hotplug.d/firmware/10-ath9k-eeprom|   4 +
 5 files changed, 216 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/ath79/dts/ar7240_dlink_dir-615-e4.dts

diff --git a/target/linux/ath79/dts/ar7240_dlink_dir-615-e4.dts 
b/target/linux/ath79/dts/ar7240_dlink_dir-615-e4.dts
new file mode 100644
index 00..64ee2eb938
--- /dev/null
+++ b/target/linux/ath79/dts/ar7240_dlink_dir-615-e4.dts
@@ -0,0 +1,188 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include 
+#include 
+
+#include "ar7240.dtsi"
+
+/ {
+   model = "D-Link DIR-615 E4";
+   compatible = "dlink,dir-615-e4", "qca,ar7240";
+
+   aliases {
+   led-boot = &power_amber;
+   led-failsafe = &power_amber;
+   led-running = &power_green;
+   led-upgrade = &power_amber;
+   };
+
+   keys {
+   compatible = "gpio-keys";
+
+   reset {
+   label = "reset";
+   linux,code = ;
+   gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
+   debounce-interval = <60>;
+   };
+
+   wps {
+   label = "wps";
+   linux,code = ;
+   gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+   debounce-interval = <60>;
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+   pinctrl-names = "default";
+   pinctrl-0 = <&switch_led_pins>;
+
+   power_green: power_green {
+   label = "dir-615-e4:green:power";
+   gpios = <&gpio 6 GPIO_ACTIVE_HIGH>;
+   };
+
+   power_amber: power_amber {
+   label = "dir-615-e4:amber:power";
+   gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
+   };
+
+   wps {
+   label = "dir-615-e4:blue:wps";
+   gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
+   };
+
+   lan1 {
+   label = "dir-615-e4:green:lan1";
+   gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+   };
+
+   lan2 {
+   label = "dir-615-e4:green:lan2";
+   gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
+   };
+
+   lan3 {
+   label = "dir-615-e4:green:lan3";
+   gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+   };
+
+   lan4 {
+   label = "dir-615-e4:green:lan4";
+   gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
+   };
+
+   wan_amber {
+   label = "dir-615-e4:amber:wan";
+   gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
+   };
+
+   wan_green {
+   label = "dir-615-e4:green:wan";
+   gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
+   };
+
+   wlan {
+   label = "dir-615-e4:green:wlan";
+   gpios = <&ath9k 1 GPIO_ACTIVE_LOW>;
+   linux,default-trigger = "phy0tpt";
+   };
+   };
+};
+
+&spi {
+   status = "okay";
+   num-cs = <1>;
+
+   flash@0 {
+   compatible = "jedec,spi-nor";
+   reg = <0>;
+   spi-max-frequency = <3300>;
+
+   partitions {
+   compatible = "fixed-partitions";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   uboot: partition@0 {
+   reg = <0x0 0x3

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

2019-11-09 Thread Florian Eckert via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---
Hauke Mehrtens  schrieb am Sa., 9. Nov. 2019, 13:53:

> On 11/7/19 2:31 PM, Florian Eckert wrote:
> > 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}
>
> Why do you set the respawn_retry to 0 by default?
>

As suggested by others on the mailinglist. Settings this option to 0 means
respawn forever.
--- End Message ---
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 2/2] base-files: rename SSID with EUI of mac address

2019-11-09 Thread Jonas Gorski
On Sat, 9 Nov 2019 at 12:04,  wrote:
>
> Hi,
>
> > -Original Message-
> > From: Jonas Gorski [mailto:jonas.gor...@gmail.com]
> > Sent: Samstag, 9. November 2019 10:37
> > To: Adrian Schmutzler 
> > Cc: OpenWrt Development List ; Rosy
> > Song 
> > Subject: Re: [OpenWrt-Devel] [PATCH 2/2] base-files: rename SSID with EUI
> > of mac address
> >
> > On Fri, 8 Nov 2019 at 12:49, Adrian Schmutzler
> >  wrote:
> > >
> > > If the label MAC address is provided for a device, the default SSID
> > > will be set to contain the EUI of this address, e.g. OpenWrt-ddeeff.
> > >
> > > With multiple routers, this will help the user to identify his device
> > > based on the MAC address printed on the device.
> > >
> > > If no label MAC address is specified, this will use "OpenWrt" as done
> > > before.
> > >
> > > Using a uci-defaults script for this is necessary as mac80211.sh is
> > > executed before /etc/board.json is created, so label MAC addresses set
> > > in 02_network would not be available there.
> >
> > Unfortunately since we detect wifi async these days this is quite racy, and
> > there is no guarantee /etc/config/wireless is fully populated by the time 
> > the
> > uci defaults are run. E.g. mwl8k takes quite a while since it uses different
> > firmwares for STA and AP modes, and it needs to re-initialize to switch
> > between them (triggered by by mac80211.sh trying to detect the supporte
> > features).
>
> So, in the end, it might be like Manuel Giganto suggested in GitHub and one 
> might
> either have to wait in mac80211.sh until /etc/board.json is available (ugly) 
> or
> just put the same code (the few lines of SSID change) in both locations 
> (uci_defaults AND mac80211.sh).

How about just generating the board.json at an earlier time before
loading the wifi drivers, so it's always there once mac80211.sh runs?

We already generate it in preinit (unless failsafe is disabled) to
configure the switch and find the proper lan if, we might as well make
it unconditional and then rely on it for mac80211.sh.


Regards
Jonas

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


[OpenWrt-Devel] [PATCH maintainer-tools] patchwork-apply.sh: help spotting DMARC mangled patches

2019-11-09 Thread Petr Štetiar
Avoid DMARC plague in the commit messages:

 87f9292300cf hostapd: add IEEE 802.11k support
 450d44a8ead2 openssl: change defaults: ENGINE:on, NPN:off, misc
 eabc1ddc4541 build: Honour NO_COLOR in include/scan.mk
 3fb45576ac16 cryptodev-linux: move from packages feed
 a73283dc10f7 kernel: nf-nathelper-extra depends on ipt-raw
 0317fc3658eb libpcap: patch to add limits.h to pcap-usb-linux.c
 26dbf79f4905 libevent2: Don't build tests and samples
 d59126040701 brcm63xx: initial support for Sky SR102 router
 094d49cddf93 kernel: bump 4.14 to 4.14.51
 247055cbfbf1 igmpproxy: bump to 0.2.1
 c451434b963d cake: bump to 20180504 bake
 080fb7a3fbb6 iproute2: import latest cake
 ad5af37ca793 iproute2: backport json_print-fix-hidden-64-bit-type-promotion
 78f4305933b9 iftop: bump to latest
 7783f31359cb base-files: nand: use CI_KERNPART whenever the kernel volume is 
needed

Signed-off-by: Petr Štetiar 
---
 patchwork-apply.sh | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/patchwork-apply.sh b/patchwork-apply.sh
index 5506adbfe451..506a09fd4fd5 100755
--- a/patchwork-apply.sh
+++ b/patchwork-apply.sh
@@ -140,6 +140,12 @@ echo "$1" | grep -sqE '^[0-9]+$' || {
}
 }
 
+grep --color --context=3 "DMARC Reject/Quarantine" "$1.patch" && {
+   if yesno "Beware DMARC text detected! Set to 'Changes Requested'?" "y"; 
then
+   pwclient update -s "Changes Requested" "$1"
+   fi
+}
+
 git am "$1.patch" || {
echo "Failed to apply patch $1" >&2
git am --abort

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


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

2019-11-09 Thread Hauke Mehrtens
On 11/7/19 2:31 PM, Florian Eckert wrote:
> 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}

Why do you set the respawn_retry to 0 by default?

>   procd_close_instance
>  }
>  
> 




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


Re: [OpenWrt-Devel] [PATCH 0/3] Further preparations for USB gadget usage

2019-11-09 Thread Zoltan HERPAI

On 11/5/2019 0:39, Michael Heimpold wrote:

This patch series bundles some more steps towards the usage
of I2SE Duckbills as USB gadget devices.



Thanks, pushed the series to trunk.

Regards,
Zoltan H


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


Re: [OpenWrt-Devel] [PATCH RESEND] mxs: add support and switch to kernel 4.19

2019-11-09 Thread Zoltan HERPAI

On 11/5/2019 0:15, Michael Heimpold wrote:

Also remove kernel 4.14 support and the meanwhile obsolete patch.

This was run-tested on I2SE Duckbill device and
Olimex OLinuXino Maxi board.

Signed-off-by: Michael Heimpold 


Thanks, pushed to trunk along with the u-boot upgrade.

Regards,
Zoltan H


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


Re: [OpenWrt-Devel] [PATCH V2] ath79: add support for TP-Link TL-MR6400

2019-11-09 Thread Filip Moc via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---
Hi,

> What exactly are you referring to when you say "connection status events"?
Link detection does not work. eth0 is always reported as up with carrier even 
when
there is no cable connected to any port of the switch.

This seems related:
https://bugs.openwrt.org/index.php?do=details&task_id=1702&order=dateopened&sort=desc
And see also this comment and comments below:
https://github.com/openwrt/openwrt/pull/1146#issuecomment-408653790

It seems to me that link detection on this switch might be currently not
supported at all on ath79.
I did not find any bug report that would track this issue further so I'm not
really sure what the current status is.
But I find it hard to belive that so important feature wouldn't be supported.

Note also this comment on bug page by John: "it'll come when we add qca8k 
support".
But it seems qca8k support was already added to kernel long time ago:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit?id=e5dcad290a7c62d1c856269dbd13e470e388b704
So I'm not sure what support exactly needs to be added.

Perhaps John could explain what exactly needs to be done to get link detection
support on ag71xx. Then we could try to make some patch if needed.

--

I also found another problem. LTE module does not work reliably. Sometimes when
I boot MR6400 the LTE module is not detected. This never happens when I boot
ar71xx version.

Filip


On Mon, Oct 14, 2019 at 05:50:55PM +0200, Adrian Schmutzler wrote:
> Hi,
> 
> > -Original Message-
> > From: Enrico Mioso [mailto:mrkiko...@gmail.com]
> > Sent: Dienstag, 8. Oktober 2019 07:14
> > To: Filip Moc 
> > Cc: m...@adrianschmutzler.de; openwrt-devel@lists.openwrt.org
> > Subject: Re: [PATCH V2] ath79: add support for TP-Link TL-MR6400
> > 
> > Hi Filip, hello all!
> > 
> > Thank you very very much for your help and sorry for me not ansering to 
> > your previous mail. I tought I would re-check this all when I
> > went back home to report with precise informations, but in the end I didn't.
> > Your help is very very much apreciated.
> > 
> > As you found out, I would need help in exactly that: setting port numbers 
> > correctly in the UI and fixing the fact eth0 doesn't receive
> > connection status events.
> 
> What exactly are you referring to when you say "connection status events"?
> 
> This has two aspects: One is the LED status which needs to be set with 
> switch0 (I commented on that in my previous e-mail reviewing your v2 patch 
> again).
> 
> The other one is that switch-phy-swap has an effect on which ports can detect 
> link status changes. This setting will affect several things:
> 1. Which port gets link detection
> 2. The port numbers will change
> 3. The order in which gmacs are set up will change: If you change that, eth0 
> will become eth1 and vice versa (on running system). This will require 
> adjustment of setup in 02_network/01_leds, where ethX then needs to be 
> swapped, too. Note that for several devices eth0/eth1 are swapped compared to 
> ar71xx.
> 
> So, you really have a lot to play around with and to make wrong ;-)
> 
> For further reading on the effects of switch-phy-swap, you might have a look 
> at this Pull Request (starting at the comment):
> 
> https://github.com/openwrt/openwrt/pull/1942#issuecomment-529078064
> 
> Note that the situation in the PR is even more complicated as the vendor did 
> a dumbass setup in the first place.
> 
> Best
> 
> Adrian



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


Re: [OpenWrt-Devel] [PATCH 2/2] base-files: rename SSID with EUI of mac address

2019-11-09 Thread mail
Hi,

> -Original Message-
> From: Jonas Gorski [mailto:jonas.gor...@gmail.com]
> Sent: Samstag, 9. November 2019 10:37
> To: Adrian Schmutzler 
> Cc: OpenWrt Development List ; Rosy
> Song 
> Subject: Re: [OpenWrt-Devel] [PATCH 2/2] base-files: rename SSID with EUI
> of mac address
> 
> On Fri, 8 Nov 2019 at 12:49, Adrian Schmutzler
>  wrote:
> >
> > If the label MAC address is provided for a device, the default SSID
> > will be set to contain the EUI of this address, e.g. OpenWrt-ddeeff.
> >
> > With multiple routers, this will help the user to identify his device
> > based on the MAC address printed on the device.
> >
> > If no label MAC address is specified, this will use "OpenWrt" as done
> > before.
> >
> > Using a uci-defaults script for this is necessary as mac80211.sh is
> > executed before /etc/board.json is created, so label MAC addresses set
> > in 02_network would not be available there.
> 
> Unfortunately since we detect wifi async these days this is quite racy, and
> there is no guarantee /etc/config/wireless is fully populated by the time the
> uci defaults are run. E.g. mwl8k takes quite a while since it uses different
> firmwares for STA and AP modes, and it needs to re-initialize to switch
> between them (triggered by by mac80211.sh trying to detect the supporte
> features).

So, in the end, it might be like Manuel Giganto suggested in GitHub and one 
might
either have to wait in mac80211.sh until /etc/board.json is available (ugly) or
just put the same code (the few lines of SSID change) in both locations 
(uci_defaults AND mac80211.sh).

Best

Adrian

> 
> 
> Regards
> Jonas
> 
> >
> > Suggested-by: Rosy Song 
> > Signed-off-by: Adrian Schmutzler 
> >
> > ---
> >
> > This effectively uses a workaround to prevent SSID from being reset
> > after upgrade (match SSID vs. "OpenWrt"). If there is a nicer option,
> > please propose it.
> >
> > Another option for this would be to explicitly mark the wireless uci
> > config as 'default setup' by a to-be-introduced option, which is to be
> > removed in a late uci-defaults script. This could then be exploited
> > for several other objectives, e.g. further config-dependent WiFi setup
> > tasks.
> > ---
> >  .../etc/uci-defaults/15_wifi-ssid-mac-address | 22
> > +++
> >  1 file changed, 22 insertions(+)
> >  create mode 100644
> > package/base-files/files/etc/uci-defaults/15_wifi-ssid-mac-address
> >
> > diff --git
> > a/package/base-files/files/etc/uci-defaults/15_wifi-ssid-mac-address
> > b/package/base-files/files/etc/uci-defaults/15_wifi-ssid-mac-address
> > new file mode 100644
> > index 00..aeb46e39c0
> > --- /dev/null
> > +++ b/package/base-files/files/etc/uci-defaults/15_wifi-ssid-mac-addre
> > +++ ss
> > @@ -0,0 +1,22 @@
> > +. /lib/functions.sh
> > +. /lib/functions/system.sh
> > +
> > +set_wifi_ssid() {
> > +   local iface="$1"
> > +
> > +   [ "$(uci get "wireless.${iface}.ssid")" = "OpenWrt" ] && \
> > +   uci set "wireless.${iface}.ssid=$ssid"
> > +}
> > +
> > +label_macaddr=$(get_mac_label)
> > +
> > +[ -n "$label_macaddr" ] || exit 0
> > +
> > +ssid="OpenWrt-$(macaddr_geteui $label_macaddr)"
> > +
> > +config_load wireless
> > +config_foreach set_wifi_ssid wifi-iface
> > +
> > +uci commit wireless
> > +
> > +exit 0
> > --
> > 2.20.1
> >
> >
> > ___
> > openwrt-devel mailing list
> > openwrt-devel@lists.openwrt.org
> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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


Re: [OpenWrt-Devel] [PATCH 2/2] base-files: rename SSID with EUI of mac address

2019-11-09 Thread Jonas Gorski
On Fri, 8 Nov 2019 at 12:49, Adrian Schmutzler
 wrote:
>
> If the label MAC address is provided for a device, the default SSID
> will be set to contain the EUI of this address, e.g. OpenWrt-ddeeff.
>
> With multiple routers, this will help the user to identify his device
> based on the MAC address printed on the device.
>
> If no label MAC address is specified, this will use "OpenWrt" as
> done before.
>
> Using a uci-defaults script for this is necessary as mac80211.sh is
> executed before /etc/board.json is created, so label MAC addresses
> set in 02_network would not be available there.

Unfortunately since we detect wifi async these days this is quite
racy, and there is no guarantee /etc/config/wireless is fully
populated by the time the uci defaults are run. E.g. mwl8k takes quite
a while since it uses different firmwares for STA and AP modes, and it
needs to re-initialize to switch between them (triggered by by
mac80211.sh trying to detect the supporte features).


Regards
Jonas

>
> Suggested-by: Rosy Song 
> Signed-off-by: Adrian Schmutzler 
>
> ---
>
> This effectively uses a workaround to prevent SSID from being reset
> after upgrade (match SSID vs. "OpenWrt"). If there is a nicer option,
> please propose it.
>
> Another option for this would be to explicitly mark the wireless uci
> config as 'default setup' by a to-be-introduced option, which is
> to be removed in a late uci-defaults script. This could then be
> exploited for several other objectives, e.g. further config-dependent
> WiFi setup tasks.
> ---
>  .../etc/uci-defaults/15_wifi-ssid-mac-address | 22 +++
>  1 file changed, 22 insertions(+)
>  create mode 100644 
> package/base-files/files/etc/uci-defaults/15_wifi-ssid-mac-address
>
> diff --git 
> a/package/base-files/files/etc/uci-defaults/15_wifi-ssid-mac-address 
> b/package/base-files/files/etc/uci-defaults/15_wifi-ssid-mac-address
> new file mode 100644
> index 00..aeb46e39c0
> --- /dev/null
> +++ b/package/base-files/files/etc/uci-defaults/15_wifi-ssid-mac-address
> @@ -0,0 +1,22 @@
> +. /lib/functions.sh
> +. /lib/functions/system.sh
> +
> +set_wifi_ssid() {
> +   local iface="$1"
> +
> +   [ "$(uci get "wireless.${iface}.ssid")" = "OpenWrt" ] && \
> +   uci set "wireless.${iface}.ssid=$ssid"
> +}
> +
> +label_macaddr=$(get_mac_label)
> +
> +[ -n "$label_macaddr" ] || exit 0
> +
> +ssid="OpenWrt-$(macaddr_geteui $label_macaddr)"
> +
> +config_load wireless
> +config_foreach set_wifi_ssid wifi-iface
> +
> +uci commit wireless
> +
> +exit 0
> --
> 2.20.1
>
>
> ___
> 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