Re: [OpenWrt-Devel] OpenWrt /etc/hotplug.d/button/00-wps

2015-09-16 Thread Bastian Bittorf
* John kerry  [16.09.2015 11:32]:
> even i checked on http://www.shellcheck.net/ , its not giving any feedback,
> it seems correct but still its not working.

add 1 line on top of your script for debugging:

set | logger

and check with 'logread -f' the output when you press the button.

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 /etc/hotplug.d/button/00-wps

2015-09-16 Thread Bastian Bittorf
* John kerry  [16.09.2015 08:10]:
> Hi,
> 
> I have changed the script as below:
> 
> MYDEV='eth0.2'
> 
>  ["$ACTION" = "pressed" -a "$BUTTON" = "BUT_2" -a "INTERFACE" = 'wan'] &&
   ^^^ a space here, so [ "$ACTION" - the same at the end: 'wan' ]
use "$INTERFACE" with the '$'

please learn shell-scripting. maybe it's an good idea to use a static
checker like http://www.shellcheck.net/

>{
> devstatus "$MYDEV" | grep '"up": true' &&
>{
> echo "255" >
> /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness
> }
> }
> 
> 
> but its not working.
> 
> What mistake i am doing.

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


Re: [OpenWrt-Devel] OpenWrt /etc/hotplug.d/button/00-wps

2015-09-16 Thread Bastian Bittorf
* John kerry  [16.09.2015 12:18]:
> I am getting below log:

ok, i see: INTERFACE is not set, so you have to remove the check for
this var and hardcode it.

please stop sending mails like this, debug on your own with a local friend.

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


[OpenWrt-Devel] thanks for r46829 / replace ifconfig-usage with ip

2015-09-11 Thread Bastian Bittorf
Thanks for fully switching to 'ip' and abandon 'ifconfig/route'.

Back in 2008 with r11157 i started the first discussion with
a patch and the core team was against it. i tried again in 2009,
but the additional 12k was just to much [1] for adding. Several
discussions in IRC always leaded to 'too much bloat' and 'unneeded'.

Finally with have it.
Why have you switched your mind now?

[1] https://lists.openwrt.org/pipermail/openwrt-devel/2008-May/002265.html
[2] https://lists.openwrt.org/pipermail/openwrt-devel/2009-June/004481.html
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] thanks for r46829 / replace ifconfig-usage with ip

2015-09-11 Thread Bastian Bittorf
* Steven Barth  [11.09.2015 11:44]:
> Well it's not yet abandoned we still have to migrate a lot of
> stuff under target/ and in the feeds. ifconfig and route won't
> go away before that happens.

thanks for pointing at it:
user@build:~/openwrt$ git grep 'ifconfig ' | wc -l
57

i see that as a direct invitation for sending patches...

> Besides I guess it's a more pressing issue now with IPv6 and so on
> where the old tools are relatively useless. As we are making some
> more ground-breaking changes and breaking all kinds of stuff,
> we might as well introduce ip. DD will be the first "non-alcoholic"
> release after all so who knows what other crazy thing we will come
> up with before then.

i was shocked seeing the ingredients 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] OpenWrt /etc/hotplug.d/button/00-wps

2015-09-15 Thread Bastian Bittorf
* John kerry  [15.09.2015 08:52]:
> I have to write some condition in
> /etc/hotplug.d/button/50-wps/ file
> 
> I have to configure cat /etc/hotplug.d/button/00-wps file for following
> condition:
> if [ "$BUTTON" = "BTN_2" ] && [ "$ACTION" = "pressed" ]; then
> 
> I have to check eth0.1 if link is up then have ON status led otherwise OFF.

if i understand you correctly, you want this:

MYDEV='eth0.1'
[ "$BUTTON" = 'BTN_2' -a "$ACTION" = 'pressed' ] && {
  devstatus "$MYDEV" | grep '"up": true' && {
your_action_here
  }
}

but this is at least...rude. better you use the correct
JSON-parser like:

. /usr/share/libubox/jshn.sh
json_load "$( devstatus eth0.1 )"
json_get_var 'JSON_VAR_up' 'up'
json_cleanup

in case your dev is up you have e.g.
$JSON_VAR_up = 1

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] [RFC] toolchain: add OCaml compiler

2015-09-17 Thread Bastian Bittorf
* Stefan Hellermann  [17.09.2015 20:00]:
> Tested with Unison File Synchronizer on ar71xx and x86_64. Beware:
> Stripping unison won't work!
> Better solutions and comments are appreciated!
> 
> Signed-off-by: Stefan Hellermann 

thank you!

tested and works for me on ar71xx.
the resulting unison-binary is a little
bit fat (~2mb gzipped) but thats not your fault 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] [PATCH] [RFC] toolchain: add OCaml compiler

2015-09-17 Thread Bastian Bittorf
* Stefan Hellermann  [17.09.2015 20:00]:
> Tested with Unison File Synchronizer on ar71xx and x86_64. Beware:

tested on kirkwood here, and it builds the toolchain/ocaml,
but fails to compile unison:

[...]
arm-openwrt-linux-muslgnueabi-ocamlc -verbose -g -I lwt -I ubase -I
system -I fsmonitor -I fsmonitor/linux -I fsmonitor/windows -I
system/generic -I lwt/generic -custom -g -o unison  unix.cma str.cma
bigarray.cma ubase/rx.cmo unicode_tables.cmo unicode.cmo bytearray.cmo
system/system_generic.cmo system/generic/system_impl.cmo system.cmo
ubase/projectInfo.cmo ubase/myMap.cmo ubase/safelist.cmo ubase/util.cmo
ubase/uarg.cmo ubase/prefs.cmo ubase/trace.cmo ubase/proplist.cmo
lwt/pqueue.cmo lwt/lwt.cmo lwt/lwt_util.cmo
lwt/generic/lwt_unix_impl.cmo lwt/lwt_unix.cmo uutil.cmo case.cmo
pred.cmo fileutil.cmo name.cmo path.cmo fspath.cmo fs.cmo
fingerprint.cmo abort.cmo osx.cmo external.cmo fswatch.cmo props.cmo
fileinfo.cmo os.cmo lock.cmo clroot.cmo common.cmo tree.cmo checksum.cmo
terminal.cmo transfer.cmo xferhint.cmo remote.cmo globals.cmo
fswatchold.cmo fpcache.cmo update.cmo copy.cmo stasher.cmo files.cmo
sortri.cmo recon.cmo transport.cmo strings.cmo uicommon.cmo uitext.cmo
test.cmo main.cmo linktext.cmo osxsupport.o pty.o bytearray_stubs.o
-cclib -lutil
+ arm-openwrt-linux-muslgnueabi-gcc -Os -pipe -march=armv5te
-mtune=xscale -fno-caller-saves -fhonour-copts
-Wno-error=unused-but-set-variable -mfloat-abi=soft -o 'unison'
'-Llwt' '-Lubase' '-Lsystem' '-Lfsmonitor' '-Lfsmonitor/linux'
'-Lfsmonitor/windows' '-Lsystem/generic' '-Llwt/generic'
'-L/home/bastian/openwrt/staging_dir/toolchain-arm_xscale_gcc-4.8-linaro_musl-1.1.11_eabi/lib/ocaml'
'/tmp/uml/camlprime736ee.c' '-lbigarray' '-lcamlstr' '-lunix'
'osxsupport.o' 'pty.o' 'bytearray_stubs.o' '-lutil' '-lcamlrun'
-I'/home/bastian/openwrt/staging_dir/toolchain-arm_xscale_gcc-4.8-linaro_musl-1.1.11_eabi/lib/ocaml'
-lm
arm-openwrt-linux-muslgnueabi-ocamlopt: fsmonitor/linux/inotify_stubs.c
---> fsmonitor/linux/inotify_stubs.o
arm-openwrt-linux-muslgnueabi-ocamlc -g -I lwt -I ubase -I system -I
fsmonitor -I fsmonitor/linux -I fsmonitor/windows -I system/generic -I
lwt/generic -custom -g -ccopt "-o
"/home/bastian/openwrt/build_dir/target-arm_xscale_musl-1.1.11_eabi/unison-2.48.3/fsmonitor/linux/inotify_stubs.o
-c
/home/bastian/openwrt/build_dir/target-arm_xscale_musl-1.1.11_eabi/unison-2.48.3/fsmonitor/linux/inotify_stubs.c
In file included from
/home/bastian/openwrt/build_dir/target-arm_xscale_musl-1.1.11_eabi/unison-2.48.3/fsmonitor/linux/inotify_stubs.c:41:0:
/home/bastian/openwrt/build_dir/target-arm_xscale_musl-1.1.11_eabi/unison-2.48.3/fsmonitor/linux/inotify_compat.h:76:0:
warning: "__NR_inotify_init" redefined [enabled by default]
 # define __NR_inotify_init (__NR_SYSCALL_BASE+316)
 ^
In file included from
/home/bastian/openwrt/staging_dir/toolchain-arm_xscale_gcc-4.8-linaro_musl-1.1.11_eabi/include/sys/syscall.h:4:0,
 from
/home/bastian/openwrt/build_dir/target-arm_xscale_musl-1.1.11_eabi/unison-2.48.3/fsmonitor/linux/inotify_compat.h:13,
 from
/home/bastian/openwrt/build_dir/target-arm_xscale_musl-1.1.11_eabi/unison-2.48.3/fsmonitor/linux/inotify_stubs.c:41:
/home/bastian/openwrt/staging_dir/toolchain-arm_xscale_gcc-4.8-linaro_musl-1.1.11_eabi/include/bits/syscall.h:272:0:
note: this is the location of the previous definition
 #define __NR_inotify_init 316
 i^

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


Re: [OpenWrt-Devel] OpenWrt /etc/hotplug.d/button/00-wps

2015-09-15 Thread Bastian Bittorf
* John kerry  [15.09.2015 13:44]:
> Hi,
> 
> I have added following condition but its not working:
> 
> MYDEV='eth0'
> 
> if [ "$ACTION" = "pressed" -a "$BUTTON" = "BUT_2" ] && {
  remove the 'if'
>   devstatus "$MYDEV" | grep '"up": true' && {
> echo "255" >
> /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness
>   }
> }
> 
> fi
  remove the 'fi'

please change the first line to e.g.
[ "$ACTION" = "pressed" -a "$BUTTON" = "BUT_2" -a "$INTERFACE" = 'wan' ] && {

INTERFACE is the 'name' of the device, e.g. 'wan' or 'lan'
DEVICE is the real thing, e.g. eth0.1

> Am i doing any mistake or need to change anything

you can always TEST you script with e.g.

set -x
INTERFACE=bla
DEVICE=blubb
. name_of_your_script 
set +x

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 2/3] ramips: Add base-files for HiWiFi HC5x61 models

2015-09-28 Thread Bastian Bittorf
* Comman Kang  [28.09.2015 17:37]:
> Mostly done, except this one
> 
> >+   hiwifi-hc5*61)
> >+   __fac_mac=`strings /dev/mtd7 | grep 'fac_mac = 
> >..:..:..:..:..:..'`
> >+   lan_mac=`expr "$__fac_mac" : '.*\(..:..:..:..:..:..\)' | tr 
> >'[A-Z]' '[a-z]'`
> 
> Is that really needed?
> 
> >+   [ -n "$lan_mac" ] || lan_mac=$(cat 
> >/sys/class/net/eth0/address)
> >+   wan_mac=$(macaddr_add "$lan_mac" 1)
> >+   ;;
> 
> 
> 
> That is needed,  here is the result on my router.
> 
> 
> root@Hiwifi:~# __fac_mac=`strings /dev/mtd7 | grep 'fac_mac = 
> ..:..:..:..:..:..'`
> root@Hiwifi:~# echo $__fac_mac
> Vfac_mac = D4:EE:07:25:6C:D6
> root@Hiwifi:~# lan_mac=`expr "$__fac_mac" : '.*\(..:..:..:..:..:..\)' | tr 
> '[A-Z]' '[a-z]'`
> root@Hiwifi:~# echo $lan_mac
> d4:ee:07:25:6c:d6
> 
> 
> So that line is needed,  __fac_mac itself is not a valid mac

can you please use this:

set -- $( strings /dev/mtd7 | grep 'fac_mac = ..:..:..:..:..:..' )
lan_mac="$( echo $3 | tr '[A-Z]' '[a-z]' )"

or maybe:

for lan_mac in $( strings /dev/mtd7 | grep 'fac_mac = ..:..:..:..:..:..' ); do 
:; done
lan_mac="$( echo $lan_mac | tr '[A-Z]' '[a-z]' )"

maybe you can even use one of the helpers in /lib/functions/system.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] UML not working in master

2015-09-26 Thread Bastian Bittorf
* Javier Domingo Cansino  [26.09.2015 13:26]:
> Hi,
> 
> I wanted to setup for some tests an environment running uml, and I found
> it's not compiling on master with default config. The error seems similar
> to a previous one I found in the bug tracker.

IMHO this is a macro problem and we locally have this fix running:
https://github.com/glycoknob/builder/commit/4dbb2911ec890ff698e1df6cad86584b5628f99f

please test and report, we can send it if it's useful for others too.

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


Re: [OpenWrt-Devel] Excluding a certain module from a kernel mod packaging ?

2015-09-27 Thread Bastian Bittorf
* Daniel Petre  [27.09.2015 11:10]:
> Hey guys,
> i am wondering what is the easiest way to exclude a certain module from being 
> packaged?
> For example i could use pptp from the "nf-nathelper-extra" package but i do 
> not need the rest:

this is not supported IMHO, what you can do is:

copy 'nf-nathelper-extra', make your changed and name it 'mymodules'.
select 'mymodules' and unselect 'nf-nathelper-extra'.

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: init/sysfixtime - exclude dnsmasq.time

2015-09-23 Thread Bastian Bittorf
* Kevin Darbyshire-Bryant  [23.09.2015 12:21]:

[...]

> signature timestamps.  If the system time is not actually 'internet
> time' (within a tolerance of which I'm unclear) and dnsmasq is using
> 'dnssec-check-unsigned' then ALL dns resolution will fail (everything is
> considered BOGUS) - arguably a fail safe in that it just stops!  This
> become really problematic when trying to resolve name to ip addresses of
> ntp servers ;-)

good point. so it makes sense to startup dnsmasq without dnssec strict
checks and reconfigure it when NTP was successful?

it would be really helpful if ntp can mark (with a file) somehow, that
time is 'good'. At least the returncode indicates that:

root@box:~ /usr/sbin/ntpd -q -n -p 1.openwrt.pool.ntp.org
root@box:~ echo $?
0

(it is e.g. 143 when it fails)

so if first timesetting is done, it has to trigger dnsmasq...

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: sysfixtime exclude dnsmasq.time

2015-09-22 Thread Bastian Bittorf
* Kevin Darbyshire-Bryant  [22.09.2015 11:06]:
> Either way, including /etc/dnsmasq.time as a time source for sysfixtime
> is not helpful.

please drop this patch, i will send a V2 which is faster - thanks Kevin for V1

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


[OpenWrt-Devel] [PATCH v2] base-files: init/sysfixtime - exclude dnsmasq.time

2015-09-22 Thread Bastian Bittorf
dnsmasq maintains dnsmasq.time across reboots and uses it as a means of
determining if current time is good enough to validate dnssec time
stamps.  By including /etc/dnsmasq.time as a time source for sysfixtime,
the mechanism was effectively defeated because time was set to the last
time that dnsmasq considered current even though that time is in
the past.  Since that time is out of date, dns(sec) resolution would
fail thus defeating any ntp based mechanisms for setting the clock
correctly.

In theory the process is defeated by any files in /etc that are newer
than /etc/dnsmasq.time however dnsmasq now updates the file's timestamp
on process TERM so hopefully /etc/dnsmasq.time is the latest file
timestamp in /etc as part of openWrt shutdown/reboot.

Either way, including /etc/dnsmasq.time as a time source for sysfixtime
is not helpful.

for safing time we dont read the filedate of every file,
but only the newest in each subdirectory of /etc and sort them.
this speeds up from 1.72 sec to 0.51 sec on my router.

v1 - original concept from Kevin Darbyshire-Bryant 
<ke...@darbyshire-bryant.me.uk>
v2 - speedup + update copyright date

Signed-off-by: Bastian Bittorf <bitt...@bluebottle.com>
---
 package/base-files/files/etc/init.d/sysfixtime |   13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/package/base-files/files/etc/init.d/sysfixtime 
b/package/base-files/files/etc/init.d/sysfixtime
index 4010e06..b3e3862 100755
--- a/package/base-files/files/etc/init.d/sysfixtime
+++ b/package/base-files/files/etc/init.d/sysfixtime
@@ -1,11 +1,20 @@
 #!/bin/sh /etc/rc.common
-# Copyright (C) 2013-2014 OpenWrt.org
+# Copyright (C) 2013-2015 OpenWrt.org
 
 START=00
 
 boot() {
local curtime="$(date +%s)"
-   local maxtime="$(find /etc -type f -exec date -r {} +%s \; | sort -nr | 
head -n1)"
+   local maxtime="$(maxtime)"
+
[ $curtime -lt $maxtime ] && date -s @$maxtime
 }
 
+maxtime() {
+   local dir file
+
+   find /etc -type d | while read dir; do
+   file="$dir/$( ls -1t "$dir" | head -n1 )"
+   [ -e "$file" -a "$file" != '/etc/dnsmasq.time' ] && date -r 
"$file" +%s
+   done | sort -nr | head -n1
+}
-- 
1.7.10.4
___
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: init/sysfixtime - exclude dnsmasq.time

2015-09-23 Thread Bastian Bittorf
* Yousong Zhou  [23.09.2015 07:58]:
> In theory, a security sensitive mechanism's dependence on a
> non-reliable timestamp file with access permission nobody:nogroup
> makes little sense to me.  How about that we do --dnssec-no-timecheck
> on dnsmasq startup time and notify it of the system time change from
> ntpd hotplug script?

this sounds good to me, but will be another patch.

should we drop this patch completely or does it still
make sense to deny reading '/etc/dnsmasq.time'?

and: of which hotplug script you are talking about?
find /etc/hotplug.d -name '*ntp*'
= empty

> Another idea would be to delegate timestamp update task to a specific
> service program like ntpd or procd and later on system startup we set
> system time from the specific file.

unsure if this is overkill, just for 1 service.

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


[OpenWrt-Devel] compression with 'brotli' / squashfs / FYI

2015-09-23 Thread Bastian Bittorf
i did a quick test, how good 'brotli' performs in compression
on binary files versus e.g. xz/lzma...here it is:

bytes:
10.905.600  uncompressed
 4.192.280  gzip -9
 3.362.626  brotli -11
 3.098.216  xz -9 --extreme
 3.097.691  lzma -9 --extreme

the uncompressed file is an unsquashfs'ed rootfs from
bin/ar71xx/openwrt-ar71xx-generic-root.squashfs and then
tar'ed.

so nothing to talk about for now, especially the
decompressor is HUGE and this must be taken into account.

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


[OpenWrt-Devel] HTTPS with 'letsencrypt.org' on OpenWrt

2015-09-25 Thread Bastian Bittorf
has anyone played with let's encrypt and their API?
http://letsencrypt.readthedocs.org/en/latest/api.html

at the moment they are doing really complicated stuff,
but maybe it's possible to hack something simply with
the built JSON-tools and curl?

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 <j...@szakmeister.net> [02.12.2015 16:04]:
> On Wed, Dec 2, 2015 at 6:14 AM, Bastian Bittorf <bitt...@bluebottle.com> 
> wrote:
> > * Petr Štetiar <yn...@true.cz> [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 <bitt...@bluebottle.com>
---
 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


[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] 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


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


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


[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] 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


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] 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] [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


[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 <bitt...@bluebottle.com>
---
 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] 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


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] [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] [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] 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] 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]:
> 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]:
> 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-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-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-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] use NTP server received via DHCP

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

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

when speaking with ubus/parsing json do this:

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

@jow: can you say more about that?


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

please do
[ -z "$ntpservers" ]

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

this comment also does not help 8-)

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

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

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

same as on top, dont parse JSON like this.

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

same as on top

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


[OpenWrt-Devel] flock vs. lock in scripts

2015-11-24 Thread Bastian Bittorf
OpenWrt ships since a long time an own
implementation of locking for scripts:

https://dev.openwrt.org/browser/trunk/package/utils/busybox/patches/220-add_lock_util.patch

can we use 'flock' for that which is upstream/busybox
or maybe use a shell-function for that?

seems, that the only users are:
/lib/functions.sh
/lib/preinit/30_failsafe_wait
/lib/preinit/40_run_failsafe_hook
/lib/preinit/99_10_failsafe_login

with e.g.:
lock $file
luch -u $file
lock -w $file

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-11-30 Thread Bastian Bittorf
* Petr Štetiar  [30.11.2015 13:47]:
> > 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?

ofcourse we have. even faster. we did a little bit of cheating
using power of the GCC compile Farm. But using a simple core i7 with 8
gig ram gives such numbers. I will provide more details 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] [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-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-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] 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] 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
* 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
* 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] 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


[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] [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


[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] [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 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] 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


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


[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 <bitt...@bluebottle.com>
---
 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] [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] [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] 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] [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 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] 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] 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-20 Thread Bastian Bittorf
* open...@daniel.thecshore.com <open...@daniel.thecshore.com> [20.01.2016 
14:01]:
> +# From Bastian Bittorf <bitt...@bluebottle.com>
> +# 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


[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 <bitt...@bluebottle.com>
---
 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


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


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] erro compiling 'master' with musl

2016-02-17 Thread Bastian Bittorf
* Bastian Bittorf <bitt...@bluebottle.com> [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] [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] 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] 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


[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-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] new kernel 4.1.20 / jffs-deadlock fix

2016-03-19 Thread Bastian Bittorf
* Sedat Dilek <sedat.di...@gmail.com> [18.03.2016 13:33]:
> On Fri, Mar 18, 2016 at 8:42 AM, Bastian Bittorf <bitt...@bluebottle.com> 
> 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


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=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] 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] [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


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

2016-04-27 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-25 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: [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_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


[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: 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: [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_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: [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_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


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


[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_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


<    2   3   4   5   6   7   8   >