Permalink
Browse files

[iface] ugly hack to enforce a loopback interface index of 1 on linux

  • Loading branch information...
1 parent a1529d1 commit 34641a3e9e1d49dc7beb4634d8e32e931faff2e2 @agnat committed Dec 26, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/network_interface.js
View
@@ -40,11 +40,15 @@ exports.interfaceIndex = function interfaceIndex(options) {
index = networkInterface;
}
}
+ //console.log('interface index:', index);
return index;
}
exports.loopbackInterface = function loopbackInterface() {
- if (typeof dns_sd.kDNSServiceInterfaceIndexLocalOnly !== 'undefined') {
+ // XXX This is wild guessing. It will break if somebody uses mDNSResponder
+ // on linux or avahi on any other platform. What is needed is a proper
+ // check that we are running on avahi.
+ if (os.platform() !== 'linux' && typeof dns_sd.kDNSServiceInterfaceIndexLocalOnly !== 'undefined') {
return dns_sd.kDNSServiceInterfaceIndexLocalOnly;
} else {
var interfaces = os.networkInterfaces();

0 comments on commit 34641a3

Please sign in to comment.