{"record":{"id":"512b9ee8a2842620","repo":"XTLS/Xray-core","slug":"outbound-interface-cannot-be-the-tun-interface-512b9e","errorCode":null,"errorMessage":"outbound interface cannot be the TUN interface","messagePattern":"outbound interface cannot be the TUN interface","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/tun/tun_darwin.go","lineNumber":488,"sourceCode":"\t\terr1 = unix.SetsockoptInt(int(fd), unix.IPPROTO_IPV6, unix.IPV6_BOUND_IF, iface.Index)\n\t\tfallthrough\n\tcase \"tcp4\", \"udp4\", \"ip4\":\n\t\terr2 = unix.SetsockoptInt(int(fd), unix.IPPROTO_IP, unix.IP_BOUND_IF, iface.Index)\n\tdefault:\n\t\tpanic(network + \" \" + address)\n\t}\n\n\treturn errors.Join(err1, err2)\n}\n\nfunc findOutboundInterface(tunIndex int, fixedName string) (*net.Interface, error) {\n\tif fixedName != \"\" {\n\t\tiface, err := net.InterfaceByName(fixedName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif iface.Index == tunIndex {\n\t\t\treturn nil, errors.New(\"outbound interface cannot be the TUN interface\")\n\t\t}\n\t\treturn iface, nil\n\t}\n\n\trib, err := route.FetchRIB(unix.AF_UNSPEC, route.RIBTypeRoute, 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmessages, err := route.ParseRIB(route.RIBTypeRoute, rib)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar ipv6Index int\n\tfor _, message := range messages {\n\t\trouteMessage, ok := message.(*route.RouteMessage)\n\t\tif !ok || routeMessage.Index == tunIndex {\n\t\t\tcontinue","sourceCodeStart":470,"sourceCodeEnd":506,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/proxy/tun/tun_darwin.go#L470-L506","documentation":"Error \"outbound interface cannot be the TUN interface\" thrown in XTLS/Xray-core.","triggerScenarios":"Thrown at proxy/tun/tun_darwin.go:488 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}