Skip to content

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

@hxx258456

Description

@hxx258456

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions