networkstatus: add no NoLink and LinkNoConfig status

An interface that fail to configure due to link lost will be
reported to have "No Link" instead of to be still "Configuring...",
which was not the actual state.
This commit is contained in:
Philippe Houdoin 2017-08-03 14:40:48 +00:00
parent 65abebfaa7
commit cb7833c724

View File

@ -498,16 +498,17 @@ NetworkStatusView::_DetermineInterfaceStatus(
const BNetworkInterface& interface)
{
uint32 flags = interface.Flags();
int32 status = kStatusNoLink;
// TODO: no kStatusLinkNoConfig yet
if ((flags & IFF_LINK) == 0)
return kStatusNoLink;
if ((flags & (IFF_UP | IFF_LINK | IFF_CONFIGURING)) == IFF_LINK)
return kStatusLinkNoConfig;
if (flags & IFF_CONFIGURING)
status = kStatusConnecting;
else if ((flags & (IFF_UP | IFF_LINK)) == (IFF_UP | IFF_LINK))
status = kStatusReady;
return kStatusConnecting;
if ((flags & (IFF_UP | IFF_LINK)) == (IFF_UP | IFF_LINK))
return kStatusReady;
return status;
return kStatusUnknown;
}