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

Unexpected IP Address In SSDP Server Advertising

Open cjames9001 opened this issue 3 years ago • 0 comments

I've created an SSDP server and I've given it a specific location, however the advertise-alive has messages with the expected ip of 172.16.1.47, but there are also unexpected messages being broadcast of 169.254.204.77.

This is running on a raspberry pi, I recently upgraded all my packages on the box, so this may be broken as a result of that occurring. Can someone help me understand why this isn't using the 172 address for every message? The client I'm communicating with is always picking up the wrong ip address (169.254.204.77) and then unable to communicate with my device at the correct ip address (172.16.1.47)

Here is the snippet of code for my server:

var SSDP = require('node-ssdp').Server
  , server = new SSDP({
          location: '172.16.1.47:8080/ssdp/device-desc.xml',
          udn: 'uuid:6b36a922-3d85-477e-8ec9-d87f415fc0b6'
  })

server.addUSN('urn:schemas-upnp-org:device:MyDevice:1')

server.on('advertise-alive', function (heads) {
  console.log('advertise-alive', heads)
})

server.on('advertise-bye', function (heads) {
  console.log('advertise-bye', heads)
})

// start server on all interfaces
server.start()
  .catch(e => {
    console.log('Failed to start server:', e)
  })
  .then(() => {
    console.log('Server started.')
  })

Here is the output I am getting:

advertise-alive { HOST: '239.255.255.250:1900',
  NT: 'urn:schemas-upnp-org:device:MyDevice:1',
  NTS: 'ssdp:alive',
  USN:
   'uuid:6b36a922-3d85-477e-8ec9-d87f415fc0b6::urn:schemas-upnp-org:device:MyDevice:1',
  'CACHE-CONTROL': 'max-age=1800',
  SERVER: 'node.js/10.21.0 UPnP/1.1 node-ssdp/4.0.0',
  LOCATION: 'http://169.254.204.77:8080/ssdp/device-desc.xml' }          //WHERE IS THIS COMING FROM?!
advertise-alive { HOST: '239.255.255.250:1900',
  NT: 'uuid:6b36a922-3d85-477e-8ec9-d87f415fc0b6',
  NTS: 'ssdp:alive',
  USN: 'uuid:6b36a922-3d85-477e-8ec9-d87f415fc0b6',
  'CACHE-CONTROL': 'max-age=1800',
  SERVER: 'node.js/10.21.0 UPnP/1.1 node-ssdp/4.0.0',
  LOCATION: 'http://169.254.204.77:8080/ssdp/device-desc.xml' }            //WHERE IS THIS COMING FROM?!
advertise-alive { HOST: '239.255.255.250:1900',
  NT: 'urn:schemas-upnp-org:device:MyDevice:1',
  NTS: 'ssdp:alive',
  USN:
   'uuid:6b36a922-3d85-477e-8ec9-d87f415fc0b6::urn:schemas-upnp-org:device:MyDevice:1',
  LOCATION: '172.16.1.47:8080/ssdp/device-desc.xml',
  'CACHE-CONTROL': 'max-age=1800',
  SERVER: 'node.js/10.21.0 UPnP/1.1 node-ssdp/4.0.0' }
advertise-alive { HOST: '239.255.255.250:1900',
  NT: 'uuid:6b36a922-3d85-477e-8ec9-d87f415fc0b6',
  NTS: 'ssdp:alive',
  USN: 'uuid:6b36a922-3d85-477e-8ec9-d87f415fc0b6',
  LOCATION: '172.16.1.47:8080/ssdp/device-desc.xml',                        //This is what I am expecting
  'CACHE-CONTROL': 'max-age=1800',
  SERVER: 'node.js/10.21.0 UPnP/1.1 node-ssdp/4.0.0' }

cjames9001 avatar Nov 21 '20 18:11 cjames9001