diff --git a/src/enum_net.cpp b/src/enum_net.cpp index c6820eb01..34b68c65d 100644 --- a/src/enum_net.cpp +++ b/src/enum_net.cpp @@ -718,11 +718,22 @@ namespace libtorrent for (int i = 0; i < int(ips.size()); ++i) { ip_route r; - r.destination = address_v4(); - r.netmask = address_v4::from_string("255.255.255.0"); - address_v4::bytes_type b = ips[i].to_v4().to_bytes(); - b[3] = 1; - r.gateway = address_v4(b); + if (ips[i].is_v4()) + { + r.destination = address_v4(); + r.netmask = address_v4::from_string("255.255.255.0"); + address_v4::bytes_type b = ips[i].to_v4().to_bytes(); + b[3] = 1; + r.gateway = address_v4(b); + } + else + { + r.destination = address_v6(); + r.netmask = address_v6::from_string("FFFF:FFFF:FFFF:FFFF::0"); + address_v6::bytes_type b = ips[i].to_v6().to_bytes(); + b[14] = 1; + r.gateway = address_v6(b); + } strcpy(r.name, "eth0"); r.mtu = ios.sim().config().path_mtu(ips[i], ips[i]); ret.push_back(r);