Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Packetdrill_tarr_ext
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stefan Gense
Packetdrill_tarr_ext
Commits
ccbfda22
Commit
ccbfda22
authored
6 years ago
by
Michael Tuexen
Browse files
Options
Downloads
Patches
Plain Diff
Set immediate mode before activating the handle.
This fixes a bug which did not show up on FreeBSD, but on MacOS.
parent
5b078e86
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gtests/net/packetdrill/packet_socket_pcap.c
+11
-9
11 additions, 9 deletions
gtests/net/packetdrill/packet_socket_pcap.c
with
11 additions
and
9 deletions
gtests/net/packetdrill/packet_socket_pcap.c
+
11
−
9
View file @
ccbfda22
...
@@ -89,6 +89,17 @@ static void packet_socket_setup(struct packet_socket *psock)
...
@@ -89,6 +89,17 @@ static void packet_socket_setup(struct packet_socket *psock)
if
(
pcap_set_snaplen
(
psock
->
pcap_out
,
PACKET_READ_BYTES
)
!=
0
)
if
(
pcap_set_snaplen
(
psock
->
pcap_out
,
PACKET_READ_BYTES
)
!=
0
)
die_pcap_perror
(
psock
->
pcap_out
,
"pcap_set_snaplen"
);
die_pcap_perror
(
psock
->
pcap_out
,
"pcap_set_snaplen"
);
/* By default libpcap with BPF waits until a read buffer fills
* up before returning any packets. We use the immediate mode to
* force the BPF device to return the first packet
* immediately.
* Enable this mode before activating the pcap handle.
*/
if
(
pcap_set_immediate_mode
(
psock
->
pcap_in
,
1
)
!=
0
)
die_pcap_perror
(
psock
->
pcap_out
,
"pcap_set_immediate_mode"
);
if
(
pcap_set_immediate_mode
(
psock
->
pcap_out
,
1
)
!=
0
)
die_pcap_perror
(
psock
->
pcap_out
,
"pcap_set_immediate_mode"
);
if
(
pcap_activate
(
psock
->
pcap_in
)
!=
0
)
if
(
pcap_activate
(
psock
->
pcap_in
)
!=
0
)
die_pcap_perror
(
psock
->
pcap_in
,
die_pcap_perror
(
psock
->
pcap_in
,
"pcap_activate "
"pcap_activate "
...
@@ -104,15 +115,6 @@ static void packet_socket_setup(struct packet_socket *psock)
...
@@ -104,15 +115,6 @@ static void packet_socket_setup(struct packet_socket *psock)
die_pcap_perror
(
psock
->
pcap_in
,
"pcap_setdirection"
);
die_pcap_perror
(
psock
->
pcap_in
,
"pcap_setdirection"
);
if
(
pcap_setdirection
(
psock
->
pcap_out
,
PCAP_D_OUT
)
!=
0
)
if
(
pcap_setdirection
(
psock
->
pcap_out
,
PCAP_D_OUT
)
!=
0
)
die_pcap_perror
(
psock
->
pcap_out
,
"pcap_setdirection"
);
die_pcap_perror
(
psock
->
pcap_out
,
"pcap_setdirection"
);
/* By default libpcap with BPF waits until a read buffer fills
* up before returning any packets. We use the immediate mode to
* force the BPF device to return the first packet
* immediately.
*/
if
(
pcap_set_immediate_mode
(
psock
->
pcap_in
,
1
)
!=
0
)
die_pcap_perror
(
psock
->
pcap_out
,
"pcap_set_immediate_mode"
);
if
(
pcap_set_immediate_mode
(
psock
->
pcap_out
,
1
)
!=
0
)
die_pcap_perror
(
psock
->
pcap_out
,
"pcap_set_immediate_mode"
);
bpf_fd
=
pcap_get_selectable_fd
(
psock
->
pcap_in
);
bpf_fd
=
pcap_get_selectable_fd
(
psock
->
pcap_in
);
if
(
bpf_fd
<
0
)
if
(
bpf_fd
<
0
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment