Network preferences: Set the "auto configuration" flag.

Fixes #11416.
This commit is contained in:
Adrien Destugues 2014-11-06 15:00:00 +01:00
parent bca1813626
commit b1b51eddee
2 changed files with 18 additions and 2 deletions

View File

@ -564,8 +564,11 @@ InterfacesListView::_HandleNetworkMessage(BMessage* message)
switch (opcode) {
case B_NETWORK_INTERFACE_CHANGED:
case B_NETWORK_DEVICE_LINK_CHANGED:
if (item != NULL)
if (item != NULL) {
// Make sure the item reflects the current state
item->GetSettings()->ReadConfiguration();
InvalidateItem(IndexOf(item));
}
break;
case B_NETWORK_INTERFACE_ADDED:

View File

@ -300,7 +300,6 @@ NetworkSettings::SetConfiguration()
interfaceConfig.SetAddress(fAddress[inet_id]);
interfaceConfig.SetMask(fNetmask[inet_id]);
fNetworkInterface->SetAddress(interfaceConfig);
fNetworkInterface->SetTo(zeroAddr);
} else {
// TODO : test this case (no address set for this protocol)
printf("no zeroAddr found for %s(%d), found %" B_PRIu32 "\n",
@ -311,6 +310,20 @@ NetworkSettings::SetConfiguration()
fNetworkInterface->AddAddress(interfaceConfig);
}
// FIXME these flags shouldn't be interface-global, but specific to
// each protocol. Only set them for AF_INET otherwise there is
// confusion and freezes.
if (fProtocols[index].inet_id == AF_INET) {
int32 flags = fNetworkInterface->Flags();
if (AutoConfigure(fProtocols[index].inet_id)) {
flags |= IFF_AUTO_CONFIGURED;
fNetworkInterface->SetFlags(flags);
fNetworkInterface->AutoConfigure(fProtocols[index].inet_id);
} else {
flags &= ~(IFF_AUTO_CONFIGURED | IFF_CONFIGURING);
fNetworkInterface->SetFlags(flags);
}
}
}
}
}