Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem running on a router #5

Open
Migel1 opened this issue Dec 16, 2024 · 3 comments
Open

Problem running on a router #5

Migel1 opened this issue Dec 16, 2024 · 3 comments

Comments

@Migel1
Copy link

Migel1 commented Dec 16, 2024

I tried to run wireproxy on a router.
To achieve this I crosscompiled source code for ARM Linux (GOOS=linux GOARCH=arm GOARM=5) and run the resulting WireProxy binary on the router.

The binary started successfully, but when I tried to connect to the proxy I got the following error on the router console:

DEBUG: 2024/12/16 17:51:42 peer(bmXO…fgyo) - Sending handshake initiation
ERROR: 2024/12/16 17:51:42 peer(bmXO…fgyo) - Failed to send handshake initiation: write udp 0.0.0.0:61895: sendmmsg: function not implemented

The kernel version on router is Linux router 2.6.36.4brcmarm #82 PREEMPT Wed Aug 7 09:46:26 CEST 2024 armv7l Tomato.

I this Linux kernel supported? Or may be I need to add some special options to run wireproxy on a router?

@artem-russkikh
Copy link
Owner

I didn't attempt to run wireproxy on a router. Need to research this topic. Meanwhile you can search for similar issues in the origin wireguard GitHub repository at https://github.com/pufferffish/wireproxy

@Migel1
Copy link
Author

Migel1 commented Dec 18, 2024

It seems that the gvisor library uses the sendmmsg Linux system call, which is available only in Linux kernels 3.0+ :(

@ValentineShilov
Copy link

ValentineShilov commented Jan 14, 2025

In Amnezia-wg I fixed the same problem by changing conn/bind_std.go.
In func (s *StdNetBind) send(conn net.UDPConn, pc batchWriter, msgs []ipv6.Message)
by default for Linux WriteBatch is used to send udp packets (and it uses syscall absent on kernel 2.
)
change the code

var (
		n     int
		err   error
		start int
	)
if runtime.GOOS == "linux" || runtime.GOOS == "android" {
		for {
			n, err = pc.WriteBatch(msgs[start:], 0)
			if err != nil || n == len(msgs[start:]) {
				break
			}
			start += n
		}
	} else {
		for _, msg := range msgs {
			_, _, err = conn.WriteMsgUDP(msg.Buffers[0], msg.OOB, msg.Addr.(*net.UDPAddr))
			if err != nil {
				break
			}
		}
	}

to

var (
err   error
)
      for _, msg := range msgs {
	      _, _, err = conn.WriteMsgUDP(msg.Buffers[0], msg.OOB, msg.Addr.(*net.UDPAddr))
	      if err != nil {
		      break
	      }
		
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants