* 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()
|
Settings::~Settings()
|
||||||
{
|
{
|
||||||
close(fSocket);
|
close(fSocket);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -62,7 +61,6 @@ Settings::_PrepareRequest(struct ifreq& request)
|
|||||||
void
|
void
|
||||||
Settings::ReadConfiguration()
|
Settings::ReadConfiguration()
|
||||||
{
|
{
|
||||||
|
|
||||||
ifreq request;
|
ifreq request;
|
||||||
if (!_PrepareRequest(request))
|
if (!_PrepareRequest(request))
|
||||||
return;
|
return;
|
||||||
@@ -72,10 +70,8 @@ Settings::ReadConfiguration()
|
|||||||
sockaddr_in* inetAddress = NULL;
|
sockaddr_in* inetAddress = NULL;
|
||||||
|
|
||||||
// Obtain IP.
|
// Obtain IP.
|
||||||
if (ioctl(fSocket, SIOCGIFADDR, &request,
|
if (ioctl(fSocket, SIOCGIFADDR, &request, sizeof(request)) < 0)
|
||||||
sizeof(request)) < 0) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
inetAddress = (sockaddr_in*)&request.ifr_addr;
|
inetAddress = (sockaddr_in*)&request.ifr_addr;
|
||||||
if (inet_ntop(AF_INET, &inetAddress->sin_addr, address,
|
if (inet_ntop(AF_INET, &inetAddress->sin_addr, address,
|
||||||
@@ -100,8 +96,6 @@ Settings::ReadConfiguration()
|
|||||||
fNetmask = address;
|
fNetmask = address;
|
||||||
|
|
||||||
// Obtain gateway
|
// Obtain gateway
|
||||||
|
|
||||||
char* gwAddress;
|
|
||||||
ifconf config;
|
ifconf config;
|
||||||
config.ifc_len = sizeof(config.ifc_value);
|
config.ifc_len = sizeof(config.ifc_value);
|
||||||
if (ioctl(fSocket, SIOCGRTSIZE, &config, sizeof(struct ifconf)) < 0)
|
if (ioctl(fSocket, SIOCGRTSIZE, &config, sizeof(struct ifconf)) < 0)
|
||||||
@@ -129,13 +123,9 @@ Settings::ReadConfiguration()
|
|||||||
while (interface < end) {
|
while (interface < end) {
|
||||||
route_entry& route = interface->ifr_route;
|
route_entry& route = interface->ifr_route;
|
||||||
|
|
||||||
|
|
||||||
if (route.flags & RTF_GATEWAY) {
|
if (route.flags & RTF_GATEWAY) {
|
||||||
inetAddress = (sockaddr_in *)route.gateway;
|
inetAddress = (sockaddr_in*)route.gateway;
|
||||||
|
fGateway = inet_ntoa(inetAddress->sin_addr);
|
||||||
|
|
||||||
gwAddress = inet_ntoa(inetAddress->sin_addr);
|
|
||||||
fGateway = gwAddress;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 addressSize = 0;
|
int32 addressSize = 0;
|
||||||
@@ -148,20 +138,13 @@ Settings::ReadConfiguration()
|
|||||||
|
|
||||||
interface = (ifreq *)((addr_t)interface +
|
interface = (ifreq *)((addr_t)interface +
|
||||||
IF_NAMESIZE + sizeof(route_entry) + addressSize);
|
IF_NAMESIZE + sizeof(route_entry) + addressSize);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bufferDeleter.Detach();
|
|
||||||
free(buffer);
|
|
||||||
|
|
||||||
uint32 flags = 0;
|
uint32 flags = 0;
|
||||||
if (ioctl(fSocket, SIOCGIFFLAGS, &request, sizeof(struct ifreq)) == 0)
|
if (ioctl(fSocket, SIOCGIFFLAGS, &request, sizeof(struct ifreq)) == 0)
|
||||||
flags = request.ifr_flags;
|
flags = request.ifr_flags;
|
||||||
|
|
||||||
if ((flags & IFF_AUTO_CONFIGURED) != 0)
|
fAuto = flags & IFF_AUTO_CONFIGURED;
|
||||||
fAuto = true;
|
|
||||||
else
|
|
||||||
fAuto = false;
|
|
||||||
|
|
||||||
// read resolv.conf for the dns.
|
// read resolv.conf for the dns.
|
||||||
fNameservers.MakeEmpty();
|
fNameservers.MakeEmpty();
|
||||||
|
|||||||
Reference in New Issue
Block a user