WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [patch] netfront: unregister net device at backend_changed()

To: Xen-devel@xxxxxxxxxxxxxxxxxxx, keir.fraser@xxxxxxxxxxxxx
Subject: [Xen-devel] [patch] netfront: unregister net device at backend_changed() if network_connect() failed
From: Joe Jin <joe.jin@xxxxxxxxxx>
Date: Tue, 18 Nov 2008 14:01:58 +0800
Cc:
Delivery-date: Mon, 17 Nov 2008 22:02:43 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.2.2i
Subject: netfront: unregister net device at backend_changed() if 
network_connect() failed
From: Joe Jin <joe.jin@xxxxxxxxxx>

When network_connect() failed on backend_changed(), need to call 
unregister_netdev() to unregister the device, otherwise at vm maybe create
a no-mac address net device, the device sometime might confuse user.

Signed-off-by: Joe Jin <joe.jin@xxxxxxxxxx>
---
 netfront.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff -r 2fb13b8cbe13 drivers/xen/netfront/netfront.c
--- a/drivers/xen/netfront/netfront.c   Thu Oct 30 13:34:43 2008 +0000
+++ b/drivers/xen/netfront/netfront.c   Tue Nov 18 13:52:34 2008 +0800
@@ -549,8 +549,10 @@
        case XenbusStateInitWait:
                if (dev->state != XenbusStateInitialising)
                        break;
-               if (network_connect(netdev) != 0)
+               if (network_connect(netdev) != 0) {
+                       unregister_netdev(netdev);
                        break;
+               }
                xenbus_switch_state(dev, XenbusStateConnected);
                send_fake_arp(netdev);
                break;




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>