node-dhcp icon indicating copy to clipboard operation
node-dhcp copied to clipboard

listen/bind to specific IP doesn't pickup broadcast requests

Open nistorj opened this issue 7 years ago • 0 comments

Hi!

Looks like when you specific an IP to bind to the broadcast DHCP requests are ignored, for example:

var dhcp = require('dhcp');
var s = dhcp.createBroadcastHandler();
s.on('message', function (data) {
  if (data.options[53] === dhcp.DHCPDISCOVER)
  {
    console.log('DHCP Discover from ' + data.chaddr );
  } else {
    console.log('DHCP Other from ' + data.chaddr );
  }
});

s.listen();

This code snip-ip works fine: DHCP Discover from 98-4B-E1-61-23-CE DHCP Discover from 98-4B-E1-61-41-A6

However when trying to bind with: s.listen(null,bind);

Packet captures show DHCP but there are no responses from the node instance.

nistorj avatar Nov 27 '18 21:11 nistorj