48 |
print "RENEW $mac $ip\n"; |
print "RENEW $mac $ip\n"; |
49 |
return $ip; |
return $ip; |
50 |
} else { |
} else { |
51 |
$ip = client::next_ip; |
$ip = client::next_ip( $mac ); |
52 |
print "NEW $mac $ip\n"; |
print "NEW $mac $ip\n"; |
|
symlink "$conf/ip/$ip", "$conf/mac/$mac"; |
|
53 |
} |
} |
54 |
|
|
|
my $ip_path = "$conf/ip/$ip"; |
|
|
mkdir $ip_path unless -e $ip_path; |
|
|
|
|
|
if ( -l "$ip_path/mac" && readlink "$ip_path/mac" ne "$conf/mac/$mac" ) { |
|
|
warn "$mac IP changed from ", readlink "$ip_path/mac", " to $ip"; |
|
|
unlink "$ip_path/mac"; |
|
|
}; |
|
|
|
|
|
symlink "$conf/mac/$mac", "$ip_path/mac"; |
|
|
|
|
55 |
return $ip; |
return $ip; |
56 |
} |
} |
57 |
|
|
84 |
my $mac = substr($dhcp->chaddr(),0,$dhcp->hlen()*2); |
my $mac = substr($dhcp->chaddr(),0,$dhcp->hlen()*2); |
85 |
my $ip = client_ip($mac); |
my $ip = client_ip($mac); |
86 |
|
|
87 |
|
my $hostname = $dhcp->getOptionValue(DHO_HOST_NAME); |
88 |
|
print "$ip ", client::conf( $ip => 'hostname', default => $hostname ), " >> /etc/hosts\n"; |
89 |
|
|
90 |
=for later |
=for later |
91 |
|
|
92 |
my $user_class = $dhcp->getOptionValue(DHO_USER_CLASS()); |
my $user_class = $dhcp->getOptionValue(DHO_USER_CLASS()); |