* removed unnecessary whitespaces, small style cleanups
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22365 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -40,7 +40,6 @@ Settings::Settings(const char *name)
|
||||
Settings::~Settings()
|
||||
{
|
||||
close(fSocket);
|
||||
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -62,7 +61,6 @@ Settings::_PrepareRequest(struct ifreq& request)
|
||||
void
|
||||
Settings::ReadConfiguration()
|
||||
{
|
||||
|
||||
ifreq request;
|
||||
if (!_PrepareRequest(request))
|
||||
return;
|
||||
@@ -72,16 +70,14 @@ Settings::ReadConfiguration()
|
||||
sockaddr_in* inetAddress = NULL;
|
||||
|
||||
// Obtain IP.
|
||||
if (ioctl(fSocket, SIOCGIFADDR, &request,
|
||||
sizeof(request)) < 0) {
|
||||
if (ioctl(fSocket, SIOCGIFADDR, &request, sizeof(request)) < 0)
|
||||
return;
|
||||
}
|
||||
|
||||
inetAddress = (sockaddr_in*)&request.ifr_addr;
|
||||
if (inet_ntop(AF_INET, &inetAddress->sin_addr, address,
|
||||
sizeof(address)) == NULL) {
|
||||
return;
|
||||
}
|
||||
sizeof(address)) == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
fIP = address;
|
||||
|
||||
@@ -93,15 +89,13 @@ Settings::ReadConfiguration()
|
||||
|
||||
inetAddress = (sockaddr_in*)&request.ifr_mask;
|
||||
if (inet_ntop(AF_INET, &inetAddress->sin_addr, address,
|
||||
sizeof(address)) == NULL) {
|
||||
return;
|
||||
}
|
||||
sizeof(address)) == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
fNetmask = address;
|
||||
|
||||
// Obtain gateway
|
||||
|
||||
char* gwAddress;
|
||||
ifconf config;
|
||||
config.ifc_len = sizeof(config.ifc_value);
|
||||
if (ioctl(fSocket, SIOCGRTSIZE, &config, sizeof(struct ifconf)) < 0)
|
||||
@@ -129,13 +123,9 @@ Settings::ReadConfiguration()
|
||||
while (interface < end) {
|
||||
route_entry& route = interface->ifr_route;
|
||||
|
||||
|
||||
if (route.flags & RTF_GATEWAY) {
|
||||
inetAddress = (sockaddr_in *)route.gateway;
|
||||
|
||||
|
||||
gwAddress = inet_ntoa(inetAddress->sin_addr);
|
||||
fGateway = gwAddress;
|
||||
inetAddress = (sockaddr_in*)route.gateway;
|
||||
fGateway = inet_ntoa(inetAddress->sin_addr);
|
||||
}
|
||||
|
||||
int32 addressSize = 0;
|
||||
@@ -148,20 +138,13 @@ Settings::ReadConfiguration()
|
||||
|
||||
interface = (ifreq *)((addr_t)interface +
|
||||
IF_NAMESIZE + sizeof(route_entry) + addressSize);
|
||||
|
||||
}
|
||||
|
||||
bufferDeleter.Detach();
|
||||
free(buffer);
|
||||
|
||||
uint32 flags = 0;
|
||||
if (ioctl(fSocket, SIOCGIFFLAGS, &request, sizeof(struct ifreq)) == 0)
|
||||
flags = request.ifr_flags;
|
||||
|
||||
if ((flags & IFF_AUTO_CONFIGURED) != 0)
|
||||
fAuto = true;
|
||||
else
|
||||
fAuto = false;
|
||||
fAuto = flags & IFF_AUTO_CONFIGURED;
|
||||
|
||||
// read resolv.conf for the dns.
|
||||
fNameservers.MakeEmpty();
|
||||
|
||||
Reference in New Issue
Block a user