| sctp-echo - SCTP-over-UDP echo server/client for creating reliable tunnels over UDP. |
README.md (3349B) - raw
1 # SCTP+UDP Echo Server/Client 2 3 This program uses the SCTP protocol tunneled over UDP to turn UDP into a reliable transport. The same program can be run in either server or client mode; in terms of behaviour, this is intended to be identical to 4 ``` 5 client: socat - UDP4:<remote ip>:<remote port>,sourceport=<local port> 6 server: socat UDP4-LISTEN:<local ip>:<local port> - 7 ``` 8 along with some access control on the server side should the client IP/port be known ahead of time. In particular, the server will accept only one (valid) connection and is intended to exit once the connection closes (how reliable this part is is unclear). 9 10 The [usrsctp](https://github.com/Kurento/libusrsctp) library is used rather than the built-in kernel SCTP implementation on FreeBSD/Linux/etc. because the kernel implementations are lazy with UDP encapsulation: the port used to send/recieve SCTP-over-UDP is set for the entire system (i.e. via `sysctl`) rather than per-connection as in usrsctp. This program is essentially a stripped down and merged version of the [discard server](https://github.com/Kurento/libusrsctp/blob/master/programs/discard_server.c) included in the usrsctp library as an example. 11 12 ## Limitations 13 Currently, there is no timeout functionality on the server/client when no connection is made. This is typically not a problem on the server side: to connect to anything expecting a reliable transport typically involves a `socat` invocation, e.g.: 14 ``` 15 sctp_echo -s ... | socat -T 60 - TCP-CONNECT:... 16 ``` 17 would give it a timeout of 60 seconds of no data transferred. 18 19 The packets sent are not disguised as anything: they are very clearly SCTP tunneled over UDP; DPI firewalls are likely to block this. 20 21 Both of these could be resolved to a degree by implementing a very restricted subset of SCTP or some other protocol for making an unreliable link reliable, rather than relying on SCTP-over-UDP (and specifically usrsctp). 22 23 ## Requirements 24 - Some sort of reasonable UNIX (FreeBSD, Linux, etc.) 25 - C compiler 26 - [usrsctp](https://github.com/Kurento/libusrsctp) 27 28 ## Building 29 These should be executed in the directory you found this file. 30 31 1. (Optional) Run `autoconf` 32 2. Run `./configure` 33 3. Run `make` 34 35 The echo server/client will be `src/sctp_echo`. 36 37 ## Usage 38 In server mode: 39 ``` 40 sctp_echo -s <local IP> <local UDP port> <local SCTP port> <remote IP> <remote SCTP port> 41 ``` 42 In client mode: 43 ``` 44 sctp_echo -c <local IP> <local UDP port> <local SCTP port> <remote IP> <remote UDP port> <remote SCTP port> 45 ``` 46 - Local IP: the local IP address to connect from/listen on, generally only useful on the server side. 47 - Local UDP port: the local UDP port to connect from/listen on. 48 - Local SCTP port: the local SCTP port to connect from/listen on. This is never publically seen, since all communication over the network happens via the UDP ports. However, both server and client need to know the other's SCTP port since SCTP-over-UDP is designed to allow the UDP port to be used for multiple SCTP connections. 49 - Remote IP: the remote IP to connect to/accept a connection from. Setting it to `0.0.0.0` on the server disables access control. 50 - Remote UDP port (client only): the remote UDP port to connect to. On the server, usrsctp handles the remote UDP port transparently. 51 - Remote SCTP port: the remote SCTP port to connect to/accept a connection from.