X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/9eaeac69829469108bce954ccce0710bbdb27fb3..31d4361fb52761b6486f55af10268a51ee536a6f:/dnscore.pas?ds=inline

diff --git a/dnscore.pas b/dnscore.pas
index 7cbb828..18e40c9 100644
--- a/dnscore.pas
+++ b/dnscore.pas
@@ -204,7 +204,6 @@ procedure reportlag(id:integer;lag:integer); //lag should be in microseconds and
 
 
 {$ifdef ipv6}
-function getv6localips:tbiniplist;
 procedure initpreferredmode;
 
 var
@@ -221,9 +220,9 @@ implementation
 
 uses
   {$ifdef win32}
-    windows,winsock,
+    windows,
   {$endif}
-
+  lcorelocalips,
   sysutils;
 
 
@@ -750,68 +749,8 @@ begin
 end;
 
 
-
 {$ifdef ipv6}
 
-{$ifdef linux}
-function getv6localips:tbiniplist;
-var
-  t:textfile;
-  s,s2:ansistring;
-  ip:tbinip;
-  a:integer;
-begin
-  result := biniplist_new;
-
-  assignfile(t,'/proc/net/if_inet6');
-  {$i-}reset(t);{$i+}
-  if ioresult <> 0 then exit; {none found, return empty list}
-
-  while not eof(t) do begin
-    readln(t,s);
-    s2 := '';
-    for a := 0 to 7 do begin
-      if (s2 <> '') then s2 := s2 + ':';
-      s2 := s2 + copy(s,(a shl 2)+1,4);
-    end;
-    ipstrtobin(s2,ip);
-    if ip.family <> 0 then biniplist_add(result,ip);
-  end;
-  closefile(t);
-end;
-
-{$else}
-
-{the following code's purpose is to determine what IP windows would come from, to reach an IP
-it can be abused to find if there's any global v6 IPs, getaddrinfo seems unreliable (not working on XP atleast)
-}
-const
-  SIO_ROUTING_INTERFACE_QUERY = $c8000014;
-  function WSAIoctl(s: TSocket; code:integer; const Buf; len: Integer; var output; outlen:integer; var outreturned: Integer; overlapped:pointer; completion: pointer): Integer; stdcall; external 'ws2_32.dll' name 'WSAIoctl';
-
-function getlocalipforip(const ip:tbinip):tbinip;
-var
-  handle:integer;
-  a,b:integer;
-  inaddrv,inaddrv2:tinetsockaddrv;
-  srcx:winsock.tsockaddr absolute inaddrv2;
-begin
-  makeinaddrv(ip,'0',inaddrv);
-  handle := Socket(inaddrv.inaddr.family,SOCK_DGRAM,IPPROTO_UDP);
-  if WSAIoctl(handle, SIO_ROUTING_INTERFACE_QUERY, inaddrv, sizeof(inaddrv), inaddrv2, sizeof(inaddrv2), a, nil, nil) <> 0
-  then raise exception.create('getlocalipforip failed with error: '+inttostr(wsagetlasterror));
-  result := inaddrvtobinip(inaddrv2);
-  closesocket(handle);
-end;
-
-function getv6localips:tbiniplist;
-begin
-  result := biniplist_new;
-  {this IP is chosen because it's the first normal global v6 IP that has no special purpose}
-  biniplist_add(result,getlocalipforip(ipstrtobinf('2001:200::')));
-end;
-{$endif}
-
 procedure initpreferredmode;
 var
   l:tbiniplist;