* If DHCP reports DNS addresses, we'll now rewrite /etc/resolv.conf for now.
* minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19477 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
8b91b40ae6
commit
a552ec1396
@ -444,7 +444,7 @@ DHCPClient::DHCPClient(BMessenger target, const char* device)
|
|||||||
if (state != REQUESTING)
|
if (state != REQUESTING)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// try again
|
// try again (maybe we should prefer other servers if this happens more than once)
|
||||||
fStatus = _SendMessage(socket, discover, broadcast);
|
fStatus = _SendMessage(socket, discover, broadcast);
|
||||||
if (fStatus == B_OK)
|
if (fStatus == B_OK)
|
||||||
state = INIT;
|
state = INIT;
|
||||||
@ -492,11 +492,17 @@ DHCPClient::_ParseOptions(dhcp_message& message, BMessage& address)
|
|||||||
address.AddString("mask", _ToString(data));
|
address.AddString("mask", _ToString(data));
|
||||||
break;
|
break;
|
||||||
case OPTION_DOMAIN_NAME_SERVER:
|
case OPTION_DOMAIN_NAME_SERVER:
|
||||||
// TODO: for now, write it out to /etc/resolv.conf
|
{
|
||||||
|
// TODO: for now, we write it just out to /etc/resolv.conf
|
||||||
|
FILE* file = fopen("/etc/resolv.conf", "w");
|
||||||
for (uint32 i = 0; i < size / 4; i++) {
|
for (uint32 i = 0; i < size / 4; i++) {
|
||||||
printf("DNS: %s\n", _ToString(&data[i*4]).String());
|
printf("DNS: %s\n", _ToString(&data[i*4]).String());
|
||||||
|
if (file != NULL)
|
||||||
|
fprintf(file, "nameserver %s\n", _ToString(&data[i*4]).String());
|
||||||
}
|
}
|
||||||
|
fclose(file);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case OPTION_SERVER_ADDRESS:
|
case OPTION_SERVER_ADDRESS:
|
||||||
fServer.sin_addr.s_addr = *(in_addr_t*)data;
|
fServer.sin_addr.s_addr = *(in_addr_t*)data;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user