Re: Best practice for resetting (iptables) firewall state

2023-07-18 Thread Bastian Bittorf
On Tue, Jul 11, 2023 at 11:25:55PM -0600, Philip Prindeville wrote:
> I'm working on a wrapper for using xt_asn and xt_geoip in xtables-addons, and 
> was wondering about how best to solve certain problems.
> 

maybe the mechanism for stop/start/update used here is useful:
https://github.com/bittorf/block-TOR-nodes/blob/master/tornodes_block.sh

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


new musl libc release 1.2.4 (2023-05-01) (was Re: [musl] busybox problem on powerpc PPC/32bit (hardware TP-Link-WDR-4900-v1))

2023-05-02 Thread Bastian Bittorf
On Sun, Feb 12, 2023 at 05:34:43PM -0500, Rich Felker wrote:
> On Sun, Feb 12, 2023 at 08:17:04AM +0000, Bastian Bittorf wrote:
> > On Sat, Feb 11, 2023 at 02:30:44PM -0500, Rich Felker wrote:
> > > > >   .hidden __hwcap
> > > > >   .long __hwcap-.
> > > > > -1:   mflr 4
> > > > > - lwz 5, 0(4)
> > > > > - lwzx 4, 4, 5
> > > > > - andis. 4, 4, 0x80
> > > > > +1:   mflr 6
> > > > > + lwz 5, 0(6)
> > > > > + lwzx 6, 6, 5
> > > > > + andis. 6, 6, 0x80
> > > > >   beq 1f
> > > > >   .long 0x11c35b01 /* evldd 14,88(3) */
> > > > >   .long 0x11e36301 /* ... */
> > 
> > It works!

New musl release including this fix is out:
https://musl.libc.org/releases/musl-1.2.4.tar.gz

Is anybody already working on upgrading musl for OpenWRT?

bye, bastian

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


Re: [musl] busybox problem on powerpc PPC/32bit (hardware TP-Link-WDR-4900-v1)

2023-02-12 Thread Bastian Bittorf
On Sat, Feb 11, 2023 at 02:30:44PM -0500, Rich Felker wrote:
> > >   .hidden __hwcap
> > >   .long __hwcap-.
> > > -1:   mflr 4
> > > - lwz 5, 0(4)
> > > - lwzx 4, 4, 5
> > > - andis. 4, 4, 0x80
> > > +1:   mflr 6
> > > + lwz 5, 0(6)
> > > + lwzx 6, 6, 5
> > > + andis. 6, 6, 0x80
> > >   beq 1f
> > >   .long 0x11c35b01 /* evldd 14,88(3) */
> > >   .long 0x11e36301 /* ... */

It works!

~ # test A -gt 5 && echo OK
ash: A: out of range
~ # echo $?
2
~ # uname -a
Linux (none) 6.1.11 #1 Sun Feb 12 09:06:57 CET 2023 ppc GNU/Linux

In the end i directly changed the sourcecode,  
using the patchdir did not work an my side, i'am sure
a made a mistake here.

Anyway - i'am happy!
Is there some more, where i can help/test?

I uploaded kernel + busybox/initrd for qemu here:
http://intercity-vpn.de/mpc85xx/musl-1.2.3+ppcpatch/

bye, Bastian

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


Re: [musl] busybox problem on powerpc PPC/32bit (hardware TP-Link-WDR-4900-v1)

2023-02-11 Thread Bastian Bittorf
On Sat, Feb 11, 2023 at 09:01:03AM -0500, Rich Felker wrote:
> It looks like the powerpc spe longjmp code is clobbering the value
> argument. Try the attached patch.

> diff --git a/src/setjmp/powerpc/longjmp.S b/src/setjmp/powerpc/longjmp.S
> index 611389fe..465e4cd7 100644
> --- a/src/setjmp/powerpc/longjmp.S
> +++ b/src/setjmp/powerpc/longjmp.S
> @@ -42,10 +42,10 @@ longjmp:
>   bl 1f
>   .hidden __hwcap
>   .long __hwcap-.
> -1:   mflr 4
> - lwz 5, 0(4)
> - lwzx 4, 4, 5
> - andis. 4, 4, 0x80
> +1:   mflr 6
> + lwz 5, 0(6)
> + lwzx 6, 6, 5
> + andis. 6, 6, 0x80
>   beq 1f
>   .long 0x11c35b01 /* evldd 14,88(3) */
>   .long 0x11e36301 /* ... */

Thanks a lot, this looked promising!, but
sorry, it does NOT solve the issue:

Using musl-cross-make and this file in
patches/musl-1.2.0/ppc-spe-longjmp-fix.diff
i compiled an output/bin/powerpc-linux-muslsf*
crosscompiler with:
make TARGET=powerpc-linux-muslsf install
and used it for further steps...

maybe the patch did not applied?  
let me sleep about it...

Thanks a lot, Bastian

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


Re: [musl] busybox problem on powerpc PPC/32bit (hardware TP-Link-WDR-4900-v1)

2023-02-11 Thread Bastian Bittorf
On Sat, Feb 11, 2023 at 12:51:47PM +, Bastian Bittorf wrote:
> With OpenWRT i recognized a strange behavior of ash-shell scripts.
> It happens only on target PowerPC, e.g. m68k, arm, mips, x86 are
> unaffected.

to be more clear:
it seems to affect musl, but not glibc build.

bye, Bastian

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


busybox problem on powerpc PPC/32bit (hardware TP-Link-WDR-4900-v1)

2023-02-11 Thread Bastian Bittorf
With OpenWRT i recognized a strange behavior of ash-shell scripts.
It happens only on target PowerPC, e.g. m68k, arm, mips, x86 are
unaffected.

The visible strange behavior in 'ash' is:

$ test A -gt 5 && echo OK
ash: A: out of range
OK

Ofcourse this wrong returncode leads to all sorts of things...

I tested several busybox releases (1.33.2, 1.35.0, 1.36.0) and
crosscompiled with musl-git-b76f37f (from musl.cc) and 
crosscompiled with glibc: powerpc-linux-gnu-gcc (Debian-12.2.0)
(it's the same for all versions)

The resulting linux + busybox images ready for QEMU are here:
http://intercity-vpn.de/mpc85xx/

If needed i can provide build instructions.
Maybe somebody with more powerpc assembly knowledge can help here.

The underlying code is here:  
https://git.busybox.net/busybox/tree/coreutils/test.c#n488
But i can not spot the error:

static number_t getn(const char *s)
{
  char *p;
  errno = 0;
  r = strtol(s, &p, 10);
  if (errno != 0)
syntax(s, "out of range");
  return r;
}

Best Greetings,
Bastian Bittorf


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


Re: strange errors on mpc85xx-p1010-tplink_tl-wdr4900-v1

2023-02-07 Thread Bastian Bittorf
On Sun, Feb 05, 2023 at 03:47:46PM +, Bastian Bittorf wrote:
> I build r21997 for the wdr4900, flashed with
> 'sysupgrade -n /tmp/factory.bin' and recognized strange
> errors with custom scripts. It can be reduced to:
> 
> $ test A -gt 5 && echo OK
> ash: A: out of range
> OK

i compiled kernel-6.1 + busybox 1.36.0 for powerpc/mpc85xx [1]
using toolchain from http://musl.cc/powerpc-linux-muslsf-cross.tgz
and it is just the same broken behavior.

it does not happen an other architectures,
so it can be a compiler or toolchain issue.

i will investigate further.
bye, bastian

[1] http://intercity-vpn.de/mpc85xx/
qemu-system-ppc -M mpc8544ds -kernel zImage -initrd initramfs.cpio.gz -nographic

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


strange errors on mpc85xx-p1010-tplink_tl-wdr4900-v1

2023-02-05 Thread Bastian Bittorf
I build r21997 for the wdr4900, flashed with
'sysupgrade -n /tmp/factory.bin' and recognized strange
errors with custom scripts. It can be reduced to:

$ test A -gt 5 && echo OK
ash: A: out of range
OK

I will try to run busybox-1.36.0 with QEMU
for investigating further...

bye, Bastian

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


Re: howto support ramoops (former crashlog.o)

2022-08-24 Thread Bastian Bittorf
On Tue, Aug 23, 2022 at 07:53:53PM +0200, Daniel Golle wrote:
> pstore/ramoops can only work on platforms which do NOT clear DRAM
> content on (re-)boot. Many of the $vendor loaders unfortunately do that.
> Archer C6U being an MT7621-based unit will probably need a replacement
> bootloader in order to change that behavior. As it is a rather
> straight-forward board with SPI-NOR, creating a replacement loader is
> not hard (see uboot-mediatek package).

Thanks for this very convincing argument!

Attached is the full bootlog (serial console) of the device 
Archer C6U v1 (including DRAM/DDR3 calibration preamble)

But what still gives me hope, are the 
offset-addresses in the bootlog, e.g.:

# Booting image at bc04

this is decimal 3.154.378.752 - and:

# Load Address: 80001000

Both addresses are way bayond the 128k RAM border - maybe
i'am just calculating the ramoops-offset in a wrong way?

Thanks a lot & bye,
bastian
### serial console with 57600 baud:

===
MT7621   stage1 code Aug 28 2018 16:58:15 (ASIC)
CPU=5 HZ BUS=1 HZ
==
Change MPLL source from XTAL to CR...
do MEMPLL setting..
MEMPLL Config : 0x1110
3PLL mode + External loopback
=== XTAL-40Mhz === DDR-1200Mhz ===
PLL3 FB_DL: 0xe, 1/0 = 562/462 3900
PLL2 FB_DL: 0x14, 1/0 = 606/418 5100
PLL4 FB_DL: 0x18, 1/0 = 602/422 6100
do DDR setting..[01F4]
Apply DDR3 Setting...(use customer AC)
  08   16   24   32   40   48   56   64   72   80   88   96  104  
112  120
  

:|00000000000000
00
0001:|00000000000000
00
0002:|00000000000000
00
0003:|00000000000000
00
0004:|00000000000000
00
0005:|00000000000000
00
0006:|00000000000000
00
0007:|00000000000000
00
0008:|00000000000000
00
0009:|00000000000000
00
000A:|00000000000000
00
000B:|00000000000000
00
000C:|00000000000000
00
000D:|00000000000001
11
000E:|00000001111111
11
000F:|00111111111100
00
0010:|11111110000000
00
0011:|11000000000000
00
0012:|00000000000000
00
0013:|00000000000000
00
0014:|00000000000000
00
0015:|00000000000000
00
0016:|00000000000000
00
0017:|00000000000000
00
0018:|00000000000000
00
0019:|00000000000000
00
001A:|00000000000000
00
001B:|00000000000000
00
001C:|00000000000000
00
001D:|00000000000000
00
001E:|00000000000000
00
001F:|00000000000000
00
DRAMC_DQSCTL1[0e0]=1300
DRAMC_DQSGCTL[124]=8033
rank 0 coarse = 15
rank 0 fine = 56
B:|000000001110000  
  0
opt_dle value:9
DRAMC_DDR2CTL[07c]=C287221D
DRAMC_PADCTL4[0e4]=22B3
DRAMC_DQIDLY1[210]=0E0F0B0F
DRAMC_DQIDLY2[214]=0C0F0D0E
DRAMC_DQIDLY3[218]=0B0B090B
DRAMC_DQIDLY4[21c]=0A0B0C09
DRAMC_R0DELDLY[018]=1F1F
=

howto support ramoops (former crashlog.o)

2022-08-23 Thread Bastian Bittorf
I'am trying to add ramoops support for a specific mediatek model.
There are alreay a few commit regarding this, but i'am not apply
to harvest a crashlog after a crash-reboot.

# openwrt$ git grep "ramoops@"
package/boot/uboot-mediatek/patches/050-mt7622-enable-pstore.patch:+ 
ramoops@42ff {
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nighthawk.dtsi: 
ramoops@4210 {
target/linux/mediatek/patches-5.15/105-dts-mt7622-enable-pstore.patch:+ 
ramoops@42ff {

This looks good, e.g. 0x42ff = the upper 48 Megabyte minus 64k
My Router Archer C6U v1 has 128mb RAM, so i go for:

128 * 1024 * 1024 = 134217728 = 0x800,  
substracting 0x1 = 0x7ff - so my dts-patch looks like:


+reserved-memory {
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   /* 64 KiB reserved for ramoops/pstore */
+   ramoops@7ff {
+   compatible = "ramoops";
+   reg = <0 0x7ff 0 0x1>;
+   record-size = <0x1000>;
+   };   
+};


It builds and the running image has 'pstore' automatically mounted,
and the kernelmodule loads, and is visible in device-tree:

root@box:~ hexdump -C /proc/device-tree/reserved-memory/ramoops@7ff/reg
  00 00 00 00 07 ff 00 00  00 00 00 00 00 01 00 00  ||
0010
root@box:~ hexdump -C 
/proc/device-tree/reserved-memory/ramoops@7ff/record-size
  00 00 10 00   ||
0004
root@box:~ mount | grep pstore
pstore on /sys/fs/pstore type pstore (rw,noatime)
root@box:~ lsmod | grep pstore
pstore  9910  1 

but when crashing the kernel with: echo 'c' >/proc/sysrq-trigger
the store is always empty:

root@box:~ ls -l /sys/fs/pstore/

Has anyone succeeded and has maybe a hint for me?

bye, bastian


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


FS#4118 - "logread" crashes sometimes #9100

2022-08-16 Thread Bastian Bittorf
I just want to mention a longstanding segfault-issue,  
which one can now reproduce with an x86-snapshot-image.  

Maybe somebody has time to look into this core building block:
https://github.com/openwrt/openwrt/issues/9100

thanks && bye,
bastian

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


Re: mt7915e in mt7621 - Failed to get patch semaphore

2021-12-19 Thread Bastian Bittorf
On Sat, Dec 18, 2021 at 01:21:21PM +0100, Janusz Dziedzic wrote:
> Hello,
> 
> Have mt7915e in my mt7621 router (pandora box/ramips).

the same here with 'TP-LINK Archer C6U' (also ramips)
(but since a long time and maybe forever).

bye, Bastian

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


Re: [RFC] Stop providing binary package updates for release builds?

2021-12-13 Thread Bastian Bittorf
On Sun, Dec 12, 2021 at 08:42:52PM +0100, Jo-Philipp Wich wrote:
>  - Stop providing binary package updates; build release images and associated
>repositories once only, archive the artifacts and redelegate build
>resources back to master snapshots

This!
If people are interested in providing binary-updates
(e.g. for their community) it's up to them.

Bastian

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


Re: ath79 / TP-Link CPE510 / tftp: recovery.bin

2021-11-12 Thread Bastian Bittorf
On Fri, Nov 12, 2021 at 11:12:03AM +0100, Vincent Wiemann wrote:
> > Press CTRL+B to enter SafeLoader: 1
> 
> Have you tried that?

yes, after this it asks for a password, which is not
'admin' or 'Admin' or 'tpl'...

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


ath79 / TP-Link CPE510 / tftp: recovery.bin

2021-11-12 Thread Bastian Bittorf
After flashing trunk to some devices, i'am affected
from the lzma-loader/GCC11 issue. It was possible in
the past to use the standard recovery procedure, but
it seems NOT possible anymore, maybe because of
the changed partition layout?

The bootloader says:
Incorrect File.
Writting error.

Anyway: does somebody know how to access the bootloader?
The password 'admin' or 'tpl' is not accepted and
images are also not accepted.

I'am happy for any hint - thanks a lot,
bye, bastian!




TP-LINK SafeLoader (Build time: Jun 12 2015 - 09:49:53)
CPU: 560MHz AHB: 225MHz DDR: 64MB
Performing LED check..  PASS
Press CTRL+B to enter SafeLoader: 1
Flash Manufacturer: Unknown(0xc8)
Flash Device ID: Unknown(0x4017)
Data flash init failed.
open user-config failed.
open user-config failed.
Error: Kernel did not takeover charge of WatchDog last time!

enet0 port4 up

TFTP server address is 192.168.0.100; our address is 192.168.0.254
Get filename 'recovery.bin'.
#
#
Done.
Bytes transferred = 5204617, 1373 Kbytes/sec
Incorrect File.
Writting error.
Allocated memory for elf segment ok: addr: 0x8006, size 0x16cc
Loading .text @ 0x8006 (5836 bytes)

Starting kernel



OpenWrt kernel loader for AR7XXX/AR9XXX
Copyright (C) 2011 Gabor Juhos 
Looking for OpenWrt image... found at 0xbf043000
Decompressing kernel... 

(hangs here)

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


Problem: dnsmasq.init / dhcp-user-script not executed

2021-11-10 Thread Bastian Bittorf
Introduced with:

---
commit 8b486ec2b52056b737a4ce64a2040a9a27a6bd60
Author: Hans Dedecker 
Date:   Fri Jun 9 16:24:12 2017 +0200

dnsmasq: add dhcp-script hook conditionally
---

breaks parsing of user provided dhcp-script for me:

uci set dhcp.@dnsmasq[0].dhcpscript='/etc/dhcp-script.d/10dhcpscript'
/etc/init.d/dnsmasq restart

but in generated configfile we always have the default:
/usr/lib/dnsmasq/dhcp-script.sh

A fix in line 994 of package/network/services/dnsmasq/files/dnsmasq.init can be:

config_get user_dhcpscript $cfg dhcpscript
  if has_handler || [ -n "$user_dhcpscript" ]; then
  xappend "--dhcp-script=$DHCPSCRIPT"

TO:

config_get user_dhcpscript $cfg dhcpscript
  if has_handler || [ -n "$user_dhcpscript" ]; then
  xappend "--dhcp-script=$user_dhcpscript"

but maybe this breaks the default script?!

bye, Bastian

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


Re: warning about which deprecated

2021-11-07 Thread Bastian Bittorf
On Sun, Nov 07, 2021 at 10:25:48PM -0800, Rosen Penev wrote:
> > > Should we consider building it as a toolchain tool or should we migrate to
> > > command -v ?
> > https://github.com/openwrt/openwrt/commit/1f5e7224868109a170a9248d18f8d2b6124e9c5a
> Wonder if switching command -v to type -a -p makes sense.

Is seems to be not portable using '-a -p':

At least it is also POSIX and builtin:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/type.html
(but no commandline switches!)

it works the way you describe it on debian,
but not on e.g. OpenWRT:

root@F36-stube:~ ls -l /bin/foo /usr/sbin/foo
-rwxr-xr-x1 root root16 Nov  8 08:31 /bin/foo
-rwxr-xr-x1 root root16 Nov  8 08:31 /usr/sbin/foo

user@box:~ which -a foo
/usr/sbin/foo
/bin/foo
/usr/sbin/foo

root@F36-stube:~ type -a -p foo
/usr/sbin/foo
# here the returncode is != 0

bye, bastian

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


wget: limit downloaded bytes problem

2021-11-05 Thread Bastian Bittorf
With OpenWRT master and busybox v1.34.1 (musl-1.2.2),
but also with older busybox v1.26.2 (musl-1.1.16),
I see these issues with wget:

# on server:
dd if=/dev/urandom of=/var/www/random.bin bs=513 count=1

# on OpenWRT/client: limit downloaded bytes:
wget -O - http://intercity-vpn.de/random.bin | head -c 10 >/tmp/part
(hangs/connection times out)
 ^

The interesting things are:
1) sometimes it works
2) no problem with files =< 512 bytes

i tried it with different architectures:
OK: mipsel_24kc / ramips (Archer C6U)
problem: x86_64 (qemu)
problem: mips_24kc (TP-Link 4300)
problem: ppc/powerpc_8540 (TP-Link 4900)
problem: arm_arm1176jzf-s_vfp = bcm2708/armv6l/RaspPiZero

using GCC8 or GCC11 makes no difference.
using 'curl' instead of wget works without issues.

A selfcompiled static musl-busybox + qemu x86_64 has no issues.

Can somebody confirm this?
Has somebody an idea why i can see this only on OpenWRT?

bye, Bastian


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


Re: [PATCH] dnsmasq: procd-ujail: workaround startup failure, when leasefile location is in /tmp

2021-10-19 Thread Bastian Bittorf
On Mon, Oct 18, 2021 at 10:20:56AM +0100, Daniel Golle wrote:
> On Mon, Oct 18, 2021 at 08:12:00AM +0000, Bastian Bittorf wrote:

[...]

> > This is v2 of the patch with a more correct description what is does.
> > 
> > Ref: https://bugs.openwrt.org/index.php?do=details&task_id=4085
> > Suggested-by: Daniel Golle 
> 
> I have neither Ack-ed nor suggested this change.

I'am sorry about the confusion:

I troubleshooted together with Daniel the issue
and he proposed a change which i did unterstood in a wrong way,
hence the situation. Sorry about that. Finally the underlying issue
was even another thing, so I will bring up another patch,
so please ignre the patch v2 too.

bye, bastian

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


[PATCH] dnsmasq: procd-ujail: workaround startup failure, when leasefile location is in /tmp

2021-10-18 Thread Bastian Bittorf
introduced with 44f694ba1bca1417d24e851c637c284f9f78c06d
("build: select procd-ujail if !SMALL_FLASH") dnsmasq fails
to startup when the leasefile is configured to be in /tmp,
which is just not suited for beeing a jail location.

With this patch we explicit call jail_mount_rw() for the
(now autocreated) leasedir and show a warning in syslog
for the special case when leasefile is in directory /tmp

without this patch, the syslog shows:
Thu Oct 14 18:32:38 2021 user.err : jail: 
creat(/tmp/ujail-lhNbFK/tmp/dhcp.leases) failed: Read-only file system
Thu Oct 14 18:32:38 2021 daemon.crit dnsmasq[1]: cannot open or create lease 
file /tmp/dhcp.leases: Read-only file system
Thu Oct 14 18:32:38 2021 daemon.crit dnsmasq[1]: FAILED to start up

This is v2 of the patch with a more correct description what is does.

Ref: https://bugs.openwrt.org/index.php?do=details&task_id=4085
Suggested-by: Daniel Golle 
Signed-off-by: Bastian Bittorf 
---
 .../services/dnsmasq/files/dnsmasq.init   | 19 ---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/package/network/services/dnsmasq/files/dnsmasq.init 
b/package/network/services/dnsmasq/files/dnsmasq.init
index 3250b2179b..af2effdb26 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -616,7 +616,7 @@ dhcp_add() {
 
case $ra_management in
0)
-   # SLACC with DCHP for extended options
+   # SLACC with DHCP for extended options
xappend 
"--dhcp-range=$nettag::,constructor:$ifname,ra-stateless,ra-names"
;;
2)
@@ -816,7 +816,7 @@ dnsmasq_start()
 {
local cfg="$1"
local disabled user_dhcpscript
-   local resolvfile resolvdir localuse=0
+   local resolvfile resolvdir leasedir localuse=0
 
config_get_bool disabled "$cfg" disabled 0
[ "$disabled" -gt 0 ] && return 0
@@ -994,7 +994,11 @@ dnsmasq_start()
fi
 
config_get leasefile $cfg leasefile "/tmp/dhcp.leases"
-   [ -n "$leasefile" ] && [ ! -e "$leasefile" ] && touch "$leasefile"
+   [ -n "$leasefile" ] && {
+   leasedir="$( dirname "$leasefile" )" && mkdir -p "$leasedir"
+   [ ! -e "$leasefile" ] && touch "$leasefile"
+   }
+
config_get_bool cachelocal "$cfg" cachelocal 1
 
config_get_bool noresolv "$cfg" noresolv 0
@@ -1154,6 +1158,15 @@ dnsmasq_start()
procd_add_jail_mount $EXTRA_MOUNT $RFC6761FILE $TRUSTANCHORSFILE
procd_add_jail_mount $dnsmasqconffile $dnsmasqconfdir $resolvdir 
$user_dhcpscript
procd_add_jail_mount /etc/passwd /etc/group /etc/TZ /etc/hosts 
/etc/ethers
+
+   [ -d "$leasedir" ] && {
+   [ "$leasedir" = '/tmp' ] && {
+   logger -t dnsmasq \
+   "consider using a more private directory for 
leasefile" \
+   "because jailing /tmp does not work: choose 
e.g. /tmp/dnsmasq/leasefile"
+   }
+   procd_add_jail_mount_rw $leasedir
+   }
procd_add_jail_mount_rw /var/run/dnsmasq/ $leasefile
 
procd_close_instance
-- 
2.30.2


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


Re: [PATCH] dnsmasq: procd-ujail: workaround startup failure, when leasefile location is in /tmp

2021-10-17 Thread Bastian Bittorf
On Sun, Oct 17, 2021 at 05:45:19PM +0100, Daniel Golle wrote:
> > +   "because jailing /tmp does not work: choose 
> > e.g. /tmp/dnsmasq/leasefile"
> > +   }
> To do what you describe in the commit message it would be
> } else {
> 
> I'm fine with either, just the commit message should match the code...
>

sorry, will do that and resend.
please ignore this patch for now.

thanks & bye, bastian

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


[PATCH] dnsmasq: procd-ujail: workaround startup failure, when leasefile location is in /tmp

2021-10-17 Thread Bastian Bittorf
introduced with 44f694ba1bca1417d24e851c637c284f9f78c06d
("build: select procd-ujail if !SMALL_FLASH") dnsmasq fails
to startup when the leasefile is configured to be in /tmp,
which is just not suited for beeing a jail location.

Workaround this (no jailing for this file for this special case)
and show a proper information in syslog.

without this patch, the syslog shows:
Thu Oct 14 18:32:38 2021 user.err : jail: 
creat(/tmp/ujail-lhNbFK/tmp/dhcp.leases) failed: Read-only file system
Thu Oct 14 18:32:38 2021 daemon.crit dnsmasq[1]: cannot open or create lease 
file /tmp/dhcp.leases: Read-only file system
Thu Oct 14 18:32:38 2021 daemon.crit dnsmasq[1]: FAILED to start up

Ref: https://bugs.openwrt.org/index.php?do=details&task_id=4085
Acked-by: Daniel Golle 
Signed-off-by: Bastian Bittorf 
---
 .../services/dnsmasq/files/dnsmasq.init   | 19 ---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/package/network/services/dnsmasq/files/dnsmasq.init 
b/package/network/services/dnsmasq/files/dnsmasq.init
index 3250b2179b..af2effdb26 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -616,7 +616,7 @@ dhcp_add() {
 
case $ra_management in
0)
-   # SLACC with DCHP for extended options
+   # SLACC with DHCP for extended options
xappend 
"--dhcp-range=$nettag::,constructor:$ifname,ra-stateless,ra-names"
;;
2)
@@ -816,7 +816,7 @@ dnsmasq_start()
 {
local cfg="$1"
local disabled user_dhcpscript
-   local resolvfile resolvdir localuse=0
+   local resolvfile resolvdir leasedir localuse=0
 
config_get_bool disabled "$cfg" disabled 0
[ "$disabled" -gt 0 ] && return 0
@@ -994,7 +994,11 @@ dnsmasq_start()
fi
 
config_get leasefile $cfg leasefile "/tmp/dhcp.leases"
-   [ -n "$leasefile" ] && [ ! -e "$leasefile" ] && touch "$leasefile"
+   [ -n "$leasefile" ] && {
+   leasedir="$( dirname "$leasefile" )" && mkdir -p "$leasedir"
+   [ ! -e "$leasefile" ] && touch "$leasefile"
+   }
+
config_get_bool cachelocal "$cfg" cachelocal 1
 
config_get_bool noresolv "$cfg" noresolv 0
@@ -1154,6 +1158,15 @@ dnsmasq_start()
procd_add_jail_mount $EXTRA_MOUNT $RFC6761FILE $TRUSTANCHORSFILE
procd_add_jail_mount $dnsmasqconffile $dnsmasqconfdir $resolvdir 
$user_dhcpscript
procd_add_jail_mount /etc/passwd /etc/group /etc/TZ /etc/hosts 
/etc/ethers
+
+   [ -d "$leasedir" ] && {
+   [ "$leasedir" = '/tmp' ] && {
+   logger -t dnsmasq \
+   "consider using a more private directory for 
leasefile" \
+   "because jailing /tmp does not work: choose 
e.g. /tmp/dnsmasq/leasefile"
+   }
+   procd_add_jail_mount_rw $leasedir
+   }
procd_add_jail_mount_rw /var/run/dnsmasq/ $leasefile
 
procd_close_instance
-- 
2.30.2


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


Re: uml: drop target

2021-10-14 Thread Bastian Bittorf
On Sun, Oct 10, 2021 at 12:23:16PM -0400, Michael Richardson wrote:
> I haven't used the UML target in the past year, but I have used it a lot
> before.
> The ability to do hostfs mounts is very nice.
> If it went away, I'd be sad, it's not a disaster as you say.

I'am also an infrequent user. I do not see an issue
for the moment, it compiles and runs just fine:

bastian@ubuntu:~/software/openwrt$ bin/targets/uml/generic/openwrt-uml-vmlinux 
ubd0=bin/targets/uml/generic/openwrt-uml-squashfs.img 
eth8=tuntap,,,192.168.0.254
Core dump limits :
soft - 0
hard - NONE
Checking that ptrace can change system call numbers...OK
Checking syscall emulation patch for ptrace...OK
Checking advanced syscall emulation patch for ptrace...OK
Checking environment variables for a tempdir...none found
Checking if /dev/shm is on tmpfs...OK
Checking PROT_EXEC mmap in /dev/shm...OK
Adding 19591168 bytes to physical memory to account for exec-shield gap
[0.00] Linux version 5.4.152 (bastian@ubuntu) (gcc version 10.2.0 
(Ubuntu 10.2.0-13ubuntu1)) #0 Thu Oct 14 17:40:03 2021
[0.00] Built 1 zonelists, mobility grouping on.  Total pages: 12772
[...]

root@OpenWrt:/ :) cat /proc/cpuinfo 
processor   : 0
vendor_id   : User Mode Linux
model name  : UML
mode: skas
host: Linux ubuntu 5.8.0-25-generic #26-Ubuntu SMP Thu Oct
15 10:30:38 UTC 2020 x86_64
bogomips: 3321.03

root@OpenWrt:/ :) cat /etc/openwrt_release 
DISTRIB_ID='OpenWrt'
DISTRIB_RELEASE='SNAPSHOT'
DISTRIB_REVISION='r17755+24-0eed96ca5d'
DISTRIB_TARGET='uml/generic'
DISTRIB_ARCH='x86_64'
DISTRIB_DESCRIPTION='OpenWrt SNAPSHOT r17755+24-0eed96ca5d'
DISTRIB_TAINTS='no-all busybox'


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


Re: WDS stopped working in 21.02, looking for bug in netifd

2021-09-23 Thread Bastian Bittorf
On Thu, Sep 23, 2021 at 03:17:15PM +0200, Daniel Haid wrote:
> Is there any way to dump a detailed state of the wlan driver in the kernel?
> Or the state of netifd? Sould I enable some debug options?

at least you can try to debug with 2 terminals an running:

iw event
ip monitor

bye, Bastian

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


Re: WDS stopped working in 21.02, looking for bug in netifd

2021-09-22 Thread Bastian Bittorf
On Wed, Sep 22, 2021 at 06:12:13PM +0200, Daniel Haid wrote:
> Another update:

can you please add this function ontop of
/lib/netifd/wireless/mac80211.sh

#!/bin/sh
iw() { local rc; command iw "$@"; rc=$?; echo "rc:$rc | iw $*" >>/tmp/foo; test 
$rc -eq 0 || command iw "$@" 2>>/tmp/foo; return $rc; }

After booting the file '/tmp/foo' looks like:
###
rc:0 | iw dev wlan1 del
rc:0 | iw dev wlan0 del
rc:0 | iw phy1 info
rc:0 | iw phy0 info
rc:0 | iw reg get
rc:0 | iw reg set US
rc:0 | iw reg get
rc:0 | iw reg set US
rc:0 | iw phy phy1 set antenna 0x 0x
rc:0 | iw phy phy1 set antenna_gain 0
rc:0 | iw phy phy1 set distance 0
rc:0 | iw phy phy1 set txpower auto
rc:0 | iw phy phy1 info
rc:134 | iw phy phy0 set antenna 0x 0x
command failed: Not supported (-122)
rc:0 | iw phy phy0 set antenna_gain 0
rc:0 | iw phy phy1 info
rc:0 | iw phy phy0 set distance 100
rc:0 | iw phy phy0 set txpower fixed 2300
rc:0 | iw phy phy0 info
rc:0 | iw phy phy0 interface add wlan0 type adhoc
rc:0 | iw phy phy1 interface add wlan1 type __ap
rc:0 | iw phy phy0 interface add wlan0-1 type __ap
rc:0 | iw dev wlan0 ibss join ffintern.2GHz 2432 HT20 fixed-freq 
02:ca:ff:ee:ba:be beacon-interval 250 basic-rates 6,12,24 mcast-rate 6
###

Please send a good and a bad case, or ignore if the error is deeper.

bye, Bastian

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


[PATCH] mac80211: fix IBSS/adhoc mode for brcmfmac (e.g. Raspberry Pi Zero W)

2021-09-19 Thread Bastian Bittorf
without this fix, the final setup-call:
iw dev wlan0 ibss join ...

fails with returncode 161 and message:
"command failed: Not supported (-95)"

So this patch calls an explicit:
iw dev wlan0 set type ibss
just prior to the 'ibss join' command.

I have tested several ath9k and mt76xx devices
with different revisions: this patch does not harm.

please also apply to stable branch.

Signed-off-by: Bastian Bittorf 
---
 package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh 
b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
index 4574a9881a..7d2ac48dae 100644
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -860,6 +860,7 @@ mac80211_setup_adhoc() {
mcval=
[ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval "$mcast_rate"
 
+   iw dev "$ifname" set type ibss
iw dev "$ifname" ibss join "$ssid" $freq $iw_htmode fixed-freq $bssid \
beacon-interval $beacon_int \
${brstr:+basic-rates $brstr} \
-- 
2.27.0


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


Re: [PATCH v2] vxlan: allow for dynamic source ip selection

2020-11-27 Thread Bastian Bittorf
On Tue, Nov 24, 2020 at 04:26:29AM +0100, Johannes Kimmel wrote:
> Fixes: FS#3426
> Ref: https://bugs.openwrt.org/index.php?do=details&task_id=3426
> 
> V2:
>   - bump PKG_RELEASE
>   - add small explaination about behaviour changes
> 
> Signed-off-by: Johannes Kimmel 

Tested-by: Bastian Bittorf 

works here with the

option ipaddr auto
or
empty case

Bravo!
This indeed fixes above ticket 3426

bye, Bastian

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


Re: [OpenWrt-Devel] [PATCH][CC] Revert "ar71xx: change some TP-link modelnames (WR841, WA701, WA730)"

2016-04-26 Thread Bastian Bittorf
* Sven Roederer  [27.04.2016 08:30]:
> So finally, as this change will come, so it comes already inside this release 
> and some derived projects also adapted the change.

We also adapted this change and it makes the world better.

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


Re: [OpenWrt-Devel] [PATCH][CC] Revert "ar71xx: change some TP-link modelnames (WR841, WA701, WA730)"

2016-04-24 Thread Bastian Bittorf
* John Crispin  [25.04.2016 07:39]:
> > The changed image name breaks compatibility for derived projects and
> > that's something which should only happen if there is a really good
> > reason (e.g. security fix).
> 
> how does it beak compatibility ?

I think they auto-download a preconfigured filename,
which will ofcource not succeed. We circumvented this in our
network-autoupdater in a way, that we download e.g. "$MODELNAME.bin"
where $MODELNAME is from '/tmp/sysinfo/model' e.g. 'TP-Link TL-WDR4900 v1'
and on the downloadserver we can "adjust" the symlinks...

I'am against reverting the commit. Lets keep it, because it makes sense.

Maybe i can give a short talk at Battlemesh v9 about proper autoupdates,
because we have ~10 years experience in this (including 500 dead devices
8-)))

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


Re: [OpenWrt-Devel] Sha256 checksum generation of images: why OpenSSL instead of sha256sum?

2016-03-22 Thread Bastian Bittorf
* Stijn Segers  [22.03.2016 08:47]:
> Is there a specific reason why OpenSSL is used instead of sha256sum?

it's all about portability. OpenSSL is widely available, and sha256 not.
maybe you can 'sanitize' the output somehow?

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


Re: [OpenWrt-Devel] new kernel 4.1.20 / jffs-deadlock fix

2016-03-19 Thread Bastian Bittorf
* Sedat Dilek  [18.03.2016 13:33]:
> Just FYI...
> 
> "jffs2: Fix page lock / f->sem deadlock" see [1].
> 
> - Sedat -
> 
> [1] 
> http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/?h=v4.1.20&id=e0dae728bf0878ad831440ff5d2e90ec10b794a4

yes, we can cherry pick them...but...a kernel
version bump is better...

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


Re: [OpenWrt-Devel] new kernel 4.1.20 / jffs-deadlock fix

2016-03-19 Thread Bastian Bittorf
* Sedat Dilek  [18.03.2016 13:33]:
> On Fri, Mar 18, 2016 at 8:42 AM, Bastian Bittorf  
> wrote:
> > maybe someone has the power to bump
> > kernel 4.1.x to 4.1.20 - it has in
> > jffs2-deadlock fix...
> >
> > does somebody already working or on the schedule?

done! - thanks Hauke (for r49035).

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


[OpenWrt-Devel] new kernel 4.1.20 / jffs-deadlock fix

2016-03-19 Thread Bastian Bittorf
maybe someone has the power to bump
kernel 4.1.x to 4.1.20 - it has in
jffs2-deadlock fix...

does somebody already working or on the schedule?

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


Re: [OpenWrt-Devel] Question regarding call python script

2016-03-14 Thread Bastian Bittorf
* Jason Wu  [14.03.2016 07:39]:
> Just to be sure, are you saying that we should also avoid indexed
> array in bash? It is possible to create n-dimensional arrays with
> indexed array. The main reason for this is to be sure that I am on
> the right track.

"Complexity is a cost, spend it wisely."

ofcourse it depends on your usecase. I'am really not in
the position to decide anything, but if you ask me:
stick to portable constructs...

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


Re: [OpenWrt-Devel] Question regarding call python script

2016-03-13 Thread Bastian Bittorf
* Karl Palsson  [13.03.2016 10:00]:
> > array_set "test" 7
> > array_get 7
> > 
> > or for 2-dimensional arrays:
> > array_set "2dim" 3 14
> > array_get 3 14
> 
> You know, this is _exactly_ why people want to use python or even
> perl instead of bash/awk/sed.
> 
> This is a great, wonderful solution if you _must_ use posix
> shell. But do we?

Yes, we do.
In terms of "this does not look nice and elegant" you are right:

Using n-dimensional arrays in build scripts is
a rare usecase. you can easily switch to AWK if this
fits more. But using Perl or Python should be avoided,
because it adds more complexity to the dependencies
and leads to more headache when maintaining:

Perl and Python are not well defined and all sorts
of things are breaking. (if not tomorrow, then next week...)

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


Re: [OpenWrt-Devel] Question regarding call python script

2016-03-11 Thread Bastian Bittorf
* Paul Fertser  [11.03.2016 11:15]:
> As a sidenote, POSIX shell doesn't support associative arrays (which
> were mentioned in this thread), so it's probably worth clarifying
> whether it's ok to require bash >= 4 for OpenWrt build scripts or not.

yes, POSIX is "missing" some goodies of a full bash but:

"Stick to portable constructs where possible, and
 you will make somebody's life easier in the future.
 Maybe your own."

For all things you can use a workaround.
So, if you need an array e.g.

foo[7]=bar

for e.g. easy iterating over it? use e.g. this approach:

array_put()
{
local message="$1"
local dim1="$2"
local dim2="$3"

eval ${ARRAYNAME:-default}_${dim1}_${dim2}='$message'
}

array_get()
{
local dim1="$1"
local dim2="$2"
local var

eval var="\"\${${ARRAYNAME:-default}_${dim1}_${dim2}:-unset}\""
echo "$var"
}

array_set "test" 7
array_get 7

or for 2-dimensional arrays:
array_set "2dim" 3 14
array_get 3 14

you can simplify this by removing dim2 and ARRAYNAME if this is too much.

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


Re: [OpenWrt-Devel] Question regarding call python script

2016-03-10 Thread Bastian Bittorf
* John Crispin  [11.03.2016 06:27]:
> depends on what you want to do. i dont really see anything that cannot
> be handled using shell. what exactly do you want to write in python ?

also in general i think it's a good idea to have
less dependency than more. personally 8-) i want to
see perl and awk abandoned...

(perl is a deb for the kernel itself, but there are
patches to circumvent this. awk is mostly used for
e.g. command | awk $print_first_word - but 'awk' is
posix, so we have it anyway 8-))

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


Re: [OpenWrt-Devel] [musl] regex issue / asterisk / musl / sed

2016-03-01 Thread Bastian Bittorf
* Szabolcs Nagy  [29.02.2016 20:35]:
> a possible fix is attached, the handling of ^ and $
> in BRE is suboptimal, but that will need a bigger
> refactoring.

thank you, fixes it for me on x86/UML and MIPS/ar71xx.

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


[OpenWrt-Devel] regex issue / asterisk / musl / sed

2016-02-29 Thread Bastian Bittorf
dear hackers,

i cannot find any former issue with that,
but want to document this here. I spotted
an issue in one of our scripts and it boils down to:

root@box:~ echo 'o*o' | sed -e 's/*/asterisk/g'
sed: bad regex '*': Invalid regexp
root@box:~ echo 'o*o' | sed -e 's/\*/asterisk/g'
oasterisko

it's musl 1.1.14 on OpenWrt / r48814
both commands are working fine with glibc and uclibc
but the first invokation fails with musl 1.1.14 but
works with musl 1.1.13. unsre if the prob is on my
side, maybe $you have an idea...

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


Re: [OpenWrt-Devel] [EXPERIMENTAL] [PATCH] package/utils/busybox: Make busybox /bin /sbin so full first in /usr/bin /usr/sbin

2016-02-22 Thread Bastian Bittorf
* open...@daniel.thecshore.com  [22.02.2016 
09:50]:
>   install_bin /bin/busybox /bin/ash /bin/sh /bin/mount /bin/umount
> \
>   /sbin/pivot_root /sbin/reboot /bin/sync /bin/dd /bin/grep   
> \
> - /bin/cp /bin/mv /bin/tar /usr/bin/md5sum "/usr/bin/[" /bin/dd   
> \
> - /bin/vi /bin/ls /bin/cat /usr/bin/awk /usr/bin/hexdump  
> \
> - /bin/sleep /bin/zcat /usr/bin/bzcat /usr/bin/printf /usr/bin/wc 
> \
> - /bin/cut /usr/bin/printf /bin/sync /bin/mkdir /bin/rmdir
> \
> - /bin/rm /usr/bin/basename /bin/kill /bin/chmod
> + /bin/cp /bin/mv /bin/tar /bin/md5sum "/bin/[" /bin/dd   \
> + /bin/vi /bin/ls /bin/cat /bin/awk /bin/hexdump  \
> + /bin/sleep /bin/zcat /bin/bzcat /bin/printf /bin/wc \
> + /bin/cut /bin/printf /bin/sync /bin/mkdir /bin/rmdir\
> + /bin/rm /bin/basename /bin/kill /bin/chmod

while looking at this list, we should avoid to 
copy shell "builtins" applets: it's just unneeded.

printf, [ and kill

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


Re: [OpenWrt-Devel] erro compiling 'master' with musl

2016-02-17 Thread Bastian Bittorf
* Bastian Bittorf  [12.02.2016 11:12]:
> as far as i read we should replace the 
> 
> #ifdef __linux__
> with
> #ifdef __GLIBC__

any opinions about that?
so should i send a proper patch to ML?

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


Re: [OpenWrt-Devel] [PATCH] dropbear: fix forever hanging startup when jffs2 fails to mount

2016-02-17 Thread Bastian Bittorf
* John Crispin  [16.02.2016 18:39]:
> > root@OpenWrt:~ mv -f /tmp/dropbear/dropbear_* /etc/dropbear/
> > mv: can't remove '/etc/dropbear/dropbear_rsa_host_key': Read-only file 
> > system
> 
> this is really only fighting the symptoms. we dont really want to have
> all scripts be aware of and handle full flash. i am not sure this is the
> right approach to use.

i also want to point out, that 'fstools' (mount_root) needs
first a fix, so that we can see what is the underlying issue:
why mounting jffs2 fails. related:

https://dev.openwrt.org/ticket/21786

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


Re: [OpenWrt-Devel] [PATCH] dropbear: fix forever hanging startup when jffs2 fails to mount

2016-02-16 Thread Bastian Bittorf
* John Crispin  [16.02.2016 18:39]:
> > fix that by using 'mv -f' which omits the interactive question:
> > 
> > root@OpenWrt:~ mv -f /tmp/dropbear/dropbear_* /etc/dropbear/
> > mv: can't remove '/etc/dropbear/dropbear_rsa_host_key': Read-only file 
> > system
> > 
> 
> this is really only fighting the symptoms. we dont really want to have
> all scripts be aware of and handle full flash. i am not sure this is the
> right approach to use.

i agree, that this is not elegant but:

without this patch the box keeps unreachable because
dropbear does NOT start - so the only chance to get a
working router back is to solder a serial console.
failsafe is also broken.

i dont think there is a good way for making sure if
moving a file to a target *will* succeed 8-) so at
least we should fail and go further (= start the daemon)
instead of hanging forever.

i tested ALL init-scripts in this stage (jffs2 mounted
readonly) and this is the only one which hangs. so this
is at least a workaround for now...

another approach could be to simply let 'cp/rm/mv' fail if the
command is not invoked interactive, but it sounds somehow special
and we should stick to POSIX...

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


[OpenWrt-Devel] [PATCH] dropbear: fix forever hanging startup when jffs2 fails to mount

2016-02-16 Thread Bastian Bittorf
if something goes wrong while mounting jffs2 (e.g. full flash
and the mount is readonly) the dropbear-init script will hang
forever (and so the startup-procedure) asking:

root@OpenWrt:~ /etc/init.d/dropbear boot
mv: overwrite '/etc/dropbear/dropbear_rsa_host_key'? 

fix that by using 'mv -f' which omits the interactive question:

root@OpenWrt:~ mv -f /tmp/dropbear/dropbear_* /etc/dropbear/
mv: can't remove '/etc/dropbear/dropbear_rsa_host_key': Read-only file system

so the startup can continue.

Signed-off-by: Bastian Bittorf 
---
 package/network/services/dropbear/files/dropbear.init | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/services/dropbear/files/dropbear.init 
b/package/network/services/dropbear/files/dropbear.init
index 03745c9..56565bd 100755
--- a/package/network/services/dropbear/files/dropbear.init
+++ b/package/network/services/dropbear/files/dropbear.init
@@ -100,7 +100,7 @@ keygen()
 
lock /tmp/.switch2jffs
mkdir -p /etc/dropbear
-   mv /tmp/dropbear/dropbear_* /etc/dropbear/
+   mv -f /tmp/dropbear/dropbear_* /etc/dropbear/
lock -u /tmp/.switch2jffs
chown root /etc/dropbear
chmod 0700 /etc/dropbear
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] erro compiling 'master' with musl

2016-02-12 Thread Bastian Bittorf
user@box:~/openwrt$ cat logs/package/feeds/routing/olsrd/compile.txt
make[4]: Entering directory 
`/home/bastian/openwrt/build_dir/target-mips_34kc_musl-1.1.12/olsrd-master'
[CC] src/main.c
src/main.c:48:22: fatal error: execinfo.h: No such file or directory
compilation terminated.
make[4]: *** [src/main.o] Error 1
make[4]: Leaving directory
`/home/bastian/openwrt/build_dir/target-mips_34kc_musl-1.1.12/olsrd-master'
make[3]: ***
[/home/bastian/openwrt/build_dir/target-mips_34kc_musl-1.1.12/olsrd-master/.built]
Error 2

this was introduced with 9e95a76e
execinfo.h is a GNU specific header, and doesn't exist under musl.

as far as i read we should replace the 

#ifdef __linux__
with
#ifdef __GLIBC__

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


Re: [OpenWrt-Devel] Patchwork patch state mysteriously changed to "Not applicable"

2016-02-12 Thread Bastian Bittorf
* Bob Ham  [12.02.2016 11:00]:
> now has the state of "Not applicable" but there are no comments and it
> doesn't say who changed the status.

what I see is, that
'luci-app-bmx6/files/usr/lib/lua/luci/model/cbi/bmx6/main.lua' is
at least does not belong to openwrt.git - you should send a pull-request
to the github/packages where luci-app-bmx6 is maintained.

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


Re: [OpenWrt-Devel] [PATCH] iproute2: ip_tiny.patch: Don't filter CAN support

2016-01-28 Thread Bastian Bittorf
* Pushpal Sidhu  [28.01.2016 11:06]:
> Adds < 4k to ipk.

can you explain your usecase?
how much does the binary grow?

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


Re: [OpenWrt-Devel] [PATCH v3] base-files: For sysfixtime use hwclock if RTC available

2016-01-28 Thread Bastian Bittorf
* Petr Štetiar  [28.01.2016 11:06]:
> Like following?
> 
>   deps_ok && $HWCLOCK -s -f $RTC_DEV && exit 0 && return 

just:
deps_ok && $HWCLOCK -s -f $RTC_DEV && return

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


Re: [OpenWrt-Devel] [PATCH] busybox: sysntpd - use NTP servers received via DHCP

2016-01-25 Thread Bastian Bittorf
* Amine Aouled Hamed  [25.01.2016 14:53]:
> So using the latest procd version,
> I added a simple logger message on top start_service() in sysntpd and added
> the triggers in service_triggers and to test I just unplugged and
> re-plugget my network cable and checked logread.
> Nothing shows up.

not every switchport is aware of un- or replug.
better wait for DHCP-lease timeout to check if it triggers.
(or do 'ifup lan')

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


Re: [OpenWrt-Devel] uclient-fetch & SSL WAS:Re: DD: CONFIG_BUSYBOX_DEFAULT_WGET is not set

2016-01-24 Thread Bastian Bittorf
* Martin Tippmann  [24.01.2016 09:10]:
> Sorry if I was not clear - I meant uclient-fetch not wget.

me too, i showed the link /bin/wget which *is* uclient-fetch

> # opkg list | grep uclient
> libuclient - 2016-01-21-b9808a8c3a8922ed8df4e6fe45848ac2e52f13be
> uclient-fetch - 2016-01-21-b9808a8c3a8922ed8df4e6fe45848ac2e52f13be

the same here.

i'am running olsrd-git and there where a lot of fixes regarding
the HTTP interface. i will try to downgrade and reproduce the issue.

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


Re: [OpenWrt-Devel] uclient-fetch & SSL WAS:Re: DD: CONFIG_BUSYBOX_DEFAULT_WGET is not set

2016-01-23 Thread Bastian Bittorf
* Martin Tippmann  [23.01.2016 14:23]:
> The daemon should work fine, at least curl and wget on Ubuntu handle it fine.

i cannot reproduce this here:

root@box:~ wget -qO - http://127.0.0.1:2006|wc -l
709
root@box:~ command -V wget
wget is a tracked alias for /bin/wget

(so it's working fine)
bye, bastian
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] DD: CONFIG_BUSYBOX_DEFAULT_WGET is not set

2016-01-22 Thread Bastian Bittorf
* John Clark  [22.01.2016 07:55]:
> Is it intentional that wget is not available by default in the

i just send a patch. thanks for spotting this.

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


[OpenWrt-Devel] [PATCH] base-files: fix sysupgrade 'wget' handling

2016-01-22 Thread Bastian Bittorf
with r48379 and r48386 the path of wget changed.
respect that and adjust the dirname.

this fixes #21680

Signed-off-by: Bastian Bittorf 
---
 package/base-files/files/lib/upgrade/common.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/lib/upgrade/common.sh 
b/package/base-files/files/lib/upgrade/common.sh
index 761b4c1..adf290c 100644
--- a/package/base-files/files/lib/upgrade/common.sh
+++ b/package/base-files/files/lib/upgrade/common.sh
@@ -48,7 +48,7 @@ supivot() { #  
 
 run_ramfs() { #  [...]
install_bin /bin/busybox /bin/ash /bin/sh /bin/mount /bin/umount
\
-   /sbin/pivot_root /usr/bin/wget /sbin/reboot /bin/sync /bin/dd   
\
+   /sbin/pivot_root /bin/wget /sbin/reboot /bin/sync /bin/dd   
\
/bin/grep /bin/cp /bin/mv /bin/tar /usr/bin/md5sum "/usr/bin/[" 
\
/bin/dd /bin/vi /bin/ls /bin/cat /usr/bin/awk /usr/bin/hexdump  
\
/bin/sleep /bin/zcat /usr/bin/bzcat /usr/bin/printf /usr/bin/wc 
\
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] DD: CONFIG_BUSYBOX_DEFAULT_WGET is not set

2016-01-21 Thread Bastian Bittorf
* John Clark  [22.01.2016 07:55]:
> Is it intentional that wget is not available by default in the
> current trunk?  I noticed this because /sbin/sysupgrade is failing in
> the current build of designated driver due to this.  I thought I
> would point it out.

yes, is was dropped with r48386 + 48379
so it *should* be automatically work with wget -> uclient-fetch

ah, i see - the link is wrong in /lib/upgrade/common.sh
was: /usr/bin/wget
should: /bin/wget

can you send a patch?

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


Re: [OpenWrt-Devel] netifd question

2016-01-21 Thread Bastian Bittorf
* Daniel Dickinson  [22.01.2016 07:55]:
> For a netifd protocol is there  way to tell netifd to *not*
> automatically try to restart the connection?

we have samething similar for PPPoE.

option 'authfail' '1'   # since r33291

check package/network/services/ppp/files/ppp.sh

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


Re: [OpenWrt-Devel] [PATCH 3/3] package/network/config/qos-scripts: Drop ifconfig and use ip command instead

2016-01-21 Thread Bastian Bittorf
* Daniel Dickinson  [22.01.2016 07:55]:
> >>-   export dev_${dir}="ifconfig $dev up txqueuelen 5 >&- 2>&-
> >>+   export dev_${dir}="ip link set $dev up txqueuelen 5 >&- 2>&-
> >This doesn't actually work...
> 
> Is it unsupported by busybox ip applet?  It is correct on fedora, but

seems like:

root@box:~ ip link set $WANDEV up txqueuelen 5
ip: either "dev" is duplicate, or "txqueuelen" is garbage

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


Re: [OpenWrt-Devel] [PATCH v3] base-files: For sysfixtime use hwclock if RTC available

2016-01-21 Thread Bastian Bittorf
* John Crispin  [21.01.2016 13:30]:
> hang on there, this looks like bastel basti scriptowahn

8-) but the 'exit VS. return' is valid...

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


Re: [OpenWrt-Devel] [PATCH v3] base-files: For sysfixtime use hwclock if RTC available

2016-01-21 Thread Bastian Bittorf
* Petr Štetiar  [21.01.2016 12:22]:
>  boot() {
> + [ -e "$RTC_DEV" ] && [ -e "$HWCLOCK" ] && $HWCLOCK -s -f $RTC_DEV && 
> exit 0

thank you! can you please do in this line a:
&& return

and introduce a helper (maybe overengineered 8-)

deps_ok() {
[ -e "$RTC_DEV" ] && [ -e "$HWCLOCK" ]
}

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


Re: [OpenWrt-Devel] [PATCH 1/3] package/network/utils/iproute: ip-full/busybox provides ip

2016-01-20 Thread Bastian Bittorf
* open...@daniel.thecshore.com  [21.01.2016 
07:06]:
> From: Daniel Dickinson 
> 
> Allow to use dependencies on 'ip' command without forcing a
> particular version by having ip-full and busybox (if ip
> applet enabled), as well as renamed ip package
> (to ip-tiny) all provides the ip virtual package.

this is a good thought, but the maintainer must make sure
that only the implemented subset of the busybox ip fits for
package X.

busybox:
ip { address | route | link | neigh | rule }

iproute2:
ip { link | address | addrlabel | route | rule | neighbor |ntable | tunnel | 
tuntap | maddress | mroute | mrule | monitor | xfrm | netns | l2tp | fou | 
tcp_metrics | token | netconf }

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


Re: [OpenWrt-Devel] [PATCH] package/config/netifd: Replace ifconfig/route with ip command

2016-01-20 Thread Bastian Bittorf
* open...@daniel.thecshore.com  [20.01.2016 
14:01]:
> +# From Bastian Bittorf 
> +# Included in this file to avoid dependencies
> +mask2cidr()

please drop the comment, thank you.

> +{
> + local x=${1##*255.}
> + local allones=$(( (${#1} - ${#x}) * 2 ))
> + local tbl='0^^^128^192^224^240^248^252^254^'
> +
> + x=${tbl%%${x%%.*}*}
> + CIDR=$(( allones + (${#x}/4) ))
> +}
> +
>  set_classless_routes() {
>   local max=128
> - local type
>   while [ -n "$1" -a -n "$2" -a $max -gt 0 ]; do
> - [ ${1##*/} -eq 32 ] && type=host || type=net
>   echo "udhcpc: adding route for $type $1 via $2"
> - route add -$type "$1" gw "$2" dev "$interface"
> + ip route add "$1" via "$2" dev "$interface"
>   max=$(($max-1))

please use max=$((max-1))
the '$' is unneeded (just style).

>  setup_interface() {
> - echo "udhcpc: ifconfig $interface $ip netmask ${subnet:-255.255.255.0} 
> broadcast ${broadcast:-+}"
> - ifconfig $interface $ip netmask ${subnet:-255.255.255.0} broadcast 
> ${broadcast:-+}
> + local CIDR
> +
> + mask2cidr ${subnet:-255.255.255.0}
> +
> + echo "udhcpc: ip address add $ip/${CIDR} ${broadcast:-+} dev $interface"
> + ip address add $ip/${prefix:-24} ${broadcast:-+} dev $interface"

a mistake: "add $ip/${prefix:-24} " -> "add $ip/$CIDR" like in the 'echo'

> @@ -41,7 +55,7 @@ setup_interface() {
>  applied=
>  case "$1" in
>   deconfig)
> - ifconfig "$interface" 0.0.0.0
> + ip -f inet addr flush dev "$interface"

during scripting i like to use '-family' which makes
it clearer for the unpractised reader. (so dont abbrev. 8-)

thank you!

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


Re: [OpenWrt-Devel] [PATCH] package/config/netifd: Replace ifconfig/route with ip command

2016-01-20 Thread Bastian Bittorf
* Daniel Dickinson  [20.01.2016 10:18]:
> >>+   local prefix="$(
> >>+   eval "$(ipcalc.sh 0.0.0.0 ${subnet:-255.255.255.0})"
> >>+   echo -n $PREFIX
> >
> >dont use '-n'
> 
> Why not?  It prevents echo from emitting an unwanted newline.

by the way:
is somebody fluent enough in AWK to fix this ipcalc-issue
https://dev.openwrt.org/ticket/20750

maybe i should ask 'TheMozg' 8-)
https://github.com/TheMozg/awk-raycaster

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


Re: [OpenWrt-Devel] [PATCH] package/config/netifd: Replace ifconfig/route with ip command

2016-01-20 Thread Bastian Bittorf
* Daniel Dickinson  [20.01.2016 10:18]:
> >>+   local prefix="$(
> >>+   eval "$(ipcalc.sh 0.0.0.0 ${subnet:-255.255.255.0})"
> >>+   echo -n $PREFIX
> >
> >dont use '-n'
> 
> Why not?  It prevents echo from emitting an unwanted newline.

it's not POSIX and really unneeded here (it does not matter for eval).
BTW: if you need this, use: printf '%s' "$string" or just: printf "$string"

> >>+   echo "udhcpc: ip address add $ip/${prefix:-24} ${broadcast:-+} dev 
> >>$interface"
> >>+   ip address add $ip/${prefix:-24} ${broadcast:-+} dev $interface"
> >
> >please dont double-fallback. It's ok to have it once default to 
> >'255.255.255.0',
> >so just use $prefix
> 
> The second fallback is in case the interpolation fails.

ok, i will not discuss this and accept.

> >>-   eval $(route -n | awk '
> >>-   /^0.0.0.0\W{9}('$valid_gw')\W/ {next}
> >>-   /^0.0.0.0/ {print "route del -net "$1" gw "$2";"}
> >>+   eval $(ip route | awk '
> >>+   /^default\Wvia\W('$valid_gw')/ {next}
> >>+   /^default/ {print "ip route del "$1" via "$3";"}
> >
> >the code leaves the default-gateway if already set and removes all other
> >default routes. i dont like the awk-approach, maybe something like:
> 
> I wasn't planning on reworking the udhcpc script beyond making it
> work with ip vs ifconfig/route.  You're talking about changing more
> unrelated things, which really should go in a separate patch.

ok.

> >the rest looks good! there are still a lot of other users
> >for route/ifconfig, but thats a good start!
> 
> Actually according to grep, only openvpn after this in base (there
> are < 10 others in packages feed as well, and I am planning on
> creating a minimalist busybox package (calling the binary e.g.
> net-tools) to supply ifconfig/route for those packages that aren't
> converted yet, or for third party use of ifconfig/route (in the
> packages feeds; doesn't belong in base).

git grep 'ifconfig'
shows a *lot* - but dont mind - thanks for your input.

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


Re: [OpenWrt-Devel] [PATCH v2] base-files: For sysfixtime use hwclock if RTC available

2016-01-20 Thread Bastian Bittorf
* Petr Štetiar  [20.01.2016 10:14]:

thank you!

>  START=00
> +STOP=90
> +
> +rtc_dev=/dev/rtc0
> +hwclock=/sbin/hwclock

please use varname in UPPERCASE if global (just a style issue)
the rest looks good to me.

bye, bastian
___
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

2016-01-20 Thread Bastian Bittorf
* amine ahd  [20.01.2016 10:09]:

thank you!

> 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.

like john wrote already:
if you edit the first line of the commit-message, please write:

busybox: ntp - use server received via DHCP

the rest looks good to me. - bye, bastian
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] package/config/netifd: Replace ifconfig/route with ip command

2016-01-19 Thread Bastian Bittorf
* open...@daniel.thecshore.com  [20.01.2016 
07:21]:
> @@ -5,30 +5,34 @@ set_classless_routes() {
>   local max=128
>   local type

thanks for that, i have it also on my todo-list.
please remove also the 'local type' here.

>   done
>  }
>  
>  setup_interface() {
> - echo "udhcpc: ifconfig $interface $ip netmask ${subnet:-255.255.255.0} 
> broadcast ${broadcast:-+}"
> - ifconfig $interface $ip netmask ${subnet:-255.255.255.0} broadcast 
> ${broadcast:-+}
> + local prefix="$(
> + eval "$(ipcalc.sh 0.0.0.0 ${subnet:-255.255.255.0})"
> + echo -n $PREFIX

dont use '-n'

> + )"
> + 
> + echo "udhcpc: ip address add $ip/${prefix:-24} ${broadcast:-+} dev 
> $interface"
> + ip address add $ip/${prefix:-24} ${broadcast:-+} dev $interface"

please dont double-fallback. It's ok to have it once default to '255.255.255.0',
so just use $prefix

maybe we can even have a function in /lib/functions.sh for that:

!#/bin/sh
mask2cidr()
{
local x=${1##*255.}
local allones=$(( (${#1} - ${#x}) * 2 ))
local tbl='0^^^128^192^224^240^248^252^254^'

x=${tbl%%${x%%.*}*}
export CIDR=$(( allones + (${#x}/4) ))
}

mask2cidr 255.255.255.224
echo $CIDR


>  
>   [ -n "$router" ] && [ "$router" != "0.0.0.0" ] && [ "$router" != 
> "255.255.255.255" ] && {
>   echo "udhcpc: setting default routers: $router"
>  
>   local valid_gw=""
>   for i in $router ; do
> - route add default gw $i dev $interface
> + ip route add default via $i dev $interface
>   valid_gw="${valid_gw:+$valid_gw|}$i"
>   done
>   
> - eval $(route -n | awk '
> - /^0.0.0.0\W{9}('$valid_gw')\W/ {next}
> - /^0.0.0.0/ {print "route del -net "$1" gw "$2";"}
> + eval $(ip route | awk '
> + /^default\Wvia\W('$valid_gw')/ {next}
> + /^default/ {print "ip route del "$1" via "$3";"}

the code leaves the default-gateway if already set and removes all other
default routes. i dont like the awk-approach, maybe something like:

root@box:~ ip route list exact '0.0.0.0/0'
default via 217.0.116.253 dev pppoe-wan  proto static 
default via 10.63.21.98 dev eth0.1  metric 7 

#!/bin/sh

replace_default_gw()
{
ip route list exact '0.0.0.0/0' | while read LINE; do
set -- $LINE
[ "$3" = "$valid_gw" ] || ip route del default via $3
done
}

the rest looks good! there are still a lot of other users
for route/ifconfig, but thats a good start!

bye, bastian
___
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

2016-01-19 Thread Bastian Bittorf
* amine ahd  [19.01.2016 10:12]:
>  start_service() {
> - local server enabled enable_server peer
> -
> + local server enabled enable_server peer ntpservers iface status 
> ntpserver dump
> + local dhcp_ifaces="$(uci -q get system.ntp.dhcp_ifaces)"
> + 

please remove whitespaces in the line above,
otherwise it looks fine to me.

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


Re: [OpenWrt-Devel] Dissociate STA based on SNR

2016-01-18 Thread Bastian Bittorf
* Weedy  [19.01.2016 07:46]:
> > I was wondering if there is a way to dissociate STAs who say go below a
> > minimum threshold SNR or signal level of say -65dBm in a multi-AP scenario?
> >
> option disassoc_low_ack1
> Adjust this code to trigger higher?

yes, this also helps but is NOT enough.

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


Re: [OpenWrt-Devel] Dissociate STA based on SNR

2016-01-18 Thread Bastian Bittorf
* Nishant Sharma  [19.01.2016 07:46]:
> >ubus call hostapd.$dev del_client '{ "addr" : "$mac", "reason" :
> >"assoc toomany", "ban_time" : 1 }'
> Thanks for the pointers. It works for me.
> 
> What exactly is ban_time unit? I presume it's millisecond.

yes, milliseconds.

> Where can I find more documentation about ubus call to different
> processes? The page https://wiki.openwrt.org/doc/techref/ubus doesn't
> mention the call that you have used :)

in the source only 8-)

as far as I understand, these are the same command
which one can use in the hostapd-cli.

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


Re: [OpenWrt-Devel] Dissociate STA based on SNR

2016-01-18 Thread Bastian Bittorf
* Nishant Sharma  [18.01.2016 15:40]:
> I was wondering if there is a way to dissociate STAs who say go below
> a minimum threshold SNR or signal level of say -65dBm in a multi-AP
> scenario?

we also faced this, while doing roaming.
i workaround is to have something like:

#!/bin/sh

iw event | while read -r LINE; do
  case "$LINE" in
*': del station '*|*': new station '*)
  # wlan0-1: del station 00:21:6a:32:7c:1c
  # wlan0: new station dc:9f:db:02:b8:ee
  ...your own logic here...
;;
  esac
done

what we do e.g. is if a station connects for the
first time and signal is below -70, we just kick.

#!/bin/sh

dev='wlan0-1'
mac=...
ubus call hostapd.$dev del_client '{ "addr" : "$mac", "reason" : "assoc 
toomany", "ban_time" : 1 }'


if the same mac connects during a specific time again,
we dont kick 8-) - really, it's just a workaround.

bye ,bastian
___
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] use NTP server received via DHCP

2016-01-15 Thread Bastian Bittorf
* Amine Aouled Hamed  [15.01.2016 10:03]:
> > please make var 'iface' local and while you are there, move
> > all the 'local' declaration to the head of the function.
> 
> Wouldn't be better if the local vars inside of the if and for statements
> stay inside?

maybe thats personal preference, i like it outside a loop.

> I mean what is the point of declaring ifaces if I will be using all the
> ifaces? in term of performance(even if it is negligible and clarity of the
> code).

you are right, performance is not an issue here.
i just spotted this in memory if a former double-local-crash-bug
in busybox (which is what happens in a for-loop)

also: declaring iface 'local' means, that it is thrown away
when the functions returns, otherwise it will pollute your
env-space.

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


Re: [OpenWrt-Devel] [PATCH] brcm47xx: Mark broken; no working images

2016-01-14 Thread Bastian Bittorf
* Daniel Dickinson  [14.01.2016 17:35]:
> If on trunk, what compile options do use to make the images build
> successfully?  I get failed compiles with warning that the image is
> too big on any brcm47xx target I tried, so unless wl-500gp is bigger
> than most of them, I'm thinking you're either doing something
> special, or are not on trunk.  (And I tried cutting *way* back on
> things that increase image, well below normal OpenWrt).

with r48235 i just built 2 images, one fat:
5.050.368 openwrt-brcm47xx-legacy-asus-wl-500gp-v1-squashfs.trx

and one smaller with some thing disabled:
3.346.432 openwrt-brcm47xx-legacy-squashfs.trx

both are working...

bye, bastian
___
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] use NTP server received via DHCP

2016-01-14 Thread Bastian Bittorf
* amine ahd  [14.01.2016 10:29]:

thank you, patch applies...

>  start_service() {
> - local server enabled enable_server peer
> + local server enabled enable_server peer ntpservers
> + local use_dhcp="$(uci -q get system.ntp.use_dhcp)"
>  
>   validate_ntp_section ntp || {
>   echo "validation failed"
> @@ -21,13 +25,33 @@ start_service() {
>   }
>  
>   [ $enabled = 0 ] && return
> -
> - [ -z "$server" ] && return
> + [ -z "$server" ] && [ "$use_dhcp" = 0 ] && return

i'am ok with this, if you like you can reuse
'config_get_bool()' from /lib/functions.sh

>   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"
> +
> + local dhcp_ifaces="$(uci -q get system.ntp.dhcp_ifaces)"
> + [ "$use_dhcp" = 1 ] && {

this should also be 'bool'

> + if [ -z "$dhcp_ifaces" ]; then
> + local dump="$(ubus call network.interface dump)"
> + ntpservers=$(jsonfilter -s "$dump" -e 
> '$["interface"][*]["data"]["ntpserver"]')
> + else
> + for iface in $dhcp_ifaces; do

please make var 'iface' local and while you are there, move
all the 'local' declaration to the head of the function.

the rest looks OK to me. - thank you

bye, bastian
___
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] use NTP server received via DHCP

2016-01-12 Thread Bastian Bittorf
* amine ahd  [12.01.2016 10:08]:
> ---
>  package/utils/busybox/Makefile |  3 ++
>  package/utils/busybox/files/sysntpd| 26 ++-
>  package/utils/busybox/files/sysntpd.hotplug| 53 ++
>  3 files changed, 80 insertions(+), 2 deletions(-)
>  create mode 100755 package/utils/busybox/files/sysntpd.hotplug

also it does not apply:

bastian@X301:~/software/openwrt$ curl -s 
https://patchwork.ozlabs.org/patch/566411/mbox/ | git apply --check
error: patch failed: package/utils/busybox/Makefile:112
error: package/utils/busybox/Makefile: patch does not apply

bye, bastian
___
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] use NTP server received via DHCP

2016-01-12 Thread Bastian Bittorf
* amine ahd  [12.01.2016 10:08]:
> + [ "$use_dhcp" = 1 ] && {
> + if [ -z "$dhcp_ifaces" ]; then
> + local dump=$(ubus call network.interface dump)
> + ntpservers=$(jsonfilter -s "$dump" -e 
> '$["interface"][*]["data"]["ntpserver"]')

please make 'ntpservers' once local in the function head

> + else
> + for iface in $dhcp_ifaces; do
> + local status=$(ubus call 
> network.interface.$iface status)
> + local ntpserver=$(jsonfilter -s "$status" -e 
> '$["data"]["ntpserver"]')
> + [ -n "$ntpserver" ] && \\

this is one '\' to much

> +is_valid_interface() {
> + local list=$(uci get system.ntp.dhcp_ifaces)

just for me: use list="$( ... )"

bye,bastian
___
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] use NTP server received via DHCP

2016-01-07 Thread Bastian Bittorf
* amine ahd  [07.01.2016 19:41]:
> ---
>  package/utils/busybox/Makefile |  3 ++
>  package/utils/busybox/files/sysntpd| 28 +++-
>  .../package/utils/busybox/files/sysntpd.hotplug| 53 
> ++

the path for "sysntpd.hotplug" is wrong, it should be:
package/utils/busybox/files/sysntpd.hotplug

> + local dhcp_ifaces="$(uci -q get system.ntp.dhcp_ifaces)"
> + [ "$use_dhcp" = 1 ] && {
> + if [ -z "$dhcp_ifaces" ]; then
> + local dump=$(ubus call network.interface dump)
> + ntpservers=$(jsonfilter -s "$dump" -e 
> '$["interface"][*]["data"]["ntpserver"]')
> + else
> + for iface in $dhcp_ifaces; do
> + local status=$(ubus call network.interface.$int 
> status)

please test if your code really runs.
you have renamed "int" to "iface", but not everywhere

> + [ -n "$ntpserver" ] &&
> + ntpservers="$ntpservers $ntpserver"

here is a '\' at line end missing, is'nt it?

>  service_triggers()
>  {
>   procd_add_reload_trigger "system"
> +
>   procd_add_validation validate_ntp_section
> +
>  }

are these newlines really needed?

> +. /lib/functions.sh
> +. /usr/share/libubox/jshn.sh
> +
> +is_valid_interface() {
> + local list=$(uci get system.ntp.dhcp_ifaces)
> + [ -z "$list" ] && return 0;

the ";" is unneeded

> +
> + case "$list" in
> + *"$INTERFACE"*)
> + return 0

please use the spaces like i wrote:
" $list "
and
*" $INTERFACE "*

> + [ -n "$ntpserver" ] &&
> + dhcp_ntp_servers="dhcp_ntp_servers $ntpserver"

here is also a "\" missing 

please: before sending this patch to the mailinglist, try
to manually apply it to a fresh git-checkout of openwrt.
after applying, test the resulting files with "shellcheck.net".

bye, bastian.
___
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] [DEV-1329] use NTP server received via DHCP

2016-01-07 Thread Bastian Bittorf
* amine ahd  [07.01.2016 10:34]:

the patch is from wrong dir.
please do a 'git format-patch' inside the OpenWrt-dir,
so the modified files are:

package/utils/busybox/Makefile
package/utils/busybox/files/sysntpd
package/utils/busybox/files/sysntpd.hotplug

for the subject: what means "[DEV-1329]"?

> +. /usr/share/libubox/jshn.sh
>  START=98
>  
>  USE_PROCD=1
> @@ -22,12 +24,32 @@ start_service() {
>  
>   [ $enabled = 0 ] && return
>  
> - [ -z "$server" ] && return

please check if any interface is in DHCP-mode
and has a chance to get an NTP, otherwise return. 

> + if [ "$use_dhcp" = 1 ]; then

minor: use OpenWrt-style:
when there is no 'else', just do:

[ "$use_dhcp" = 1 ] && {
...
}

> + if [ -z "$dhcp_ifaces" ]; then
> + dump=$(ubus call network.interface dump)

make 'dump' also 'local'

> +check_int() {

minor: choose better function name.

> + list=$(uci get system.ntp.dhcp_ifaces)
> + if [ -z $list ];
> + then
> + return 0
> + fi

it's shorter:
[ -z "$list" ] && return

> + if [ "${list#*$INTERFACE}" != "$list" ]

this looks strange to me and will IMHO not work
for similar names, e.g. eth0 eth0.1 eth0.2

you want to test, if the upcoming $INTERFACE is part
of allowed interfaces ("system.ntp.dhcp_ifaces"), aren't you?

is_valid_interface()
{
local list="$(uci get system.ntp.dhcp_ifaces)"

case " $list " in
*" $INTERFACE "*)
;;
*)
return 1
;;
esac
}

> + for int in $dhcp_ifaces; do

please you 'iface' or 'interface' not 'int'
but thanks for the patch for now!

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


Re: [OpenWrt-Devel] SDK vs. Toolchain+

2016-01-06 Thread Bastian Bittorf
* Daniel Dickinson  [06.01.2016 20:11]:
> Obviously your idea of cheap, fast hardware is based on the
> assumption that one is working on OpenWrt for pay rather than hobby.

sorry, i misunderstood and was thinking that it _is_ part of
your business. you are right, it's way too much money for a hobbyist.

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


Re: [OpenWrt-Devel] SDK vs. Toolchain+

2016-01-05 Thread Bastian Bittorf
* Daniel Dickinson  [05.01.2016 18:48]:
> The problem is that I find, at least with ar71xx, that even with a an
> already compile toolchain that target/linux/compile takes an annoying
> amount of time (even though nothing is being compiled, there is a lot
> of stuff that still gets done), and,
> 
> in addition, target/linux/install takes a very long time because
> there are preparations for every image, even if you only want two or
> three profiles (but the two or three means you can't just select one
> profile and be happy), because you have multiple types of hardware
> you want to deal with.
> 
> It's actually target/linux that's the major issue when it comes to
> allowing not rebuilding every time to be a useful answer.

some weeks ago i gave some numbers for

make clean && make

for e.g. ar71xx and it boils down to only some ~140 seconds
on cheap and fast hardware. (including ALL images).

so what is your problem? slow hardware?

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


[OpenWrt-Devel] [PATCH] procd: emit events for sound subsystem

2016-01-05 Thread Bastian Bittorf
Useful e.g. for plugable USB-soundcards.
With this change an event/hotplug-call looks like:

ACTION: add DEVNAME: snd/timer DEVPATH: /devices/virtual/sound/timer SUBSYSTEM: 
sound
ACTION: add DEVNAME:  DEVPATH: 
/devices/platform/ehci-platform/usb1/1-1/1-1:1.0/sound/card0 SUBSYSTEM: sound
ACTION: add DEVNAME: snd/controlC0 DEVPATH: 
/devices/platform/ehci-platform/usb1/1-1/1-1:1.0/sound/card0/controlC0 
SUBSYSTEM: sound
ACTION: add DEVNAME: snd/pcmC0D0p DEVPATH: 
/devices/platform/ehci-platform/usb1/1-1/1-1:1.0/sound/card0/pcmC0D0p 
SUBSYSTEM: sound
ACTION: add DEVNAME: snd/pcmC0D0c DEVPATH: 
/devices/platform/ehci-platform/usb1/1-1/1-1:1.0/sound/card0/pcmC0D0c 
SUBSYSTEM: sound
ACTION: add DEVNAME: dsp DEVPATH: 
/devices/platform/ehci-platform/usb1/1-1/1-1:1.0/sound/card0/dsp SUBSYSTEM: 
sound
ACTION: add DEVNAME: audio DEVPATH: 
/devices/platform/ehci-platform/usb1/1-1/1-1:1.0/sound/card0/audio SUBSYSTEM: 
sound
ACTION: add DEVNAME: mixer DEVPATH: 
/devices/platform/ehci-platform/usb1/1-1/1-1:1.0/sound/card0/mixer SUBSYSTEM: 
sound

This fixes #21466.

Signed-off-by: Bastian Bittorf 
---
 package/system/procd/files/hotplug.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/system/procd/files/hotplug.json 
b/package/system/procd/files/hotplug.json
index 27b4836..516a122 100644
--- a/package/system/procd/files/hotplug.json
+++ b/package/system/procd/files/hotplug.json
@@ -70,7 +70,7 @@
],
[ "if",
[ "eq", "SUBSYSTEM",
-   [ "net", "input", "usb", "usbmisc", "ieee1394", 
"block", "atm", "zaptel", "tty", "button" ]
+   [ "net", "input", "usb", "usbmisc", "ieee1394", 
"block", "atm", "zaptel", "tty", "button", "sound" ]
],
[ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%" ]
],
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


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

2015-12-24 Thread Bastian Bittorf
* Michael Richardson  [24.12.2015 22:14]:
> 2) if the user is "used" to a key mismatch, and they type their password in,
>the password has just been compromised.

this is indeed true for IPv6/linklocal

> A better approach is that the ssh daemon should start, open port 22, and then
> do SSHv2 transport mode up to the key-exchange, and then just respond to
> keep alives, ideally with a message to "Please stand by", if we can find
> a way to do that in-protocol. (wow. it's been 18 years since I worked at 
> ssh...)

this is very interesting.
i'am not sure how big this impact is to the dropbear codebase, but i like it.

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


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

2015-12-24 Thread Bastian Bittorf
* Michael Richardson  [24.12.2015 22:14]:
> >> > till the real keys are generated? it can last several minutes on some
> >> > routers and it feels like the box is broken. also: if really 
> something
> >> > goes wrong during key generating we can at least login.
> >>
> >> you have a very bizarre understanding of securing a device.
> 
> > in this stage the box is still without password.
> 
> okay.  So the impersonator machine lets the user in without a password, and
> the impersonator machine has ALREADY connected to the new machine with no
> password, and trojan'ed some binaries.

yes, if somebody wants to upload some binaries it's possible.

> > the only issue i can think of is, that one can
> > read on the wire to which password somebody changes
> > with 'passwd' - but i'am pretty sure this is not
> > the case, because each session has it's own privacy.
> 
> No, since the impersonator (MITM) has involved itself with the session.
> Effectively, the MITM creates:
> 
>  ssh mitm 'tee /badguy | ssh target'
> 
> (but, bidirectionally, and inside the SSH transport layer)
> 
> A new ICMP port-unreachable code would be nice to have here.

interesting idea, but this is also possible with the current
approach. the user has to accept a new unknown key and has no
idea from which box it comes from.

but really, this is really hypothetical - normally you have
1 box on your desk and you are connected via wire to it. what
is your usecase?

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


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

2015-12-24 Thread Bastian Bittorf
* Michael Richardson  [24.12.2015 22:14]:
> 1) when the "default" key is being used, the box can be impersonated.

hmmm, it can - but you need another box on the same wire
with the same IP 192.168.1.1

> 2) if the user is "used" to a key mismatch, and they type their password in,
>the password has just been compromised.

at the moment the user *is* used to a key mismatch, because
every box comes up with 192.168.1.1 and another key.

> 3) if the user accepts the default keys, when the correct ones are generated,
>the user then has a key mismatch, again opening the possibility of
>an impersonation.

no - usually you change the IP and then you have to accept the new key.

i'am still not convinced that the "pre-key" is a bad idea.

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


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

2015-12-24 Thread Bastian Bittorf
* John Crispin  [24.12.2015 21:15]:
> > while we are at it: what about including default private keys for SSH
> > till the real keys are generated? it can last several minutes on some
> > routers and it feels like the box is broken. also: if really something
> > goes wrong during key generating we can at least login.
> 
> you have a very bizarre understanding of securing a device.

in this stage the box is still without password.

the only issue i can think of is, that one can
read on the wire to which password somebody changes
with 'passwd' - but i'am pretty sure this is not
the case, because each session has it's own privacy.

please say more about your doubts.

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


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

2015-12-24 Thread Bastian Bittorf
* Imre Kaloz  [24.12.2015 21:15]:
> >while we are at it: what about including default private keys for SSH
> >till the real keys are generated? it can last several minutes on some
> >routers and it feels like the box is broken. also: if really something
> >goes wrong during key generating we can at least login.
> 
> So make it double unsafe - great idea ;)

please say more about this. the initial keygenerating is only
active when the password is still unset. i dont see an unsecure
thing here, do you?

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


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

2015-12-23 Thread Bastian Bittorf
* Daniel Curran-Dickinson  [23.12.2015 17:27]:
> I'm implementing without mount_root - that means passwordless
> failsafe unless user has preconfigured passwords in their image.
> OTOH if they have configured passwords in their image then they will
> be required.

ok, this sounds good.

while we are at it: what about including default private keys for SSH
till the real keys are generated? it can last several minutes on some
routers and it feels like the box is broken. also: if really something
goes wrong during key generating we can at least login.

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


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

2015-12-23 Thread Bastian Bittorf
* Imre Kaloz  [23.12.2015 16:22]:
> >I'd hate to have some corner case result in bricked routers for
> >people who have no means of recovering from a bad flash.
> 
> You can reflash from the bootloader all the time, we are talking
> about userland here. IMHO this should be just a normal change, like
> dropping telnet. Enforcing login should be on by default, specially
> since if one forgets the password they can just reset everything to
> defaults keeping the reset button pressed.

I am against asking for a password in failsafe mode:
failsafe is failsafe is failsafe.

You have to run mount_root which does _things_ and can break.

bye, bastian
___
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


Re: [OpenWrt-Devel] Fast build testing [Was: Git mirror with branches, tags and full history]

2015-12-17 Thread Bastian Bittorf
* Dirk Neukirchen  [02.12.2015 15:35]:
> Can you please add some compile speed numbers
> on cloud service/workstation/ >8thread hardware to
> this wiki page: https://wiki.openwrt.org/doc/faq/development

yes, i will update that if i have collected for some
more machines. thanks to jow, i managed it to do a full/fresh
build including all packages and in runs for ar71xx in 57 minutes
on a strong board und needs a 38 gig ramdisk. Xeon/3GHz/24 threads

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


Re: [OpenWrt-Devel] [PATCH] base-files: For sysfixtime use hwclock if RTC available

2015-12-17 Thread Bastian Bittorf
* open...@daniel.thecshore.com  [17.12.2015 
10:39]:
> From: Daniel Dickinson 
> 
> On systems that have an RTC prefer it to the file-based
> time fixup (i.e. use hwclock when there is a permanent
> clock instead of the faked up time logic that is needed
> when there is not RTC).

whats the difference between both mails?

also i suggest for the future:

if [ -e /dev/rtc ]; then
  ...
else
  ...
fi

instead of testing the opposite.

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


[OpenWrt-Devel] sysupgrade + reverse SSH tunnel broken

2015-12-17 Thread Bastian Bittorf
when starting sysupgrade on a router with
an interactive reverse SSH session provided
via dropbear/dbclient, the "dbclient" gets
killed during early run of the script, keeping
the box unreachable. maybe this is the same
user other tunnels too.

there are 3 possible ways i can imagine:

1)
warn the user when such a tunnel is detected

2)
keep the tunnel-proider in a whitelist, so
they dont get killed during sysupgrade

3)
nohup the script more early (and keep the process
running when the connection is lost)

internally we are using this for such things:

#!/bin/sh
nohup()
{
# close stdin, and make any read attempt an error
[ -t 0 ] && exec 0>/dev/null

# redirect stdout to a file if it's a TTY
[ -t 1 ] && {
exec 1>nohup.out || exec 1>nohup.out
}

# redirect stderr to stdout if it's a TTY
[ -t 2 ] && exec 2>&1

# trap the HUP signal to ignore it
trap : HUP
}

# detach script from shell
nohup

...further commands



has somebody and idea what is the "best"?

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


Re: [OpenWrt-Devel] [PATCH 6/6] ramips: mt7621: disable ISDN in kernel config

2015-12-14 Thread Bastian Bittorf
* John Crispin  [14.12.2015 09:19]:
> > +# CONFIG_ISDN is not set
> 
> ah you found my easter egg. this has been in our config for ages for
> some reason beyond my knowledge ;)

using OpenWrt as an ISDN-dialup/concentrator is not totally
out of scope, but nowadays it's at least exotic...

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


Re: [OpenWrt-Devel] Fast build testing [Was: Git mirror with branches, tags and full history]

2015-12-10 Thread Bastian Bittorf
* John Szakmeister  [02.12.2015 16:04]:
> > today tested PowerPC/mpc85xx and this needs 160 seconds:
> > make clean; make -j25
> 
> Do these numbers include building the toolchain?  And I assume it does
> not include downloading all the sources, correct?

just bumping this thread:
is there a way to just build *all* (or nearly all) packages?

here is the script for copy/paste for measuring *your* time:
(please make sure '/usr/bin/time' is installed)

work()
{
echo "CONFIG_TARGET_${1:-mpc85xx}=y" >.config

THREADS=$( grep -sc ^processor /proc/cpuinfo )
THREADS=$(( THREADS + 1 ))

S0='defconfig'
S1="tools/install $( test "$(id -u)" = 0 && echo 
FORCE_UNSAFE_CONFIGURE=1 )"
S2='toolchain/install'
S3='target/compile'
S4='package/compile'
S5='package/install'
S6='package/preconfig'
S7='target/install'
S8='package/index'
S9='clean'

for STEP in "$S0" "$S1" "$S2" "$S3" "$S4" "$S5" "$S6" "$S7" "$S8" "$S9" 
'' dirclean; do
COMMAND="make -j$THREADS $STEP"
echo "real: $COMMAND | $( cat /proc/loadavg ) - space: $( du 
-sh )"
/usr/bin/time -f "real %e secs" $COMMAND || break
done
}

you can run it (inside the openwrt-dir) with:
# work ar71xx 2>&1 | tee LOG

after it has run you can get the stats with the horrible one-liner:
# grep ^real LOG | while read -r L; do set -- $L; test "$1" != 'real:' && echo 
"$L $O" || { shift; O="$*"; }; done

bye, bastian

PS: i asked some of my customers if they agree to setup some strong
boxes inside theire data-center for just building openwrt and at
least 3 are fine with this.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Q: procd / respawn if process dies

2015-12-08 Thread Bastian Bittorf
* Yousong Zhou  [08.12.2015 15:59]:
> respawn is an instance attribute, moving that statement inside the
> open/close instance block should do the job

thanks for the hint, this works!

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


[OpenWrt-Devel] Q: procd / respawn if process dies

2015-12-08 Thread Bastian Bittorf
while trying to understand the procd
respawn-trigger, I wrote this testscript:

#!/bin/sh /etc/rc.common
START=50
USE_PROCD=1
PROG=/tmp/test.sh

start_service()
{
{
echo '#!/bin/sh'
echo 'logger START-$0 $$'
echo 'sleep 10'
echo 'logger READY-$0 $$'
} >$PROG
chmod +x $PROG

procd_set_param respawn ${threshold:-20} ${timeout:-5} ${retry:-3}
procd_open_instance
procd_set_param command "$PROG"
procd_close_instance
}

The script starts and ends, i can see it in syslog, but
it is not automatically restarted. Changing the exitcode
to != 0 does not change this and kill -9 $$ also does not
trigger a restart. What i'am doing wrong? when reading
https://wiki.openwrt.org/inbox/procd-init-scripts
it should work this way.

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


Re: [OpenWrt-Devel] Fast build testing [Was: Git mirror with branches, tags and full history]

2015-12-07 Thread Bastian Bittorf
* John Szakmeister  [02.12.2015 16:04]:
> On Wed, Dec 2, 2015 at 6:14 AM, Bastian Bittorf  
> wrote:
> > * Petr Štetiar  [30.11.2015 13:47]:
> >> That sounds really great, can you please share more details? It's just your
> >> guess or you've achieved such build times already?
> >
> > today tested PowerPC/mpc85xx and this needs 160 seconds:
> > make clean; make -j25
> 
> Do these numbers include building the toolchain?  And I assume it does
> not include downloading all the sources, correct?

downloading is not included.
we use a "always up-to-date" tarball which is downloaded
downloaded and unpacked in only some seconds.

here are some more values:
real   1.34 secs make -j25 defconfig
real 330.28 secs make -j25 tools/install
real 520.04 secs make -j25 toolchain/install
real  30.48 secs make -j25 target/compile
real 101.95 secs make -j25 package/compile
real   4.41 secs make -j25 package/install
real   1.69 secs make -j25 package/preconfig
real  39.78 secs make -j25 target/install
real   2.94 secs make -j25 package/index
#
real   1.91 secs make -j25 clean
real 147.28 secs make -j25

the last 2 steps are interesting, because this is the
most used action. (tools/install and toolchain/install is seldom needed)

these numbers are for Intel Xeon(R) CPU X5650 @ 2.67GHz / 24threads
they are about 700-800 Euro:
http://www.leader112.com/c1-178/proliant-dl380-g7

i'am still unsure how to automatically test a build with
'all packages'. there is a 'menuconfig' entry ("build all packages",
"build all kmodules") but it does not seems to work.

also i need help / ideas for using an IBM Power8 on the GCC Compile
Farm, which is somehow unused 8-) and has 152 Threads. There is zlib-dev
missing and I dont get it working with a local compile/install. I
can provide SSH-access, just PM me.

I'am also interested in the Board-CI stuff. We already have a lot
of real boards (with different arch's) running for that...

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


Re: [OpenWrt-Devel] [OpenWrt] openwrt build system costs: support of or foundation over?

2015-12-07 Thread Bastian Bittorf
* Eric Schultz  [08.12.2015 07:18]:
> but they don't even know who to pay in some cases. There's lots of reasons
> why this has been the case but, in the end, more clarity in governance and
> process would go a long way to help here. I'm happy to personally help but
> the committers are really the ones who have to drive this.

Is somebody of the OpenWrt-people attending to the hangout on 15th?
http://doodle.com/poll/sg7wkv93bewa4tff

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


[OpenWrt-Devel] [PATCH] netifd: ifup-shellscript - fix wrong usage of 'local'

2015-12-07 Thread Bastian Bittorf
this error was not visible until recent bump to
busybox 1.24.1 stable which introduced a warning message
when keyword 'local' is not used with a shell-function.

this does not change behavior and is a cosmetic cleanup.
fixes the following output:

root@box:~ ifup 
/sbin/ifup: local: line 362: not in a function
/sbin/ifup: local: line 362: not in a function
/sbin/ifup: local: line 1: not in a function

Signed-off-by: Bastian Bittorf 
---
 package/network/config/netifd/files/sbin/ifup | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/package/network/config/netifd/files/sbin/ifup 
b/package/network/config/netifd/files/sbin/ifup
index af3aaa8..5515b91 100755
--- a/package/network/config/netifd/files/sbin/ifup
+++ b/package/network/config/netifd/files/sbin/ifup
@@ -67,12 +67,10 @@ if [ -n "$setup_wifi" ] && grep -sq config 
/etc/config/wireless; then
fi
}
 
-   local radio_devs
-   local network="$1"
+   network="$1"
config_load wireless
config_foreach find_related_radios wifi-iface
 
-   local dev
for dev in $(echo "$radio_devs" | sort -u); do
/sbin/wifi up "$dev"
done
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Fast build testing [Was: Git mirror with branches, tags and full history]

2015-12-02 Thread Bastian Bittorf
* John Szakmeister  [02.12.2015 16:04]:
> Do these numbers include building the toolchain?  And I assume it does
> not include downloading all the sources, correct?

building toolchain is not included
and sources are already in place.

i will update the wikipage with exact numbers,
and will post if ready. thanks for all the feedback.

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


Re: [OpenWrt-Devel] Fast build testing [Was: Git mirror with branches, tags and full history]

2015-12-02 Thread Bastian Bittorf
* Petr Štetiar  [30.11.2015 13:47]:
> That sounds really great, can you please share more details? It's just your
> guess or you've achieved such build times already?

today tested PowerPC/mpc85xx and this needs 160 seconds:
make clean; make -j25

(the test yesterday was with ar71xx - so a lot of images/boards)

In the cloud (so you only pay for uptime) this will
cost about 5ct/min, so 15 cent 8-) But i think a lot of
users have servers idling most time of the day...

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


Re: [OpenWrt-Devel] Fast build testing [Was: Git mirror with branches, tags and full history]

2015-12-01 Thread Bastian Bittorf
* Petr Štetiar  [30.11.2015 13:47]:
> > build testing OpenWrt can be *really* fast, if you
> > 
> > a) build in a ram-disk
> > b) use dedicated hardware for each architecture
> > 
> > i bet it's about 300 seconds for a full fresh
> > distributed build for *all* architectures.
> 
> That sounds really great, can you please share more details? It's just your
> guess or you've achieved such build times already?

i just retested on one spare machine:
Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz

you need ~12 tmpfs and a
"make clean; make -j25"
runs in 310 secs. it seems to last very long
to generate the image-files, compiling itself is fast.

tomorrow i will test another board with 4ghz AMD.

my idea was, that people of the community can "spend"
cpu-time and run builds for only 1 arch after each checkin.

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


  1   2   3   4   5   6   7   8   >