]> git.proxmox.com Git - mirror_corosync.git/commitdiff
cfgtool: Simplify output a bit for link status
authorJan Friesse <jfriesse@redhat.com>
Tue, 3 Mar 2020 14:07:55 +0000 (15:07 +0100)
committerJan Friesse <jfriesse@redhat.com>
Wed, 4 Mar 2020 14:19:13 +0000 (15:19 +0100)
Display words connected/disconnected instead of 1/0 and show enabled
status only when link is not enabled (shouldn't happen).

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
tools/corosync-cfgtool.c

index f1c12a4004442c68edb396e1124438efd051194f..a029e48e626ba627c3ebbcbce61fc013d5c9a8ff 100644 (file)
@@ -202,8 +202,22 @@ linkstatusget_do (char *interface_name, int brief)
 
                                                if (stat_ch >= '0' && stat_ch <= '9') {
                                                        t = stat_ch - '0';
-                                                       printf("link enabled:%d\t", t&1? 1 : 0);
-                                                       printf("link connected:%d\n", t&2? 1: 0);
+
+                                                       /*
+                                                        * bit 0 - enabled
+                                                        * bit 1 - connected
+                                                        * bit 2 - dynconnected
+                                                        */
+                                                       if (t & 0x2) {
+                                                               printf("connected");
+                                                       } else {
+                                                               printf("disconnected");
+                                                       }
+
+                                                       if (!(t & 0x1)) {
+                                                               printf(" (not enabled)");
+                                                       }
+                                                       printf("\n");
                                                } else if (stat_ch == 'n') {
                                                        printf("localhost\n");
                                                } else if (stat_ch == '?') {