Closed embhorn closed 12 months ago
Tested and working. Perhaps add some of the PR notes into the SN example section of the README
I added a new README for the MQTT-SN examples. It was getting pretty long, so makes sense to move it.
Ready for merge!
Tested with mosquitto as broker, https://github.com/eclipse/paho.mqtt-sn.embedded-c as gateway.
MQTTSNGateway/gateway.conf
. Also set paths to DTLS cert / key....
-DtlsCertsKey=/etc/ssl/certs/gateway.pem -DtlsPrivKey=/etc/ssl/private/privkey.pem +#DtlsCertsKey=/etc/ssl/certs/gateway.pem +DtlsCertsKey=//wolfssl/certs/server-cert.pem
+#DtlsPrivKey=/etc/ssl/private/privkey.pem
+DtlsPrivKey=//wolfssl/certs/server-key.pem
diff --git a/MQTTSNGateway/src/linux/dtls/SensorNetwork.cpp b/MQTTSNGateway/src/linux/dtls/SensorNetwork.cpp index 3f2dcf3..363d0ba 100644 --- a/MQTTSNGateway/src/linux/dtls/SensorNetwork.cpp +++ b/MQTTSNGateway/src/linux/dtls/SensorNetwork.cpp @@ -308,7 +308,7 @@ Connections::~Connections() { for (int i = 0; i < _numfds; i++) {
if (_ssls[i] > 0)
if (_ssls[i] > (SSL *)0) { SSL_shutdown(_ssls[i]); SSL_free(_ssls[i]); @@ -416,7 +416,7 @@ void Connections::close(int index) } }
if (ssl > 0)
if (ssl > (SSL *)0) { _numfds--; SSL_shutdown(ssl);
Build gateway with DTLS:
<gateway-folder>/MQTTSNGateway$ ./build.sh dtls
./configure --enable-dtls && make && sudo make install
./configure --enable-sn && make
mosquitto
<gateway-folder>/MQTTSNGateway$ ./bin/MQTT-SNGateway
./examples/sn-client/sn-client -t