Skip to contentSkip to conversation

netfront: unregister net device at backend_changed() if network_connect() failed

PATCH In review Joe Jin 2 participants 2 messages Nov 18, 2008 Xen hypervisor interface

lore
Share & tools
lore

Joe Jin

author
#0 lore raw

PATCH 1/1 netfront: unregister net device at backend_changed() if network_connect() failed

Subject: netfront: unregister net device at backend_changed() if network_connect() failed
From: Joe Jin <[email protected]>

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.

---
 netfront.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/xen/netfront/netfront.c +3 -1
diff -r 2fb13b8cbe13 drivers/xen/netfront/netfront.c
@@ -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;
#1 lore raw
Quoted 7 lines · Joe Jin

Subject: netfront: unregister net device at backend_changed() if network_connect() failed
From: Joe Jin <[email protected]>

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.

If virtual devices are failing to initialise then a confusing no-mac interface is presumably the least of the user's worries?

-- Keir