added client::ip_from_mac with database upgrade so that macs are now symlinks
[pxelator] / lib / PXElator / dhcpd.pm
index b4931a6..b9b5774 100644 (file)
@@ -44,14 +44,13 @@ sub client_ip {
 
        my $ip;
 
-       if ( -e "$conf/mac/$mac" ) {
-               $ip = read_file "$conf/mac/$mac";
+       if ( $ip = client::ip_from_mac( $mac ) ) {
                print "RENEW $mac $ip\n";
                return $ip;
        } else {
                $ip = client::next_ip;
                print "NEW $mac $ip\n";
-               write_file "$conf/mac/$mac", $ip;
+               symlink "$conf/ip/$ip", "$conf/mac/$mac";
        }
 
        my $ip_path = "$conf/ip/$ip";