summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnsuel Smith <ansuelsmth@gmail.com>2021-01-06 05:57:39 +0100
committerDaniel Golle <daniel@makrotopia.org>2021-01-06 19:42:14 +0000
commitea7f4717f8b210a8fa491d288ff99ef74409dbff (patch)
treeecfd186662af715748bdab86600fad727df99a04
parent5c15f5736de0c329bccd1a39264a7bd00299f728 (diff)
downloadrpcd-ea7f4717f8b210a8fa491d288ff99ef74409dbff.tar.gz
iwinfo: include ht_operation data only if available
Check if ht_operation data are present and add them accordingly. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
-rw-r--r--iwinfo.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/iwinfo.c b/iwinfo.c
index 7c9a656..63ff2a1 100644
--- a/iwinfo.c
+++ b/iwinfo.c
@@ -455,11 +455,13 @@ rpc_iwinfo_scan(struct ubus_context *ctx, struct ubus_object *obj,
blobmsg_add_u32(&buf, "quality", e->quality);
blobmsg_add_u32(&buf, "quality_max", e->quality_max);
- t = blobmsg_open_table(&buf, "ht_operation");
- blobmsg_add_u32(&buf, "primary_channel", e->ht_chan_info.primary_chan);
- blobmsg_add_string(&buf, "secondary_channel_offset", ht_secondary_offset[e->ht_chan_info.secondary_chan_off]);
- blobmsg_add_u32(&buf, "channel_width", ht_chan_width[e->ht_chan_info.chan_width]);
- blobmsg_close_table(&buf, t);
+ if (e->ht_chan_info.primary_chan) {
+ t = blobmsg_open_table(&buf, "ht_operation");
+ blobmsg_add_u32(&buf, "primary_channel", e->ht_chan_info.primary_chan);
+ blobmsg_add_string(&buf, "secondary_channel_offset", ht_secondary_offset[e->ht_chan_info.secondary_chan_off]);
+ blobmsg_add_u32(&buf, "channel_width", ht_chan_width[e->ht_chan_info.chan_width]);
+ blobmsg_close_table(&buf, t);
+ }
if (e->vht_chan_info.center_chan_1) {
t = blobmsg_open_table(&buf, "vht_operation");