Tomato ND USB Mod

Discussion in 'Tomato Firmware' started by teddy_bear, Dec 17, 2008.

  1. teddy_bear

    teddy_bear Network Guru Member

    Try my mod without recompiling. It has this option (missing in stock Tomato):
    and it's enough. No need for "CONFIG_MTD_CFI_I2=y".
  2. pawlowski

    pawlowski Addicted to LI Member

    Oh, yep, it works.
    Sorry to bother you again.
  3. Borisbme

    Borisbme Addicted to LI Member

    Ok, I foud the problem, partially. If I clear the NVRAM, than I do the upgrade than it works. After the upgrade i restored the NVRAM, and it froze the router again. So the problem is in the settings somewhere. I'll post it if I find it.
  4. cr00kedview

    cr00kedview Network Guru Member

    Works fine so far on my WL-500W. Thanks!
  5. toolbox

    toolbox LI Guru Member

    Installed build 42 on my Asus WL-520Gu this morning. Works great. No issues. (I have build 41 before the upgrade).

    MADDAN Addicted to LI Member

    Works great on my WL-500gp V2. Thanks again Teddy Bear!
  7. TheBus

    TheBus Addicted to LI Member

    Just upgraded to build 42 from 41 which I first installed earlier this week on my Asus WL-500gPv2. Working great so far.
  8. babydragon

    babydragon Addicted to LI Member

    I find something interesting by playing it around...

    with the standard build installed on my 520gu router, I got about 576k free space after enable /jffs and apply "format/erase" in the webgui. That's bigger than the free space claimed: ~300k. Hope I'm not doing anything wrong and it won't affect the function of the firmware

    Another question, how should I mount the usb device correctly if I want to do that manually? If I use the following command on a fat32 partition, some file names with foreign characters are not displayed correctly
    mount -o noatime,nodev /dev/discs/disc0/part1 /mnt
    However, the built in auto-mount function works perfectly. By the way, I install the required code pages. Is there any other option I should specify when mounting a drive manually? And may I ask what's the way to umount in the web-gui? Is it "umount -l"? Thanks
  9. great work !!! just upgraded to v42.

    installed v41 on a new asus520gu i bought recently and this sure is a masterpiece. being a total noob with linux, i had to run from pillar to post to get optware and transmission working, but it works now. the setup has the 520gu plugged to a wd 500gb having three partitions 512mb /opt, 64mb /swap and rest ext3 /shared. works well as a nas.

    the only thing i seem to be having unresolved is the ability to queue in transmission. there are a couple of scripts that can assist at it. but i dunno how to make the script work. it mentions something about crontab and crond. i can see crond service running using top command in putty but thats as far as i have been able to get. any assistance in getting this done would be greatly appreciated.
  10. teddy_bear

    teddy_bear Network Guru Member

    After your drive auto-mounts, run "mount" command without parameters. You'll see all options used to mount the drive. Just use the same options when mounting it manually.
    BTW, may I ask why do you need to mount the drive manually? Of course, there could be many reasons - just wanted to make sure you're aware of fstab option...
    As for the umount, "-l" parameter is not used when you click "Unmount" in the GUI, it's only used when you restart/shutdown the router.
  11. dswo

    dswo Addicted to LI Member

    Thank you again, Ray. Getting Optware installed seems a bit daunting; a project for another weekend maybe. Also, I wasn't running any programs from the external drive. In fact, I wasn't doing anything to it except plugging it in. Mysteries...

    I tried unmounting the partitions directly, via Telnet. That worked fine. So, I typed the umount commands for each partition into the Tomato "Run before Unmounting" box. THAT seems to be working. I'm not suggesting that I have understood or solved my problem; but if someone later comes looking for a workaround, this is worth trying.
  12. Tim2k

    Tim2k Addicted to LI Member

    Is it safe to flash the newest no-usb version on a WRT54GS v1.0 (CGN1, 200Mhz CPU, 32MB Ram, 8MB Flash)?
    wl0_corerev shows revision 7. I don't want to brick my little router. :)
  13. hypermood

    hypermood LI Guru Member

    No USB + VPN patch


    If interested, I've patched the 8742 Makefile to support a 'No USB + VPN' build option. This works out to be a pretty useful build option IMHO following the tomato-ND-usbmod-mixvpn merge. I know this is the USB mod but you've added some great upgrades to the entire build.

    Nice reorganization of the Makefile btw!

    --- Makefile	2010-01-07 16:40:08.000000000 -0600
    +++ Makefile-patched	2010-01-08 20:47:09.000000000 -0600
    @@ -384,6 +384,45 @@ s:
     	@$(MAKE) setprofile N=$(TPROFILE) B=S DESC="" USB=""
     	@$(MAKE) all
    +## Make the "No USB + VPN" build
    +	@cp router/config_base router/config_$@
    +	@cp router/busybox/config_base router/busybox/config_$@
    +	@cp $(LINUXDIR)/config_base $(LINUXDIR)/config_$@
    +	@sed -i "/TCONFIG_LZO/d" router/config_$@
    +	@sed -i "/TCONFIG_OPENVPN/d" router/config_$@
    +	@echo "TCONFIG_LZO=y" >>router/config_$@
    +	@echo "TCONFIG_OPENVPN=y" >>router/config_$@
    +	@sed -i "/TCONFIG_SAMBASRV/d" router/config_$@
    +	@echo "# TCONFIG_SAMBASRV is not set" >>router/config_$@
    +	@sed -i "/TCONFIG_FTP/d" router/config_$@
    +	@echo "# TCONFIG_FTP is not set" >>router/config_$@
    +	@sed -i "/TCONFIG_USB/d" router/config_$@
    +	@echo "# TCONFIG_USB is not set" >>router/config_$@
    +	$(call KernelConfigMips, $(LINUXDIR)/config_$@)
    +	$(call BusyboxExtraOptions, router/busybox/config_$@)
    +	$(call BusyboxKernelConfig, router/busybox/config_$@)
    +	@sed -i "/CONFIG_FEATURE_MOUNT_LOOP/d" router/busybox/config_$@
    +	@echo "# CONFIG_FEATURE_MOUNT_LOOP is not set" >>router/busybox/config_$@
    +	@sed -i "/CONFIG_FEATURE_DEVFS/d" router/busybox/config_$@
    +	@echo "# CONFIG_FEATURE_DEVFS is not set" >>router/busybox/config_$@
    +	@sed -i "/CONFIG_FEATURE_MOUNT_LABEL/d" router/busybox/config_$@
    +	@echo "# CONFIG_FEATURE_MOUNT_LABEL is not set" >>router/busybox/config_$@
    +	@sed -i "/CONFIG_FEATURE_MOUNT_FSTAB/d" router/busybox/config_$@
    +	@echo "# CONFIG_FEATURE_MOUNT_FSTAB is not set" >>router/busybox/config_$@
    +	@sed -i "/CONFIG_VOLUMEID/d" router/busybox/config_$@
    +	@echo "# CONFIG_VOLUMEID is not set" >>router/busybox/config_$@
    +	@sed -i "/CONFIG_BLKID/d" router/busybox/config_$@
    +	@echo "# CONFIG_BLKID is not set" >>router/busybox/config_$@
    +	@sed -i "/CONFIG_SWAPONOFF/d" router/busybox/config_$@
    +	@echo "# CONFIG_SWAPONOFF is not set" >>router/busybox/config_$@
    +	@$(MAKE) setprofile N=$(TPROFILE) B=V DESC="VPN" USB=""
    +	@$(MAKE) all
     ## Make Asus RT-N16 (mips32r2 CPU) build
     	@$(MAKE) m MIPS32=r2
    @@ -448,7 +487,10 @@ help:
     	@echo "b            B build (standard minus SSH)"
     	@echo "c            C build (standard minus cifs)"
     	@echo "d            D build (standard minus Samba server)"
    +	@echo "e            E build (standard plus extra utilities with VPN)"
     	@echo "m            M build (standard plus extra utilities)"
    +	@echo "s            S build (no usb)"    
    +	@echo "v            V build (no usb with VPN)"
     	@echo "..etc..      other build configs"
     	@echo "clean        -C router clean"
     	@echo "cleanimage   rm -rf image"
  14. babydragon

    babydragon Addicted to LI Member

    thanks teddy_bear! That's exactly what I do now as an alternative. Initially I was trying to disable auto-mounting and mount the drive manually. There are two reasons why I wanted to do so: 1) I want to mount the drive at different points other than under the folder /mnt. 2) I don't want samba service to be restarted whenever I plug in another usb. So I thought mounting the drives manually might be a better option for me. However, it looks like I couldn't solve the foreign character problem.

    Actually I am planning to try samba 3 because are still some problems in displaying foreign characters correctly even when I use auto-mounting option. I've seen some posts online about it and I guess it's the problem of samba 2.

    The reason I asked about umounting is that sometimes I input the command "umount /mnt/data", the system gives me the message "device is busy". But i can successfully umounting it from the webgui. However, the command "umount -l" works for me.

  15. ray123

    ray123 LI Guru Member

    babydragon: Just create your own fstab with the appropriate line for the partition you want to mount. Tomato always calls "mount -a" before it tries it's own automount. If it's mounted from fstab, Tomato won't mount it again.

    Just create your /etc/fstab and then do "nvram setfile2nvram /etc/fstab" and "nvram commit". Any files saved with setfile2nvram will be restored when the router boots up.
    This is what I do for setting up my fstab for my swapfile. You can create any personalized directories for your mountpoints by putting mkdir commands in your init script. can take advantage of the new feature where all "*.autorun" commands/scripts in the root directory of a partition will be executed when the partition is automounted. You could put your tailored "mount -o bind " command in an autorun script. FWIW, this is what I do to get my "/mnt/ext_160/opt" directory to be mounted as "/opt". My external 160GB USB harddrive has one swap partition and one ext3 partition, and "opt" is a directory in the ext3 partition.

    I *really* need to make a document explaining all this stuff.
    If you get "device busy" on umount, then there IS something open on the partition. Either a file is open, or a command window has cd'ed to a directory on that partition. The reason why the webgui unmount seems to work is that it does "-l" (under certain conditions) if the umount fails.
  16. babydragon

    babydragon Addicted to LI Member

    Thanks ray123! It's very clear explanation. That's really helpful tip to know, especially the *.autorun scripts. Then I can store the scripts on external disks instead of putting them in the webgui or /jffs folder. This makes everything much simpler if I was to upgrade the firmware or do a factory reset.

    Update: I tried the "*.autorun" trick but it seems that it doesn't run automatically when it's auto-mounted. I am running the latest standard build. Is there any other thing I should pay attention to when applying this? Beside this one, I find another place where auto-execution doesn't work as I expected. Under the jffs section in the webgui, I've put a command in "Execute When Mounted" field. But this seems not working either. I have jffs enabled and try to put command like "sh" or "" in that field and track the action by exporting the log to /tmp directory.

    About "device busy" message, I know it might be used somewhere. But I just couldn't find where it's used some times: it's not open in samba, ftp or telnet, and no program runs on the disk. Anyway, it doesn't bother me too much as long as I can use "-l" option.

  17. Engineer

    Engineer Network Guru Member

    Just upgraded to version 42 from 25 (yes, I did a NVRAM clear ;) ). Let's see if this version is stable...I've always went back to version 25 because it has been the most consistent and stable. So far so good on this one. :)

    Thanks TB...Oh and damn I want the RT-N16! :p
  18. teddy_bear

    teddy_bear Network Guru Member

    Yes, you need to make sure your scripts are made executable (chmod +x <script_name>), have "#!/bin/sh" as the first line, and DO NOT HAVE DOS caret returns between lines (so do not edit scripts with Windows notepad).
    With these conditions met all these scripts worked for me.

    There's an issue with the current implementation though - you can't make a script file executable on FAT filesystem, so these ".autorun" scripts won't work on FAT-formatted drives. I'll probably change it for the next build...
  19. babydragon

    babydragon Addicted to LI Member

    Thank you so much! I finally make it work. And I make it work on fat32 partition too!!! (I tried a few times and the script is finally executable on the fat32 disk) This version of the firmware is really great!!!

  20. babydragon

    babydragon Addicted to LI Member

    By the way, I just find something that might be improved.
    With auto-mounting configured, the folder names in fat partitions that are consist of capitalized letters will be shown in lower cases in the system. For example, a folder "TEST" under fat32 formatted drive will be shown as "test". This will cause many problems when one want to transfer files. The mounting option "-o shortname=winnt" would solve this problem. Maybe you might want to include this as the auto-mounting option for vfat partitions
  21. XEPOBO

    XEPOBO Addicted to LI Member

    I just fried my wl-500gP v2 with 42 twice (once with VPN and once with EXT builds). Went back to 41 via TFTP (was a bit nervous there for a min when I had to reconnect my WRT54GL to download TFTP, really have that ASUS set up perfectly). Anything I can send to you to see if something is wrong with my config. I have been updating since 1.25.32 and have not skipped a version, this is the first time I have an issue. Thank you by the way for your great work, I donated a few bux as a sign of appreciation a while back.
  22. teddy_bear

    teddy_bear Network Guru Member

    Thanks for the tip. Good idea - I'll add this option in the next build.
    Someone else had similar problem, and resetting to defaults (thorough nvram erase) before upgrading helped in that case. Maybe it's time for you to clear nvram as well...
  23. ghostknife

    ghostknife Addicted to LI Member

    I had no such problem, but it was still on v39 and did the upgrade from there as I hadn't gone to 1.27 builds yet. No reset performed.
    I did however have a lot of trouble with a WRT54g (v2.2), bricked and went round in circles to get it working when I upgraded to v42 (NON-USB) version the other day, prior to that it was running v41 USB No-Cifs. Anyway it's a working now but thats also the first time I had problem going between builds as well.
  24. Tim2k

    Tim2k Addicted to LI Member

  25. ghostknife

    ghostknife Addicted to LI Member

    teddy,ray, someone else..sorry to be a pain but is there any other response on if this is supposed/possible to work in WET mode. As advised PPPoE works if I use WDS but then I can only use No security or WEP, since WPA doesn't work with WDS. So I can have no security or WEP (basically no security) and it works but thats not really a solution.
  26. ghostknife

    ghostknife Addicted to LI Member

    If it helps I have a WRT54g v2.2 which also has wl0_corerev=7 and that is now on v1.27.8742 ND (No USB), think it should be OK.
  27. Tim2k

    Tim2k Addicted to LI Member

    Thank you! :)
    Going to try out teddys mod tomorrow.
  28. trevorw

    trevorw LI Guru Member

    vlan per port with USB mod?

    Hi guys,

    I'm trying to add each network port to its own vlan so that the traffic on each connection is easily monitored however I couldn't find a working combination.
    Somebody wrote a while back there might be even a hardcoded config reset in Tomato ( and so I'm hoping somebody on this thread can help me out.
    I have an AsusWlPv1 and from what I can tell all the lan wired ports are on vlan0 with the wired wan on vlan1.
    Ideally, I'd like to move each lan port to its own vlan (starting from 1 so vlan1-vlan4) with the wan port on vlan5 or vlan0.

    Is this possible to do in a safe, portable manner (so there's no hardcoding to a specific router) or are vlan1/vlan0 used in various places and changing the names is problematic?

    P.S. If it helps, there's a diagram of the internal wiring at: (the Asus wlPv1 uses a similar design).
  29. ray123

    ray123 LI Guru Member

    I haven't messed with that, but the code appears to support vlan0 to vlan15. It also appears that these are used only during initialization & vlan startup. It's all controlled by nvram parameters.
    So it should be easy to screw up. :eek:

    It looks like everything is driven from the config items in nvram, so once you have that right, it should be automatic. Just be SURE that you don't do a committ until you have everything working!

    I think that you could probably get it going by manually doing the appropriate setups. Things like setting up the routing tables, ifconfig, vconfig, etc. Just like Linux old-timers did.
    The key commands appear to be "vconfig add" and "vconfig set_ingress_map".

    The code is in .../router/rc/interface.c. If you want, I'll walk you thru how the configuration items work. Just ask.

    Out of curiosity, what are you wanting to monitor that you can't see now? Traffic by computer? By port? By ip-addr?
    FWIW, I used to have all 3 of my computers plugged into the router, using the router as a local switch. But the router only supports 10/100MB ethernet and my computers all do 1GB, so traffic between them (file transfers, X11, etc.) was capped at 100MB. So I bought a $10 Rosewill 8-port(*) gigabyte switch from Newegg, and plugged everything into it. Now the router doesn't even see the computer-to-computer traffic.

    (*) But one port was dead, so it's really a 7-port switch. For $10, it wasn't worth it to do an RMA. And I still have 3 un-used ports.
  30. BeHappy

    BeHappy Network Guru Member

    Never had any problem with earlier versions, but 8742 behaves very strange, indeed over the whole line of routers; asus, buffalo. As I narrow down the problem is existed when you change som wireless configurations, and after commit/reboot the routers hang and must do a hardreset. Anyone has the same problem?
    Going back to 8741 everything is fine again!
  31. teddy_bear

    teddy_bear Network Guru Member

    I only have DHCP here, and can't test PPPoE - but with DHCP my WL-520GU runs fine in WET mode, providing internet access to a coulpe of wired clients. Make sure you configure your client router correctly - specify main router's IP as "Default Gateway" and "Static DNS", uncheck "Use internal DNS", and set it to "Router" mode, not "Gateway".
    Also, the WDS does work with WPA - just not WPA2. Have you tried to set both routers to use WPA+AES? That works for me...

    The major change between v41 and v42 was adding wireless-N mode support - everything else was minor and should not cause any troubles.

    Have you tried thorough nvram reset and manual re-configuration after flashing to v42? Based on some other people experience, it might be needed for this build - depending on when you did it last time.
  32. BeHappy

    BeHappy Network Guru Member

    I did the nvram reset and the re-configuration after flashing to v42 several times to reproduce the troubleshooting, and the same oddly behavior with v42 for all my routers.
  33. teddy_bear

    teddy_bear Network Guru Member

    Well, so far only a few users (3 including you) reported similar issue (with at least one resolved after nvram erase) after roughly 500 downloads of v42. I'm unable to reproduce the problem either. So it must be something specific about your setup. Without seeing your routers, and with no further details I can't say anything else.

    Maybe if you send me your nvram (saved configuration) from wl520gu (PM me for the address), I'll try to load it into my router, and see if this will cause the same problem (if you do that, don't forget to mask your personal details, i.e. passwords/names/etc before saving - unless you don't care)...
  34. dswo

    dswo Addicted to LI Member

    UPDATE: I think I found the problem. My partitions were formatted in Windows, and they both had spaces in the name. I think it was the spaces that were tripping up Tomato. I renamed the partitions with no spaces, and now I can unmount all partitions without running anything in the "Run before unmounting" box.
  35. NewG

    NewG Addicted to LI Member

    Hey All,

    I am sure this has probably already been answered but I couldn't find anything after multiple searches.
    I am trying to do backups of the bandwidth logs. I have a thumb drive (fat32) mounted and accessible. I figured I could just put in /tmp/mnt/ into the custom path but that hasn't worked. So how exactly do I go about saving bandwidth logs to my attached hard drive?
  36. besonen

    besonen LI Guru Member

    qos firewall script generator

    i've been using the WRT54SG.exe (WRT54 Script Generator v1.02) application to create the firewall qos scripts for the cisco/linksys wrt54gl routers i deploy.

    i am now looking at using the asus wl-500gp v2 routers with tomato. will the firewall scripts generated by the WRT54SG.exe app work with this router?

  37. ghostknife

    ghostknife Addicted to LI Member

    OK tried that, both were already in router mode, unchecked internal DNS. I thought WPA was supposed to work as well but I can't get it to do so, tried TKIP, TKIP/AES, AES, all fail to connect, Disabled or WEP works fine. Maybe i got some weird wireless issue now as well, both are on 42, but it did the same when one was on 39 and the other on 41 so maybe it just hates me, *sigh*.

    Just to be clear on the config I'm trying to achieve because I have a strange network setup that is probably not available to many people.

    1) So my internets are ADSL2+ and my ISP allows 4 WAN IP on the same line/connection and in Australia use PPPoE to connect up.

    2) The modem/router is doing the main auth but is not in bridge mode and is set to "PPPoE with Pass-through", so this then allows the VM/server/PC to do a separate PPPoE dial-up session and get it's own internet address.

    3) The primary 500gp router is connected to the modem (WAN assigned to LAN) and does the DHCP/WiFi, the secondary WRT54 (was a 520gu, makes no difference) is at the other end of the house and in WET. Now in that config I can't do the dial-up sessions from that location if I need and have to connect to LAN cable run through the house because I can't install eth points.

    4) DHCP on the attached devices works fine and they get LAN IP, only when I try to do the additional WAN dial-up does it fail

    SO not sure how you can really do anything to help since you can't test that setup but if you have any ideas i'd be happy to try. I don't really want to use WDS and in any case it appears not to work for me anyhow. Is there some explanation I can understand why the PPPoe pass-through doesn't work when in WET mode? Is this the same reason VPN doesn't work in WET mode?

    Thanks for your time.

    Attached Files:

  38. buggage

    buggage Network Guru Member

    What's the reason to set the WET side to router vs gateway? Tried both actually and only difference I noticed was that I couldn't access the router's UI when in router mode, but could in gateway.
  39. trevorw

    trevorw LI Guru Member

    Hey Ray,

    Thanks for the support - I'll try to get a couple of hours this weekend, to play around with the config and see what can be done. I'm only interested in
    the traffic/bandwidth on each port, no matter the IP. In fact, I'd like to keep the current configuration (same network across the entire lan); I don't want
    to separate the ports rather to just identify them. The routing tables as well as the firewall rules should be the same and I hope QoS won't be affected.
    To add a bit of context, based on some recent discussions regarding traffic, I'd like to simply be able to monitor/quantify the IO activity on each port (regardless of the IP) - I know there are ways to do this but this seems sufficient.
    As for the hardware, I was thinking of using a gigabit but unfortunately here it costs a lot more then 10$ (probably ~40) and I'm not sure whether the uplink connection won't downgrade the entire switch to 100mbps. Further more since currently the network performance showed my Asus WL-500gPv1 was head to head with the dedicated switch (there were some dropdowns from time to time but nothing major) I was thinking of investing into the next gen of routers that come with gigabit lan. Further more (and much to my dismay), the utp (5e) cable (once wired through the building) had a bigger impact on performance (from 85/84% rolled up to 79-81% when wired through walls) probably due to the various turns, power cable interference or some pinches somewhere along the way. The tests (pretty basic) were done transffering the same file repeatedly, using two Win XP computers while looking at the the network performance graph from task manager. Both laptops have gigabit cards (though the switch and the router are obviously 100mb).

    Thanks again for your (practical) advice and support! I'll be sure to ping for more information if things don't work out.
  40. teddy_bear

    teddy_bear Network Guru Member

    If you only need to monitor/limit bandwidth by port, maybe you need to look into imq-based solution instead of creating vlans?

    In "Router" firewall is off, so you're avoiding a double-NAT situation which can cause various issues. No idea why you can't access GUI in "Router" mode - must be something you're not doing right...
  41. buggage

    buggage Network Guru Member

    Thanks for the explanation. Yeah was just testing it out quickly yesterday, so something might've happened. I'll try setting it up again tonight and double check.
  42. BeHappy

    BeHappy Network Guru Member

    As you wrote when the router is set up in mode - Router - the firewall is off, but if I change the default firewall rules with the firewall script (in GUI) below so the router is more responsive. Please enlight me (the router is set up as wds-client and the pc is wired to this one)

    # Flush all rules
    iptables -F
    iptables -t nat -F
    iptables -t mangle -F

    # Erase all non-default chains
    iptables -X
    iptables -t nat -X
    iptables -t mangle -X

    # Reset Default Policies
    iptables -P INPUT ACCEPT
    iptables -P FORWARD ACCEPT
    iptables -P OUTPUT ACCEPT
    iptables -t nat -P PREROUTING ACCEPT
    iptables -t nat -P POSTROUTING ACCEPT
    iptables -t nat -P OUTPUT ACCEPT
    iptables -t mangle -P PREROUTING ACCEPT
    iptables -t mangle -P OUTPUT ACCEPT
  43. teddy_bear

    teddy_bear Network Guru Member

    Well, it's not completely off... To be more specific, in "Router" mode Tomato doesn't create any FORWARD rules, only a single "ACCEPT" rule for everything (the rest is the same as in "Gateway" mode). I haven't had any issues with router responsiveness in client modes, so I didn't investigate it further. It is very much possible that your clean-up script helps. What exact difference in behaviour/responsiveness do you experience between having this script and not having it?

    By the way, in your signature it says that you're using WDS with WPA2+AES security... Does it work for you in that combination?? I've never been able to configure WPA2 with WDS, not even WPA/WPA2. The only option that worked for me was WPA+AES.
  44. BeHappy

    BeHappy Network Guru Member

    - In router-mode with the upon firewall script the web-surfing is more responsive (maybe a little bit shorter ping time) as the data packets don't need to be passed/filtered from the client- to main router

    - Using WPA/WPA2 Personal (+AES) as security mode since v1.23
  45. maurer

    maurer Network Guru Member

  46. Cool_Zero

    Cool_Zero Addicted to LI Member

    Transmission Queing

    Thanks for the new build of tomato mod...
    I'll try it later...

    Guys, please enlighten me. I'm new to unix/linux. I found this script on the net and
    I need to run this script in my scheduler in tomato webgui.. or in cron

    I'm running "Tomato Firmware v1.25.8739 ND USB Ext" on my ASUS WL-520GU with "Transmission 1.76 (9395)" optware.

    I need to test this script first before putting it in my start-up. so I log-in using SSH (putty) on the router and do the following.

    here's my scenario and the help that i need:

    1. I run this command first to make sure the file is executable.
    # chmod 755 /opt/usr/transmission-queue
    then run the script
    # /opt/usr/transmission-queue
    and i got this message
    -sh: /opt/usr/transmission-queue: not found

    It's a bash script? should i install the bash optware to run that script? (ipkg install bash)

    2. What else I need to do? I've installed the bash using the "ipkg install bash"
    and CHMOD 755 the "transmission-queue" file again and then run the script but i got this message:

    $ /opt/usr/transmission-queue

    /opt/usr/transmission-queue: line 17: tail: Permission denied
    /opt/usr/transmission-queue: line 17: grep/opt/usr/transmission-queue: line 17: head: Permission denied
    : Permission denied
    /opt/usr/transmission-queue: line 17: grep: Permission denied
    /opt/usr/transmission-queue: line 17: awk: Permission denied
    [01:35:49.423] transmission-remote: (localhost:9091) Error
    /opt/usr/transmission-queue: line 25: tail: Permission denied
    /opt/usr/transmission-queue: line 25: head: Permission denied
    /opt/usr/transmission-queue: line 25: grep: Permission denied
    /opt/usr/transmission-queue: line 25: grep: Permission denied
    /opt/usr/transmission-queue: line 25: wc: Permission denied
    [01:35:49.771] transmission-remote: (localhost:9091) Error
    /opt/usr/transmission-queue: line 33: [: Permission denied
    /opt/usr/transmission-queue: line 37: tail: Permission denied
    /opt/usr/transmission-queue: line 37: head: Permission denied
    /opt/usr/transmission-queue: line 37: grep: Permission denied
    /opt/usr/transmission-queue: line 37: wc: Permission denied
    [01:35:50.096] transmission-remote: (localhost:9091) Error
    /opt/usr/transmission-queue: line 48: [: Permission denied
    /opt/usr/transmission-queue: line 51: tail: Permission denied
    /opt/usr/transmission-queue: line 51: head: Permission denied
    /opt/usr/transmission-queue: line 51: grep: Permission denied
    /opt/usr/transmission-queue: line 51: awk: Permission denied
    [01:35:50.425] transmission-remote: (localhost:9091) Error

    3. Do i need to change something in "/etc/passwd"? Here's my "/etc/passwd":

    $ nano /etc/passwd


    4. How about in my "/etc/profile", Do i have to add something on it?

    $ nano /etc/profile

    export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/home/$USER:/mmc/sbin:/mmc/bin:/mmc/usr/sbin:/mmc/usr/bin:/opt/sbin:/opt/$
    export PS1='\u@\h:\w\$ '

    alias l='ls -lFA'
    alias ll='ls -lF'

    [ -f /jffs/etc/profile ] && . /jffs/etc/profile
    [ -f /opt/etc/profile ] && . /opt/etc/profile

    5. there's no "/opt/etc/profile"
    $ ls /opt/etc

    cron.d init.d lynx.cfg mke2fs.conf wgetrc
    crontab ipkg.conf logrotate.conf lynx.lss nanorc
    fonts logrotate.d man.conf termcap

    6. If i need the bash optware and already installed it... How can i mix it with the original shell of tomato?
    is it possible so that it will be more advance?

  47. teddy_bear

    teddy_bear Network Guru Member

    Busybox really needs to output better diagnostic messages - this question comes up every ones in a while in different variations.

    1. Uninstall bash.
    2. Read this post for script requirements.
    3. Start using google and forum search.
  48. ray123

    ray123 LI Guru Member

    So are you the "noob" that asked this question here: ?

    If so, I'd say you got a few steps ahead of yourself, what with being a self-proclaimed noobie.
    Tomato doesn't have cron, so all that discussion about crobtab is worthless.

    FWIW, I have transmission installed on my 520GU. You must realize that these routers are routers, not full-fledged computers. They have very limited resources. Limit it to 1 or 2 downloads and uploads, and it'll probably be fine. I guarantee that if you let it rip you'll be sorry. If the memory gets full, Linux will start to kill processes. That's gonna hurt if a process it picks is critical to the running of Tomato.

    You'd be well served to read my writeup on how to run a torrent client on Tomato. Unfortunately I haven't posted it anywhere yet. :mad:
  49. besonen

    besonen LI Guru Member

    ping (is there is a better place to post this question?)

  50. Toastman

    Toastman Super Moderator Staff Member Member

    I don't see why it shouldn't work - it just generates iptables rules.
  51. Cool_Zero

    Cool_Zero Addicted to LI Member

    Well its true.. Thanks anyway... Im trying to figure something out...:wink:
  52. Cool_Zero

    Cool_Zero Addicted to LI Member

    NO, its no me.
    but anyway, Im trying to learn something on it... THANKS RAY123!

    I found that true... that's why I want to use the queing in transmission and because right now I'm downloading a tv series.

    hehehe :biggrin: well that will be a great help.. :wink:
  53. cadteach

    cadteach Addicted to LI Member

    USB settings?

    I have a non-tomato main router as a wireless access point and the ASUS WL 520GU running tomato in client mode. The tomato router connects to my network, and I can access the Internet from a PC connected (by wire) to the ASUS. I can also print to the printer via the USB port on the ASUS. However, I can only print to the printer from the machine wired to the ASUS printer.

    Is this because of the ASUS router being in client mode (because of the differences in IP addresses)? Only the one PC connected to the ASUS is on the same IP range.
  54. xppx99

    xppx99 Addicted to LI Member

    I mount the drive manually because I run a "e2fsck -p" before mounting every drive. Is this possible to do with the Auto-mount + fstab option?
  55. xppx99

    xppx99 Addicted to LI Member

    I have an Asus 500gP with transmission for torrents. I'm also TV series watcher and I found a solution for automatically grab the torrents, and start downloading in transmission.

    for grabing the torrents, I managed to install "rssdler" (serch on google), which basically does the "hard work". It checks the RSS feed of the tracker, and if the torrent matches the filter, it downloads it.

    Then I made a very basic script, which runs every minute (cronjob) and checks if there's a torrent in the folder. If it finds one, simply does the command "transmission-daemon -a nameofthetorrent.torrent" and that's it!

    I don't know if this is what you mean by "queing in transmission", but this system works very nice for me!
  56. ray123

    ray123 LI Guru Member

    That way, no. But another way, possibly yes. I've been giving this some thought for a while.
    IIRC, one of the patches I put up passed the device name(?) or maybe mountpoint of the newly mounted partitions to the post-mount script. That could maybe be a start. I think that TeddyBear dropped that part, though.

    You can only do fsck before the partition gets mounted, so of course the post-mount script is too late.

    My thought was doing something like adding a "run fsck" checkbox, or perhaps a "pre-mount" script option. The latter would probably be best.

    You've got to be really careful. Fsck on a large ext2/3 partition can take a lot of memory. If you don't have a swap enabled, it is liable to crash or lock-up the router. And even if you do have swapping enabled, it *still* may take too much memory. You do NOT want to have this be automatic, for fear that it will just continually reboot and lock-up forever.

    Also, we don't really want to install all the fsck programs in the standard Tomato image, because that would consume too much of the limited flash memory. So they'd have to be installed in an /opt partition on either a USB drive or a cifs drive. The former is bad because it would have to be mounted to access the fsck program but it must be unmounted to run fsck on that partition. Chicken-and-egg problem. As for cifs, you'd have to make sure that the remote computer was up when the router gets booted.
    Ugly, ugly, ugly.

    IMHO, the best thing is probably to have all ext3 partions, where you don't have to worry about running fsck.

    Also......both ext3 recovery and fsck can take a LONG time to run. I've seen them take as long a 5 minutes. Yes, on my 520GU router. So mounting the drive may take several minutes.

    As you can see, this is a much more complex problem than it seems at first thought.
  57. babydragon

    babydragon Addicted to LI Member

    I used to run a post-mounting script which would umount the drive first, then do fsck and finally mount it again with extra build. But isn't it true that the 6th options in fstab would specify whether to do fsck on the partition? well, fsck is included in extra build

  58. ray123

    ray123 LI Guru Member

    The post-mount script doesn't know which partition/device just got mounted. (Unless TB did indeed include that---but I think he didn't.) Don't forget that the solution must work when there is more than one disk and more than one partition on a disk.

    Only the *.autorun script on the partition knows which partition it is. But even so, it doesn't know the device name (like "/dev/discs/disc2/part1"), just the mountpoint (like "/tmp/mnt/ext_160"). To do umount/fsck/mount you have to know both.

    FWIW, the fsck passno parameter (6th arg in fstab) is the order to do the checks in. A value of zero means don't check. For this to work, you must have every disk & partition specified in fstab, and also have fsck run just before any mount gets done. But right now Tomato does not even attempt to run fsck, and there's no facility to let the user do so. There's no pre-mount script, only post-mount.
    And unlike a desktop system, the disks are not accessible early in bootup----they only come into existance later on, one at a time, when the USB subsystem gets the hotplug status events.

    A generally usable solution has a lot of picky problems that must be addressed. One is to make it easily workable for people who don't know Linux. Another is that the normal case will NOT have /etc/fstab, but will have only the standard Tomato automount. etc. etc. etc.
  59. depornage

    depornage Network Guru Member

    draft N on WL-500W?

    • Can anyone confirm successfully running draft N on an Asus WL-500W with the new build? Would love to migrate from oleg's firmware. Thanks -
  60. babydragon

    babydragon Addicted to LI Member

    Thanks for your explanation. I guess it is best to just use ext3 without fsck. But if any one would like to do fsck, here is my ugly solution:
    e.g. I want to mount a drive with label "Optware" to the folder /opt. Run a script after a drive is auto-mounted like the following:
    [ -d /mnt/Optware/lost&found ] && [ -d /opt/lost&found ] || (umount /mnt/Optware && e2fsck LABEL=Optware & mount LABEL=Optware /opt)

    Of course you may want to put command like "sleep 5" within to wait a few seconds before the system trying to mount/umount/fsck
  61. paulvb

    paulvb Addicted to LI Member

    I'm trying to clarify whether the Tomato ND USB mod supports SFTP. There's a table in the wikibooks Tomato article
    with a list of features for various mods. For the teddy bear mod the SFTP column says "Yes". A lot of people confuse SFTP (FTP-like interactive sessions over SSH) and FTPS (FTP with SSL/TLS), so I tried both. I have a thumb drive on my ASUS 520-gl (latest teddy bear 1.27 FW) and can put/get files with FTP. When I try SFTP I get a message about sftp-server not found:
    # sftp sieggy
    Connecting to sieggy...
    root@sieggy's password:
    sh: /usr/libexec/sftp-server: not found
    Connection closed

    vsftpd optionally supports ftps - if openssl or GNU TLS libraries are compiled in. By default, vsftpd has SSL/TLS disabled. I tried typing in ssl_enable=yes into the Vsftpd Custom Configuration box, then hit save, it did not change vsftpd behavior. If I navigated to a different page and returned to to the FTP page, the customization text disappeared. I couldn't get any vsftpd config commands to "stick", but my intuition is that SSL/TLS is not compiled in (due to the size).

    Can anyone confirm whether any sort of encrypted file xfer is available?
  62. kamatschka

    kamatschka Network Guru Member

    Hello there.

    Is there any possibility you are including SD(HC) Feature in your Firmware?

    Maybe a separate SD(HC) Version of your mod without USB? That would be really awesome. Thank you in advance.


    Linksys WRT54GS v1.1
  63. teddy_bear

    teddy_bear Network Guru Member

    Since nobody responds to your question, what prevents you from loading this firmware, and testing yourslef whther N-mode works or not?

    The wiki is wrong. This mod doesn't include neither sftp, nor ftps (vsftpd is compiled without ssl support). You can install Optware sftp separately though.

    I'm not going to include SDHC support. There's a separate mod which supports it (search this forum).
  64. TurtleFang

    TurtleFang Addicted to LI Member

    But you can use scp in a pinch if you need to securely copy a file.

    No, its not a feature rich as sftp, but its there without any additional effort.

    Hope this helps,
  65. Daggerx

    Daggerx LI Guru Member


    Can i run this on an WRT54GS-1.0. I'm currently running Victek's mod. Also should I erase nvram if I can run it? Thanks in advance.
  66. vyrticl

    vyrticl Addicted to LI Member

    Back again with the same SSH issue :(

    I updated to build v42 and the ran across the same SSH issue that I had before. I can SSH to the router from my local network but I can't SSH to the router from an outside network. When I look at the log in the web gui after attempting to SSH to the router from an outside network, nothing is displayed in the log that it allowed or denied a login attempt. So it's like dropbear isn't even seeing my attempt.

    I downgraded to v41 and still had the same issue. Each time I flashed, I cleared NVRAM before and after. Going back to stock Tomato, SSH works perfectly.

    Thinking back on it the only time SSH has worked for me with this mod is when I enable SSH before doing any of my other configuration changes. I'll list a brief breakdown of what changes I make to the router.

    • change basic wireless settings
    • change the hostname
    • change time zone
    • setup opendns and dyndns
    • increase cache size, enable asynchronous logging, and setup custom adblock file for dnsmasq
    • delete all example (disabled) port forwards and access restrictions
    • enable upnp
    • change web gui port, enable ssh, disable telnet, change admin password
    • setup cifs1
    • change bandwidth monitoring save location
    • setup script to copy custom adblock and pixelserv from cifs1
    • setup qos (tried with no QoS, same issue)
    Like I said, going back to stock Tomato or Speedmod Tomato, SSH works perfectly, no issues. So it's not an issue with my SSH client or setup. Maybe my WRT54GS v1.0 has issues with this mod?

    Any suggestions as to what I could try to help further isolate the issue?
  67. TurtleFang

    TurtleFang Addicted to LI Member

    I doubt that it's something to do with hw, as it's not an accelerated feature and it works inside the network. Me thinks you have some kind of configuration issue.

    If you're willing to work on it a bit more, I recommend you try to "divide and conquer". Under Administration -> Logging -> Connection Logging "If Allowed by Firewall". Now try to connect again, see if your getting through the firewall like this:

    Jan 18 12:50:23 ROUTER_NAME user.warn kernel: ACCEPT IN...

    This line will contain a ton of info about the tcp port, etc. If you don't see a log entry when trying to connect, try changing the logging rules to "both" and see if there is a deny entry.

    At this point you'll know if the problem is getting to dropbear, or dropbear itself.

    Hope this helps,
  68. vyrticl

    vyrticl Addicted to LI Member

    I'll re-flash back to the usb mod when I get off work and enable that. I'll also compare the iptables rules and post that as well. Maybe for some reason the remote port rule isn't being applied to iptables?
  69. ray123

    ray123 LI Guru Member

    Teddy Bear, I ran into another issue with v42.
    It almost always doesn't create my /etc/fstab during startup. This file is supposed to be created by load_files_from_nvram in init.c. I added another file ("nvram setfile2nvram <file>"), and it also doesn't always get created. But sometimes they do get created.:confused:

    V41 is rock solid.
    I think it must be some sort of timing problem, because if I put some cprintf & syslogs in that code the files do get created. I looked at the diff of v41 vs. v42, and didn't see anything obvious that would have caused this problem.
    I'm looking into it.

    BTW, I found & fixed a slight timing issue in start_syslog, that causes the first few syslog messages to not appear.
  70. teddy_bear

    teddy_bear Network Guru Member

    I played with it once more, and it worked as expected - no issues. Are you testing remote SSH access from the WAN side, or just using your external WAN IP address while you're actually in your LAN? If you're testing from LAN, this is exepcted - it may not work. If you do test from WAN, check your iptables configuration (cat /etc/iptables), and verify that the dropbear listens on the port specified (netstat -an)... If it works right afer resetting to defaults, try to apply your settings one at a time and pay attention when it stops working - that might provide some clues.

    I suppose getting rid of USB lock might have changed the timing in startup procedure - but nothing obvious that could cause issues with load_files_from_nvram()... I'll look into it. Maybe I'll just move load_files_from_nvram after start_usb, right before running the init script...

    I too noticed some of the syslog output being cut off at startup - that started to happen after merging with Tomato 1.27. I moved start_syslog() to be called earlier - that improved the situation but didn't resolve it completely. I didn't care enough to research this further as dmesg is still there - but it would be nice to get it fixed...
  71. CsBubo

    CsBubo Addicted to LI Member

    Is nfs working with Tomato USB mod?

    Hi Everyone!

    Anyone knows/tried if nfs somehow can be switched on? So far necessary modules are existing within the extras module pack, they can be loaded as well without error, but all the remaining prerequisites are in place, if any? Thinking of kernel parameters etc..
    I'd like to know beforehand if any more effort should be put in, to get it working.
    Looking for Your input!
  72. vyrticl

    vyrticl Addicted to LI Member

    This is beginning to be very annoying. It seems that everytime I try to reproduce the problem after posting here I can't. I swear I'm not just making this problem up :)

    Next time I see the issue though, I'll get a copy of my /etc/iptables and netstat and turn on firewall logging.

    Although, during the process of reflashing a million times, I decided to try out the "execute when mounted" feature in the CIFS Client. So I put in the command, "/cifs1/tomato/adblock". However when my CIFS share gets mounted it never runs the script. So I tried the command, "echo Hello". That didn't work either. Also on the logging page it says the share is mounting but it never says that it mounted (even though it did). Maybe I'm not understanding the feature correctly but it doesn't seem to execute a command when the CIFS share mounts.
  73. teddy_bear

    teddy_bear Network Guru Member

    Yep, the modules are compiled, and as far as I know this is all you need. But I have not tried NFS myself - just compiled the modules...

    Not sure if scripts can be executed directly from CIFS partition... Can you make the script file "executable" there (i.e. "chmod +x script_file" runs with no errors)? If so, it should work - might just be another case of malformed script file. If you can't set "executable" attribute to the script file, you'll need to copy it to the router filesystem first, and run from there.
  74. ray123

    ray123 LI Guru Member

    V42 compiler bug

    If I had a dollar for every time I heard somebody claim "it's got to be a compiler error", I'd be rich.
    Alas, in this case it turns out to be true.

    Long story short....
    The new compiler (3.4.6) produces bad code.
    I tried to compile V42 with the old compiler (3.2.3 w/Broadcom midifications), but couldn't get it to compile-----seems there's other things like libraries that need to be co-ordinated with the compiler version, so I didn't go any further.

    Perhaps some of the problems that people are having with V42 are related to this. Hard to tell when you have a buggy compiler.
    Might be better off to switch back to the old compiler.

    Long story long....
    The problem I was having with load_files_from_nvram in V42 just didn't make sense. The code hasn't changed, yet it would sometimes always fail. The official trx build fails every time. Even when I rebuilt it myself it failed. When I put in some debugging code, it would work. When I made edits elsewhere in the init.c file, it would fail. Another edit and it would work. When it fails, it fails on every reboot. When it works, it works on every reboot.
    Note: "fail" means that it didn't create the files that it was supposed to.

    I finally got a build to fail with some debug cprint's, and the result didn't make sense.

    After the loop, I had this line:
    cprintf("in load_files_from_nvram @ %d  size: %u   %p %p\n", __LINE__, name - buf, name, buf);
    The printout is:
    in load_files_from_nvram @ 864  size: 4294902235   0x7ffe0023 0x7ffefe48
    Impossible!!! "name" has to be >= "buf". It CAN'T be < buf. That "size" of 4GB means it wrapped around (pointer arithmetic is unsigned).

    Here's the output from a working build:
    in load_files_from_nvram @ 866  size: 13545   0x7fff3329 0x7ffefe40  
    I compiled init.c with flags "-Wa,-ahlsn" to see the assembler output.
    The original code:
    	for (name = buf; *name; name += strlen(name) + 1) {
    and modified code:
    	name = buf;
    	for (; *name; name += strlen(name) + 1) {
    These should generate the same exact assembler code. But it doesn't. Here's the diff:
       998 0970 1000B1AF             sw      $17,16($sp)
       999 0974 00008424             addiu   $4,$4,%lo($LC21)
      1000 0978 09F82003            jalr    $25
    - 1001 097c 61030524            li      $5,865                  # 0x361
    + 1001 097c 62030524            li      $5,866                  # 0x362
      1003 0980 1800BC8F            lw      $28,24($sp)
    It looks to me like the assignment to "name" didn't got done. Or something. I know nothing about mips32 assembly code, but one of these *has* to be wrong.

    BTW, with the failing version with the cprintf's.......just removing the "static" from the declaration "static void load_files_from_nvram(void)" makes it work.

    Here's the code (note that *any* change to this can change it from failing to working, with no rhyme or reason):
    static void load_files_from_nvram(void)
    	char *name, *cp, buf[NVRAM_SPACE];
    	nvram_getall(buf, sizeof(buf));
    	for (name = buf; *name; name += strlen(name) + 1) {
    	   cprintf("name: %p    strlen: %d\n", name, strlen(name));
    		if (strncmp(name, "FILE:", 5) == 0) { /* This special name marks a file to get. */
    			if ((cp = strchr(name, '=')) == NULL)
    			*cp = 0;
    			syslog(LOG_INFO, "Loading file %s from nvram", name);
    			nvram_nvram2file(name, name+5);
           cprintf(">>%.75s<<\n", buf);
    int j=0;
    cprintf("in load_files_from_nvram @ %d  size: %u   %p %p %d\n", __LINE__, name - buf, name, buf, j);
           for (j = 0; j < 25; ++j)
    	  cprintf("%02x\n", buf[j]);
  75. hapahopi

    hapahopi LI Guru Member

  76. ray123

    ray123 LI Guru Member

    Easy----but it just won't work, eh? :biggrin:
    "Other than that, Mrs. Lincoln, how was the play?"
    "Other than that, Mrs. Kennedy, how was the parade?"

    I'm making a writeup, hopefully coming Real Soon Now. Watch for it.
  77. ray123

    ray123 LI Guru Member


    Well, well, well. This compiler bug is worse than I thought.
    Either that, or I forgot what I know about C.

    Here's a new snippet of code:
    	char *name, *cp, buf[NVRAM_SPACE];
    	nvram_getall(buf, sizeof(buf));
    	name = buf;
    	cprintf("name: '%s'\n", name);
    	cprintf("buf : '%s'\n", buf);
    	cprintf("  buf:  %p  name: %p\n", buf, name);
    	for (name = buf; *name; name += strlen(name) + 1) {...}
    	cprintf("name: '%s'\n", name);
    	cprintf("buf : '%s'\n", buf);
    	cprintf("  buf:  %p  name: %p\n", buf, name);
    Now, "buf" by definition is identical to "&buf[0]", and the address of a variable doesn't change. Right?
    However, this is what gets printed:
    name: ''
    buf : ''
      buf:  0x7ffe0022  name: 0x7ffe0022
    name: ''
    buf : 'wl_mac_deny='
      buf:  0x7ffefe40  name: 0x7ffe0023
    Impossible!! The address of buf changed. This explains why "name" had a bogus value in my previous post. And we see that "name" got correctly bumped by 1----just that it started out at a bogus value. However, it looks like the correct address got passed to nvram_getall.
  78. jinx

    jinx Addicted to LI Member

    Shouldn't it be "name = &buf[0];" such that "name" points to what "buf" points to, rather than the address of "buf" itself?

    Here's a new snippet of code:
    	char *name, *cp, buf[NVRAM_SPACE];
    	nvram_getall(buf, sizeof(buf));
    	[B]name = [I]&buf[0][/I];[/B]
    	cprintf("name: '%s'\n", name);
    	cprintf("buf : '%s'\n", buf);
    	cprintf("  buf:  %p  name: %p\n", buf, name);
    	for (name = buf; *name; name += strlen(name) + 1) {...}
    	cprintf("name: '%s'\n", name);
    	cprintf("buf : '%s'\n", buf);
    	cprintf("  buf:  %p  name: %p\n", buf, name);
  79. ray123

    ray123 LI Guru Member

    No, buf isn't a pointer, it's the buffer itself.
    "To get the address of an array, you simply use the array name, which stores the memory location of the first value in the array. Note that while using the name of the array causes it to act like a pointer, unlike a regular pointer, it is constant."

    Oh, I should also mention one more thing---for anybody who looks at the source code. If you call load_files_from_nvram once where it currently is (after start_syslog) and then again later (after the syslog of the Tomato version ID), and the 1st one fails, the 2nd one generally works. That's not a good workaround, of course, since we need to load the files very early in case any of them are config files. Which is my case, since I load /etc/fstab. In fact, that's how the bug came to my attention, because I noticed that my swap partition didn't get activated. The chances that this is the only piece of code that the compiler screws up is vanishingly small.
  80. were55

    were55 Addicted to LI Member

    Printer in 2dn router

    Hi everyone, I hope your somebody can help me with that, let me explain me:

    I used to have my first router (router1=asus WL-520gu in WDS+AP mode) connected trought a Hub a MFP (printer and scanner Samsung SCX-4300) and my HDD with two partitions, one in FAT and other one in ext3, that was working fine (FTP server, File sharing, printer, scanner) and a second router (WDS) for coverage purpouse (also WL520gu), BUT my wife :mad: pushed me to move the MFP to another room (where router2 is located), so now this is the situation:

    - Router1 is connected to cable-modem and have connected the HDD (with FTP and file sharing functions), with Ip in WDS+AP mode.
    - Router2 have MFP connected with Ip, printer is working fine (I can print behind router 1 or 2), but I'm trying the scan to got it work, but so far I can't.

    I'm trying to use /jffs for opt (already mounted) but I'm not sure if I will have enough space for SANE packages and also I can not get "wget" to run (there is not access from shell to internet) so I have many doubts:

    1. How can I have access internet from 2nd router ?
    2.- Is it possible to access my HDD from the shell of second router ? how ? This might help me to mount a bigger /opt partition.
    3.- If steps 1 or 2 worked, Could I use the scanner behind router1 ?

    Any idea ?


    PD I'm using last TB release.
  81. teddy_bear

    teddy_bear Network Guru Member

    I assume the problem can't be reproduced in a test app, and only occurs in the actual rc code during startup? Have you tried it with different compiler flags (i.e. -O2 or -O0 instead of -Os)?

    With my current version of the code it doesn't happen... I'll go back to the exact v42 code and play with it. If it's indeed a compiler problem, maybe there's a patch for it somewhere already...
  82. mstombs

    mstombs Network Guru Member

    Ray you've probably forgotten more than I've ever learnt about C, but latest gcc 4.x compilers warn that passing a char[] to a function that expects char * is dangerous

    nvram/nvram_linux.c:int nvram_getall(char *buf, int count)
    my guess is that the optimiser on nvram_getall thinks it can do what it likes with buf.
  83. jstewar9

    jstewar9 Guest

    HP 1018 Won't Print After Restart


    I have a WL-G520GU flashed with Tomato USB Mod. I was able to use the hotplug script below to get my HP 1018 working.

    if [ $PRODUCT = "3f0/4117/100" ]
    if [ $ACTION = "add" ]
    sleep 5
    cat /jffs/sihp1018.dl > /dev/usb/lp0

    Unfortunately, after restarting my computer I am unable to print. If I reinstall the printer it will work. Any thoughts on getting it to work after restarting?

    I apologize if this has been brought up before. I have searched for a while and not found a solution.

  84. alexlau

    alexlau LI Guru Member

  85. ray123

    ray123 LI Guru Member

    I can't find that warning (I guess google doesn't find everything), but I suspect that you are mis-reading the warning. By definition, naming an array is exactly the same as taking the address of the 0'th element of the array. Identical. Otherwise every C program in the world would break. Consider such basic functions as read, write, strlen, strcpy, etc. They all work the same way as the call to nvram_getall does.

    Examine, for example, the getall function in nvram.c (line 43). Also the code for "show" in nvram/main.c (line 33 & 67-72). If you compare those, you'll notice an uncanny resemblance between that and the code in load_files_from_nvram. The similarity is because I copied that code from nvram/main.c and copied it verbatim when making load_files_from_nvram.

    Remember the motto of the professional programmer: "Plagiarize, plagiarize, plagiarize, let no one's work evade your eyes." "It's better to steal than to re-invent."

    So, anyway...yes, the optimizer can do what it wants, but it is required to produce correct code. In this case, it doesn't. It's not nvram_getall that's the problem anyway.

    Correct, I haven't been able to reproduce the bug in a test app. As I said, even adding debug statements to load_files_ changes it back & forth from working to not working. I did not try other compiler flags, other than removing "-mtune=mips32". Which had no effect. It took me 2 solid days of poking around to get a full understanding of what's going on. Things like this, BTW, is why most professional programmers eventually become bald---from ripping out their hair. :)

    I spent a few hours trying to compile the V42 code with the old compiler, but was unsuccessful. There are obviously library, etc. differences that I am unfamiliar with. I figure that since you did the upgrade, you'd know what changes must be made to do try the downgrade.

    Since this only clearly shows up in the init function, it can't be tested like most of the other things, by just copying the new executable from /cifs and running it. It can only be tested by building and flashing a whole new trx file. I consider it a success that I only bricked my router once. So it's a very laborious process to try different things. The code *should* work (the C code is correct), so it's a matter of trying different things and seeing how the compiler f'ed it up this time. It took a LOT of trying until I managed to get a build that fails *and* has cprintf's so you can see what's going on. Like I said, the least little thing will change the workings of it. Even changing this function declaration from static to non-static changes the way it works.

    It failed on my first build of V42 + my next set of trivial mods, so I then dl'ed your V42 trx file, and it failed the same way. I then built a virgin V42, and it failed the same way.
    And then I started thinking...
    > ~/tomatov34/tools/brcm/hndtools-mipsel-linux-3.2.3/mipsel-linux/bin/gcc --version
    gcc (GCC) 3.2.3 with Broadcom modifications

    I wonder just what these "Broadcom modifications" were? Why would they have seen a need to modify the standard gcc compiler? Maybe to fix some bugs in code generation?????? Hmmmmmm??????

    You can't trust a compiler that is known to generate bad code. It is pure happenstance that I ran into this situation. Who knows how many other places in Tomato there are which have incorrect generated code.
  86. mstombs

    mstombs Network Guru Member

    My bad, its probably the "const char[] to char *" that now triggers only a "deprecated warning" that I've seen for example

    and it may be more common with g++ and cpp files.

    As you say its pretty unlikely this would be the only place a compiler would screw up, and the code does seem to basically work.

    How about this for some Broadcom mods to gcc ?
  87. Toastman

    Toastman Super Moderator Staff Member Member

    alexlau, The router can theoretically handle quite a large number of connections, but the router will likely become unstable and slow.

    There is a lot of misunderstanding about this. The fact is, routers most often crash because they run out of memory. This is often caused by the router tracking thousands of connections. Fair enough, we have to make connections! But in most circumstances, the biggest problem comes from P2P applications leaving huge numbers of connections improperly terminated, and waiting to be timed out by the router. The default timeout values used in many routers is too long, the connection tracking table keeps getting bigger, and the routers therefore run out of memory and crash.

    So, the secret is NOT to allow more and more connections to be opened and add to the problem (often recommended), but to allow a sensible number only. At the same time, to RAPIDLY expire dead connections to free up memory.

    With Tomato, the timeout values can be changed, in the Advanced/Conntrack-Netfilter section. In a properly set up router, it is actually quite rare to see much more than 1000 connections even with many users and applications running. A sensible value for the maximum number of connections is around 2000 to 3000.

    Experimentation with these values can make a dramatic difference to your router's performance.

    EDIT - with the arrival of the Asus RT-N16 and it's bloody ridiculous claims for maximum number of P2P connections, a cautionary word is in order.

    At any one time, a REALLY BUSY router might, for example, be handling 400 active connections and 600+ inactive ones waiting to be expired. Now, you can set the connection limit higher if you wish, and allow 64,000 inactive connections to be tracked. But what's the point, actually? It uses up memory and processor time for no benefit at all. If you want your router to remain fast and responsive, don't set more than say 3000 connections (or whatever you feel might be really sensible). Instead, expire those old connections as fast as you can using the conntrack limits! Be as vicious as you can and then back off if you go too far. Look at my QOS thread to see how far I have gone with the conntrack limits as a start. Most of the time I don't see more than 1300 connections even in a busy building with 120 users.

    Hope this is useful !
  88. teddy_bear

    teddy_bear Network Guru Member

    Not possible. New kernel can't be compiled with old toolchain (gcc/libc), and vice versa - the new toolchain can't be used to compile the old 2.4.20 kernel.

    But I don't believe it's a way to go anyway - and we don't even know if the old version has the same bug or not! It seems very weird that we didn't see any such problems for all builds between 35 (when I started to use gcc 3.4.6) and 41, and suddenly the compiler bug reveals itself in v42. Also, this exact gcc version with the exact same set of patches has been used by OpenWRT and DD-WRT projects for a few years, and is still used by these projects to compile the 2.4 kernel. So probably a very specific and rare set of conditions must be met to trigger this bug...

    Other open source firmware projects (OpenWRT, DD-WRT, already switched to gcc 4.x for userspace apps, and only keep gcc 3.4.6 to compile the kernel (because gcc 4.x miscompiles kernel 2.4). I'm going to do the same for the next build. I already tested gcc 4.1.2 - I'm using it to compile a kernel 2.6 version of this mod, and so far everything looks good there.
    In the meantime, I'll try to find out more about this particular gcc bug, and maybe a fix for it.
    These are workarounds for BCM4710 chip hardware bugs. They are applied to gcc 3.4.6 I'm using as well, it's just that the wording "with Broadcom modifications" has been removed from newer versions because of some licensing arguments...
  89. alexlau

    alexlau LI Guru Member

    thank you Toastman! your explanation is clean & clear, as always :) Matter of fact, I'm still studying your post on QoS.

    I'm currently using a WL-500GP Version1. which Tomato would you recommend?
  90. Toastman

    Toastman Super Moderator Staff Member Member

    Teddy Bear's!
  91. xppx99

    xppx99 Addicted to LI Member

    I have reacently updated my 500gP's firmware (41 -> 42 Extra build) and I have noticed some problems with QOS:

    I have configured "inbound limit"=10000kbit/s, and have the lowest class configured to 70%, which means 7000kbit/s bandwidth limit for this class.

    Sometimes, I can see clearly that this limit is not working. I have to reboot the router more than once sometimes. I comfirmed that the connections are being tagged correctly (as the lowest priority in the QOS graphs section), so I don't understand the problem, it seems that the QOS does not apply the inbound limit rule.

    I do not know if I was experiencing this problem in the previous 41 version. Nevertheless, I was wondering if the previous version 41 is available anywhere for download, so I can revert to the previous firmware and check if the problem remains.

    PS: Although the router is running samba (installed with optware), transmission and rssdler most of the time, I've confirmed the issue without them running, or even with no costum init script at all.
  92. Toastman

    Toastman Super Moderator Staff Member Member

    You may find the version you want here: . However, the QOS on 42 appears to work fine here, I just tested it.

    As there is no clear indicator of incoming bandwidth, it is not so easy to tell if an incoming limit is being applied. Remember that incoming limits work by counting total traffic for that class. In the case of P2P which is opening and closing connections all the time, often leaving connections improperly terminated, many incoming connections are "legacy" connections that are no longer part of any transfer. They are therefore no longer part of any current connection, and are not counted in any class. Therefore, connections that originated from P2P can generate incoming traffic that is not actually counted as P2P - and thus - the limit does not work as intended. You may see a lot of them in the "unclassified" display.

    That is why an overall limit is recommended, to be set at some level below the maximum. Try setting the incoming maximum bandwidth to say, 66%, and see what happens.
  93. xppx99

    xppx99 Addicted to LI Member

    Thanks for the reply Toastman. I know for sure that the incoming limit of the "lowest" class is not being applied (sometimes).

    I'm doing this procedure for testing:
    1- Reboot the router;
    2- only 1 PC connected, running utorrent, with a single torrent that can easely max out the total bandwith in few seconds (powerful seeders).
    3- Start torrent. When the limit is not applied, the transfer speed rapidally increases to 1,1MB/s (maximum of my conection). When the limit is indeed applied, transfer speed remains steady at 830-850KB/s.

    I've also tried with 50% of the total bandwidth, (just to be sure), and the result corroborates the mentioned problem. The problem seams to appear randomly with router reboots. Sometimes it works fine, sometimes don't.

    If you are not experiencing this problem, I can only assume that the problem may be related to some of my configs. But anyway, I'll continue to try different configs until I find whats triggering the problem (hopefully..). I've also re-flashed the router, followed (and pre-followed) by a thorough nvram reset, with no luck.

    I just posted this problem here in order to know if the masters :cool: (teddy_bear and ray123) have some "special" console command to check if the rules are indeed being assumed by the router.
  94. paulvb

    paulvb Addicted to LI Member

    sftp/scp access

    Awesome! scp should work fine. I saw sftp in the wiki and didn't even try scp. Many thanks.
  95. kilian2050

    kilian2050 Addicted to LI Member

    Tomato Web Server for photo gallery


    I have an Asus Wl-500g Premium running tomato-1.27-NDUSB-8742-vpn3.4.rar with an USB hard drive connected.

    Now I'd like to share all my photos located on the USB hard drive to my friends over the web using a php photo gallery web site. How can I do this?

    I already tried to install ogg php photo gallery, but it seems php is missing...
    It also seems that httpd that comes with tomato doesn't support httpd.conf files...
  96. Engineer

    Engineer Network Guru Member

    Could there be a memory leak in version 42? My free memory has went from 24% to 6% in the last 8 days. I've run version 25 since it came out and don't remember memory dropping like this. As far as I can remember, I ran version 25 for nearly 6 months with little to no drop in amount of free ram. I did a full NVRAM erase after install.

    No settings different that I know of. Anything to look for? The reason I ask is I noticed that things are slowing down so I decided to look at the logs and noticed the low memory %.

    Edit: Just logged back on and it dropped another .5% down to 5.5%. Hmmmm?

  97. teddy_bear

    teddy_bear Network Guru Member

    The low amount of free memory is not a problem by itself, as long as there's at least some free memory. In fact, free memory is wasted memory - if you have a lot of it, it means kernel doesn't fully utilizes the resources available. But applications should be able to get more memory when it's needed, and kernel will redistribute it on demand from buffers and cache.

    Builds 35 and above use newer kernel (2.4.37), and supposedly work with memory more efficiently. I see the similar behavior with kernel 2.6 builds - on RT-N16 which has 128MB of RAM, the free memory could drop down to 3-5MB after large file transfers, for example, but everything's working fine.

    Check "cat /proc/meminfo" output - the total amount of "available" memory (buffers + cached memory +free memory) should stay about the same (may drop during some activities, but should come back on). However, if the amount of total available memory constantly drops over time - then we might indeed have a leak.
  98. Engineer

    Engineer Network Guru Member

    Thanks TB. Will check that out and report when I get a chance.

    Edit: I had already went back to version 25 but I saved configurations for the version 42 (I do for all of my updates) and it took a few minutes to go back to version 42. I took a screenshot of the "cat /proc/meminfo" command from the Telnet window and dated it for today when I saved it. I will do so every so often and compare.
  99. kilian2050

    kilian2050 Addicted to LI Member

    php http server

    Is there any chance to install php supported http server in tomato? I tried ipkg, but it seems to be missing?
  100. teddy_bear

    teddy_bear Network Guru Member

    Follow links from the 1st post to install Optware ipkg. Once Optware is installed, you can use ipkg to install additional software, including http server with php support.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice