summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/sample
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2019-04-17 11:14:24 -0700
committerShentubot <shentubot@google.com>2019-04-17 11:16:35 -0700
commit9f8c89fc7fb7c4588713eb376fa56c4c3026d43c (patch)
treeafa9bea24c4c4685d16e6ef3cb432e9b3ac425ae /pkg/tcpip/sample
parente8156667179c52c40f54affc085009258ae11092 (diff)
Return error from fdbased.New
RELNOTES: n/a PiperOrigin-RevId: 244031742 Change-Id: Id0cdb73194018fb5979e67b58510ead19b5a2b81
Diffstat (limited to 'pkg/tcpip/sample')
-rw-r--r--pkg/tcpip/sample/tun_tcp_connect/main.go5
-rw-r--r--pkg/tcpip/sample/tun_tcp_echo/main.go5
2 files changed, 8 insertions, 2 deletions
diff --git a/pkg/tcpip/sample/tun_tcp_connect/main.go b/pkg/tcpip/sample/tun_tcp_connect/main.go
index 327a79f48..cf8900c4d 100644
--- a/pkg/tcpip/sample/tun_tcp_connect/main.go
+++ b/pkg/tcpip/sample/tun_tcp_connect/main.go
@@ -137,7 +137,10 @@ func main() {
log.Fatal(err)
}
- linkID := fdbased.New(&fdbased.Options{FD: fd, MTU: mtu})
+ linkID, err := fdbased.New(&fdbased.Options{FD: fd, MTU: mtu})
+ if err != nil {
+ log.Fatal(err)
+ }
if err := s.CreateNIC(1, sniffer.New(linkID)); err != nil {
log.Fatal(err)
}
diff --git a/pkg/tcpip/sample/tun_tcp_echo/main.go b/pkg/tcpip/sample/tun_tcp_echo/main.go
index b23dc13e7..da6202f97 100644
--- a/pkg/tcpip/sample/tun_tcp_echo/main.go
+++ b/pkg/tcpip/sample/tun_tcp_echo/main.go
@@ -128,12 +128,15 @@ func main() {
log.Fatal(err)
}
- linkID := fdbased.New(&fdbased.Options{
+ linkID, err := fdbased.New(&fdbased.Options{
FD: fd,
MTU: mtu,
EthernetHeader: *tap,
Address: tcpip.LinkAddress(maddr),
})
+ if err != nil {
+ log.Fatal(err)
+ }
if err := s.CreateNIC(1, linkID); err != nil {
log.Fatal(err)
}