quota's question

Discuss the technical details of Gargoyle and ongoing development

Moderator: Moderators

alenhoff
Posts: 16
Joined: Sun Mar 01, 2009 6:45 am

quota's question

Post by alenhoff »

first of all sorry if this is a waste of time. i don't know how many people that come here are on a satellite connection as i am but the quota system is perfect. i don't have to worry about going over my limit and being a sub dialup speeds for 24 hours because of the fair access policy which limits me to 425mb's a day. upload and download combined... my question is that there is a free download period from 2am to 6am central time. how hard would it be to add this as an exception to the quota limits. if it wouldn't be to difficult i would like to learn to do it myself but i'm not good enough yet to code something that is very complex. i would appreciate any input.

Thanks

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

Re: quota's question

Post by Eric »

First, I'm glad you find the quota feature so useful. You're the first user to report using it, so I'm glad someone likes it.

Be careful if you're limited to 425Mb combined upload and download. Gargoyle has independent limits on each, so you might want to set a quota of 125Mb upload / 300Mb download or something reasonable like that, so you don't go over.

As for adding a scheduling feature to the quotas... it's doable. It's probably possible to make a quick hack to implement it simply, though doing it right isn't trivial. The access restrictions program handles the quotas as well as the restrictions. So, if you aren't using the access restrictions (other than the quotas) you can use cron to shut down restricter_gargoyle (run /etc/init.d/restricter_gargoyle stop ; /etc/init.d/bwmon_gargoyle restart) when the unlimited window opens and then use cron to schedule a restart of the restricter daemon (/etc/init.d/restricter_gargoyle start) right before the window ends. As indicated, you need to restart the bandwidth monitor after shutting down the restriction daemon, or when it comes back up it will still detect the used bandwidth. That's the hack.

To do it right you'll need to modify my rectriction program (Checkout the source from the SVN as indicated in the download page. You'll find the code in trunk/package/restricter-gargoyle/src/restricter.c). While fairly well organized, the code is still big (3k lines of C code). Also, I was being an idiot when I implemented the quotas -- instead of using the QUOTA iptables rule, I have it check the byte counters on rules periodically, which makes things a bit more complicated. However, there are already some scheduling routines in there for the other restriction rules, which can be scheduled. So... if you're ambitious.. have fun :-) If you implement this feature I'd love to incorporate it into Gargoyle, giving you full credit in the About Page, of course.

Also, since I haven't heard anyone else report using the quota tool, please DO report any bugs you find. I try to debug everything before I release it, but bugs often slip in unnoticed, and I rely on users to tell me if something is still wrong. I'll try to fix any bugs you report ASAP. Thanks!

alenhoff
Posts: 16
Joined: Sun Mar 01, 2009 6:45 am

Re: quota's question

Post by alenhoff »

so far everything with the quota's system is working great. i've already tested it with a low upload/download limit and hit the limit intentionally to test it. i had already downloaded the svn after posting this to check things out and look at the code. i'd be happy to help out in any way i can. i did think about adding the option for a combined upload/download wan limit.. i know that alot of people with satellite based internet would find it extremely useful since both hughesnet and wildblue have a fap in place although wildblue's is monthly it can still be done since you already have the monthly option available as well. i'll see what i can do and report back, since i have the use for the quota's i'll test it as well before releasing anything about it other then maybe an update.

Thanks again for the examples.

ps. i have since installed this on a wrt54gs v3 as well and everything is running perfect.

my wrt54g v4 is setup with a static ip and is also doing well.

FRiC
Posts: 62
Joined: Sat Sep 27, 2008 8:03 am
Contact:

Re: quota's question

Post by FRiC »

What's supposed to happen when the % used reaches 100%? :?

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

Re: quota's question

Post by Eric »

When a bandwidth quota is reached all access to the WAN is shut off (both upload and download), just like if you were blocking all access for a certain IP in the restrictions section.

FRiC
Posts: 62
Joined: Sat Sep 27, 2008 8:03 am
Contact:

Re: quota's question

Post by FRiC »

I always assumed that quota was just a counter. When I tried enabling it earlier, it counts to 100% and then nothing happens. I'll give it another try. :shock:

alenhoff
Posts: 16
Joined: Sun Mar 01, 2009 6:45 am

Re: quota's question

Post by alenhoff »

REJECT all -- kitchen.lan anywhere reject-with icmp-port-unreachable

Chain block_ingress (1 references)
target prot opt source destination
ingress_whitelist all -- anywhere anywhere
REJECT all -- anywhere kitchen.lan reject-with icmp-port-unreachable

mine is blocking it like its supposed to. however do you have all ips or just quota's for each ip number fric. i have quota's for each ip number so the problem could be with setting the rejections with all ips.

Update: I enabled a 1mb quota to all ips and exceeded it. i deleted my previous quota for seperate ips to test. using all ips option its not setting up the rules to reject the activity when the quota is exceeded. i'm looking at the code now but i can only post what i find. unless your confident with editing the restrictor source and rebuilding it yourself. not trying to be insulting but i don't know you or your capabilities lol. good catch on this though, i use seperate ip quota's for my pc's so i wasn't affected.

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

Re: quota's question

Post by Eric »

Quotas for all ips combined fixed in SVN r208, new bleeding-edge firmware uploaded.

FRiC
Posts: 62
Joined: Sat Sep 27, 2008 8:03 am
Contact:

Re: quota's question

Post by FRiC »

Yes, I used "All IPs". Maybe it only works for individual IP's?

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

Re: quota's question

Post by Eric »

Ummm... yeah. But it's fixed now. See comment above.

Post Reply