change Heal to Renegotiate for now as it is the most technically correct; add missing delete of fNetworkInterface from deconstructor; remove un-needed RemoveDefaultRoute as per Axel
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40921 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -80,9 +80,9 @@ InterfacesAddOn::CreateView(BRect *bounds)
|
|||||||
new BMessage(kMsgInterfaceToggle));
|
new BMessage(kMsgInterfaceToggle));
|
||||||
fOnOff->SetEnabled(false);
|
fOnOff->SetEnabled(false);
|
||||||
|
|
||||||
fHeal = new BButton(intViewRect, "heal",
|
fRenegotiate = new BButton(intViewRect, "heal",
|
||||||
"Heal", new BMessage(kMsgInterfaceHeal));
|
"Renegotiate", new BMessage(kMsgInterfaceRenegotiate));
|
||||||
fHeal->SetEnabled(false);
|
fRenegotiate->SetEnabled(false);
|
||||||
|
|
||||||
// Build the layout
|
// Build the layout
|
||||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||||
@@ -93,7 +93,7 @@ InterfacesAddOn::CreateView(BRect *bounds)
|
|||||||
.Add(fConfigure)
|
.Add(fConfigure)
|
||||||
.Add(fOnOff)
|
.Add(fOnOff)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
.Add(fHeal)
|
.Add(fRenegotiate)
|
||||||
.End()
|
.End()
|
||||||
.SetInsets(10, 10, 10, 10)
|
.SetInsets(10, 10, 10, 10)
|
||||||
);
|
);
|
||||||
@@ -109,7 +109,7 @@ InterfacesAddOn::AttachedToWindow()
|
|||||||
fListview->SetTarget(this);
|
fListview->SetTarget(this);
|
||||||
fConfigure->SetTarget(this);
|
fConfigure->SetTarget(this);
|
||||||
fOnOff->SetTarget(this);
|
fOnOff->SetTarget(this);
|
||||||
fHeal->SetTarget(this);
|
fRenegotiate->SetTarget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -135,11 +135,11 @@ InterfacesAddOn::MessageReceived(BMessage* msg)
|
|||||||
{
|
{
|
||||||
fConfigure->SetEnabled(item != NULL);
|
fConfigure->SetEnabled(item != NULL);
|
||||||
fOnOff->SetEnabled(item != NULL);
|
fOnOff->SetEnabled(item != NULL);
|
||||||
fHeal->SetEnabled(item != NULL);
|
fRenegotiate->SetEnabled(item != NULL);
|
||||||
if (!item)
|
if (!item)
|
||||||
break;
|
break;
|
||||||
fConfigure->SetEnabled(!item->IsDisabled());
|
fConfigure->SetEnabled(!item->IsDisabled());
|
||||||
fHeal->SetEnabled(!item->IsDisabled());
|
fRenegotiate->SetEnabled(!item->IsDisabled());
|
||||||
fOnOff->SetLabel(item->IsDisabled() ? "Enable" : "Disable");
|
fOnOff->SetLabel(item->IsDisabled() ? "Enable" : "Disable");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -162,18 +162,18 @@ InterfacesAddOn::MessageReceived(BMessage* msg)
|
|||||||
item->SetDisabled(!item->IsDisabled());
|
item->SetDisabled(!item->IsDisabled());
|
||||||
fConfigure->SetEnabled(!item->IsDisabled());
|
fConfigure->SetEnabled(!item->IsDisabled());
|
||||||
fOnOff->SetLabel(item->IsDisabled() ? "Enable" : "Disable");
|
fOnOff->SetLabel(item->IsDisabled() ? "Enable" : "Disable");
|
||||||
fHeal->SetEnabled(!item->IsDisabled());
|
fRenegotiate->SetEnabled(!item->IsDisabled());
|
||||||
fListview->Invalidate();
|
fListview->Invalidate();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kMsgInterfaceHeal:
|
case kMsgInterfaceRenegotiate:
|
||||||
{
|
{
|
||||||
if (!item)
|
if (!item)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
NetworkSettings* ns = item->GetSettings();
|
NetworkSettings* ns = item->GetSettings();
|
||||||
ns->HealInterface();
|
ns->RenegotiateAddresses();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
static const uint32 kMsgInterfaceSelected = 'ifce';
|
static const uint32 kMsgInterfaceSelected = 'ifce';
|
||||||
static const uint32 kMsgInterfaceConfigure = 'ifcf';
|
static const uint32 kMsgInterfaceConfigure = 'ifcf';
|
||||||
static const uint32 kMsgInterfaceToggle = 'onof';
|
static const uint32 kMsgInterfaceToggle = 'onof';
|
||||||
static const uint32 kMsgInterfaceHeal = 'heal';
|
static const uint32 kMsgInterfaceRenegotiate = 'redo';
|
||||||
|
|
||||||
|
|
||||||
class InterfacesAddOn : public NetworkSetupAddOn, public BBox
|
class InterfacesAddOn : public NetworkSetupAddOn, public BBox
|
||||||
@@ -44,7 +44,7 @@ private:
|
|||||||
InterfacesListView* fListview;
|
InterfacesListView* fListview;
|
||||||
BButton* fConfigure;
|
BButton* fConfigure;
|
||||||
BButton* fOnOff;
|
BButton* fOnOff;
|
||||||
BButton* fHeal;
|
BButton* fRenegotiate;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ NetworkSettings::~NetworkSettings()
|
|||||||
|
|
||||||
close(socket_id);
|
close(socket_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete fNetworkInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -332,20 +334,17 @@ NetworkSettings::WriteConfiguration()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! HealInterface performs a address renegotiation in an attempt to fix
|
/*! RenegotiateAddresses performs a address renegotiation in an attempt to fix
|
||||||
connectivity problems
|
connectivity problems
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
NetworkSettings::HealInterface()
|
NetworkSettings::RenegotiateAddresses()
|
||||||
{
|
{
|
||||||
for (int index = 0; index < MAX_PROTOCOLS; index++) {
|
for (int index = 0; index < MAX_PROTOCOLS; index++) {
|
||||||
int inet_id = fProtocols[index].inet_id;
|
int inet_id = fProtocols[index].inet_id;
|
||||||
if (fProtocols[index].present
|
if (fProtocols[index].present
|
||||||
&& AutoConfigure(inet_id)) {
|
&& AutoConfigure(inet_id)) {
|
||||||
// If protocol is active, and set to auto
|
// If protocol is active, and set to auto
|
||||||
printf("Healing %d\n", inet_id);
|
|
||||||
fNetworkInterface->RemoveDefaultRoute(inet_id);
|
|
||||||
// Remove default route
|
|
||||||
fNetworkInterface->AutoConfigure(inet_id);
|
fNetworkInterface->AutoConfigure(inet_id);
|
||||||
// Perform AutoConfiguration
|
// Perform AutoConfiguration
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,8 +59,6 @@ public:
|
|||||||
void SetDisabled(bool disabled)
|
void SetDisabled(bool disabled)
|
||||||
{ fDisabled = disabled; }
|
{ fDisabled = disabled; }
|
||||||
|
|
||||||
status_t HealInterface();
|
|
||||||
|
|
||||||
// void SetWirelessNetwork(const char* name)
|
// void SetWirelessNetwork(const char* name)
|
||||||
// { fWirelessNetwork.SetTo(name); }
|
// { fWirelessNetwork.SetTo(name); }
|
||||||
// void SetDomain(const BString& domain)
|
// void SetDomain(const BString& domain)
|
||||||
@@ -80,6 +78,7 @@ public:
|
|||||||
int32 PrefixLen(int family)
|
int32 PrefixLen(int family)
|
||||||
{ return fNetmask[family].PrefixLength(); }
|
{ return fNetmask[family].PrefixLength(); }
|
||||||
|
|
||||||
|
status_t RenegotiateAddresses();
|
||||||
|
|
||||||
const char* Name() { return fName.String(); }
|
const char* Name() { return fName.String(); }
|
||||||
const char* Domain() { return fDomain.String(); }
|
const char* Domain() { return fDomain.String(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user