{"record":{"id":"9bc9bb083f0ddc0d","repo":"shadowsocks/shadowsocks-rust","slug":"tun-interface-destination-invalid","errorCode":null,"errorMessage":"`tun_interface_destination` invalid","messagePattern":"`tun_interface_destination` invalid","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/shadowsocks-service/src/config.rs","lineNumber":2022,"sourceCode":"\n                        #[cfg(feature = \"local-tun\")]\n                        if let Some(tun_interface_address) = local.tun_interface_address {\n                            match tun_interface_address.parse::<IpNet>() {\n                                Ok(addr) => local_config.tun_interface_address = Some(addr),\n                                Err(..) => {\n                                    let err = Error::new(ErrorKind::Malformed, \"`tun_interface_address` invalid\", None);\n                                    return Err(err);\n                                }\n                            }\n                        }\n\n                        #[cfg(feature = \"local-tun\")]\n                        if let Some(tun_interface_destination) = local.tun_interface_destination {\n                            match tun_interface_destination.parse::<IpNet>() {\n                                Ok(addr) => local_config.tun_interface_destination = Some(addr),\n                                Err(..) => {\n                                    let err =\n                                        Error::new(ErrorKind::Malformed, \"`tun_interface_destination` invalid\", None);\n                                    return Err(err);\n                                }\n                            }\n                        }\n\n                        #[cfg(feature = \"local-tun\")]\n                        if let Some(tun_interface_name) = local.tun_interface_name {\n                            local_config.tun_interface_name = Some(tun_interface_name);\n                        }\n\n                        #[cfg(all(feature = \"local-tun\", unix))]\n                        if let Some(tun_device_fd_from_path) = local.tun_device_fd_from_path {\n                            local_config.tun_device_fd_from_path = Some(From::from(tun_device_fd_from_path));\n                        }\n\n                        #[cfg(feature = \"local\")]\n                        if let Some(socks5_auth_config_path) = local.socks5_auth_config_path {\n                            local_config.socks5_auth = Socks5AuthConfig::load_from_file(&socks5_auth_config_path)?;","sourceCodeStart":2004,"sourceCodeEnd":2040,"githubUrl":"https://github.com/shadowsocks/shadowsocks-rust/blob/8eb0f0a65b1d976ab6bed5787327ef86529b0435/crates/shadowsocks-service/src/config.rs#L2004-L2040","documentation":"Thrown while parsing a SIP008/JSON local config: the `tun_interface_destination` field failed to parse as an IpNet. The library expects a CIDR network (e.g. `1.2.3.0/24`) used as the TUN route destination; invalid strings yield ErrorKind::Malformed.","triggerScenarios":"Config parsing where a local entry has `tun_interface_destination` set to a non-CIDR string: bare IP, hostname, bad prefix length, or empty string.","commonSituations":"Routing destinations copied as single IPs without prefix; typos in IPv6 networks; mixing up address and netmask forms like `10.0.0.0/255.0.0.0`.","solutions":["Express the destination as CIDR, e.g. `\"tun_interface_destination\": \"1.2.3.0/24\"`","Check the prefix length fits the address family (0-32 / 0-128)","Replace netmask notation with prefix-length notation"],"exampleFix":"// before\n{\"tun_interface_destination\": \"10.0.0.0/255.0.0.0\"}\n// after\n{\"tun_interface_destination\": \"10.0.0.0/8\"}","handlingStrategy":"validation","validationCode":"fn valid_ipnet(s: &str) -> bool { s.parse::<ipnet::IpNet>().is_ok() }\n// before load: assert config[\"tun_interface_destination\"].as_str().map(valid_ipnet).unwrap_or(true)","typeGuard":"fn is_ipnet(s: &str) -> bool { s.parse::<ipnet::IpNet>().is_ok() }","tryCatchPattern":"match Config::load_from_json(...) { Err(e) if format!(\"{e}\").contains(\"tun_interface_destination\") => fix_and_retry(), ... }","preventionTips":["Convert netmask notation to prefix length before writing configs","Keep a list of valid route destinations in CIDR","Lint configs for missing /prefix on IP fields"],"tags":["config","tun","cidr"],"backgroundTag":"invalid-config-value","analyzedSha":"8eb0f0a65b1d976ab6bed5787327ef86529b0435","analyzedAt":"2026-09-09T12:20:43.168Z","contentChangedAt":"2026-09-09T12:20:43.168Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}