wiki:SocketRework

Version 1 (modified by plaisthos, 12 years ago) (diff)

--

Socket Rework

The current state of socket handling of openvpn is suboptimal. It lacks proper support of dual stack environments. There are some design decisions to be made beforehand. This a first list of things that should be discussed before beginning a rewrite.

  • Meaning of udp, udp6. At the moment udp forces AF_INET and udp6 AF_INET6. If no udp/tcp is specified the client will guess ipv4/ipv6 and stick to that guess
    • Change udp to AF_INET/AF_INET6, add udp4

  • tcp design is straightfoward
    • tcp-server resolves address with AI_PASSIVE, bind to all returned results
    • tcp-client resolve all adresses, iterate through them in the returned order
    • as for udp, introduce tcp4

  • Behaviour of udp p2p clients, now it is simply only socket is open for both peers, in dual stack this assumption breaks
    • introduce udp-server and udp-client. Let udp-server bind/listen on all socket and udp-client only on the one currently trying to connect
    • Both peer bind on all sockets but iterate through the socket when trying to connect
  • behaviour of bind/remote if they different in the returned protocols
    • bind only IPv4 but remote IPv4/IPv6, issue warning
    • bind only IPv4 and remote IPv6, exit with error
  • Listening on multiple sockets is needed for dual stack anyway. So simultaneous udp/tcp is possible too:
    • <listen> like <connection> but uses all <listen> blocks at the same time