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;
46 my $mac = client::conf( $ip, 'mac' );
47 return '' unless $mac;
48 $mac =~ s{(..)}{$1:}g;
50 $mac = qq|<tt>$mac</tt>| if (caller(1))[3] =~ m{^httpd} && $op ne 'clean';
56 my $p = Net::Ping->new;
58 my $prefix = $server::ip;
59 $prefix =~ s{\.\d+$}{.};
60 my $addr = $server::ip_from || die;
61 my $ip = $prefix . $addr;
63 while ( -e "$server::conf/ip/$ip" || $p->ping( $ip, 0.7 ) ) {
64 $ip = $prefix . $addr++;
65 die "all addresses allocated!" if $addr == $server::ip_to;