Changeset 188


Ignore:
Timestamp:
Apr 5, 2009, 5:06:25 PM (16 years ago)
Author:
george
Message:
  • Opraveno: Generování nastavení routerů.
Location:
trunk/system/generators
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/system/generators/nat_routerboard.php

    r187 r188  
    3030    $Range = CIDRToAddressRange($Subnet['ExtAddressRange'], $Subnet['ExtMask']);
    3131    $Range = $Range['From'].'-'.$Range['To'];
    32     $Commands[] = ' /ip firewall nat add chain=srcnat src-address-list='.$Subnet['AddressRange'].'/'.$Subnet['Mask'].' out-interface='.$InetInterface.' action=src-nat to-addresses='.$Range.' comment="'.$Subnet['Name'].'"';
     32    $Commands[] = ' /ip firewall nat add chain=srcnat src-address='.$Subnet['AddressRange'].'/'.$Subnet['Mask'].' out-interface='.$InetInterface.' action=src-nat to-addresses='.$Range.' comment="'.$Subnet['Name'].'"';
    3333    $Range = CIDRToAddressRange($Subnet['AddressRange'], $Subnet['Mask']);
    3434    $Range = $Range['From'].'-'.$Range['To'];
    35     $Commands[] = ' /ip firewall nat add chain=dstnat dst-address-list='.$Subnet['ExtAddressRange'].'/'.$Subnet['ExtMask'].' in-interface='.$InetInterface.' action=dst-nat to-addresses='.$Range.' comment="'.$Subnet['Name'].'"';
     35    $Commands[] = ' /ip firewall nat add chain=dstnat dst-address='.$Subnet['ExtAddressRange'].'/'.$Subnet['ExtMask'].' in-interface='.$InetInterface.' action=dst-nat to-addresses='.$Range.' comment="'.$Subnet['Name'].'"';
    3636  }
    3737  echo("\n");
     
    4747$Command = '/usr/bin/ssh -l '.$Config['MainRouter']['UserName'].' -i id_dsa '.$Config['MainRouter']['HostName'].' "'.$Commands.'"';
    4848$Output = array();
    49 echo($Command."\n");
     49//echo($Command."\n");
    5050exec($Command, $Output);
    5151//array_pop($Output);
  • trunk/system/generators/netwatch.php

    r187 r188  
    1414    $I = explode('.', $Subnet['AddressRange']);
    1515    $I = $I[2];
    16     $DbResult2 = $Database->query('SELECT * FROM hosts WHERE (IP LIKE "192.168.'.$I.'.%") AND (MAC != "00:00:00:00:00:00") ORDER BY IP');
     16    $DbResult2 = $Database->query('SELECT * FROM hosts WHERE (IP LIKE "192.168.'.$I.'.%") ORDER BY IP');
    1717    while($Host = $DbResult2->fetch_assoc())
    1818    {
  • trunk/system/generators/traffic_shaping_routerboard.php

    r187 r188  
    4444while($Subnet = $DbResult->fetch_assoc())
    4545{
    46   $Commands[] = ' /ip firewall mangle add chain=inet-out src-address='.$Subnet['AddressRange'].'/'.$Subnet['Mask'].' out-interface='.$InetInterface.' action=jump jump-target=inet-out-'.$Subnet['Id'];
    47   $Commands[] = ' /ip firewall mangle add chain=inet-in dst-address='.$Subnet['AddressRange'].'/'.$Subnet['Mask'].' in-interface='.$InetInterface.' action=jump jump-target=inet-in-'.$Subnet['Id'];
     46  $SubnetParts = explode('.', $Subnet['AddressRange']);
     47  $SubnetNumber = $SubnetParts[2];
     48  $Commands[] = ' /ip firewall mangle add chain=inet-out src-address='.$Subnet['AddressRange'].'/'.$Subnet['Mask'].' out-interface='.$InetInterface.' action=jump jump-target=inet-out-'.$SubnetNumber;
     49  $Commands[] = ' /ip firewall mangle add chain=inet-in dst-address='.$Subnet['AddressRange'].'/'.$Subnet['Mask'].' in-interface='.$InetInterface.' action=jump jump-target=inet-in-'.$SubnetNumber;
    4850}
    4951
     
    7375  $Commands[] = ' /queue tree add name='.$Member['Name'].'-in limit-at='.$SpeedOut.' max-limit='.$UserMaxSpeedOut.' parent=main-in queue=wireless-default';
    7476
    75   $DbResult2 = $Database->select('hosts', 'COUNT(*)', '(block = 0) AND (MAC != "") AND (user = '.$Member['Id'].')');
     77  $DbResult2 = $Database->select('hosts', 'COUNT(*)', '(block = 0) AND (MAC != "")');
    7678  $Row = $DbResult2->fetch_array();
    7779  $HostCount = $Row[0];
Note: See TracChangeset for help on using the changeset viewer.