shadowsocks/shadowsocks-rust · error

invalid `fake_dns_ipv6_network`

Error message

invalid `fake_dns_ipv6_network`

What it means

Thrown while parsing a local (SIP008/JSON) config: `fake_dns_ipv6_network` could not be parsed as an Ipv6Net. Fake-DNS needs a valid IPv6 CIDR range; any other string is rejected with ErrorKind::Malformed.

Source

Thrown at crates/shadowsocks-service/src/config.rs:2068

                            if let Some(d) = local.fake_dns_record_expire_duration {
                                local_config.fake_dns_record_expire_duration = Some(Duration::from_secs(d));
                            }
                            if let Some(n) = local.fake_dns_ipv4_network {
                                match n.parse::<Ipv4Net>() {
                                    Ok(n) => local_config.fake_dns_ipv4_network = Some(n),
                                    Err(..) => {
                                        let err =
                                            Error::new(ErrorKind::Malformed, "invalid `fake_dns_ipv4_network`", None);
                                        return Err(err);
                                    }
                                }
                            }
                            if let Some(n) = local.fake_dns_ipv6_network {
                                match n.parse::<Ipv6Net>() {
                                    Ok(n) => local_config.fake_dns_ipv6_network = Some(n),
                                    Err(..) => {
                                        let err =
                                            Error::new(ErrorKind::Malformed, "invalid `fake_dns_ipv6_network`", None);
                                        return Err(err);
                                    }
                                }
                            }
                            if let Some(p) = local.fake_dns_database_path {
                                local_config.fake_dns_database_path = Some(p.into());
                            }
                        }

                        let mut local_instance = LocalInstanceConfig {
                            config: local_config,
                            acl: None,
                        };

                        if let Some(acl_path) = local.acl {
                            let acl = match AccessControl::load_from_file(&acl_path) {
                                Ok(acl) => acl,
                                Err(err) => {

View on GitHub (pinned to 8eb0f0a65b)

Solutions

  1. Use a valid IPv6 CIDR, e.g. `"fake_dns_ipv6_network": "fc00::/18"`
  2. Confirm the value contains colons and prefix is 0-128
  3. Append a prefix length if only an address was given

Example fix

// before
{"fake_dns_ipv6_network": "fc00::"}
// after
{"fake_dns_ipv6_network": "fc00::/18"}
Defensive patterns

Strategy: validation

Validate before calling

fn valid_ipv6net(s: &str) -> bool { s.parse::<ipnet::Ipv6Net>().is_ok() }
// before load: assert config["fake_dns_ipv6_network"].as_str().map(valid_ipv6net).unwrap_or(true)

Type guard

fn is_ipv6net(s: &str) -> bool { s.parse::<ipnet::Ipv6Net>().is_ok() }

Try / catch

match Config::load_from_json(...) { Err(e) if format!("{e}").contains("fake_dns_ipv6_network") => fix_and_retry(), ... }

Prevention

When it happens

Trigger: Config parsing with `fake_dns_ipv6_network` set to a non-IPv6-CIDR value: an IPv4 network, a bare IPv6 address without prefix, or malformed text.

Common situations: Configuring fake-dns IPv6 ranges by hand; using IPv4 ranges in the IPv6 field; typos in IPv6 addresses.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of shadowsocks/shadowsocks-rust@8eb0f0a65b (2026-09-09). Data as JSON: /api/errors/a6769eaf8ae9df81. Report an issue: GitHub.