Skip to contentSkip to conversation

net: add print link status of nic in print_net_client function

PATCH New ZhiPeng Lu 1 participant 1 message Nov 3, 2017 Networking

lore
Share & tools
lore

ZhiPeng Lu

author
#0 lore raw

PATCH v2 1/1 net: add print link status of nic in print_net_client function

We can directly know the information of vm by executing "info network" command,
including the link state of nics, without executing other commands again.

---
v2: correct commit messages

---
 net/net.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
net/net.c +5 -1
index 39ef546..9e349cb 100644
@@ -1298,10 +1298,14 @@ void print_net_client(Monitor *mon, NetClientState *nc)
 {
     NetFilterState *nf;
 
-    monitor_printf(mon, "%s: index=%d,type=%s,%s\n", nc->name,
+    monitor_printf(mon, "%s: index=%d,type=%s,%s", nc->name,
                    nc->queue_index,
                    NetClientDriver_str(nc->info->type),
                    nc->info_str);
+    if (nc->info->type == NET_CLIENT_DRIVER_NIC) {
+        monitor_printf(mon, ",link status:%s", nc->link_down ? "down" : "up");
+    }
+    monitor_printf(mon, "\n");
     if (!QTAILQ_EMPTY(&nc->filters)) {
         monitor_printf(mon, "filters:\n");
     }
Signature · 1 line
1.8.3.1