Thoughts about ipv6 white listing

Tore Anderson tore.anderson at redpill-linpro.com
Sat Dec 4 20:18:22 CET 2010


* Mikael Abrahamsson

> It would be great if someone would produce a opensource javascript (or
> alike) snippet which would try to verify if IPv6 connectivity was broken
> and give people some kind of "your IPv6 is broken and this will cause
> you problems in the future, please press ok that you're aware of
> this"-window on top of the website in question.

Here's something to get you started.  No copyright restrictions whatsoever,
but I'd be happy to hear about it if other sites are enabling something
like this too.  We intend to keep it running even after dual-stacking,
so that the users that endure the initial connect timeout will get the
warning (perhaps making it even more obvious and in-your-face).

$ curl -s http://www.vg.no | grep -A100 'Start of dualstack test code'
<!-- Start of dualstack test code -->
<img id="1x1_ds_testimg_1" class="1x1_ds_testimg" width="1" height="1">
<img id="1x1_ds_testimg_2" class="1x1_ds_testimg" width="1" height="1">
<img id="1x1_ds_testimg_3" class="1x1_ds_testimg" width="1" height="1">
<img id="1x1_v4_testimg_1" class="1x1_v4_testimg" width="1" height="1">
<img id="1x1_v4_testimg_2" class="1x1_v4_testimg" width="1" height="1">
<img id="1x1_v4_testimg_3" class="1x1_v4_testimg" width="1" height="1">
<img id="1x1_v4_only" class="1x1_v4_testimg" width="1" height="1">

<script language="javascript" type="text/javascript">
// record the number of dualstack and ipv4-only successes
var ds_ok = 0;
var v4_ok = 0;

$('.1x1_ds_testimg').load(function() {
	ds_ok++;
});

$('.1x1_v4_testimg').load(function() {
	v4_ok++;
});

var VGIpV6 = function () {
    var d = new Date();
    timestamp = d.getTime(); // Milliseconds
    timestamp = Math.round(timestamp / 1000); // Seconds

    // load the test images and try to bust some caches
    $('#1x1_ds_testimg_1').attr('src', 'http://ds-1.ipv6test.vgnett.no/ipv6/1x1.png?rand=' + timestamp);
    $('#1x1_ds_testimg_2').attr('src', 'http://ds-2.ipv6test.vgnett.no/ipv6/1x1.png?rand=' + timestamp);
    $('#1x1_ds_testimg_3').attr('src', 'http://ds-3.ipv6test.vgnett.no/ipv6/1x1.png?rand=' + timestamp);
    $('#1x1_v4_testimg_1').attr('src', 'http://v4-1.ipv6test.vgnett.no/ipv6/1x1.png?rand=' + timestamp);
    $('#1x1_v4_testimg_2').attr('src', 'http://v4-2.ipv6test.vgnett.no/ipv6/1x1.png?rand=' + timestamp);
    $('#1x1_v4_testimg_3').attr('src', 'http://v4-3.ipv6test.vgnett.no/ipv6/1x1.png?rand=' + timestamp);

    // check the result of the test after 15 seconds have passed
    var t = setTimeout(function() {
        // we take the conservative approach here.  100% success with
        // IPv4 combined with 0% success with dualstack is necessary
        // to give user a warning about broken IPv6
        if(v4_ok == 3 && ds_ok == 0) {
            $("head").append('<link rel="stylesheet" type="text/css" href="http://195.88.55.16/vgrett/css/vgrett.css?4" />');
            $("body").append('<div id="typoContainer"><h2>Du har en nettverksfeil!</h2>\
                                    <div class="trControls">\
                                        <p id="trMessages" class="trMessages">Du har problemer med IPv6</p>\
                                        <p class="trHelpLink trMessages" style="text-align: left;"><a target="_new" href="http://ipv6test.redpill-linpro.com/">Klikk her for hjelp</a></p>\
                                    </div>\
                                    \
                                  </div>');
            $('#1x1_v4_only').attr('src', 'http://v4-1.ipv6test.vgnett.no/ipv6/1x1.png?counter=koseklemz&rand=' + d.getTime());
        }
    }, 5000);
}();
</script>

BR,
-- 
Tore Anderson
Redpill Linpro AS - http://www.redpill-linpro.com/
Tel: +47 21 54 41 27


More information about the ipv6-ops mailing list