socket_ipv6.on('listening', assert.fail);
socket_ipv6.on('error', common.mustCall(function(e) {
- // EAFNOSUPPORT means IPv6 is disabled on this system.
- var code = (e.code === 'EADDRNOTAVAIL' ? e.code : 'EAFNOSUPPORT');
- assert.equal(e.message, 'bind ' + code + ' 111::1:' + common.PORT);
+ // EAFNOSUPPORT or EPROTONOSUPPORT means IPv6 is disabled on this system.
+ var allowed = ['EADDRNOTAVAIL', 'EAFNOSUPPORT', 'EPROTONOSUPPORT'];
+ assert.notEqual(allowed.indexOf(e.code), -1);
+ assert.equal(e.message, 'bind ' + e.code + ' 111::1:' + common.PORT);
assert.equal(e.address, '111::1');
assert.equal(e.port, common.PORT);
- assert.equal(e.code, code);
socket_ipv6.close();
}));