aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-08-13 23:07:57 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-08-13 23:07:57 +0000
commit9694747f7742b10aa929b7a3edad87493fcb7a21 (patch)
tree95ccd0f6752c75795ed7f6e93282035e070fdab4 /packages
parent5c32b27996bbe37654eab50272985f9c607dee17 (diff)
downloadpfsense-packages-9694747f7742b10aa929b7a3edad87493fcb7a21.tar.gz
pfsense-packages-9694747f7742b10aa929b7a3edad87493fcb7a21.tar.bz2
pfsense-packages-9694747f7742b10aa929b7a3edad87493fcb7a21.zip
Add per user bandwidth distribution package
Diffstat (limited to 'packages')
-rw-r--r--packages/per-user-bandwidth-distribution.xml55
1 files changed, 55 insertions, 0 deletions
diff --git a/packages/per-user-bandwidth-distribution.xml b/packages/per-user-bandwidth-distribution.xml
new file mode 100644
index 00000000..c58c8b00
--- /dev/null
+++ b/packages/per-user-bandwidth-distribution.xml
@@ -0,0 +1,55 @@
+<packagegui>
+ <name>per-user-bandwidth-distribution</name>
+ <version>1.0.1</version>
+ <title>Services: Per User Bandwidth</title>
+ <aftersaveredirect>pkg_edit.php?xml=per-user-bandwidth-distribution.xml&amp;id=0</aftersaveredirect>
+ <menu>
+ <name>Per User Bandwidth</name>
+ <tooltiptext>Enforce a fair use bandwidth policy</tooltiptext>
+ <section>Services</section>
+ <configfile>per-user-bandwidth-distribution.xml</configfile>
+ </menu>
+ <service>
+ <name>PerUserBandwidth</name>
+ <rcfile>per_user_bandwidth_distribution.sh</rcfile>
+ </service>
+ <configpath>installedpackages->package->$packagename->configuration->settings</configpath>
+ <fields>
+ <field>
+ <fielddescr>Bandwidth</fielddescr>
+ <fieldname>bandwidth</fieldname>
+ <description>Enter the bandwidth you would like to distribute:</description>
+ <type>input</type>
+ </field>
+ <field>
+ <fielddescr>Bandwidth Type</fielddescr>
+ <fieldname>bandwidthtype</fieldname>
+ <type>select</type>
+ <options>
+ <option>
+ <value>Byte/s</value>
+ <name>Byte/s</name>
+ </option>
+ <option>
+ <value>KByte/s</value>
+ <name>KByte/s</name>
+ </option>
+ <option>
+ <value>MByte/s</value>
+ <name>MByte/s</name>
+ </option>
+ </options>
+ </field>
+ </fields>
+ <custom_add_php_command>
+ $fd = fopen("/usr/local/etc/rc.d/per_user_bandwidth_distribution.sh","w");
+ fwrite($fd, "/sbin/kldload dummynet");
+ fwrite($fd, "/sbin/ipfw add 10 pipe 1 ip from any to any out via {$wanif}");
+ fwrite($fd, "/sbin/ipfw add 10 pipe 2 ip from any to any in via {$wanif}");
+ fwrite($fd, "/sbin/ipfw add allow all from any to any");
+ fwrite($fd, "/sbin/ipfw pipe 1 config mask src-ip 0x000000ff bw {$_POST['bandwidth']}{$_POST['bandwidthtype']}");
+ fwrite($fd, "/sbin/ipfw pipe 2 config mask dst-ip 0x000000ff bw {$_POST['bandwidth']}{$_POST['bandwidthtype']}");
+ fclose($fd);
+ mwexec("chmod a+rx /usr/local/etc/rc.d/per_user_bandwidth_distribution.sh");
+ </custom_add_php_command>
+</packagegui>