From 8fd84f8778dde3f1c62934c1c2ae687bc5c0f51f Mon Sep 17 00:00:00 2001 From: Ermal Date: Fri, 22 Jul 2011 17:27:51 +0000 Subject: Ticket #749. Make the rules of the traffic shaper wizard select the wan side of the interfaces to not make the intra-lan traffic classifible in this way. --- usr/local/www/wizards/traffic_shaper_wizard.inc | 53 ++-- .../wizards/traffic_shaper_wizard_dedicated.inc | 329 +++++++++++---------- .../wizards/traffic_shaper_wizard_multi_all.inc | 146 ++++----- .../wizards/traffic_shaper_wizard_multi_lan.inc | 8 + 4 files changed, 291 insertions(+), 245 deletions(-) diff --git a/usr/local/www/wizards/traffic_shaper_wizard.inc b/usr/local/www/wizards/traffic_shaper_wizard.inc index e6d8823..ee800ce 100644 --- a/usr/local/www/wizards/traffic_shaper_wizard.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard.inc @@ -600,12 +600,15 @@ function apply_all_choosen_items() { $lanbw += $input_bw; } + $interfacelist = array(); + for ($i = 0; $i < $steps; $i++) { $altq =& new altq_root_queue(); $tmppath = array(); $altq->SetInterface($config['ezshaper']['step2']["conn{$i}interface"]); + $interfacelist[] = $config['ezshaper']['step2']["conn{$i}interface"]; $altq->SetScheduler($config['ezshaper']['step2']["conn{$i}uploadscheduler"]); $altq->SetBandwidth(floatval($config['ezshaper']['step2']["conn{$i}upload"])); $altq->SetBwscale($config['ezshaper']['step2']["conn{$i}uploadspeed"]); @@ -1329,11 +1332,17 @@ function apply_all_choosen_items() { if (!is_array($config['filter']['rule'])) $config['filter']['rule'] = array(); + if (empty($interfacelist)) + $interfacelist = ""; + else + $interfacelist = implode(",", $interfacelist); + /* Rules */ if ($penalty) { if( is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) { $rule = array(); $rule['type'] = "match"; + $rule['interface'] = $interfacelist; $rule['descr'] = gettext("Penalty Box"); $rule['source']['any'] = TRUE; $rule['defaultqueue'] = "qOthersLow"; @@ -1353,6 +1362,7 @@ function apply_all_choosen_items() { /* create VOIP rules */ $rule = array(); $rule['type'] = "match"; + $rule['interface'] = $interfacelist; $rule['descr'] = gettext("VOIP Adapter"); $rule['protocol'] = "udp"; $rule['defaultqueue'] = "qVoIP"; @@ -1367,6 +1377,7 @@ function apply_all_choosen_items() { /* create VOIP rules */ $rule = array(); $rule['type'] = "match"; + $rule['interface'] = $interfacelist; $rule['descr'] = "DiffServ/Lowdelay/Upload"; $rule['protocol'] = "udp"; $rule['source']['any'] = TRUE; @@ -1383,6 +1394,7 @@ function apply_all_choosen_items() { foreach ($voiplist[$config['ezshaper']['step3']['provider']] as $voip) { $rule = array(); $rule['type'] = "match"; + $rule['interface'] = $interfacelist; $rule['defaultqueue'] = 'qVoIP'; $rule['source']['any'] = TRUE; $rule['destination']['any'] = TRUE; @@ -1406,6 +1418,7 @@ function apply_all_choosen_items() { foreach ($p2plist[$key] as $p2pclient) { $rule = array(); $rule['type'] = "match"; + $rule['interface'] = $interfacelist; $rule['defaultqueue'] = 'qP2P'; $rule['source']['any'] = TRUE; $rule['destination']['any'] = TRUE; @@ -1428,6 +1441,7 @@ function apply_all_choosen_items() { foreach ($gamesplist[$key] as $Gameclient) { $rule = array(); $rule['type'] = "match"; + $rule['interface'] = $interfacelist; $rule['defaultqueue'] = 'qGames'; if ($Gameclient[1] == "tcp") $rule['ackqueue'] = 'qACK'; @@ -1453,6 +1467,7 @@ function apply_all_choosen_items() { foreach ($othersplist[$key] as $otherclient) { $rule = array(); $rule['type'] = "match"; + $rule['interface'] = $interfacelist; switch ($val) { case "H": $rule['defaultqueue'] = 'qOthersHigh'; /* posted value H or L */ @@ -1475,29 +1490,29 @@ function apply_all_choosen_items() { } else $loop = 1; /* It automitaclly goes to default queue */ break; - default: - $loop = 1; - } - if (!$loop) { - $rule['source']['any'] = TRUE; - $rule['destination']['any'] = TRUE; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['descr'] = "m_Other {$otherclient[0]} outbound"; - - if($otherclient[2] or $otherclient[3]) { - $rule['destination']['port'] = $otherclient[2]."-".$otherclient[3]; - } - if($otherclient[1] != '') - $rule['protocol'] = $otherclient[1]; - - $config['filter']['rule'][] = $rule; + default: + $loop = 1; + } + if (!$loop) { + $rule['source']['any'] = TRUE; + $rule['destination']['any'] = TRUE; + $rule['floating'] = "yes"; + $rule['wizard'] = "yes"; + $rule['enabled'] = "on"; + $rule['descr'] = "m_Other {$otherclient[0]} outbound"; + + if($otherclient[2] or $otherclient[3]) { + $rule['destination']['port'] = $otherclient[2]."-".$otherclient[3]; } + if($otherclient[1] != '') + $rule['protocol'] = $otherclient[1]; + + $config['filter']['rule'][] = $rule; } } } - write_config(); + } + write_config(); } function wizard_get_bandwidthtype_scale($type = "b") { diff --git a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc index 9707d06..bb25f79 100755 --- a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc @@ -625,13 +625,16 @@ function apply_all_choosen_items() { $altq_list_queues = array(); $steps = intval($config['ezshaper']['step1']['numberofconnections']); - + + $interfacelist = array(); + for ($i = 0; $i < $steps; $i++) { $tmppath = array(); $altq =& new altq_root_queue(); $altq->SetInterface($config['ezshaper']['step2']["conn{$i}interface"]); + $interfacelist[] = $config['ezshaper']['step2']["conn{$i}interface"]; $altq->SetScheduler($config['ezshaper']['step2']["conn{$i}uploadscheduler"]); $altq->SetBandwidth(floatval($config['ezshaper']['step2']["conn{$i}upload"])); $altq->SetBwscale($config['ezshaper']['step2']["conn{$i}uploadspeed"]); @@ -1394,175 +1397,183 @@ function apply_all_choosen_items() { if (!is_array($config['filter']['rule'])) $config['filter']['rule'] = array(); - /* Rules */ - if ($penalty) { - if( is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) { - $rule = array(); - $rule['type'] = "match"; - $rule['descr'] = gettext("Penalty Box"); - $rule['source']['any'] = TRUE; - $rule['defaultqueue'] = "qOthersLow"; - $rule['source']['address'] = $config['ezshaper']['step4']['address']; - $rule['destination']['any'] = TRUE; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $config['filter']['rule'][] = $rule; - - } + $interfacelist = implode(",", $interfacelist); + + /* Rules */ + if ($penalty) { + if( is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) { + $rule = array(); + $rule['type'] = "match"; + $rule['interface'] = $interfacelist; + $rule['descr'] = gettext("Penalty Box"); + $rule['source']['any'] = TRUE; + $rule['defaultqueue'] = "qOthersLow"; + $rule['source']['address'] = $config['ezshaper']['step4']['address']; + $rule['destination']['any'] = TRUE; + $rule['floating'] = "yes"; + $rule['wizard'] = "yes"; + $rule['enabled'] = "on"; + $config['filter']['rule'][] = $rule; + } + } + + /* If user specifies an IP, we don't bother with providers */ + if ($voip) { + if( is_ipaddr($config['ezshaper']['step3']['address']) || is_alias($config['ezshaper']['step3']['address'])) { + /* create VOIP rules */ + $rule = array(); + $rule['type'] = "match"; + $rule['interface'] = $interfacelist; + $rule['descr'] = gettext("VOIP Adapter"); + $rule['protocol'] = "udp"; + $rule['defaultqueue'] = "qVoIP"; + $rule['source']['address'] = $config['ezshaper']['step3']['address']; + $rule['destination']['any'] = TRUE; + $rule['floating'] = "yes"; + $rule['wizard'] = "yes"; + $rule['enabled'] = "on"; + $config['filter']['rule'][] = $rule; + + } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) { + /* create VOIP rules */ + $rule = array(); + $rule['type'] = "match"; + $rule['interface'] = $interfacelist; + $rule['descr'] = "DiffServ/Lowdelay/Upload"; + $rule['protocol'] = "udp"; + $rule['source']['any'] = TRUE; + $rule['defaultqueue'] = "qVoIP"; + $rule['destination']['any'] = TRUE; + $rule['iptos'] = "lowdelay"; + $rule['floating'] = "yes"; + $rule['wizard'] = "yes"; + $rule['enabled'] = "on"; + $config['filter']['rule'][] = $rule; + + } else { + /* loop through voiplist[] */ + foreach ($voiplist[$config['ezshaper']['step3']['provider']] as $voip) { + $rule = array(); + $rule['type'] = "match"; + $rule['interface'] = $interfacelist; + $rule['defaultqueue'] = 'qVoIP'; + $rule['source']['any'] = TRUE; + $rule['destination']['any'] = TRUE; + $rule['descr'] = "m_voip {$voip[0]} outbound"; + $rule['floating'] = "yes"; + $rule['wizard'] = "yes"; + $rule['enabled'] = "on"; + $rule['destination']['port'] = $voip[2]."-".$voip[3]; + if($voip[1] != '') + $rule['protocol'] = $voip[1]; + $config['filter']['rule'][] = $rule; } + } + } - /* If user specifies an IP, we don't bother with providers */ - if ($voip) { - if( is_ipaddr($config['ezshaper']['step3']['address']) || is_alias($config['ezshaper']['step3']['address'])) { - /* create VOIP rules */ - $rule = array(); - $rule['type'] = "match"; - $rule['descr'] = gettext("VOIP Adapter"); - $rule['protocol'] = "udp"; - $rule['defaultqueue'] = "qVoIP"; - $rule['source']['address'] = $config['ezshaper']['step3']['address']; - $rule['destination']['any'] = TRUE; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $config['filter']['rule'][] = $rule; - - } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) { - /* create VOIP rules */ - $rule = array(); - $rule['type'] = "match"; - $rule['descr'] = "DiffServ/Lowdelay/Upload"; - $rule['protocol'] = "udp"; + /* loop through p2plist[] */ + if ($p2p) { + foreach($config['ezshaper']['step5'] as $key => $val) { + if (!is_array($p2plist[$key])) + continue; + foreach ($p2plist[$key] as $p2pclient) { + $rule = array(); + $rule['type'] = "match"; + $rule['interface'] = $interfacelist; + $rule['defaultqueue'] = 'qP2P'; + $rule['source']['any'] = TRUE; + $rule['destination']['any'] = TRUE; + $rule['descr'] = "m_P2P {$p2pclient[0]} outbound"; + $rule['floating'] = "yes"; + $rule['wizard'] = "yes"; + $rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3]; + if($p2pclient[1] != '') + $rule['protocol'] = $p2pclient[1]; + $config['filter']['rule'][] = $rule; + } + } + } + + /* loop through gamesplist[] */ + if ($games) { + foreach($config['ezshaper']['step6'] as $key => $val) { + if (!is_array($gamesplist[$key])) + continue; + foreach ($gamesplist[$key] as $Gameclient) { + $rule = array(); + $rule['type'] = "match"; + $rule['interface'] = $interfacelist; + $rule['defaultqueue'] = 'qGames'; + if ($Gameclient[1] == "tcp") + $rule['ackqueue'] = 'qACK'; + $rule['source']['any'] = TRUE; + $rule['destination']['any'] = TRUE; + $rule['floating'] = "yes"; + $rule['wizard'] = "yes"; + $rule['enabled'] = "on"; + $rule['descr'] = "m_Game {$Gameclient[0]} outbound"; + $rule['destination']['port'] = $Gameclient[2]."-".$Gameclient[3]; + if($Gameclient[1] != '') + $rule['protocol'] = $Gameclient[1]; + $config['filter']['rule'][] = $rule; + } + } + } + + /* loop through othersplist[] */ + if ($otherpriority) { + foreach($config['ezshaper']['step7'] as $key => $val) { + if (!is_array($othersplist[$key])) + continue; + foreach ($othersplist[$key] as $otherclient) { + $rule = array(); + $rule['type'] = "match"; + $rule['interface'] = $interfacelist; + switch ($val) { + case "H": + $rule['defaultqueue'] = 'qOthersHigh'; /* posted value H or L */ + if ($otherclient[1] == "tcp") + $rule['ackqueue'] = 'qACK'; + $loop = 0; + break; + case "L": + $rule['defaultqueue'] = 'qOthersLow'; /* posted value H or L */ + if ($otherclient[1] == "tcp") + $rule['ackqueue'] = 'qACK'; + $loop = 0; + break; + case "D": + if ($p2pcatchall) { + $loop = 0; + $rule['defaultqueue'] = 'qOthersDefault'; + if ($otherclient[1] == "tcp") + $rule['ackqueue'] = 'qACK'; + } else + $loop = 1; /* It automitaclly goes to default queue */ + break; + default: + $loop = 1; + } + if (!$loop) { $rule['source']['any'] = TRUE; - $rule['defaultqueue'] = "qVoIP"; $rule['destination']['any'] = TRUE; - $rule['iptos'] = "lowdelay"; $rule['floating'] = "yes"; $rule['wizard'] = "yes"; $rule['enabled'] = "on"; - $config['filter']['rule'][] = $rule; - - } else { - /* loop through voiplist[] */ - foreach ($voiplist[$config['ezshaper']['step3']['provider']] as $voip) { - $rule = array(); - $rule['type'] = "match"; - $rule['defaultqueue'] = 'qVoIP'; - $rule['source']['any'] = TRUE; - $rule['destination']['any'] = TRUE; - $rule['descr'] = "m_voip {$voip[0]} outbound"; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['destination']['port'] = $voip[2]."-".$voip[3]; - if($voip[1] != '') - $rule['protocol'] = $voip[1]; - $config['filter']['rule'][] = $rule; - } - } - } + $rule['descr'] = "m_Other {$otherclient[0]} outbound"; - /* loop through p2plist[] */ - if ($p2p) { - foreach($config['ezshaper']['step5'] as $key => $val) { - if (!is_array($p2plist[$key])) - continue; - foreach ($p2plist[$key] as $p2pclient) { - $rule = array(); - $rule['type'] = "match"; - $rule['defaultqueue'] = 'qP2P'; - $rule['source']['any'] = TRUE; - $rule['destination']['any'] = TRUE; - $rule['descr'] = "m_P2P {$p2pclient[0]} outbound"; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3]; - if($p2pclient[1] != '') - $rule['protocol'] = $p2pclient[1]; - $config['filter']['rule'][] = $rule; - } - } - } - - /* loop through gamesplist[] */ - if ($games) { - foreach($config['ezshaper']['step6'] as $key => $val) { - if (!is_array($gamesplist[$key])) - continue; - foreach ($gamesplist[$key] as $Gameclient) { - $rule = array(); - $rule['type'] = "match"; - $rule['defaultqueue'] = 'qGames'; - if ($Gameclient[1] == "tcp") - $rule['ackqueue'] = 'qACK'; - $rule['source']['any'] = TRUE; - $rule['destination']['any'] = TRUE; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['descr'] = "m_Game {$Gameclient[0]} outbound"; - $rule['destination']['port'] = $Gameclient[2]."-".$Gameclient[3]; - if($Gameclient[1] != '') - $rule['protocol'] = $Gameclient[1]; - $config['filter']['rule'][] = $rule; - } - } - } - - /* loop through othersplist[] */ - if ($otherpriority) { - foreach($config['ezshaper']['step7'] as $key => $val) { - if (!is_array($othersplist[$key])) - continue; - foreach ($othersplist[$key] as $otherclient) { - $rule = array(); - $rule['type'] = "match"; - switch ($val) { - case "H": - $rule['defaultqueue'] = 'qOthersHigh'; /* posted value H or L */ - if ($otherclient[1] == "tcp") - $rule['ackqueue'] = 'qACK'; - $loop = 0; - break; - case "L": - $rule['defaultqueue'] = 'qOthersLow'; /* posted value H or L */ - if ($otherclient[1] == "tcp") - $rule['ackqueue'] = 'qACK'; - $loop = 0; - break; - case "D": - if ($p2pcatchall) { - $loop = 0; - $rule['defaultqueue'] = 'qOthersDefault'; - if ($otherclient[1] == "tcp") - $rule['ackqueue'] = 'qACK'; - } else - $loop = 1; /* It automitaclly goes to default queue */ - break; - default: - $loop = 1; - } - if (!$loop) { - $rule['source']['any'] = TRUE; - $rule['destination']['any'] = TRUE; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['descr'] = "m_Other {$otherclient[0]} outbound"; - - if($otherclient[2] or $otherclient[3]) { - $rule['destination']['port'] = $otherclient[2]."-".$otherclient[3]; - } - if($otherclient[1] != '') - $rule['protocol'] = $otherclient[1]; - - $config['filter']['rule'][] = $rule; - } + if($otherclient[2] or $otherclient[3]) { + $rule['destination']['port'] = $otherclient[2]."-".$otherclient[3]; } + if($otherclient[1] != '') + $rule['protocol'] = $otherclient[1]; + + $config['filter']['rule'][] = $rule; } } - write_config(); + } + } + write_config(); } function wizard_get_bandwidthtype_scale($type = "b") { diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc index 2ff0b84..519364f 100755 --- a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc @@ -658,13 +658,16 @@ function apply_all_choosen_items() { $altq_list_queues = array(); $steps = intval($config['ezshaper']['step1']['numberofconnections']); - + + $interfacelist = array(); + for ($i = 0; $i < $steps; $i++) { $tmppath = array(); $altq =& new altq_root_queue(); $altq->SetInterface($config['ezshaper']['step2']["conn{$i}interface"]); + $interfacelist[] = $config['ezshaper']['step2']["conn{$i}interface"]; $altq->SetScheduler($config['ezshaper']['step2']["conn{$i}uploadscheduler"]); $altq->SetBandwidth(floatval($config['ezshaper']['step2']["conn{$i}upload"])); $altq->SetBwscale($config['ezshaper']['step2']["conn{$i}uploadspeed"]); @@ -1448,23 +1451,26 @@ function apply_all_choosen_items() { if (!is_array($config['filter']['rule'])) $config['filter']['rule'] = array(); - /* Rules */ - if ($penalty) { - if( is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) { - $rule = array(); - $rule['type'] = "match"; - $rule['descr'] = gettext("Penalty Box"); - $rule['source']['any'] = TRUE; - $rule['defaultqueue'] = "qOthersLow"; - $rule['source']['address'] = $config['ezshaper']['step4']['address']; - $rule['destination']['any'] = TRUE; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $config['filter']['rule'][] = $rule; - - } - } + $interfacelist = implode(",", $interfacelist); + + /* Rules */ + if ($penalty) { + if( is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) { + $rule = array(); + $rule['type'] = "match"; + $rule['interface'] = $interfacelist; + $rule['descr'] = gettext("Penalty Box"); + $rule['source']['any'] = TRUE; + $rule['defaultqueue'] = "qOthersLow"; + $rule['source']['address'] = $config['ezshaper']['step4']['address']; + $rule['destination']['any'] = TRUE; + $rule['floating'] = "yes"; + $rule['wizard'] = "yes"; + $rule['enabled'] = "on"; + $config['filter']['rule'][] = $rule; + + } + } /* If user specifies an IP, we don't bother with providers */ if ($voip) { @@ -1472,6 +1478,7 @@ function apply_all_choosen_items() { /* create VOIP rules */ $rule = array(); $rule['type'] = "match"; + $rule['interface'] = $interfacelist; $rule['descr'] = gettext("VOIP Adapter"); $rule['protocol'] = "udp"; $rule['defaultqueue'] = "qVoIP"; @@ -1486,6 +1493,7 @@ function apply_all_choosen_items() { /* create VOIP rules */ $rule = array(); $rule['type'] = "match"; + $rule['interface'] = $interfacelist; $rule['descr'] = "DiffServ/Lowdelay/Upload"; $rule['protocol'] = "udp"; $rule['source']['any'] = TRUE; @@ -1502,6 +1510,7 @@ function apply_all_choosen_items() { foreach ($voiplist[$config['ezshaper']['step3']['provider']] as $voip) { $rule = array(); $rule['type'] = "match"; + $rule['interface'] = $interfacelist; $rule['defaultqueue'] = 'qVoIP'; $rule['source']['any'] = TRUE; $rule['destination']['any'] = TRUE; @@ -1525,6 +1534,7 @@ function apply_all_choosen_items() { foreach ($p2plist[$key] as $p2pclient) { $rule = array(); $rule['type'] = "match"; + $rule['interface'] = $interfacelist; $rule['defaultqueue'] = 'qP2P'; $rule['source']['any'] = TRUE; $rule['destination']['any'] = TRUE; @@ -1547,6 +1557,7 @@ function apply_all_choosen_items() { foreach ($gamesplist[$key] as $Gameclient) { $rule = array(); $rule['type'] = "match"; + $rule['interface'] = $interfacelist; $rule['defaultqueue'] = 'qGames'; if ($Gameclient[1] == "tcp") $rule['ackqueue'] = 'qACK'; @@ -1564,59 +1575,60 @@ function apply_all_choosen_items() { } } - /* loop through othersplist[] */ - if ($otherpriority) { - foreach($config['ezshaper']['step7'] as $key => $val) { - if (!is_array($othersplist[$key])) - continue; - foreach ($othersplist[$key] as $otherclient) { - $rule = array(); - $rule['type'] = "match"; - switch ($val) { - case "H": - $rule['defaultqueue'] = 'qOthersHigh'; /* posted value H or L */ - if ($otherclient[1] == "tcp") + /* loop through othersplist[] */ + if ($otherpriority) { + foreach($config['ezshaper']['step7'] as $key => $val) { + if (!is_array($othersplist[$key])) + continue; + foreach ($othersplist[$key] as $otherclient) { + $rule = array(); + $rule['type'] = "match"; + $rule['interface'] = $interfacelist; + switch ($val) { + case "H": + $rule['defaultqueue'] = 'qOthersHigh'; /* posted value H or L */ + if ($otherclient[1] == "tcp") $rule['ackqueue'] = 'qACK'; - $loop = 0; - break; - case "L": - $rule['defaultqueue'] = 'qOthersLow'; /* posted value H or L */ - if ($otherclient[1] == "tcp") - $rule['ackqueue'] = 'qACK'; - $loop = 0; - break; - case "D": - if ($p2pcatchall) { - $loop = 0; - $rule['defaultqueue'] = 'qOthersDefault'; - if ($otherclient[1] == "tcp") - $rule['ackqueue'] = 'qACK'; - } else - $loop = 1; /* It automitaclly goes to default queue */ - break; - default: - $loop = 1; - } - if (!$loop) { - $rule['source']['any'] = TRUE; - $rule['destination']['any'] = TRUE; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['descr'] = "m_Other {$otherclient[0]} outbound"; - - if($otherclient[2] or $otherclient[3]) { - $rule['destination']['port'] = $otherclient[2]."-".$otherclient[3]; - } - if($otherclient[1] != '') - $rule['protocol'] = $otherclient[1]; - - $config['filter']['rule'][] = $rule; - } + $loop = 0; + break; + case "L": + $rule['defaultqueue'] = 'qOthersLow'; /* posted value H or L */ + if ($otherclient[1] == "tcp") + $rule['ackqueue'] = 'qACK'; + $loop = 0; + break; + case "D": + if ($p2pcatchall) { + $loop = 0; + $rule['defaultqueue'] = 'qOthersDefault'; + if ($otherclient[1] == "tcp") + $rule['ackqueue'] = 'qACK'; + } else + $loop = 1; /* It automitaclly goes to default queue */ + break; + default: + $loop = 1; + } + if (!$loop) { + $rule['source']['any'] = TRUE; + $rule['destination']['any'] = TRUE; + $rule['floating'] = "yes"; + $rule['wizard'] = "yes"; + $rule['enabled'] = "on"; + $rule['descr'] = "m_Other {$otherclient[0]} outbound"; + + if($otherclient[2] or $otherclient[3]) { + $rule['destination']['port'] = $otherclient[2]."-".$otherclient[3]; } + if($otherclient[1] != '') + $rule['protocol'] = $otherclient[1]; + + $config['filter']['rule'][] = $rule; } } - write_config(); + } + } + write_config(); } function wizard_get_bandwidthtype_scale($type = "b") { diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc index 7ab8e69..9fdc3a3 100644 --- a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc @@ -451,6 +451,7 @@ function apply_all_choosen_items() { $altq_list_queues = array(); $steps = floatval($config['ezshaper']['step1']['numberofconnections']); + for ($i = 0; $i < $steps; $i++) { $tmppath = array(); @@ -1202,6 +1203,7 @@ function apply_all_choosen_items() { if( is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) { $rule = array(); $rule['type'] = "match"; + $rule['interface'] = "wan"; $rule['descr'] = gettext("Penalty Box"); $rule['source']['any'] = TRUE; $rule['defaultqueue'] = "qOthersLow"; @@ -1221,6 +1223,7 @@ function apply_all_choosen_items() { /* create VOIP rules */ $rule = array(); $rule['type'] = "match"; + $rule['interface'] = "wan"; $rule['descr'] = gettext("VOIP Adapter"); $rule['protocol'] = "udp"; $rule['defaultqueue'] = "qVoIP"; @@ -1235,6 +1238,7 @@ function apply_all_choosen_items() { /* create VOIP rules */ $rule = array(); $rule['type'] = "match"; + $rule['interface'] = "wan"; $rule['descr'] = "DiffServ/Lowdelay/Upload"; $rule['protocol'] = "udp"; $rule['source']['any'] = TRUE; @@ -1251,6 +1255,7 @@ function apply_all_choosen_items() { foreach ($voiplist[$config['ezshaper']['step3']['provider']] as $voip) { $rule = array(); $rule['type'] = "match"; + $rule['interface'] = "wan"; $rule['defaultqueue'] = 'qVoIP'; $rule['source']['any'] = TRUE; $rule['destination']['any'] = TRUE; @@ -1274,6 +1279,7 @@ function apply_all_choosen_items() { foreach ($p2plist[$key] as $p2pclient) { $rule = array(); $rule['type'] = "match"; + $rule['interface'] = "wan"; $rule['defaultqueue'] = 'qP2P'; $rule['source']['any'] = TRUE; $rule['destination']['any'] = TRUE; @@ -1296,6 +1302,7 @@ function apply_all_choosen_items() { foreach ($gamesplist[$key] as $Gameclient) { $rule = array(); $rule['type'] = "match"; + $rule['interface'] = "wan"; $rule['defaultqueue'] = 'qGames'; if ($Gameclient[1] == "tcp") $rule['ackqueue'] = 'qACK'; @@ -1321,6 +1328,7 @@ function apply_all_choosen_items() { foreach ($othersplist[$key] as $otherclient) { $rule = array(); $rule['type'] = "match"; + $rule['interface'] = "wan"; switch ($val) { case "H": $rule['defaultqueue'] = 'qOthersHigh'; /* posted value H or L */ -- cgit v1.1