Changeset 288


Ignore:
Timestamp:
Sep 9, 2010, 7:29:41 PM (14 years ago)
Author:
george
Message:
  • Upraveno: Doplněno generování DNS pro další podsítě. * Opraveno: Generování firewall mangle pravidel pro podsítě domácností. * Přidáno: Generování pravidel pro NAT NTP serveru.
Location:
trunk/system/generators
Files:
4 edited

Legend:

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

    r267 r288  
    3535}
    3636
    37 function InsertToAddressTree(&$Tree, $Address, $Name, $InterSubnets = false)
     37function InsertToAddressTree(&$Tree, $Address, $Name, $InterSubnets = false, $ForceMark = false)
    3838{
    3939  global $Config;
     
    5757      $NewAddress->ChangePrefix($Tree['Address']->Prefix + 1);
    5858      //echo('InsertToTree('.$NewAddress->AddressToString().'/'.$NewAddress->Prefix.')'."\n");
    59       $Tree['Items'][] = array('Address' => $NewAddress, 'Name' => $Name, 'Items' => array());
     59      $Tree['Items'][] = array('Address' => $NewAddress, 'Name' => $Name, 'Items' => array(), 'ForceMark' => false);
    6060      InsertToAddressTree($Tree['Items'][count($Tree['Items']) - 1], $Address, $Name, true);
    6161    } else
    6262    {
    6363     
    64       $NewNode = array('Address' => $Address, 'Name' => $Name, 'Items' => array());
     64      $NewNode = array('Address' => $Address, 'Name' => $Name, 'Items' => array(), 'ForceMark' => $ForceMark);
    6565     
    6666      // Should be existed items placed under new node?
  • trunk/system/generators/dns.php

    r273 r288  
    114114  'Host' => array(),
    115115  'Alias' => array(),
    116   'Network' => array('10.145.64', '10.145.65', '10.145.66', '10.145.67', '77.92.221'),
     116  'Network' => array('10.145.64', '10.145.65', '10.145.66', '10.145.67', '10.145.68', '10.145.69', '10.145.70', '10.145.71', '77.92.221', '172.16.0', '172.16.1'),
    117117);
    118118
  • trunk/system/generators/firewall_mangle.php

    r280 r288  
    6464    $NewAddress->AddressFromString($Subnet['AddressRange']);
    6565    $NewAddress->Prefix = $Subnet['Mask'];
    66     InsertToAddressTree($AddressTree, $NewAddress, $Subnet['Name']);
     66    if($Subnet['Member'] != 0) $ForceMark = true;
     67      else $ForceMark = false;
     68    echo($ForceMark.', ');
     69    InsertToAddressTree($AddressTree, $NewAddress, $Subnet['Name'], false, $ForceMark);
    6770  }
    6871  echo("\n");
     
    7780  foreach($Node['Items'] as $Index => $Item)
    7881  {
    79     if(count($Item['Items']) == 0)
     82    if((count($Item['Items']) == 0) or ($Item['ForceMark'] == true))
    8083    {
    8184      // Hosts
  • trunk/system/generators/firewall_nat.php

    r280 r288  
    1515
    1616$Items = array();
     17// NTP redirect
     18$Items[] = array('chain' => 'srcnat', 'src-address' => '10.145.66.1', 'protocol' => 'udp', 'src-port' => 123, 'action' => 'src-nat', 'to-addresses' => '10.145.64.1', 'comment' => 'NTP_redirect_4');
     19$Items[] = array('chain' => 'srcnat', 'src-address' => '10.145.66.161', 'protocol' => 'udp', 'src-port' => 123, 'action' => 'src-nat', 'to-addresses' => '10.145.64.1', 'comment' => 'NTP_redirect_5');
     20$Items[] = array('chain' => 'srcnat', 'src-address' => '10.145.66.193', 'protocol' => 'udp', 'src-port' => 123, 'action' => 'src-nat', 'to-addresses' => '10.145.64.1', 'comment' => 'NTP_redirect_1');
     21$Items[] = array('chain' => 'srcnat', 'src-address' => '10.145.66.225', 'protocol' => 'udp', 'src-port' => 123, 'action' => 'src-nat', 'to-addresses' => '10.145.64.1', 'comment' => 'NTP_redirect_2');
     22$Items[] = array('chain' => 'srcnat', 'src-address' => '10.145.66.250', 'protocol' => 'udp', 'src-port' => 123, 'action' => 'src-nat', 'to-addresses' => '10.145.64.1', 'comment' => 'NTP_redirect_3');
     23$Items[] = array('chain' => 'srcnat', 'src-address' => '10.145.66.253', 'protocol' => 'udp', 'src-port' => 123, 'action' => 'src-nat', 'to-addresses' => '10.145.64.1', 'comment' => 'NTP_redirect_6');
     24
    1725// Chain for inet interface
    1826$Items[] = array('chain' => 'srcnat', 'out-interface' => $InetInterface, 'action' => 'jump', 'jump-target' => 'inet-out', 'comment' => 'inet-out');
     
    7583
    7684//print_r($Items);
    77 $Routerboard->ListUpdate($Path, array('chain', 'dst-address', 'in-interface', 'src-address', 'out-interface', 'to-ports', 'dst-port', 'protocol', 'action', 'to-addresses', 'comment', 'jump-target'), $Items);
     85$Routerboard->ListUpdate($Path, array('chain', 'dst-address', 'in-interface', 'src-address', 'out-interface', 'to-ports', 'dst-port', 'protocol', 'action', 'to-addresses', 'comment', 'jump-target', 'src-port'), $Items);
    7886
    7987?>
Note: See TracChangeset for help on using the changeset viewer.