sign: NOCAPTURE_LOCAL is not reqd since we don't tx on this handle
This commit is contained in:
parent
e7ed15fc89
commit
b4beda7c30
@ -50,34 +50,14 @@ void PcapRxStats::run()
|
|||||||
|
|
||||||
qDebug("In %s", __PRETTY_FUNCTION__);
|
qDebug("In %s", __PRETTY_FUNCTION__);
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
|
||||||
flags |= PCAP_OPENFLAG_NOCAPTURE_LOCAL; // FIXME: needed?
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
|
||||||
_retry:
|
|
||||||
// NOCAPTURE_LOCAL needs windows only pcap_open()
|
|
||||||
handle_ = pcap_open(qPrintable(device_), 65535,
|
|
||||||
flags, 100 /* ms */, NULL, errbuf);
|
|
||||||
#else
|
|
||||||
handle_ = pcap_open_live(qPrintable(device_), 65535,
|
handle_ = pcap_open_live(qPrintable(device_), 65535,
|
||||||
flags, 100 /* ms */, errbuf);
|
flags, 100 /* ms */, errbuf);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (handle_ == NULL) {
|
if (handle_ == NULL) {
|
||||||
if (flags && QString(errbuf).contains("promiscuous")) {
|
if (flags && QString(errbuf).contains("promiscuous")) {
|
||||||
notify("Unable to set promiscuous mode on <%s> - "
|
notify("Unable to set promiscuous mode on <%s> - "
|
||||||
"stream stats rx will not work", qPrintable(device_));
|
"stream stats rx will not work", qPrintable(device_));
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
#ifdef Q_OS_WIN32
|
|
||||||
else if ((flags & PCAP_OPENFLAG_NOCAPTURE_LOCAL)
|
|
||||||
&& QString(errbuf).contains("loopback")) {
|
|
||||||
qDebug("Can't set no local capture mode %s", qPrintable(device_));
|
|
||||||
flags &= ~PCAP_OPENFLAG_NOCAPTURE_LOCAL;
|
|
||||||
goto _retry;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else {
|
else {
|
||||||
notify("Unable to open <%s> [%s] - stream stats rx will not work",
|
notify("Unable to open <%s> [%s] - stream stats rx will not work",
|
||||||
qPrintable(device_), errbuf);
|
qPrintable(device_), errbuf);
|
||||||
|
Loading…
Reference in New Issue
Block a user