Possibility of adding perl to dd-wrt

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Goto page Previous  1, 2, 3  Next
Author Message
mstombs
DD-WRT User


Joined: 31 Oct 2007
Posts: 151

PostPosted: Thu Nov 05, 2009 8:10    Post subject: Reply with quote
frater wrote:
...
I will post mine... maybe you can see something which is not right....
http://pastebin.com/f2bad6d7e
BTW. It doesn't do anything with its stdin... Can this be a problem?


I did see that version, and I also didn't do anything with stdin (apart from leave comment where it would go!). The perl scripts read to the end of the input buffer before sending the string, but in the daemon C version the router didn't close the connection properly unless the input was cleared, just before clsong the connection. I managed to test the inetd version only on ubuntu, not the router and it seems not necessary maybe inetd flushes the buffer?

And no, it didn't know the router could compile - but when you have a 3GHz quad core 4GB ram machine why use a 200MHz 32MB ram device and where does the 100MB+ toolchain go?

Which version? Your call, only thing I may add is a null js script (but no I don't know when...), Internet Explorer still reports errors when pages try to load scripts from blocked hosts - and get given the null pixel. I 'think' the standalone version will be better when loading pages with lots of adds as inetd (and the previous version of this pixelserv.c) have to create new processes to deal with each request.

And do you need pixelserv at all when using Firefox and adblock plus?
Sponsor
frater
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 2777

PostPosted: Sat Nov 07, 2009 8:40    Post subject: Reply with quote
mstombs wrote:
And do you need pixelserv at all when using Firefox and adblock plus?

I don't even want to have that dns-request to leave my local network.

I'm going to use your C-version to avoid confusion.

_________________
Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge

DD-WRT v24-sp2 vpn (c) 2010 NewMedia-NET GmbH
Release: 12/16/10 (SVN revision: 15758M)
jimmydu3
DD-WRT Novice


Joined: 31 Jan 2009
Posts: 2

PostPosted: Tue Nov 24, 2009 3:05    Post subject: Reply with quote
so can this pixelserv be used without optware? I'm limited in space on my router, so hopefully pixelserv can be standalone on the router. I'm using the basic adblock startup script frater had in the original adblock thread. Can this be integrated into that? Thanks!
crashfly
DD-WRT Guru


Joined: 24 Feb 2009
Posts: 2026
Location: Sol System > Earth > USA > Arkansas

PostPosted: Tue Nov 24, 2009 6:27    Post subject: Reply with quote
jimmydu3 wrote:
so can this pixelserv be used without optware? I'm limited in space on my router, so hopefully pixelserv can be standalone on the router. I'm using the basic adblock startup script frater had in the original adblock thread. Can this be integrated into that? Thanks!

Unlikely. The "original" pixelserv requires perl which can only be used with storage space (hence optware). Now, assuming the posted 'C' pixelserv would work, we have no information on making it work properly in "standalone" mode. Does it have a configuration file? What dependencies does it have?

While it *might* be possible, a this time it is going to be unlikely, unless more information is given.

_________________
E3000 22200M KongVPN K26
WRT600n v1.1 refirb mega 18767 BS K24 NEWD2 [not used]
WRT54G v2 16214 BS K24 [access point]

Try Dropbox for syncing files - get 2.5gb online for free by signing up.

Read! Peacock thread
*PLEASE* upgrade PAST v24SP1 or no support.
frater
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 2777

PostPosted: Tue Nov 24, 2009 17:49    Post subject: Reply with quote
I had to use trick to use port 80 and keep access to your webserver on port 80.
If you want to keep it simple you have to move your DD-WRT's webif to another port (88?). You can then run pixelserv on your IP and that's it.

My system uses xinetd and an extra IP to achieve the ultimate goal of having everything on port 80 (even an extra webserver).

_________________
Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge

DD-WRT v24-sp2 vpn (c) 2010 NewMedia-NET GmbH
Release: 12/16/10 (SVN revision: 15758M)
mstombs
DD-WRT User


Joined: 31 Oct 2007
Posts: 151

PostPosted: Tue Nov 24, 2009 23:40    Post subject: Reply with quote
jimmydu3 wrote:
so can this pixelserv be used without optware? I'm limited in space on my router, so hopefully pixelserv can be standalone on the router. I'm using the basic adblock startup script frater had in the original adblock thread. Can this be integrated into that? Thanks!


Yes the posted pixelserv is a compiled binary that 'should' work standalone and with inetd (when called with -i). I've only tested using latest Mega dd-wrt on a WRT54G-TM, but also have same c-code running on 32 or 64-bit Ubuntu or AR7 adsl routers.

You will need to store it on /jffs, or "wget" it from your own website and make it executable "chmod +x /path/to/pixelserv".

Test by copying to /var and run it! Monitor consumed resources with "top" and "ps" - it should be at the bottom of any measure!

Run with no parameters it will listen on all available interfaces/ IP addresses on Port 80, so it will fail to start unless you move the configuration web gui off port 80. See Frater's instructions above, you can disable http and use only https, but not all functions work - such as web firmware upgrade. A user has also reported to me there are some sites that ask for https ads, which still find the router gui on port 443, so a non-standard http port is preferred.

To listen on a specific IP address, possibly a special secondary lan bridge IP (create manually using "ifconfig br0:0 192.178.0.2"?), use syntax

/path/to/pixelserv 192.168.0.2

You will need to modify your adblock script to divert ads to this IP.

There is no configuration file, after an initial message to report version all messages go to the syslog.
krylon
DD-WRT Novice


Joined: 11 Jun 2007
Posts: 3

PostPosted: Mon Mar 01, 2010 22:09    Post subject: Reply with quote
[quote="mstombs"]
jimmydu3 wrote:

Run with no parameters it will listen on all available interfaces/ IP addresses on Port 80, so it will fail to start unless you move the configuration web gui off port 80. See Frater's instructions above, you can disable http and use only https, but not all functions work - such as web firmware upgrade. A user has also reported to me there are some sites that ask for https ads, which still find the router gui on port 443, so a non-standard http port is preferred.


So what is the fix for the bold? Run two instances of pixelserv - one for port 80 and one for port 443?
mstombs
DD-WRT User


Joined: 31 Oct 2007
Posts: 151

PostPosted: Tue Mar 02, 2010 20:46    Post subject: Reply with quote
krylon wrote:
mstombs wrote:

Run with no parameters it will listen on all available interfaces/ IP addresses on Port 80, so it will fail to start unless you move the configuration web gui off port 80. See Frater's instructions above, you can disable http and use only https, but not all functions work - such as web firmware upgrade. A user has also reported to me there are some sites that ask for https ads, which still find the router gui on port 443, so a non-standard http port is preferred.


So what is the fix for the bold? Run two instances of pixelserv - one for port 80 and one for port 443?


Never tried 2 instances and the port 80 is hardcoded, so would need a special recompile. I just don't use https on the standard port. I assume Frater's more complete optware xinetd solution would be more configurable.

[edit] I made the port configurable, and multiple copies seem to coexist fine, but you do not want to send a null pixel in response to an https request, it is not a valid secure response.
sint
DD-WRT Novice


Joined: 28 Jan 2010
Posts: 21

PostPosted: Sun Sep 12, 2010 23:42    Post subject: Reply with quote
Thank you mstomb and other for compiling pixelserv in c.

It works perfectly :)

(I have a wrt160n).

But I have 2 other routers that are Atheros platform

One is Trendnet 652, one is Dlink615, both have 4MB).

When I ran the pixelserv on these, it outputs "garbage" characters on screen.

My question is: Would it be possible to compile it for Atheros ?

I am really an ignorant when it comes to compiling stuff .

I think they call me: a noob.

Could you compile a version ?

Thank you so much in advance.
sint
DD-WRT Novice


Joined: 28 Jan 2010
Posts: 21

PostPosted: Mon Sep 13, 2010 19:26    Post subject: Reply with quote
I would like to add something:

So after I install toolchain for Atheros MIPS
and compile the pixelserv.c with mipsel-linux-uclibc-gcc (static 72K and non static about 5k),

the build.sh finished fine.

But when I run the pixelserv in my DLink 615 (WiSOC platform), I get this error:

root@TrendNet:/tmp# ./pixelserv
./pixelserv: line 1: syntax error: "(" unexpected


What could be my error in the process not getting this right ?

Thank you in advance.
kfuglsang
DD-WRT Novice


Joined: 16 Aug 2010
Posts: 2

PostPosted: Thu Oct 07, 2010 20:00    Post subject: Reply with quote
Im also getting the syntax error "(" on my WNDR3700.
nvasic
DD-WRT Novice


Joined: 17 Oct 2010
Posts: 1

PostPosted: Sun Oct 17, 2010 11:09    Post subject: Reply with quote
sint wrote:
Thank you mstomb and other for compiling pixelserv in c.

It works perfectly :)

(I have a wrt160n).

But I have 2 other routers that are Atheros platform

One is Trendnet 652, one is Dlink615, both have 4MB).

When I ran the pixelserv on these, it outputs "garbage" characters on screen.

My question is: Would it be possible to compile it for Atheros ?

I am really an ignorant when it comes to compiling stuff .

I think they call me: a noob.

Could you compile a version ?

Thank you so much in advance.


I also have Linksys 160N, mine is version 3 hardware and have been trying for about a month to get pixelsvr working on my router. I have also tried the code on all 3 firmware versions awailable for my router. Now I am on build 14896.

The thing is that MVPS hosts file and also my custom host entries part of the code seam to be working fine however pixelsvr just wont work, it always gives me page not available no matter how I tweak the code.

What's even more interesting is that the part of the code in charge of moving administration port sometimes just doesnt work and have to connect to router via telnet fo fix it manually. The codes to change port I used are..

//version1
nvram set http_lanport=81
nvram commit

//version2
if [ nvram get http_lanport == 80 ]; then
nvram set http_lanport=81
nvram commit
stopservice httpd
startservice httpd
stopservice firewall
startservice firewall
fi httpd -h /usr/tmp/www

//version3
killall httpd
httpd -p 81 -h /www

I would be most gratefull, since you have the same router, to post the complete code for your (startup) script and if possibile pixelserv file so I can finally get a working version. You will save me a lot of headakes cause I am banging my head against a wall cause of this :)

Thanks ahead!
mstombs
DD-WRT User


Joined: 31 Oct 2007
Posts: 151

PostPosted: Fri Nov 05, 2010 1:00    Post subject: Reply with quote
Have replied by pm to some, sorry can't help with compile on Atheros, but I have also just noticed that the pixelserv.c V9 compiled above also doesn't work properly on Broadcom - if params are incorrect - a printf doesn't work, so who knows what else doesn't!, curiously the same code compiled with the latest TomatoUSB git (OpenWRT derived) gcc 4.2.4 toolchain appears to work fine on dd-wrt, so here it is.

Old versions could sometimes hang waiting for browser confirmations or close connections too aggressively giving browser warnings, latest version forks for each reply but each process should only hang around long enough to close the connection cleanly, using various tcp/ip tweaks to ease this.

'Features' added over the past year are all for the standalone version - no benefit to Frater's inetd one:-

The port and interface are now configurable, by default only binds to the lan interface br0. Calling syntax:-

Code:
root@DD-WRT:~# ./pixelserv -h
Unknown opt: -h
Usage:./pixelserv [-i] [IP] [-p 80] [-n IF]
i = inetd mode, IP or hostname to listen on - default all, p = port No/name, IF = interface name (def br0)


for example

Code:
root@DD-WRT:~# ./pixelserv -p 88
...
pixelserv[2416]: ./pixelserv V19 compiled: Nov  4 2010 23:54:44 from pixelserv19.c


and with syslogd enabled the following appears in the log

Code:
root@DD-WRT:~# tail /var/log/messages
...
Nov  5 00:56:04 DD-WRT daemon.notice pixelserv[2418]: Listening on 0.0.0.0:88


I wasn't aware this would be much use - but it maybe ...

http://sysadmingeek.com/articles/how-to-remove-advertisements-with-pixelserv-on-dd-wrt/

The program also now keeps a count of many requests sent, and can be poked to put this in the log using

Code:
root@DD-WRT:~# kill -SIGHUP $(pidof pixelserv)


resulting in, for example
Code:
Nov  5 01:24:30 DD-WRT daemon.info pixelserv[3429]: 1000 ads served


The same message also sent on normal exit (via killall)

The various options can be disabled at compile time, and all output messages can be removed with "-DTINY" to save a couple of kB if you really want to squeeze a base64 coded gzip version into nvram as per

http://www.dd-wrt.com/phpBB2/viewtopic.php?t=71036

but there won't be any useful diagnostics from that one if it doesn't work.

An issue still is that sending blank gifs to browsers asking for javascript causes script errors to be logged, you can see from the code that test versions only responding to image requests have been made, but can cause more problems - any suggestions?

[edit] for reference, this version tested on WRT54G-TM running DD-WRT v24-sp2 (05/16/10) big (SVN revision 14428M NEWD Eko) did try a latest 2.6 kernel but router got stuck in reboot loop, had to use serial console to interrupt, clear nvram, and then tftp 'known working version' in...



pixserve19dd.zip
 Description:
Pixelserv19.c and build/test scripts

Download
 Filename:  pixserve19dd.zip
 Filesize:  7.72 KB
 Downloaded:  1197 Time(s)



Last edited by mstombs on Sat Nov 06, 2010 22:45; edited 1 time in total
Oki
DD-WRT Novice


Joined: 06 Nov 2010
Posts: 2

PostPosted: Sat Nov 06, 2010 20:23    Post subject: pixelserv AR71xx binary Reply with quote
First of all since it's my first post here I would like to welcome everybody.Smile I configured “OpenWrt Buildroot” from “backfire” branch, compiled pixelserv19.c for AR71xx target and indeed it seams to be working fine I used the same flags as in mstombs build script. Use at your own risk, I’m not responsible for any unwanted behavior (only for good things). Very Happy


pixelserv_AR71xx.zip
 Description:
pixelserv AR71xx binary

Download
 Filename:  pixelserv_AR71xx.zip
 Filesize:  3.36 KB
 Downloaded:  1345 Time(s)

mstombs
DD-WRT User


Joined: 31 Oct 2007
Posts: 151

PostPosted: Sat Nov 06, 2010 22:33    Post subject: Reply with quote
Welcome, and thanks Oki. There was another thread in the Atheros sub-forum asking for this, if I can find it I'll post a link back here, although its the Broadcom forum the history of this little bit of code is here - and there's still an open request ticket ... http://svn.dd-wrt.com:8000/dd-wrt/ticket/771
Goto page Previous  1, 2, 3  Next Display posts from previous:    Page 2 of 3
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum