[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] slirp: Allow to disable IPv4 or IPv6
From: |
Thomas Huth |
Subject: |
Re: [Qemu-devel] [PATCH] slirp: Allow to disable IPv4 or IPv6 |
Date: |
Mon, 21 Mar 2016 08:33:45 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 |
On 20.03.2016 12:39, Samuel Thibault wrote:
> Make net=0.0.0.0 disable IPv4 and ip6-net=:: disable IPv6, so the user can
> setup IPv4-only and IPv6-only network environments.
>
> Signed-off-by: Samuel Thibault <address@hidden>
> ---
> net/slirp.c | 8 +++++---
> qapi-schema.json | 4 ++--
> qemu-options.hx | 7 ++++---
> slirp/ip6.h | 9 +++++++++
> slirp/ip6_icmp.c | 10 ++++++++++
> slirp/ip6_input.c | 6 ++++++
> slirp/ip_input.c | 5 +++++
> slirp/slirp.c | 5 +++++
> 8 files changed, 46 insertions(+), 8 deletions(-)
>
> diff --git a/net/slirp.c b/net/slirp.c
> index 95239bc..3151d4a 100644
> --- a/net/slirp.c
> +++ b/net/slirp.c
> @@ -244,13 +244,15 @@ static int net_slirp_init(NetClientState *peer, const
> char *model,
>
> #if defined(_WIN32) && (_WIN32_WINNT < 0x0600)
> /* No inet_pton helper before Vista... */
> - if (vprefix6) {
> + if (vprefix6 && strcmp(vprefix6, "::")) {
> /* Unsupported */
> return -1;
> }
> memset(&ip6_prefix, 0, sizeof(ip6_prefix));
> - ip6_prefix.s6_addr[0] = 0xfe;
> - ip6_prefix.s6_addr[1] = 0xc0;
> + if (!vprefix6) {
> + ip6_prefix.s6_addr[0] = 0xfe;
> + ip6_prefix.s6_addr[1] = 0xc0;
> + }
> #else
> if (!vprefix6) {
> vprefix6 = "fec0::";
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 88f9b81..69eb6e7 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -2427,7 +2427,7 @@
> #
> # @ip: #optional legacy parameter, use net= instead
> #
> -# @net: #optional IP address and optional netmask
> +# @net: #optional IP address and optional netmask. Set to 0.0.0.0 to disable
> IPv4 completely
> #
> # @host: #optional guest-visible address of the host
> #
> @@ -2443,7 +2443,7 @@
> # @dnssearch: #optional list of DNS suffixes to search, passed as DHCP option
> # to the guest
> #
> -# @ip6-prefix: #optional IPv6 network prefix (default is fec0::) (since 2.6)
> +# @ip6-prefix: #optional IPv6 network prefix. Set to :: to disable IPv6
> completely (default is fec0::) (since 2.6)
The new lines here seem to be longer than 80 characters ... I think you
should wrap them.
Apart from that, the patch looks fine to me.
Thomas