DIR-300 sous DD-WRT

Attention ne concerne que la révision B du Dir-300

On peut flasher le Dlink DIR-300 en DD-WRT directement depuis l’interface constructeur; on remarque toutefois que les leds POWER et INTERNET sont mal gérées et que le bouton WPS sur le coté droit ne permet pas d’activer et désactiver le Wifi, comme l’interface graphique le laisserait penser :


Gestion radio
Cette dernière fonctionnalité est de plus en plus demandée par les abonnés.

Pour remédier à ces petites lacunes, il convient de le flasher avec une version de DD-WRT intégrant l’utilitaire gpioread, que l’on peut trouver ici ou en copie là, et de créer un script de startup permettant de gérer le bouton WPS et les couleurs des Leds; ce firmware se flashe depuis l’interface Dlink.

Script de startup

C’est de fait le contenu de la variable rc_startup de la nvram (nvram get rc_startup dans une session ssh ou telnet).

TST=$(/usr/sbin/nvram get radiooff_button)
 if [ "x${TST}" == "x1" ]; then
 # Generate SESButton script and make it executable
 logger -s  "Generating SESButton script"
 mkdir /tmp/etc/config/
 echo "if [ \`ifconfig | grep ra0\` == "" ]; then
 logger -s \"Current wireless status: Off, Turning wireless on...\"
 /sbin/ifconfig ra0 up
 /sbin/gpio enable 13
 else
 logger -s \"Current wireless status: On, Turning wireless off...\"
 /sbin/ifconfig ra0 down
 /sbin/gpio disable 13
 fi
 " > /tmp/etc/config/wifi_toggle.sesbutton
 chmod +x /tmp/etc/config/wifi_toggle.sesbutton
 logger -s "SESButton script generated and ready for use"
 TSO=$(/usr/sbin/nvram get radiooff_boot_off)
 # Si radio OFF au demarrage
 if [ "x${TS0}" == "x1" ]; then
 /sbin/ifconfig ra0 down
 /sbin/gpio disable 13
 fi
 fi
 # Couleur des LEDS POWER et INTERNET
 sleep 3; gpio disable 9; gpio enable 8; gpio disable 12; gpio enable 14

Résultat : les mêmes fonctionnalités qu’un Buffalo AirStation WHR-HP-GN, du moins en usage Point d’accès derrière un CPE d’abonné, mais à moindre coût.

Log de démarrage

Avec une trace de désactivation suivi d’activation du sans fil à la fin de la log.

U-Boot 1.1.3 (Jan 13 2009 - 17:40:14) (Alpha) - SVN revision : 105
Model: WRGN23
Board: RT2880 DRAM:  32 MB
 twe0 set to <NULL>
 toe0 set to <NULL>
 ============================================
 Ralink UBoot Version: 3.1 Alpha
 --------------------------------------------
 ASIC 3052_MP2 (MAC to GigaMAC Mode)
 DRAM COMPONENT: 256Mbits
 DRAM BUS: 16BIT
 Total memory: 32Mbytes
 Date:Jan 13 2009  Time:17:40:14
 ============================================
 icache: sets:128, ways:4, linesz:32 ,total:16384
 dcache: sets:128, ways:4, linesz:32 ,total:16384
Please choose the operation:
 1: Load system code to SDRAM via TFTP.
 2: Load system code then write to Flash via TFTP.
 3: Boot system code via Flash (default).
 4: Entr boot command line interface.
 9: Load Boot Loader code then write to Flash via TFTP.
 0 seconds ...
Eth0 (10/100-M) :  ethaddr = (00:26:5a:a2:xx:xx) 00 26 5A A2 xx xx
3: System Boot system code via Flash.
 ## Powering down port 0 ~ 3.
 ## Booting image at bf050000 ...
 Image Name:   DD-WRT v24 Linux Kernel Image
 Created:      2010-08-07   7:12:51 UTC
System Control Status = 0x23400000
 Image Type:   MIPS Linux Kernel Image (lzma compressed)
 Data Size:    867583 Bytes = 847.2 kB
 Load Address: 80000000
 Entry Point:  8026d000
 Verifying Checksum ... OK
 Uncompressing Kernel Image ... OK
Starting kernel ...
LINUX started...
THIS IS ASIC
 Linux version 2.6.23.17 (root@dd-wrt) (gcc version 4.1.2) #3580 Sat Aug 7 09:11:12 CEST 2010
The CPU frequency set to 320 MHz
 32M RAM Detected!
 CPU revision is: 0001964c
 Determined physical RAM map:
 memory: 02000000 @ 00000000 (usable)
 Built 1 zonelists in Zone order.  Total pages: 8128
 Kernel command line: console=ttyS1,57600n8 root=/dev/mtdblock4 rootfstype=squashfs noinitrd
 Primary instruction cache 16kB, physically tagged, 4-way, linesize 32 bytes.
 Primary data cache 16kB, 4-way, linesize 32 bytes.
 Synthesized TLB refill handler (20 instructions).
 Synthesized TLB load handler fastpath (32 instructions).
 Synthesized TLB store handler fastpath (32 instructions).
 Synthesized TLB modify handler fastpath (31 instructions).
 Cache parity protection disabled
 cause = 10800020, status = 1100ff00
 PID hash table entries: 128 (order: 7, 512 bytes)
 calculating r4koff... 0030d400(3200000)
 CPU frequency 320.00 MHz
 Using 160.000 MHz high precision timer.
 console [ttyS1] enabled
 Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
 Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
 Memory: 29480k/32768k available (2164k kernel code, 3288k reserved, 316k data, 120k init, 0k highmem
 )
 Mount-cache hash table entries: 512
 NET: Registered protocol family 16
 Generic PHY: Registered new driver
 NET: Registered protocol family 2
 Time: MIPS clocksource has been installed.
 IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
 TCP established hash table entries: 1024 (order: 1, 8192 bytes)
 TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
 TCP: Hash tables configured (established 1024 bind 1024)
 TCP reno registered
 Load RT2880 Timer Module(Wdg/Soft)
 devfs: 2004-01-31 Richard Gooch (rgooch@atnf.csiro.au)
 devfs: boot_options: 0x1
 squashfs: version 3.0 (2006/03/15) Phillip Lougher
 io scheduler noop registered
 io scheduler deadline registered (default)
 Ralink gpio driver initialized
 Serial: 8250/16550 driver $Revision: 1.3 $ 2 ports, IRQ sharing disabled
 serial8250: ttyS0 at I/O 0xb0000500 (irq = 37) is a 16550A
 serial8250: ttyS1 at I/O 0xb0000c00 (irq = 12) is a 16550A
 rt3052 access driver initialization.
 PPP generic driver version 2.4.2
 PPP Deflate Compression module registered
 PPP BSD Compression module registered
 MPPE/MPPC encryption/compression module registered
 NET: Registered protocol family 24
 PPPoL2TP kernel driver, V1.0
 tun: Universal TUN/TAP device driver, 1.6
 tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
 ralink flash device: 0x1000000 at 0xbf000000
 Ralink SoC physically mapped flash: Found 1 x16 devices at 0x0 in 16-bit bank
 Amd/Fujitsu Extended Query Table at 0x0040
 number of CFI chips: 1
 cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
found squashfs at 124000
 Creating 6 MTD partitions on "Ralink SoC physically mapped flash":
 0x00000000-0x00030000 : "uboot"
 0x00030000-0x00040000 : "uboot-config"
 0x00040000-0x00050000 : "factory-defaults"
 0x00050000-0x003f0000 : "linux"
 0x00124000-0x003f0000 : "rootfs"
 mtd: partition "rootfs" doesn't start on an erase block boundary -- force read-only
 0x003f0000-0x00400000 : "nvram"
 u32 classifier
 Actions configured
 Netfilter messages via NETLINK v0.30.
 nf_conntrack version 0.5.0 (1024 buckets, 4096 max)
 ctnetlink v0.93: registering with nfnetlink.
 IPv4 over IPv4 tunneling driver
 GRE over IPv4 tunneling driver
 ip_tables: (C) 2000-2006 Netfilter Core Team
 IPP2P v0.8.2 loading
 ClusterIP Version 0.8 loaded successfully
 TCP bic registered
 TCP cubic registered
 TCP westwood registered
 TCP highspeed registered
 TCP hybla registered
 TCP htcp registered
 TCP vegas registered
 TCP scalable registered
 NET: Registered protocol family 1
 NET: Registered protocol family 17
 Welcome to PF_RING 3.2.1
 (C) 2004-06 L.Deri <deri@ntop.org>
 NET: Registered protocol family 27
 PF_RING: bucket length    128 bytes
 PF_RING: ring slots       4096
 PF_RING: sample rate      1 [1=no sampling]
 PF_RING: capture TX       No [RX only]
 PF_RING: transparent mode Yes
 PF_RING initialized correctly.
 PF_RING: registered /proc/net/pf_ring/
 802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
 All bugs added by David S. Miller <davem@redhat.com>
 GDMA1_MAC_ADRH -- : 0x00000000
 GDMA1_MAC_ADRL -- : 0x00000000
 Ralink APSoC Ethernet Driver Initilization. v2.00  256 rx/tx descriptors allocated, mtu = 1500!
 NAPI enable, weight = 0, Tx Ring = 256, Rx Ring = 256
 GDMA1_MAC_ADRH -- : 0x0000000c
 GDMA1_MAC_ADRL -- : 0x43305077
 PROC INIT OK!
 decode /dev/mtdblock4
 VFS: Mounted root (squashfs filesystem) readonly.
 Mounted devfs on /dev
 Freeing unused kernel memory: 120k freed
 start service
 starting Architecture code for rt2880
 rt2860v2_ap: module license 'unspecified' taints kernel.
 GDMA1_MAC_ADRH -- : 0x00000026
 GDMA1_MAC_ADRL -- : 0x5aa2xxxx
phy_tx_ring = 0x01d6e000, tx_ring = 0xa1d6e000, size: 16 bytes
phy_rx_ring = 0x01d6f000, rx_ring = 0xa1d6f000, size: 16 bytes
 RT305x_ESW: Link Status Changed
 GDMA1_FWD_CFG = 10000
 RT305x_ESW: Link Status Changed
 switch reg write offset=14, value=405555
 switch reg write offset=50, value=2001
 switch reg write offset=98, value=7f3f
 switch reg write offset=e4, value=3f
 switch reg write offset=40, value=1001
 switch reg write offset=44, value=1001
 switch reg write offset=48, value=1002
 switch reg write offset=70, value=ffff506f
 br0: Dropping NETIF_F_UFO since no NETIF_F_HW_CSUM feature.
 device br0 entered promiscuous mode
 Algorithmics/MIPS FPU Emulator v1.5
 device vlan1 entered promiscuous mode
 device eth2 entered promiscuous mode
 device vlan2 entered promiscuous mode
 sh: ead: not found
 RtmpOSNetDevDetach(): RtmpOSNetDeviceDetach(), dev->name=ra0!
 0x1300 = 00064380
 0x1300 = 00064380
 device ra0 entered promiscuous mode
 br0: port 3(ra0) entering learning state
 br0: port 2(vlan2) entering learning state
 br0: port 1(vlan1) entering learning state
 device br0 left promiscuous mode
 device br0 entered promiscuous mode
 device br0 left promiscuous mode
 device br0 entered promiscuous mode
 wland: No such file or directory
 br0: No such process
 br0: topology change detected, propagating
 br0: port 3(ra0) entering forwarding state
 br0: topology change detected, propagating
 br0: port 2(vlan2) entering forwarding state
 br0: topology change detected, propagating
 br0: port 1(vlan1) entering forwarding state
 SIOCGIFFLAGS: No such device
 SIOCGIFFLAGS: No such device
 SIOCGIFFLAGS: No such device
 SIOCGIFFLAGS: No such device
 SIOCGIFFLAGS: No such device
 SIOCGIFFLAGS: No such device
 SIOCGIFFLAGS: No such device
 SIOCGIFFLAGS: No such device
 SIOCGIFFLAGS: No such device
 SIOCGIFFLAGS: No such device
 SIOCGIFFLAGS: No such device
 SIOCGIFFLAGS: No such device
 SIOCGIFFLAGS: No such device
 SIOCGIFFLAGS: No such device
 SIOCGIFFLAGS: No such device
 wland: No such file or directory
 root: Generating SESButton script
 root: SESButton script generated and ready for use
 etherip: Ethernet over IPv4 tunneling driver
 GPIO 0 PRESSED
 root: Current wireless status: On, Turning wireless off
 br0: port 3(ra0) entering disabled state
 GPIO 0 PRESSED
 root: Current wireless status: Off, Turning wireless on
 0x1300 = 00064380
 br0: port 3(ra0) entering learning state
 br0: topology change detected, propagating
 br0: port 3(ra0) entering forwarding state
DD-WRT v24-sp2 std (c) 2010 NewMedia-NET GmbH
 Release: 08/07/10 (SVN revision: 14896)
dir314 login: