Skip to content

Commit f4ad465

Browse files
committed
make ifconfig parameters optional
1 parent ba836ee commit f4ad465

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

ifconfig.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,16 @@ function down(interface, callback) {
236236
* };
237237
*
238238
* ifconfig.up(options, function(err) {
239-
* // the interface is up
239+
* // the interface is up
240240
* });
241241
*
242+
* ipv4_address, ipv4_broadcast and ipv4_subnet_mask are optional
242243
*/
243244
function up(options, callback) {
244245
return this.exec('ifconfig ' + options.interface +
245-
' ' + options.ipv4_address +
246-
' netmask ' + options.ipv4_subnet_mask +
247-
' broadcast ' + options.ipv4_broadcast +
246+
' ' +
247+
(options.ipv4_address ? options.ipv4_address : '0.0.0.0') +
248+
(options.ipv4_subnet_mask ? ' netmask ' + options.ipv4_subnet_mask : '') +
249+
(options.ipv4_broadcast ? ' broadcast ' + options.ipv4_broadcast : '') +
248250
' up', callback);
249251
}

0 commit comments

Comments
 (0)