Skip to content
This repository was archived by the owner on Aug 26, 2024. It is now read-only.

Commit 7d9fe80

Browse files
authored
allow socket option configuration (#4)
1 parent 90bd149 commit 7d9fe80

File tree

6 files changed

+128
-92
lines changed

6 files changed

+128
-92
lines changed

examples/dumpframes/dumpframes.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func main() {
6666

6767
// Create and initialize an XDP socket attached to our chosen network
6868
// link.
69-
xsk, err := xdp.NewSocket(Ifindex, queueID)
69+
xsk, err := xdp.NewSocket(Ifindex, queueID, nil)
7070
if err != nil {
7171
fmt.Printf("error: failed to create an XDP socket: %v\n", err)
7272
return

examples/l2fwd/l2fwd.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func forwardL2(verbose bool, inLink netlink.Link, inLinkQueueID int, inLinkDst n
8282
}
8383
defer inProg.Detach(inLink.Attrs().Index)
8484
log.Printf("opening XDP socket for %s...", inLink.Attrs().Name)
85-
inXsk, err := xdp.NewSocket(inLink.Attrs().Index, inLinkQueueID)
85+
inXsk, err := xdp.NewSocket(inLink.Attrs().Index, inLinkQueueID, nil)
8686
if err != nil {
8787
log.Fatalf("failed to open XDP socket for link %s: %v", inLink.Attrs().Name, err)
8888
}
@@ -95,7 +95,7 @@ func forwardL2(verbose bool, inLink netlink.Link, inLinkQueueID int, inLinkDst n
9595

9696
// Note: The XDP socket used for transmitting data does not need an EBPF program.
9797
log.Printf("opening XDP socket for %s...", outLink.Attrs().Name)
98-
outXsk, err := xdp.NewSocket(outLink.Attrs().Index, outLinkQueueID)
98+
outXsk, err := xdp.NewSocket(outLink.Attrs().Index, outLinkQueueID, nil)
9999
if err != nil {
100100
log.Fatalf("failed to open XDP socket for link %s: %v", outLink.Attrs().Name, err)
101101
}

examples/rebroadcast/rebroadcast.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func main() {
6666

6767
// Create and initialize an XDP socket attached to our chosen network
6868
// link.
69-
xsk, err := xdp.NewSocket(Ifindex, queueID)
69+
xsk, err := xdp.NewSocket(Ifindex, queueID, nil)
7070
if err != nil {
7171
fmt.Printf("error: failed to create an XDP socket: %v\n", err)
7272
return

examples/senddnsqueries/senddnsqueries.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func main() {
4747
panic(err)
4848
}
4949

50-
xsk, err := xdp.NewSocket(link.Attrs().Index, QueueID)
50+
xsk, err := xdp.NewSocket(link.Attrs().Index, QueueID, nil)
5151
if err != nil {
5252
panic(err)
5353
}

examples/sendudp/sendudp.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func main() {
5151
panic(err)
5252
}
5353

54-
xsk, err := xdp.NewSocket(link.Attrs().Index, QueueID)
54+
xsk, err := xdp.NewSocket(link.Attrs().Index, QueueID, nil)
5555
if err != nil {
5656
panic(err)
5757
}

0 commit comments

Comments
 (0)