Need software (tcpdump/Netflow exporter) on DIR-615 D3

Post new topic   Reply to topic    DD-WRT Forum Index -> Ralink SoC based Hardware
Author Message
yodaHeIs
DD-WRT Novice


Joined: 04 Mar 2011
Posts: 2

PostPosted: Fri Mar 04, 2011 16:25    Post subject: Need software (tcpdump/Netflow exporter) on DIR-615 D3 Reply with quote
Hi,

i need to get tcpdump and softflowd (or another NetFlow exporter) running on my D-Link DIR-615 (HwRev: D3). The current firmware installed is "DD-WRT v24-sp2 (02/17/11) std". It is completely ok for me to just get an executable that i can copy into the /tmp partition. This is just for evaluation purposes.

My problems currently are:

1.) The (only) DD-WRT firmware that runs on this device is the standard (std) one. That means no ipkg or jffs2. That also means my device is not supported by the stable branch, yet.

2.) I do not know how to cross-compile for this architecture. It looks like the mipsel executables (e.g. from WRT54 ipkgs) do not work. Subproblem: I also got stuck trying to setup a toolchain for compiling the complete DD-WRT from scratch.

3.) I failed to use the firmware-mod-kit. It stops with "Error: filesystem not extracted properly. firmware image format not compatible?" and does not produce a rootfs directory in the working dir.

I'd appreciate any pointers to either a pre-compiled program or a guide how to setup a cross-compilation toolchain.

I'd also take a firmware image with tcpdump/softflowd included. Btw. i do not need Wireless support at all!
I just need the WAN and two LAN ports, NAT and ssh.

best
Fabian
Sponsor
jnjn
DD-WRT User


Joined: 07 Jun 2006
Posts: 448
Location: PRC

PostPosted: Fri Mar 04, 2011 16:33    Post subject: Reply with quote
broadcom binaries should run well on the unit. however, you may need some extra library files. a good start is to extract some pre-compiled files from a mega firmware and try to run them on your unit. "export LD_LIBRARY_PATH=XXXXXXXXXXx"quite useful in this case.

btw: you probably need files from a K26 mega firmware.
yodaHeIs
DD-WRT Novice


Joined: 04 Mar 2011
Posts: 2

PostPosted: Fri Mar 04, 2011 17:54    Post subject: Great idea, that pu me on the right track. Reply with quote
Hi,

thanks jnjn. That helped and put me on the right track. What i need to to is a crude hack and needs to be exercised with caution, but it works:

1.) get a mega firmware image (i opted for the dd-wrt.v24_mega_generic.bin from Asus WL500G Premium v2)

2.) disassemble it with the firmware-mod-kit

3.) copy the tcpdump binary from working_dir/rootfs/usr/sbin to the DIR-615 (into /tmp). If you execute it now it complains about a missing symbol named 'mmap64'. Most likely not the only one it misses. Therefore next step:

4.) locate the library that provides this symbol. The easiest way was to execute the following in working_dir/rootfs:

Code:
--> strings -f lib/* usr/lib/* | grep 'mmap64'
lib/libc.so.0: mmap64


(Now given that the library we need is libc.so.0 we should be careful with changing global environments!)

5.) copy the library to the DIR-615 (also into /tmp)

6.) execute the program and preload the library:

Code:
LD_PRELOAD=/tmp/libc.so.0 ./tcpdump



thanks again for the idea

best
Fabian
aw215
DD-WRT Novice


Joined: 27 Aug 2015
Posts: 3

PostPosted: Mon Aug 31, 2015 19:15    Post subject: Reply with quote
Here is a simpler/safer alternative approach to getting around the limitations of a DIR-615, which I developed for my D4 but should work also for a D3 (and can be easily adapted by changing only 2 lines [beneath the comments] for other routers with similar restrictions, or other packages required).

Add the code below to the Startup Script (Administration-Commands):
Code:
cat > /tmp/tcpdump-install.sh << 'EOF'
#!/bin/sh
# Set the correct OpenWRT packages repository for router model and CPU chipset
repository=http://downloads.openwrt.org/attitude_adjustment/12.09/ramips/rt305x/packages
mkdir /tmp/inst
# List package(s) to install from the repository, in sequence (no .ipk extension)
for package in libpcap_1.1.1-2_ramips tcpdump_4.2.1-3_ramips
do
 cd /tmp/inst
 wget $repository/$package.ipk
 tar -zxvf $package.ipk
 tar -zxvf control.tar.gz
 cd ..
 tar -zxvf /tmp/inst/data.tar.gz
done
rm -rf inst
chmod 777 /tmp
EOF
chmod +x /tmp/tcpdump*.sh


This creates an install script on reboot that can then be executed via telnet/ssh with:
Code:
/tmp/tcpdump-install.sh


tcpdump can then be run as follows (supplying additional options as required):
Code:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/usr/lib
/tmp/usr/sbin/tcpdump
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Ralink 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 cannot attach files in this forum
You cannot download files in this forum