diff --git a/MQTTSNGateway/src/MQTTSNGWVersion.h b/MQTTSNGateway/src/MQTTSNGWVersion.h index 275be35..f09e7f9 100644 --- a/MQTTSNGateway/src/MQTTSNGWVersion.h +++ b/MQTTSNGateway/src/MQTTSNGWVersion.h @@ -17,6 +17,6 @@ #ifndef MQTTSNGWVERSION_H_IN_ #define MQTTSNGWVERSION_H_IN_ -#define PAHO_GATEWAY_VERSION "1.6.0" +#define PAHO_GATEWAY_VERSION "1.5.1" #endif /* MQTTSNGWVERSION_H_IN_ */ diff --git a/MQTTSNGateway/src/linux/udp6/SensorNetwork.cpp b/MQTTSNGateway/src/linux/udp6/SensorNetwork.cpp index 193d1d7..353d793 100644 --- a/MQTTSNGateway/src/linux/udp6/SensorNetwork.cpp +++ b/MQTTSNGateway/src/linux/udp6/SensorNetwork.cpp @@ -416,12 +416,24 @@ int UDPPort6::unicast(const uint8_t* buf, uint32_t length, SensorNetAddress* add int UDPPort6::broadcast(const uint8_t* buf, uint32_t length) { - int err = unicast(buf, length, &_grpAddr); + sockaddr_in6 dest; + memset(&dest, 0, sizeof(dest)); + dest.sin6_family = AF_INET6; + dest.sin6_port = _grpAddr.getPortNo(); + memcpy(dest.sin6_addr.s6_addr, (const void*) &_grpAddr.getIpAddress()->sin6_addr, sizeof(in6_addr)); - if (err < 0) +#ifdef DEBUG_NW + char addrBuf[INET6_ADDRSTRLEN]; + addr->sprint(addrBuf); + D_NWSTACK("sendto %s\n", addrBuf); +#endif + + int status = ::sendto(_pollfds[1].fd, buf, length, 0, (const sockaddr*) &dest, sizeof(dest)); + + if (status < 0) { D_NWSTACK("UDP6::broadcast - sendto: %s", strerror(errno)); - return err; + return status; } return 0;