Mittwoch, 21. Januar 2009

DSL-Modem D-Link DSL-380T telnet

Using telnet one can access the practically undocumented cmdline interface (cm_cli):

mike@sidbomx:~$ telnet 192.168.1.1
Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.

BusyBox on (none) login: admin
Password:


BusyBox v0.61.pre (2007.02.11-04:23+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

# cat /etc/passwd
root:x:0:0:Root,,,:/:/bin/sh

admin:x:0:0:Admin,,,:/:/bin/sh

# cat /proc/cpuinfo

processor : 0
cpu model : MIPS 4KEc V4.8
BogoMIPS : 211.35
wait instruction : no
microsecond timers : yes
extra interrupt vector : yes
hardware watchpoint : yes
VCED exceptions : not available
VCEI exceptions : not available

# cat /proc/meminfo

total: used: free: shared: buffers: cached:
Mem: 6541312 6242304 299008 0 438272 1576960
Swap: 0 0 0
MemTotal: 6388 kB
MemFree: 292 kB
MemShared: 0 kB
Buffers: 428 kB
Cached: 1540 kB
SwapCached: 0 kB
Active: 2368 kB
Inactive: 1252 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 6388 kB
LowFree: 292 kB
SwapTotal: 0 kB
SwapFree: 0 kB

# free

total used free shared buffers
Mem: 6388 6088 300 0 428
Swap: 0 0 0
Total: 6388 6088 300

# cat /proc/version

Linux version 2.4.17_mvl21-malta-mips_fp_le (root@sweet) (gcc version 2.95.3 20010315 (release/MontaVista)) #1 Sun Feb 11 12:03:14 CST 2007

# ps

PID Uid VmSize Stat Command
1 root 1284 S init
2 root S [keventd]
3 root S [ksoftirqd_CPU0]
4 root S [kswapd]
5 root S [bdflush]
6 root S [kupdated]
7 root S [mtdblockd]
28 root 2744 S /usr/bin/cm_pc
29 root 1656 S /usr/sbin/diap
31 root 1284 S init
32 root 3520 S /usr/bin/cm_logic -m /dev/ticfg -c /etc/config.xml
53 root 1356 S /usr/sbin/thttpd -g -d /usr/www -u root -p 80 -c /cg
1421 root 2352 S /usr/sbin/pppd plugin pppoe nas0 linkname nas0 user
1447 root 700 S /usr/sbin/udhcpd /var/tmp/udhcpd.conf
1706 root 628 S /sbin/utelnetd
1707 root 1288 S -sh
1721 root 1284 R ps

# ifconfig

br0 Link encap:Ethernet HWaddr 00:1B:11:B6:06:21
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 ASYMMTU:1500
RX packets:65881 errors:0 dropped:0 overruns:0 frame:0
TX packets:151850 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:7862018 (7.4 Mb) TX bytes:62326038 (59.4 Mb)

br1 Link encap:Ethernet HWaddr 00:00:00:00:00:00
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 ASYMMTU:1500
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

eth0 Link encap:Ethernet HWaddr 00:1B:11:B6:06:21
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 ASYMMTU:1500
RX packets:65881 errors:0 dropped:0 overruns:0 frame:0
TX packets:151839 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:7862018 (7.4 Mb) TX bytes:62324778 (59.4 Mb)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1 ASYMMTU:0
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

nas0 Link encap:Ethernet HWaddr 00:1B:11:B6:06:21
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 ASYMMTU:1500
RX packets:146259 errors:0 dropped:0 overruns:0 frame:0
TX packets:58224 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:60116086 (57.3 Mb) TX bytes:7866729 (7.5 Mb)

ppp0 Link encap:Point-Point Protocol
inet addr:77.22.222.15 P-t-P:192.168.2.5 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1 ASYMMTU:1500
RX packets:28642 errors:0 dropped:0 overruns:0 frame:0
TX packets:19971 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:31389498 (29.9 Mb) TX bytes:1934356 (1.8 Mb)

# ifconfig ppp0

ppp0 Link encap:Point-Point Protocol
inet addr:66.99.255.99 P-t-P:166.89.333.9 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1 ASYMMTU:1500
RX packets:28643 errors:0 dropped:0 overruns:0 frame:0
TX packets:19972 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:31389602 (29.9 Mb) TX bytes:1934460 (1.8 Mb)

# route

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
88.44.444.254 * 255.255.255.255 UH 0 0 0 br0
33.55.666.64 * 255.255.255.255 UH 0 0 0 br0
44.66.777.43 * 255.255.255.255 UH 0 0 0 br0
192.168.1.0 * 255.255.255.0 U 0 0 0 br0
239.0.0.0 * 255.0.0.0 U 1 0 0 br0
default * 0.0.0.0 U 0 0 0 ppp0

# cat /proc/avalanche/eth0_rfc2665_stats

ifSpeed : 100000000
dot3StatsDuplexStatus : 3
ifAdminStatus : 1
ifOperStatus : 1
ifLastChange : 1139
ifInDiscards : 40
ifInErrors : 0
ifOutDiscards : 0
ifOutErrors : 0
ifInGoodFrames : 66028
ifInBroadcasts : 464
ifInMulticasts : 0
ifInPauseFrames : 0
ifInCRCErrors : 0
ifInAlignCodeErrors : 0
ifInOversizedFrames : 0
ifInJabberFrames : 0
ifInUndersizedFrames : 0
ifInFragments : 0
ifInFilteredFrames : 0
ifInQosFilteredFrames : 0
ifInOctets : 8136063
ifOutGoodFrames : 151952
ifOutBroadcasts : 12
ifOutMulticasts : 0
ifOutPauseFrames : 0
ifDeferredTransmissions : 0
ifCollisionFrames : 0
ifSingleCollisionFrames : 0
ifMultipleCollisionFrames : 0
ifExcessiveCollisionFrames : 0
ifLateCollisions : 0
ifOutUnderrun : 0
ifCarrierSenseErrors : 0
ifOutOctets : 62991505
if64OctetFrames : 8850
if65To127POctetFrames : 154540
if128To255OctetFrames : 8014
if256To511OctetFrames : 3235
if512To1023OctetFrames : 6869
if1024ToUpOctetFrames : 36472
ifNetOctets : 71127568
ifRxSofOverruns : 40
ifRxMofOverruns : 0
ifRxDMAOverruns : 40

# cat /proc/avalanche/avsar_modem_stats

AR7 DSL Modem Statistics:
--------------------------------
[DSL Modem Stats]
US Connection Rate: 1212 DS Connection Rate: 15221
DS Line Attenuation: 31 DS Margin: 6
US Line Attenuation: 14 US Margin: 7
US Payload : 2935536 DS Payload: 32780592
US Superframe Cnt : 101088 DS Superframe Cnt: 101088
US Transmit Power : 12 DS Transmit Power: 21
LOS errors: 0 SEF errors: 0
Frame mode: 0 Max Frame mode: 0
Trained Path: 1 US Peak Cell Rate: 2858
Trained Mode: 16 Selected Mode: 1
ATUC Vendor Code: 4244434D ATUC Revision: 2
Hybrid Selected: 3 Trellis: 1
Showtime Count: 3 DS Max Attainable Bit Rate: 16428 kbps
BitSwap: 1 US Max Attainable Bit Rate: 1324000 bps
Annex: AnxB psd_mask_qualifier: 0x0100
ATUC ghsVid: b5 00 42 44 43 4d 62 91
T1413Vid: 00 00 T1413Rev: 00 VendorRev: 00
ATUR ghsVid: 00 44 4c 69 6e 6b 00 00
T1413Vid: 00 00 T1413Rev: 00 VendorRev: 00

[Upstream (TX) Interleave path]
CRC: 0 FEC: 0 NCD: 0
LCD: 0 HEC: 0

[Downstream (RX) Interleave path]
CRC: 604 FEC: 31444 NCD: 0
LCD: 0 HEC: 0

[Upstream (TX) Fast path]
CRC: 0 FEC: 0 NCD: 0
LCD: 0 HEC: 0

[Downstream (RX) Fast path]
CRC: 0 FEC: 0 NCD: 0
LCD: 0 HEC: 0

[ATM Stats]
[Upstream/TX]
Good Cell Cnt: 61157
Idle Cell Cnt: 4853174


[Downstream/RX)]
Good Cell Cnt: 682929
Idle Cell Cnt: 60858096
Bad Hec Cell Cnt: 5243
Overflow Dropped Cell Cnt: 0

[SAR AAL5 Stats]
Tx PDU's: 58113
Rx PDU's: 146267
Tx Total Bytes: 7853310
Rx Total Bytes: 63627046
Tx Total Error Counts: 0
Rx Total Error Counts: 107


[OAM Stats]
Near End F5 Loop Back Count: 0
Near End F4 Loop Back Count: 0
Far End F5 Loop Back Count: 2
Far End F4 Loop Back Count: 0
SAR OAM Ping Response Drop Count=15
# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
CFG tcp -- 78.34.143.40 0.0.0.0/0 tcp dpt:80 Records Packet's Source Interface


Chain FORWARD (policy ACCEPT)
target prot opt source destination
TCPMSS tcp -- 0.0.0.0/0 0.0.0.0/0 tcp flags:0x06/0x02 TCPMSS set 1360

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
DROP icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 3
DROP icmp -- 0.0.0.0/0 0.0.0.0/0 state INVALID
# cat /proc/avalanche/developers


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Salt Lake City Kernel Developement team (1999-2000)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jeff Harrell - Kernel ports, ADSL driver
Brady Brown - filesystem, kernel port
Mike Hassler - filesystem, timers
Victor Wells - Ram disk image, EMAC driver
Kevin Mcdonald - f/s, ramdisk compression
Rosemary Rogers - kitchen gnomes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Germantown Kernel Developement team (2001- )
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jeff Harrell - Kernel ports, ADSL driver
Victor Wells - VMAC driver
James Beaulieu - VMAC driver, PCI
Hari Krishna - USB driver
Boris Marenkov - USB driver
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
India Kernel Development Team (2002-)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Nitin Dhingra - Intc, Avalanche
Suraj Iyer - Intc, SEAD2, AR7 Port (2.4.17)
Suraj Iyer - CPMAC (2.4.17)
Sharath Kumar - SEAD2, AR7 Port (2.4.17)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


#

ASDL2+-Modem/Router, default IP-address 192.168.1.1, Linux-based, 2MB NOR-Flash (Spansion S29AL016D 901F102), 8MB SDRAM (Hynix HY57V641620ETP-H), ti ADSL2+ System on a Chip (TNETD7300EZDW). Serial port and JTAG headers are present and pinout is known.
5 unpopulated LEDs! (Enough for an SD-Card interface :)), unpopulated USB header. Board is marked as DSL-500T (which is supposed to have 4MB flash + 16MB RAM).
Login is possible using telnet:
BusyBox on (none) login: admin
Password:


BusyBox v0.61.pre (2007.04.30-09:59+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

# free
total used free shared buffers
Mem: 6372 6120 252 0 508
Swap: 0 0 0
Total: 6372 6120 252
# df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/mtdblock/0 1376 1376 0 100% /
# cat /proc/version
Linux version 2.4.17_mvl21-malta-mips_fp_le (root@David.localdomain) (gcc version 2.95.3 20010315 (release/MontaVista)) #2 һ 4� 30 18:07:10 CST 2007
# cat /proc/cpuinfo
processor : 0
cpu model : MIPS 4KEc V4.8
BogoMIPS : 211.35
wait instruction : no
microsecond timers : yes
extra interrupt vector : yes
hardware watchpoint : yes
VCED exceptions : not available
VCEI exceptions : not available



Userspace is driven by a proprietary ti solution (cm == cfgmgr?), which handles practically everything from booting up to starting services and the web configuration interface. Using telnet one can access the practically undocumented cmdline interface (cm_cli):
# echo 'fdb:settings/service/ssh/state' | cm_cli -l
1 fdb:settings/service/ssh/state=2
# echo 'fdb:settings/service/ssh/state=1' | cm_cli
# echo 'fdb:settings/service/ssh/state' | cm_cli -l
1 fdb:settings/service/ssh/state=2
# echo 'begin;fdb:settings/service/ssh/state=1;end' | cm_cli
# echo 'fdb:settings/service/ssh/state' | cm_cli -l
1 fdb:settings/service/ssh/state=1
# echo 'lan0:static:settings/ip' | cm_cli -l
1 static-103:settings/ip=xxx.xxx.xxx.xxx
# echo 'lan0:static:settings/gateway' | cm_cli -l
error: error_code=-1, err_msg=Bad key 'settings/gateway' in 'static-103'
# echo 'lan0:static:settings/defaultgateway' | cm_cli -l
error: error_code=-1, err_msg=Bad key 'settings/defaultgateway' in 'static-103'
# echo 'lan0:static:settings/defaultroute' | cm_cli -l
# echo 'sar:status/dsl_carrier_state' | cm_cli -l
1 sar:status/dsl_carrier_state=2
# echo 'sar:status/dsl_ds_rate' | cm_cli -l
1 sar:status/dsl_ds_rate=18637
# echo 'sar:status/dsl_us_rate' | cm_cli -l
1 sar:status/dsl_us_rate=1263
# echo 'sar:status/dsl_us_attenuation' | cm_cli -l
1 sar:status/dsl_us_attenuation=10
# echo 'sar:status/dsl_ds_attenuation' | cm_cli -l
1 sar:status/dsl_ds_attenuation=23
#

Changes can be saved to flash using
echo 'begin;logic:command/save;end' | cm_cli

cm_cli builtin help:
cm_cli -h
Usage: cm_cli [OPTIONS]

OPTIONS:
-t : assign the time out value in second
-l : output results in long format
-v : verbose mode
-h : this help message

EXAMPLE:
echo "logger:status/log" | cm_cli

echo "begin;logger:settings/loglevel=debug;end" | cm_cli

or
cm_cli <<-EOF >begin
>logger:command/clear_log
>end
>EOF

NOTE: "set" or "command" requires a transaction with "begin" & "end"

The default config is kept in xml files, the userchanges are kept somewhere in an mtd partition (probably).
# ls /etc/*.xml
/etc/config.xml /etc/progdefs.xml /etc/strings.xml /etc/sysdef.xml

The basic structure of cm_cli commands seem to be :(settings|status|command|valid_settings|temp)/[=].
Valid modules: (Found using 'strings /usr/bin/cm_logic | grep register' and trial+error):
strings bin/cm_logic | grep register:
container_register
event_global_register
time_register
system_register
eth_register
static_register
resolver_register
route_register
filter_register
hostname_register
upnp_register
bridge_register
usb_register
pppoa_register
pppoe_register
sar_register
pvc_register
rfc2684_register
clip_register
dhcpc_register
dhcps_register
service_register
routed_register
dhcpfwd_register
fwan_register
flan_register
fdb_register
igmpproxy_register
bfilter_register
snmp_register
webui_register
qos_register
wbridge_register
sntp_register

# echo 'time:xxx' | cm_cli
# echo 'abc:xxx' | cm_cli
error: error_code=-1, err_msg=There is no module 'abc'
# echo 'system:xxx' | cm_cli
error: error_code=-1, err_msg=Bad key 'xxx' in 'system'

Valid Modules:
time
logic
lan0
lan1
lanbridge0
lanbridge1
lanfilter0
lanfilter1
fdb
system
resolver
route
filter
upnp
sar
fdb
webui
sntp
snmpd
snmpcm
Some more commands:
# echo 'snmpcm:settings/community/entry' | cm_cli -l
1 snmpcm:settings/community/entry=public ro
2 snmpcm:settings/community/entry=
3 snmpcm:settings/community/entry=

# echo 'snmpcm:settings/system/sysname' | cm_cli -l
1 snmpcm:settings/system/sysname=DSL-380T

# echo 'lanfilter0:settings/activated' | cm_cli -l
1 lanfilter0:settings/activated=0
# echo 'lanfilter0:settings/protocol/proto1' | cm_cli -l
1 lanfilter0:settings/protocol/proto1=0x0800
# echo 'lanfilter0:settings/protocol/proto2' | cm_cli -l
1 lanfilter0:settings/protocol/proto2=0x86DD
# echo 'lanfilter0:settings/bf_mng_port' | cm_cli -l
1 lanfilter0:settings/bf_mng_port=0
# echo 'landhcps0:settings/state' | cm_cli -l
1 landhcps0:settings/state=0
# echo 'landhcps0:settings/dns1' | cm_cli -l
1 landhcps0:settings/dns1=192.168.1.1
# echo 'landhcps0:settings/pc1/ip' | cm_cli -l
1 landhcps0:settings/pc1/ip=192.168.8.1
# echo 'landhcps0:settings/pc1/mac' | cm_cli -l
1 landhcps0:settings/pc1/mac=00:00:00:00:00:00
# echo 'landhcps0:settings/pc1/hname' | cm_cli -l
1 landhcps0:settings/pc1/hname=router
# echo 'landhcpfwd0:settings/ip' | cm_cli -l
1 landhcpfwd0:settings/ip=0.0.0.0
# echo 'resolver:settings/nameserver1' | cm_cli -l
1 resolver:settings/nameserver1=168.95.1.1
# echo 'sntp:settings/prim_server' | cm_cli -l
1 sntp:settings/prim_server=0.0.0.0
# echo 'sntp:settings/secn_server' | cm_cli -l
1 sntp:settings/secn_server=0.0.0.0
# echo 'sntp:settings/poll_interval' | cm_cli -l
1 sntp:settings/poll_interval=30
# echo 'system:settings/thttpd/port' | cm_cli -l
1 system:settings/thttpd/port=80
# echo 'fdb:settings/service/mtu/mss_value' | cm_cli -l
1 fdb:settings/service/mtu/mss_value=1452
# echo 'fdb:settings/service/remote_telnet/RemoteNetmask' | cm_cli -l
1 fdb:settings/service/remote_telnet/RemoteNetmask=255.255.255.255
# echo 'fdb:settings/service/remote_telnet/RemoteHost' | cm_cli -l
1 fdb:settings/service/remote_telnet/RemoteHost=0.0.0.0
# echo 'fdb:settings/service/service_filter_telnet/state' | cm_cli -l
1 fdb:settings/service/service_filter_telnet/state=1
# echo 'fdb:settings/categoryG/ruleG1/description' | cm_cli -l
1 fdb:settings/categoryG/ruleG1/description=Asheron's Call
# echo 'fdb:settings/categoryG/ruleG1/protocolport1/portstart' | cm_cli -l
1 fdb:settings/categoryG/ruleG1/protocolport1/portstart=9000
# echo 'fdb:settings/categoryG/ruleG1/protocolport1/protocol' | cm_cli -l
1 fdb:settings/categoryG/ruleG1/protocolport1/protocol=UDP
# echo 'fdb:settings/categoryH/description' | cm_cli -l
1 fdb:settings/categoryH/description=Remote Management ACL
# echo 'fdb:settings/categoryH/acl/IP0' | cm_cli -l
1 fdb:categoryH/acl/IP0=0
# echo 'systemdump:settings/func1/name' | cm_cli -l
1 systemdump:settings/func1/name=ls
# echo 'systemdump:settings/func1/option1' | cm_cli -l
1 systemdump:settings/func1/option1=-l
# echo 'cat:settings/func1/option1' | cm_cli -l
1 cat:settings/func1/option1=/proc/version
# echo 'time:settings/ntpserver' | cm_cli -l
1 time:settings/ntpserver=time.nist.gov
# echo 'route:status/table' | cm_cli -l
1 route:status/table=1 1.1.1.1 0.0.0.0 192.168.8.121 1




Dlink links
http://www.linux-mips.com/wiki/DSL-xxxT#DSL-320T

http://mcmcc.bat.ru/dlinkt/


http://www.seattlewireless.net/index.cgi/DlinkDslG604t

Linux version 2.4.17_mvl21-malta-mips_fp_le (root@David.localdomain) (gcc version 2.95.3 20010315 (release/MontaVista))


http://www.mvista.com/


http://www.routertech.org/index.php



http://pit-homepage.de/DSL-380T/DSL380T_Main_Seite.html