bazwilliams / node-ssdp Goto Github PK
View Code? Open in Web Editor NEWSimple Service Discovery for Node.js, handling Upnp NOTIFY and M-SEARCH requests.
License: MIT License
Simple Service Discovery for Node.js, handling Upnp NOTIFY and M-SEARCH requests.
License: MIT License
Hi,
there is currently an issue with a software called the "Nanoleaf adaptor for ioBroker" that uses this library for handling UDP multicasts. Unfortunately, here on my system it didn't work as expected, and I started debugging. I discovered that there is a bug in node-upnp-ssdp that I'm going to describe here in the following.
At first, you can read the whole story with a detailed analysis of this issue in this bug report: daniel-2k/ioBroker.nanoleaf-lightpanels#16.
Problem:
Your code binds a multicast listener to the first local IP address it finds, obtained via a call to ip.address(). On my system, I have two local interfaces: enp1s0 in direction to a PPPoE-driven ADSL modem, and br0 being my bridge towards my local LAN. In my setup, a call to ip.address() reveals the local IP address of enp1s0 instead of that of br0. This causes multicast communication to fail.
Furthermore, if i consider having multiple internal LAN segments (one for PCs, one for WLAN, one for gadgets...) this approach would also fail completely.
Solution:
The "addMembership" call should omit any IP address. Then the listener may bind to every suitable interface instead of just to a "random first local". By doing that, the interface selection ("ip mroute show") is performed on the basis of the current routing table. This is the expected behavior of an application dealing with UDP multicasts.
Fix:
The fix is trivial: please just remove the call to ip.address() while adding the multicast membership:
powerstation node-upnp-ssdp # diff index.js index.js~
86c86
< udpServer.addMembership(BROADCAST_ADDR);
---
> udpServer.addMembership(BROADCAST_ADDR, ip.address());
powerstation node-upnp-ssdp #
This fixes any of the observed misbehaviors of the referred ioBroker adaptor software and would also enable such software to run in setups having multiple internal LANs.
Thanks in advance for fixing this :-)
Florian
How does one send "Device Description" info from a Device to the Control Point using this module?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.