[OpenWrt-Devel] dnsmasq sending to all upstream servers??

2012-02-24 Thread Lee Essen
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


[OpenWrt-Devel] Frequent reboot WBMR Lantiq

2012-02-21 Thread lee . essen

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

2012-02-21 Thread lee . essen

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.044000]
4[   58.044000] ---[ end trace 01fcc832fe4215f4 ]---
3[ 6986.092000] eth0: tx ring full
1[ 6986.096000] CPU 0 Unable to handle kernel paging request at 

Re: [OpenWrt-Devel] Frequent reboot WBMR Lantiq

2012-02-21 Thread lee . essen

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] openwrt capable router with integrated adsl modem

2012-02-12 Thread Lee Essen
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


Re: [OpenWrt-Devel] Proposal for service start after mount capability

2012-02-07 Thread lee . essen

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

2012-02-07 Thread lee . essen

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

2012-02-07 Thread lee . essen

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 lee.es...@nowonline.co.uk


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] DSL support and luci integration

2012-01-25 Thread Lee Essen
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 andrew.l...@gmail.com wrote:

 On Thu, Jan 19, 2012 at 8:51 PM,  lee.es...@nowonline.co.uk 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] [PATCH 1/2] Initial DSL framework for Lantiq

2012-01-23 Thread Lee Essen
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
+   
+   lsg=$(dsl_cmd g997lsg 1 1)
+   latnd=$(dsl_val $lsg LATN)
+   snrd=$(dsl_val $lsg SNR)
+   

Re: [OpenWrt-Devel] DSL support and luci integration

2012-01-22 Thread Lee Essen
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


Re: [OpenWrt-Devel] DSL support and luci integration

2012-01-21 Thread Lee Essen

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


[OpenWrt-Devel] DSL support and luci integration

2012-01-19 Thread lee . essen

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

2012-01-19 Thread Lee Essen

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_sync ;;
0x801)s=showtime_tc_sync ;;
0x900)s=fastretrain ;;
0xa00)

[OpenWrt-Devel] [PATCH] ltq_dsl_app support for taking pppoa link up and down

2012-01-18 Thread lee . essen

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 lee.es...@nowonline.co.uk

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

2012-01-18 Thread Lee Essen
Hi Luka,

On 18 Jan 2012, at 22:04, Luka Perkov open...@lukaperkov.net 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] Resend: [PATCH] start selected services after block mount

2011-03-11 Thread Lee Essen
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.ukDate: 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] start selected services after block mount

2011-02-18 Thread Lee Essen
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 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