Attention is currently required from: fixeria.

pespin uploaded patch set #4 to this change.

View Change

The following approvals got outdated and were removed: Verified+1 by Jenkins Builder

client: use pcap_dispatch to avoid extra pkt buffer copy

pcap_next() allows use of returned buffer until next time the same API
is called. In order to do so, it internally calls pcap_dispatch() with
an internal handler (in the case of linux pcapint_oneshot_linux()).
That handler basically memcpy()s the pkt buffer obtained in the
pcap_dispatch callback into a temporary static buffer which is then
returned.
We don't need any of that here, and by using pcap_dispatch() directly
(as recommended in pcapint_oneshot_linux() function documentation) we
can skip an extra memcpy() of each packet buffer captured.

Furthermore, it will allow us processing multiple packets from the
captured queue (RA_SOCKET+mmap implementation in linux) in one poll
iteration if several packets have been captured. This will be done in a
follow-up patch.

pcap handle is marked non-blocking to allow polling from it without
ending up blocked. Applying filter is moved beforehand, as seen in
libpcap capturetest example.

Related: SYS#7290
Change-Id: I055efb66fac5e04c541d75ec2c0f654cdfb17838
---
M src/osmo_client_core.c
1 file changed, 28 insertions(+), 14 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-pcap refs/changes/48/39948/4

To view, visit change 39948. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-Change-Id: I055efb66fac5e04c541d75ec2c0f654cdfb17838
Gerrit-Change-Number: 39948
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy@sysmocom.de>