Ignore:
Timestamp:
Apr 14, 2015, 10:20:16 PM (10 years ago)
Author:
chronos
Message:
  • Removed: Spaces on end of line.
  • Modified: Tabs converted to spaces.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/NetworkConfigRouterOS/Generators/FirewallNAT.php

    r735 r738  
    3434
    3535// Skip local subnet
    36 //$Items[] = array('chain' => 'inet-out', 'dst-address' => '172.16.1.1/30', 'action' => 'accept', 'comment' => 'Local_subnet');     
     36//$Items[] = array('chain' => 'inet-out', 'dst-address' => '172.16.1.1/30', 'action' => 'accept', 'comment' => 'Local_subnet');
    3737//$Items[] = array('chain' => 'inet-in', 'dst-address' => '172.16.1.1/30', 'action' => 'accept', 'comment' => 'Local_subnet');
    3838
     
    4646  $DbResult2 = $System->Database->query('SELECT `NetworkInterface`.*, `NetworkDevice`.`Name` AS `DeviceName`, `NetworkDevice`.`InboundNATPriority` FROM `NetworkInterface`'.
    4747  ' LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` WHERE (`NetworkInterface`.`ExternalIP` <> "")'.
    48   ' AND (`NetworkInterface`.`LocalIP` <> "")'. 
     48  ' AND (`NetworkInterface`.`LocalIP` <> "")'.
    4949  ' AND (`NetworkDevice`.`Member` = '.$Member['Id'].') AND (`NetworkInterface`.`LocalIP` != `NetworkInterface`.`ExternalIP`) ORDER BY `id` DESC');
    5050  while($Interface = $DbResult2->fetch_assoc())
     
    5757    {
    5858      $Items[] = array('chain' => 'inet-out', 'src-address' => $Interface['LocalIP'], 'action' => 'src-nat',  'to-addresses' => $Interface['ExternalIP'], 'comment' => $Name.'-out');
    59       if($Interface['InboundNATPriority'] > 0) 
     59      if($Interface['InboundNATPriority'] > 0)
    6060        $Items[] = array('chain' => 'inet-in', 'dst-address' => $Interface['ExternalIP'], 'action' => 'dst-nat', 'to-addresses' => $Interface['LocalIP'], 'comment' => $Name.'-in');
    61     } else 
     61    } else
    6262    {
    6363      $Items[] = array('chain' => 'dstnat', 'src-address' => $Interface['LocalIP'], 'protocol' => 'tcp', 'dst-port' => 80, 'action' => 'dst-nat',  'to-addresses' => $IPCentrala, 'to-ports' => 81, 'comment' => $Name.'-out');
     
    6868  $DbResult2 = $System->Database->select('NetworkSubnet', '*', '`Member`='.$Member['Id']);
    6969  while($Subnet = $DbResult2->fetch_assoc())
    70   {   
     70  {
    7171    $Subnet['Name'] = RouterOSIdent('subnet-'.$Subnet['Name']);
    7272    echo($Subnet['Name'].'('.$Subnet['AddressRange'].'/'.$Subnet['Mask'].'), ');
     
    8282        else $Src = $Subnet['AddressRange'].'/'.$Subnet['Mask'];
    8383      $Items[] = array('chain' => 'inet-out', 'src-address' => $Src, 'action' => 'src-nat', 'to-addresses' => $Range, 'comment' => $Subnet['Name'].'-out');
    84    
     84
    8585      $NewAddress = new NetworkAddressIPv4();
    8686      $NewAddress->AddressFromString($Subnet['AddressRange']);
     
    114114
    115115// Accept free-access clients
    116 $Items[] = array('chain' => 'dstnat', 'dst-address' => '!10.145.0.0/16', 
    117         'src-address-list' => 'free-access', 'in-interface' => $LocalInterface,
    118         'action' => 'accept', 'comment' => 'Free_access');
     116$Items[] = array('chain' => 'dstnat', 'dst-address' => '!10.145.0.0/16',
     117  'src-address-list' => 'free-access', 'in-interface' => $LocalInterface,
     118  'action' => 'accept', 'comment' => 'Free_access');
    119119// Redirect unregistred clients to free access activation page
    120 $Items[] = array('chain' => 'dstnat', 'dst-address' => '!10.145.0.0/16', 
    121         'src-address-list' => 'unregistred', 'in-interface' => $LocalInterface,
    122         'action' => 'dst-nat', 'to-addresses' => '10.145.64.8', 'to-ports' => 82, 'comment' => 'Redirect_unregistred');
     120$Items[] = array('chain' => 'dstnat', 'dst-address' => '!10.145.0.0/16',
     121  'src-address-list' => 'unregistred', 'in-interface' => $LocalInterface,
     122  'action' => 'dst-nat', 'to-addresses' => '10.145.64.8', 'to-ports' => 82, 'comment' => 'Redirect_unregistred');
    123123
    124124/*
Note: See TracChangeset for help on using the changeset viewer.