diff --git a/peer/control_conn.go b/peer/control_conn.go index d7f9746..c7d1e51 100644 --- a/peer/control_conn.go +++ b/peer/control_conn.go @@ -4,6 +4,7 @@ import ( "log" "net" "net/netip" + "time" "vppn/peer/control" ) @@ -32,11 +33,14 @@ func (c *udpControlConn) SendPing(dst netip.AddrPort, ping control.Ping, buf []b // run reads incoming ping packets and forwards them to ch until ctx is done. // Call this in a goroutine before starting the App event loop. func (c *udpControlConn) run(ch chan<- PingEvent) { + const errorTimeout = 8 * time.Second + var buf [control.Size]byte for { n, src, err := c.conn.ReadFromUDP(buf[:]) if err != nil { log.Printf("control read: %v", err) + time.Sleep(errorTimeout) continue } diff --git a/peer/wginterface/interface.go b/peer/wginterface/interface.go index 3412862..b339c8d 100644 --- a/peer/wginterface/interface.go +++ b/peer/wginterface/interface.go @@ -175,7 +175,7 @@ func nlAttr(attrType uint16, data []byte) []byte { func ioctlSetAddr(name string, ip net.IP, prefixLen int) error { if ip.To4() == nil { - return errors.New("attempted to set nil IP on interface") + return errors.New("attempted to set non-IPv4 address on interface") } fd, err := unix.Socket(unix.AF_INET, unix.SOCK_DGRAM, unix.IPPROTO_IP)