We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0eed5aa commit f1332ceCopy full SHA for f1332ce
simulator/tunnel-icmp.go
@@ -2,9 +2,12 @@ package simulator
2
3
import (
4
"context"
5
+ "errors"
6
+ "fmt"
7
"math/rand"
8
"net"
9
"os"
10
+ "syscall"
11
12
"golang.org/x/net/icmp"
13
"golang.org/x/net/ipv4"
@@ -26,6 +29,11 @@ func NewICMPtunnel() *ICMPtunnel {
26
29
func (s *ICMPtunnel) Init(bind net.IP) error {
27
30
c, err := icmp.ListenPacket("ip4:icmp", bind.String())
28
31
if err != nil {
32
+ // check if it's syscall error 1: "operation not permitted"
33
+ var errno syscall.Errno
34
+ if errors.As(err, &errno); errno == 1 {
35
+ err = fmt.Errorf("%w (make sure you have sufficient network privileges or try to run as root)", err)
36
+ }
37
return err
38
}
39
s.c = c
0 commit comments