From patchwork Fri Oct 26 00:03:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: max7255 X-Patchwork-Id: 10656879 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8E04A14BB for ; Fri, 26 Oct 2018 01:26:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82DEA2C571 for ; Fri, 26 Oct 2018 01:26:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 773222C577; Fri, 26 Oct 2018 01:26:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 10F762C571 for ; Fri, 26 Oct 2018 01:26:11 +0000 (UTC) Received: from localhost ([::1]:57579 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFqt7-0004w5-Si for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 21:26:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37623) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFpbn-0002vG-OR for qemu-devel@nongnu.org; Thu, 25 Oct 2018 20:04:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFpbk-0007e3-D4 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 20:04:11 -0400 Received: from forwardcorp1o.cmail.yandex.net ([37.9.109.47]:35276) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFpbj-0007d2-VZ for qemu-devel@nongnu.org; Thu, 25 Oct 2018 20:04:08 -0400 Received: from mxbackcorp1j.mail.yandex.net (mxbackcorp1j.mail.yandex.net [IPv6:2a02:6b8:0:1619::162]) by forwardcorp1o.cmail.yandex.net (Yandex) with ESMTP id E64A520F73 for ; Fri, 26 Oct 2018 03:04:02 +0300 (MSK) Received: from smtpcorp1o.mail.yandex.net (smtpcorp1o.mail.yandex.net [2a02:6b8:0:1a2d::30]) by mxbackcorp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id z6tzUm4Z04-42ICTTpk; Fri, 26 Oct 2018 03:04:02 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1540512242; bh=naDB2nE5d09DOIEPf3pE9sI9CwsPFn1W+23gGOURcVI=; h=From:To:Cc:Subject:Date:Message-Id; b=Z44L/syIAlPG94x8ALGV09XvDXl7CM7hYEk0Rv8OtHLMBmIH98WPiwmXqKNGD57/Y tBkzmxgAqxaUw2NGCo8JE7HqHtwNfEW8clI0cT+O30s2vTlo8HbzAM4PARxBu1xq72 /wxtlApUEg2cEhtPoiRbJBQmpSYO95MfETcyc4MU= Received: from dynamic-iva.dhcp.yndx.net (dynamic-iva.dhcp.yndx.net [2a02:6b8:b010:d002::1:1]) by smtpcorp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id bOfpZ9lZrb-42FGeZOj; Fri, 26 Oct 2018 03:04:02 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1540512242; bh=naDB2nE5d09DOIEPf3pE9sI9CwsPFn1W+23gGOURcVI=; h=From:To:Cc:Subject:Date:Message-Id; b=Z44L/syIAlPG94x8ALGV09XvDXl7CM7hYEk0Rv8OtHLMBmIH98WPiwmXqKNGD57/Y tBkzmxgAqxaUw2NGCo8JE7HqHtwNfEW8clI0cT+O30s2vTlo8HbzAM4PARxBu1xq72 /wxtlApUEg2cEhtPoiRbJBQmpSYO95MfETcyc4MU= Authentication-Results: smtpcorp1o.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Maxim Samoylov To: qemu-devel@nongnu.org Date: Fri, 26 Oct 2018 03:03:39 +0300 Message-Id: <1540512223-21199-1-git-send-email-max7255@yandex-team.ru> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 37.9.109.47 X-Mailman-Approved-At: Thu, 25 Oct 2018 21:24:29 -0400 Subject: [Qemu-devel] [PATCH RFC 0/4] slirp: support hostfwd for ipv6 addresses X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: max7255@yandex-team.ru Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The following patch implements ipv6 host port forwarding support for qemu slirp net subsystem. The slirp itself supports ipv6 communication, but hostfwd currently does not allow listening on and forwarding ports for ipv6 addresses. This should be useful, when host works in v6-capable environment and guests should be accessible there. Turns out the only thing should be done is to properly parse ipv6 addresses and pass them down to listening socket create logic. The proposed option ipv6-hostfwd syntax is the same as for the hostfwd option, but one should enclose their ipv6 addresses into square brackets, e.g.: ipv6-hostfwd=tcp::7255-[fec0::5054:ff:fe12:3456]:80 The guest ipv6 address intended to be specified explicitly, because there is no dhcpv6 server in slirp. Maxim Samoylov (4): slirp: add helper for tcp6 socket creation slirp: add helper for udp6 socket creation slirp: add helpers for ipv6 hostfwd manipulation net/slirp: add ipv6-hostfwd option for user netdev type hmp-commands.hx | 31 ++++++++ include/net/slirp.h | 2 + net/slirp.c | 214 ++++++++++++++++++++++++++++++++++++++++++++++++++++ qapi/net.json | 3 +- slirp/libslirp.h | 6 ++ slirp/slirp.c | 43 +++++++++++ slirp/socket.c | 73 ++++++++++++++++++ slirp/socket.h | 2 + slirp/udp.c | 48 ++++++++++++ slirp/udp.h | 2 + 10 files changed, 423 insertions(+), 1 deletion(-)