Skip to contentSkip to conversation

net: Mark 'vlan' parameter as deprecated

PATCH In review Thomas Huth 2 participants 4 messages Jan 24, 2017 – Jan 25, 2017 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: Mark 'vlan' parameter as deprecated

The 'vlan' parameter is a continuous source of confusion for the users, many people mix it up with the more common term VLAN (the link layer packet encapsulation), and even if they realize that the QEMU 'vlan' is rather some kind of network hub emulation, there is still a high risk that they configure their QEMU networking in a wrong way with this parameter (e.g. by hooking NICs together, so they get a 'loopback' between one and the other NIC).
Thus at one point in time, we should finally get rid of the 'vlan' feature in QEMU. Let's do a first step in this direction by declaring the 'vlan' parameter as deprecated and informing the users to use the 'netdev' parameter instead.

---
 net/net.c | 6 ++++++
 1 file changed, 6 insertions(+)
net/net.c +6 -0
index 939fe31..fb7af3a 100644
@@ -970,6 +970,7 @@ static int net_client_init1(const void *object, bool is_netdev, Error **errp)
     const Netdev *netdev;
     const char *name;
     NetClientState *peer = NULL;
+    static bool vlan_warned;
 
     if (is_netdev) {
         netdev = object;
@@ -1050,6 +1051,11 @@ static int net_client_init1(const void *object, bool is_netdev, Error **errp)
             !opts->u.nic.data->has_netdev) {
             peer = net_hub_add_port(net->has_vlan ? net->vlan : 0, NULL);
         }
+
+        if (net->has_vlan && !vlan_warned) {
+            error_report("'vlan' is deprecated. Please use 'netdev' instead.");
+            vlan_warned = true;
+        }
     }
 
     if (net_client_init_fun[netdev->type](netdev, name, peer, errp) < 0) {
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 31 lines · Thomas Huth

The 'vlan' parameter is a continuous source of confusion for the users, many people mix it up with the more common term VLAN (the link layer packet encapsulation), and even if they realize that the QEMU 'vlan' is rather some kind of network hub emulation, there is still a high risk that they configure their QEMU networking in a wrong way with this parameter (e.g. by hooking NICs together, so they get a 'loopback' between one and the other NIC).
Thus at one point in time, we should finally get rid of the 'vlan' feature in QEMU. Let's do a first step in this direction by declaring the 'vlan' parameter as deprecated and informing the users to use the 'netdev' parameter instead.

---
  net/net.c | 6 ++++++
  1 file changed, 6 insertions(+)
net/net.c +1 -0
index 939fe31..fb7af3a 100644
@@ -970,6 +970,7 @@ static int net_client_init1(const void *object, bool is_netdev, Error **errp)
      const Netdev *netdev;
      const char *name;
      NetClientState *peer = NULL;
+    static bool vlan_warned;
 
      if (is_netdev) {
          netdev = object;
@@ -1050,6 +1051,11 @@ static int net_client_init1(const void *object, bool is_netdev, Error **errp)
              !opts->u.nic.data->has_netdev) {

net/net.c static int net_client_init1(const void *object, bool is_netdev, Error **errp) · line 1061

Quoted 10 lines
net/net.c +5 -0
              peer = net_hub_add_port(net->has_vlan ? net->vlan : 0, NULL);
          }
+
+        if (net->has_vlan && !vlan_warned) {
+            error_report("'vlan' is deprecated. Please use 'netdev' instead.");
+            vlan_warned = true;
+        }
      }
 
      if (net_client_init_fun[netdev->type](netdev, name, peer, errp) < 0) {

Looks good, but do really want only warn once? Consider we have monitor command e.g "host_net_add".

Thanks

#2 lore raw
Quoted 42 lines · Jason Wang
Quoted 39 lines · Thomas Huth

The 'vlan' parameter is a continuous source of confusion for the users, many people mix it up with the more common term VLAN (the link layer packet encapsulation), and even if they realize that the QEMU 'vlan' is rather some kind of network hub emulation, there is still a high risk that they configure their QEMU networking in a wrong way with this parameter (e.g. by hooking NICs together, so they get a 'loopback' between one and the other NIC).
Thus at one point in time, we should finally get rid of the 'vlan' feature in QEMU. Let's do a first step in this direction by declaring the 'vlan' parameter as deprecated and informing the users to use the 'netdev' parameter instead.

---
  net/net.c | 6 ++++++
  1 file changed, 6 insertions(+)
net/net.c +4 -0
index 939fe31..fb7af3a 100644
@@ -970,6 +970,7 @@ static int net_client_init1(const void *object,
 bool is_netdev, Error **errp)
      const Netdev *netdev;
      const char *name;
      NetClientState *peer = NULL;
+    static bool vlan_warned;
        if (is_netdev) {
          netdev = object;
@@ -1050,6 +1051,11 @@ static int net_client_init1(const void *object,
 bool is_netdev, Error **errp)
              !opts->u.nic.data->has_netdev) {
              peer = net_hub_add_port(net->has_vlan ? net->vlan : 0,
 NULL);
          }
+
+        if (net->has_vlan && !vlan_warned) {
+            error_report("'vlan' is deprecated. Please use 'netdev'
 instead.");
Quoted 8 lines
Quoted 5 lines
net/net.c +2 -0
+            vlan_warned = true;
+        }
      }
        if (net_client_init_fun[netdev->type](netdev, name, peer,

errp) < 0) {

Looks good, but do really want only warn once? Consider we have monitor command e.g "host_net_add".

I don't mind ... I can remove the "vlan_warned" check, but then you'll get a lot of error messages at once if you start QEMU with multiple "-net" parameters that use "vlan=...". Is that ok for you? If yes, I'll send an updated v2 of my patch without that "vlan_warned" check.

Thomas

#3 lore raw
Quoted 49 lines · Thomas Huth
Quoted 40 lines · Jason Wang
Quoted 38 lines · Thomas Huth

The 'vlan' parameter is a continuous source of confusion for the users, many people mix it up with the more common term VLAN (the link layer packet encapsulation), and even if they realize that the QEMU 'vlan' is rather some kind of network hub emulation, there is still a high risk that they configure their QEMU networking in a wrong way with this parameter (e.g. by hooking NICs together, so they get a 'loopback' between one and the other NIC).
Thus at one point in time, we should finally get rid of the 'vlan' feature in QEMU. Let's do a first step in this direction by declaring the 'vlan' parameter as deprecated and informing the users to use the 'netdev' parameter instead.

---
   net/net.c | 6 ++++++
   1 file changed, 6 insertions(+)
net/net.c +4 -0
index 939fe31..fb7af3a 100644
@@ -970,6 +970,7 @@ static int net_client_init1(const void *object,
 bool is_netdev, Error **errp)
       const Netdev *netdev;
       const char *name;
       NetClientState *peer = NULL;
+    static bool vlan_warned;
         if (is_netdev) {
           netdev = object;
@@ -1050,6 +1051,11 @@ static int net_client_init1(const void *object,
 bool is_netdev, Error **errp)
               !opts->u.nic.data->has_netdev) {
               peer = net_hub_add_port(net->has_vlan ? net->vlan : 0,
 NULL);
           }
+
+        if (net->has_vlan && !vlan_warned) {
+            error_report("'vlan' is deprecated. Please use 'netdev'
Quoted 8 lines
Quoted 6 lines
net/net.c +2 -0
 instead.");
+            vlan_warned = true;
+        }
       }
         if (net_client_init_fun[netdev->type](netdev, name, peer,

errp) < 0) {

Looks good, but do really want only warn once? Consider we have monitor command e.g "host_net_add".

Quoted 7 lines

I don't mind ... I can remove the "vlan_warned" check, but then you'll get a lot of error messages at once if you start QEMU with multiple "-net" parameters that use "vlan=...". Is that ok for you? If yes, I'll send an updated v2 of my patch without that "vlan_warned" check.

Thomas

You're right, this version looks better, applied to -net.

Thanks