Test:

OpenBSD UDP Server:
# ifconfig tun0 create
# ifconfig tun0 inet 192.168.74.1/24
# socat -d -d UDP-LISTEN:11443,reuseaddr GOPEN:/dev/tun0
2023/11/13 10:30:58 socat[31554] N listening on UDP LEN=16 AF=2
0.0.0.0:11443
2023/11/13 10:33:27 socat[31554] N accepting UDP connection from LEN=16
AF=2 192.168.255.2:59152
2023/11/13 10:33:27 socat[31554] N opening character device "/dev/tun0" for
reading and writing

Linux UDP Client:
$ socat UDP:1.2.3.4:11443 TUN:192.168.74.2/24,up

OpenBSD UDP Server, this line appears:
2023/11/13 10:33:27 socat[31554] N starting data transfer loop with FDs
[5,5] and [6,6]

Linux UDP Client, start a ping but no replies received
$ ping 192.168.74.1

OpenBSD UDP Server, tcpdump -ni tun0 shows:
11:02:15.130291
11:02:16.130410
11:02:17.130223
11:02:18.130072
11:02:19.131211
11:02:20.130417
11:02:21.130218


So, maybe socat doesn't know how to decode raw data received on tun0.

Thanks anyway


Il giorno dom 12 nov 2023 alle ore 14:03 Sebastien Marie <
sema...@kapouay.eu.org> ha scritto:

> Luca Di Gregorio <luc...@gmail.com> writes:
>
> > So, I installed socat with pkg_add and tried to do like this:
> > http://www.dest-unreach.org/socat/doc/socat-tun.html
> >
> > Anyway, I see this:
> > # socat UDP:1.2.3.4:11443 TUN:192.168.255.2/24,up
> > 2023/11/11 14:11:27 socat[4504] E unknown device/address "TUN"
> >
>
> Have you try to manually configure tun(4) interface and simply use
> /dev/tun0 ?
>
> To keep your example:
>   # ifconfig tun0 create
>   # ifconfig tun0 inet 192.168.255.2/24
>   # socat UDP:1.2.3.4:11443 GOPEN:/dev/tun0
>
> Regards.
> --
> Sebastien Marie
>

Reply via email to