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:
parent
f5753b4af0
commit
5fb615a3b5
@ -80,9 +80,9 @@ InterfacesAddOn::CreateView(BRect *bounds)
|
||||
new BMessage(kMsgInterfaceToggle));
|
||||
fOnOff->SetEnabled(false);
|
||||
|
||||
fHeal = new BButton(intViewRect, "heal",
|
||||
"Heal", new BMessage(kMsgInterfaceHeal));
|
||||
fHeal->SetEnabled(false);
|
||||
fRenegotiate = new BButton(intViewRect, "heal",
|
||||
"Renegotiate", new BMessage(kMsgInterfaceRenegotiate));
|
||||
fRenegotiate->SetEnabled(false);
|
||||
|
||||
// Build the layout
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
@ -93,7 +93,7 @@ InterfacesAddOn::CreateView(BRect *bounds)
|
||||
.Add(fConfigure)
|
||||
.Add(fOnOff)
|
||||
.AddGlue()
|
||||
.Add(fHeal)
|
||||
.Add(fRenegotiate)
|
||||
.End()
|
||||
.SetInsets(10, 10, 10, 10)
|
||||
);
|
||||
@ -109,7 +109,7 @@ InterfacesAddOn::AttachedToWindow()
|
||||
fListview->SetTarget(this);
|
||||
fConfigure->SetTarget(this);
|
||||
fOnOff->SetTarget(this);
|
||||
fHeal->SetTarget(this);
|
||||
fRenegotiate->SetTarget(this);
|
||||
}
|
||||
|
||||
|
||||
@ -135,11 +135,11 @@ InterfacesAddOn::MessageReceived(BMessage* msg)
|
||||
{
|
||||
fConfigure->SetEnabled(item != NULL);
|
||||
fOnOff->SetEnabled(item != NULL);
|
||||
fHeal->SetEnabled(item != NULL);
|
||||
fRenegotiate->SetEnabled(item != NULL);
|
||||
if (!item)
|
||||
break;
|
||||
fConfigure->SetEnabled(!item->IsDisabled());
|
||||
fHeal->SetEnabled(!item->IsDisabled());
|
||||
fRenegotiate->SetEnabled(!item->IsDisabled());
|
||||
fOnOff->SetLabel(item->IsDisabled() ? "Enable" : "Disable");
|
||||
break;
|
||||
}
|
||||
@ -162,18 +162,18 @@ InterfacesAddOn::MessageReceived(BMessage* msg)
|
||||
item->SetDisabled(!item->IsDisabled());
|
||||
fConfigure->SetEnabled(!item->IsDisabled());
|
||||
fOnOff->SetLabel(item->IsDisabled() ? "Enable" : "Disable");
|
||||
fHeal->SetEnabled(!item->IsDisabled());
|
||||
fRenegotiate->SetEnabled(!item->IsDisabled());
|
||||
fListview->Invalidate();
|
||||
break;
|
||||
}
|
||||
|
||||
case kMsgInterfaceHeal:
|
||||
case kMsgInterfaceRenegotiate:
|
||||
{
|
||||
if (!item)
|
||||
break;
|
||||
|
||||
NetworkSettings* ns = item->GetSettings();
|
||||
ns->HealInterface();
|
||||
ns->RenegotiateAddresses();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
static const uint32 kMsgInterfaceSelected = 'ifce';
|
||||
static const uint32 kMsgInterfaceConfigure = 'ifcf';
|
||||
static const uint32 kMsgInterfaceToggle = 'onof';
|
||||
static const uint32 kMsgInterfaceHeal = 'heal';
|
||||
static const uint32 kMsgInterfaceRenegotiate = 'redo';
|
||||
|
||||
|
||||
class InterfacesAddOn : public NetworkSetupAddOn, public BBox
|
||||
@ -44,7 +44,7 @@ private:
|
||||
InterfacesListView* fListview;
|
||||
BButton* fConfigure;
|
||||
BButton* fOnOff;
|
||||
BButton* fHeal;
|
||||
BButton* fRenegotiate;
|
||||
};
|
||||
|
||||
|
||||
|
@ -58,6 +58,8 @@ NetworkSettings::~NetworkSettings()
|
||||
|
||||
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
|
||||
*/
|
||||
status_t
|
||||
NetworkSettings::HealInterface()
|
||||
NetworkSettings::RenegotiateAddresses()
|
||||
{
|
||||
for (int index = 0; index < MAX_PROTOCOLS; index++) {
|
||||
int inet_id = fProtocols[index].inet_id;
|
||||
if (fProtocols[index].present
|
||||
&& AutoConfigure(inet_id)) {
|
||||
// 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);
|
||||
// Perform AutoConfiguration
|
||||
}
|
||||
|
@ -59,8 +59,6 @@ public:
|
||||
void SetDisabled(bool disabled)
|
||||
{ fDisabled = disabled; }
|
||||
|
||||
status_t HealInterface();
|
||||
|
||||
// void SetWirelessNetwork(const char* name)
|
||||
// { fWirelessNetwork.SetTo(name); }
|
||||
// void SetDomain(const BString& domain)
|
||||
@ -80,6 +78,7 @@ public:
|
||||
int32 PrefixLen(int family)
|
||||
{ return fNetmask[family].PrefixLength(); }
|
||||
|
||||
status_t RenegotiateAddresses();
|
||||
|
||||
const char* Name() { return fName.String(); }
|
||||
const char* Domain() { return fDomain.String(); }
|
||||
|
Loading…
Reference in New Issue
Block a user