Posted: Wed Sep 21, 2011 4:32 Post subject: Not Quite [Solved] compiling dnsmasq with tftpd and logging
Hi all,
Should be straight forward enough
I would Love Someone to put the tftp server functionality back into dnsmasq.
I understand that there is a version that is available with Optware, but, all the same I would love that feature to be available out of the box.
Simple interface
Service On / Off
Mount point for tftpboot directory
Option to log messages to syslog
An .cfg option as currently exists would be fine
Happy to have a go myself, but a little shy on time.
Speicifically for Netgear WNR3500L and Cisco E3000 hardware.
I know I am not the only person looking for this, but there are not very many posts in the forums and a short post in the Wiki saying that it has been removed from the DNSMasq compilation due to space.
As we now have 400MHz+ CPUs, 8Mb ROM and 64MB Ram with USB2 routers for less than AU$100.00 here in Australia, I think that this feature could be revisited. Would be more useful to me than some of the features currently on offer
Any comments, takers ??
Thanks
Chris
ps. I hope I have posted in the right place. I have looked through the stickys and Wikis and found nothing on posting feature requests other than request on the forums.
pps. Happy to donate "something" for the efforts of someone if they want to get involved.
ppps. Im also requesting through the "Professional Development" page too
Last edited by MrFidget on Tue Nov 01, 2011 11:42; edited 5 times in total
0 - Dnsmasq successfully forked into the background, or terminated normally if backgrounding is not enabled.
1 - A problem with configuration was detected.
2 - A problem with network access occurred (address in use, attempt to use privileged ports without permission).
3 - A problem occurred with a filesystem operation (missing file/directory, permissions).
4 - Memory allocation failure.
5 - Other miscellaneous problem.
11 or greater - a non zero return code was received from the lease-script process "init" call. The exit code from dnsmasq is the script's exit code with 10 added.
Have a play and you'll see what I mean
Can you help ? I am trying to sdet up a build environment and knock up a new binary with TFTPD built in. I'll trash some hotspot stuff to make space
It is failling on file permissions within the tftp.c
Code:
if (uid == 0)
{
if (!(statbuf.st_mode & S_IROTH))
{
goto perm;
}
}
statbuf.st_mode == 0 which implies no access
uid == 0 therefore the process is running as root so there shouldnt be a reason for no access.
The file is 0777 on an efs2 partition and no other processes are accessing it.
if I ignore the check and force it to continue, the program cant read the file.
Reading the file is done with read and open, not a buffered fread and fopen.
This is statrting to strech my C coding. Can anyone throw me some suggestions ?
When I get back home later today, I was going to try to see if I could read the file using another method. I have created some debugging messages, not shown here that can write to a file using fopen, fprintf and fflush, therefore I am thinking that there is some implimentation issue with using system calls from fcntl.h instead of stdio.h
Anyone with any experience who can shed some light on this would be met with grattitude and beer money via paypal.
1. Make sure you are compiling with the right toolchain.
In my case, for a Netgear WNR3500L and v15962 source (K26) use the toolchain-mipsel_gcc4.1.2
2. Make sure your development libraries are all there and up to date. There was some libc6 stuff that wasnt there or wrong. Not sure. It works now though
AFAIK the stdio.h functions will work under most circumstances, however with lower level system calls, you have to have your libraries set up correctly.
Remove the -DNO_LOG and from the shell before you run make:
Code:
set CONFIG_DNSMASQ_TFTP=y
export CONFIG_DNSMASQ_TFTP
To build, from the ./src/router directory
Code:
make clean
make dnsmasq
The dnsmasq binary will now be found in ./src/router/dnsmasq/src directory.
Use the firmware mod tool to extract a binary
Copy that file on its own to ./rootfs/usr/sbin
Repackage the binary
Copy to your router
You will now get useful messages about leases and tftp transfers in your /var/log/messages
You will also have a working tftp server.
To make the TFTP server work
1. Format a USB key on a machine either FAT32, or efs2 if you wish, and make a directory on it /tftpboot. If you use efs2, make sure its set world readable / executable (755)
2. Enable USB storage services. Services -> USB -> USB Support
Code:
Core USB Support: Enable
USB 2.0 Support: Enable
USB Storage Support: Enable
Automatic Drive Mount: Enable
Disk Mount Point: /mnt
To make this active, in your Services -> Services -> DNSMasq -> Additional DNSMasq Options add the following lines:
Posted: Thu Oct 18, 2012 3:42 Post subject: No, Really....
Very good work!
but....
Why boot off your router?
Do you have a store mounted?
Can you boot off the store?
In my case, having been doing this since looong before there was even an ARPANET (since 1973), I'd consider reviewing...
Network Working Group Bill Croft (Stanford University)
Request for Comments: 951 John Gilmore (Sun Microsystems)
September 1985
BOOTSTRAP PROTOCOL (BOOTP)
and joining me as I try to boot Scientific Linux (onto my Compaq EVO D510 SFF desktop PC)....
from my *phone*. Wirelessly.
No, really...read it. It could happen.
In other words, I'll put up with your sh!t and help you with your project, if you'll put up with my sh!t and help me with my project. I am saying this because at the root of it, I think we're pretty much working on the same project.
"It is also possible to store custom configurations at netboot.me and use chainload URLs to start them with the netboot.me boot loader. To do this, a user just needs to simply submit the URLs of kernel and initrd together with any required parameters. Those who have built a boot configuration that is interesting for a wider audience are asked to inform the operators so they can include it in the boot menu and make it accessible to all."
Been a while, but I'm back here needing a TFTP server....still..I just got disctracted with more pressing work....like a job tracking system, and a CDR billing system...but I'm back
I am using the TFTP to boot / provision IP phones.
I think I have a solution which may work for me. I'm going to try it out and if it works, I'll post my results