Quotas and shutdown

General discussion about Gargoyle, OpenWrt or anything else even remotely related to the project

Moderator: Moderators

Post Reply
petermac
Posts: 11
Joined: Thu Apr 23, 2009 10:40 am

Quotas and shutdown

Post by petermac »

Hi,

I have just installed Gargoyle on a wrt54gl and I am setting up quotas to restrict the daily usage of machines on my network. I noticed that usage data is stored in /usr/data/restricter. This data appears to be updated only when settings are changed. If the power is switched off to the router does any accumulated usage get lost?

From a quick look at the source code restricter.c my understanding is that that the data is only updated once a day and that a variable quota_backup_interval can be set to have it backed up more often. Is this correct?

Also is there a correct way to shutdown the router so that things such as quotas and bandwidth data are saved and not lost?

Thanks
Peter

Eric
Site Admin
Posts: 1443
Joined: Sat Jun 14, 2008 1:14 pm

Re: Quotas and shutdown

Post by Eric »

Yup, that's exactly right. The reason I have it write only once a day is that if you write too frequently to a flash chip it can wear out, but once a day is infrequently enough that it shouldn't cause any problems unless you intend to use your router for a few decades.

If the router loses power randomly you can lose up to a day of usage, but the data previous to this will get restored. There's really no way to shut down & save if the router just loses power so the only way to prevent against this is to backup more frequently.

If you use the reboot button under the system/reboot section, the router will shut down properly, saving bandwidth/quota data.

petermac
Posts: 11
Joined: Thu Apr 23, 2009 10:40 am

Re: Quotas and shutdown

Post by petermac »

Eric,

Thanks for the quick response. I didn't think about wearing out the flash chip. The problem for me is that we sometimes turn the router off in the middle of the day if we leave the house. In this case we would lose the quota details. Also I could see someone exploiting this to reduce their usage.

I don't seem to have a reboot option under System on my version of Gargoyle (or i'm looking in the wrong spot).

Thanks
Peter

Eric
Site Admin
Posts: 1443
Joined: Sat Jun 14, 2008 1:14 pm

Re: Quotas and shutdown

Post by Eric »

The only way this could be exploited is if someone has physical access to the router (to unplug it). If you have physical access to the router, you can do anything you like including installing new firmware. If you don't have physical security on your router, it can always be compromised fairly easily.

The reboot button is only in the bleeding edge firmware. You can upgrade now or wait a week and install Beta 5.

petermac
Posts: 11
Joined: Thu Apr 23, 2009 10:40 am

Re: Quotas and shutdown

Post by petermac »

I am not really worried about the physical access to the router but more concerned about saving the values before the router is turned off. Is it possible to program the router to run a script when the Cisco button on the front is pressed?


Peter

Post Reply