Ignore:
Timestamp:
May 6, 2009, 8:21:23 AM (16 years ago)
Author:
george
Message:
  • Upraveno: Tabulka hosts rozdělena na NetworkDevice, NetworkInterface, NetworkInterfaceType a NetworkLink. Jeden počítač může mít více rozhraní. Nově se již nepočítá pouze s stromovou topologií, ale s celkovou sítí s okruhy. Sloupce Parent byl proto nahrazen tabulkou NetworkLink, ve které jsou uchovány informace o tom, co kam je připojeno. Každé rozhraní má definovaný typ dle NetworkInterfaceType.
  • Upraveno: Tabulka HostType přejmenována na NetworkDeviceType.
  • Smazáno: Původní složka komunikačního programu sunrisechat. Nově nahrazena složkou chat pro podporu IRC.
File:
1 edited

Legend:

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

    r197 r208  
    1414  echo($Member['Name'].': ');
    1515  // Hosts
    16   $DbResult2 = $Database->select('hosts', '*', '(external_ip <> "") AND (user='.$Member['Id'].') AND (IP != external_ip) ORDER BY id DESC');
    17   while($Host = $DbResult2->fetch_assoc())
     16  $DbResult2 = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface LEFT JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE (NetworkInterface.ExternalIP <> "") AND (NetworkDevice.Member = '.$Member['Id'].') AND (NetworkInterface.LocalIP != NetworkInterface.ExternalIP) ORDER BY id DESC');
     17  while($Interface = $DbResult2->fetch_assoc())
    1818  {
    19     $Host['name'] = RouterOSIdent($Host['name']);
    20     echo($Host['name'].'('.$Host['IP'].'), ');
    21     $Commands[] = ' /ip firewall nat add chain=srcnat src-address='.$Host['IP'].' out-interface='.$InetInterface.' action=src-nat to-addresses='.$Host['external_ip'].' comment="'.$Host['name'].'"';
    22     $Commands[] = ' /ip firewall nat add chain=dstnat dst-address='.$Host['external_ip'].' in-interface='.$InetInterface.' action=dst-nat to-addresses='.$Host['IP'].' comment="'.$Host['name'].'"';
     19    $Name = $Interface['DeviceName'].'-'.$Interface['Name'];
     20    $Name = RouterOSIdent($Name);
     21    echo($Name.'('.$Interface['LocalIP'].'), ');
     22    $Commands[] = ' /ip firewall nat add chain=srcnat src-address='.$Interface['LocalIP'].' out-interface='.$InetInterface.' action=src-nat to-addresses='.$Interface['ExternalIP'].' comment="'.$Name.'"';
     23    $Commands[] = ' /ip firewall nat add chain=dstnat dst-address='.$Interface['ExternalIP'].' in-interface='.$InetInterface.' action=dst-nat to-addresses='.$Interface['LocalIP'].' comment="'.$Name.'"';
    2324  }
    2425
Note: See TracChangeset for help on using the changeset viewer.