* settings in a DHCP message.
*/
protected void doConfigure(DHCPMessage msg) throws IOException {
super.doConfigure(msg);
final IPv4ConfigurationService cfg;
try {
cfg = InitialNaming.lookup(IPv4ConfigurationService.NAME);
} catch (NameNotFoundException ex) {
throw new NetworkException(ex);
}
BOOTPHeader hdr = msg.getHeader();
cfg.configureDeviceStatic(device, new IPv4Address(hdr
.getYourIPAddress()), null, false);
final IPv4Address serverAddr = new IPv4Address(hdr.getServerIPAddress());
final IPv4Address networkAddress = serverAddr.and(serverAddr.getDefaultSubnetmask());
if (hdr.getGatewayIPAddress().isAnyLocalAddress()) {
cfg.addRoute(serverAddr, null, device, false);
cfg.addRoute(networkAddress, null, device, false);
} else {
cfg.addRoute(networkAddress, new IPv4Address(hdr.getGatewayIPAddress()), device, false);
}
byte[] routerValue = msg.getOption(DHCPMessage.ROUTER_OPTION);
if (routerValue != null && routerValue.length >= 4) {
IPv4Address routerIP = new IPv4Address(routerValue, 0);
log.info("Got Router IP address : " + routerIP);
cfg.addRoute(IPv4Address.ANY, routerIP, device, false);
}
// find the dns servers and add to the resolver
final byte[] dnsValue = msg.getOption(DHCPMessage.DNS_OPTION);
if (dnsValue != null) {