I connect to the remote router through SSH, opening a tunnel:
ssh -L 9999:localhost:9999 remote_router
OK. Then I use SOCAT to pass UDP traffic over TCP tunnel .
socat tcp4-listen:9999,reuseaddr,fork UDP:<ESP8266 IP>:8266
This is in remote_router, connected to ESP through WIFI and running openWRT. 8266 is OTA UDP port.
Then in my laptop (Linux), SOCAT again:
socat -T15 udp4-recvfrom:8266,reuseaddr,fork tcp:localhost:9999
Finally, I run espota.py in my laptop to upload a binary sketch.
./espota.py -d -i 127.0.0.1 --aut= -f ./sketch.bin
And it never connects, error "NO ANSWER".
Trying to identify the problem I have created another UDP tunnel, but this time addressing port 53 (DNS Server) in router, and it is working, If I do
dig @127.0.0.1 -p 8266 google.com
It gives me response.
So, I don't know why OTA UDP tunnel is not working.