Giter Club home page Giter Club logo

node-ssdp's People

Contributors

kylegordon avatar manufacturedba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

node-ssdp's Issues

Multicast listener choses wrong interface on multi-homed system

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.