AR7 based routers - permanently add a perm. ARP table entry?

Support forum for routers of all shapes and sizes. As long as it's router based and doesn't fall into the other categories, this is the place to ask your questions.
Post Reply
Evgueni
Newbie
Newbie
Posts: 5
Joined: Tue Sep 02, 2014 1:34 am

AR7 based routers - permanently add a perm. ARP table entry?

Post by Evgueni » Wed Sep 03, 2014 12:34 am

Hi Everyone

I have a DSL-300T running f/w version "1.1.00.RU 06.02.2008 (24.10.2007) DSP 7.0.3 D-Link", from MCMCC originally I believe. I think this is based on f/w "v.1.1.00.23102007" from Acorp though the 1 day date discrepancy is curious. Anyway it is stable and does the job, ADSL2+ resulting in ~15Mb/s down and ~1Mb/s up. I am about a couple of hundred metres away from the exchange.

My question is - has anyone figured out a way to add a permanent ARP table entry in these AR7-based toys, either using cm_cli or by modifying config.xml directly? I trawled the net for cm_cli documentation but found little - Routertech's own "cm_cli.pdf" and this:
http://tuxi-test.blogspot.co.uk/2009/01 ... outer.html

However, I see nothing specific to ARP. What I would like to do is replicate the action of the command ARP -S <ipaddr> <macaddr> by writing the relevant instructions into config.xml, so that the permanent ARP table entry is not flushed arbitrarily, as happens now if I add it from Busybox command line. The reason I want this is because it enables me to use the WOL feature.

Can anyone tell me where to dig?
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: AR7 based routers - permanently add a perm. ARP table en

Post by thechief » Wed Sep 03, 2014 8:07 am

AFAIK, no other documentation for cm_cli exists (believe me, I have searched for years). You can glean some ideas from the source code for the firmware (which is what we have done).

As for editing config.xml directly, that is not a straightforward matter (even if one knew what to write to it).
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
Evgueni
Newbie
Newbie
Posts: 5
Joined: Tue Sep 02, 2014 1:34 am

Re: AR7 based routers - permanently add a perm. ARP table en

Post by Evgueni » Wed Sep 03, 2014 11:29 pm

Thank you - I suspected as much.. As for modifying config.xml, I have suceeded in doing that using cfgconv-0.3 utility from MCMCC. As a test, I loaded a new config.xml (minor changes, e.g. the name of a port forwarding rule) and was able to observe the change in webgui. The difficult part for me is knowing what to write in the config, as you say.
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: AR7 based routers - permanently add a perm. ARP table en

Post by thechief » Thu Sep 04, 2014 8:31 pm

I guess the first thing is to search through the current config.xml and see what entries there are in inside it for ARP. That will show you any default ARP commands.
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
Evgueni
Newbie
Newbie
Posts: 5
Joined: Tue Sep 02, 2014 1:34 am

Re: AR7 based routers - permanently add a perm. ARP table en

Post by Evgueni » Thu Sep 04, 2014 11:22 pm

Yes - I have looked at config.xml in detail and there is an empty <arp> </arp> section under 'dependencies'. All other examples of config.xml that I have been able to find also turn up nothing. I have been staring at cm_* files through notepad to see if there are clues in the text strings but nothing has cought my eye. I am trying out Acorp Monitor from Zyxmon which supposedly may offer clues but so far I can't make heads nor tails of it.

Thank you for the ideas. I am guessing no source code for the cm_* executables is available..
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: AR7 based routers - permanently add a perm. ARP table en

Post by thechief » Sat Sep 06, 2014 11:43 am

Evgueni wrote:I am guessing no source code for the cm_* executables is available..
Not publicly, as far as I know. And, if it does exist publicly, it wouldn't be legal because it is proprietary software. That being said, some manufacturers have been known to release by mistake proprietary code in their GPL source code release. So if you trawl through the GPL source code release, you might find something.

You might find clues to the ARP stuff by looking in the javascript and html files in the web interface (/usr/www/).
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
Evgueni
Newbie
Newbie
Posts: 5
Joined: Tue Sep 02, 2014 1:34 am

Re: AR7 based routers - permanently add a perm. ARP table en

Post by Evgueni » Thu Oct 02, 2014 1:46 am

I have almost given up on this but thought I should report where I got to. Config.xml has under 'modules' a number of sections called 'service' that appear to list commands and their arguments. e.g.

- <service>
<id>arp</id>
<active>1</active>
<lan>0</lan>
- <settings>
<exec>no</exec>
<type>bin</type>
- <func1>
<name>arp</name>
<option1>-n</option1>
</func1>
</settings>
</service>

ARP -n is a valid command, and all other 'service' sections have valid commands in them (sometimes several). Arguments can be added by adding new <optionx> sections with incrementing x. It seems these 'service' sections are intended for excecution somehow but I could not figure out how. I can set <exec> value to anything via CM_CLI and the drats thing does not complain about invalid values. I tried changing this to 'yes' and '1' by editing and uploading config.xml but the effect was zero after reboot. Perhaps the service module needs to be called from somewhere else in config.xml - but how?
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: AR7 based routers - permanently add a perm. ARP table en

Post by thechief » Thu Oct 02, 2014 11:12 am

I don't think that just editing config.xml will result in any new commands being executed, else that becomes a backdoor into the router.
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
Evgueni
Newbie
Newbie
Posts: 5
Joined: Tue Sep 02, 2014 1:34 am

Re: AR7 based routers - permanently add a perm. ARP table en

Post by Evgueni » Wed Oct 08, 2014 12:35 am

I did give up trying to add ARP command via the config file - I am not convinced it is even possible in principle, there is simply not enough documentation for TI's CLI.

However I have achieved my aim in another way - the Acorp f/w provides a means of adding 3 user scripts that execute at startup and at PPPoX session start/end. This is not an elegant solution as it requires the creation of a writable mtd5 partition (i.e. its size must be a multiple of eraseblock size, 65536 bytes in my case) at the expense of reducing mtd0/mtd4. It seems wasteful for the 3 one line script files but it appears to be working well - 24 hours so far without problems.

My f/w is "1.1.00.RU 06.02.2008 (24.10.2007) DSP 7.0.3 D-Link" specially adapted for D-Link DSL-300T I think but clearly it is sufficiently close to Acorp's official release "V.1.1.00.RU.23102007_AnnexA_DSP73" for their Sprinter LAN120 so I followed the instructions in release notes for that.

The release notes are in Russian only, so here is what I needed to do. Make a note of the mtd block sizes:
# cat /proc/ticfg/env | grep mtd
mtd0 0x90083000,0x901f0000
mtd1 0x90010090,0x90083000
mtd2 0x90000000,0x90010000
mtd3 0x901f0000,0x90200000
mtd4 0x90010000,0x901f0000
Check eraseblock size:
# cat /proc/mtd
dev: size erasesize name
mtd0: 0016d000 00010000 "mtd0"
mtd1: 00072f70 00010000 "mtd1"
mtd2: 00010000 00002000 "mtd2"
mtd3: 00010000 00010000 "mtd3"
mtd4: 001e0000 00010000 "mtd4"
Create mtd5 - 0x10000 (65536 bytes) is the smallest writable mtd5 we can make:
# echo "mtd5 0x901E0000,0x901F0000" > /proc/ticfg/env
Now trim mtd0 and mtd4 by the same amount:
# echo "mtd4 0x90010000,0x901E0000" > /proc/ticfg/env
# echo "mtd0 0x90083000,0x901E0000" > /proc/ticfg/env
Check the result is as intended:
# cat /proc/ticfg/env | grep mtd
mtd0 0x90083000,0x901E0000
mtd1 0x90010090,0x90083000
mtd2 0x90000000,0x90010000
mtd3 0x901f0000,0x90200000
mtd4 0x90010000,0x901E0000
mtd5 0x901E0000,0x901F0000
# reboot
Prepare script file(s) on a PC - these must be named init.sh, pppup.sh and pppdown.sh, place these in a folder called mycfg. Create a targ.gz of mycfg folder with the 3 script files in it:
tar --format=oldgnu -cpzf mycfg.tar.gz mycfg
(or
tar --format=oldgnu -cpf mycfg.tar mycfg
gzip mycfg.tar)
I used TAR under Cygwin.
Start an FTP server on PC and place mycfg.tar.gz into the Public folder.
Whilst logged on via telnet into router, transfer mycfg.tar.gz to /var/tmp:
# cd /var/tmp
# wget ftp://192.168.1.2/mycfg.tar.gz
Save to mtd5:
# cfgsave mycfg.tar.gz (or cat mycfg.tar.gz > /dev/mtdblock/5)

The error message "cat: write: Operation not permitted" at this point would indicate that there is something wrong with the size or boundaries of mtd5 (e.g. smaller than or not an exact multiple of eraseblock size).
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: AR7 based routers - permanently add a perm. ARP table en

Post by thechief » Wed Oct 08, 2014 9:59 am

That's a reasonable solution. I would have suggested something similar if you had been using a RouterTech firmware, which has these facilities built-in.
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
Post Reply