Skip to content

Commit

Permalink
make ifconfig parameters optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Clement-TS committed Apr 3, 2017
1 parent ba836ee commit 535c18c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ifconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,16 @@ function down(interface, callback) {
* };
*
* ifconfig.up(options, function(err) {
* // the interface is up
* // the interface is up
* });
*
* ipv4_address, ipv4_broadcast and ipv4_subnet_mask are optional
*/
function up(options, callback) {
return this.exec('ifconfig ' + options.interface +
' ' + options.ipv4_address +
' netmask ' + options.ipv4_subnet_mask +
' broadcast ' + options.ipv4_broadcast +
' ' +
(options.ipv4_address) ? options.ipv4_address : '0.0.0.0' +
(options.ipv4_subnet_mask) ? ' netmask ' + options.ipv4_subnet_mask : '' +
(options.ipv4_broadcast) ? ' broadcast ' + options.ipv4_broadcast : '' +
' up', callback);
}

0 comments on commit 535c18c

Please sign in to comment.