/[mdap]/lib/MDAP/ChangeIP.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/MDAP/ChangeIP.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 58 by dpavlin, Fri Nov 16 19:12:08 2007 UTC revision 82 by dpavlin, Fri Nov 23 00:48:49 2007 UTC
# Line 10  my $serial2ip = { Line 10  my $serial2ip = {
10          'CP0636JT3SH' => '192.168.1.242;10.0.0.1',          'CP0636JT3SH' => '192.168.1.242;10.0.0.1',
11          'CP0644JTHJ4' => '192.168.1.243;10.0.0.2',          'CP0644JTHJ4' => '192.168.1.243;10.0.0.2',
12          'CP0624BH55U' => '192.168.1.244;10.0.0.3',          'CP0624BH55U' => '192.168.1.244;10.0.0.3',
13            'CP0703KT3PP' => '10.0.0.4',
14  };  };
15    
 my $debug = 1;  
   
16  sub check {  sub check {
17          my ( $self, $h ) = @_;          my ( $self, $h ) = @_;
18    
# Line 40  sub check { Line 39  sub check {
39                                  warn "-- remove IP $current_ip\n" if $debug;                                  warn "-- remove IP $current_ip\n" if $debug;
40                                  return "ip ipdelete addr=$current_ip";                                  return "ip ipdelete addr=$current_ip";
41                          } elsif ( $ip_status->{$current_ip} > 0 ) {                          } elsif ( $ip_status->{$current_ip} > 0 ) {
42                                  warn "++ add IP $current_ip\n" if $debug;                                  my $mask = '';
43                                  return "ip ipadd intf=LocalNetwork addr=$current_ip";                                  $mask = '/8'  if $current_ip =~ m/^10\./;
44                                    $mask = '/24' if $current_ip =~ m/^192\.168\./;
45                                    warn "++ add IP $current_ip$mask\n" if $debug;
46                                    return "ip ipadd intf=LocalNetwork addr=$current_ip$mask";
47                          }                          }
48                  }                  }
49                  return;                  return;

Legend:
Removed from v.58  
changed lines
  Added in v.82

  ViewVC Help
Powered by ViewVC 1.1.26