forked from premiere/premiere-libtorrent
fix scope_id in enum_routes on Windows
This commit is contained in:
parent
72cf4fd9ea
commit
4a578b1450
|
@ -1114,6 +1114,16 @@ int _System __libsocket_sysctl(int* mib, u_int namelen, void *oldp, size_t *oldl
|
||||||
{
|
{
|
||||||
ip_route r;
|
ip_route r;
|
||||||
r.gateway = sockaddr_to_address((const sockaddr*)&routes->Table[i].NextHop);
|
r.gateway = sockaddr_to_address((const sockaddr*)&routes->Table[i].NextHop);
|
||||||
|
#if TORRENT_USE_IPV6
|
||||||
|
// The scope_id in NextHop is always zero because that would make
|
||||||
|
// things too easy apparently
|
||||||
|
if (r.gateway.is_v6() && r.gateway.to_v6().is_link_local())
|
||||||
|
{
|
||||||
|
address_v6 gateway6 = r.gateway.to_v6();
|
||||||
|
gateway6.scope_id(routes->Table[i].InterfaceIndex);
|
||||||
|
r.gateway = gateway6;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
r.destination = sockaddr_to_address(
|
r.destination = sockaddr_to_address(
|
||||||
(const sockaddr*)&routes->Table[i].DestinationPrefix.Prefix);
|
(const sockaddr*)&routes->Table[i].DestinationPrefix.Prefix);
|
||||||
r.netmask = build_netmask(routes->Table[i].DestinationPrefix.PrefixLength
|
r.netmask = build_netmask(routes->Table[i].DestinationPrefix.PrefixLength
|
||||||
|
|
Loading…
Reference in New Issue