diff options
Diffstat (limited to 'usr')
-rwxr-xr-x | usr/local/www/firewall_shaper.php | 16 | ||||
-rw-r--r-- | usr/local/www/wizards/traffic_shaper_wizard.xml | 154 |
2 files changed, 132 insertions, 38 deletions
diff --git a/usr/local/www/firewall_shaper.php b/usr/local/www/firewall_shaper.php index 58fb7b5..f4ef20d 100755 --- a/usr/local/www/firewall_shaper.php +++ b/usr/local/www/firewall_shaper.php @@ -179,6 +179,7 @@ if ($_GET['act'] == "del") { <li class="tabact">Rules</li> <li class="tabinact"><a href="firewall_shaper_queues.php">Queues</a></li> <li class="tabinact"><a href="firewall_shaper_magic.php">Magic shaper wizard</a></li> + <li class="tabinact"><a href="wizard.php?xml=traffic_shaper_wizard.xml">Experimental magic shaper wizard</a></li> </ul> </td></tr> <tr> @@ -228,10 +229,11 @@ if ($_GET['act'] == "del") { echo $textss . htmlspecialchars($iflabels[$shaperent['interface']]); echo "<br>"; echo "<a href=\"?act=toggle&id={$i}\">"; - if ($shaperent['direction'] != "in") - echo "<img src=\"out{$dis}.gif\" width=\"11\" height=\"11\" border=\"0\" style=\"margin-top: 5px\" title=\"click to toggle enabled/disabled status\">"; - if ($shaperent['direction'] != "out") + if ($shaperent['direction'] == "in") echo "<img src=\"in{$dis}.gif\" width=\"11\" height=\"11\" border=\"0\" style=\"margin-top: 5px\" title=\"click to toggle enabled/disabled status\">"; + if ($shaperent['direction'] == "out") + echo "<img src=\"out{$dis}.gif\" width=\"11\" height=\"11\" border=\"0\" style=\"margin-top: 5px\" title=\"click to toggle enabled/disabled status\">"; + echo "</a>" . $textse;; ?> </td> @@ -250,9 +252,11 @@ if ($_GET['act'] == "del") { </td> <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_shaper_edit.php?id=<?=$i;?>';"><?=$textss;?> <?php - if (isset($shaperent['targetqueue'])) { - $desc = htmlspecialchars($shaperent['targetqueue']); - echo "<a href=\"firewall_shaper_queues_edit.php?id={$shaperent['targetqueue']}\">{$desc}</a>"; + if (isset($shaperent['outqueue']) && isset($shaperent['inqueue'])) { + $desc = htmlspecialchars($shaperent['outqueue']); + echo "<a href=\"firewall_shaper_queues_edit.php?id={$shaperent['outqueue']}\">{$desc}</a>"; + $desc = htmlspecialchars($shaperent['inqueue']); + echo "/<a href=\"firewall_shaper_queues_edit.php?id={$shaperent['inqueue']}\">{$desc}</a>"; } ?><?=$textse;?> </td> diff --git a/usr/local/www/wizards/traffic_shaper_wizard.xml b/usr/local/www/wizards/traffic_shaper_wizard.xml index b0ac364..cc8a1fd 100644 --- a/usr/local/www/wizards/traffic_shaper_wizard.xml +++ b/usr/local/www/wizards/traffic_shaper_wizard.xml @@ -46,11 +46,9 @@ </fields> <stepsubmitphpaction> /* wipe previous */ -/* XXX - billm - disabling for preview unset($config['shaper']['queue']); unset($config['shaper']['rule']); $config['shaper']['enable'] = FALSE; -*/ </stepsubmitphpaction> </step> <step> @@ -160,7 +158,7 @@ <type>checkbox</type> <typehint>Prioritize Peer-to-Peer traffic</typehint> <description>This will lower the priority of P2P traffic below all other traffic.</description> - <enablefields>edonkey,cutemx,imest,songspy,hotlineconnect,gnutella,dcc,napster,aimster,buddyshare,scour,opennap,hotcomm,grouper,dcplusplus,winmx</enablefields> + <enablefields>Aimster,BitTorrent,BuddyShare,CuteMX,DCplusplus,dcc,DirectConnect,DirectFileExpress,EDonkey2000,FastTrack,Gnutella,grouper,hotComm,HotlineConnect,iMest,Napster,OpenNap,Scour,SongSpy,WinMX</enablefields> </field> <field> <name>Next</name> @@ -171,9 +169,19 @@ <type>listtopic</type> </field> <field> - <name>eDonkey</name> + <name>Aimster</name> <type>checkbox</type> - <typehint>eDonkey and other P2P using the eDonkey protocol and ports</typehint> + <typehint>Aimster and other P2P using the Aimster protocol and ports</typehint> + </field> + <field> + <name>BitTorrent</name> + <type>checkbox</type> + <typehint>Bittorrent and other P2P using the Torrent protocol and ports</typehint> + </field> + <field> + <name>BuddyShare</name> + <type>checkbox</type> + <typehint>BuddyShare and other P2P using the BuddyShare protocol and ports</typehint> </field> <field> <name>CuteMX</name> @@ -181,19 +189,34 @@ <typehint>CuteMX and other P2P using the CuteMX protocol and ports</typehint> </field> <field> - <name>iMest</name> + <name>DCplusplus</name> <type>checkbox</type> - <typehint>iMest and other P2P using the iMest protocol and ports</typehint> + <typehint>DC++ and other P2P using the DC++ protocol and ports</typehint> </field> <field> - <name>SongSpy</name> + <name>DCC</name> <type>checkbox</type> - <typehint>SongSpy and other P2P using the SongSpy protocol and ports</typehint> + <typehint>irc DCC file transfers</typehint> </field> <field> - <name>HotlineConnect</name> + <name>DirectConnect</name> <type>checkbox</type> - <typehint>HotlineConnect and other P2P using the HotlineConnect protocol and ports</typehint> + <typehint>DirectConnect and other P2P using the DirectConnect protocol and ports</typehint> + </field> + <field> + <name>DirectFileExpress</name> + <type>checkbox</type> + <typehint>DirectFileExpress and other P2P using the DirectFileExpress protocol and ports</typehint> + </field> + <field> + <name>eDonkey2000</name> + <type>checkbox</type> + <typehint>eDonkey and other P2P using the eDonkey protocol and ports</typehint> + </field> + <field> + <name>FastTrack</name> + <type>checkbox</type> + <typehint>FastTrack and other P2P using the FastTrack protocol and ports</typehint> </field> <field> <name>Gnutella</name> @@ -201,29 +224,29 @@ <typehint>Gnutella and other P2P using the Gnutella protocol and ports</typehint> </field> <field> - <name>DCC</name> + <name>grouper</name> <type>checkbox</type> - <typehint>irc DCC file transfers</typehint> + <typehint>grouper and other P2P using the grouper protocol and ports</typehint> </field> <field> - <name>Napster</name> + <name>hotComm</name> <type>checkbox</type> - <typehint>Napster and other P2P using the Napster protocol and ports</typehint> + <typehint>hotComm and other P2P using the hotComm protocol and ports</typehint> </field> <field> - <name>Aimster</name> + <name>HotlineConnect</name> <type>checkbox</type> - <typehint>Aimster and other P2P using the Aimster protocol and ports</typehint> + <typehint>HotlineConnect and other P2P using the HotlineConnect protocol and ports</typehint> </field> <field> - <name>BuddyShare</name> + <name>iMest</name> <type>checkbox</type> - <typehint>BuddyShare and other P2P using the BuddyShare protocol and ports</typehint> + <typehint>iMest and other P2P using the iMest protocol and ports</typehint> </field> <field> - <name>Scour</name> + <name>Napster</name> <type>checkbox</type> - <typehint>Scour and other P2P using the Scour protocol and ports</typehint> + <typehint>Napster and other P2P using the Napster protocol and ports</typehint> </field> <field> <name>OpenNap</name> @@ -231,19 +254,14 @@ <typehint>OpenNap and other P2P using the OpenNap protocol and ports</typehint> </field> <field> - <name>hotComm</name> - <type>checkbox</type> - <typehint>hotComm and other P2P using the hotComm protocol and ports</typehint> - </field> - <field> - <name>grouper</name> + <name>Scour</name> <type>checkbox</type> - <typehint>grouper and other P2P using the grouper protocol and ports</typehint> + <typehint>Scour and other P2P using the Scour protocol and ports</typehint> </field> <field> - <name>DCplusplus</name> + <name>SongSpy</name> <type>checkbox</type> - <typehint>DC++ and other P2P using the DC++ protocol and ports</typehint> + <typehint>SongSpy and other P2P using the SongSpy protocol and ports</typehint> </field> <field> <name>WinMX</name> @@ -256,8 +274,80 @@ </field> </fields> <stepsubmitphpaction> -/* XXX create P2P queues here */ -/* XXX create P2P rules here */ + + /* XXX - billm - needs to actually honor what the user selects still */ + + /* To add p2p clients, push Descr,Protocol,Start,End,src/dest/both onto p2plist */ + $p2plist[] = array('Aimster','tcp','7668','7668','both'); + $p2plist[] = array('BitTorrent','tcp','6881','6999','both'); + $p2plist[] = array('BuddyShare','tcp','7788','7788','both'); + $p2plist[] = array('CuteMX','tcp','2340','2340','both'); + $p2plist[] = array('DC++','tcp','1412','1412','both'); + $p2plist[] = array('dcc','tcp','6666','6668','both'); + $p2plist[] = array('DirectConnect','tcp','412','412','both'); + $p2plist[] = array('DirectFileExpress','tcp','1044','1045','both'); + $p2plist[] = array('EDonkey2000','tcp','4661','4665','both'); + $p2plist[] = array('FastTrack','tcp','1214','1214','both'); + $p2plist[] = array('Gnutella','tcp','6346','6346','both'); + $p2plist[] = array('grouper','tcp','8038','8039','both'); + $p2plist[] = array('hotComm','tcp','28864','28865','both'); + $p2plist[] = array('HotlineConnect','tcp','5500','5503','both'); + $p2plist[] = array('iMest','tcp','4329','4329','both'); + $p2plist[] = array('Napster','tcp','6699','6701','both'); + $p2plist[] = array('OpenNap','tcp','8888','8889','both'); + $p2plist[] = array('Scour','tcp','8311','8311','both'); + $p2plist[] = array('SongSpy','tcp','5190','5190','both'); + $p2plist[] = array('WinMX','tcp','6699','6699','both'); + + /* Set up/down p2p as lowest weight */ + /* loop through p2plist[] */ + foreach ($p2plist as $p2pclient) { + foreach (array('source','destination') as $srcdest) { + $rule = array(); + if ($srcdest == 'source') { + $destsrc = 'destination'; + $rule['outqueue'] = 'qP2PUp'; + $rule['inqueue'] = 'qP2PDown'; + $rule['interface'] = 'lan'; + $rule['source']['network'] = 'lan'; + $rule['destination']['any'] = TRUE; + $rule['descr'] = "m_P2P {$p2pclient[0]} outbound"; + } else { + $destsrc = 'source'; + $rule['outqueue'] = 'qP2PDown'; + $rule['inqueue'] = 'qP2PUp'; + $rule['interface'] = 'wan'; + $rule['source']['any'] = TRUE; + $rule['destination']['network'] = 'lan'; + $rule['descr'] = "m_P2P {$p2pclient[0]} inbound"; + } + + + $rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3]; + if($p2pclient[1] != '') + $rule['protocol'] = $p2pclient[1]; + + $config['shaper']['rule'][] = $rule; + } + } + + /* create qP2PUp */ + $queue = array(); + $queue['name'] = "qP2PUp"; + $queue['associatedrule'] = 0; + $queue['priority'] = 0; + $queue['red'] = "on"; + $queue['ecn'] = "on"; + $config['shaper']['queue'][] = $queue; + + /* create qP2PDown */ + $queue = array(); + $queue['name'] = "qP2PDown"; + $queue['associatedrule'] = 0; + $queue['priority'] = 1; + $queue['red'] = "on"; + $queue['ecn'] = "on"; + $config['shaper']['queue'][] = $queue; </stepsubmitphpaction> </step> <step> |