All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/2] Delayed binding of UDP sockets for Quic per-connection sockets
@ 2018-10-31 23:26 Christoph Paasch
  2018-10-31 23:26 ` [RFC 1/2] net: Add new socket-option SO_DELAYED_BIND Christoph Paasch
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Christoph Paasch @ 2018-10-31 23:26 UTC (permalink / raw)
  To: netdev; +Cc: Ian Swett, Leif Hedstrom, Jana Iyengar

Implementations of Quic might want to create a separate socket for each
Quic-connection by creating a connected UDP-socket.

To achieve that on the server-side, a "master-socket" needs to wait for
incoming new connections and then creates a new socket that will be a
connected UDP-socket. To create that latter one, the server needs to
first bind() and then connect(). However, after the bind() the server
might already receive traffic on that new socket that is unrelated to the
Quic-connection at hand. Only after the connect() a full 4-tuple match
is happening. So, one can't really create this kind of a server that has
a connected UDP-socket per Quic connection.

So, what is needed is an "atomic bind & connect" that basically
prevents any incoming traffic until the connect() call has been issued
at which point the full 4-tuple is known.


This patchset implements this functionality and exposes a socket-option
to do this.

Usage would be:

        int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);

        int val = 1;
        setsockopt(fd, SOL_SOCKET, SO_DELAYED_BIND, &val, sizeof(val));

        bind(fd, (struct sockaddr *)&src, sizeof(src));

	/* At this point, incoming traffic will never match on this socket */

        connect(fd, (struct sockaddr *)&dst, sizeof(dst));

	/* Only now incoming traffic will reach the socket */



There is literally an infinite number of ways on how to implement it,
which is why I first send it out as an RFC. With this approach here I
chose the least invasive one, just preventing the match on the incoming
path.


The reason for choosing a SOL_SOCKET socket-option and not at the
SOL_UDP-level is because that functionality actually could be useful for
other protocols as well. E.g., TCP wants to better use the full 4-tuple space
by binding to the source-IP and the destination-IP at the same time.


Feedback is very welcome!


Christoph Paasch (2):
  net: Add new socket-option SO_DELAYED_BIND
  udp: Support SO_DELAYED_BIND

 arch/alpha/include/uapi/asm/socket.h  |  2 ++
 arch/ia64/include/uapi/asm/socket.h   |  2 ++
 arch/mips/include/uapi/asm/socket.h   |  2 ++
 arch/parisc/include/uapi/asm/socket.h |  2 ++
 arch/s390/include/uapi/asm/socket.h   |  2 ++
 arch/sparc/include/uapi/asm/socket.h  |  2 ++
 arch/xtensa/include/uapi/asm/socket.h |  2 ++
 include/net/sock.h                    |  1 +
 include/uapi/asm-generic/socket.h     |  2 ++
 net/core/sock.c                       | 21 +++++++++++++++++++++
 net/ipv4/datagram.c                   |  1 +
 net/ipv4/udp.c                        |  3 +++
 12 files changed, 42 insertions(+)

-- 
2.16.2

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-11-05  4:14 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-31 23:26 [RFC 0/2] Delayed binding of UDP sockets for Quic per-connection sockets Christoph Paasch
2018-10-31 23:26 ` [RFC 1/2] net: Add new socket-option SO_DELAYED_BIND Christoph Paasch
2018-10-31 23:26 ` [RFC 2/2] udp: Support SO_DELAYED_BIND Christoph Paasch
2018-11-01  0:53 ` [RFC 0/2] Delayed binding of UDP sockets for Quic per-connection sockets Eric Dumazet
2018-11-01  3:50   ` Christoph Paasch
2018-11-01  5:04     ` Eric Dumazet
2018-11-01  5:07       ` Christoph Paasch
2018-11-01  5:08     ` Eric Dumazet
2018-11-01  5:17       ` Eric Dumazet
2018-11-01 17:58   ` Leif Hedstrom
2018-11-01 18:21     ` Eric Dumazet
2018-11-01 21:51 ` Willem de Bruijn
2018-11-01 22:11   ` Christoph Paasch
     [not found]     ` <CAKcm_gNZqgRGRj2J5yJDsavHsoaeXtozrbGp+TmAj_DRsCUOLQ@mail.gmail.com>
     [not found]       ` <CACpbDccs6WmLCknpu2GLMMBnkHwS4apsr3Z3sAKt4Ch_2HPwgg@mail.gmail.com>
2018-11-04 18:58         ` Eric Dumazet

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.