1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

Changeset 3705

Show
Ignore:
Timestamp:
10/18/09 09:39:34 (5 years ago)
Author:
owes
Message:

Add and use getredinterface function, to help avoid reading red/iface in multiple places.

Location:
ipcop/trunk/src
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • ipcop/trunk/src/libs/DataAccess.pl

    r3662 r3705  
    458458    } 
    459459 
    460     if (-e "/var/ipcop/red/iface") { 
    461         my $red_iface = `cat /var/ipcop/red/iface`; 
     460    my $red_iface = &General::getredinterface(); 
     461    if ($red_iface ne '') { 
     462         
    462463        $ifaces->{'Red'}{'IFACE'} = $red_iface; 
    463464        $ifaces->{'Red'}{'ID'}    = 'RED_1'; 
  • ipcop/trunk/src/libs/general-functions.pl

    r3704 r3705  
    744744    } 
    745745    return $ip; 
     746} 
     747 
     748# 
     749# Get Interface from /var/ipcop/red/iface, return "" if none 
     750# 
     751sub getredinterface 
     752{ 
     753    my $iface = ''; 
     754     
     755    if (open(IFACE, "/var/ipcop/red/iface")) { 
     756        $iface = <IFACE>; 
     757        close IFACE; 
     758        chomp($iface); 
     759        $iface =~ /([a-zA-Z0-9_\-]*)/; 
     760        $iface = $1; 
     761    } 
     762     
     763    return $iface; 
    746764} 
    747765 
  • ipcop/trunk/src/libs/header.pl

    r3421 r3705  
    507507        || $netsettings{'RED_1_TYPE'} eq 'DHCP') 
    508508    { 
    509         if (open(IFACE, "${General::swroot}/red/iface")) { 
    510             $iface = <IFACE>; 
    511             close IFACE; 
    512             chomp($iface); 
    513             $iface =~ /([a-zA-Z0-9_\-]*)/; 
    514             $iface = $1; 
    515         } 
     509        $iface = &General::getredinterface(); 
    516510    } 
    517511 
  • ipcop/trunk/src/rc.d/rc.red

    r3631 r3705  
    249249} 
    250250elsif ($ARGV[0] eq 'stop') { 
    251     if (open(IFACE, "/var/ipcop/red/iface")) { 
    252         $iface = <IFACE>; 
    253         close IFACE; 
    254         chomp($iface); 
    255         $iface =~ /([a-zA-Z0-9_\-]*)/; 
    256         $iface = $1; 
    257     } 
     251    $iface = &General::getredinterface(); 
    258252 
    259253    my $device;