Changeset 798


Ignore:
Timestamp:
Feb 6, 2016, 8:04:17 PM (9 years ago)
Author:
chronos
Message:
  • Fixed: Don't include unused network devices addresses in DNS server records.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/NetworkConfigLinux/Generators/DNS.php

    r790 r798  
    155155    $MinimumTime = 10800;
    156156    $TTL = 86400;
    157     //$BaseDir = '/var/named';
    158     $BaseDir = '/home/chronos/Projekty/centrala/trunk/var/named';
     157    $BaseDir = '/var/named';
     158    //$BaseDir = '/home/chronos/Projekty/centrala/trunk/var/named';
    159159    if(!file_exists($BaseDir)) die('Base directory "'.$BaseDir.'" not exists.');
    160160    $MailServer = 'centrala';
     
    183183
    184184    // Local records
    185     $DbResult = $this->Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface '.
    186         'JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE NetworkInterface.LocalIP <> ""');
     185    $DbResult = $this->Database->query('SELECT `NetworkInterface`.*, `NetworkDevice`.`Name` AS `DeviceName` '.
     186      'FROM `NetworkInterface` '.
     187      'JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` '.
     188      'WHERE (`NetworkInterface`.`LocalIP` <> "") AND (`NetworkDevice`.`Used` = 1)');
    187189    while($Interface = $DbResult->fetch_assoc())
    188190    {
     
    194196
    195197    // External IPv4 records in internal server
    196     $DbResult = $this->Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface '.
    197         'JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE NetworkInterface.ExternalIP <> ""');
     198    $DbResult = $this->Database->query('SELECT `NetworkInterface`.*, `NetworkDevice`.`Name` AS `DeviceName` FROM `NetworkInterface` '.
     199        'JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` '.
     200        'WHERE (`NetworkInterface`.`ExternalIP` <> "") AND (`NetworkDevice`.`Used` = 1)');
    198201    while($Interface = $DbResult->fetch_assoc())
    199202    {
     
    243246    );
    244247
    245     $DbResult = $this->Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface '.
    246         'JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE NetworkInterface.ExternalIP != ""');
     248    $DbResult = $this->Database->query('SELECT `NetworkInterface`.*, `NetworkDevice`.`Name` AS `DeviceName` FROM `NetworkInterface` '.
     249        'JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` WHERE '.
     250        '(`NetworkInterface`.`ExternalIP` != "") AND (`NetworkDevice`.`Used` = 1)');
    247251    while($Interface = $DbResult->fetch_assoc())
    248252    {
     
    254258
    255259    // Domain alias
    256     $DbResult = $this->Database->query('SELECT NetworkDomainAlias.* FROM `NetworkDomainAlias`');
     260    $DbResult = $this->Database->query('SELECT `NetworkDomainAlias`.* FROM `NetworkDomainAlias`');
    257261    // JOIN `NetworkDevice` ON NetworkDomainAlias.Target LIKE NetworkDevice.Name AND NetworkInterface.ExternalIP != ""');
    258262    while($Alias = $DbResult->fetch_assoc())
     
    285289
    286290    // Hosts
    287     $DbResult = $this->Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface '.
    288         'JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE NetworkInterface.LocalIP != ""');
     291    $DbResult = $this->Database->query('SELECT `NetworkInterface`.*, `NetworkDevice`.`Name` AS `DeviceName` FROM `NetworkInterface` '.
     292        'JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` '.
     293        'WHERE (`NetworkInterface`.`LocalIP` != "") AND (`NetworkDevice`.`Used` = 1)');
    289294    while($Interface = $DbResult->fetch_assoc())
    290295    {
     
    295300
    296301    // Domain alias
    297     $DbResult = $this->Database->query('SELECT NetworkDomainAlias.* FROM `NetworkDomainAlias`');
     302    $DbResult = $this->Database->query('SELECT `NetworkDomainAlias`.* FROM `NetworkDomainAlias`');
    298303    // JOIN `hosts` ON NetworkDomainAlias.Target LIKE hosts.name AND hosts.czfree_ip != ""');
    299304    while($Alias = $DbResult->fetch_assoc())
     
    325330
    326331    // Hosts
    327     $DbResult = $this->Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface '.
    328         'JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE NetworkInterface.LocalIP != ""');
     332    $DbResult = $this->Database->query('SELECT `NetworkInterface`.*, `NetworkDevice`.`Name` AS `DeviceName` FROM `NetworkInterface` '.
     333        'JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` WHERE `NetworkInterface`.`LocalIP` != ""');
    329334    while($Interface = $DbResult->fetch_assoc())
    330335    {
     
    336341
    337342    // Domain alias
    338     $DbResult = $this->Database->query('SELECT NetworkDomainAlias.* FROM `NetworkDomainAlias`');
     343    $DbResult = $this->Database->query('SELECT `NetworkDomainAlias`.* FROM `NetworkDomainAlias`');
    339344    // JOIN `hosts` ON NetworkDomainAlias.Target LIKE hosts.name AND hosts.czfree_ip != ""');
    340345    while($Alias = $DbResult->fetch_assoc())
Note: See TracChangeset for help on using the changeset viewer.