[OpenWrt-Devel] [PATCH] start selected services after block mount
This patch adds /etc/hotplug.d/block/60-services that will look for "service" entries in /etc/config/fstab against a given mount and start them once the mount has been completed by the hotplug system. This is to solve the problem of usb devices being mounted after most of the rc system has completed, therefore any services that are intended to write to a mounted filesystem either fail or end up writing to the mount point prior to the mount.An example config:config 'mount' option 'enabled' '1' option 'device' '/dev/sda1' option 'target' '/site' option 'fstype' 'ext4' option 'options' 'rw,noatime' list 'service' 'syslog-ng' list 'service' 'collectd'Signed-off-by: Lee Essen block_mount_svcs.patch Description: Binary data ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] Resend: [PATCH] start selected services after block mount
Is there any interest in this?Is it better packaged separately?Also, as a side note, it does present another challenge ... all packages included in the image are enabled by default, this means these things would startup automatically the first time around could be enhanced to include a config string containing those packages not to auto-enable. I'm happy to implement, but if nobody is interested then I'll just keep it to my local repository.Thanks,Lee.Begin forwarded message:From: Lee Essen <lee.es...@nowonline.co.uk>Date: 18 February 2011 08:48:00 GMTTo: openwrt-devel@lists.openwrt.orgSubject: [PATCH] start selected services after block mountThis patch adds /etc/hotplug.d/block/60-services that will look for "service" entries in /etc/config/fstab against a given mount and start them once the mount has been completed by the hotplug system. This is to solve the problem of usb devices being mounted after most of the rc system has completed, therefore any services that are intended to write to a mounted filesystem either fail or end up writing to the mount point prior to the mount.An example config:config 'mount' option 'enabled' '1' option 'device' '/dev/sda1' option 'target' '/site' option 'fstype' 'ext4' option 'options' 'rw,noatime' list 'service' 'syslog-ng' list 'service' 'collectd'Signed-off-by: Lee Essen <lee.es...@nowonline.co.uk> block_mount_svcs.patch Description: Binary data ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] ltq_dsl_app support for taking pppoa link up and down
Hi, The attached patch adds a "notify" script to the dsl_cpe_control app to bring the relevant pppoa interface up (or down) whenever there is a line status change. As far as I can tell the existing hotplug mechanism doesn't work for non-br2684 based systems as there is no nas0 interface created, and hence no hotplug event ... so the ppp link stays down until you manually start it, people may be surviving by having an erroneous bridge configured (which seems to be the default), but clearly this isn't the right behaviour. The patch largely replicates the code from the atm hotplug script (with the addition of support for the link going down.) Signed-off-by: Lee Essen ifx_cpe_ifup.patch Description: Binary data ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] ltq_dsl_app support for taking pppoa link up and down
Hi Luka, On 18 Jan 2012, at 22:04, Luka Perkov wrote: > Hi Lee, > > On Wed, Jan 18, 2012 at 01:22:10PM +, lee.es...@nowonline.co.uk wrote: >> The attached patch adds a "notify" script to the dsl_cpe_control app >> to bring the relevant pppoa interface up (or down) whenever there is >> a line status change. >> >> As far as I can tell the existing hotplug mechanism doesn't work for >> non-br2684 based systems as there is no nas0 interface created, and >> hence no hotplug event ... so the ppp link stays down until you >> manually start it, people may be surviving by having an erroneous >> bridge configured (which seems to be the default), but clearly this >> isn't the right behaviour. >> >> The patch largely replicates the code from the atm hotplug script >> (with the addition of support for the link going down.) > > I did not test your patch yet but I think that regardles of the proto we > should > do ifup/ifdown. For example I use dhcp... > I'm not sure I understand what you mean? If this script didn't look for pppoa interfaces then it would try to bring up any 'down' interfaces when the DSL line came up, and more worryingly it would take every interface down when the link went down. My understanding is that you either use a br2684 bridge (for pppoe based DSL providers) or pppoa for native pppoa DSL providers (although I've no experience of the bridge option so I am making some assumptions.) In the bridge case the ppp link comes up as part of the hotplug mechanism, but for pppoa you need to trigger it as per the patch. So I'm not sure why you would look at non pppoa interfaces? In fact the code is mostly copied from the hotplug atm script to ensure the behaviour is as similar as possible. > + if [ "$DSL_INTERFACE_STATUS" = "UP" ]; then > + if [ "$proto" = "pppoa" ] && [ "$up" != 1 ] && [ "$auto" = 1 > ]; then > + found=1 > + ( sleep 1; ifup "$ifc" ) & > + fi > + else > + if [ "$proto" = "pppoa" ] && [ "$up" = 1 ] && [ "$auto" = 1 > ]; then > + found=1 > + ( sleep 1; ifdown "$ifc" ) & > + fi > + fi > +done > > This is the part of the patch I'm refering to. Please send your patches inline > in the future. Oops, apologies ... will do. > > Regards, > Luka Regards, Lee. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] DSL support and luci integration
Hi, I've been using trunk on a Buffalo WBMR-HP-G300H ADSL router with great success, so I've been looking at the existing DSL support and am keen to help out getting it better integrated. I'm conscious that there are likely to be a number of different DSL devices needing support and have been thinking about a way to have relatively standard support in LuCI but with flexibility in implementation. I have put together some patches to start doing this, but thought it best to check the concepts before getting too far ... also I don't know if anyone else is working on this or if other ideas have been discussed. So basically: A single "control" script that is shipped as part of the relevant driver (or app) for the device. For me, this is the lantiq one. The control script (my suggestion is: /etc/init.d/dsl_control) would be responsible for the normal start and stop as any rc script would be. But also ... the control script can be used to get the DSL status, either in human readable form, or in a standard form parsable by Luci. In this way any DSL implementation need only provide basic start, stop and status information and then it could easily appear in LuCI to provide line status, speed and noise information without any hardware specific detail in LuCI. Just by way of example: root@OpenWrt:~# /etc/init.d/dsl_control status Line State: UP [0x801: showtime_tc_sync] Data Rate: 4.064 Mb/s / 448 Kb/s Line Attenuation: 49.0dB / 26.5dB Noise Margin: 12.2dB / 25.0dB Or, the LuCI compatible version ... I went for a "loadstring" approach that returned a lua table: root@OpenWrt:~# /etc/init.d/dsl_control luastat local dsl={} dsl.line_state_num=0x801 dsl.line_state_detail="showtime_tc_sync" dsl.line_state="UP" dsl.data_rate_down=4064000 dsl.data_rate_up=448000 dsl.data_rate_down_s="4.064 Mb" dsl.data_rate_up_s="448 Kb" dsl.line_attenuation_down=49.0 dsl.line_attenuation_up=26.5 dsl.noise_margin_down=12.3 dsl.noise_margin_up=25.0 return dsl I've also implemented the basic summary in the LuCI admin overview page which looks pretty nice, updates regularly (you can see the noise margin changing) and doesn't seem to place much load on the system. There's a bit more to do, it currently doesn't actually check the daemon is running etc, also I think a "start_available" and "stop_available" variable might be a nice way to control whether LuCI should allow start and stop buttons ... possible on the network admin page? Anyway ... just a few ideas, interested in thoughts, I can post the current patches if there's interest, or happy to explore other ideas if I'm way off the mark. Cheers, Lee. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] DSL support and luci integration
On 19 Jan 2012, at 22:17, John Crispin wrote: > >> >> Anyway ... just a few ideas, interested in thoughts, I can post the >> current patches if there's interest, or happy to explore other ideas if >> I'm way off the mark. > > sure, show us your patch please ;) > ___ Ok, these aren't in the right format for a couple of reasons (namely that I haven't got a LuCI tree checked out yet, and that I'm still working on the main script and haven't put it back into the main tree), but hopefully this will give you a feel for what I'm talking about…. Firstly the main dsl_control script (/etc/init.d/dsl_control) … used to stop/start and provide hardware specific stats, this is still work in progress, I'll tidy it up and add more functionality (and error checking) over the next couple of days, and build a proper patch... #!/bin/sh /etc/rc.common # Copyright (C) 2008 OpenWrt.org START=99 EXTRA_COMMANDS="status luastat" EXTRA_HELP="status Get DSL status information lustat Get status information if lua friendly format" # # Basic functions to send CLI commands to the dsl_cpe_control daemon # dsl_cmd() { echo "$@" > /tmp/pipe/dsl_cpe0_cmd cat /tmp/pipe/dsl_cpe0_ack } dsl_val() { echo $(expr "$1" : '.*'$2'=\([[:alnum:]]*\).*') } # # Simple divide by 10 routine to cope with one decimal place # dbt() { local a=$(expr $1 / 10) local b=$(expr $1 % 10) echo "${a}.${b}" } # # Take a number and convert to k or meg # scale() { local val=$1 local a local b if [ "$val" -gt 100 ]; then a=$(expr $val / 1000) b=$(expr $a % 1000) a=$(expr $a / 1000) printf "%d.%03d Mb" ${a} ${b} elif [ "$val" -gt 1000 ]; then a=$(expr $val / 1000) printf "%d Kb" ${a} else echo "${val} b" fi } start() { # start CPE dsl daemon in the background /sbin/dsl_cpe_control -i \ -n /sbin/dsl_notify.sh \ -f /lib/firmware/ModemHWE.bin & # PS=`ps` # echo $PS | grep -q dsl_cpe_control && { # # workaround for nfs: allow write to pipes for non-root # while [ ! -e /tmp/pipe/dsl_cpe1_ack ] ; do sleep 1; done # chmod a+w /tmp/pipe/dsl_* # } echo $PS | grep -q dsl_cpe_control || { echo "Start of dsl_cpe_control failed!!!" false } } data_rates() { local csg local dru local drd local sdru local sdrd csg=$(dsl_cmd g997csg 0 1) drd=$(dsl_val "$csg" ActualDataRate) csg=$(dsl_cmd g997csg 0 0) dru=$(dsl_val "$csg" ActualDataRate) sdrd=$(scale $drd) sdru=$(scale $dru) if [ "$action" = "luastat" ]; then echo "dsl.data_rate_down=$drd" echo "dsl.data_rate_up=$dru" echo "dsl.data_rate_down_s=\"$sdrd\"" echo "dsl.data_rate_up_s=\"$sdru\"" else echo "Data Rate:${sdrd}/s / ${sdru}/s" fi } line_data() { local lsg local latnu local latnd local snru local snrd lsg=$(dsl_cmd g997lsg 1 1) latnd=$(dsl_val "$lsg" LATN) snrd=$(dsl_val "$lsg" SNR) lsg=$(dsl_cmd g997lsg 0 1) latnu=$(dsl_val "$lsg" LATN) snru=$(dsl_val "$lsg" SNR) latnd=$(dbt $latnd) latnu=$(dbt $latnu) snrd=$(dbt $snrd) snru=$(dbt $snru) if [ "$action" = "luastat" ]; then echo "dsl.line_attenuation_down=$latnd" echo "dsl.line_attenuation_up=$latnu" echo "dsl.noise_margin_down=$snrd" echo "dsl.noise_margin_up=$snru" else echo "Line Attenuation: ${latnd}dB / ${latnu}dB" echo "Noise Margin: ${snrd}dB / ${snru}dB" fi } line_state() { local lsg=$(dsl_cmd lsg) local ls=$(dsl_val "$lsg" nLineState); local s; case "$ls" in "0x0") s="not initialized" ;; "0x1") s="exception" ;; "0x10") s="not updated" ;; "0xff") s="idle request" ;; "0x100")s="idle" ;; "0x1ff")s="silent request" ;; "0x200")s="silent" ;; "0x300")s="handshake" ;; "0x380")s="full_init" ;; "0x400")s="discovery" ;; "0x500")s="training" ;; "0x600")s="analysis" ;; "0x700")s="exchange" ;; "0x800")s="showtime_no_sy
Re: [OpenWrt-Devel] DSL support and luci integration
On 20 Jan 2012, at 23:47, Philip Prindeville wrote: > I'd sure like to see netlink being used to communicate speed/carrier changes > up into userspace. > Unfortunately there's absolutely no netlink support in the lantiq driver and I don't think any of that info is available elsewhere, I would have thought trying to add a netlink capability would be a bit extreme? (and probably well outside my capability) … and that would then need to be done for every subsequent DSL driver to maintain standardisation. There is an ioctl interface, which also works without the daemon running, which I did consider, but my thought was that this would require an extra binary to maintain (unless there's a simple lua ioctl interface, but I couldn't find one) and would have a lot less transparency than a script -- but I'm happy to knock something up to make use of this if it's considered a better approach. Regards, Lee. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] DSL support and luci integration
Ok, with a bit of further investigation, netlink doesn't actually seem too difficult … is there a process for registering new support (i.e. NETLINK_DSL) or is there some other way to do this? Could something else be re-used? I'm happy to have a go at a sample implementation, but I'm completely new to netlink, so a little help and a few pointers would be great. Cheers, Lee. On 20 Jan 2012, at 23:47, Philip Prindeville wrote: > I'd sure like to see netlink being used to communicate speed/carrier changes > up into userspace. > > > On 1/20/12 12:20 AM, Lee Essen wrote: >> >> On 19 Jan 2012, at 22:17, John Crispin wrote: >> >>> >>>> >>>> Anyway ... just a few ideas, interested in thoughts, I can post the >>>> current patches if there's interest, or happy to explore other ideas if >>>> I'm way off the mark. >>> >>> sure, show us your patch please ;) >>> ___ >> >> Ok, these aren't in the right format for a couple of reasons (namely that I >> haven't got a LuCI tree checked out yet, and that I'm still working on the >> main script and haven't put it back into the main tree), but hopefully this >> will give you a feel for what I'm talking about…. >> >> Firstly the main dsl_control script (/etc/init.d/dsl_control) … used to >> stop/start and provide hardware specific stats, this is still work in >> progress, I'll tidy it up and add more functionality (and error checking) >> over the next couple of days, and build a proper patch... >> [snip] > ___ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/mailman/listinfo/openwrt-devel ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 1/2] Initial DSL framework for Lantiq
Hi, I think I've got my initial concept for DSL support to a point where it's quite functional now and ready for a bit more extensive testing. I will look at netlink as discussed, but I think that will take some time, so I think this would serve as a good interim solution (some of it is valid with a netlink solution anyway.) So this proposes a very simple script based framework (which is used by LuCI) and provides an implementation for the Lantiq driver. The patch is in two parts, this one contains the non-LuCI bits, the next one provides support for DSL in LuCI with an overview status in the admin_status page and a extra DSL tab on the network admin section which shows similar data and allows you to start and start the daemon. So the non-luci bits: - Removed ifx_cpe_control_init.sh (the old init script) - Created dsl_control (/etc/init.d) - tidied up start and stop - stop calls dsl_notify before killing daemon - has status and lucistat options to provide detail - copes with daemon not running situation - Updated package makefile to use new init script and to build cli support - Provide a dsl_notify.sh script to cope with line up/down events The patch is below. Cheers, Lee. Index: package/ltq-dsl-app/files/dsl_control === --- package/ltq-dsl-app/files/dsl_control (revision 0) +++ package/ltq-dsl-app/files/dsl_control (revision 0) @@ -0,0 +1,280 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2008 OpenWrt.org +START=99 + +EXTRA_COMMANDS="status lucistat" +EXTRA_HELP=" status Get DSL status information + lucistat Get status information if lua friendly format" + +SERVICE_DAEMONIZE=1 +SERVICE_WRITE_PID=1 + +# +# Basic functions to send CLI commands to the dsl_cpe_control daemon +# +dsl_cmd() { + pkill -0 dsl_cpe_control && ( + echo "$@" > /tmp/pipe/dsl_cpe0_cmd + cat /tmp/pipe/dsl_cpe0_ack + ) +} +dsl_val() { + echo $(expr "$1" : '.*'$2'=\([-\.[:alnum:]]*\).*') +} + +# +# Simple divide by 10 routine to cope with one decimal place +# +dbt() { + local a=$(expr $1 / 10) + local b=$(expr $1 % 10) + echo "${a}.${b}" +} +# +# Take a number and convert to k or meg +# +scale() { + local val=$1 + local a + local b + + if [ "$val" -gt 100 ]; then + a=$(expr $val / 1000) + b=$(expr $a % 1000) + a=$(expr $a / 1000) + printf "%d.%03d Mb" ${a} ${b} + elif [ "$val" -gt 1000 ]; then + a=$(expr $val / 1000) + printf "%d Kb" ${a} + else + echo "${val} b" + fi +} + +# +# Read the data rates for both directions +# +data_rates() { + local csg + local dru + local drd + local sdru + local sdrd + + csg=$(dsl_cmd g997csg 0 1) + drd=$(dsl_val "$csg" ActualDataRate) + + csg=$(dsl_cmd g997csg 0 0) + dru=$(dsl_val "$csg" ActualDataRate) + + [ -z "$drd" ] && drd=0 + [ -z "$dru" ] && dru=0 + + sdrd=$(scale $drd) + sdru=$(scale $dru) + + if [ "$action" = "lucistat" ]; then + echo "dsl.data_rate_down=$drd" + echo "dsl.data_rate_up=$dru" + echo "dsl.data_rate_down_s=\"$sdrd\"" + echo "dsl.data_rate_up_s=\"$sdru\"" + else + echo "Data Rate:${sdrd}/s / ${sdru}/s" + fi +} + +# +# Chipset +# +chipset() { + local vig + local cs + local csv + + vig=$(dsl_cmd vig) + cs=$(dsl_val "$vig" DSL_ChipSetType) + csv=$(dsl_val "$vig" DSL_ChipSetHWVersion) + + if [ "$action" = "lucistat" ]; then + echo "dsl.chipset=\"${cs} ${csv}\"" + else + echo "Chipset: ${cs} ${csv}" + fi +} + +# +# Work out how long the line has been up +# +line_uptime() { + local ccsg + local et + local etr + local d + local h + local m + local s + local rc="" + + ccsg=$(dsl_cmd pmccsg 0 0 0) + et=$(dsl_val "$ccsg" nElapsedTime) + + [ -z "$et" ] && et=0 + + if [ "$action" = "lucistat" ]; then + echo "dsl.line_uptime=${et}" + return + fi + + d=$(expr $et / 86400) + etr=$(expr $et % 86400) + h=$(expr $etr / 3600) + etr=$(expr $etr % 3600) + m=$(expr $etr / 60) + s=$(expr $etr % 60) + + + [ "${d}${h}${m}${s}" -ne 0 ] && rc="${s}s" + [ "${d}${h}${m}" -ne 0 ] && rc="${m}m ${rc}" + [ "${d}${h}" -ne 0 ] && rc="${h}h ${rc}" + [ "${d}" -ne 0 ] && rc="${d}d ${rc}" + + [ -z "$rc" ] && rc="down" + echo "Line Uptime: ${rc}" +} + +# +# Get noise and attenuation figures +# +line_data() { + local lsg + local latnu + local latnd + local snru + local snrd +
Re: [OpenWrt-Devel] DSL support and luci integration
Hi Andy, I posted a brief summary on the openwrt 'General' forum earlier today ... it's brief but will hopefully help. I've done 2 now, only bricked one (by experimenting) and the serial cable makes it pretty easy to recover. Cheers, Lee. On 25 Jan 2012, at 22:01, Andrew Lyon wrote: > On Thu, Jan 19, 2012 at 8:51 PM, wrote: >> Hi, >> >> I've been using trunk on a Buffalo WBMR-HP-G300H ADSL router with great >> success, so I've been looking at the existing DSL support and am keen to >> help out getting it better integrated. > > Could you explain or point me in the direction of documentation about > how you installed openwrt onto the WBMR-HP-G300H? I just got one to do > some testing with and have loaded dd-wrt, I have serial console > working and I think I can simply write the appropriate image to one of > the mtd devices but if you can detail how you did it it would be > helpful, and reduce the chances of me bricking the device. > > The openwrt wiki has hardly any documentation about the WBMR-HP-G300H, > I will try to contribute some info... > > Thanks > Andy > > >> >> I'm conscious that there are likely to be a number of different DSL devices >> needing support and have been thinking about a way to have relatively >> standard support in LuCI but with flexibility in implementation. >> >> I have put together some patches to start doing this, but thought it best to >> check the concepts before getting too far ... also I don't know if anyone >> else is working on this or if other ideas have been discussed. >> >> So basically: >> >> A single "control" script that is shipped as part of the relevant driver (or >> app) for the device. For me, this is the lantiq one. >> The control script (my suggestion is: /etc/init.d/dsl_control) would be >> responsible for the normal start and stop as any rc script would be. >> But also ... the control script can be used to get the DSL status, either in >> human readable form, or in a standard form parsable by Luci. >> >> In this way any DSL implementation need only provide basic start, stop and >> status information and then it could easily appear in LuCI to provide line >> status, speed and noise information without any hardware specific detail in >> LuCI. >> >> Just by way of example: >> >> root@OpenWrt:~# /etc/init.d/dsl_control status >> Line State: UP [0x801: showtime_tc_sync] >> Data Rate: 4.064 Mb/s / 448 Kb/s >> Line Attenuation: 49.0dB / 26.5dB >> Noise Margin: 12.2dB / 25.0dB >> >> Or, the LuCI compatible version ... I went for a "loadstring" approach that >> returned a lua table: >> >> root@OpenWrt:~# /etc/init.d/dsl_control luastat >> local dsl={} >> dsl.line_state_num=0x801 >> dsl.line_state_detail="showtime_tc_sync" >> dsl.line_state="UP" >> dsl.data_rate_down=4064000 >> dsl.data_rate_up=448000 >> dsl.data_rate_down_s="4.064 Mb" >> dsl.data_rate_up_s="448 Kb" >> dsl.line_attenuation_down=49.0 >> dsl.line_attenuation_up=26.5 >> dsl.noise_margin_down=12.3 >> dsl.noise_margin_up=25.0 >> return dsl >> >> I've also implemented the basic summary in the LuCI admin overview page >> which looks pretty nice, updates regularly (you can see the noise margin >> changing) and doesn't seem to place much load on the system. >> >> There's a bit more to do, it currently doesn't actually check the daemon is >> running etc, also I think a "start_available" and "stop_available" variable >> might be a nice way to control whether LuCI should allow start and stop >> buttons ... possible on the network admin page? >> >> Anyway ... just a few ideas, interested in thoughts, I can post the current >> patches if there's interest, or happy to explore other ideas if I'm way off >> the mark. >> >> Cheers, >> >> Lee. >> >> ___ >> openwrt-devel mailing list >> openwrt-devel@lists.openwrt.org >> https://lists.openwrt.org/mailman/listinfo/openwrt-devel > ___ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/mailman/listinfo/openwrt-devel ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] Proposal for service start after mount capability
Hi, I think it was about a year ago when I first proposed this, there was some feedback and I reworked the code but looking back I don't think I ever resubmitted - so here's a second go! Basically if you make use of usb storage devices and specifically if you want to have services make use of the storage from service start time (for example, collectd or syslog-ng etc.) then you have a problem ... the usb device is mounted much too late in the boot sequence and you'll find the services writing "underneath" the mount point. Also, you may want to only start the service once the device is plugged in (well after the boot sequence) ... can't think of a good example here, but it's probably better to do the right thing with hotplug rather than to hack around with the startup sequence. So the basic idea is that in the fstab config you can specify that specific services are started once the filesystem is mounted, this is then handled by the hotplug system. There's also a menuconfig option to allow you to specific services that aren't started at boot time (since that's the default.) This is made up of a patch to package/Makefile to handle the non-auto-starting of services, and then a new package which I've called block-hotplug-svcs. An example /etc/config/fstab entry: config mount option target /site option device /dev/sda1 option fstype ext4 option options rw,sync,noatime list servicesyslog-ng option enabled 1 option enabled_fsck 1 The code below is probably space mangled, but it's really there for comment for now Index: package/Makefile === --- package/Makefile(revision 30306) +++ package/Makefile(working copy) @@ -79,6 +79,7 @@ cd $(TARGET_DIR); \ for script in ./etc/init.d/*; do \ grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \ + echo $(CONFIG_NO_AUTO_ENABLE_SERVICES) | grep -v -w `basename $$script` > /dev/null || continue; \ IPKG_INSTROOT=$(TARGET_DIR) $$(which bash) ./etc/rc.common $$script enable; \ done || true \ ) Then the new package Config.in === config NO_AUTO_ENABLE_SERVICES string prompt "Services to not auto enable in the image" depends on PACKAGE_block-hotplug-svcs default "" help All packages are enabled in the image by default. If we need to start services using this service then we need to list the ones we dont want enabled. Makefile === # # Copyright (C) 2006-2009 OpenWrt.org # Copyright 2010 Vertical Communications # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # include $(TOPDIR)/rules.mk PKG_NAME:=block-hotplug-svcs PKG_VERSION:=0.1.0 PKG_RELEASE:=1 include $(INCLUDE_DIR)/package.mk define Package/block-hotplug-svcs SECTION:=ob CATEGORY:=Owls Barn TITLE:=Start services after block hotplug event DEPENDS:=+block-mount +hotplug2 endef define Package/block-hotplug-svcs/config source "$(SOURCE)/Config.in" endef define Package/block-hotplug-svcs/description Scripts used to automatically start services after a hotplug event (filesystem mount) endef define Build/Compile endef define Package/block-hotplug-svcs/install $(INSTALL_DIR) $(1)/etc/hotplug.d/block $(INSTALL_DATA) ./files/60-services $(1)/etc/hotplug.d/block/ endef $(eval $(call BuildPackage,block-hotplug-svcs)) files/60-services === #!/bin/sh . /etc/functions.sh start_service() { /etc/init.d/$1 $2 } find_device() { local cfg="$1" local hotdev="$2" local action="$3" local enabled local device config_get device "$cfg" device config_get_bool enabled "$cfg" enabled 0 [ $enabled -lt 1 ] && return [ $action = "start" ] && { grep -q "$hotdev" /proc/mounts || return } [ "$device" = "$hotdev" ] && { config_get target "$1" target config_list_foreach "$1" "service" start_service $action } } config_load fstab case "$ACTION" in add) config_foreach find_device mount "/dev/$DEVNAME" "start" ;; remove) config_foreach find_device mount "/dev/$DEVNAME" "stop" ;; esac ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Proposal for service start after mount capability
On Tue, 07 Feb 2012 10:44:21 +0100, Maarten Bezemer wrote: On Tuesday 07 February 2012 09:19:25 lee.es...@nowonline.co.uk wrote: Also, you may want to only start the service once the device is plugged in (well after the boot sequence) ... can't think of a good example here, but it's probably better to do the right thing with hotplug rather than to hack around with the startup sequence. Automatically start samba/sharing service when an external USB disk has been plugged in? And how about stopping services when an USB device has been removed. Say I have an exeternal harddisk plugged in, but I want to use it (temporarely) to transport (other) data or something. So I remove it from the router, any file sharing services should be stopped (ideally). Is it possible to support this as well? Regards, Maarten Hi Maarten, On the "stopping" front, the code actually attempts to do this, however I'm not sure how (or if) the hotplug stuff will get called *before* the device actually goes away. It would be easy to put together some kind of "eject" script that would do the right thing, but there may be a better way of achieving it. I'll happily add "eject" unless someone comes up with a better approach. Regards, Lee. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] shellinabox build problems
Hi, There's a ticket open (#7043) for adding shellinabox to openwrt ... there are patches attached to it which seem to do the job, however (as you can see from the last comment in Jan) there is a problem building it. I've got what I assume is the same problem: mv -f .deps/hashmap.Tpo .deps/hashmap.Plo mv: cannot stat `.deps/hashmap.Tpo': No such file or directory If you go through Makefile.in and remove the lines containing these mv's then it seems to build ok, all except the final binary (although there's no error, just doesn't seem to be there???) So fundamentally this looks like it should build ok, and it would be really handy to have ... any ideas? I've never really understood all the deps stuff. Cheers, Lee. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] fix syslog-ng start script
Hi, The syslog-ng start script doesn't stop syslog-ng because it tries to use pid's instead of the executable name. Very simple patch attached. (apologies: tabs are mangled, I'm on a webmail system and can't seem to fix it, there are only 2 though :-)) Lee. Signed-off-by: Lee Essen Index: admin/syslog-ng/files/syslog-ng.init === --- admin/syslog-ng/files/syslog-ng.init(revision 29908) +++ admin/syslog-ng/files/syslog-ng.init(working copy) @@ -3,8 +3,6 @@ START=50 -SERVICE_USE_PID=1 - start() { [ -f /etc/syslog-ng.conf ] || return 1 service_start /usr/sbin/syslog-ng ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] openwrt capable router with integrated adsl modem
Hi, On 11 Feb 2012, at 18:54, John Crispin wrote: > buffalo wbmr is a nice choice, trunk works on t, wifi usb come up, has 4 > gbit ports. > > john > ___ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/mailman/listinfo/openwrt-devel I've got three of these up and running now on a three-way (well, two-way, it will be three tomorrow) bonded setup. I would thoroughly recommend these devices - they're great and pretty reasonably priced. I'm getting good DSL performance as well … one of them seems too good, although it did reboot (the whole thing, not just the DSL) and lower the rate a little, so I suspect there are still things to be sorted out with the driver … but it's been rock solid since, and the other one in current use has been stable for about three weeks now, no issues at all. Lee. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] Frequent reboot WBMR & Lantiq
Hi, I've been running the Buffalo WBMR-HP-G300H routers for a while now, actually three of them on a bonded line, and in general they are working very well. On one of the lines I am seeing very frequent reboots (of the whole system, not just the DSL) every two or three hours, the other two lines seem to be stable (although I have seen reboots on the other lines, not for the last week or so). The "faulty" line is the one that seems to sync closer to it's limit (it has a smaller noise margin) but it's been stable with other DSL routers in the past. I am going to swap the hardware around, to make sure it's not something hardware related (they are all running the same firmware), although I suspect it's a panic caused by the lantiq driver when some situation happens on the line ... the same router stayed up for over 6 weeks with no DSL connected while I was puting the build together. Is there any way to get a crash dump configured in openwrt so I can get more info about the reboot cause? Thanks, Lee. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Frequent reboot WBMR & Lantiq
On Tue, 21 Feb 2012 09:41:44 +0100, John Crispin wrote: On 21/02/12 09:17, lee.es...@nowonline.co.uk wrote: Hi, I've been running the Buffalo WBMR-HP-G300H routers for a while now, actually three of them on a bonded line, and in general they are working very well. On one of the lines I am seeing very frequent reboots (of the whole system, not just the DSL) every two or three hours, the other two lines seem to be stable (although I have seen reboots on the other lines, not for the last week or so). The "faulty" line is the one that seems to sync closer to it's limit (it has a smaller noise margin) but it's been stable with other DSL routers in the past. I am going to swap the hardware around, to make sure it's not something hardware related (they are all running the same firmware), although I suspect it's a panic caused by the lantiq driver when some situation happens on the line ... the same router stayed up for over 6 weeks with no DSL connected while I was puting the build together. Is there any way to get a crash dump configured in openwrt so I can get more info about the reboot cause? crashlog is what you are looking for. ../o.git/build_dir/linux-lantiq_ar9/linux-3.1.9/patches/generic/930-crashlog.patch Thanks John ... it was already configured and I had a reboot this morning, interestingly though it doesn't actually look like the lantiq driver ... the first backtrace I get once after boot, doesn't seem to be a problem, the second one is the Oops! So is the problem the "eth0: tx ring full"?? <4>[ 20.004000] Infineon CPE API Driver version: DSL CPE API V3.24.4.4 <6>[ 20.144000] ATM (A1) firmware version 1.0.19 <4>[ 20.148000] ifxmips_atm: ATM init succeed <6>[ 20.18] dwc_otg: version 2.60a 22-NOV-2006 <6>[ 20.784000] DWC_otg: Using DMA mode <6>[ 20.784000] dwc_otg dwc_otg.0: DWC OTG Controller <6>[ 20.788000] dwc_otg dwc_otg.0: new USB bus registered, assigned bus number 1 <6>[ 20.796000] dwc_otg dwc_otg.0: irq 62, io mem 0xbe101000 <6>[ 20.804000] DWC_otg: Init: Port Power? op_state=1 <6>[ 20.808000] DWC_otg: Init: Power Port (0) <6>[ 20.812000] hub 1-0:1.0: USB hub found <6>[ 20.816000] hub 1-0:1.0: 1 port detected <6>[ 20.844000] input: gpio-keys-polled as /devices/platform/gpio-keys-polled/input/input0 <4>[ 20.968000] DISCONNECTED PORT <6>[ 22.924000] device eth0 entered promiscuous mode <6>[ 22.976000] br-lan: port 1(eth0) entering forwarding state <6>[ 22.98] br-lan: port 1(eth0) entering forwarding state <6>[ 27.588000] device eth0 left promiscuous mode <6>[ 27.592000] br-lan: port 1(eth0) entering forwarding state <6>[ 27.976000] device eth0 entered promiscuous mode <6>[ 27.98] br-lan: port 1(eth0) entering forwarding state <6>[ 27.984000] br-lan: port 1(eth0) entering forwarding state <3>[ 55.30] [DSL_BSP_Showtime 916]: Datarate US intl = 448000, fast = 0 <4>[ 58.044000] [ cut here ] <4>[ 58.044000] WARNING: at kernel/softirq.c:159 0x80022258() <4>[ 58.044000] Modules linked in: gpio_keys_polled dwc_otg lantiq_atm drv_dsl_cpe_api lantiq_mei ledtrig_usbdev ip6t_REJECT ip6t_LOG ip6t_rt ip6t_hbh ip6t_mh ip6t_ipv6header ip6t_frag ip6t_eui64 ip6t_ah ip6table_raw ip6_queue ip6table_mangle ip6table_filter ip6_tables nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_irc nf_conntrack_irc nf_nat_ftp nf_conntrack_ftp ipt_MASQUERADE iptable_nat nf_nat xt_conntrack xt_CT xt_NOTRACK iptable_raw xt_state nf_conntrack_ipv4 nf_defrag_ipv4 nf_conntrack pppoe pppox pppoatm ipt_REJECT xt_TCPMSS ipt_LOG xt_comment xt_multiport xt_mac xt_limit iptable_mangle iptable_filter ip_tables xt_tcpudp x_tables ppp_async ppp_generic slhc button_hotplug br2684 atm ath9k ath9k_common ath9k_hw ath mac80211 usbcore nls_base crc_ccitt ipv6 cfg80211 compat arc4 aes_generic crypto_algapi <4>[ 58.044000] Call Trace:[<8022c144>] 0x8022c144 <4>[ 58.044000] [<8022c144>] 0x8022c144 <4>[ 58.044000] [<8001b96c>] 0x8001b96c <4>[ 58.044000] [<80022258>] 0x80022258 <4>[ 58.044000] [<8001b9b0>] 0x8001b9b0 <4>[ 58.044000] [<801943f4>] 0x801943f4 <4>[ 58.044000] [<831c437c>] 0x831c437c <4>[ 58.044000] [<80022258>] 0x80022258 <4>[ 58.044000] [<832e4640>] 0x832e4640 <4>[ 58.044000] [<80015c58>] 0x80015c58 <4>[ 58.044000] [<83281330>] 0x83281330 <4>[ 58.044000] [<8004f370>] 0x8004f370 <4>[ 58.044000] [<800309b8>] 0x800309b8 <4>[ 58.044000] [<8004f5b0>] 0x8004f5b0 <4>[ 58.044000] [<80051784>] 0x80051784 <4>[ 58.044000] [<8004ecf8>] 0x8004ecf8 <4>[ 58.044000] [<800079b4>] 0x800079b4 <4>[ 58.044000] [<800031c8>] 0x800031c8 <4>[ 58.044000] [<80022130>] 0x80022130 <4>[ 58.044000] [<80005ecc>] 0x80005ecc <4>[ 58.044000] [<800060a0>] 0x800060a0 <4>[ 58.044000] [<8001701c>] 0x8001701c <4>[ 58.044000] [<80007a10>] 0x80007a10 <4>[ 58.044000] [<800060c0>] 0x800060c0 <4>[ 58.044000] [<8028e8ec>] 0x8028e8ec <4>[ 58.044000] [<8028e230>] 0x8028e230 <4>[ 58.04
Re: [OpenWrt-Devel] Frequent reboot WBMR & Lantiq
On Tue, 21 Feb 2012 10:56:44 +0100, John Crispin wrote: please build a kernel with KALLSYMS enable menuconfig -> Global build settings -> Compile the kernel with symbol table information and show us the output again. i assume this is annex-a ?! OK, new kernel built and installed ... just waiting for a reboot now, hopefully in the next couple of hours. Yes, it is Annex-A. Regards, Lee. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Frequent reboot WBMR & Lantiq
On Tue, 21 Feb 2012 12:55:41 +, lee.es...@nowonline.co.uk wrote: OK, new kernel built and installed ... just waiting for a reboot now, hopefully in the next couple of hours. Yes, it is Annex-A. Well, that didn't take long ... full log output below including the initial boot (just in case that helps.) I'm confused that the other two routers aren't seeing the same problem, the only difference I can think of is that this one is the default for locally generated traffic from my load balancer (openwrt also) so it gets a litte more traffic, but it's not a lot mainly just DNS traffic. Lee. Time: 1329832916.194484 Modules:gpio_keys_polled@82c7d000+864 dwc_otg@82c7+cf0f lantiq_atm@833a+c249drv_dsl_cpe_api@833c+1afb6 lantiq_mei@83398000+533bledtrig_usbdev@83393000+854 ip6t_REJECT@8338d000+9d4 ip6t_LOG@83388000+18f4 ip6t_rt@8337f000+5e4ip6t_hbh@83376000+504 ip6t_mh@83384000+2b4 ip6t_ipv6header@83379000+434 ip6t_frag@8338+354 ip6t_eui64@8335b000+2b4 ip6t_ah@8337b000+314 ip6table_raw@83373000+234 ip6_queue@8337a000+fb4 ip6table_mangle@8333+3d4ip6table_filter@8333e000+274 ip6_tables@8337+2606 nf_conntrack_ipv6@8335c000+1064 nf_defrag_ipv6@8334c000+1473 nf_nat_irc@83336000+364nf_conntrack_irc@83353000+a14 nf_nat_ftp@8333d000+424 nf_conntrack_ftp@8335+1234 ipt_MASQUERADE@8334b000+3f4iptable_nat@8334f000+8ba nf_nat@83338000+2894xt_conntrack@8334e000+854 xt_CT@8331f000+5d4 xt_NOTRACK@83317000+254 iptable_raw@8000+274 xt_state@83327000+2b4 nf_conntrack_ipv4@8331e000+fc7 nf_defrag_ipv4@83315000+2c7 nf_conntrack@8334+9e2b pppoe@83324000+2094 pppox@831d1000+4f0 pppoatm@831e3000+974 ipt_REJECT@83311000+724 xt_TCPMSS@831df000+af4 ipt_LOG@8314e000+17a4 xt_comment@830a1000+1d4xt_multiport@8330d000+494 xt_mac@831e2000+254 xt_limit@83309000+594 iptable_mangle@831d9000+374iptable_filter@83245000+2b4 ip_tables@831ec000+2450 xt_tcpudp@831e6000+684 x_tables@831d4000+29a4 ppp_async@83246000+1d44 ppp_generic@83318000+4e88 slhc@8330e000+12c3 button_hotplug@8330a000+ab4 br2684@83302000+18c4atm@831f+933c ath9k@832e+169ed ath9k_common@8313c000+589 ath9k_hw@8328+574b2 ath@83248000+3f8f mac80211@8320+402c7 usbcore@8316+19f87 nls_base@8312a000+12dc crc_ccitt@830b9000+3f4 ipv6@8318+3e3d2 cfg80211@8310+2349e compat@83064000+3f7 arc4@8307a000+344 aes_generic@83088000+75ea crypto_algapi@8308+26b7 0.052000] NET: Registered protocol family 16 <6>[0.064000] MIPS: machine is WBMR <6>[0.084000] bio: create slab at 0 <7>[0.096000] pci :00:0e.0: [168croot=/dev/mtdblock3rorootfstype=squashfsip=192.168.11.1:192.168.11.2eth0:onconsole=ttyS1,115200ethaddr=00:24:A5:BD:37:90phym=64Mmem=64Mpanic=1mtdparts=ifx_nor0:256k(uboot),128k(ubootconfig),1280k(kernel),30336k(rootfs),256k(firmware),128k(user_property),128k(fwdiag),128k(boardcfg),128k(calibration)init=/etc/preinitquiet: set to [mem 0£ð£ðð3£ðC£ðZCI address [0x1800-0x1800]) <6>[0.104000] Switching to clocksource MIPS <6>[0.112000] NET: Registered protocol family 2 <6>[0.116000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes) <6>[0.124000] TCP established hash table entries: 2048 (order: 2, 16384 bytes) <6>[0.132000] TCP bind hash table entries: 2048 (order: 1, 8192 bytes) <6>[0.136000] TCP: Hash tables configured (established 2048 bind 2048) <6>[0.144000] TCP reno registered <6>[0.148000] UDP hash table entries: 256 (order: 0, 4096 bytes) <6>[0.152000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes) <6>[0.16] NET: Registered protocol family 1 <7>[0.164000] PCI: CLS 0 bytes, default 32 <6>[0.164000] gptu: totally 6 16-bit timers/counters <6>[0.168000] gptu: misc_register on minor 63 <6>[0.172000] gptu: succeeded to request irq 126 <6>[0.18] gptu: succeeded to request irq 127 <6>[0.184000] gptu: succeeded to request irq 128 <6>[0.188000] gptu: succeeded to request irq 129 <6>[0.192000] gptu: succeeded to request irq 130 <6>[0.196000] gptu: succeeded to request irq 131 <6>[0.204000] squashfs: version 4.0 (2009/01/31) Phillip Lougher <6>[0.212000] JFFS2 version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc. <6>[0.224000] msgmni has been set to 120 <6>[0.224000] io scheduler noop registered <6>[0.228000] io scheduler deadline registered (default) <6>[0.236000] ltq_asc.0: ttyLTQ0 at MMIO 0x1e100400 (irq = 104) is a ltq_asc <6>[0.244000] ltq_asc.1: ttyLTQ1 at MMIO 0x1e100c00 (irq = 112) is a ltq_asc <6>[0.252000] console [ttyLTQ1] enabled, bootconsole disabled <6>[0.264000] ltq_nor: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0xc2 Chip ID 0x0
[OpenWrt-Devel] local domain resolver issues
Hi, I've noticed some slightly strange behaviour on trunk (certainly compared with older releases) around how names are resolved. If I have a host "fred", that I configure within LuCI then the dnsmasq command line will include records for that, with the appropriate domain (lets call it: my.domain.org) So if I'm on another machine, pointing dns at openwrt then everything is fine, my domain name is properly set and query's for "fred" without a domain get the domain added and then the result is returned. If I'm actually on the openwrt box, then whenever I run a query (ping, nslookup anything) it doesn't seem to append the domain name (I assumed it would use the "search" entry from resolve.conf, or the domain from the hostname) … neither of these seem to get looked at and the bare query is sent to dnsmasq … which doesn't know the answer since it's appended the domain onto all the host records and doesn't keep the non-appended ones. I believe the problem is with the resolver since it's clearly not using resolv.conf … has anyone else seen this? I'll continue to dig. Lee. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] dnsmasq sending to all upstream servers??
You can tell I've been looking at my outgoing DNS traffic … another problem… >From looking at traffic I can see dnsmasq sending each dns request to ALL the >servers configured (two in my case) which it shouldn't be doing (I haven't got >the all-servers option enabled) So it's obviously a bit wasteful ands add upstream load, but given it seems to close the socket once it's got the first reply, it also ends up generating a icmp port unreachable for the second and presumably subsequent replies. Can anyone else confirm this? (trunk) Thanks, Lee. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel