// build properties map
Map properties = getProperties( subnet );
// update lease options
OptionsField o = lease.getOptions();
o.clear();
// add subnet settings
o.add( new SubnetMask( subnet.getNetmask() ) );
o.merge( subnet.getOptions() );
// check whether there is a designated host.
Host host = findDesignatedHost( hardwareAddress );
if ( null != host )
{
// check whether the host matches the address (using a fixed
// host address is mandatory).
if ( host.getAddress() != null && !host.getAddress().equals( lease.getClientAddress() ) )
{
logger.warn( "Existing fixed address for " + hardwareAddress + " conflicts with existing lease "
+ lease );
return null;
}
properties.putAll( getProperties( host ) );
// set (client) host name
o.add( new HostName( host.getName() ) );
// add the host's options
o.merge( host.getOptions() );
}
// update other lease fields
long leaseTime = determineLeaseTime( requestedLeaseTime, properties );
lease.setExpires( System.currentTimeMillis() + leaseTime );