Changeset 932 for trunk


Ignore:
Timestamp:
May 11, 2022, 4:54:11 PM (3 years ago)
Author:
chronos
Message:
  • Fixed: Suppress warnings during checking network ports.
  • Fixed: Check network ports only for enabled devices and interfaces.
File:
1 edited

Legend:

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

    r887 r932  
    1010      else if ($Protocol == 'udp') $Prefix = 'udp://';
    1111      else throw new Exception('Unsupported protocol "'.$Protocol.'"');
    12     if ($Socket = @fsockopen($Prefix.$IP, $Port, $ErrorNumber, $ErrorString, $Timeout))
     12    try
    1313    {
    14       fclose($Socket);
    15       $State = 1;
     14      $LastErrorReporting = error_reporting();
     15      error_reporting(0);
     16      if ($Socket = @fsockopen($Prefix.$IP, $Port, $ErrorNumber, $ErrorString, $Timeout))
     17      {
     18        fclose($Socket);
     19        $State = 1;
     20      }
     21    }
     22    finally
     23    {
     24      error_reporting($LastErrorReporting);
    1625    }
    1726    return $State;
     
    2837      'FROM `NetworkPort` '.
    2938      'LEFT JOIN `NetworkInterface` ON `NetworkInterface`.`Id`=`NetworkPort`.`Interface` '.
    30       'WHERE (`NetworkPort`.`Enabled`=1) AND (`NetworkInterface`.`LocalIP` !="")');
     39      'LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id`=`NetworkInterface`.`Device` '.
     40      'WHERE (`NetworkPort`.`Enabled`=1) AND (`NetworkInterface`.`LocalIP` !="") AND (`NetworkInterface`.`Enabled`=1) AND'.
     41      '(`NetworkDevice`.`Used`=1)');
    3142    while ($DbRow = $DbResult->fetch_assoc())
    3243      $Ports[$DbRow['Id']] = $DbRow;
Note: See TracChangeset for help on using the changeset viewer.