]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
bridge: vlan: Remove paranoid check
authorBenjamin Poirier <bpoirier@nvidia.com>
Mon, 11 Dec 2023 14:07:19 +0000 (09:07 -0500)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 22 Dec 2023 17:54:23 +0000 (09:54 -0800)
To make the code lighter, remove the check on the actual print_range()
output width. In the odd case that an out-of-range, wide vlan id is
printed, printf() will treat the negative field width as positive and the
output will simply be further misaligned.

Suggested-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Tested-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
bridge/vlan.c

index 797b7802ad25a3dbec3db7e9036557e60ca3109e..7a175b047b9226ababdc08eb3c79c314dd39c127 100644 (file)
@@ -661,13 +661,8 @@ static void print_vlan_tunnel_info(struct rtattr *tb, int ifindex)
 
                open_json_object(NULL);
                width = print_range("vlan", last_vid_start, tunnel_vid);
-               if (width <= VLAN_ID_LEN) {
-                       if (!is_json_context())
-                               printf("%-*s  ", VLAN_ID_LEN - width, "");
-               } else {
-                       fprintf(stderr, "BUG: vlan range too wide, %u\n",
-                               width);
-               }
+               if (!is_json_context())
+                       printf("%-*s  ", VLAN_ID_LEN - width, "");
                print_range("tunid", last_tunid_start, tunnel_id);
                close_json_object();
                print_nl();