File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -66,23 +66,18 @@ module.exports = class Controller {
66
66
var alias = 0 ;
67
67
68
68
ifaces [ ifname ] . forEach ( function ( iface ) {
69
- if ( 'IPv4' !== iface . family || iface . internal !== false ) {
69
+ if ( 'IPv4' !== iface . family || iface . internal !== false ) {
70
70
// skip over internal (i.e. 127.0.0.1) and non-ipv4 addresses
71
+ alias ++ ;
71
72
return ;
72
73
}
73
74
74
- if ( alias >= 1 ) {
75
- // this single interface has multiple ipv4 addresses
76
- //console.log(ifname + ':' + alias, iface.address);
77
- } else {
78
- // this interface has only one ipv4 adress
79
- //console.log(ifname, iface.address, iface.netmask);
80
- if ( searchIf == "" ) {
81
- searchIf = ifname ;
82
- searchalias = alias + 1 ;
83
- }
75
+ // use first external ipv4 address found in interface
76
+ // this may cause the wrong address to be selected if there are multiple ipv4 addresses in the interface
77
+ if ( searchIf == "" ) {
78
+ searchIf = ifname ;
79
+ searchalias = alias ;
84
80
}
85
- ++ alias ;
86
81
} ) ;
87
82
} ) ;
88
83
You can’t perform that action at this time.
0 commit comments