Commit Graph

36 Commits

Author SHA1 Message Date
Srivats P
f185ceb206 Stop thread if still running in destructor
Threads addressed in this commit:
 - Transmitter (txThread, txStats)
 - Capturer
 - EmulXcvr
2023-11-24 13:12:35 +05:30
Srivats P
5ec7010c51 Fix contention for port streamStats across threads
Tx/Rx stream stats related threads no longer have a direct reference to the
port's stream stats - instead they have their own copy that they keep and
return (in a reset-on-read fashion) when asked for. Each copy also has it's
own lock to prevent contention for read/update/clear.

PcapPort now fetches Tx(Transmitter) and Rx(Poller) stats on demand and
updates the port's stream stats - under protection of a lock.
2023-06-17 11:31:48 +05:30
Srivats P
3060701386 Move debugStats() from PcapRx to base PcapSession
With this change, other classes that use PcapSession as base can also
use debugStats(), if required
2023-05-26 11:31:52 +05:30
Srivats P
47325c38b0 Ignore failures when stopping stream stats tracking
Stop everything irrespective of any failures
2023-05-26 11:31:52 +05:30
Srivats P
21ce331c43 Create a Tx Ttag tracker thread
For now we are just debug printing timestamp with T-TagId and GUID. We
need to store this tuple and compare when we Rx the same - this will be
in a upcoming commit.
2023-05-26 11:31:52 +05:30
Srivats P
c70811eaa4 Fix spurious stream stats drops
The problem happens for bidirectional flows. The sequence of events is
as follows when you start Tx on Ports p1, p2 with the current code -

1. Clear stream stats on p1
2. Start tx on p1
3. Clear stream stats on p2
4. Start tx on p2

By the time #3 is executed, it may have already rx packets from p1 which
are being incorrectly cleared, this will cause these number of packets
to show up as dropped instead - incorrectly.

The fix is to change the order like this -

1. Clear stream stats on p1
2. Clear stream stats on p2
3. Start tx on p1
4. Start tx on p2

Unidirectional flows will not see this problem - as long as startTx is
done only on the Tx port and not the Rx port.

This bug is a regression caused due to the code changes introduced for the
stream stats rates feature implemented in 1.2.0
2023-02-08 16:34:03 +05:30
Srivats P
f7ace4c5c2 Name threads for easier debugging 2020-05-15 18:55:03 +05:30
Srivats P
db66d7c5ea Add support for npcap as winpcap replacement
For now both winpcap and npcap are supported with the latter being
experimentally supported till we get some feedback from users and
confirm that things are all working fine with npcap.

OID for link state has been changed to one that supports both.

To check which is being used, run 'drone -v'.

Fixes #236
2020-02-12 18:14:48 +05:30
Srivats P
64d1525f50 Fix infinite loop when stopping capture etc.
On some platforms and/or some libpcap verisons, libpcap doesn't support a
timeout which makes interactive stop not possible. So we now use a UNIX
signal to break out. Obviously this works only on *nix platforms - which
includes MacOS. For now the problem is not seen on Windows with WinPCAP,
so we should be fine. May need to revisit when we add Npcap support.

Fixes #215, #234
2019-08-10 13:26:04 +05:30
Srivats P
bc972e4476 HostDev: Added infra and windows IPv4 implementation 2018-07-26 20:53:33 +05:30
Srivats P
9f4b70c5a8 Port server code from Qt4 to Qt5
Verification/testing of porting changes is pending
2018-03-15 19:34:42 +05:30
Srivats P
13e28cff68 sign: Fix Tx stream stats counted as Rx on some platforms
On platforms that don't support filtering IN/OUT using
pcap_setdirection() - e.g. Windows, adjust Rx stats appropriately
2017-01-09 18:57:38 +05:30
Srivats P
8f97a69220 sign: Refactor StreamStatsTracking methods
Start/StopStreamStatsTracking() methods made private helper functions
specific to PcapPort. AbstractPort::setStreamStatsTracking() virtual
function should be implemented by subclasses as required
2016-12-07 18:19:09 +05:30
Srivats P
35c56b9181 sign: Calculate stream stats only if configured
Stream Stats Rx and Tx both are calculated only if 'Track Stream Stats'
is configured on the port
2016-12-06 21:41:47 +05:30
Srivats P
e9bdfa04ea sign: implemented rx stream stats - loopback problem to be fixed 2016-11-17 21:44:34 +05:30
Srivats P
afcb4126b5 sign: port stream tx stats are updated when TxThread finishes; actual Tx stream stats collection by TxThread is still pending 2016-11-11 21:22:07 +05:30
Srivats P
1986845bae sign: remove streamsType and associated code 2016-11-05 19:41:02 +05:30
Srivats P
a79bbb1fcd sign: signed tx stats infra; actual tx signing pending 2016-10-23 17:24:23 +05:30
Srivats P
12351d6304 sign: Refactored PortTransmitter into PcapTransmitter and PcapTxThread classes. Also broke out PacketSequence and Timestamp stuff into their own files. No change in functionality. 2016-09-13 19:05:24 +05:30
Srivats P
20fa1dcb69 sign: refactor (Pcap)PortTransmitter into a separate file 2016-09-06 18:50:08 +05:30
Srivats P
2acfb3f25a Fix warnings introduced by recent feature development 2016-06-01 20:51:29 +05:30
Srivats P
b6a6b776e1 Open Session - Drone on Windows now sends actual /Device/NPF_XXXX as port names - client sets up the ifX style alias and uses that all places; this was needed for comparison of port names while opening sessions for Drones running on Windows 2016-05-18 18:37:48 +05:30
Srivats P
8b80b4c3ef Device Emulation (contd.): Checked and decided on a couple of FIXMEs/TODOs 2016-03-24 18:47:43 +05:30
Srivats P
46a09a82e4 Device Emulation (contd.): Reduced pcap timeout to improve ping response times 2016-01-12 19:08:01 +05:30
Srivats P
f88f8ebd38 Device Emulation (contd.): Fix incorrect capture filter 2016-01-08 21:59:34 +05:30
Srivats P
eff603304e Device Emulation (contd.): Receive, parse IPv6 Neigh Advt and update NDP Table 2016-01-06 18:10:28 +05:30
Srivats P
ea44e55e78 Feature (contd.): Device Emulation - Test case and code to support sending ping echo reply in response to received ping echo request 2015-12-23 21:18:25 +05:30
Srivats P
ad1fb5fc37 Feature (contd.): Device Emulation - fixed problems in code and in test case for multi-tagged vlans 2015-12-14 21:04:58 +05:30
Srivats P
c022290da1 Merge branch 'master' of https://github.com/pstavirs/ostinato into emul
Conflicts:
	server/pcapport.cpp
2015-12-01 21:00:41 +05:30
Srivats P
3a5396c865 Feature (contd.): Device Emulation - Got rid of a bunch of FIXMEs and all trailing whitespace (in the code added for this feature) 2015-11-14 17:06:43 +05:30
Srivats P
01e8524491 Regression Fix: Fix compilation issue on Windows introduced by the RateAccuracy feature 2015-11-06 18:53:27 +05:30
Srivats P
06182a435c Bugfix: Introduced RateAccuracy setting for Drone to conserve CPU at the cost of accuracy
Fixes #151
2015-10-12 18:11:30 +05:30
Srivats P
8c41b536a4 Feature (contd.): Device Emulation - fixed bug where we receive back a transmitted emulation packet 2015-10-03 21:27:15 +05:30
Srivats P
0c98e30a93 Feature (contd.): Device Emulation - added test cases for multiple ip4 devices with and without VLANs; fixed bugs discovered via these cases 2015-10-03 13:18:44 +05:30
Srivats P
ab433dc22b Feature: Device Emulation - first cut working code 2015-09-14 18:19:52 +05:30
Srivats P.
a9da643fb2 Feature: Reserve Ports for cooperative use of shared drone. If a port is reserved the GUI will display the username of the owner but others can still view and control the port; in other words, we just potentially prevent unintentional usage of other people's ports, users still need to play nice with each other!
Fixes issue 144
2015-04-16 22:20:07 +05:30