14 my ( $default, $value );
17 } elsif ( $#_ == 1 && $_[0] eq 'default' ) {
21 my $path ="$server::conf/ip/$ip";
22 mkdir $path unless -d $path;
25 if ( defined $value ) {
26 write_file $path, $value;
27 warn "update $path = $value";
28 } elsif ( ! -e $path && defined $default ) {
29 write_file $path, $default;
30 warn "default $path = $default";
32 } elsif ( -e $path ) {
34 $value = readlink $path;
35 $value =~ s{.*/([^/]+)$}{$1};
37 $value = read_file $path;
45 my $mac = client::conf( $ip, 'mac' );
46 $mac =~ s{(..)}{$1:}g;
48 $mac = qq|<tt>$mac</tt>| if (caller(1))[3] =~ m{^httpd};
54 my $p = Net::Ping->new;
56 my $prefix = $server::ip;
57 $prefix =~ s{\.\d+$}{.};
58 my $addr = $server::ip_from || die;
59 my $ip = $prefix . $addr;
61 while ( -e "$server::conf/ip/$ip" || $p->ping( $ip, 0.7 ) ) {
62 $ip = $prefix . $addr++;
63 die "all addresses allocated!" if $addr == $server::ip_to;