iwinfo: print HT operation only if present
authorAleksander Jan Bajkowski <[email protected]>
Sat, 15 Mar 2025 14:00:32 +0000 (15:00 +0100)
committerRobert Marko <[email protected]>
Fri, 7 Nov 2025 11:21:23 +0000 (12:21 +0100)
HT Operation is empty in the 6GHz band, where only 802.11 ax (HE)
and 802.11 be (EHT) are allowed, and in 802.11 legacy modes.

Example:
Cell 19 - Address: xx:xx:xx:xx:xx:xx
          ESSID: "OpenWrt"
          Mode: Master  Frequency: 5.955 GHz  Band: 6 GHz  Channel: 1
          Signal: -20 dBm  Quality: 70/70
          Encryption: WPA3 SAE (CCMP)
          HT Operation:
                    Primary Channel: 0
                    Secondary Channel Offset: no secondary
                    Channel Width: 20 MHz
          HE Operation:
                    Center Frequency 1: 7
                    Center Frequency 2: 15
                    Channel Width: 160 MHz
          EHT Operation:
                    Center Frequency 1: 15
                    Center Frequency 2: 31
                    Channel Width: 320 MHz

Fixes: ea28dfb5f957 ("iwinfo: export ht and vht operation in scan results")
Signed-off-by: Aleksander Jan Bajkowski <[email protected]>
Link: https://github.com/openwrt/iwinfo/pull/21
Signed-off-by: Robert Marko <[email protected]>
iwinfo_cli.c

index 6f87d98b4f25596f3d286f3c43bd99af4054871d..0966d1b535047d462dd0d9f16717260cd10718c4 100644 (file)
@@ -700,13 +700,15 @@ static void print_scanlist(const struct iwinfo_ops *iw, const char *ifname)
                        format_quality_max(e->quality_max));
                printf("          Encryption: %s\n",
                        format_encryption(&e->crypto));
-               printf("          HT Operation:\n");
-               printf("                    Primary Channel: %d\n",
-                       e->ht_chan_info.primary_chan);
-               printf("                    Secondary Channel Offset: %s\n",
-                       ht_secondary_offset[e->ht_chan_info.secondary_chan_off]);
-               printf("                    Channel Width: %s\n",
-                       format_chan_width(false, e->ht_chan_info.chan_width));
+               if (e->ht_chan_info.primary_chan) {
+                       printf("          HT Operation:\n");
+                       printf("                    Primary Channel: %d\n",
+                               e->ht_chan_info.primary_chan);
+                       printf("                    Secondary Channel Offset: %s\n",
+                               ht_secondary_offset[e->ht_chan_info.secondary_chan_off]);
+                       printf("                    Channel Width: %s\n",
+                               format_chan_width(false, e->ht_chan_info.chan_width));
+               }
 
                if (e->vht_chan_info.center_chan_1) {
                        printf("          VHT Operation:\n");