All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCHv4 0/2] Rework ipv6 options, add ipv4/ipv6 enabling/disabling options
@ 2016-03-24 23:34 Samuel Thibault
  2016-03-24 23:34 ` [Qemu-devel] [PATCHv4 1/2] Rework ipv6 options Samuel Thibault
  2016-03-24 23:34 ` [Qemu-devel] [PATCHv4 2/2] slirp: Allow disabling IPv4 or IPv6 Samuel Thibault
  0 siblings, 2 replies; 6+ messages in thread
From: Samuel Thibault @ 2016-03-24 23:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: thuth, jan.kiszka, jasowang, armbru, Samuel Thibault

This is a split of the previously-sent "Allow disabling IPv4 or IPv6"
patch, to separate reworking the existing newly-added options and
the new ipv4/ipv6 options.

Samuel Thibault (2):
  Rework ipv6 options
  slirp: Allow disabling IPv4 or IPv6

 net/slirp.c       | 35 +++++++++++++++++++++++++++--------
 qapi-schema.json  | 33 ++++++++++++++++++++++++---------
 qemu-options.hx   | 22 ++++++++++++++--------
 slirp/ip6_icmp.c  |  8 ++++++++
 slirp/ip6_input.c |  5 +++++
 slirp/ip_input.c  |  4 ++++
 slirp/libslirp.h  |  3 ++-
 slirp/slirp.c     | 10 +++++++++-
 slirp/slirp.h     |  2 ++
 9 files changed, 95 insertions(+), 27 deletions(-)

-- 
2.8.0.rc3

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

* [Qemu-devel] [PATCHv4 1/2] Rework ipv6 options
  2016-03-24 23:34 [Qemu-devel] [PATCHv4 0/2] Rework ipv6 options, add ipv4/ipv6 enabling/disabling options Samuel Thibault
@ 2016-03-24 23:34 ` Samuel Thibault
  2016-03-28 15:00   ` Eric Blake
  2016-03-24 23:34 ` [Qemu-devel] [PATCHv4 2/2] slirp: Allow disabling IPv4 or IPv6 Samuel Thibault
  1 sibling, 1 reply; 6+ messages in thread
From: Samuel Thibault @ 2016-03-24 23:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: thuth, jan.kiszka, jasowang, armbru, Samuel Thibault

Rename the recently-added ip6-foo options into ipv6-foo options, to make
them coherent with other ipv6 options.

Also rework the documentation.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 net/slirp.c      |  6 +++---
 qapi-schema.json | 25 ++++++++++++++++---------
 qemu-options.hx  | 18 ++++++++++--------
 3 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/net/slirp.c b/net/slirp.c
index 95239bc..0013c27 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -828,10 +828,10 @@ int net_init_slirp(const NetClientOptions *opts, const char *name,
     net_init_slirp_configs(user->guestfwd, 0);
 
     ret = net_slirp_init(peer, "user", name, user->q_restrict, vnet,
-                         user->host, user->ip6_prefix, user->ip6_prefixlen,
-                         user->ip6_host, user->hostname, user->tftp,
+                         user->host, user->ipv6_prefix, user->ipv6_prefixlen,
+                         user->ipv6_host, user->hostname, user->tftp,
                          user->bootfile, user->dhcpstart,
-                         user->dns, user->ip6_dns, user->smb,
+                         user->dns, user->ipv6_dns, user->smb,
                          user->smbserver, dnssearch);
 
     while (slirp_configs) {
diff --git a/qapi-schema.json b/qapi-schema.json
index 88f9b81..e1dd7e1 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -2427,7 +2427,10 @@
 #
 # @ip: #optional legacy parameter, use net= instead
 #
-# @net: #optional IP address and optional netmask
+# @net: #optional IP network address that the guest will see, in the
+#       form addr[/netmask] The netmask is optional, and can be
+#       either in the form a.b.c.d or as a number of valid top-most
+#       bits. Default is 10.0.2.0/24.
 #
 # @host: #optional guest-visible address of the host
 #
@@ -2443,13 +2446,17 @@
 # @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)
+# @ipv6-prefix: #optional IPv6 network prefix (default is fec0::) (since
+#               2.6). The network prefix is given in the usual
+#               hexadecimal IPv6 address notation.
 #
-# @ip6-prefixlen: #optional IPv6 network prefix length (default is 64) (since 2.6)
+# @ipv6-prefixlen: #optional IPv6 network prefix length (default is 64)
+#                  (since 2.6)
 #
-# @ip6-host: #optional guest-visible IPv6 address of the host (since 2.6)
+# @ipv6-host: #optional guest-visible IPv6 address of the host (since 2.6)
 #
-# @ip6-dns: #optional guest-visible IPv6 address of the virtual nameserver (since 2.6)
+# @ipv6-dns: #optional guest-visible IPv6 address of the virtual
+#            nameserver (since 2.6)
 #
 # @smb: #optional root directory of the built-in SMB server
 #
@@ -2474,10 +2481,10 @@
     '*dhcpstart': 'str',
     '*dns':       'str',
     '*dnssearch': ['String'],
-    '*ip6-prefix':      'str',
-    '*ip6-prefixlen':   'int',
-    '*ip6-host':        'str',
-    '*ip6-dns':         'str',
+    '*ipv6-prefix':      'str',
+    '*ipv6-prefixlen':   'int',
+    '*ipv6-host':        'str',
+    '*ipv6-dns':         'str',
     '*smb':       'str',
     '*smbserver': 'str',
     '*hostfwd':   ['String'],
diff --git a/qemu-options.hx b/qemu-options.hx
index 732ed8c..5654ce3 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1560,9 +1560,9 @@ DEF("smb", HAS_ARG, QEMU_OPTION_smb, "", QEMU_ARCH_ALL)
 
 DEF("netdev", HAS_ARG, QEMU_OPTION_netdev,
 #ifdef CONFIG_SLIRP
-    "-netdev user,id=str[,net=addr[/mask]][,host=addr][,ip6-net=addr[/int]]\n"
-    "         [,ip6-host=addr][,restrict=on|off][,hostname=host][,dhcpstart=addr]\n"
-    "         [,dns=addr][,ip6-dns=addr][,dnssearch=domain][,tftp=dir]\n"
+    "-netdev user,id=str[,net=addr[/mask]][,host=addr][,ipv6-net=addr[/int]]\n"
+    "         [,ipv6-host=addr][,restrict=on|off][,hostname=host][,dhcpstart=addr]\n"
+    "         [,dns=addr][,ipv6-dns=addr][,dnssearch=domain][,tftp=dir]\n"
     "         [,bootfile=f][,hostfwd=rule][,guestfwd=rule]"
 #ifndef _WIN32
                                              "[,smb=dir[,smbserver=addr]]\n"
@@ -1719,11 +1719,13 @@ either in the form a.b.c.d or as number of valid top-most bits. Default is
 Specify the guest-visible address of the host. Default is the 2nd IP in the
 guest network, i.e. x.x.x.2.
 
-@item ip6-net=@var{addr}[/@var{int}]
-Set IPv6 network address the guest will see. Optionally specify the prefix
-size, as number of valid top-most bits. Default is fec0::/64.
+@item ipv6-net=@var{addr}[/@var{int}]
+Set IPv6 network address the guest will see (default is fec0::/64). The
+network prefix is given in the usual hexadecimal IPv6 address
+notation. The prefix size is optional, and is given as the number of
+valid top-most bits (default is 64).
 
-@item ip6-host=@var{addr}
+@item ipv6-host=@var{addr}
 Specify the guest-visible IPv6 address of the host. Default is the 2nd IPv6 in
 the guest network, i.e. xxxx::2.
 
@@ -1744,7 +1746,7 @@ Specify the guest-visible address of the virtual nameserver. The address must
 be different from the host address. Default is the 3rd IP in the guest network,
 i.e. x.x.x.3.
 
-@item ip6-dns=@var{addr}
+@item ipv6-dns=@var{addr}
 Specify the guest-visible address of the IPv6 virtual nameserver. The address
 must be different from the host address. Default is the 3rd IP in the guest
 network, i.e. xxxx::3.
-- 
2.8.0.rc3

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

* [Qemu-devel] [PATCHv4 2/2] slirp: Allow disabling IPv4 or IPv6
  2016-03-24 23:34 [Qemu-devel] [PATCHv4 0/2] Rework ipv6 options, add ipv4/ipv6 enabling/disabling options Samuel Thibault
  2016-03-24 23:34 ` [Qemu-devel] [PATCHv4 1/2] Rework ipv6 options Samuel Thibault
@ 2016-03-24 23:34 ` Samuel Thibault
  2016-03-28 15:12   ` Eric Blake
  1 sibling, 1 reply; 6+ messages in thread
From: Samuel Thibault @ 2016-03-24 23:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: thuth, jan.kiszka, jasowang, armbru, Samuel Thibault

Add ipv4 and ipv6 boolean options, so the user can setup IPv4-only and
IPv6-only network environments.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

---

Changes since previous versions:

- Introduce boolean options ipv4 and ipv6 instead of net=none and
  ip6-net=none.
- Reject incoherent configuration (e.g. v4 address but v4 disabled)
---
 net/slirp.c       | 31 +++++++++++++++++++++++++------
 qapi-schema.json  |  8 ++++++++
 qemu-options.hx   |  8 ++++++--
 slirp/ip6_icmp.c  |  8 ++++++++
 slirp/ip6_input.c |  5 +++++
 slirp/ip_input.c  |  4 ++++
 slirp/libslirp.h  |  3 ++-
 slirp/slirp.c     | 10 +++++++++-
 slirp/slirp.h     |  2 ++
 9 files changed, 69 insertions(+), 10 deletions(-)

diff --git a/net/slirp.c b/net/slirp.c
index 0013c27..b7978be 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -135,8 +135,8 @@ static NetClientInfo net_slirp_info = {
 
 static int net_slirp_init(NetClientState *peer, const char *model,
                           const char *name, int restricted,
-                          const char *vnetwork, const char *vhost,
-                          const char *vprefix6, int vprefix6_len,
+                          bool ipv4, const char *vnetwork, const char *vhost,
+                          bool ipv6, const char *vprefix6, int vprefix6_len,
                           const char *vhost6,
                           const char *vhostname, const char *tftp_export,
                           const char *bootfile, const char *vdhcp_start,
@@ -164,6 +164,16 @@ static int net_slirp_init(NetClientState *peer, const char *model,
     char *end;
     struct slirp_config_str *config;
 
+    if (!ipv4 && (vnetwork || vhost || vnameserver))
+        return -1;
+
+    if (!ipv6 && (vprefix6 || vhost6 || vnameserver6))
+        return -1;
+
+    if (!ipv4 && !ipv6)
+        /* It doesn't make sense to disable both */
+        return -1;
+
     if (!tftp_export) {
         tftp_export = legacy_tftp_prefix;
     }
@@ -308,8 +318,8 @@ static int net_slirp_init(NetClientState *peer, const char *model,
 
     s = DO_UPCAST(SlirpState, nc, nc);
 
-    s->slirp = slirp_init(restricted, net, mask, host,
-                          ip6_prefix, vprefix6_len, ip6_host,
+    s->slirp = slirp_init(restricted, ipv4, net, mask, host,
+                          ipv6, ip6_prefix, vprefix6_len, ip6_host,
                           vhostname, tftp_export, bootfile, dhcp,
                           dns, ip6_dns, dnssearch, s);
     QTAILQ_INSERT_TAIL(&slirp_stacks, s, entry);
@@ -812,10 +822,18 @@ int net_init_slirp(const NetClientOptions *opts, const char *name,
     int ret;
     const NetdevUserOptions *user;
     const char **dnssearch;
+    int ipv4 = 1, ipv6 = 1;
 
     assert(opts->type == NET_CLIENT_OPTIONS_KIND_USER);
     user = opts->u.user.data;
 
+    if ((user->has_ipv6 && user->ipv6 && !user->has_ipv4)
+            || (user->has_ipv4 && !user->ipv4))
+        ipv4 = 0;
+    if ((user->has_ipv4 && user->ipv4 && !user->has_ipv6)
+            || (user->has_ipv6 && !user->ipv6))
+        ipv6 = 0;
+
     vnet = user->has_net ? g_strdup(user->net) :
            user->has_ip  ? g_strdup_printf("%s/24", user->ip) :
            NULL;
@@ -827,8 +845,9 @@ int net_init_slirp(const NetClientOptions *opts, const char *name,
     net_init_slirp_configs(user->hostfwd, SLIRP_CFG_HOSTFWD);
     net_init_slirp_configs(user->guestfwd, 0);
 
-    ret = net_slirp_init(peer, "user", name, user->q_restrict, vnet,
-                         user->host, user->ipv6_prefix, user->ipv6_prefixlen,
+    ret = net_slirp_init(peer, "user", name, user->q_restrict,
+                         ipv4, vnet, user->host,
+                         ipv6, user->ipv6_prefix, user->ipv6_prefixlen,
                          user->ipv6_host, user->hostname, user->tftp,
                          user->bootfile, user->dhcpstart,
                          user->dns, user->ipv6_dns, user->smb,
diff --git a/qapi-schema.json b/qapi-schema.json
index e1dd7e1..331997b 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -2425,6 +2425,12 @@
 #
 # @restrict: #optional isolate the guest from the host
 #
+# @ipv4: #optional whether to support IPv4, default true for enabled
+#        (since 2.6)
+#
+# @ipv6: #optional whether to support IPv6, default true for enabled
+#        (since 2.6)
+#
 # @ip: #optional legacy parameter, use net= instead
 #
 # @net: #optional IP network address that the guest will see, in the
@@ -2473,6 +2479,8 @@
   'data': {
     '*hostname':  'str',
     '*restrict':  'bool',
+    '*ipv4':      'bool',
+    '*ipv6':      'bool',
     '*ip':        'str',
     '*net':       'str',
     '*host':      'str',
diff --git a/qemu-options.hx b/qemu-options.hx
index 5654ce3..25e4494 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1560,8 +1560,9 @@ DEF("smb", HAS_ARG, QEMU_OPTION_smb, "", QEMU_ARCH_ALL)
 
 DEF("netdev", HAS_ARG, QEMU_OPTION_netdev,
 #ifdef CONFIG_SLIRP
-    "-netdev user,id=str[,net=addr[/mask]][,host=addr][,ipv6-net=addr[/int]]\n"
-    "         [,ipv6-host=addr][,restrict=on|off][,hostname=host][,dhcpstart=addr]\n"
+    "-netdev user,id=str[,ipv4][,net=addr[/mask]][,host=addr]\n"
+    "         [,ipv6][,ipv6-net=addr[/int]][,ipv6-host=addr]\n"
+    "         [,restrict=on|off][,hostname=host][,dhcpstart=addr]\n"
     "         [,dns=addr][,ipv6-dns=addr][,dnssearch=domain][,tftp=dir]\n"
     "         [,bootfile=f][,hostfwd=rule][,guestfwd=rule]"
 #ifndef _WIN32
@@ -1710,6 +1711,9 @@ Connect user mode stack to VLAN @var{n} (@var{n} = 0 is the default).
 @itemx name=@var{name}
 Assign symbolic name for use in monitor commands.
 
+@option{ipv4} and @option{ipv6} specify that either IPv4 or IPv6 must
+be enabled.  If neither is specified both protocols are enabled.
+
 @item net=@var{addr}[/@var{mask}]
 Set IP network address the guest will see. Optionally specify the netmask,
 either in the form a.b.c.d or as number of valid top-most bits. Default is
diff --git a/slirp/ip6_icmp.c b/slirp/ip6_icmp.c
index 9d61349..09571bc 100644
--- a/slirp/ip6_icmp.c
+++ b/slirp/ip6_icmp.c
@@ -24,6 +24,10 @@ static void ra_timer_handler(void *opaque)
 
 void icmp6_init(Slirp *slirp)
 {
+    if (!slirp->in6_enabled) {
+        return;
+    }
+
     slirp->ra_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, ra_timer_handler, slirp);
     timer_mod(slirp->ra_timer,
               qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + NDP_Interval);
@@ -31,6 +35,10 @@ void icmp6_init(Slirp *slirp)
 
 void icmp6_cleanup(Slirp *slirp)
 {
+    if (!slirp->in6_enabled) {
+        return;
+    }
+
     timer_del(slirp->ra_timer);
     timer_free(slirp->ra_timer);
 }
diff --git a/slirp/ip6_input.c b/slirp/ip6_input.c
index c0b11e7..ac2e3ea 100644
--- a/slirp/ip6_input.c
+++ b/slirp/ip6_input.c
@@ -24,6 +24,11 @@ void ip6_cleanup(Slirp *slirp)
 void ip6_input(struct mbuf *m)
 {
     struct ip6 *ip6;
+    Slirp *slirp = m->slirp;
+
+    if (!slirp->in6_enabled) {
+        goto bad;
+    }
 
     DEBUG_CALL("ip6_input");
     DEBUG_ARG("m = %lx", (long)m);
diff --git a/slirp/ip_input.c b/slirp/ip_input.c
index 12f173d..ccbcc79 100644
--- a/slirp/ip_input.c
+++ b/slirp/ip_input.c
@@ -80,6 +80,10 @@ ip_input(struct mbuf *m)
 	register struct ip *ip;
 	int hlen;
 
+	if (!slirp->in_enabled) {
+		goto bad;
+	}
+
 	DEBUG_CALL("ip_input");
 	DEBUG_ARG("m = %p", m);
 	DEBUG_ARG("m_len = %d", m->m_len);
diff --git a/slirp/libslirp.h b/slirp/libslirp.h
index c4b25c9..127aa41 100644
--- a/slirp/libslirp.h
+++ b/slirp/libslirp.h
@@ -8,8 +8,9 @@ typedef struct Slirp Slirp;
 
 int get_dns_addr(struct in_addr *pdns_addr);
 
-Slirp *slirp_init(int restricted, struct in_addr vnetwork,
+Slirp *slirp_init(int restricted, bool in_enabled, struct in_addr vnetwork,
                   struct in_addr vnetmask, struct in_addr vhost,
+                  bool in6_enabled,
                   struct in6_addr vprefix_addr6, uint8_t vprefix_len,
                   struct in6_addr vhost6, const char *vhostname,
                   const char *tftp_path, const char *bootfile,
diff --git a/slirp/slirp.c b/slirp/slirp.c
index 9ccf415..6256c89 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -199,8 +199,9 @@ static void slirp_init_once(void)
 static void slirp_state_save(QEMUFile *f, void *opaque);
 static int slirp_state_load(QEMUFile *f, void *opaque, int version_id);
 
-Slirp *slirp_init(int restricted, struct in_addr vnetwork,
+Slirp *slirp_init(int restricted, bool in_enabled, struct in_addr vnetwork,
                   struct in_addr vnetmask, struct in_addr vhost,
+                  bool in6_enabled,
                   struct in6_addr vprefix_addr6, uint8_t vprefix_len,
                   struct in6_addr vhost6, const char *vhostname,
                   const char *tftp_path, const char *bootfile,
@@ -215,6 +216,9 @@ Slirp *slirp_init(int restricted, struct in_addr vnetwork,
     slirp->grand = g_rand_new();
     slirp->restricted = restricted;
 
+    slirp->in_enabled = in_enabled;
+    slirp->in6_enabled = in6_enabled;
+
     if_init(slirp);
     ip_init(slirp);
     ip6_init(slirp);
@@ -693,6 +697,10 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
     int ar_op;
     struct ex_list *ex_ptr;
 
+    if (!slirp->in_enabled) {
+        return;
+    }
+
     ar_op = ntohs(ah->ar_op);
     switch(ar_op) {
     case ARPOP_REQUEST:
diff --git a/slirp/slirp.h b/slirp/slirp.h
index 9ad88e7..0b84027 100644
--- a/slirp/slirp.h
+++ b/slirp/slirp.h
@@ -179,6 +179,8 @@ struct Slirp {
     u_int last_slowtimo;
     bool do_slowtimo;
 
+    bool in_enabled, in6_enabled;
+
     /* virtual network configuration */
     struct in_addr vnetwork_addr;
     struct in_addr vnetwork_mask;
-- 
2.8.0.rc3

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

* Re: [Qemu-devel] [PATCHv4 1/2] Rework ipv6 options
  2016-03-24 23:34 ` [Qemu-devel] [PATCHv4 1/2] Rework ipv6 options Samuel Thibault
@ 2016-03-28 15:00   ` Eric Blake
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Blake @ 2016-03-28 15:00 UTC (permalink / raw)
  To: Samuel Thibault, qemu-devel; +Cc: jan.kiszka, thuth, jasowang, armbru

[-- Attachment #1: Type: text/plain, Size: 685 bytes --]

On 03/24/2016 05:34 PM, Samuel Thibault wrote:
> Rename the recently-added ip6-foo options into ipv6-foo options, to make
> them coherent with other ipv6 options.
> 
> Also rework the documentation.

Needs to go in to 2.6 before we bake in the wrong names.

> 
> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> ---
>  net/slirp.c      |  6 +++---
>  qapi-schema.json | 25 ++++++++++++++++---------
>  qemu-options.hx  | 18 ++++++++++--------
>  3 files changed, 29 insertions(+), 20 deletions(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

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

* Re: [Qemu-devel] [PATCHv4 2/2] slirp: Allow disabling IPv4 or IPv6
  2016-03-24 23:34 ` [Qemu-devel] [PATCHv4 2/2] slirp: Allow disabling IPv4 or IPv6 Samuel Thibault
@ 2016-03-28 15:12   ` Eric Blake
  2016-03-28 23:46     ` Samuel Thibault
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Blake @ 2016-03-28 15:12 UTC (permalink / raw)
  To: Samuel Thibault, qemu-devel; +Cc: jan.kiszka, thuth, jasowang, armbru

[-- Attachment #1: Type: text/plain, Size: 1295 bytes --]

On 03/24/2016 05:34 PM, Samuel Thibault wrote:
> Add ipv4 and ipv6 boolean options, so the user can setup IPv4-only and
> IPv6-only network environments.
> 
> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> 
> ---
> 

> @@ -812,10 +822,18 @@ int net_init_slirp(const NetClientOptions *opts, const char *name,
>      int ret;
>      const NetdevUserOptions *user;
>      const char **dnssearch;
> +    int ipv4 = 1, ipv6 = 1;

These should be bool, and set to true.

>  
>      assert(opts->type == NET_CLIENT_OPTIONS_KIND_USER);
>      user = opts->u.user.data;
>  
> +    if ((user->has_ipv6 && user->ipv6 && !user->has_ipv4)
> +            || (user->has_ipv4 && !user->ipv4))
> +        ipv4 = 0;

Inconsistent with current qemu style.  Should be:

    if ((user->has_ipv6 && user->ipv6 && !user->has_ipv4) ||
        (user->has_ipv4 && !user->ipv4)) {
        ipv4 = false;
    }

In particular, the missing {} (should) fail ./scripts/checkpatch.pl.

> +    if ((user->has_ipv4 && user->ipv4 && !user->has_ipv6)
> +            || (user->has_ipv6 && !user->ipv6))
> +        ipv6 = 0;

More missing {} and unusual indentation.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

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

* Re: [Qemu-devel] [PATCHv4 2/2] slirp: Allow disabling IPv4 or IPv6
  2016-03-28 15:12   ` Eric Blake
@ 2016-03-28 23:46     ` Samuel Thibault
  0 siblings, 0 replies; 6+ messages in thread
From: Samuel Thibault @ 2016-03-28 23:46 UTC (permalink / raw)
  To: Eric Blake; +Cc: jasowang, jan.kiszka, thuth, qemu-devel, armbru

Eric Blake, on Mon 28 Mar 2016 09:12:04 -0600, wrote:
> > +    if ((user->has_ipv6 && user->ipv6 && !user->has_ipv4)
> > +            || (user->has_ipv4 && !user->ipv4))
> > +        ipv4 = 0;
> 
> Inconsistent with current qemu style.  Should be:
> 
>     if ((user->has_ipv6 && user->ipv6 && !user->has_ipv4) ||
>         (user->has_ipv4 && !user->ipv4)) {

Ah, I didn't know about that one.  I personally prefer it the other way,
but alright.

> In particular, the missing {} (should) fail ./scripts/checkpatch.pl.

Right, sorry, it seems I forgot to re-run the script after the last
rework.

Samuel

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

end of thread, other threads:[~2016-03-28 23:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-24 23:34 [Qemu-devel] [PATCHv4 0/2] Rework ipv6 options, add ipv4/ipv6 enabling/disabling options Samuel Thibault
2016-03-24 23:34 ` [Qemu-devel] [PATCHv4 1/2] Rework ipv6 options Samuel Thibault
2016-03-28 15:00   ` Eric Blake
2016-03-24 23:34 ` [Qemu-devel] [PATCHv4 2/2] slirp: Allow disabling IPv4 or IPv6 Samuel Thibault
2016-03-28 15:12   ` Eric Blake
2016-03-28 23:46     ` Samuel Thibault

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.