X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/85edf7ed5948e0efe59301680f79ea0bac4367e8..b60a32da0a15deb572474b1f66a6c63695ed7491:/dnscore.pas?ds=sidebyside diff --git a/dnscore.pas b/dnscore.pas index e38f35f..08f99d1 100644 --- a/dnscore.pas +++ b/dnscore.pas @@ -684,31 +684,16 @@ end; {$ifdef ipv6} procedure initpreferredmode; -var - l:tbiniplist; - a:integer; - ip:tbinip; - ipmask_global,ipmask_6to4,ipmask_teredo:tbinip; - begin if preferredmodeinited then exit; if useaf <> useaf_default then exit; - l := getv6localips; - if biniplist_getcount(l) = 0 then exit; - useaf := useaf_preferv4; - ipstrtobin('2000::',ipmask_global); - ipstrtobin('2001::',ipmask_teredo); - ipstrtobin('2002::',ipmask_6to4); - {if there is any v6 IP which is globally routable and not 6to4 and not teredo, prefer v6} - for a := biniplist_getcount(l)-1 downto 0 do begin - ip := biniplist_get(l,a); - if not comparebinipmask(ip,ipmask_global,3) then continue; - if comparebinipmask(ip,ipmask_teredo,32) then continue; - if comparebinipmask(ip,ipmask_6to4,16) then continue; - useaf := useaf_preferv6; - preferredmodeinited := true; - exit; - end; + + if (have_ipv6_connectivity) then + useaf := useaf_preferv6 + else + useaf := useaf_preferv4; + + preferredmodeinited := true; end; {$endif}