* Moved the network status replicant into its own application, similar to what

ProcessController and PowerStatus are doing.
* Currently polls for info only - later, the stack should support listeners for
  interface related changes.
* Also works under BONE (although it doesn't make much sense to use it there).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20655 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-04-11 16:01:02 +00:00
parent 861b3c0b6f
commit f01106c3cf
18 changed files with 854 additions and 569 deletions
+20 -6
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku, Inc. All Rights Reserved.
* Copyright 2006-2007, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -40,10 +40,22 @@ AutoconfigLooper::~AutoconfigLooper()
void
AutoconfigLooper::_ReadyToRun()
{
BMessage interface(kMsgConfigureInterface);
interface.AddString("device", fDevice.String());
interface.AddInt32("net:status", kStatusPreparing);
fTarget.SendMessage(&interface);
ifreq request;
if (!prepare_request(request, fDevice.String()))
return;
// set IFF_CONFIGURING flag on interface
int socket = ::socket(AF_LINK, SOCK_DGRAM, 0);
if (socket < 0)
return;
if (ioctl(socket, SIOCGIFFLAGS, &request, sizeof(struct ifreq)) == 0) {
request.ifr_flags |= IFF_CONFIGURING;
ioctl(socket, SIOCSIFFLAGS, &request, sizeof(struct ifreq));
}
close(socket);
// start with DHCP
@@ -62,7 +74,9 @@ AutoconfigLooper::_ReadyToRun()
// TODO: have a look at zeroconf
// TODO: this could also be done add-on based
interface.ReplaceInt32("net:status", kStatusLinkNoConfig);
BMessage interface(kMsgConfigureInterface);
interface.AddString("device", fDevice.String());
interface.AddBool("auto", true);
uint8 mac[6];
uint8 last = 56;