Added "non promiscuous mode" to port notes as a limitation
This commit is contained in:
parent
73afecc07a
commit
24dc621145
@ -90,18 +90,21 @@ void PcapPort::updateNotes()
|
|||||||
{
|
{
|
||||||
QString notes;
|
QString notes;
|
||||||
|
|
||||||
|
if ((!monitorRx_->isPromiscuous()) || (!monitorTx_->isPromiscuous()))
|
||||||
|
notes.append("<li>Non Promiscuous Mode</li>");
|
||||||
|
|
||||||
if (!monitorRx_->isDirectional() && !hasExclusiveControl())
|
if (!monitorRx_->isDirectional() && !hasExclusiveControl())
|
||||||
notes.append("<i>Rx Frames/Bytes</i>: Includes non Ostinato Tx pkts also (Tx by Ostinato are not included)<br>");
|
notes.append("<li><i>Rx Frames/Bytes</i>: Includes non Ostinato Tx pkts also (Tx by Ostinato are not included)</li>");
|
||||||
|
|
||||||
if (!monitorTx_->isDirectional() && !hasExclusiveControl())
|
if (!monitorTx_->isDirectional() && !hasExclusiveControl())
|
||||||
notes.append("<i>Tx Frames/Bytes</i>: Only Ostinato Tx pkts (Tx by others NOT included)<br>");
|
notes.append("<li><i>Tx Frames/Bytes</i>: Only Ostinato Tx pkts (Tx by others NOT included)</li>");
|
||||||
|
|
||||||
if (notes.isEmpty())
|
if (notes.isEmpty())
|
||||||
data_.set_notes("");
|
data_.set_notes("");
|
||||||
else
|
else
|
||||||
data_.set_notes(QString("<b>Limitation(s)</b>"
|
data_.set_notes(QString("<b>Limitation(s)</b>"
|
||||||
"<p>%1<br>"
|
"<ul>%1</ul>"
|
||||||
"Rx/Tx Rates are also subject to above limitation(s)</p>").
|
"Rx/Tx Rates are also subject to above limitation(s)").
|
||||||
arg(notes).toStdString());
|
arg(notes).toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,22 +112,22 @@ PcapPort::PortMonitor::PortMonitor(const char *device, Direction direction,
|
|||||||
AbstractPort::PortStats *stats)
|
AbstractPort::PortStats *stats)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int flag = PCAP_OPENFLAG_PROMISCUOUS;
|
|
||||||
char errbuf[PCAP_ERRBUF_SIZE] = "";
|
char errbuf[PCAP_ERRBUF_SIZE] = "";
|
||||||
|
|
||||||
direction_ = direction;
|
direction_ = direction;
|
||||||
isDirectional_ = true;
|
isDirectional_ = true;
|
||||||
|
isPromisc_ = true;
|
||||||
stats_ = stats;
|
stats_ = stats;
|
||||||
_retry:
|
_retry:
|
||||||
handle_ = pcap_open_live(device, 64 /* FIXME */, flag,
|
handle_ = pcap_open_live(device, 64 /* FIXME */, int(isPromisc_),
|
||||||
1000 /* ms */, errbuf);
|
1000 /* ms */, errbuf);
|
||||||
|
|
||||||
if (handle_ == NULL)
|
if (handle_ == NULL)
|
||||||
{
|
{
|
||||||
if (flag && QString(errbuf).contains("promiscuous"))
|
if (isPromisc_ && QString(errbuf).contains("promiscuous"))
|
||||||
{
|
{
|
||||||
qDebug("%s:can't set promiscuous mode, trying non-promisc", device);
|
qDebug("%s:can't set promiscuous mode, trying non-promisc", device);
|
||||||
flag = 0;
|
isPromisc_ = false;
|
||||||
goto _retry;
|
goto _retry;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -78,12 +78,14 @@ protected:
|
|||||||
pcap_t* handle() { return handle_; }
|
pcap_t* handle() { return handle_; }
|
||||||
Direction direction() { return direction_; }
|
Direction direction() { return direction_; }
|
||||||
bool isDirectional() { return isDirectional_; }
|
bool isDirectional() { return isDirectional_; }
|
||||||
|
bool isPromiscuous() { return isPromisc_; }
|
||||||
protected:
|
protected:
|
||||||
AbstractPort::PortStats *stats_;
|
AbstractPort::PortStats *stats_;
|
||||||
private:
|
private:
|
||||||
pcap_t *handle_;
|
pcap_t *handle_;
|
||||||
Direction direction_;
|
Direction direction_;
|
||||||
bool isDirectional_;
|
bool isDirectional_;
|
||||||
|
bool isPromisc_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PortTransmitter: public QThread
|
class PortTransmitter: public QThread
|
||||||
|
Loading…
Reference in New Issue
Block a user