HostDev: Fix another bunch of FIXME/TODOs
This commit is contained in:
parent
112c3ff788
commit
e6592c03a2
@ -231,7 +231,7 @@ bool DeviceManager::modifyDeviceGroup(const OstProto::DeviceGroup *deviceGroup)
|
|||||||
|
|
||||||
int DeviceManager::deviceCount()
|
int DeviceManager::deviceCount()
|
||||||
{
|
{
|
||||||
return deviceList_.size() + 1; // FIXME: why +1 for hostdev?
|
return deviceList_.size() + hostDeviceList_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManager::getDeviceList(
|
void DeviceManager::getDeviceList(
|
||||||
|
@ -80,7 +80,7 @@ private:
|
|||||||
QMultiHash<DeviceKey, Device*> bcastList_;
|
QMultiHash<DeviceKey, Device*> bcastList_;
|
||||||
QHash<quint16, uint> tpidList_; // Key: TPID, Value: RefCount
|
QHash<quint16, uint> tpidList_; // Key: TPID, Value: RefCount
|
||||||
|
|
||||||
QList<Device*> hostDeviceList_; // TODO: use to add/remove from devicelist on useHostDevice flag toggle
|
QList<Device*> hostDeviceList_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -277,16 +277,14 @@ void LinuxPort::populateInterfaceInfo()
|
|||||||
//
|
//
|
||||||
// Find self IP
|
// Find self IP
|
||||||
//
|
//
|
||||||
bool foundIp4 = false; // FIXME: needed? why?
|
|
||||||
bool foundIp6 = false; // FIXME: needed? why?
|
|
||||||
if (!addressCache_) {
|
if (!addressCache_) {
|
||||||
qWarning("rtnetlink address cache empty for %s", name());
|
qWarning("rtnetlink address cache empty for %s", name());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rtnl_addr *l3addr = (rtnl_addr*) nl_cache_get_first(addressCache_);
|
rtnl_addr *l3addr = (rtnl_addr*) nl_cache_get_first(addressCache_);
|
||||||
while (l3addr && !foundIp4 && !foundIp6) {
|
while (l3addr) {
|
||||||
if (rtnl_addr_get_ifindex(l3addr) == ifIndex) {
|
if (rtnl_addr_get_ifindex(l3addr) == ifIndex) {
|
||||||
if (rtnl_addr_get_family(l3addr) == AF_INET && !foundIp4) {
|
if (rtnl_addr_get_family(l3addr) == AF_INET) {
|
||||||
Ip4Config ip;
|
Ip4Config ip;
|
||||||
ip.address = qFromBigEndian<quint32>(
|
ip.address = qFromBigEndian<quint32>(
|
||||||
nl_addr_get_binary_addr(
|
nl_addr_get_binary_addr(
|
||||||
@ -295,7 +293,7 @@ void LinuxPort::populateInterfaceInfo()
|
|||||||
ip.gateway = gw4;
|
ip.gateway = gw4;
|
||||||
interfaceInfo_->ip4.append(ip);
|
interfaceInfo_->ip4.append(ip);
|
||||||
}
|
}
|
||||||
else if (rtnl_addr_get_family(l3addr) == AF_INET6 && !foundIp6) {
|
else if (rtnl_addr_get_family(l3addr) == AF_INET6) {
|
||||||
Ip6Config ip;
|
Ip6Config ip;
|
||||||
ip.address = UInt128((quint8*)nl_addr_get_binary_addr(
|
ip.address = UInt128((quint8*)nl_addr_get_binary_addr(
|
||||||
rtnl_addr_get_local(l3addr)));
|
rtnl_addr_get_local(l3addr)));
|
||||||
|
@ -78,8 +78,20 @@ void WindowsHostDevice::clearNeighbors(Device::NeighborSet set)
|
|||||||
void WindowsHostDevice::getNeighbors(OstEmul::DeviceNeighborList *neighbors)
|
void WindowsHostDevice::getNeighbors(OstEmul::DeviceNeighborList *neighbors)
|
||||||
{
|
{
|
||||||
PMIB_IPNET_TABLE2 nbrs = NULL;
|
PMIB_IPNET_TABLE2 nbrs = NULL;
|
||||||
// TODO: optimization: use AF_UNSPEC only if hasIp4 and hasIp6
|
ADDRESS_FAMILY af = AF_UNSPEC;
|
||||||
ulong status = GetIpNetTable2(AF_UNSPEC, &nbrs) != NO_ERROR;
|
|
||||||
|
// TODO: the following can potentially be used elsewhere
|
||||||
|
// but definition of AF_XXX may be different in different
|
||||||
|
// platforms
|
||||||
|
if (!hasIp4_)
|
||||||
|
if (!hasIp6_)
|
||||||
|
return;
|
||||||
|
else
|
||||||
|
af = AF_INET6;
|
||||||
|
else if (!hasIp6_)
|
||||||
|
af = AF_INET;
|
||||||
|
|
||||||
|
ulong status = GetIpNetTable2(af, &nbrs) != NO_ERROR;
|
||||||
if (status != NO_ERROR) {
|
if (status != NO_ERROR) {
|
||||||
qWarning("Get ARP/ND table failed for LUID %llx: %s",
|
qWarning("Get ARP/ND table failed for LUID %llx: %s",
|
||||||
luid_.Value, errMsg(status));
|
luid_.Value, errMsg(status));
|
||||||
|
Loading…
Reference in New Issue
Block a user