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

pixelserv compiled to run on router WRT54G

Discussion in 'Tomato Firmware' started by Jedis, Sep 5, 2009.

  1. HunterZ

    HunterZ LI Guru Member

    What toolchain can be used to compile the h0tw1r3 version? I get weird errors trying to use Shibby's branch of the Tomato firmware toolchain:
    $ make
    mipsel-uclibc-gcc -mips32 -Os -s -Wall -ffunction-sections -fdata-sections -fno-strict-aliasing -Wl,--gc-sections -DDO_COUNT -DTEXT_REPLY -DREAD_FILE -DREAD_GIF -DNULLSERV_REPLIES -DSSL_RESP pixelserv.c -o dist/pixelserv.mips32
    pixelserv.c: In function `main':
    pixelserv.c:615: `AI_ADDRCONFIG' undeclared (first use in this function)
    pixelserv.c:615: (Each undeclared identifier is reported only once
    pixelserv.c:615: for each function it appears in.)
    make: *** [mips] Error 1
    Edit: Happens with the official version too.

    Edit 2: Looks like I screwed up and was probably using the trunk toolchain, which is ancient.
    Last edited: Apr 22, 2014
  2. koitsu

    koitsu Network Guru Member

    Ensure the .c file has the following lines in it:

    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netdb.h>
    If it contains these (edit: it looks like it does), then the Makefile or related bits are not referring to the proper location (specifically -I include base directory) for where these are located. Cross-compiling is a complex/different situation than native compiling, but my guess from reviewing the Makefile is that missing -I arguments for relevant kernel include file paths. Here's an example (from some of the TomatoUSB source, albeit Toastman's branch) -- and a big example but I digress -- of included crap in the firmware and how use of CPPFLAGS and CFLAGS often require -I arguments to include what's relevant (see targets miniupnpd, and especially flac/stamp-h1). TL;DR -- I think the author of that stuff on github needs to provide much more accurate/thorough documentation of how to get his stuff to build. Building stuff for TomatoUSB is never easy.

    AI_ADDRCONFIG and its functionality is discussed as part of getaddrinfo(3). I'm not sure if this functionality is available in Linux 2.6.22 (I'd need to git clone the tomato source and grep through it all).
    Last edited: Apr 20, 2014
  3. HunterZ

    HunterZ LI Guru Member

    For what it's worth, I grep'd the Tomato toolchain I was trying to use and didn't find AI_ADDRCONFIG in any .h files.

    Sent from my Nexus 7 using Tapatalk
  4. koitsu

    koitsu Network Guru Member

    Took the time to git clone and all that jazz.

    Toastman-RT-N branch contains uClibc (the libc that's used on Tomato) which does in fact support and define AI_ADDRCONFIG, for both 2.4 and 2.6 kernels:

    2.4: http://repo.or.cz/w/tomato.git/blob.../hndtools-mipsel-uclibc-4.2.4/include/netdb.h
    2.6: http://repo.or.cz/w/tomato.git/blob.../hndtools-mipsel-uclibc-4.2.4/include/netdb.h

    This is the file which should be included when using #include <netdb.h>

    And support for this is indeed included in uClibc from review of the configuration portion:

    2.4: http://repo.or.cz/w/tomato.git/blob...sel-uclibc-4.2.4/include/bits/uClibc_config.h
    2.6: http://repo.or.cz/w/tomato.git/blob...sel-uclibc-4.2.4/include/bits/uClibc_config.h

    If the branch you checked out had none of this, then therein lies the problem. But if you're using, say, Toastman-RT-N, and the problem happens, then the issue relates to incorrect include paths being passed to gcc as my previous post explained; the issue happens during compile-time, not link-time. I only follow Toastman-RT-N; I respectfully can't be bothered to try and track all the changes everyone else is doing all the time.

    Based on a quick skim of the pixelserv code linked in question, the use of AI_ADDRCONFIG appears to be important.
  5. mstombs

    mstombs Network Guru Member

    So there is a problem either Shibby or Entware toolchain? h0tw1r3 pixelserv Compiles fine on Ubuntu or with old tomatousb toolchain - but there is a code bug ifname not null strung defined, so you must specify "-n lo" or similar to be able to use, also the tiny build option is broken, still haven't looked at DECODE_URL in operation!
  6. HunterZ

    HunterZ LI Guru Member

    There may be a problem with Shibby, yeah. I was just able to compile h0tw1r3's mips-flavored pixelserv with Toastman-RT-N just like koitsu, so I guess I'll stick with that toolchain?

    Not to get too off-topic, but I searched the entire Internet yesterday looking for some discussion on which branch was the best to use for a Tomato cross-compiler toolchain and came up empty and frustrated. I had semi-randomly picked Shibby's tomato-shibby-RT-AC branch because it was one of the most recently updated, and I guess it didn't pay off.

    Edit: Build seems to run fine on my RT-N66U (K26 mipsR2 running Toastman Tomato).

    Also noticed that h0tw1r3 provides occasional binary releases (doh): https://github.com/h0tw1r3/pixelserv/releases
    Last edited: Apr 21, 2014
  7. jerrm

    jerrm Network Guru Member

    Just grabbed the zip from h0tw1r3's git, got a fresh new copy of Shibby's RT-AC branch, and the mips version builds and (appears to) run fine for me.

    Just to be sure - you realize the Shibby chain is compiled for a 64bit OS?
  8. HunterZ

    HunterZ LI Guru Member

    I'm on 64 bit actually. Maybe I screwed up the git clone/checkout somehow.

    Edit: Yeah, I'm pretty sure I ended up with the a base Tomato 1.28 checkout instead of Shibby's. Oh well.
    Last edited: Apr 21, 2014
  9. superdos

    superdos Networkin' Nut Member

    I've compiled h0tw1r3's version of pixelserv for Asus RT-AC68U.
    If anyone interested I use the toolchain included in the Asus Firmware source (hndtools-arm-linux-2.6.36-uclibc-4.5.3).

    Attached Files:

    WaLLy3K likes this.
  10. koitsu

    koitsu Network Guru Member

    Folks should be very careful using this for the following reasons. Note that when I say "TomatoUSB" I am referring to Toastman-RT-N branch (others may differ, but I think the kernel and uClibc are identical across Toastman, Shibby, and Victek):

    - Architecture differences -- be very aware that this binary is for the RT-AC68U. It may not work on other models of routers given SoC differences.

    - TomatoUSB uses Linux 2.6.22, while Asus uses Linux 2.6.36. It's very possible that some part of the socket implementation or layer changed across all those minor versions.

    - TomatoUSB uses uClibc 0.9.30 with some patches (it's labelled "" -- don't confuse this with, while Asus uses (I have no idea). uClibc is probably the most key/critical part to this picture (if something was to break I'd expect it to be here more so than the kernel).

    - A statically-linked binary would not necessarily rectify issues encountered with either of these items.

    It's always best to provide binaries built for the specific router and firmware you're using. Kudos to you for building a binary that works for you on that specific firmware / with that specific toolchain, but that may not work correctly for others using TomatoUSB.
  11. mstombs

    mstombs Network Guru Member

    I'd always recommend using the same toolchain as used for the firmware, so library links and kernel hooks are correct. I suspect the Victek/Shibby Tomatousb ARM ports do use the Asus toolchain and same kernel version with Broadcom binary modules at the moment.

    Linux binaries can be surprisingly portable - with mipsel dynamic linked binaries working between Broadcom K2.6 routers and Ti AR7 K2.4 adsl router firmwares in my experience - but I found earlier in this thread that pixelserv built using tomatousb toolchain did not work on stock tomato K2.4 firmwares, a failure to run due to missing/changed library link, rather than obscure occasional run-time error which is always possible when mixing/matching.

    I assume things are better forward compatible so pixelserv with older Toastman toolchain will work fine with newer Shibby toolchain, but I have to admit haven't looked in detail at Shibby/Entware compilers. I did have my own built toolchain with a timezone patch at one time. In a different field I see some Android mods claim better performance with newer gcc/ Linaro compilers and optimizations, and its not unusual to see different compiler used for kernel and userspace, but all quite risky to try.
  12. lancethepants

    lancethepants Network Guru Member

    I believe Tomato and Asus both use the same kernel in both instances of architectures, as is necessary for the binary blob drivers

    mipsel -> (MIPSR2)
    arm ->

    uclibc is not necessarily backwards compatible with previous versions, in fact they may be very incompatible (so statically compile)

    I would safely say it is fine to use another toolchain, so long as it was also built against the same kernel version and architecture as the firmware you run, and you statically compile (unless you want to setup a whole entware-like environment). Maybe not in all cases, but I would say most the time.
    One good example of this is entware. Totally different, more up-to-date toolchain. I actually think the toolchain that entware uses is superior to tomato's. It manages to work across a plethora of routers with various firmwares.

    It's surprising how some non-static binaries still tend to work on systems built with different toolchains. For example, many of the early non-static binaries I compiled would work fine on dd-wrt systems, using the libraries from their firmware. Some would horribly break though too :)
    Last edited: Apr 22, 2014
    koitsu likes this.
  13. darkknight93

    darkknight93 Networkin' Nut Member

    This is what adblocking Looks in Sophos UTM (different router distro for x86 - free!)

    You can unblock via "Unblock" and page will load automatically

    Administration is quite easy due you only Switch on filtering for ads - lists are updated by Sophos Team itself adblock.jpg
  14. mstombs

    mstombs Network Guru Member

    Is Sophos UTM GNU/Linux based so has GPL available? A splash page on blocked domains is actually opposite to what pixelserv aims to do!
  15. darkknight93

    darkknight93 Networkin' Nut Member

    Sophos utm is based on open suse enterprise server. The sophos part itself is closed firmware due it not only offers proxy but also routing and WiFi protection..

    Well I find splash pages okay due I sometimes need to bypass filtering. But you can edit this splash screen :)
  16. piotrpiano

    piotrpiano Serious Server Member

    Guys, could some of you please post a compiled version (for Asus RT-N66U Shibby 121) of pixelserv v35 or point me to one?
  17. HunterZ

    HunterZ LI Guru Member

    Where's the source for v35? I think I have a Tomato cross-compiler toolchain installed on my Linux box.
  18. roadkill

    roadkill Super Moderator Staff Member Member

    I think RT-N66U is ARM based you'll need the ARM toolchain, perhaps we should include this solution built in?
  19. HunterZ

    HunterZ LI Guru Member

    No, the RT-N66U is MIPS and is supported by Tomato. I know because I have one running Toastman right now (as well as an RT-N16 running the same, and a WRT54G running OpenWRT).

    I just need to know where the latest pixelserv source is (I don't see a v35 anywhere) and I will try to build it.
  20. roadkill

    roadkill Super Moderator Staff Member Member

    perhaps I was mistaken.. again don't you think it would be a better solution if it was built in?
    .. I think i'll have a go with it as this is really nice add on ;)
  21. HunterZ

    HunterZ LI Guru Member

    Huh? To a firmware? Sure, that would make me happy, but I'm not a firmware hacker.
  22. roadkill

    roadkill Super Moderator Staff Member Member

    well I can do it.. can you point me to a pixelserv source code?
  23. HunterZ

    HunterZ LI Guru Member

    That's what I had already said in post #317 :p
  24. roadkill

    roadkill Super Moderator Staff Member Member

  25. HunterZ

    HunterZ LI Guru Member

  26. M0g13r

    M0g13r LI Guru Member

  27. HunterZ

    HunterZ LI Guru Member

  28. M0g13r

    M0g13r LI Guru Member

  29. HunterZ

    HunterZ LI Guru Member

    Just diff'd the two versions and there are substantial differences:

    The hotwire version appears to have these unique features:
    • A potentially smaller null JPG (JPEG image) response (mstombs appears to have a bunch of 0xff bytes in the middle, along with other differences).
    • Some code that appears to detect advertisement redirects and divert the browser (via HTTP "temporary redirect" code 307) to the intended destination instead of just serving up a blank page (this looks like a great idea to me!).

    The mstombs version appears to have these unique features:
    • A smaller null SWF (adobe flash) response.
    • The ability to disable dropping of root privileges (at compile time; useful for running on routers where root is the only user account), and no longer dies if the attempt fails (this behavior probably ought to be a compile time flag).
    • Some restructuring of the code to allow some features to be disabled at compile time.
    • Ability to run in "portless" mode, although I'm completely confused as to what this actually does since it still ends up calling getaddrinfo() with 80 as the port number.

    I'm tempted to try merging them together, but the differences are so numerous that I'd probably just make even more of a mess.

    Apparently they're two distinct forks that have been cross-pollinating. It would be nice if they could agree on a common codebase with #ifdefs around each piece of functionality that only one of them cares about.
  30. piotrpiano

    piotrpiano Serious Server Member

    Sorry I didn't point to the source before but I assumed most pixelserv users were aware of and using mstombs's v35... It's on page 3 post #288.
  31. mstombs

    mstombs Network Guru Member

    I think this just disables the ability to change the port Nos (Tiny size). There was an option without ports for the dd-wrt inetd version, but wasn't kept updated when selective responses added, and was supposed to be removed. Nullserv works in inetd mode.

    Does Shibby 121 mips need a different toolchain than 120?
    Last edited: Aug 24, 2014
  32. HunterZ

    HunterZ LI Guru Member

    Attempting a merge just for the heck of it. May not get a chance to complete it. Also, meld is an amazing merge tool.

    Also noticed that some linger stuff is hanging around in hotwire but disappeared from mstombs, despite being in the latter's changelog and earlier in this thread. I guess it's OBE?

    Edit: Use of IFNAMSIZ appears to be removed too, but the dependent header include is still in place.
  33. mstombs

    mstombs Network Guru Member

    good luck, sure it would be easier to update the h0tw1r3 version with the different jpg,swf (if needed), the DECODE_URL and redirection would be good to get working.

    linger was an issue, but never seemed to have a good effect and someone reported it broke compilation on non-linux

  34. HunterZ

    HunterZ LI Guru Member

    Barring a compatibility issue, I would think the hotwire JPG data would be more desirable, given that it is 29 bytes smaller?

    The merge isn't going too bad so far. I'm assuming that most of the other quibbles (like ports being int versus string, AF_UNSPEC versus AF_INET, and AI_ADDRCONFIG versus not) are due to hotwire not keeping up with mstombs on various tweaks (a la linger).

    I'm planning to remove (or at least greatly reduce the use of) the MULTIPORT define in favor of just having PORT_MODE fully support monitoring 1...n ports, because it seems like overkill to support single-port monitoring as an explicit architectural case (especially when everything is controllable via command line parameters.

    I'm also planning to not #ifdef the redirection because I'm lazy. People who obsess about file sizes may want to be able to compile it out, though.


    Changed my mind on MULTIPORT and basically left it alone.

    Finished my first cut at a merge. Need to try building and testing and then I may check it into a fork of hotwire's repo and post a binary here.

    Update 2:

    Got it building for both AMD64 and MIPS. Tried testing the redirect stuff on AMD64 and it segfaulted due to a bug. I found a hack that seems to work, but I've filed an issue report on the hotwire repo in hopes of an official fix.

    I have to go to bed now, so I'll have to mess with it more tomorrow or whatever.

    I may also #ifdef the redirect stuff after all, as it's not small and is possibly buggy.
    Last edited: Aug 25, 2014
  35. roadkill

    roadkill Super Moderator Staff Member Member

    guys I still want the source code if anyone knows where the source code is located please send a link
  36. mstombs

    mstombs Network Guru Member

    The whole history of the c-code pixelserv is in this thread with my latest V35 as an attachment to this post


    Its only a single C-file with a compile script, with lots of options as 'features were added', can't guarantee all options possible.

    As an attachment its only available to registered users here, and the code is not in repository so h0tw1r3 started a publically tracked github version, which now has a Makefile and extra features

  37. mstombs

    mstombs Network Guru Member

    The smaller one failed my testing with an error message in Firefox:- its this one


    But to be honest I am still unsure if jpg really needed because most browsers seem to accept a properly announced gif as an image. nullserv author introduced selective replies flexiondotorg seems to have dropped his project now, was also on github

    Last edited: Sep 1, 2014
  38. HunterZ

    HunterZ LI Guru Member

    Looks like the nullserv author took down his old launchpad repo too.

    You're right about the JPEG - Firefox, MSIE and Windows Photo Viewer all report problems trying to parse it. I'll revert the code in my merge to use the mstombs version when I get a chance.

    mstombs: Are there any objections to me checking my merged version into github as a fork of hotwire's project when I'm ready? His version is licensed as GPL, but I don't recall whether your version comes with a license.
  39. mstombs

    mstombs Network Guru Member

    No probs free source no warranty no licence IANAL.
    Out of courtesy I did originally make contact with the author of Beejs guide and the original perl pixelserv etc.
  40. HunterZ

    HunterZ LI Guru Member

    Haven't had much of a chance to test yet, but my merges are pushed to a fork of h0tw1r3: https://github.com/HunterZ/pixelserv

    I highly suggest that anyone wanting to view the changes use Meld with ignore whitespace enabled. Among other things, mstombs uses tab indentation while h0tw1r3 uses two-space indentation (I chose the latter).

    This is really close to mstombs V35 with h0tw1r3's redirect feature merged in, as:
    • I restrained myself from making too many extra tweaks of my own (mostly I just added comments).
    • Most of the other differences between h0tw1r3 and mstombs appear to be due to the former not keeping up with changes in the latter after conceptually forking off.
    • I even went ahead and added #ifdef REDIRECT around all of the redirect changes so that you can choose whether to build it in by adding -DREDIRECT to your GCC options (in build.sh).

    I also attempted to fix a bug in the redirect code that was causing segfaults. Hopefully I did it the right way; it seems to work but I haven't tested very thoroughly.
  41. AndreDVJ

    AndreDVJ Addicted to LI Member

    I compiled directly from the router and running it. So far it's working fine, blocking ads as intended. I will report issues if I spot any, though very unlikely I see one to be honest.

    pixelserv[2851]: /mnt/storage/adblock/pixelserv version: V35.HZ1 compiled: Aug 26 2014 17:51:24 from pixelserv.c
  42. HunterZ

    HunterZ LI Guru Member


    Did you try building it with -DREDIRECT and then running it with the 'r' parameter?

    That should allow you to do things like click on sponsored links in google search results (assuming that doesn't work for you currently), as pixelserv will decode the ultimate destination address and redirect your browser to it.
  43. AndreDVJ

    AndreDVJ Addicted to LI Member

    I will definitely try. Yeah sponsored links does not work when I click on them since ever. Thanks!
  44. AndreDVJ

    AndreDVJ Addicted to LI Member

    The compiled binary took the -DREDIRECT parameter. Checking what options it can take, -r appears to use

    The build script:
    mkdir dist
    # use Linksys Tomato toolchain (or teddy_bear tomatousb K26, Tornado dd-wrt)
    export PATH=/opt/tomatoware/:$PATH
    CFLAGS="-Os -s -Wall -ffunction-sections -fdata-sections"
    STRIP="strip -s -R .note -R .comment -R .gnu.version -R .gnu.version_r"
    # -DIF_MODE "-i br0" responsible for failures when gui changes made
    # -DVERBOSE"
    ls -laF $BIN
    root@WNR3500L:/tmp/mnt/storage/adblock# ./pixelserv
    pixelserv[16401]: ./pixelserv version: V35.HZ1 compiled: Aug 26 2014 22:10:41 from pixelserv.c
    root@WNR3500L:/tmp/mnt/storage/adblock# ./pixelserv --help
    Usage:./pixelserv [IP No/hostname (all)] [-p port (80) & (443)] [-n i/f (all)] [-u user ("nobody")] [-r redirect encoded path (tracker links)]
    However, looks like I didn't had much success passing -r parameter. The blocked sponsored links are still getting blocked.

    In the script we have this:
    I tried passing to that variable both r and -r, tried uppercase R and -R with and without the quotes and didn't had success on getting it work.
    root@WNR3500L:/tmp/mnt/storage/adblock# ps | grep pixelserv
    16789 nobody  868 S  /mnt/storage/adblock/pixelserv
    How yours look like? I look stupid, getting compiled which is supposed to be much harder I did but I can't pass a simple parameter on the command :(
  45. HunterZ

    HunterZ LI Guru Member

    It's possible that it just doesn't work. I really haven't had time to test it yet. I only ran it on a Linux box for a bit, and not on my router yet. I hope to try in a couple hours.
  46. HunterZ

    HunterZ LI Guru Member

    It's working for me. I searched "home depot" on google and clicked in the sponsored link, and it took me to the site. With an older pixelserv this does not work.

    build.sh options (note -DREDIRECT):
    Run info (note that -r is listed):
    root@intertron:/cifs1/adblock# ./pixelserv
    pixelserv[30417]: ./pixelserv version: V35.HZ1 compiled: Aug 26 2014 21:44:01 from pixelserv.c
    root@intertron:/cifs1/adblock# ./pixelserv --help
    Usage:./pixelserv [IP No/hostname (all)] [-p port (80) & (443)] [-n i/f (all)] [-u user ("nobody")] [-r redirect encoded path (tracker links)]
    Adblock config option:
    ps dump (note the -r):
    root@intertron:/cifs1/adblock# ps w | grep pixelserv
    30341 nobody  736 S  ./pixelserv -r
    What does the line look like in your adblock.sh that launches pixelserv? Mine looks like this:
    "$prefix/pixelserv" $redirip $PIXEL_OPTS
    I've attached my build and source in case anyone else wants to test without having to build.

    Attached Files:

    Goggy likes this.
  47. M0g13r

    M0g13r LI Guru Member

    thx HunterZ

    runs like expected

    Aug 27 10:27:02 R0ut3r daemon.info pixelserv[14334]: 52 req, 15 err, 0 gif, 0 bad, 32 txt, 0 jpg, 0 png, 0 swf, 3 ssl, 2 rdr
  48. mstombs

    mstombs Network Guru Member

    Nicely done HunterZ, I'm now running your version with redirects. I find redirects in google search results do now work (don't block), but not the examples in http://www.linksysinfo.org/index.ph...run-on-router-wrt54g.30509/page-3#post-243747 so I am still not sure exactly what the code does - must look at comms with wireshark sometime, and also make sure the url parsing is robust, no buffer overflow exploits etc - I suspect I did previously see the segfault you have now fixed.
    Last edited: Aug 27, 2014
  49. HunterZ

    HunterZ LI Guru Member

    Thanks for pointing out the additional test case. It should be possible to add logging to see what it's doing. I might play with it this evening if I have time.

    I noticed that the post you linked suggests a change that isn't in my merge. I may also test putting that in my fork.
  50. AndreDVJ

    AndreDVJ Addicted to LI Member

    Mine looks like this at startserver() function:
    $pixelbin" $redirip $PIXEL_OPTS
    That's straight from the source: http://pastebin.com/raw.php?i=xMiGfbyE

    I tried your binary and no luck as well. Maybe there's some issue with the script. Where did you get yours?

    root@WNR3500L:/tmp/mnt/storage/adblock# ./pixelserv
    pixelserv[31203]: ./pixelserv version: V35.HZ1 compiled: Aug 26 2014 21:44:01 from pixelserv.c
    root@WNR3500L:/tmp/mnt/storage/adblock# ps | grep pixelserv
    31129 nobody  632 S  /mnt/storage/adblock/pixelserv
    31207 root  2360 S  grep pixelserv
    root@WNR3500L:/tmp/mnt/storage/adblock# ./pixelserv --help
    Usage:./pixelserv [IP No/hostname (all)] [-p port (80) & (443)] [-n i/f (all)] [-u user ("nobody")] [-r redirect encoded path (tracker links)]

    I ran the script with the debug parameter and found that the script wasn't taking whatever text you store in the variable:
    So I added -r directly on the line which calls pixelserv
    "$pixelbin" $redirip -r
    And now it's working:
    root@WNR3500L:/tmp/mnt/storage/adblock# ps | grep pixelserv
      936 nobody  632 S  /mnt/storage/adblock/pixelserv -r
    The issue in the script is something I will look at later to see if I figure out what's wrong.

    For the redirection functionality, well... One or another website is working (Two of the ads previously blocked now Works). The majority are redirected to "http://www.googleadservices.com/pagead/http" and stays there.

    I'll try to play more with that in the next hours.
    Last edited: Aug 27, 2014
  51. mstombs

    mstombs Network Guru Member

  52. HunterZ

    HunterZ LI Guru Member

    My script is probably based on an old version by now, and I've hacked it up a bit here and there.

    Update: hammer's suggested code change doesn't fix his listed test cases for me.

    Update 2: Crap, looks like the bug I supposedly found in the redirect code was me screwing up the merge, and it's what's causing hammer's test cases to fail for me. I don't have time to fix it tonight, so it will have to wait until tomorrow.
    Last edited: Aug 28, 2014
  53. piotrpiano

    piotrpiano Serious Server Member

    Thanks for that! Appreciate it :)
  54. HunterZ

    HunterZ LI Guru Member

    No problem. I hope to get a less glitchy version out tonight (~10 hours).
  55. HunterZ

    HunterZ LI Guru Member

    Update: Got it sorted. Also added hammer's suggested change (his test cases now work), a small optimization, and a memory leak fix.

    I've been pushing my code changes to a Github fork of the hotwire version, but here is an attached zip of the code and binary as well.

    Attached Files:

    jerrm and Goggy like this.
  56. jerrm

    jerrm Network Guru Member

    Looks great!

    While your in there, it would be nice to get stats without tail/grepping syslog. I was considering a special url that would return them.
  57. mstombs

    mstombs Network Guru Member

    @jerm good idea - do you have a suggestion for a URL that nothing else would uses? Could also have a csv file option for use by script or an html page for direct to browser?

    Also -it seems we need an "favicon.ico" response, in a little bit of testing I have done recently, browsers, Chrome in particular keep asking for one (so is not satisfied by the null text). I'm not sure what the minimum universally accepted one is, this is the smallest I have found on the net, a red dot which might get expanded to 16x16 with correct response:-

  58. jerrm

    jerrm Network Guru Member

    I don't think it needs to be anything too obscure. I was thinking along the lines of something simple like /servstats or similar. I guess there could be .txt, .html, .csv variations. If you wanted to protect against potential conflicts, or a site testing pixelserv using the url, a command line parameter could be added to change it to whatever the user wants.

    Output from the command line would be great, but that would require adding code for pixelserv to talk to the running version, and I would err on the side of keeping the executable lean when netcat and wget are commonly available.
  59. HunterZ

    HunterZ LI Guru Member

    I think I can probably add .ico response and stats report URL features over the next couple of days, including configurable stats URL. Should the stats URL be specifiable on the command line, or baked into the compile?
  60. mstombs

    mstombs Network Guru Member

    I don't think you would need more code inside pixelserv for a command line query, you would need another exe in the current userspace open a channel to the daemon process - just parse the response to the url query - a variant of this which is the example client that this pixelserv.c was the server:-

  61. jerrm

    jerrm Network Guru Member

    You mean a build options define for the feature or a command line parameter for the executable?

    As for build options, no real preference. I'm of the opinion that an executable of 12K vs 13K shouldn't really matter in 2014. I would just do it and not make it a build option. Obviously this threshold changes over time, I can remember trying to save every last possible bit.

    For the executable, I'd consider an enable/disable parameter and/or an option to change the url, but sort of doubt anyone would really care.
  62. jerrm

    jerrm Network Guru Member

    Which is why wget or netcat is perfectly viable in my opinion. We don't need a pixelserv "suite."

    A "pixelserv --stats" would be nice, but then do you worry about multiple instances, do you do "pixelserv ip: port --stats" or try and find all running instances and report back on all of them? Not rocket science questions I admit.

    It's not that adding the client code to pixelserv would be all that complicated, but wget will do just fine.
  63. HunterZ

    HunterZ LI Guru Member

    I meant to specify the URL for which the stats response should be generated.
  64. HunterZ

    HunterZ LI Guru Member

    .ico response added and successfully tested, new version attached.

    Will work the stats response next. I'm assuming people are just looking for the data normally generated by SIGUSR1? I will probably move generation of that info to a separate function that can be called by either the signal handler (where it's currently used) or the stats response logic.

    Attached Files:

    Goggy likes this.
  65. mstombs

    mstombs Network Guru Member

    thanks, already in use here!

    I know how to turn the favicon black or white (red square not often seen), by toggling some bits in the definition - but can't make it transparent or appear in Internet explorer, but just having one should reduce traffic.

    I still don't have 100% success with redirects from google search results, I think it is due to multiple redirects in the url, but I have no idea how to fix

    I think you can add an extra comma in here!

    Aug 30 02:29:59 rtn66u daemon.info pixelserv[2154]: /mnt/usb4gb/pixelserv version: V35.HZ3 compiled: Aug 29 2014 17:07:39 from pixelserv.c
    Aug 30 02:51:53 rtn66u daemon.info pixelserv[2156]: 35 req, 1 err, 4 gif, 0 bad, 9 txt, 0 jpg, 0 png, 0 swf 14 ico, 2 ssl, 5 rdr
  66. HunterZ

    HunterZ LI Guru Member

    Yeah I caught the missing comma while moving the code to a separate function in support of the stats reply feature. The fix will be in the next release, along with the stats reply feature, which I'm currently working on.
  67. jerrm

    jerrm Network Guru Member

    Running it here too. Working well.

    As mstombs said, there are a few google ad links that won't flow all the way through to the target, but it is a chain of redirections and the ultimate target is not encoded in the subsequent urls, so I don't think there is anything to be done.

    In any event the redirection works better than it ever has before.

    Great job.
  68. HunterZ

    HunterZ LI Guru Member

    Yeah, I believe the hotwire redirect code just finds the last 'http=' or 'https=' string on the decoded URL and (provided it isn't a loop back to the current base URL) generates an HTTP redirect response to send the browser to the decoded URL.

    If someone can capture a chain of redirections it may be possible to get a little further, but it's likely to be a complex problem.
  69. HunterZ

    HunterZ LI Guru Member

    Update: Stats response implemented! Default relative path from pixelserv IP is /servstats (e.g., but this can be overridden with the -s parameter (e.g. pixelserv -r -s /test).

    Note that you do not need to specify -s for the feature to be enabled, as it is baked in at compile time if the STATS_REPLY macro is defined.

    Other code tweaks:
    • Fixed the missing comma in the stats output that I accidentally introduced in my last release.
    • Modified -r (redirect) argument handling logic to make more sense (the way hotwire did it looked dicey to me). It also sets a precedent for adding more arguments that don't take an additional parameter (e.g. "-x" versus "-x foo"). This should have no noticeable effect for end users.
    • Command line help text now shows actual baked-in defaults for port(s) and stats response URL. I should probably do it for other stuff, but I'm lazy... This will also have no noticeable effect for end users of binaries built with the default baked-in settings.

    UPDATE: I screwed up the stats HTML output in HZ4, so I've fixed it in HZ5 (attached). Failure messages generated by send() are also now sent to the syslog, as I noticed that my error count was nonzero now that I'm actually looking at stats; I wonder what errors it will turn up?

    Attached Files:

    Last edited: Aug 30, 2014
    Goggy likes this.
  70. jerrm

    jerrm Network Guru Member

    Looks like the response is getting truncated? Content-length is 177, but only 159 bytes sent.

    Using busybox wget on the router I get this output:
    oot@RTN66U:/opt/bin# /usr/bin/wget -O -
    Connecting to (
    43 req, 0 err, 0 gif, 0 bad, 13 txt, 0 jpg, 0 png, 0 swf, 0 ico, 0 ssl, 30 sta, 0 rdr<!DOCTYPE html><html><head><title>nullserv statistics</title></head><body>

    Using entware wget on the router I get this output and it gets stuck in a retry loop:
    root@RTN66U:/opt/bin# wget -S -O -
    --2014-08-30 02:43:37--
    Connecting to connected.
    HTTP request sent, awaiting response...
      HTTP/1.1 200 OK
      Content-type: text/html
      Content-length: 177
      Connection: close
    Length: 177 [text/html]
    Saving to: 'STDOUT'
    0% [  ] 0  --.-K/s  589% [======================================================================================================================================>  ] 159  --.-K/s  in 0s
    2014-08-30 02:43:37 (1.47 MB/s) - Connection closed at byte 159. Retrying.
    --2014-08-30 02:43:38--  (try: 2)
    Connecting to connected.
    HTTP request sent, awaiting response...
      HTTP/1.1 200 OK
      Content-type: text/html
      Content-length: 177
      Connection: close
    Length: 177 [text/html]
    Saving to: 'STDOUT'
    89% [======================================================================================================================================>  ] 159  --.-K/s  in 0s
    2014-08-30 02:43:38 (533 KB/s) - Connection closed at byte 159. Retrying.
    wget on Ubuntu gives:
    ry@ubuntu:~$ wget -S -O -
    --2014-08-30 02:55:45--
    Connecting to connected.
    HTTP request sent, awaiting response...
      HTTP/1.1 200 OK
      Content-type: text/html
      Content-length: 177
      Connection: close
    Length: 177 [text/html]
    Saving to: ‘STDOUT’
    0% [  ] 0  --.-K/s  789% [==================================================================================================================>  ] 159  --.-K/s  in 0s
    2014-08-30 02:55:45 (8.36 MB/s) - Connection closed at byte 159. Retrying.
    --2014-08-30 02:55:46--  (try: 2)
    Connecting to connected.
    HTTP request sent, awaiting response...
      HTTP/1.1 200 OK
      Content-type: text/html
      Content-length: 177
      Connection: close
    Length: 177 [text/html]
    Saving to: ‘STDOUT’
    0% [  ] 0  --.-K/s  in 0s
    Cannot write to ‘-’ (Success).
  71. mstombs

    mstombs Network Guru Member

    Big up for taking this on HunterZ

    I can also confirm this, but in my case

    Length: 181 [text/html]
    Saving to: ‘servstats’
    98% [========================================================================================>  ] 179         --.-K/s   in 0s     
    2014-08-30 11:44:05 (12.7 MB/s) - Connection closed at byte 179. Retrying.
    I think its a bug around memory allocation for the pointer "response" in this reply, suggest something similar to the redirect code with variable length response required.
    Last edited: Aug 30, 2014
  72. HunterZ

    HunterZ LI Guru Member

    Looks like you guys grabbed HZ4 before I replaced it with HZ5. I messed up the response generation code and didn't catch it until after releasing, when I decided to view the source of the stats response in my browser.

    Can you try HZ5 and see how it goes?

    Edit: looks like I'm still off by two bytes. Guess I'm not supposed to count the line ending at the end. I'll fix it when I can.

    Edit 2: here it is, provided my tablet Firefox doesn't fall at uploading a LAN file.

    Attached Files:

    Last edited: Aug 30, 2014
    AndreDVJ, mstombs and Goggy like this.
  73. Beast

    Beast Network Guru Member

    I updated to HZ6 and added -r -s to the pixleserv options in adblock.sh file.
    But I cant get wget to connect. (wget command on router tools page) Pixleserv is setup on

    wget -O -

    Connecting to (
    wget: can't connect to remote host ( Connection timed out

    Edit: From Firefox clicking on that address returns the stats just fine. How are the options to be enabled/disabled. Are the -r and -s switches required?????? Also wondering in the adblock script options for pixelserv do you seprate the switches/parms/arguments with a space, or is a comma required between them????
    Last edited: Aug 30, 2014
  74. HunterZ

    HunterZ LI Guru Member

    The -s parameter is only to override the default stats URL. It will listen on /servstats by default. If you specify -s without providing a URL, it won't launch.

    tl;dr: leave out the -s and it will still give stats at $redirip/servstats.
  75. jerrm

    jerrm Network Guru Member

    HZ36 works great!

    Two suggestions:

    1: Include a version number in the output.

    2: A "/servstats.txt" option for text only output.

    But I'm happy enough the way it is.
  76. jerrm

    jerrm Network Guru Member

    If your using my version of the script add this to your config file:
    FWBRIDGE="br+ lo"
  77. Beast

    Beast Network Guru Member

    Ok my script looks like this now

    # default interface(s) for firewall rules
    # supports multiple interfaces as well, ie: "br0 br1 br3"
    FWBRIDGE="br+ lo"

    # additional options for pixelserv
  78. HunterZ

    HunterZ LI Guru Member

    I can do those later tonight probably.

    Looks like the err counts I'm seeing are from the browser request processing logic aborting somewhere where there isn't an else statement, so I may add some to attempt to diagnose that.
  79. M0g13r

    M0g13r LI Guru Member

    thx HunterZ really nice work !

    @mstombs transparent.zip .... its the same red icon from pixelserv with alpha 100%

    i ad pixelserv with changed ico and my edited adblock.sh (modified haarp 4.5) and adblk.sh (modified webcontrol from HunterZ)

    Attached Files:

  80. mstombs

    mstombs Network Guru Member

    Nice one, pixel resolution increased from 24 bit to 32 bit but this doesn't increase size because that part of the file was zero padded to 32 bit.

    I think this is an autopsy of it:-

        static unsigned char httpnull_ico[] =
            "HTTP/1.1 200 OK\r\n"
            "Content-type: image/x-icon\r\n"
            "Cache-Control: max-age=2592000\r\n"
            "Content-length: 70\r\n"
            "Connection: close\r\n"
            "\x00\x00" // reserved 0
            "\x01\x00" // ico
            "\x01\x00" // 1 image
            "\x01\x01\x00" // 1 x 1 x >8bpp colour
            "\x00" // reserved 0
            "\x01\x00" // 1 colour plane
            "\x20\x00" // 32 bits per pixel
            "\x30\x00\x00\x00" // size 48 bytes
            "\x16\x00\x00\x00" // start of image 22 bytes in
            "\x28\x00\x00\x00" // size of DIB header 40 bytes
            "\x01\x00\x00\x00" // width
            "\x02\x00\x00\x00" // height
            "\x01\x00" // colour planes
            "\x20\x00" // bits per pixel
            "\x00\x00\x00\x00" // no compression
            "\x00\x00\x00\x00" // end of header
            "\x00\x00\x00\x00" // Colour table
            "\x00\x00\x00\x00" // XOR B G R
            "\x80\xF8\x9C\x41"; // AND ?
    Last edited: Aug 31, 2014
  81. mstombs

    mstombs Network Guru Member

    Could be an old issue, I've always seen a percentage, I assume the browser gives up and breaks the communication channel before the reply gets through?


    Wireshark might help diagnose
  82. HunterZ

    HunterZ LI Guru Member

    I've got the .txt stats response implemented, but I'm not going to release it yet because I've added a bunch of syslog() logging for EXIT_FAILURE (i.e. err counter) conditions.

    Should I change my .ico response to use mstombs' annotated version of M0g13r's data?
  83. leandroong

    leandroong Addicted to LI Member

    Kilndly, compile it static, so other router FW like me can make use of it immediately. Just add '-static' on the end of LDFLAG
    LDFLAGS="-Wl,--gc-sections -static"
    ATM, im using mstomb and addon block "adblock" on my firefox browser. This has stopped all ads so far.

    Lastly, I find this drama site good for ads testing, http://www.dramago.com/drama-updates
    Last edited: Aug 31, 2014
  84. mstombs

    mstombs Network Guru Member

    You can see the current red favicon.ico in Chrome or Firefox tab when viewing the servstats because they scale it up. Internet Explorer leaves it as a 1 pixel dot. Chrome makes an ico request for every servstats page, Firefox makes 2, IE knows how to cache it. I wonder if something could be added to the ico header to encourage browsers to cache, but maybe they are looking for bigger versions?

    Could different binaries - static and arm versions be hosted on github?
    Last edited: Aug 31, 2014
  85. mstombs

    mstombs Network Guru Member

  86. leandroong

    leandroong Addicted to LI Member

    I stopped running adlock temporarily using "adblock.sh toggle". Effect on my browser, it seems that I don't need it. Sufficient for me, just having the firefox addon adblock plus.
  87. leandroong

    leandroong Addicted to LI Member

    I wonder, if firefox addon source code is available for us to use in router ?
  88. mstombs

    mstombs Network Guru Member

  89. HunterZ

    HunterZ LI Guru Member

    leandroog: Yes, I will modify build.sh to produce both statically and dynamically linked versions, and include both in future releases.

    mstombs: Github doesn't provide file hosting any more, because it was being abused. Google Code went the same way for the same reason.
  90. mstombs

    mstombs Network Guru Member

    fyi - I have added a cache-control line to the ico response definition above. Seems to work for me with Firefox in Ubuntu 14.04 under virtualbox on win7 - leaving router compilation to others now! Don't think needed for others since favicon.ico a special common file, other ad requests rarely simple images.

    In this environment I also see 'errs' from just refreshing the servstats page. These come from the timeout on the first select. Increasing the value of the time seems to fix the problem - this bit of code

    #ifdef TEXT_REPLY
          /* read a line from the request */
          FD_SET(new_fd, &set);
          /* Initialize the timeout data structure */
          timeout.tv_sec = 10; // was 2
          timeout.tv_usec = 0;
          /* select returns 0 if timeout, 1 if input available, -1 if error */
          select_rv = select(new_fd + 1, &set, NULL, NULL, &timeout);
    There's another similar 2 timeout later on when closing the connection, might be worth increasing that too. The timeouts were added to avoid hung processes sitting around for ever.
    Last edited: Aug 31, 2014
  91. jerrm

    jerrm Network Guru Member

    I'll be happy to run the debug version and send logs if it will help.
  92. HunterZ

    HunterZ LI Guru Member

    I think I'm going to add extra responsetypes enum values (and corresponding stats counters) for various conditions that would normally result in EXIT_FAILURE, so that it's easier to get visibility into timeouts and such.

    I may also make timeouts configurable.

    I will also add the M0g13r/mstombs .ico mods and leandroong static linker build.sh target.

    I may not get a new version out for another day or two as a result of all these changes.

    Edit: Just as an FYI, the static version is going to be over 90KB, versus 15KB for the dynamically linked build.
    Last edited: Aug 31, 2014
  93. AndreDVJ

    AndreDVJ Addicted to LI Member

    After a while away from my computer, I sorted out my issues with the script (got rid of dup variables from the config file, I'm dumb!).

    I compiled it "statically" and the binary "weights" 312KB :p

    These were the compile options including STATS_REPLY
    Running readelf on the dynamically linked version, only one NEEDED dependency:
    root@WNR3500L:/tmp/mnt/storage/pixelserv-V35.HZ6/dist_dynamic# readelf -d pixelserv
    Dynamic section at offset 0x138 contains 26 entries:
      Tag  Type  Name/Value
    0x00000001 (NEEDED)  Shared library: [libc.so.0]
    0x0000000c (INIT)  0x400a70
    0x0000000d (FINI)  0x401d40
    0x00000004 (HASH)  0x400230
    0x00000005 (STRTAB)  0x400740
    0x00000006 (SYMTAB)  0x4003b0
    0x0000000a (STRSZ)  462 (bytes)
    0x0000000b (SYMENT)  16 (bytes)
    0x70000016 (MIPS_RLD_MAP)  0x41295c
    0x00000015 (DEBUG)  0x0
    0x00000003 (PLTGOT)  0x412960
    0x00000011 (REL)  0x400910
    0x00000012 (RELSZ)  24 (bytes)
    0x00000013 (RELENT)  8 (bytes)
    0x70000001 (MIPS_RLD_VERSION)  1
    0x70000005 (MIPS_FLAGS)  NOTPOT
    0x70000006 (MIPS_BASE_ADDRESS)  0x400000
    0x7000000a (MIPS_LOCAL_GOTNO)  5
    0x70000011 (MIPS_SYMTABNO)  57
    0x70000012 (MIPS_UNREFEXTNO)  27
    0x70000013 (MIPS_GOTSYM)  0x38
    0x00000014 (PLTREL)  REL
    0x00000017 (JMPREL)  0x400928
    0x00000002 (PLTRELSZ)  328 (bytes)
    0x70000032 (MIPS_PLTGOT)  0x4124e4
    0x00000000 (NULL)  0x0
    I am attaching what I have compiled by myself. Source, script, and binaries in a zip file in case someone wants to run on your router and can't compile from source for some reason.

    I have been testing and ads I wasn't being redirected now works.

    EDIT: Well, I have an odd case.
    What it gives me on Chrome is a red square on the tab preceding the url name:


    Clicking on the address bar and hitting enter redirects me.

    Attached Files:

  94. HunterZ

    HunterZ LI Guru Member

    Not sure why you got that big of a binary, unless you didn't strip it.

    The red square is normal - it means your browser also requested a favicon from a blocked domain name, so nullserv served up a single-pixel .ico file.

    Edit: I'm going to add counters for responses given for requested files with no extension ("nfe") and for requested files with unsupported extensions ("ufe"), as these seem to be the two most common conditions that are not explicitly handled (with the 3rd being select() timeouts, which I've already implemented a counter for in my WIP version).
    Last edited: Sep 1, 2014
  95. koitsu

    koitsu Network Guru Member

    It's that big of a binary almost certainly because it's statically linked. strip would probably shave off some of the size, ditto with compiling it using -O (or maybe -O2 but be careful with that). That's the trade-off with statically-linked binaries: they're physically larger, but they tend to be more portable (as in "copy somewhere and run", very little concern about dependencies, barring libc differences).
  96. HunterZ

    HunterZ LI Guru Member

    Except my statically linked version is only 90KB, as I mentioned a few posts earlier. You're right, though: stripping only seems to take off 84 bytes or so.

    Edit: Unless leandroong's info on how to compile a statically-linked binary is wrong?

    Update: Got all changes implemented (whew!). Going to let it run for a bit while bathing the kids and putting them to bed, then if all goes well I will publish it.
    Last edited: Sep 1, 2014
  97. leandroong

    leandroong Addicted to LI Member

    Just download @AndreDVJ binary and installed on my padavan FW. Initial result as follow:
    /media/optware/adblock # ./pixelserv -help
    Usage:./pixelserv [IP No/hostname (all)] [-p port (80) & (443)] [-n i/f (all)] [-u user ("nobody")] [-s /relative_stats_URL (/servstats) [-r (redirect encoded path in tracker links)]
    note: He is using gcc not tomato toolchain. I want to test using tomato-toolchain too if possible

    Here is the result of addblock.sh
    /media/optware/adblock # sh adblock.sh
    ADBLOCK: Download starting
    --2014-09-01 11:28:00--  http://pgl.yoyo.org/adservers/serverlist.php?hostformat               =hosts&mimetype=plaintext
    Resolving pgl.yoyo.org...
    Connecting to pgl.yoyo.org||:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: unspecified [text/plain]
    Saving to: 'STDOUT'
        [   <=>                                                ] 66,182      77.3KB/s   in 0.8s
    2014-09-01 11:28:03 (77.3 KB/s) - written to stdout [66182]
    --2014-09-01 11:28:10--  http://www.malwaredomainlist.com/hostslist/hosts.txt
    Resolving www.malwaredomainlist.com...
    Connecting to www.malwaredomainlist.com||:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 40851 (40K) [text/plain]
    Saving to: 'STDOUT'
    100%[=====================================================>] 40,851      80.4KB/s   in 0.5s
    2014-09-01 11:28:12 (80.4 KB/s) - written to stdout [40851/40851]
    read(net): Connection reset by peer
    --2014-09-01 11:30:08--  http://winhelp2002.mvps.org/hosts.txt
    Resolving winhelp2002.mvps.org...
    Connecting to winhelp2002.mvps.org||:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 511276 (499K) [text/plain]
    Saving to: 'STDOUT'
    100%[=====================================================>] 511,276      203KB/s   in 2.5s
    2014-09-01 11:30:11 (203 KB/s) - written to stdout [511276/511276]
    ADBLOCK: Downloaded
    ADBLOCK: Generating /media/optware/adblock/blocklist
    ADBLOCK: Config generated, 16820 unique hosts to block
    ADBLOCK: Setting up pixelserv on
    pixelserv[1190]: /media/optware/adblock/pixelserv version: V35.HZ6 compiled: Aug 31 2014 19:30:54 from pixelserv.c
    ADBLOCK: Done, restarting dnsmasq
    ADBLOCK: Exiting
    /media/optware/adblock #
    Playing youtube remove initial ads. See following comparison below between adblock and firefox add-on adblockplus
    1. drama site ( http://www.dramago.com/drama-updates )

    2. youtube main page
    Last edited: Sep 1, 2014
  98. HunterZ

    HunterZ LI Guru Member

    Update on static build: Looks like the provided static build settings were incorrect after all (missing a comma before -static). Unfortunately it seems my toolchain will not work for building static, as I get the following error:
    /home/ben/projects/tomato/tools/brcm/K26/hndtools-mipsel-uclibc-4.2.4/bin/../lib/gcc/mipsel-linux-uclibc/4.2.4/../../../../mipsel-linux-uclibc/bin/ld: cannot find -lgcc_s
  99. koitsu

    koitsu Network Guru Member

    The error in question indicates you're missing libgcc_s.a, which is what would be used when statically linking. It means that whoever built the gcc suite/toolchain may have explicitly chosen to not build the static version. (Most software builds both, other software builds dynamic only).

    The shared (dynamic) library version is called libgcc_s.so.X (where the X refers to an arbitrary version number (which is increased when the ABI changes)), and libgcc_s.so would be a symlink to libgcc_s.so.X. Some random stuff for you here.

    libgcc* is the runtime library used for things that were built with gcc, i.e. they're "under the hood" functions that the compiler injected into things to ensure your program runs given what compiler was used.

    gcc itself can sometimes actually internally insist reliance upon libgcc_s as well, which can usually be disabled through a compile-time flag of gcc (usually it's something like --disable-libgcc or --without-libgcc or something along those lines. Here's some details if you're bored.

    You may want to try what's recommended here as well. Note the very specific CFLAGS.

    I used to have to deal with this type of garbage at my old job all the time (plus on Solaris 9 and 10 boxes, which introduce their own set of complications). Really it's just easier to build dynamically-linked software and then tell everyone EXACTLY what versions of the dynamic libraries you've linked to.

    This is why I tend to advocate things like consistent toolchains, Entware, and stuff like Tomatoware. It's important the people building the software actually understand how to do it properly, understand how linkers behave, etc.. The links I've given above, and the behaviour of all the flags passed to the compiler (and thus linker in some cases) matter greatly.
    HunterZ likes this.
  100. HunterZ

    HunterZ LI Guru Member

    Here is version HZ7, which is a big update:
    • add plaintext stats response (Default URL is /servstats.txt)
    • add syslog logging of various EXIT_FAILURE conditions
    • add counters for "connection timeout" and "connection closed" failure cases
    • add counters for "no extension", "unsupported extension", "no URL", and "bad path" default response cases
    • add configurable timeout(s)
    • increase default timeout(s) per mstombs suggestion (10 seconds)
    • integrate transparent+caching .ico response from M0g13r/mstombs

    Here's a legend to the new stats:
    • req: total requests
    • err: connection/request processing ended with EXIT_FAILURE - I'd like to get the causes of all of these diagnosed and migrated to their own (or existing) stat counts if possible
    • tmo: client connection timed out
    • cls: client (browser) closed connection before sending a request
    • nou: client specified GET method but no URL
    • pth: client requested a bad path
    • nfe: client requested a file with no extension (results in default reply, which is generally 0-byte HTML)
    • ufe: client requested a file with an unrecognized extension (most often .js from what I've seen)
    • gif: client requested a .gif file
    • bad: client specified an HTTP method other than GET (results in 501 error)
    • txt: client got a default reply (0-byte HTML)
    • jpg: client requested a .jp(e)g file
    • png: client requested a .png file
    • swf: client requested a .swf (adobe flash) file
    • ico: client requested a .ico file (usually favicon)
    • ssl: client initiated an SSL connection
    • sta: client requested pixelserv stats in HTML format
    • stt: client requested pixelserv stats in plain text format
    • rdr: client requested a URL that resulted in a redirect

    UPDATE: Re-posted below with static binary included.
    Last edited: Sep 1, 2014
    Goggy and mstombs like this.

Share This Page