martin-ger / mqtt_vpn Goto Github PK
View Code? Open in Web Editor NEWIP over MQTT for ESP controllers and Linux
IP over MQTT for ESP controllers and Linux
Hi thank you for this great library my problem is on esp8266 compiles and uploads fine but nothing is happening icant ping the esp8266 ip and broker shows no esp8266 registered with mqttip/10.0.1.2, while on the esp32 version works perfectly ping and registration on broker shows up. Im using the latest 3.0.2 board version of esp8266 Ive also tested in 2.6.3 not working either.
Hello, I see that this project supports Websocket(WS) but the problem is it is close(the connection is dropped) after 1 or 2 seconds. I have no idea why. Any suggestion or configuration to solve this?
hello,
i was installing paho mqtt c client library and libnacl-dev on ubuntu 18.04.2 LTS, when me run a gcc compiler on terminal, it says error,
bengkelrobot:~/Desktop/MQTT_VPN-master/paho.mqtt.c$ gcc mqtt_vpn.c
/tmp/ccYrhtKs.o: In function msgarrvd': mqtt_vpn.c:(.text+0x71e): undefined reference to
crypto_secretbox_xsalsa20poly1305_ref_open'
mqtt_vpn.c:(.text+0x7cb): undefined reference to MQTTClient_freeMessage' mqtt_vpn.c:(.text+0x7d7): undefined reference to
MQTTClient_free'
/tmp/ccYrhtKs.o: In function main': mqtt_vpn.c:(.text+0xc19): undefined reference to
crypto_hash_sha512_ref'
mqtt_vpn.c:(.text+0x1205): undefined reference to MQTTClient_create' mqtt_vpn.c:(.text+0x1242): undefined reference to
MQTTClient_setCallbacks'
mqtt_vpn.c:(.text+0x127d): undefined reference to MQTTClient_connect' mqtt_vpn.c:(.text+0x1360): undefined reference to
MQTTClient_subscribe'
mqtt_vpn.c:(.text+0x13cc): undefined reference to MQTTClient_subscribe' mqtt_vpn.c:(.text+0x16ee): undefined reference to
crypto_secretbox_xsalsa20poly1305_ref'
mqtt_vpn.c:(.text+0x174d): undefined reference to `MQTTClient_publishMessage'
collect2: error: ld returned 1 exit status
how to solve it?
note: sorry my english isn't good :)
This error happen after a few MQTT request/response. However, if I remove MQTT the code program work fine.
"ERROR Message"
assertion "pbuf_free: p->ref > 0" failed: file "/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/pbuf.c", line 766, function: pbuf_free
abort() was called at PC 0x4010df83 on core 0
The error decoder point it to: 0x400da8e1: packet_receive_handler at /Users/***/-Firmware-master/mqttif.c:350
After several days failure to find out the real issue, it look like the problem is here
static void packet_receive_handler(void* handler_args, esp_event_base_t base, int32_t id, void* event_data)
{ ...
if (mqtt_if->netif.input(pb, &mqtt_if->netif) != ERR_OK)
...
The hard part for me is that it happen randomly after several MQTT message received.
You write "Requires the Paho MQTT C client library (https://www.eclipse.org/paho/files/mqttdoc/MQTTClient/html/index.html) and libnacl for encryption operations." Was it difficult to describe the installation process? I've been struggling for a whole day now trying to run your code on Ubuntu...
i am trying to execute:
gcc -o mqtt_vpn /mqtt_vpn.c -l paho-mqtt3c
but keep getting the error:
/ usr / bin / ld: /tmp/ccjrc57w.o: in the "msgarrvd" function:
mqtt_vpn.c :(. text + 0x8dc): undefined reference to "crypto_secretbox_xsalsa20poly1305_ref_open"
/ usr / bin / ld: /tmp/ccjrc57w.o: in the "main" function:
mqtt_vpn.c :(. text + 0xfa0): undefined reference to "crypto_hash_sha512_ref"
/ usr / bin / ld: mqtt_vpn.c :(. text + 0x1874): undefined reference to "crypto_secretbox_xsalsa20poly1305_ref"
collect2: error: ld returned 1 exit status
For the esp32 I found it is only available for ESP-IDF. Will there be way to make it for Auduino IDE it will be very helpful if that is possible.
Hi,
I was very happy with this implementation, because it offers us the hability to encapsulate IP over MQTT.
Unfortunately, I was implementing this code in a CentOS server inside a virtual machine of Azure, and the problem is that CentOS subscribe the new interface to a series of multicast addresses. As shown in the image below.
This problem causes that whenever I want to send something trough the interface it does not send anything (maybe because it needs to wait a response from the multicast packages). So a quick fix was to add a condition that only accepts packets that are within my ip range (10.x.x.x)
This causes that the IP multicast subscriptions get dropped and does not affect future packages comming in.
This is a quick fix, but it may be another solution to this.
Is it possible using this library to access other IP addresses on the ESP32 WiFi Network Interface? The new interface that is setup by this library is only on the VPN network, right? If packets are sent to the ESP32 with a different destination IP address from the VPN interface, would the ESP32 already know which interface to forward them out of, or would that need to be built separately? If that needs to be done separately, would you be able to point me in a direction to get some insight on how to do this?
Hi,
I need suggestion for having multiple devices. Currently, I tested with two devices(10.0.1.2 and 10.1.3). The daemonmqtt_vpn.c listen for response data from 10.0.1.1. What if I have 100 devices or 200 devices? Is it a good idea to implement subtopic for each devices, for example: 10.0.1.2 and 10.0.1.2/response?
Please give me suggestion for this as I am building Esp32 sprinkler system depending on this library.
hi, instead of running MQTTvpn on Linux machine, can I run it on cloud instead and access that cloud from another machine thru the cloud public ip? My scenario is to access from mobile phone
Is it possible to set up work with ESP32 in the Arduino IDE environment with the TINY_GSM_MODEM library?
Really needed
Hi,
I use MQTT_VPN with this PPPOSClient example.
https://github.com/chegewara/esp32-platformio-pppos-client
mqtt_if_output stop sending out mqtt data after a few packet, the requester(wget) can see that request is connected and wait for data.
Platform espressif32 @ 5.3.0 (required: espressif32)
├── framework-arduinoespressif32 @ 3.20006.221224 (required: platformio/framework-arduinoespressif32 @ ~3.20006.0)
├── framework-espidf @ 3.40403.0 (required: platformio/framework-espidf @ ~3.40403.0)
Here's the partial log. It stop output after the first packet.
␛[0;32mI (1404) MQTTIF: Init on broker3: mqtt://agrokh.com:1883␛[0m
␛[0;32mI (1419) MQTTIF: Other event id:7␛[0m
␛[0;32mI (2029) MQTTIF: subscribe receive_topic: mqttip/10.0.1.2␛[0m
␛[0;32mI (2029) MQTTIF: subscribe broadcast_topic: mqttip/255.255.255.255␛[0m
␛[0;32mI (5283) MQTTIF: Received mqttip/10.0.1.2 - 116 bytes␛[0m
␛[0;32mI (5284) MQTTIF: Buffer post - len: 60 tot_len: 60␛[0m
␛[0;32mI (5286) MQTTIF: OUTPUT!!!␛[0m
␛[0;32mI (5287) MQTTIF: POST DATA FOR SENDING:100␛[0m
␛[0;32mI (5292) MQTTIF: Send topic mqttip/10.0.1.1 received - len: 100␛[0m
It works when I use [email protected] version and different PPPOSClient library. However, the old version of PPPOS is very unstable and can't be used against the new espressif32 version
Got crash after around 15~60 minutes when it's publishing:
esp_mqtt_client_publish(mqtt_if->mqttcl, mqtt_if->pub_topic, pub_data->data_buf, pub_data->data_len, 0, 0);
I use the following espressif:
Platform espressif32 @ 5.3.0 (required: espressif32)
├── framework-arduinoespressif32 @ 3.20006.221224 (required: platformio/framework-arduinoespressif32 @ ~3.20006.0)
├── framework-espidf @ 3.40403.0 (required: platformio/framework-espidf @ ~3.40403.0)
Here's the crashlog
PC: 0x4011f2fd: tcp_output at /Users/xxx/.platformio/packages/framework-espidf/components/lwip/lwip/src/core/tcp_out.c line 1389
EXCVADDR: 0x0000000c
Decoding stack results
0x4011f2fa: tcp_output at /Users/xxx/.platformio/packages/framework-espidf/components/lwip/lwip/src/core/tcp_out.c line 1389
0x4011bd65: tcp_slowtmr at /Users/xx/.platformio/packages/framework-espidf/components/lwip/lwip/src/core/tcp.c line 1431
0x4011be2f: tcp_tmr at /Users/xx/.platformio/packages/framework-espidf/components/lwip/lwip/src/core/tcp.c line 242
0x4011f6ef: tcpip_tcp_timer at /Users/xxx/.platformio/packages/framework-espidf/components/lwip/lwip/src/core/timeouts.c line 159
0x4011f7b1: sys_check_timeouts at /Users/xx/.platformio/packages/framework-espidf/components/lwip/lwip/src/core/timeouts.c line 409
0x4011657a: tcpip_timeouts_mbox_fetch at /Users/xx/.platformio/packages/framework-espidf/components/lwip/lwip/src/api/tcpip.c line 115
0x4011662f: tcpip_thread at /Users/xx/.platformio/packages/framework-espidf/components/lwip/lwip/src/api/tcpip.c line 148
0x4008d455: vPortTaskWrapper at /Users/xx/.platformio/packages/framework-espidf/components/freertos/port/xtensa/port.c line 131
It also crashed randomly while receiving mqtt:
if (mqtt_if->netif.input(pb, &mqtt_if->netif) != ERR_OK)
Here's another log:
PC: 0x4011f2fd: tcp_output at /Users/chamroeun/.platformio/packages/framework-espidf/components/lwip/lwip/src/core/tcp_out.c line 1389
EXCVADDR: 0x0000000c
Decoding stack results
0x4011f2fa: tcp_output at /Users/chamroeun/.platformio/packages/framework-espidf/components/lwip/lwip/src/core/tcp_out.c line 1389
0x4011c20a: tcp_listen_input at /Users/chamroeun/.platformio/packages/framework-espidf/components/lwip/lwip/src/core/tcp_in.c line 728
0x4011ddd5: tcp_input at /Users/chamroeun/.platformio/packages/framework-espidf/components/lwip/lwip/src/core/tcp_in.c line 380
0x4012355a: ip4_input at /Users/chamroeun/.platformio/packages/framework-espidf/components/lwip/lwip/src/core/ipv4/ip4.c line 800
0x401181e2: ip_input at /Users/chamroeun/.platformio/packages/framework-espidf/components/lwip/lwip/src/core/ip.c line 160
0x400dd8e3: packet_receive_handler at src/mqttif.c line 121
0x401b38a9: handler_execute at /Users/chamroeun/.platformio/packages/framework-espidf/components/esp_event/esp_event.c line 145
0x401b333b: esp_event_loop_run at /Users/chamroeun/.platformio/packages/framework-espidf/components/esp_event/esp_event.c line 598
0x401b33f5: esp_event_loop_run_task at /Users/chamroeun/.platformio/packages/framework-espidf/components/esp_event/esp_event.c line 115
0x4008d455: vPortTaskWrapper at /Users/chamroeun/.platformio/packages/framework-espidf/components/freertos/port/xtensa/port.c line 131
I was reading your readme file and was wondering if after getting an IP I can access whatever port on whatever protocol? for instance if I want to get the 80 port to see a page in the module and then switch to another port to see stream of images, can this be done?
Hello @martin-ger ,
First of all this is great work and thanks for this.
First when you say VPN, does it mean that one will be able to have access to the network the ESP32 for example is connected to? I want to be able to not only access the ESP32, but also other devices it has on the network. So The ESP32 acts as my VPN gateway as per say.
Do you think there is a possibility this can be done in Python? As I am looking at something like this, but in a Python3 environment.
Regards
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.