vortex-5 / ddwrt-bwmon

An Individual Bandwidth Monitor For DD-WRT
171 stars 37 forks source link

How would I disable the automatic dnsmasq hostname resolution located in start.sh #14

Closed raybishop15 closed 8 years ago

raybishop15 commented 8 years ago

First off, THANK YOU FOR THIS SCRIPT. I am wanting to see which users is using the most band width instead of looking at there mac address I see that you have a case open already about this but I would just rather enter it in manually through the script I went inside the router using putty and went into /jffs/bwmon/www/vi mac-names.js and added var MAC_NAMES = {'11:22:33:44:55:66': 'HR PHONE'} but of course I used there MAC address but I can not figure out how to disable the automatic dnsmasq hostname resolution located in start.sh to make this work

vortex-5 commented 8 years ago

So there's two ways to approach this first you can just disable dns mask and run the dhcpd client. Some people say that client is less efficient but without dnsmasq there will be no ip addresses to override yours.

The other potentially better way if you're good with coding is to disable this line:

https://github.com/vortex-5/ddwrt-bwmon/blob/master/bwmon/start.sh#L26

you can just use the # symbol before the line to comment it out.

Keep in mind you will need to do this again when you upgrade.

I actually left a comment above that line to state that it was ok to disable that if you wanted to purely use mac-names.js maybe my wording is not great if you can suggest better wording for:

https://github.com/vortex-5/ddwrt-bwmon/blob/master/bwmon/start.sh#L25

Feel free to help me out and suggest something. I sometimes talk in pure programmer I understand how it can be hard to follow.

vortex-5 commented 8 years ago

The new wording may be rolled out in the next 1.6.1

I probably need to go over some of the comments that are suppose to be readable by the user and improve them I somewhat wrote them at the start of the project and haven't updated them much my focus this whole time has been to try and get the tool as automatic as possible so it was easy to get running.

raybishop15 commented 8 years ago

Great thank you! I commented the line out but when I checked my page where it gives out the usage it is still listing the wireless device as a MAC address and not a Name I made sure I used the exact code that you gave in the example var MAC_NAMES = {'11:22:33:44:55:66': 'HR PHONE'} located in mac-names.js and also commented out this line # $SCRIPT_DIR/bwmon-dnsmasq.sh

vortex-5 commented 8 years ago

you need to start and stop the script since you are making edits.

The script only executes start.sh once then the rest of the code is run through bwmon-running.sh

a quick way is to run ./startup.sh it takes care of properly shutting down the service and starting it back up again.

If you don't want to use the command like you can always try rebooting your router.

This is try for any edits ot any of the scripts.

vortex-5 commented 8 years ago

Also are you running this on a lighttpd instance? I haven't actually check if that would affect things but since it has a service provide the dns information it potentially could be smart enough to still pick up the dnsmasq entries in lighttpd.

I have to look at the code again to verify.

raybishop15 commented 8 years ago

I did run .start.sh and it didn't work I am using lighttpd

thanks!

vortex-5 commented 8 years ago

The lighttpd may automatically detect the presence of the dnsmasq unfortunately so it may not be disable-able with lighttpd in this current version.

If you put stuff in mac names it should override what is in the dnsmasq but there is no way to revert to mac addresses for things that are unnamed.

If you are not getting the overrides from mac names then I have to evaluate what is going on that feature may need a bug.

vortex-5 commented 8 years ago

I'll have a patch go up for 1.6.1 that will address this it appears what's happening is every DNSmasq update cycle all the mac addresses are overwritten. What is missing is the MAC_NAMES should overwrite the DNSmasq entries afterwards to take any custom names.

This should be sufficient if more users request no DNS and show all the raw MAC addresses then I'll see if I can detect it if using lighttpd.

Summary after the patch goes up you will be able to override any DNSmasq entries when using lighttpd by using the mac-names.js file. DNSmasq will still be used for anything non overridden.

In the future this project will evaluate the demand for disabling DNSmasq resolution entire (most users so far prefer a level of automatic resolution where possible).

vortex-5 commented 8 years ago

Ok I've drafted a new patch.

It's not in release yet since I'm at the office and I'm not able to test it until I get home.

If you want to give me your initial assessment you can replace this file on your router:

https://github.com/vortex-5/ddwrt-bwmon/blob/master/bwmon/www/bwmon.js

With the current one listed in the respository.

If you're a coder you can assess the change: https://github.com/vortex-5/ddwrt-bwmon/commit/c1368834a51cf62634a41ede2256fe213edeede5

There will be a proper release once this hot fix is fully tested.

raybishop15 commented 8 years ago

im sorry i am not a coder would i just copy and paste that in bwmon.js

vortex-5 commented 8 years ago

no you'd download the file overwrite it and then rerun the install script. It's ok I'll have a tested version up it just might be a day or two.

raybishop15 commented 8 years ago

Great Thank you! I will be waiting

raybishop15 commented 8 years ago

just to let you know I tried the new code out you. I replaced the file bwmon.js directory with the new one you gave me then extracted it and followed all the directions you have on the page but now the problem is when I go into to the www/vi mac-names.js after I enter var MAC_NAMES = {'11:22:33:44:55:66': 'HR PHONE'} and save out of VI and run startup.sh it deletes the Mac addresses I put in there and goes back to the orginal/**

vortex-5 commented 8 years ago

I tested the changes it seems to be working for me.

Did you disable the line in start.sh?

bwmon_dsnmasq.sh

Anyways here's the version I was using with the start.sh pre-modded

Github doesn't support gz so I had to upload it first in a zip container you can in stall this the same way you did before.

1.6.1 will probably show up shortly it will not have start.sh modded since people without lighttpd need that option on otherwise they get no hostnames.

bwmon.tar.zip

vortex-5 commented 8 years ago

also if startup.sh isn't working you may want to try just using ./stop.sh followed by start.sh

raybishop15 commented 8 years ago

Alright Thank you! I will give it a try later today

vortex-5 commented 8 years ago

the new version is up you can just edit start.sh to comment out the dnsmasq as stated before.

make sure to stop the service with stop.sh before editing.

raybishop15 commented 8 years ago

Thank you it works perfect!

vortex-5 commented 8 years ago

Marking as resolved.