Changeset 276


Ignore:
Timestamp:
Jan 24, 2010, 9:21:28 AM (15 years ago)
Author:
george
Message:
  • Opraveno: Výpočet IP rozsahu u generování nastavení sítě.
Location:
trunk/system/generators
Files:
2 edited

Legend:

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

    r275 r276  
    44include('../../global.php');
    55include('../routerboard.php');
     6include('common.php');
    67$Path = array('ip', 'firewall', 'nat');
    78
     
    4041    $NewAddress->Prefix = $Subnet['ExtMask'];
    4142    $Range = $NewAddress->GetRange();
    42     if($Subnet['ExtMask'] != 32) $Range = $Range['From'].'-'.$Range['To'];
    43       else $Range = $Range['From'];
     43    if($Subnet['ExtMask'] != 32) $Range = $Range['From']->AddressToStrin().'-'.$Range['To']->AddressToString();
     44      else $Range = $Range['From']->AddressToString();
    4445    if($Subnet['Mask'] == 32) $Src = $Subnet['AddressRange'];
    4546      else $Src = $Subnet['AddressRange'].'/'.$Subnet['Mask'];
     
    5051    $NewAddress->Prefix = $Subnet['Mask'];
    5152    $Range = $NewAddress->GetRange();
    52     if($Subnet['Mask'] != 32) $Range = $Range['From'].'-'.$Range['To'];
    53       else $Range = $Range['From'];
     53    if($Subnet['Mask'] != 32) $Range = $Range['From']->AddressToString().'-'.$Range['To']->AddressToString();
     54      else $Range = $Range['From']->AddressToString();
    5455    if($Subnet['ExtMask'] == 32) $Dest = $Subnet['ExtAddressRange'];
    5556      else $Dest = $Subnet['ExtAddressRange'].'/'.$Subnet['ExtMask'];
     
    6566$Items[] = array('chain' => 'dstnat', 'dst-address' => '212.111.4.174', 'protocol' => 'udp', 'dst-port' => 53, 'in-interface' => $InetInterface, 'action' => 'dst-nat', 'to-addresses' => '10.145.64.8', 'to-ports' => 53, 'comment' => 'DNS_redirection_UDP');
    6667
     68//print_r($Items);
    6769$Routerboard->ListUpdate($Path, array('chain', 'dst-address', 'in-interface', 'src-address', 'out-interface', 'to-ports', 'dst-port', 'protocol', 'action', 'to-addresses', 'comment'), $Items);
    6870
  • trunk/system/generators/netwatch_import.php

    r275 r276  
    44include('../../global.php');
    55include('../routerboard.php');
     6include('common.php');
    67$Path = array('tool', 'netwatch');
    78
     
    1718  foreach($List as $Properties)
    1819  {
    19     $NewAddress = new NetworkAddressIPv4();
    20     $NewAddress->AddressFromString($Subnet['AddressRange']);
    21     $NewAddress->Prefix = $Subnet['Mask'];
    22     if($NewAddress->Contain($Properties['host']))
     20    $SubnetAddress = new NetworkAddressIPv4();
     21    $SubnetAddress->AddressFromString($Subnet['AddressRange']);
     22    $SubnetAddress->Prefix = $Subnet['Mask'];
     23    $Address = new NetworkAddressIPv4();
     24    $Address->AddressFromString($Properties['host']);
     25    $Address->Prefix = 32;
     26    if($SubnetAddress->Contain($Address))
    2327    {
    2428      //echo($Properties['host'].', ');
Note: See TracChangeset for help on using the changeset viewer.