Comparing version 0.2.7 to 0.2.8
@@ -23,5 +23,5 @@ #!/usr/bin/env node | ||
client.on('bound', function() { | ||
client.on('bound', function(state) { | ||
var opt = this._state.options; | ||
var opt = state.options; | ||
@@ -28,0 +28,0 @@ // Print all requested options |
@@ -14,2 +14,6 @@ #!/usr/bin/env node | ||
dhcp.on('bound', function(state) { | ||
console.log(state); | ||
}); | ||
for (var arg in argv) { | ||
@@ -16,0 +20,0 @@ if (arg === '_') { |
@@ -19,5 +19,5 @@ | ||
s.on('bound', function () { | ||
s.on('bound', function (state) { | ||
console.log("State: ", this._state); | ||
console.log("State: ", state); | ||
@@ -24,0 +24,0 @@ // `ip address add IP/MASK dev eth0` |
@@ -47,5 +47,5 @@ | ||
s.on('bound', function() { | ||
s.on('bound', function(state) { | ||
console.log("BOUND:"); | ||
console.log(this._state); | ||
console.log(state); | ||
}); | ||
@@ -52,0 +52,0 @@ |
@@ -146,3 +146,3 @@ /** | ||
var values = Options.opts[optId].enum; | ||
console.log(values) | ||
// Check if value is an actual enum string | ||
@@ -214,13 +214,13 @@ for (var i in values) { | ||
* IP Selection algorithm: | ||
* | ||
* | ||
* 0. Is Mac already known, send same IP of known lease | ||
* | ||
* | ||
* 1. Is there a wish for static binding? | ||
* | ||
* | ||
* 2. Are all available IP's occupied? | ||
* - Send release to oldest lease and reuse | ||
* | ||
* | ||
* 3. is config randomIP? | ||
* - Select random IP of range, until no occupied slot is found | ||
* | ||
* | ||
* 4. Take first unmapped IP of range | ||
@@ -292,3 +292,3 @@ * | ||
var ip = Tools.formatIp(firstIP + Math.random() * (lastIP - firstIP + 1) | 0); | ||
var ip = Tools.formatIp(firstIP + Math.random() * (lastIP - firstIP) | 0); | ||
@@ -315,3 +315,3 @@ if (ips.indexOf(ip) === -1) { | ||
handleDiscover: function(req) { | ||
console.log('Handle Discover', req); | ||
//console.log('Handle Discover', req); | ||
@@ -328,3 +328,3 @@ var lease = this._state[req.chaddr] = this._state[req.chaddr] || new Lease; | ||
console.log('Send Offer'); | ||
//console.log('Send Offer'); | ||
@@ -373,3 +373,3 @@ // Formulate the response object | ||
sendAck: function(req) { | ||
console.log('Send ACK'); | ||
//console.log('Send ACK'); | ||
// Formulate the response object | ||
@@ -398,3 +398,3 @@ var ans = { | ||
this.emit('bound'); | ||
this.emit('bound', this._state); | ||
@@ -406,3 +406,3 @@ // Send the actual data | ||
sendNak: function(req) { | ||
console.log('Send NAK'); | ||
//console.log('Send NAK'); | ||
// Formulate the response object | ||
@@ -463,3 +463,3 @@ var ans = { | ||
} else { | ||
console.log('Sent ', bytes, 'bytes'); | ||
//console.log('Sent ', bytes, 'bytes'); | ||
} | ||
@@ -568,3 +568,3 @@ }); | ||
var def = [ | ||
1, // netmask | ||
1, // netmask | ||
3, // routers | ||
@@ -606,3 +606,3 @@ 51, // lease time | ||
console.log('Send Discover'); | ||
//console.log('Send Discover'); | ||
@@ -646,3 +646,3 @@ var mac = this.config('mac'); | ||
handleOffer: function(req) { | ||
console.log('Handle Offer', req); | ||
//console.log('Handle Offer', req); | ||
@@ -664,3 +664,3 @@ // Select an offer out of all offers | ||
console.log('Send Request'); | ||
//console.log('Send Request'); | ||
@@ -707,3 +707,3 @@ // Formulate the response object | ||
// We now know the IP for sure | ||
console.log('Handle ACK', req); | ||
//console.log('Handle ACK', req); | ||
@@ -774,3 +774,3 @@ this._state.bindTime = new Date; | ||
this.emit('bound'); | ||
this.emit('bound', this._state); | ||
@@ -784,3 +784,3 @@ } else { | ||
console.log('Send Release'); | ||
//console.log('Send Release'); | ||
@@ -822,3 +822,3 @@ // Formulate the response object | ||
console.log('Send Renew'); | ||
//console.log('Send Renew'); | ||
@@ -860,3 +860,3 @@ // TODO: check ans against rfc | ||
console.log('Send Rebind'); | ||
//console.log('Send Rebind'); | ||
@@ -918,3 +918,3 @@ // TODO: check ans against rfc | ||
} else { | ||
console.log('Sent ', bytes, 'bytes'); | ||
//console.log('Sent ', bytes, 'bytes'); | ||
} | ||
@@ -921,0 +921,0 @@ }); |
@@ -477,6 +477,13 @@ | ||
config: 'subnetSelection' | ||
}, /* | ||
119: { // dns search list | ||
}, */ | ||
}, | ||
119: { // dns search list | ||
name: 'Domain Search List', | ||
type: 'ASCII', | ||
config: 'domainSearchList' | ||
}, | ||
121: { // rfc 3442 | ||
name: 'Classless Route Option Format', | ||
type: 'IPs', | ||
config: 'classlessRoute' | ||
}, | ||
145: {// RFC 6704: https://tools.ietf.org/html/rfc6704 | ||
@@ -483,0 +490,0 @@ name: 'Forcerenew Nonce', |
{ | ||
"name": "dhcp", | ||
"title": "dhcp", | ||
"version": "0.2.7", | ||
"version": "0.2.8", | ||
"homepage": "https://github.com/infusion/node-dhcp", | ||
@@ -6,0 +6,0 @@ "bugs": { |
@@ -33,13 +33,13 @@ | ||
When installed globally, node-dhcp provides two executables, a client `dhcp` and a server `dhcpd`. The client simply retrieves network configuration from a DHCP server and prints the configuration after a complete handshake. All additional fields can be specified as list of arguments: | ||
When installed globally, node-dhcp provides two executables, a client `dhcp` and a server `dhcpd`. The client simply retrieves network configuration from a DHCP server and prints the configuration after a complete handshake. All additional (defined in `lib/options.js`) fields can be specified as list of arguments: | ||
```bash | ||
# sudo dhcp hostname | ||
# sudo dhcp hostname [--mac 12:23:34:45:56:67] | ||
// output: | ||
// netmask : 255.255.255.0 | ||
// router : 192.168.1.1 | ||
// dns : 8.8.8.8, 8.8.4.4 | ||
// server : 192.168.1.1 | ||
// hostname : web392 | ||
output: | ||
netmask : 255.255.255.0 | ||
router : 192.168.1.1 | ||
dns : 8.8.8.8, 8.8.4.4 | ||
server : 192.168.1.1 | ||
hostname : web392 | ||
``` | ||
@@ -53,3 +53,3 @@ | ||
The more powerful interface however, is the JavaScript API. | ||
All available options can be found in `lib/options.js`. The more powerful interface however, is the JavaScript API. | ||
@@ -99,5 +99,5 @@ Simple DHCP Server | ||
s.on('bound', function () { | ||
s.on('bound', function (state) { | ||
console.log("State: ", this._state); | ||
console.log("State: ", state); | ||
@@ -104,0 +104,0 @@ // Configure your host system, based on the current state: |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73212
2095