diff options
author | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2021-04-21 12:28:34 +0100 |
---|---|---|
committer | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2021-06-08 19:36:22 +0100 |
commit | 8bd1078aebcec5eac196a83ef1a7e74be0ba67b7 (patch) | |
tree | 324d7a50afc3362698b9bb56363159b7b3a2eeb4 /util | |
parent | a59136f3b126cfbcaa13a44fbdaf8df6e3d1885f (diff) | |
download | qemu-8bd1078aebcec5eac196a83ef1a7e74be0ba67b7.zip qemu-8bd1078aebcec5eac196a83ef1a7e74be0ba67b7.tar.gz qemu-8bd1078aebcec5eac196a83ef1a7e74be0ba67b7.tar.bz2 |
sockets: Support multipath TCP
Multipath TCP allows combining multiple interfaces/routes into a single
socket, with very little work for the user/admin.
It's enabled by 'mptcp' on most socket addresses:
./qemu-system-x86_64 -nographic -incoming tcp:0:4444,mptcp
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20210421112834.107651-6-dgilbert@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'util')
-rw-r--r-- | util/qemu-sockets.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 2463c49..c415c34 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -278,6 +278,11 @@ static int inet_listen_saddr(InetSocketAddress *saddr, /* create socket + bind/listen */ for (e = res; e != NULL; e = e->ai_next) { +#ifdef IPPROTO_MPTCP + if (saddr->has_mptcp && saddr->mptcp) { + e->ai_protocol = IPPROTO_MPTCP; + } +#endif getnameinfo((struct sockaddr*)e->ai_addr,e->ai_addrlen, uaddr,INET6_ADDRSTRLEN,uport,32, NI_NUMERICHOST | NI_NUMERICSERV); @@ -456,6 +461,13 @@ int inet_connect_saddr(InetSocketAddress *saddr, Error **errp) for (e = res; e != NULL; e = e->ai_next) { error_free(local_err); local_err = NULL; + +#ifdef IPPROTO_MPTCP + if (saddr->has_mptcp && saddr->mptcp) { + e->ai_protocol = IPPROTO_MPTCP; + } +#endif + sock = inet_connect_addr(saddr, e, &local_err); if (sock >= 0) { break; @@ -687,6 +699,17 @@ int inet_parse(InetSocketAddress *addr, const char *str, Error **errp) } addr->has_keep_alive = true; } +#ifdef IPPROTO_MPTCP + begin = strstr(optstr, ",mptcp"); + if (begin) { + if (inet_parse_flag("mptcp", begin + strlen(",mptcp"), + &addr->mptcp, errp) < 0) + { + return -1; + } + addr->has_mptcp = true; + } +#endif return 0; } |