Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Error reading data from Darwin Tun network card while writing to Linux Tun network card

Open
#28 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
go

Research direction

Start by reproducing the tunnel with the Darwin and Linux TUN creation options shown in the issue, then trace the write path that returns "write tun: invalid argument." Compare the packet and device expectations on both platforms; done means identifying the incompatibility and providing a verified fix or a documented limitation.

Written by the indexing model from the issue text.

Description

question

Mac Tun device creation code


	srcPrefix, err := netip.ParsePrefix("10.0.0.1/24")
	if err != nil {
		return nil, err
	}
	dstPrefix, err := netip.ParsePrefix("10.0.0.0/24")
	if err != nil {
		return nil, err
	}

	tun, err := stun.New(stun.Options{
		Name:              "utun3",
		Inet4Address:      []netip.Prefix{srcPrefix},
		MTU:               uint32(1420),
		AutoRoute:         true,
		Inet4RouteAddress: []netip.Prefix{dstPrefix},
	})

Linux Tun device creation code

	srcPrefix, err := netip.ParsePrefix("10.0.0.2/24")
	if err != nil {
		return nil, err
	}
	option := stun.Options{
		Name:         "tun3",
		Inet4Address: []netip.Prefix{srcPrefix},
		MTU:          uint32(1420),
	}
	tun, err := stun.New(option)

I established a tunnel between two machines, but when I forwarded the data packet read from the Mac tun device to the Linux tun device, he encountered this error

write tun: invalid argument
Dominant language
Go
Stars
238
Forks
234
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SagerNet/sing-tun

All issues in SagerNet/sing-tun

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.