diff --git a/server/pcapport.cpp b/server/pcapport.cpp index 683d462..ebb159a 100644 --- a/server/pcapport.cpp +++ b/server/pcapport.cpp @@ -90,18 +90,21 @@ void PcapPort::updateNotes() { QString notes; + if ((!monitorRx_->isPromiscuous()) || (!monitorTx_->isPromiscuous())) + notes.append("
  • Non Promiscuous Mode
  • "); + if (!monitorRx_->isDirectional() && !hasExclusiveControl()) - notes.append("Rx Frames/Bytes: Includes non Ostinato Tx pkts also (Tx by Ostinato are not included)
    "); + notes.append("
  • Rx Frames/Bytes: Includes non Ostinato Tx pkts also (Tx by Ostinato are not included)
  • "); if (!monitorTx_->isDirectional() && !hasExclusiveControl()) - notes.append("Tx Frames/Bytes: Only Ostinato Tx pkts (Tx by others NOT included)
    "); + notes.append("
  • Tx Frames/Bytes: Only Ostinato Tx pkts (Tx by others NOT included)
  • "); if (notes.isEmpty()) data_.set_notes(""); else data_.set_notes(QString("Limitation(s)" - "

    %1
    " - "Rx/Tx Rates are also subject to above limitation(s)

    "). + "" + "Rx/Tx Rates are also subject to above limitation(s)"). arg(notes).toStdString()); } @@ -109,22 +112,22 @@ PcapPort::PortMonitor::PortMonitor(const char *device, Direction direction, AbstractPort::PortStats *stats) { int ret; - int flag = PCAP_OPENFLAG_PROMISCUOUS; char errbuf[PCAP_ERRBUF_SIZE] = ""; direction_ = direction; isDirectional_ = true; + isPromisc_ = true; stats_ = stats; _retry: - handle_ = pcap_open_live(device, 64 /* FIXME */, flag, + handle_ = pcap_open_live(device, 64 /* FIXME */, int(isPromisc_), 1000 /* ms */, errbuf); 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); - flag = 0; + isPromisc_ = false; goto _retry; } else diff --git a/server/pcapport.h b/server/pcapport.h index a6264c5..e82589b 100644 --- a/server/pcapport.h +++ b/server/pcapport.h @@ -78,12 +78,14 @@ protected: pcap_t* handle() { return handle_; } Direction direction() { return direction_; } bool isDirectional() { return isDirectional_; } + bool isPromiscuous() { return isPromisc_; } protected: AbstractPort::PortStats *stats_; private: pcap_t *handle_; Direction direction_; bool isDirectional_; + bool isPromisc_; }; class PortTransmitter: public QThread