summaryrefslogtreecommitdiffhomepage
path: root/test/packetimpact/testbench/rawsockets.go
diff options
context:
space:
mode:
authorBhasker Hariharan <bhaskerh@google.com>2020-05-13 16:11:57 -0700
committergVisor bot <gvisor-bot@google.com>2020-05-13 16:13:37 -0700
commit8605c97136ab798e23d0ae4e85892270d8922b4d (patch)
tree13c45c5d19f057ccbf1aacb30d199a212dadd5f5 /test/packetimpact/testbench/rawsockets.go
parentd84607762889d999f93b89e64e09d2a4dda63bf7 (diff)
Automated rollback of changelist 311285868
PiperOrigin-RevId: 311424257
Diffstat (limited to 'test/packetimpact/testbench/rawsockets.go')
-rw-r--r--test/packetimpact/testbench/rawsockets.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/packetimpact/testbench/rawsockets.go b/test/packetimpact/testbench/rawsockets.go
index 278229b7e..4665f60b2 100644
--- a/test/packetimpact/testbench/rawsockets.go
+++ b/test/packetimpact/testbench/rawsockets.go
@@ -16,6 +16,7 @@ package testbench
import (
"encoding/binary"
+ "flag"
"fmt"
"math"
"net"
@@ -40,6 +41,7 @@ func htons(x uint16) uint16 {
// NewSniffer creates a Sniffer connected to *device.
func NewSniffer(t *testing.T) (Sniffer, error) {
+ flag.Parse()
snifferFd, err := unix.Socket(unix.AF_PACKET, unix.SOCK_RAW, int(htons(unix.ETH_P_ALL)))
if err != nil {
return Sniffer{}, err
@@ -134,6 +136,7 @@ type Injector struct {
// NewInjector creates a new injector on *device.
func NewInjector(t *testing.T) (Injector, error) {
+ flag.Parse()
ifInfo, err := net.InterfaceByName(Device)
if err != nil {
return Injector{}, err