mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-16 18:24:36 +00:00
Needed to not fix the multicast socket to a specific ip address
This is when upnp use interface only
This commit is contained in:
@@ -90,10 +90,11 @@ public class UpnpListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (useUpnpIface)
|
// This commented out code does not work... leave for review
|
||||||
upnpMulticastSocket = new MulticastSocket(
|
// if (useUpnpIface)
|
||||||
new InetSocketAddress(upnpConfigIP, Configuration.UPNP_DISCOVERY_PORT));
|
// upnpMulticastSocket = new MulticastSocket(
|
||||||
else
|
// new InetSocketAddress(upnpConfigIP, Configuration.UPNP_DISCOVERY_PORT));
|
||||||
|
// else
|
||||||
upnpMulticastSocket = new MulticastSocket(Configuration.UPNP_DISCOVERY_PORT);
|
upnpMulticastSocket = new MulticastSocket(Configuration.UPNP_DISCOVERY_PORT);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Upnp Discovery Port is in use, or restricted by admin (try running with sudo or admin privs): "
|
log.error("Upnp Discovery Port is in use, or restricted by admin (try running with sudo or admin privs): "
|
||||||
@@ -136,7 +137,7 @@ public class UpnpListener {
|
|||||||
if (traceupnp)
|
if (traceupnp)
|
||||||
log.info("Traceupnp: Interface: " + name + " valid usable IP address: " + addr);
|
log.info("Traceupnp: Interface: " + name + " valid usable IP address: " + addr);
|
||||||
IPsPerNic++;
|
IPsPerNic++;
|
||||||
} else if (addr.getHostAddress().equals(upnpConfigIP)) {
|
} else if (useUpnpIface && (addr.getHostAddress().equals(upnpConfigIP) || name.equals("lo"))) {
|
||||||
if (traceupnp)
|
if (traceupnp)
|
||||||
log.info("Traceupnp: Interface: " + name + " matches upnp config address of IP address: "
|
log.info("Traceupnp: Interface: " + name + " matches upnp config address of IP address: "
|
||||||
+ addr);
|
+ addr);
|
||||||
@@ -266,6 +267,7 @@ public class UpnpListener {
|
|||||||
protected boolean isSSDPDiscovery(DatagramPacket packet) {
|
protected boolean isSSDPDiscovery(DatagramPacket packet) {
|
||||||
// Only respond to discover request for strict upnp form
|
// Only respond to discover request for strict upnp form
|
||||||
String packetString = new String(packet.getData(), 0, packet.getLength());
|
String packetString = new String(packet.getData(), 0, packet.getLength());
|
||||||
|
// log.info("Packet string <<<" + packetString + ">>>");
|
||||||
if (packetString != null && packetString.startsWith("M-SEARCH * HTTP/1.1")
|
if (packetString != null && packetString.startsWith("M-SEARCH * HTTP/1.1")
|
||||||
&& packetString.contains("\"ssdp:discover\"")) {
|
&& packetString.contains("\"ssdp:discover\"")) {
|
||||||
if ((packetString.contains("ST: urn:schemas-upnp-org:device:basic:1")
|
if ((packetString.contains("ST: urn:schemas-upnp-org:device:basic:1")
|
||||||
|
|||||||
Reference in New Issue
Block a user