]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkctl: obey --full with lldp command
authorSimon Ellmann <simon.ellmann@tum.de>
Wed, 13 Apr 2022 19:53:10 +0000 (04:53 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 15 Apr 2022 15:51:26 +0000 (17:51 +0200)
Do not ellipsize output when -l or --full is handed to networkctl lldp.

Fixes #22806.

src/network/networkctl.c

index d656027ec45e0133c136c419fb28798b8653221c..56baf125bd6cd5658528554cc7a6401bad0c297f 100644 (file)
@@ -2491,11 +2491,11 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
         pager_open(arg_pager_flags);
 
         table = table_new("link",
-                          "chassis id",
-                          "system name",
+                          "chassis-id",
+                          "system-name",
                           "caps",
-                          "port id",
-                          "port description");
+                          "port-id",
+                          "port-description");
         if (!table)
                 return log_oom();
 
@@ -2504,24 +2504,9 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
 
         table_set_header(table, arg_legend);
 
-        assert_se(cell = table_get_cell(table, 0, 0));
-        table_set_minimum_width(table, cell, 16);
-
-        assert_se(cell = table_get_cell(table, 0, 1));
-        table_set_minimum_width(table, cell, 17);
-
-        assert_se(cell = table_get_cell(table, 0, 2));
-        table_set_minimum_width(table, cell, 16);
-
         assert_se(cell = table_get_cell(table, 0, 3));
         table_set_minimum_width(table, cell, 11);
 
-        assert_se(cell = table_get_cell(table, 0, 4));
-        table_set_minimum_width(table, cell, 17);
-
-        assert_se(cell = table_get_cell(table, 0, 5));
-        table_set_minimum_width(table, cell, 16);
-
         for (int i = 0; i < c; i++) {
                 _cleanup_fclose_ FILE *f = NULL;
 
@@ -2534,9 +2519,9 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
                 }
 
                 for (;;) {
-                        _cleanup_free_ char *cid = NULL, *pid = NULL, *sname = NULL, *pdesc = NULL, *capabilities = NULL;
                         const char *chassis_id = NULL, *port_id = NULL, *system_name = NULL, *port_description = NULL;
                         _cleanup_(sd_lldp_neighbor_unrefp) sd_lldp_neighbor *n = NULL;
+                        _cleanup_free_ char *capabilities = NULL;
                         uint16_t cc;
 
                         r = next_lldp_neighbor(f, &n);
@@ -2552,30 +2537,6 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
                         (void) sd_lldp_neighbor_get_system_name(n, &system_name);
                         (void) sd_lldp_neighbor_get_port_description(n, &port_description);
 
-                        if (chassis_id) {
-                                cid = ellipsize(chassis_id, 17, 100);
-                                if (cid)
-                                        chassis_id = cid;
-                        }
-
-                        if (port_id) {
-                                pid = ellipsize(port_id, 17, 100);
-                                if (pid)
-                                        port_id = pid;
-                        }
-
-                        if (system_name) {
-                                sname = ellipsize(system_name, 16, 100);
-                                if (sname)
-                                        system_name = sname;
-                        }
-
-                        if (port_description) {
-                                pdesc = ellipsize(port_description, 16, 100);
-                                if (pdesc)
-                                        port_description = pdesc;
-                        }
-
                         if (sd_lldp_neighbor_get_enabled_capabilities(n, &cc) >= 0) {
                                 capabilities = lldp_capabilities_to_string(cc);
                                 all |= cc;