offer = host_create_from_chunk(AF_INET,
chunk_from_thing(dhcp->your_address), 0);
- server = host_create_from_chunk(AF_INET,
- chunk_from_thing(dhcp->server_address), DHCP_SERVER_PORT);
this->mutex->lock(this->mutex);
enumerator = this->discover->create_enumerator(this->discover);
{
if (transaction->get_id(transaction) == dhcp->transaction_id)
{
- DBG1(DBG_CFG, "received DHCP OFFER %H from %H", offer, server);
this->discover->remove_at(this->discover, enumerator);
this->request->insert_last(this->request, transaction);
- transaction->set_address(transaction, offer->clone(offer));
- transaction->set_server(transaction, server->clone(server));
break;
}
}
chunk_create((char*)&option->data[pos], 4));
}
}
+ if (option->type == DHCP_SERVER_ID && option->len == 4)
+ {
+ server = host_create_from_chunk(AF_INET,
+ chunk_create(option->data, 4), DHCP_SERVER_PORT);
+ }
optlen -= optsize;
optpos += optsize;
}
+ if (!server)
+ {
+ server = host_create_from_chunk(AF_INET,
+ chunk_from_thing(dhcp->server_address), DHCP_SERVER_PORT);
+ }
+ DBG1(DBG_CFG, "received DHCP OFFER %H from %H", offer, server);
+ transaction->set_address(transaction, offer->clone(offer));
+ transaction->set_server(transaction, server->clone(server));
}
this->mutex->unlock(this->mutex);
this->condvar->broadcast(this->condvar);