1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Where in the source?

Discussion in 'Tomato Firmware' started by EthanHam, Mar 9, 2010.

  1. EthanHam

    EthanHam Addicted to LI Member

    Hi folks,

    I'm working on a project where I need the router to modify incoming html. It's for an artwork, so the solution does not need to be particularly elegant or efficient. I've considered using a proxy server, but I'd really like to keep the functionality in the router.

    I've downloaded and compiled the Tomato source and have been browsing through the source code. The problem I'm having is figuring out where to put in my modification. The source isn't very well documented, I'm not particularly well-versed in network programming, and it feels like looking for a needle in a haystack.

    Currently I'm thinking that webio.c is the file I need to muck with. It has some code in which it identifies and writes out HTML. However, I'm suspecting that this is actually just part of the webserver that the router uses to display the admin web pages (and has nothing to do with data passing through the router).

    My other thought is that perhaps firewall.c is where I want to be working... but I don't see any obvious place in that file to do what I need to do.

    Once my router arrives (today), these are the areas where I'm going to experiment... Not really sure how I'm going to debug this--I guess having info written out to log file is the only way to have an idea of what is going on.

    Thanks for any advice!
  2. EthanHam

    EthanHam Addicted to LI Member

    Oh, and it has occurred to me that someone who knows what they're doing might be able to achieve the desired result via a startup script. I'm taking the more brute-force approach because I'm simply much more comfortable working in C code than scripting.

    If someone knows how to do the script, I'd be happy to compensate for their time. It wouldn't be a huge amount of money, but would be reasonably worthwhile for an hour's worth of work.
  3. mstombs

    mstombs Network Guru Member

    A router just routes packets, I think you want a proxy server which fetches whole web pages on your behalf, and just use the router to intercept and re-direct all web requests.

    For an example of what can be done see


    There's a thread here somewhere of how to do the divert in Tomato.
  4. EthanHam

    EthanHam Addicted to LI Member

    Thanks for the tips! I'll investigate using a proxy server.

Share This Page